app.js 1.8 MB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687136881368913690136911369213693136941369513696136971369813699137001370113702137031370413705137061370713708137091371013711137121371313714137151371613717137181371913720137211372213723137241372513726137271372813729137301373113732137331373413735137361373713738137391374013741137421374313744137451374613747137481374913750137511375213753137541375513756137571375813759137601376113762137631376413765137661376713768137691377013771137721377313774137751377613777137781377913780137811378213783137841378513786137871378813789137901379113792137931379413795137961379713798137991380013801138021380313804138051380613807138081380913810138111381213813138141381513816138171381813819138201382113822138231382413825138261382713828138291383013831138321383313834138351383613837138381383913840138411384213843138441384513846138471384813849138501385113852138531385413855138561385713858138591386013861138621386313864138651386613867138681386913870138711387213873138741387513876138771387813879138801388113882138831388413885138861388713888138891389013891138921389313894138951389613897138981389913900139011390213903139041390513906139071390813909139101391113912139131391413915139161391713918139191392013921139221392313924139251392613927139281392913930139311393213933139341393513936139371393813939139401394113942139431394413945139461394713948139491395013951139521395313954139551395613957139581395913960139611396213963139641396513966139671396813969139701397113972139731397413975139761397713978139791398013981139821398313984139851398613987139881398913990139911399213993139941399513996139971399813999140001400114002140031400414005140061400714008140091401014011140121401314014140151401614017140181401914020140211402214023140241402514026140271402814029140301403114032140331403414035140361403714038140391404014041140421404314044140451404614047140481404914050140511405214053140541405514056140571405814059140601406114062140631406414065140661406714068140691407014071140721407314074140751407614077140781407914080140811408214083140841408514086140871408814089140901409114092140931409414095140961409714098140991410014101141021410314104141051410614107141081410914110141111411214113141141411514116141171411814119141201412114122141231412414125141261412714128141291413014131141321413314134141351413614137141381413914140141411414214143141441414514146141471414814149141501415114152141531415414155141561415714158141591416014161141621416314164141651416614167141681416914170141711417214173141741417514176141771417814179141801418114182141831418414185141861418714188141891419014191141921419314194141951419614197141981419914200142011420214203142041420514206142071420814209142101421114212142131421414215142161421714218142191422014221142221422314224142251422614227142281422914230142311423214233142341423514236142371423814239142401424114242142431424414245142461424714248142491425014251142521425314254142551425614257142581425914260142611426214263142641426514266142671426814269142701427114272142731427414275142761427714278142791428014281142821428314284142851428614287142881428914290142911429214293142941429514296142971429814299143001430114302143031430414305143061430714308143091431014311143121431314314143151431614317143181431914320143211432214323143241432514326143271432814329143301433114332143331433414335143361433714338143391434014341143421434314344143451434614347143481434914350143511435214353143541435514356143571435814359143601436114362143631436414365143661436714368143691437014371143721437314374143751437614377143781437914380143811438214383143841438514386143871438814389143901439114392143931439414395143961439714398143991440014401144021440314404144051440614407144081440914410144111441214413144141441514416144171441814419144201442114422144231442414425144261442714428144291443014431144321443314434144351443614437144381443914440144411444214443144441444514446144471444814449144501445114452144531445414455144561445714458144591446014461144621446314464144651446614467144681446914470144711447214473144741447514476144771447814479144801448114482144831448414485144861448714488144891449014491144921449314494144951449614497144981449914500145011450214503145041450514506145071450814509145101451114512145131451414515145161451714518145191452014521145221452314524145251452614527145281452914530145311453214533145341453514536145371453814539145401454114542145431454414545145461454714548145491455014551145521455314554145551455614557145581455914560145611456214563145641456514566145671456814569145701457114572145731457414575145761457714578145791458014581145821458314584145851458614587145881458914590145911459214593145941459514596145971459814599146001460114602146031460414605146061460714608146091461014611146121461314614146151461614617146181461914620146211462214623146241462514626146271462814629146301463114632146331463414635146361463714638146391464014641146421464314644146451464614647146481464914650146511465214653146541465514656146571465814659146601466114662146631466414665146661466714668146691467014671146721467314674146751467614677146781467914680146811468214683146841468514686146871468814689146901469114692146931469414695146961469714698146991470014701147021470314704147051470614707147081470914710147111471214713147141471514716147171471814719147201472114722147231472414725147261472714728147291473014731147321473314734147351473614737147381473914740147411474214743147441474514746147471474814749147501475114752147531475414755147561475714758147591476014761147621476314764147651476614767147681476914770147711477214773147741477514776147771477814779147801478114782147831478414785147861478714788147891479014791147921479314794147951479614797147981479914800148011480214803148041480514806148071480814809148101481114812148131481414815148161481714818148191482014821148221482314824148251482614827148281482914830148311483214833148341483514836148371483814839148401484114842148431484414845148461484714848148491485014851148521485314854148551485614857148581485914860148611486214863148641486514866148671486814869148701487114872148731487414875148761487714878148791488014881148821488314884148851488614887148881488914890148911489214893148941489514896148971489814899149001490114902149031490414905149061490714908149091491014911149121491314914149151491614917149181491914920149211492214923149241492514926149271492814929149301493114932149331493414935149361493714938149391494014941149421494314944149451494614947149481494914950149511495214953149541495514956149571495814959149601496114962149631496414965149661496714968149691497014971149721497314974149751497614977149781497914980149811498214983149841498514986149871498814989149901499114992149931499414995149961499714998149991500015001150021500315004150051500615007150081500915010150111501215013150141501515016150171501815019150201502115022150231502415025150261502715028150291503015031150321503315034150351503615037150381503915040150411504215043150441504515046150471504815049150501505115052150531505415055150561505715058150591506015061150621506315064150651506615067150681506915070150711507215073150741507515076150771507815079150801508115082150831508415085150861508715088150891509015091150921509315094150951509615097150981509915100151011510215103151041510515106151071510815109151101511115112151131511415115151161511715118151191512015121151221512315124151251512615127151281512915130151311513215133151341513515136151371513815139151401514115142151431514415145151461514715148151491515015151151521515315154151551515615157151581515915160151611516215163151641516515166151671516815169151701517115172151731517415175151761517715178151791518015181151821518315184151851518615187151881518915190151911519215193151941519515196151971519815199152001520115202152031520415205152061520715208152091521015211152121521315214152151521615217152181521915220152211522215223152241522515226152271522815229152301523115232152331523415235152361523715238152391524015241152421524315244152451524615247152481524915250152511525215253152541525515256152571525815259152601526115262152631526415265152661526715268152691527015271152721527315274152751527615277152781527915280152811528215283152841528515286152871528815289152901529115292152931529415295152961529715298152991530015301153021530315304153051530615307153081530915310153111531215313153141531515316153171531815319153201532115322153231532415325153261532715328153291533015331153321533315334153351533615337153381533915340153411534215343153441534515346153471534815349153501535115352153531535415355153561535715358153591536015361153621536315364153651536615367153681536915370153711537215373153741537515376153771537815379153801538115382153831538415385153861538715388153891539015391153921539315394153951539615397153981539915400154011540215403154041540515406154071540815409154101541115412154131541415415154161541715418154191542015421154221542315424154251542615427154281542915430154311543215433154341543515436154371543815439154401544115442154431544415445154461544715448154491545015451154521545315454154551545615457154581545915460154611546215463154641546515466154671546815469154701547115472154731547415475154761547715478154791548015481154821548315484154851548615487154881548915490154911549215493154941549515496154971549815499155001550115502155031550415505155061550715508155091551015511155121551315514155151551615517155181551915520155211552215523155241552515526155271552815529155301553115532155331553415535155361553715538155391554015541155421554315544155451554615547155481554915550155511555215553155541555515556155571555815559155601556115562155631556415565155661556715568155691557015571155721557315574155751557615577155781557915580155811558215583155841558515586155871558815589155901559115592155931559415595155961559715598155991560015601156021560315604156051560615607156081560915610156111561215613156141561515616156171561815619156201562115622156231562415625156261562715628156291563015631156321563315634156351563615637156381563915640156411564215643156441564515646156471564815649156501565115652156531565415655156561565715658156591566015661156621566315664156651566615667156681566915670156711567215673156741567515676156771567815679156801568115682156831568415685156861568715688156891569015691156921569315694156951569615697156981569915700157011570215703157041570515706157071570815709157101571115712157131571415715157161571715718157191572015721157221572315724157251572615727157281572915730157311573215733157341573515736157371573815739157401574115742157431574415745157461574715748157491575015751157521575315754157551575615757157581575915760157611576215763157641576515766157671576815769157701577115772157731577415775157761577715778157791578015781157821578315784157851578615787157881578915790157911579215793157941579515796157971579815799158001580115802158031580415805158061580715808158091581015811158121581315814158151581615817158181581915820158211582215823158241582515826158271582815829158301583115832158331583415835158361583715838158391584015841158421584315844158451584615847158481584915850158511585215853158541585515856158571585815859158601586115862158631586415865158661586715868158691587015871158721587315874158751587615877158781587915880158811588215883158841588515886158871588815889158901589115892158931589415895158961589715898158991590015901159021590315904159051590615907159081590915910159111591215913159141591515916159171591815919159201592115922159231592415925159261592715928159291593015931159321593315934159351593615937159381593915940159411594215943159441594515946159471594815949159501595115952159531595415955159561595715958159591596015961159621596315964159651596615967159681596915970159711597215973159741597515976159771597815979159801598115982159831598415985159861598715988159891599015991159921599315994159951599615997159981599916000160011600216003160041600516006160071600816009160101601116012160131601416015160161601716018160191602016021160221602316024160251602616027160281602916030160311603216033160341603516036160371603816039160401604116042160431604416045160461604716048160491605016051160521605316054160551605616057160581605916060160611606216063160641606516066160671606816069160701607116072160731607416075160761607716078160791608016081160821608316084160851608616087160881608916090160911609216093160941609516096160971609816099161001610116102161031610416105161061610716108161091611016111161121611316114161151611616117161181611916120161211612216123161241612516126161271612816129161301613116132161331613416135161361613716138161391614016141161421614316144161451614616147161481614916150161511615216153161541615516156161571615816159161601616116162161631616416165161661616716168161691617016171161721617316174161751617616177161781617916180161811618216183161841618516186161871618816189161901619116192161931619416195161961619716198161991620016201162021620316204162051620616207162081620916210162111621216213162141621516216162171621816219162201622116222162231622416225162261622716228162291623016231162321623316234162351623616237162381623916240162411624216243162441624516246162471624816249162501625116252162531625416255162561625716258162591626016261162621626316264162651626616267162681626916270162711627216273162741627516276162771627816279162801628116282162831628416285162861628716288162891629016291162921629316294162951629616297162981629916300163011630216303163041630516306163071630816309163101631116312163131631416315163161631716318163191632016321163221632316324163251632616327163281632916330163311633216333163341633516336163371633816339163401634116342163431634416345163461634716348163491635016351163521635316354163551635616357163581635916360163611636216363163641636516366163671636816369163701637116372163731637416375163761637716378163791638016381163821638316384163851638616387163881638916390163911639216393163941639516396163971639816399164001640116402164031640416405164061640716408164091641016411164121641316414164151641616417164181641916420164211642216423164241642516426164271642816429164301643116432164331643416435164361643716438164391644016441164421644316444164451644616447164481644916450164511645216453164541645516456164571645816459164601646116462164631646416465164661646716468164691647016471164721647316474164751647616477164781647916480164811648216483164841648516486164871648816489164901649116492164931649416495164961649716498164991650016501165021650316504165051650616507165081650916510165111651216513165141651516516165171651816519165201652116522165231652416525165261652716528165291653016531165321653316534165351653616537165381653916540165411654216543165441654516546165471654816549165501655116552165531655416555165561655716558165591656016561165621656316564165651656616567165681656916570165711657216573165741657516576165771657816579165801658116582165831658416585165861658716588165891659016591165921659316594165951659616597165981659916600166011660216603166041660516606166071660816609166101661116612166131661416615166161661716618166191662016621166221662316624166251662616627166281662916630166311663216633166341663516636166371663816639166401664116642166431664416645166461664716648166491665016651166521665316654166551665616657166581665916660166611666216663166641666516666166671666816669166701667116672166731667416675166761667716678166791668016681166821668316684166851668616687166881668916690166911669216693166941669516696166971669816699167001670116702167031670416705167061670716708167091671016711167121671316714167151671616717167181671916720167211672216723167241672516726167271672816729167301673116732167331673416735167361673716738167391674016741167421674316744167451674616747167481674916750167511675216753167541675516756167571675816759167601676116762167631676416765167661676716768167691677016771167721677316774167751677616777167781677916780167811678216783167841678516786167871678816789167901679116792167931679416795167961679716798167991680016801168021680316804168051680616807168081680916810168111681216813168141681516816168171681816819168201682116822168231682416825168261682716828168291683016831168321683316834168351683616837168381683916840168411684216843168441684516846168471684816849168501685116852168531685416855168561685716858168591686016861168621686316864168651686616867168681686916870168711687216873168741687516876168771687816879168801688116882168831688416885168861688716888168891689016891168921689316894168951689616897168981689916900169011690216903169041690516906169071690816909169101691116912169131691416915169161691716918169191692016921169221692316924169251692616927169281692916930169311693216933169341693516936169371693816939169401694116942169431694416945169461694716948169491695016951169521695316954169551695616957169581695916960169611696216963169641696516966169671696816969169701697116972169731697416975169761697716978169791698016981169821698316984169851698616987169881698916990169911699216993169941699516996169971699816999170001700117002170031700417005170061700717008170091701017011170121701317014170151701617017170181701917020170211702217023170241702517026170271702817029170301703117032170331703417035170361703717038170391704017041170421704317044170451704617047170481704917050170511705217053170541705517056170571705817059170601706117062170631706417065170661706717068170691707017071170721707317074170751707617077170781707917080170811708217083170841708517086170871708817089170901709117092170931709417095170961709717098170991710017101171021710317104171051710617107171081710917110171111711217113171141711517116171171711817119171201712117122171231712417125171261712717128171291713017131171321713317134171351713617137171381713917140171411714217143171441714517146171471714817149171501715117152171531715417155171561715717158171591716017161171621716317164171651716617167171681716917170171711717217173171741717517176171771717817179171801718117182171831718417185171861718717188171891719017191171921719317194171951719617197171981719917200172011720217203172041720517206172071720817209172101721117212172131721417215172161721717218172191722017221172221722317224172251722617227172281722917230172311723217233172341723517236172371723817239172401724117242172431724417245172461724717248172491725017251172521725317254172551725617257172581725917260172611726217263172641726517266172671726817269172701727117272172731727417275172761727717278172791728017281172821728317284172851728617287172881728917290172911729217293172941729517296172971729817299173001730117302173031730417305173061730717308173091731017311173121731317314173151731617317173181731917320173211732217323173241732517326173271732817329173301733117332173331733417335173361733717338173391734017341173421734317344173451734617347173481734917350173511735217353173541735517356173571735817359173601736117362173631736417365173661736717368173691737017371173721737317374173751737617377173781737917380173811738217383173841738517386173871738817389173901739117392173931739417395173961739717398173991740017401174021740317404174051740617407174081740917410174111741217413174141741517416174171741817419174201742117422174231742417425174261742717428174291743017431174321743317434174351743617437174381743917440174411744217443174441744517446174471744817449174501745117452174531745417455174561745717458174591746017461174621746317464174651746617467174681746917470174711747217473174741747517476174771747817479174801748117482174831748417485174861748717488174891749017491174921749317494174951749617497174981749917500175011750217503175041750517506175071750817509175101751117512175131751417515175161751717518175191752017521175221752317524175251752617527175281752917530175311753217533175341753517536175371753817539175401754117542175431754417545175461754717548175491755017551175521755317554175551755617557175581755917560175611756217563175641756517566175671756817569175701757117572175731757417575175761757717578175791758017581175821758317584175851758617587175881758917590175911759217593175941759517596175971759817599176001760117602176031760417605176061760717608176091761017611176121761317614176151761617617176181761917620176211762217623176241762517626176271762817629176301763117632176331763417635176361763717638176391764017641176421764317644176451764617647176481764917650176511765217653176541765517656176571765817659176601766117662176631766417665176661766717668176691767017671176721767317674176751767617677176781767917680176811768217683176841768517686176871768817689176901769117692176931769417695176961769717698176991770017701177021770317704177051770617707177081770917710177111771217713177141771517716177171771817719177201772117722177231772417725177261772717728177291773017731177321773317734177351773617737177381773917740177411774217743177441774517746177471774817749177501775117752177531775417755177561775717758177591776017761177621776317764177651776617767177681776917770177711777217773177741777517776177771777817779177801778117782177831778417785177861778717788177891779017791177921779317794177951779617797177981779917800178011780217803178041780517806178071780817809178101781117812178131781417815178161781717818178191782017821178221782317824178251782617827178281782917830178311783217833178341783517836178371783817839178401784117842178431784417845178461784717848178491785017851178521785317854178551785617857178581785917860178611786217863178641786517866178671786817869178701787117872178731787417875178761787717878178791788017881178821788317884178851788617887178881788917890178911789217893178941789517896178971789817899179001790117902179031790417905179061790717908179091791017911179121791317914179151791617917179181791917920179211792217923179241792517926179271792817929179301793117932179331793417935179361793717938179391794017941179421794317944179451794617947179481794917950179511795217953179541795517956179571795817959179601796117962179631796417965179661796717968179691797017971179721797317974179751797617977179781797917980179811798217983179841798517986179871798817989179901799117992179931799417995179961799717998179991800018001180021800318004180051800618007180081800918010180111801218013180141801518016180171801818019180201802118022180231802418025180261802718028180291803018031180321803318034180351803618037180381803918040180411804218043180441804518046180471804818049180501805118052180531805418055180561805718058180591806018061180621806318064180651806618067180681806918070180711807218073180741807518076180771807818079180801808118082180831808418085180861808718088180891809018091180921809318094180951809618097180981809918100181011810218103181041810518106181071810818109181101811118112181131811418115181161811718118181191812018121181221812318124181251812618127181281812918130181311813218133181341813518136181371813818139181401814118142181431814418145181461814718148181491815018151181521815318154181551815618157181581815918160181611816218163181641816518166181671816818169181701817118172181731817418175181761817718178181791818018181181821818318184181851818618187181881818918190181911819218193181941819518196181971819818199182001820118202182031820418205182061820718208182091821018211182121821318214182151821618217182181821918220182211822218223182241822518226182271822818229182301823118232182331823418235182361823718238182391824018241182421824318244182451824618247182481824918250182511825218253182541825518256182571825818259182601826118262182631826418265182661826718268182691827018271182721827318274182751827618277182781827918280182811828218283182841828518286182871828818289182901829118292182931829418295182961829718298182991830018301183021830318304183051830618307183081830918310183111831218313183141831518316183171831818319183201832118322183231832418325183261832718328183291833018331183321833318334183351833618337183381833918340183411834218343183441834518346183471834818349183501835118352183531835418355183561835718358183591836018361183621836318364183651836618367183681836918370183711837218373183741837518376183771837818379183801838118382183831838418385183861838718388183891839018391183921839318394183951839618397183981839918400184011840218403184041840518406184071840818409184101841118412184131841418415184161841718418184191842018421184221842318424184251842618427184281842918430184311843218433184341843518436184371843818439184401844118442184431844418445184461844718448184491845018451184521845318454184551845618457184581845918460184611846218463184641846518466184671846818469184701847118472184731847418475184761847718478184791848018481184821848318484184851848618487184881848918490184911849218493184941849518496184971849818499185001850118502185031850418505185061850718508185091851018511185121851318514185151851618517185181851918520185211852218523185241852518526185271852818529185301853118532185331853418535185361853718538185391854018541185421854318544185451854618547185481854918550185511855218553185541855518556185571855818559185601856118562185631856418565185661856718568185691857018571185721857318574185751857618577185781857918580185811858218583185841858518586185871858818589185901859118592185931859418595185961859718598185991860018601186021860318604186051860618607186081860918610186111861218613186141861518616186171861818619186201862118622186231862418625186261862718628186291863018631186321863318634186351863618637186381863918640186411864218643186441864518646186471864818649186501865118652186531865418655186561865718658186591866018661186621866318664186651866618667186681866918670186711867218673186741867518676186771867818679186801868118682186831868418685186861868718688186891869018691186921869318694186951869618697186981869918700187011870218703187041870518706187071870818709187101871118712187131871418715187161871718718187191872018721187221872318724187251872618727187281872918730187311873218733187341873518736187371873818739187401874118742187431874418745187461874718748187491875018751187521875318754187551875618757187581875918760187611876218763187641876518766187671876818769187701877118772187731877418775187761877718778187791878018781187821878318784187851878618787187881878918790187911879218793187941879518796187971879818799188001880118802188031880418805188061880718808188091881018811188121881318814188151881618817188181881918820188211882218823188241882518826188271882818829188301883118832188331883418835188361883718838188391884018841188421884318844188451884618847188481884918850188511885218853188541885518856188571885818859188601886118862188631886418865188661886718868188691887018871188721887318874188751887618877188781887918880188811888218883188841888518886188871888818889188901889118892188931889418895188961889718898188991890018901189021890318904189051890618907189081890918910189111891218913189141891518916189171891818919189201892118922189231892418925189261892718928189291893018931189321893318934189351893618937189381893918940189411894218943189441894518946189471894818949189501895118952189531895418955189561895718958189591896018961189621896318964189651896618967189681896918970189711897218973189741897518976189771897818979189801898118982189831898418985189861898718988189891899018991189921899318994189951899618997189981899919000190011900219003190041900519006190071900819009190101901119012190131901419015190161901719018190191902019021190221902319024190251902619027190281902919030190311903219033190341903519036190371903819039190401904119042190431904419045190461904719048190491905019051190521905319054190551905619057190581905919060190611906219063190641906519066190671906819069190701907119072190731907419075190761907719078190791908019081190821908319084190851908619087190881908919090190911909219093190941909519096190971909819099191001910119102191031910419105191061910719108191091911019111191121911319114191151911619117191181911919120191211912219123191241912519126191271912819129191301913119132191331913419135191361913719138191391914019141191421914319144191451914619147191481914919150191511915219153191541915519156191571915819159191601916119162191631916419165191661916719168191691917019171191721917319174191751917619177191781917919180191811918219183191841918519186191871918819189191901919119192191931919419195191961919719198191991920019201192021920319204192051920619207192081920919210192111921219213192141921519216192171921819219192201922119222192231922419225192261922719228192291923019231192321923319234192351923619237192381923919240192411924219243192441924519246192471924819249192501925119252192531925419255192561925719258192591926019261192621926319264192651926619267192681926919270192711927219273192741927519276192771927819279192801928119282192831928419285192861928719288192891929019291192921929319294192951929619297192981929919300193011930219303193041930519306193071930819309193101931119312193131931419315193161931719318193191932019321193221932319324193251932619327193281932919330193311933219333193341933519336193371933819339193401934119342193431934419345193461934719348193491935019351193521935319354193551935619357193581935919360193611936219363193641936519366193671936819369193701937119372193731937419375193761937719378193791938019381193821938319384193851938619387193881938919390193911939219393193941939519396193971939819399194001940119402194031940419405194061940719408194091941019411194121941319414194151941619417194181941919420194211942219423194241942519426194271942819429194301943119432194331943419435194361943719438194391944019441194421944319444194451944619447194481944919450194511945219453194541945519456194571945819459194601946119462194631946419465194661946719468194691947019471194721947319474194751947619477194781947919480194811948219483194841948519486194871948819489194901949119492194931949419495194961949719498194991950019501195021950319504195051950619507195081950919510195111951219513195141951519516195171951819519195201952119522195231952419525195261952719528195291953019531195321953319534195351953619537195381953919540195411954219543195441954519546195471954819549195501955119552195531955419555195561955719558195591956019561195621956319564195651956619567195681956919570195711957219573195741957519576195771957819579195801958119582195831958419585195861958719588195891959019591195921959319594195951959619597195981959919600196011960219603196041960519606196071960819609196101961119612196131961419615196161961719618196191962019621196221962319624196251962619627196281962919630196311963219633196341963519636196371963819639196401964119642196431964419645196461964719648196491965019651196521965319654196551965619657196581965919660196611966219663196641966519666196671966819669196701967119672196731967419675196761967719678196791968019681196821968319684196851968619687196881968919690196911969219693196941969519696196971969819699197001970119702197031970419705197061970719708197091971019711197121971319714197151971619717197181971919720197211972219723197241972519726197271972819729197301973119732197331973419735197361973719738197391974019741197421974319744197451974619747197481974919750197511975219753197541975519756197571975819759197601976119762197631976419765197661976719768197691977019771197721977319774197751977619777197781977919780197811978219783197841978519786197871978819789197901979119792197931979419795197961979719798197991980019801198021980319804198051980619807198081980919810198111981219813198141981519816198171981819819198201982119822198231982419825198261982719828198291983019831198321983319834198351983619837198381983919840198411984219843198441984519846198471984819849198501985119852198531985419855198561985719858198591986019861198621986319864198651986619867198681986919870198711987219873198741987519876198771987819879198801988119882198831988419885198861988719888198891989019891198921989319894198951989619897198981989919900199011990219903199041990519906199071990819909199101991119912199131991419915199161991719918199191992019921199221992319924199251992619927199281992919930199311993219933199341993519936199371993819939199401994119942199431994419945199461994719948199491995019951199521995319954199551995619957199581995919960199611996219963199641996519966199671996819969199701997119972199731997419975199761997719978199791998019981199821998319984199851998619987199881998919990199911999219993199941999519996199971999819999200002000120002200032000420005200062000720008200092001020011200122001320014200152001620017200182001920020200212002220023200242002520026200272002820029200302003120032200332003420035200362003720038200392004020041200422004320044200452004620047200482004920050200512005220053200542005520056200572005820059200602006120062200632006420065200662006720068200692007020071200722007320074200752007620077200782007920080200812008220083200842008520086200872008820089200902009120092200932009420095200962009720098200992010020101201022010320104201052010620107201082010920110201112011220113201142011520116201172011820119201202012120122201232012420125201262012720128201292013020131201322013320134201352013620137201382013920140201412014220143201442014520146201472014820149201502015120152201532015420155201562015720158201592016020161201622016320164201652016620167201682016920170201712017220173201742017520176201772017820179201802018120182201832018420185201862018720188201892019020191201922019320194201952019620197201982019920200202012020220203202042020520206202072020820209202102021120212202132021420215202162021720218202192022020221202222022320224202252022620227202282022920230202312023220233202342023520236202372023820239202402024120242202432024420245202462024720248202492025020251202522025320254202552025620257202582025920260202612026220263202642026520266202672026820269202702027120272202732027420275202762027720278202792028020281202822028320284202852028620287202882028920290202912029220293202942029520296202972029820299203002030120302203032030420305203062030720308203092031020311203122031320314203152031620317203182031920320203212032220323203242032520326203272032820329203302033120332203332033420335203362033720338203392034020341203422034320344203452034620347203482034920350203512035220353203542035520356203572035820359203602036120362203632036420365203662036720368203692037020371203722037320374203752037620377203782037920380203812038220383203842038520386203872038820389203902039120392203932039420395203962039720398203992040020401204022040320404204052040620407204082040920410204112041220413204142041520416204172041820419204202042120422204232042420425204262042720428204292043020431204322043320434204352043620437204382043920440204412044220443204442044520446204472044820449204502045120452204532045420455204562045720458204592046020461204622046320464204652046620467204682046920470204712047220473204742047520476204772047820479204802048120482204832048420485204862048720488204892049020491204922049320494204952049620497204982049920500205012050220503205042050520506205072050820509205102051120512205132051420515205162051720518205192052020521205222052320524205252052620527205282052920530205312053220533205342053520536205372053820539205402054120542205432054420545205462054720548205492055020551205522055320554205552055620557205582055920560205612056220563205642056520566205672056820569205702057120572205732057420575205762057720578205792058020581205822058320584205852058620587205882058920590205912059220593205942059520596205972059820599206002060120602206032060420605206062060720608206092061020611206122061320614206152061620617206182061920620206212062220623206242062520626206272062820629206302063120632206332063420635206362063720638206392064020641206422064320644206452064620647206482064920650206512065220653206542065520656206572065820659206602066120662206632066420665206662066720668206692067020671206722067320674206752067620677206782067920680206812068220683206842068520686206872068820689206902069120692206932069420695206962069720698206992070020701207022070320704207052070620707207082070920710207112071220713207142071520716207172071820719207202072120722207232072420725207262072720728207292073020731207322073320734207352073620737207382073920740207412074220743207442074520746207472074820749207502075120752207532075420755207562075720758207592076020761207622076320764207652076620767207682076920770207712077220773207742077520776207772077820779207802078120782207832078420785207862078720788207892079020791207922079320794207952079620797207982079920800208012080220803208042080520806208072080820809208102081120812208132081420815208162081720818208192082020821208222082320824208252082620827208282082920830208312083220833208342083520836208372083820839208402084120842208432084420845208462084720848208492085020851208522085320854208552085620857208582085920860208612086220863208642086520866208672086820869208702087120872208732087420875208762087720878208792088020881208822088320884208852088620887208882088920890208912089220893208942089520896208972089820899209002090120902209032090420905209062090720908209092091020911209122091320914209152091620917209182091920920209212092220923209242092520926209272092820929209302093120932209332093420935209362093720938209392094020941209422094320944209452094620947209482094920950209512095220953209542095520956209572095820959209602096120962209632096420965209662096720968209692097020971209722097320974209752097620977209782097920980209812098220983209842098520986209872098820989209902099120992209932099420995209962099720998209992100021001210022100321004210052100621007210082100921010210112101221013210142101521016210172101821019210202102121022210232102421025210262102721028210292103021031210322103321034210352103621037210382103921040210412104221043210442104521046210472104821049210502105121052210532105421055210562105721058210592106021061210622106321064210652106621067210682106921070210712107221073210742107521076210772107821079210802108121082210832108421085210862108721088210892109021091210922109321094210952109621097210982109921100211012110221103211042110521106211072110821109211102111121112211132111421115211162111721118211192112021121211222112321124211252112621127211282112921130211312113221133211342113521136211372113821139211402114121142211432114421145211462114721148211492115021151211522115321154211552115621157211582115921160211612116221163211642116521166211672116821169211702117121172211732117421175211762117721178211792118021181211822118321184211852118621187211882118921190211912119221193211942119521196211972119821199212002120121202212032120421205212062120721208212092121021211212122121321214212152121621217212182121921220212212122221223212242122521226212272122821229212302123121232212332123421235212362123721238212392124021241212422124321244212452124621247212482124921250212512125221253212542125521256212572125821259212602126121262212632126421265212662126721268212692127021271212722127321274212752127621277212782127921280212812128221283212842128521286212872128821289212902129121292212932129421295212962129721298212992130021301213022130321304213052130621307213082130921310213112131221313213142131521316213172131821319213202132121322213232132421325213262132721328213292133021331213322133321334213352133621337213382133921340213412134221343213442134521346213472134821349213502135121352213532135421355213562135721358213592136021361213622136321364213652136621367213682136921370213712137221373213742137521376213772137821379213802138121382213832138421385213862138721388213892139021391213922139321394213952139621397213982139921400214012140221403214042140521406214072140821409214102141121412214132141421415214162141721418214192142021421214222142321424214252142621427214282142921430214312143221433214342143521436214372143821439214402144121442214432144421445214462144721448214492145021451214522145321454214552145621457214582145921460214612146221463214642146521466214672146821469214702147121472214732147421475214762147721478214792148021481214822148321484214852148621487214882148921490214912149221493214942149521496214972149821499215002150121502215032150421505215062150721508215092151021511215122151321514215152151621517215182151921520215212152221523215242152521526215272152821529215302153121532215332153421535215362153721538215392154021541215422154321544215452154621547215482154921550215512155221553215542155521556215572155821559215602156121562215632156421565215662156721568215692157021571215722157321574215752157621577215782157921580215812158221583215842158521586215872158821589215902159121592215932159421595215962159721598215992160021601216022160321604216052160621607216082160921610216112161221613216142161521616216172161821619216202162121622216232162421625216262162721628216292163021631216322163321634216352163621637216382163921640216412164221643216442164521646216472164821649216502165121652216532165421655216562165721658216592166021661216622166321664216652166621667216682166921670216712167221673216742167521676216772167821679216802168121682216832168421685216862168721688216892169021691216922169321694216952169621697216982169921700217012170221703217042170521706217072170821709217102171121712217132171421715217162171721718217192172021721217222172321724217252172621727217282172921730217312173221733217342173521736217372173821739217402174121742217432174421745217462174721748217492175021751217522175321754217552175621757217582175921760217612176221763217642176521766217672176821769217702177121772217732177421775217762177721778217792178021781217822178321784217852178621787217882178921790217912179221793217942179521796217972179821799218002180121802218032180421805218062180721808218092181021811218122181321814218152181621817218182181921820218212182221823218242182521826218272182821829218302183121832218332183421835218362183721838218392184021841218422184321844218452184621847218482184921850218512185221853218542185521856218572185821859218602186121862218632186421865218662186721868218692187021871218722187321874218752187621877218782187921880218812188221883218842188521886218872188821889218902189121892218932189421895218962189721898218992190021901219022190321904219052190621907219082190921910219112191221913219142191521916219172191821919219202192121922219232192421925219262192721928219292193021931219322193321934219352193621937219382193921940219412194221943219442194521946219472194821949219502195121952219532195421955219562195721958219592196021961219622196321964219652196621967219682196921970219712197221973219742197521976219772197821979219802198121982219832198421985219862198721988219892199021991219922199321994219952199621997219982199922000220012200222003220042200522006220072200822009220102201122012220132201422015220162201722018220192202022021220222202322024220252202622027220282202922030220312203222033220342203522036220372203822039220402204122042220432204422045220462204722048220492205022051220522205322054220552205622057220582205922060220612206222063220642206522066220672206822069220702207122072220732207422075220762207722078220792208022081220822208322084220852208622087220882208922090220912209222093220942209522096220972209822099221002210122102221032210422105221062210722108221092211022111221122211322114221152211622117221182211922120221212212222123221242212522126221272212822129221302213122132221332213422135221362213722138221392214022141221422214322144221452214622147221482214922150221512215222153221542215522156221572215822159221602216122162221632216422165221662216722168221692217022171221722217322174221752217622177221782217922180221812218222183221842218522186221872218822189221902219122192221932219422195221962219722198221992220022201222022220322204222052220622207222082220922210222112221222213222142221522216222172221822219222202222122222222232222422225222262222722228222292223022231222322223322234222352223622237222382223922240222412224222243222442224522246222472224822249222502225122252222532225422255222562225722258222592226022261222622226322264222652226622267222682226922270222712227222273222742227522276222772227822279222802228122282222832228422285222862228722288222892229022291222922229322294222952229622297222982229922300223012230222303223042230522306223072230822309223102231122312223132231422315223162231722318223192232022321223222232322324223252232622327223282232922330223312233222333223342233522336223372233822339223402234122342223432234422345223462234722348223492235022351223522235322354223552235622357223582235922360223612236222363223642236522366223672236822369223702237122372223732237422375223762237722378223792238022381223822238322384223852238622387223882238922390223912239222393223942239522396223972239822399224002240122402224032240422405224062240722408224092241022411224122241322414224152241622417224182241922420224212242222423224242242522426224272242822429224302243122432224332243422435224362243722438224392244022441224422244322444224452244622447224482244922450224512245222453224542245522456224572245822459224602246122462224632246422465224662246722468224692247022471224722247322474224752247622477224782247922480224812248222483224842248522486224872248822489224902249122492224932249422495224962249722498224992250022501225022250322504225052250622507225082250922510225112251222513225142251522516225172251822519225202252122522225232252422525225262252722528225292253022531225322253322534225352253622537225382253922540225412254222543225442254522546225472254822549225502255122552225532255422555225562255722558225592256022561225622256322564225652256622567225682256922570225712257222573225742257522576225772257822579225802258122582225832258422585225862258722588225892259022591225922259322594225952259622597225982259922600226012260222603226042260522606226072260822609226102261122612226132261422615226162261722618226192262022621226222262322624226252262622627226282262922630226312263222633226342263522636226372263822639226402264122642226432264422645226462264722648226492265022651226522265322654226552265622657226582265922660226612266222663226642266522666226672266822669226702267122672226732267422675226762267722678226792268022681226822268322684226852268622687226882268922690226912269222693226942269522696226972269822699227002270122702227032270422705227062270722708227092271022711227122271322714227152271622717227182271922720227212272222723227242272522726227272272822729227302273122732227332273422735227362273722738227392274022741227422274322744227452274622747227482274922750227512275222753227542275522756227572275822759227602276122762227632276422765227662276722768227692277022771227722277322774227752277622777227782277922780227812278222783227842278522786227872278822789227902279122792227932279422795227962279722798227992280022801228022280322804228052280622807228082280922810228112281222813228142281522816228172281822819228202282122822228232282422825228262282722828228292283022831228322283322834228352283622837228382283922840228412284222843228442284522846228472284822849228502285122852228532285422855228562285722858228592286022861228622286322864228652286622867228682286922870228712287222873228742287522876228772287822879228802288122882228832288422885228862288722888228892289022891228922289322894228952289622897228982289922900229012290222903229042290522906229072290822909229102291122912229132291422915229162291722918229192292022921229222292322924229252292622927229282292922930229312293222933229342293522936229372293822939229402294122942229432294422945229462294722948229492295022951229522295322954229552295622957229582295922960229612296222963229642296522966229672296822969229702297122972229732297422975229762297722978229792298022981229822298322984229852298622987229882298922990229912299222993229942299522996229972299822999230002300123002230032300423005230062300723008230092301023011230122301323014230152301623017230182301923020230212302223023230242302523026230272302823029230302303123032230332303423035230362303723038230392304023041230422304323044230452304623047230482304923050230512305223053230542305523056230572305823059230602306123062230632306423065230662306723068230692307023071230722307323074230752307623077230782307923080230812308223083230842308523086230872308823089230902309123092230932309423095230962309723098230992310023101231022310323104231052310623107231082310923110231112311223113231142311523116231172311823119231202312123122231232312423125231262312723128231292313023131231322313323134231352313623137231382313923140231412314223143231442314523146231472314823149231502315123152231532315423155231562315723158231592316023161231622316323164231652316623167231682316923170231712317223173231742317523176231772317823179231802318123182231832318423185231862318723188231892319023191231922319323194231952319623197231982319923200232012320223203232042320523206232072320823209232102321123212232132321423215232162321723218232192322023221232222322323224232252322623227232282322923230232312323223233232342323523236232372323823239232402324123242232432324423245232462324723248232492325023251232522325323254232552325623257232582325923260232612326223263232642326523266232672326823269232702327123272232732327423275232762327723278232792328023281232822328323284232852328623287232882328923290232912329223293232942329523296232972329823299233002330123302233032330423305233062330723308233092331023311233122331323314233152331623317233182331923320233212332223323233242332523326233272332823329233302333123332233332333423335233362333723338233392334023341233422334323344233452334623347233482334923350233512335223353233542335523356233572335823359233602336123362233632336423365233662336723368233692337023371233722337323374233752337623377233782337923380233812338223383233842338523386233872338823389233902339123392233932339423395233962339723398233992340023401234022340323404234052340623407234082340923410234112341223413234142341523416234172341823419234202342123422234232342423425234262342723428234292343023431234322343323434234352343623437234382343923440234412344223443234442344523446234472344823449234502345123452234532345423455234562345723458234592346023461234622346323464234652346623467234682346923470234712347223473234742347523476234772347823479234802348123482234832348423485234862348723488234892349023491234922349323494234952349623497234982349923500235012350223503235042350523506235072350823509235102351123512235132351423515235162351723518235192352023521235222352323524235252352623527235282352923530235312353223533235342353523536235372353823539235402354123542235432354423545235462354723548235492355023551235522355323554235552355623557235582355923560235612356223563235642356523566235672356823569235702357123572235732357423575235762357723578235792358023581235822358323584235852358623587235882358923590235912359223593235942359523596235972359823599236002360123602236032360423605236062360723608236092361023611236122361323614236152361623617236182361923620236212362223623236242362523626236272362823629236302363123632236332363423635236362363723638236392364023641236422364323644236452364623647236482364923650236512365223653236542365523656236572365823659236602366123662236632366423665236662366723668236692367023671236722367323674236752367623677236782367923680236812368223683236842368523686236872368823689236902369123692236932369423695236962369723698236992370023701237022370323704237052370623707237082370923710237112371223713237142371523716237172371823719237202372123722237232372423725237262372723728237292373023731237322373323734237352373623737237382373923740237412374223743237442374523746237472374823749237502375123752237532375423755237562375723758237592376023761237622376323764237652376623767237682376923770237712377223773237742377523776237772377823779237802378123782237832378423785237862378723788237892379023791237922379323794237952379623797237982379923800238012380223803238042380523806238072380823809238102381123812238132381423815238162381723818238192382023821238222382323824238252382623827238282382923830238312383223833238342383523836238372383823839238402384123842238432384423845238462384723848238492385023851238522385323854238552385623857238582385923860238612386223863238642386523866238672386823869238702387123872238732387423875238762387723878238792388023881238822388323884238852388623887238882388923890238912389223893238942389523896238972389823899239002390123902239032390423905239062390723908239092391023911239122391323914239152391623917239182391923920239212392223923239242392523926239272392823929239302393123932239332393423935239362393723938239392394023941239422394323944239452394623947239482394923950239512395223953239542395523956239572395823959239602396123962239632396423965239662396723968239692397023971239722397323974239752397623977239782397923980239812398223983239842398523986239872398823989239902399123992239932399423995239962399723998239992400024001240022400324004240052400624007240082400924010240112401224013240142401524016240172401824019240202402124022240232402424025240262402724028240292403024031240322403324034240352403624037240382403924040240412404224043240442404524046240472404824049240502405124052240532405424055240562405724058240592406024061240622406324064240652406624067240682406924070240712407224073240742407524076240772407824079240802408124082240832408424085240862408724088240892409024091240922409324094240952409624097240982409924100241012410224103241042410524106241072410824109241102411124112241132411424115241162411724118241192412024121241222412324124241252412624127241282412924130241312413224133241342413524136241372413824139241402414124142241432414424145241462414724148241492415024151241522415324154241552415624157241582415924160241612416224163241642416524166241672416824169241702417124172241732417424175241762417724178241792418024181241822418324184241852418624187241882418924190241912419224193241942419524196241972419824199242002420124202242032420424205242062420724208242092421024211242122421324214242152421624217242182421924220242212422224223242242422524226242272422824229242302423124232242332423424235242362423724238242392424024241242422424324244242452424624247242482424924250242512425224253242542425524256242572425824259242602426124262242632426424265242662426724268242692427024271242722427324274242752427624277242782427924280242812428224283242842428524286242872428824289242902429124292242932429424295242962429724298242992430024301243022430324304243052430624307243082430924310243112431224313243142431524316243172431824319243202432124322243232432424325243262432724328243292433024331243322433324334243352433624337243382433924340243412434224343243442434524346243472434824349243502435124352243532435424355243562435724358243592436024361243622436324364243652436624367243682436924370243712437224373243742437524376243772437824379243802438124382243832438424385243862438724388243892439024391243922439324394243952439624397243982439924400244012440224403244042440524406244072440824409244102441124412244132441424415244162441724418244192442024421244222442324424244252442624427244282442924430244312443224433244342443524436244372443824439244402444124442244432444424445244462444724448244492445024451244522445324454244552445624457244582445924460244612446224463244642446524466244672446824469244702447124472244732447424475244762447724478244792448024481244822448324484244852448624487244882448924490244912449224493244942449524496244972449824499245002450124502245032450424505245062450724508245092451024511245122451324514245152451624517245182451924520245212452224523245242452524526245272452824529245302453124532245332453424535245362453724538245392454024541245422454324544245452454624547245482454924550245512455224553245542455524556245572455824559245602456124562245632456424565245662456724568245692457024571245722457324574245752457624577245782457924580245812458224583245842458524586245872458824589245902459124592245932459424595245962459724598245992460024601246022460324604246052460624607246082460924610246112461224613246142461524616246172461824619246202462124622246232462424625246262462724628246292463024631246322463324634246352463624637246382463924640246412464224643246442464524646246472464824649246502465124652246532465424655246562465724658246592466024661246622466324664246652466624667246682466924670246712467224673246742467524676246772467824679246802468124682246832468424685246862468724688246892469024691246922469324694246952469624697246982469924700247012470224703247042470524706247072470824709247102471124712247132471424715247162471724718247192472024721247222472324724247252472624727247282472924730247312473224733247342473524736247372473824739247402474124742247432474424745247462474724748247492475024751247522475324754247552475624757247582475924760247612476224763247642476524766247672476824769247702477124772247732477424775247762477724778247792478024781247822478324784247852478624787247882478924790247912479224793247942479524796247972479824799248002480124802248032480424805248062480724808248092481024811248122481324814248152481624817248182481924820248212482224823248242482524826248272482824829248302483124832248332483424835248362483724838248392484024841248422484324844248452484624847248482484924850248512485224853248542485524856248572485824859248602486124862248632486424865248662486724868248692487024871248722487324874248752487624877248782487924880248812488224883248842488524886248872488824889248902489124892248932489424895248962489724898248992490024901249022490324904249052490624907249082490924910249112491224913249142491524916249172491824919249202492124922249232492424925249262492724928249292493024931249322493324934249352493624937249382493924940249412494224943249442494524946249472494824949249502495124952249532495424955249562495724958249592496024961249622496324964249652496624967249682496924970249712497224973249742497524976249772497824979249802498124982249832498424985249862498724988249892499024991249922499324994249952499624997249982499925000250012500225003250042500525006250072500825009250102501125012250132501425015250162501725018250192502025021250222502325024250252502625027250282502925030250312503225033250342503525036250372503825039250402504125042250432504425045250462504725048250492505025051250522505325054250552505625057250582505925060250612506225063250642506525066250672506825069250702507125072250732507425075250762507725078250792508025081250822508325084250852508625087250882508925090250912509225093250942509525096250972509825099251002510125102251032510425105251062510725108251092511025111251122511325114251152511625117251182511925120251212512225123251242512525126251272512825129251302513125132251332513425135251362513725138251392514025141251422514325144251452514625147251482514925150251512515225153251542515525156251572515825159251602516125162251632516425165251662516725168251692517025171251722517325174251752517625177251782517925180251812518225183251842518525186251872518825189251902519125192251932519425195251962519725198251992520025201252022520325204252052520625207252082520925210252112521225213252142521525216252172521825219252202522125222252232522425225252262522725228252292523025231252322523325234252352523625237252382523925240252412524225243252442524525246252472524825249252502525125252252532525425255252562525725258252592526025261252622526325264252652526625267252682526925270252712527225273252742527525276252772527825279252802528125282252832528425285252862528725288252892529025291252922529325294252952529625297252982529925300253012530225303253042530525306253072530825309253102531125312253132531425315253162531725318253192532025321253222532325324253252532625327253282532925330253312533225333253342533525336253372533825339253402534125342253432534425345253462534725348253492535025351253522535325354253552535625357253582535925360253612536225363253642536525366253672536825369253702537125372253732537425375253762537725378253792538025381253822538325384253852538625387253882538925390253912539225393253942539525396253972539825399254002540125402254032540425405254062540725408254092541025411254122541325414254152541625417254182541925420254212542225423254242542525426254272542825429254302543125432254332543425435254362543725438254392544025441254422544325444254452544625447254482544925450254512545225453254542545525456254572545825459254602546125462254632546425465254662546725468254692547025471254722547325474254752547625477254782547925480254812548225483254842548525486254872548825489254902549125492254932549425495254962549725498254992550025501255022550325504255052550625507255082550925510255112551225513255142551525516255172551825519255202552125522255232552425525255262552725528255292553025531255322553325534255352553625537255382553925540255412554225543255442554525546255472554825549255502555125552255532555425555255562555725558255592556025561255622556325564255652556625567255682556925570255712557225573255742557525576255772557825579255802558125582255832558425585255862558725588255892559025591255922559325594255952559625597255982559925600256012560225603256042560525606256072560825609256102561125612256132561425615256162561725618256192562025621256222562325624256252562625627256282562925630256312563225633256342563525636256372563825639256402564125642256432564425645256462564725648256492565025651256522565325654256552565625657256582565925660256612566225663256642566525666256672566825669256702567125672256732567425675256762567725678256792568025681256822568325684256852568625687256882568925690256912569225693256942569525696256972569825699257002570125702257032570425705257062570725708257092571025711257122571325714257152571625717257182571925720257212572225723257242572525726257272572825729257302573125732257332573425735257362573725738257392574025741257422574325744257452574625747257482574925750257512575225753257542575525756257572575825759257602576125762257632576425765257662576725768257692577025771257722577325774257752577625777257782577925780257812578225783257842578525786257872578825789257902579125792257932579425795257962579725798257992580025801258022580325804258052580625807258082580925810258112581225813258142581525816258172581825819258202582125822258232582425825258262582725828258292583025831258322583325834258352583625837258382583925840258412584225843258442584525846258472584825849258502585125852258532585425855258562585725858258592586025861258622586325864258652586625867258682586925870258712587225873258742587525876258772587825879258802588125882258832588425885258862588725888258892589025891258922589325894258952589625897258982589925900259012590225903259042590525906259072590825909259102591125912259132591425915259162591725918259192592025921259222592325924259252592625927259282592925930259312593225933259342593525936259372593825939259402594125942259432594425945259462594725948259492595025951259522595325954259552595625957259582595925960259612596225963259642596525966259672596825969259702597125972259732597425975259762597725978259792598025981259822598325984259852598625987259882598925990259912599225993259942599525996259972599825999260002600126002260032600426005260062600726008260092601026011260122601326014260152601626017260182601926020260212602226023260242602526026260272602826029260302603126032260332603426035260362603726038260392604026041260422604326044260452604626047260482604926050260512605226053260542605526056260572605826059260602606126062260632606426065260662606726068260692607026071260722607326074260752607626077260782607926080260812608226083260842608526086260872608826089260902609126092260932609426095260962609726098260992610026101261022610326104261052610626107261082610926110261112611226113261142611526116261172611826119261202612126122261232612426125261262612726128261292613026131261322613326134261352613626137261382613926140261412614226143261442614526146261472614826149261502615126152261532615426155261562615726158261592616026161261622616326164261652616626167261682616926170261712617226173261742617526176261772617826179261802618126182261832618426185261862618726188261892619026191261922619326194261952619626197261982619926200262012620226203262042620526206262072620826209262102621126212262132621426215262162621726218262192622026221262222622326224262252622626227262282622926230262312623226233262342623526236262372623826239262402624126242262432624426245262462624726248262492625026251262522625326254262552625626257262582625926260262612626226263262642626526266262672626826269262702627126272262732627426275262762627726278262792628026281262822628326284262852628626287262882628926290262912629226293262942629526296262972629826299263002630126302263032630426305263062630726308263092631026311263122631326314263152631626317263182631926320263212632226323263242632526326263272632826329263302633126332263332633426335263362633726338263392634026341263422634326344263452634626347263482634926350263512635226353263542635526356263572635826359263602636126362263632636426365263662636726368263692637026371263722637326374263752637626377263782637926380263812638226383263842638526386263872638826389263902639126392263932639426395263962639726398263992640026401264022640326404264052640626407264082640926410264112641226413264142641526416264172641826419264202642126422264232642426425264262642726428264292643026431264322643326434264352643626437264382643926440264412644226443264442644526446264472644826449264502645126452264532645426455264562645726458264592646026461264622646326464264652646626467264682646926470264712647226473264742647526476264772647826479264802648126482264832648426485264862648726488264892649026491264922649326494264952649626497264982649926500265012650226503265042650526506265072650826509265102651126512265132651426515265162651726518265192652026521265222652326524265252652626527265282652926530265312653226533265342653526536265372653826539265402654126542265432654426545265462654726548265492655026551265522655326554265552655626557265582655926560265612656226563265642656526566265672656826569265702657126572265732657426575265762657726578265792658026581265822658326584265852658626587265882658926590265912659226593265942659526596265972659826599266002660126602266032660426605266062660726608266092661026611266122661326614266152661626617266182661926620266212662226623266242662526626266272662826629266302663126632266332663426635266362663726638266392664026641266422664326644266452664626647266482664926650266512665226653266542665526656266572665826659266602666126662266632666426665266662666726668266692667026671266722667326674266752667626677266782667926680266812668226683266842668526686266872668826689266902669126692266932669426695266962669726698266992670026701267022670326704267052670626707267082670926710267112671226713267142671526716267172671826719267202672126722267232672426725267262672726728267292673026731267322673326734267352673626737267382673926740267412674226743267442674526746267472674826749267502675126752267532675426755267562675726758267592676026761267622676326764267652676626767267682676926770267712677226773267742677526776267772677826779267802678126782267832678426785267862678726788267892679026791267922679326794267952679626797267982679926800268012680226803268042680526806268072680826809268102681126812268132681426815268162681726818268192682026821268222682326824268252682626827268282682926830268312683226833268342683526836268372683826839268402684126842268432684426845268462684726848268492685026851268522685326854268552685626857268582685926860268612686226863268642686526866268672686826869268702687126872268732687426875268762687726878268792688026881268822688326884268852688626887268882688926890268912689226893268942689526896268972689826899269002690126902269032690426905269062690726908269092691026911269122691326914269152691626917269182691926920269212692226923269242692526926269272692826929269302693126932269332693426935269362693726938269392694026941269422694326944269452694626947269482694926950269512695226953269542695526956269572695826959269602696126962269632696426965269662696726968269692697026971269722697326974269752697626977269782697926980269812698226983269842698526986269872698826989269902699126992269932699426995269962699726998269992700027001270022700327004270052700627007270082700927010270112701227013270142701527016270172701827019270202702127022270232702427025270262702727028270292703027031270322703327034270352703627037270382703927040270412704227043270442704527046270472704827049270502705127052270532705427055270562705727058270592706027061270622706327064270652706627067270682706927070270712707227073270742707527076270772707827079270802708127082270832708427085270862708727088270892709027091270922709327094270952709627097270982709927100271012710227103271042710527106271072710827109271102711127112271132711427115271162711727118271192712027121271222712327124271252712627127271282712927130271312713227133271342713527136271372713827139271402714127142271432714427145271462714727148271492715027151271522715327154271552715627157271582715927160271612716227163271642716527166271672716827169271702717127172271732717427175271762717727178271792718027181271822718327184271852718627187271882718927190271912719227193271942719527196271972719827199272002720127202272032720427205272062720727208272092721027211272122721327214272152721627217272182721927220272212722227223272242722527226272272722827229272302723127232272332723427235272362723727238272392724027241272422724327244272452724627247272482724927250272512725227253272542725527256272572725827259272602726127262272632726427265272662726727268272692727027271272722727327274272752727627277272782727927280272812728227283272842728527286272872728827289272902729127292272932729427295272962729727298272992730027301273022730327304273052730627307273082730927310273112731227313273142731527316273172731827319273202732127322273232732427325273262732727328273292733027331273322733327334273352733627337273382733927340273412734227343273442734527346273472734827349273502735127352273532735427355273562735727358273592736027361273622736327364273652736627367273682736927370273712737227373273742737527376273772737827379273802738127382273832738427385273862738727388273892739027391273922739327394273952739627397273982739927400274012740227403274042740527406274072740827409274102741127412274132741427415274162741727418274192742027421274222742327424274252742627427274282742927430274312743227433274342743527436274372743827439274402744127442274432744427445274462744727448274492745027451274522745327454274552745627457274582745927460274612746227463274642746527466274672746827469274702747127472274732747427475274762747727478274792748027481274822748327484274852748627487274882748927490274912749227493274942749527496274972749827499275002750127502275032750427505275062750727508275092751027511275122751327514275152751627517275182751927520275212752227523275242752527526275272752827529275302753127532275332753427535275362753727538275392754027541275422754327544275452754627547275482754927550275512755227553275542755527556275572755827559275602756127562275632756427565275662756727568275692757027571275722757327574275752757627577275782757927580275812758227583275842758527586275872758827589275902759127592275932759427595275962759727598275992760027601276022760327604276052760627607276082760927610276112761227613276142761527616276172761827619276202762127622276232762427625276262762727628276292763027631276322763327634276352763627637276382763927640276412764227643276442764527646276472764827649276502765127652276532765427655276562765727658276592766027661276622766327664276652766627667276682766927670276712767227673276742767527676276772767827679276802768127682276832768427685276862768727688276892769027691276922769327694276952769627697276982769927700277012770227703277042770527706277072770827709277102771127712277132771427715277162771727718277192772027721277222772327724277252772627727277282772927730277312773227733277342773527736277372773827739277402774127742277432774427745277462774727748277492775027751277522775327754277552775627757277582775927760277612776227763277642776527766277672776827769277702777127772277732777427775277762777727778277792778027781277822778327784277852778627787277882778927790277912779227793277942779527796277972779827799278002780127802278032780427805278062780727808278092781027811278122781327814278152781627817278182781927820278212782227823278242782527826278272782827829278302783127832278332783427835278362783727838278392784027841278422784327844278452784627847278482784927850278512785227853278542785527856278572785827859278602786127862278632786427865278662786727868278692787027871278722787327874278752787627877278782787927880278812788227883278842788527886278872788827889278902789127892278932789427895278962789727898278992790027901279022790327904279052790627907279082790927910279112791227913279142791527916279172791827919279202792127922279232792427925279262792727928279292793027931279322793327934279352793627937279382793927940279412794227943279442794527946279472794827949279502795127952279532795427955279562795727958279592796027961279622796327964279652796627967279682796927970279712797227973279742797527976279772797827979279802798127982279832798427985279862798727988279892799027991279922799327994279952799627997279982799928000280012800228003280042800528006280072800828009280102801128012280132801428015280162801728018280192802028021280222802328024280252802628027280282802928030280312803228033280342803528036280372803828039280402804128042280432804428045280462804728048280492805028051280522805328054280552805628057280582805928060280612806228063280642806528066280672806828069280702807128072280732807428075280762807728078280792808028081280822808328084280852808628087280882808928090280912809228093280942809528096280972809828099281002810128102281032810428105281062810728108281092811028111281122811328114281152811628117281182811928120281212812228123281242812528126281272812828129281302813128132281332813428135281362813728138281392814028141281422814328144281452814628147281482814928150281512815228153281542815528156281572815828159281602816128162281632816428165281662816728168281692817028171281722817328174281752817628177281782817928180281812818228183281842818528186281872818828189281902819128192281932819428195281962819728198281992820028201282022820328204282052820628207282082820928210282112821228213282142821528216282172821828219282202822128222282232822428225282262822728228282292823028231282322823328234282352823628237282382823928240282412824228243282442824528246282472824828249282502825128252282532825428255282562825728258282592826028261282622826328264282652826628267282682826928270282712827228273282742827528276282772827828279282802828128282282832828428285282862828728288282892829028291282922829328294282952829628297282982829928300283012830228303283042830528306283072830828309283102831128312283132831428315283162831728318283192832028321283222832328324283252832628327283282832928330283312833228333283342833528336283372833828339283402834128342283432834428345283462834728348283492835028351283522835328354283552835628357283582835928360283612836228363283642836528366283672836828369283702837128372283732837428375283762837728378283792838028381283822838328384283852838628387283882838928390283912839228393283942839528396283972839828399284002840128402284032840428405284062840728408284092841028411284122841328414284152841628417284182841928420284212842228423284242842528426284272842828429284302843128432284332843428435284362843728438284392844028441284422844328444284452844628447284482844928450284512845228453284542845528456284572845828459284602846128462284632846428465284662846728468284692847028471284722847328474284752847628477284782847928480284812848228483284842848528486284872848828489284902849128492284932849428495284962849728498284992850028501285022850328504285052850628507285082850928510285112851228513285142851528516285172851828519285202852128522285232852428525285262852728528285292853028531285322853328534285352853628537285382853928540285412854228543285442854528546285472854828549285502855128552285532855428555285562855728558285592856028561285622856328564285652856628567285682856928570285712857228573285742857528576285772857828579285802858128582285832858428585285862858728588285892859028591285922859328594285952859628597285982859928600286012860228603286042860528606286072860828609286102861128612286132861428615286162861728618286192862028621286222862328624286252862628627286282862928630286312863228633286342863528636286372863828639286402864128642286432864428645286462864728648286492865028651286522865328654286552865628657286582865928660286612866228663286642866528666286672866828669286702867128672286732867428675286762867728678286792868028681286822868328684286852868628687286882868928690286912869228693286942869528696286972869828699287002870128702287032870428705287062870728708287092871028711287122871328714287152871628717287182871928720287212872228723287242872528726287272872828729287302873128732287332873428735287362873728738287392874028741287422874328744287452874628747287482874928750287512875228753287542875528756287572875828759287602876128762287632876428765287662876728768287692877028771287722877328774287752877628777287782877928780287812878228783287842878528786287872878828789287902879128792287932879428795287962879728798287992880028801288022880328804288052880628807288082880928810288112881228813288142881528816288172881828819288202882128822288232882428825288262882728828288292883028831288322883328834288352883628837288382883928840288412884228843288442884528846288472884828849288502885128852288532885428855288562885728858288592886028861288622886328864288652886628867288682886928870288712887228873288742887528876288772887828879288802888128882288832888428885288862888728888288892889028891288922889328894288952889628897288982889928900289012890228903289042890528906289072890828909289102891128912289132891428915289162891728918289192892028921289222892328924289252892628927289282892928930289312893228933289342893528936289372893828939289402894128942289432894428945289462894728948289492895028951289522895328954289552895628957289582895928960289612896228963289642896528966289672896828969289702897128972289732897428975289762897728978289792898028981289822898328984289852898628987289882898928990289912899228993289942899528996289972899828999290002900129002290032900429005290062900729008290092901029011290122901329014290152901629017290182901929020290212902229023290242902529026290272902829029290302903129032290332903429035290362903729038290392904029041290422904329044290452904629047290482904929050290512905229053290542905529056290572905829059290602906129062290632906429065290662906729068290692907029071290722907329074290752907629077290782907929080290812908229083290842908529086290872908829089290902909129092290932909429095290962909729098290992910029101291022910329104291052910629107291082910929110291112911229113291142911529116291172911829119291202912129122291232912429125291262912729128291292913029131291322913329134291352913629137291382913929140291412914229143291442914529146291472914829149291502915129152291532915429155291562915729158291592916029161291622916329164291652916629167291682916929170291712917229173291742917529176291772917829179291802918129182291832918429185291862918729188291892919029191291922919329194291952919629197291982919929200292012920229203292042920529206292072920829209292102921129212292132921429215292162921729218292192922029221292222922329224292252922629227292282922929230292312923229233292342923529236292372923829239292402924129242292432924429245292462924729248292492925029251292522925329254292552925629257292582925929260292612926229263292642926529266292672926829269292702927129272292732927429275292762927729278292792928029281292822928329284292852928629287292882928929290292912929229293292942929529296292972929829299293002930129302293032930429305293062930729308293092931029311293122931329314293152931629317293182931929320293212932229323293242932529326293272932829329293302933129332293332933429335293362933729338293392934029341293422934329344293452934629347293482934929350293512935229353293542935529356293572935829359293602936129362293632936429365293662936729368293692937029371293722937329374293752937629377293782937929380293812938229383293842938529386293872938829389293902939129392293932939429395293962939729398293992940029401294022940329404294052940629407294082940929410294112941229413294142941529416294172941829419294202942129422294232942429425294262942729428294292943029431294322943329434294352943629437294382943929440294412944229443294442944529446294472944829449294502945129452294532945429455294562945729458294592946029461294622946329464294652946629467294682946929470294712947229473294742947529476294772947829479294802948129482294832948429485294862948729488294892949029491294922949329494294952949629497294982949929500295012950229503295042950529506295072950829509295102951129512295132951429515295162951729518295192952029521295222952329524295252952629527295282952929530295312953229533295342953529536295372953829539295402954129542295432954429545295462954729548295492955029551295522955329554295552955629557295582955929560295612956229563295642956529566295672956829569295702957129572295732957429575295762957729578295792958029581295822958329584295852958629587295882958929590295912959229593295942959529596295972959829599296002960129602296032960429605296062960729608296092961029611296122961329614296152961629617296182961929620296212962229623296242962529626296272962829629296302963129632296332963429635296362963729638296392964029641296422964329644296452964629647296482964929650296512965229653296542965529656296572965829659296602966129662296632966429665296662966729668296692967029671296722967329674296752967629677296782967929680296812968229683296842968529686296872968829689296902969129692296932969429695296962969729698296992970029701297022970329704297052970629707297082970929710297112971229713297142971529716297172971829719297202972129722297232972429725297262972729728297292973029731297322973329734297352973629737297382973929740297412974229743297442974529746297472974829749297502975129752297532975429755297562975729758297592976029761297622976329764297652976629767297682976929770297712977229773297742977529776297772977829779297802978129782297832978429785297862978729788297892979029791297922979329794297952979629797297982979929800298012980229803298042980529806298072980829809298102981129812298132981429815298162981729818298192982029821298222982329824298252982629827298282982929830298312983229833298342983529836298372983829839298402984129842298432984429845298462984729848298492985029851298522985329854298552985629857298582985929860298612986229863298642986529866298672986829869298702987129872298732987429875298762987729878298792988029881298822988329884298852988629887298882988929890298912989229893298942989529896298972989829899299002990129902299032990429905299062990729908299092991029911299122991329914299152991629917299182991929920299212992229923299242992529926299272992829929299302993129932299332993429935299362993729938299392994029941299422994329944299452994629947299482994929950299512995229953299542995529956299572995829959299602996129962299632996429965299662996729968299692997029971299722997329974299752997629977299782997929980299812998229983299842998529986299872998829989299902999129992299932999429995299962999729998299993000030001300023000330004300053000630007300083000930010300113001230013300143001530016300173001830019300203002130022300233002430025300263002730028300293003030031300323003330034300353003630037300383003930040300413004230043300443004530046300473004830049300503005130052300533005430055300563005730058300593006030061300623006330064300653006630067300683006930070300713007230073300743007530076300773007830079300803008130082300833008430085300863008730088300893009030091300923009330094300953009630097300983009930100301013010230103301043010530106301073010830109301103011130112301133011430115301163011730118301193012030121301223012330124301253012630127301283012930130301313013230133301343013530136301373013830139301403014130142301433014430145301463014730148301493015030151301523015330154301553015630157301583015930160301613016230163301643016530166301673016830169301703017130172301733017430175301763017730178301793018030181301823018330184301853018630187301883018930190301913019230193301943019530196301973019830199302003020130202302033020430205302063020730208302093021030211302123021330214302153021630217302183021930220302213022230223302243022530226302273022830229302303023130232302333023430235302363023730238302393024030241302423024330244302453024630247302483024930250302513025230253302543025530256302573025830259302603026130262302633026430265302663026730268302693027030271302723027330274302753027630277302783027930280302813028230283302843028530286302873028830289302903029130292302933029430295302963029730298302993030030301303023030330304303053030630307303083030930310303113031230313303143031530316303173031830319303203032130322303233032430325303263032730328303293033030331303323033330334303353033630337303383033930340303413034230343303443034530346303473034830349303503035130352303533035430355303563035730358303593036030361303623036330364303653036630367303683036930370303713037230373303743037530376303773037830379303803038130382303833038430385303863038730388303893039030391303923039330394303953039630397303983039930400304013040230403304043040530406304073040830409304103041130412304133041430415304163041730418304193042030421304223042330424304253042630427304283042930430304313043230433304343043530436304373043830439304403044130442304433044430445304463044730448304493045030451304523045330454304553045630457304583045930460304613046230463304643046530466304673046830469304703047130472304733047430475304763047730478304793048030481304823048330484304853048630487304883048930490304913049230493304943049530496304973049830499305003050130502305033050430505305063050730508305093051030511305123051330514305153051630517305183051930520305213052230523305243052530526305273052830529305303053130532305333053430535305363053730538305393054030541305423054330544305453054630547305483054930550305513055230553305543055530556305573055830559305603056130562305633056430565305663056730568305693057030571305723057330574305753057630577305783057930580305813058230583305843058530586305873058830589305903059130592305933059430595305963059730598305993060030601306023060330604306053060630607306083060930610306113061230613306143061530616306173061830619306203062130622306233062430625306263062730628306293063030631306323063330634306353063630637306383063930640306413064230643306443064530646306473064830649306503065130652306533065430655306563065730658306593066030661306623066330664306653066630667306683066930670306713067230673306743067530676306773067830679306803068130682306833068430685306863068730688306893069030691306923069330694306953069630697306983069930700307013070230703307043070530706307073070830709307103071130712307133071430715307163071730718307193072030721307223072330724307253072630727307283072930730307313073230733307343073530736307373073830739307403074130742307433074430745307463074730748307493075030751307523075330754307553075630757307583075930760307613076230763307643076530766307673076830769307703077130772307733077430775307763077730778307793078030781307823078330784307853078630787307883078930790307913079230793307943079530796307973079830799308003080130802308033080430805308063080730808308093081030811308123081330814308153081630817308183081930820308213082230823308243082530826308273082830829308303083130832308333083430835308363083730838308393084030841308423084330844308453084630847308483084930850308513085230853308543085530856308573085830859308603086130862308633086430865308663086730868308693087030871308723087330874308753087630877308783087930880308813088230883308843088530886308873088830889308903089130892308933089430895308963089730898308993090030901309023090330904309053090630907309083090930910309113091230913309143091530916309173091830919309203092130922309233092430925309263092730928309293093030931309323093330934309353093630937309383093930940309413094230943309443094530946309473094830949309503095130952309533095430955309563095730958309593096030961309623096330964309653096630967309683096930970309713097230973309743097530976309773097830979309803098130982309833098430985309863098730988309893099030991309923099330994309953099630997309983099931000310013100231003310043100531006310073100831009310103101131012310133101431015310163101731018310193102031021310223102331024310253102631027310283102931030310313103231033310343103531036310373103831039310403104131042310433104431045310463104731048310493105031051310523105331054310553105631057310583105931060310613106231063310643106531066310673106831069310703107131072310733107431075310763107731078310793108031081310823108331084310853108631087310883108931090310913109231093310943109531096310973109831099311003110131102311033110431105311063110731108311093111031111311123111331114311153111631117311183111931120311213112231123311243112531126311273112831129311303113131132311333113431135311363113731138311393114031141311423114331144311453114631147311483114931150311513115231153311543115531156311573115831159311603116131162311633116431165311663116731168311693117031171311723117331174311753117631177311783117931180311813118231183311843118531186311873118831189311903119131192311933119431195311963119731198311993120031201312023120331204312053120631207312083120931210312113121231213312143121531216312173121831219312203122131222312233122431225312263122731228312293123031231312323123331234312353123631237312383123931240312413124231243312443124531246312473124831249312503125131252312533125431255312563125731258312593126031261312623126331264312653126631267312683126931270312713127231273312743127531276312773127831279312803128131282312833128431285312863128731288312893129031291312923129331294312953129631297312983129931300313013130231303313043130531306313073130831309313103131131312313133131431315313163131731318313193132031321313223132331324313253132631327313283132931330313313133231333313343133531336313373133831339313403134131342313433134431345313463134731348313493135031351313523135331354313553135631357313583135931360313613136231363313643136531366313673136831369313703137131372313733137431375313763137731378313793138031381313823138331384313853138631387313883138931390313913139231393313943139531396313973139831399314003140131402314033140431405314063140731408314093141031411314123141331414314153141631417314183141931420314213142231423314243142531426314273142831429314303143131432314333143431435314363143731438314393144031441314423144331444314453144631447314483144931450314513145231453314543145531456314573145831459314603146131462314633146431465314663146731468314693147031471314723147331474314753147631477314783147931480314813148231483314843148531486314873148831489314903149131492314933149431495314963149731498314993150031501315023150331504315053150631507315083150931510315113151231513315143151531516315173151831519315203152131522315233152431525315263152731528315293153031531315323153331534315353153631537315383153931540315413154231543315443154531546315473154831549315503155131552315533155431555315563155731558315593156031561315623156331564315653156631567315683156931570315713157231573315743157531576315773157831579315803158131582315833158431585315863158731588315893159031591315923159331594315953159631597315983159931600316013160231603316043160531606316073160831609316103161131612316133161431615316163161731618316193162031621316223162331624316253162631627316283162931630316313163231633316343163531636316373163831639316403164131642316433164431645316463164731648316493165031651316523165331654316553165631657316583165931660316613166231663316643166531666316673166831669316703167131672316733167431675316763167731678316793168031681316823168331684316853168631687316883168931690316913169231693316943169531696316973169831699317003170131702317033170431705317063170731708317093171031711317123171331714317153171631717317183171931720317213172231723317243172531726317273172831729317303173131732317333173431735317363173731738317393174031741317423174331744317453174631747317483174931750317513175231753317543175531756317573175831759317603176131762317633176431765317663176731768317693177031771317723177331774317753177631777317783177931780317813178231783317843178531786317873178831789317903179131792317933179431795317963179731798317993180031801318023180331804318053180631807318083180931810318113181231813318143181531816318173181831819318203182131822318233182431825318263182731828318293183031831318323183331834318353183631837318383183931840318413184231843318443184531846318473184831849318503185131852318533185431855318563185731858318593186031861318623186331864318653186631867318683186931870318713187231873318743187531876318773187831879318803188131882318833188431885318863188731888318893189031891318923189331894318953189631897318983189931900319013190231903319043190531906319073190831909319103191131912319133191431915319163191731918319193192031921319223192331924319253192631927319283192931930319313193231933319343193531936319373193831939319403194131942319433194431945319463194731948319493195031951319523195331954319553195631957319583195931960319613196231963319643196531966319673196831969319703197131972319733197431975319763197731978319793198031981319823198331984319853198631987319883198931990319913199231993319943199531996319973199831999320003200132002320033200432005320063200732008320093201032011320123201332014320153201632017320183201932020320213202232023320243202532026320273202832029320303203132032320333203432035320363203732038320393204032041320423204332044320453204632047320483204932050320513205232053320543205532056320573205832059320603206132062320633206432065320663206732068320693207032071320723207332074320753207632077320783207932080320813208232083320843208532086320873208832089320903209132092320933209432095320963209732098320993210032101321023210332104321053210632107321083210932110321113211232113321143211532116321173211832119321203212132122321233212432125321263212732128321293213032131321323213332134321353213632137321383213932140321413214232143321443214532146321473214832149321503215132152321533215432155321563215732158321593216032161321623216332164321653216632167321683216932170321713217232173321743217532176321773217832179321803218132182321833218432185321863218732188321893219032191321923219332194321953219632197321983219932200322013220232203322043220532206322073220832209322103221132212322133221432215322163221732218322193222032221322223222332224322253222632227322283222932230322313223232233322343223532236322373223832239322403224132242322433224432245322463224732248322493225032251322523225332254322553225632257322583225932260322613226232263322643226532266322673226832269322703227132272322733227432275322763227732278322793228032281322823228332284322853228632287322883228932290322913229232293322943229532296322973229832299323003230132302323033230432305323063230732308323093231032311323123231332314323153231632317323183231932320323213232232323323243232532326323273232832329323303233132332323333233432335323363233732338323393234032341323423234332344323453234632347323483234932350323513235232353323543235532356323573235832359323603236132362323633236432365323663236732368323693237032371323723237332374323753237632377323783237932380323813238232383323843238532386323873238832389323903239132392323933239432395323963239732398323993240032401324023240332404324053240632407324083240932410324113241232413324143241532416324173241832419324203242132422324233242432425324263242732428324293243032431324323243332434324353243632437324383243932440324413244232443324443244532446324473244832449324503245132452324533245432455324563245732458324593246032461324623246332464324653246632467324683246932470324713247232473324743247532476324773247832479324803248132482324833248432485324863248732488324893249032491324923249332494324953249632497324983249932500325013250232503325043250532506325073250832509325103251132512325133251432515325163251732518325193252032521325223252332524325253252632527325283252932530325313253232533325343253532536325373253832539325403254132542325433254432545325463254732548325493255032551325523255332554325553255632557325583255932560325613256232563325643256532566325673256832569325703257132572325733257432575325763257732578325793258032581325823258332584325853258632587325883258932590325913259232593325943259532596325973259832599326003260132602326033260432605326063260732608326093261032611326123261332614326153261632617326183261932620326213262232623326243262532626326273262832629326303263132632326333263432635326363263732638326393264032641326423264332644326453264632647326483264932650326513265232653326543265532656326573265832659326603266132662326633266432665326663266732668326693267032671326723267332674326753267632677326783267932680326813268232683326843268532686326873268832689326903269132692326933269432695326963269732698326993270032701327023270332704327053270632707327083270932710327113271232713327143271532716327173271832719327203272132722327233272432725327263272732728327293273032731327323273332734327353273632737327383273932740327413274232743327443274532746327473274832749327503275132752327533275432755327563275732758327593276032761327623276332764327653276632767327683276932770327713277232773327743277532776327773277832779327803278132782327833278432785327863278732788327893279032791327923279332794327953279632797327983279932800328013280232803328043280532806328073280832809328103281132812328133281432815328163281732818328193282032821328223282332824328253282632827328283282932830328313283232833328343283532836328373283832839328403284132842328433284432845328463284732848328493285032851328523285332854328553285632857328583285932860328613286232863328643286532866328673286832869328703287132872328733287432875328763287732878328793288032881328823288332884328853288632887328883288932890328913289232893328943289532896328973289832899329003290132902329033290432905329063290732908329093291032911329123291332914329153291632917329183291932920329213292232923329243292532926329273292832929329303293132932329333293432935329363293732938329393294032941329423294332944329453294632947329483294932950329513295232953329543295532956329573295832959329603296132962329633296432965329663296732968329693297032971329723297332974329753297632977329783297932980329813298232983329843298532986329873298832989329903299132992329933299432995329963299732998329993300033001330023300333004330053300633007330083300933010330113301233013330143301533016330173301833019330203302133022330233302433025330263302733028330293303033031330323303333034330353303633037330383303933040330413304233043330443304533046330473304833049330503305133052330533305433055330563305733058330593306033061330623306333064330653306633067330683306933070330713307233073330743307533076330773307833079330803308133082330833308433085330863308733088330893309033091330923309333094330953309633097330983309933100331013310233103331043310533106331073310833109331103311133112331133311433115331163311733118331193312033121331223312333124331253312633127331283312933130331313313233133331343313533136331373313833139331403314133142331433314433145331463314733148331493315033151331523315333154331553315633157331583315933160331613316233163331643316533166331673316833169331703317133172331733317433175331763317733178331793318033181331823318333184331853318633187331883318933190331913319233193331943319533196331973319833199332003320133202332033320433205332063320733208332093321033211332123321333214332153321633217332183321933220332213322233223332243322533226332273322833229332303323133232332333323433235332363323733238332393324033241332423324333244332453324633247332483324933250332513325233253332543325533256332573325833259332603326133262332633326433265332663326733268332693327033271332723327333274332753327633277332783327933280332813328233283332843328533286332873328833289332903329133292332933329433295332963329733298332993330033301333023330333304333053330633307333083330933310333113331233313333143331533316333173331833319333203332133322333233332433325333263332733328333293333033331333323333333334333353333633337333383333933340333413334233343333443334533346333473334833349333503335133352333533335433355333563335733358333593336033361333623336333364333653336633367333683336933370333713337233373333743337533376333773337833379333803338133382333833338433385333863338733388333893339033391333923339333394333953339633397333983339933400334013340233403334043340533406334073340833409334103341133412334133341433415334163341733418334193342033421334223342333424334253342633427334283342933430334313343233433334343343533436334373343833439334403344133442334433344433445334463344733448334493345033451334523345333454334553345633457334583345933460334613346233463334643346533466334673346833469334703347133472334733347433475334763347733478334793348033481334823348333484334853348633487334883348933490334913349233493334943349533496334973349833499335003350133502335033350433505335063350733508335093351033511335123351333514335153351633517335183351933520335213352233523335243352533526335273352833529335303353133532335333353433535335363353733538335393354033541335423354333544335453354633547335483354933550335513355233553335543355533556335573355833559335603356133562335633356433565335663356733568335693357033571335723357333574335753357633577335783357933580335813358233583335843358533586335873358833589335903359133592335933359433595335963359733598335993360033601336023360333604336053360633607336083360933610336113361233613336143361533616336173361833619336203362133622336233362433625336263362733628336293363033631336323363333634336353363633637336383363933640336413364233643336443364533646336473364833649336503365133652336533365433655336563365733658336593366033661336623366333664336653366633667336683366933670336713367233673336743367533676336773367833679336803368133682336833368433685336863368733688336893369033691336923369333694336953369633697336983369933700337013370233703337043370533706337073370833709337103371133712337133371433715337163371733718337193372033721337223372333724337253372633727337283372933730337313373233733337343373533736337373373833739337403374133742337433374433745337463374733748337493375033751337523375333754337553375633757337583375933760337613376233763337643376533766337673376833769337703377133772337733377433775337763377733778337793378033781337823378333784337853378633787337883378933790337913379233793337943379533796337973379833799338003380133802338033380433805338063380733808338093381033811338123381333814338153381633817338183381933820338213382233823338243382533826338273382833829338303383133832338333383433835338363383733838338393384033841338423384333844338453384633847338483384933850338513385233853338543385533856338573385833859338603386133862338633386433865338663386733868338693387033871338723387333874338753387633877338783387933880338813388233883338843388533886338873388833889338903389133892338933389433895338963389733898338993390033901339023390333904339053390633907339083390933910339113391233913339143391533916339173391833919339203392133922339233392433925339263392733928339293393033931339323393333934339353393633937339383393933940339413394233943339443394533946339473394833949339503395133952339533395433955339563395733958339593396033961339623396333964339653396633967339683396933970339713397233973339743397533976339773397833979339803398133982339833398433985339863398733988339893399033991339923399333994339953399633997339983399934000340013400234003340043400534006340073400834009340103401134012340133401434015340163401734018340193402034021340223402334024340253402634027340283402934030340313403234033340343403534036340373403834039340403404134042340433404434045340463404734048340493405034051340523405334054340553405634057340583405934060340613406234063340643406534066340673406834069340703407134072340733407434075340763407734078340793408034081340823408334084340853408634087340883408934090340913409234093340943409534096340973409834099341003410134102341033410434105341063410734108341093411034111341123411334114341153411634117341183411934120341213412234123341243412534126341273412834129341303413134132341333413434135341363413734138341393414034141341423414334144341453414634147341483414934150341513415234153341543415534156341573415834159341603416134162341633416434165341663416734168341693417034171341723417334174341753417634177341783417934180341813418234183341843418534186341873418834189341903419134192341933419434195341963419734198341993420034201342023420334204342053420634207342083420934210342113421234213342143421534216342173421834219342203422134222342233422434225342263422734228342293423034231342323423334234342353423634237342383423934240342413424234243342443424534246342473424834249342503425134252342533425434255342563425734258342593426034261342623426334264342653426634267342683426934270342713427234273342743427534276342773427834279342803428134282342833428434285342863428734288342893429034291342923429334294342953429634297342983429934300343013430234303343043430534306343073430834309343103431134312343133431434315343163431734318343193432034321343223432334324343253432634327343283432934330343313433234333343343433534336343373433834339343403434134342343433434434345343463434734348343493435034351343523435334354343553435634357343583435934360343613436234363343643436534366343673436834369343703437134372343733437434375343763437734378343793438034381343823438334384343853438634387343883438934390343913439234393343943439534396343973439834399344003440134402344033440434405344063440734408344093441034411344123441334414344153441634417344183441934420344213442234423344243442534426344273442834429344303443134432344333443434435344363443734438344393444034441344423444334444344453444634447344483444934450344513445234453344543445534456344573445834459344603446134462344633446434465344663446734468344693447034471344723447334474344753447634477344783447934480344813448234483344843448534486344873448834489344903449134492344933449434495344963449734498344993450034501345023450334504345053450634507345083450934510345113451234513345143451534516345173451834519345203452134522345233452434525345263452734528345293453034531345323453334534345353453634537345383453934540345413454234543345443454534546345473454834549345503455134552345533455434555345563455734558345593456034561345623456334564345653456634567345683456934570345713457234573345743457534576345773457834579345803458134582345833458434585345863458734588345893459034591345923459334594345953459634597345983459934600346013460234603346043460534606346073460834609346103461134612346133461434615346163461734618346193462034621346223462334624346253462634627346283462934630346313463234633346343463534636346373463834639346403464134642346433464434645346463464734648346493465034651346523465334654346553465634657346583465934660346613466234663346643466534666346673466834669346703467134672346733467434675346763467734678346793468034681346823468334684346853468634687346883468934690346913469234693346943469534696346973469834699347003470134702347033470434705347063470734708347093471034711347123471334714347153471634717347183471934720347213472234723347243472534726347273472834729347303473134732347333473434735347363473734738347393474034741347423474334744347453474634747347483474934750347513475234753347543475534756347573475834759347603476134762347633476434765347663476734768347693477034771347723477334774347753477634777347783477934780347813478234783347843478534786347873478834789347903479134792347933479434795347963479734798347993480034801348023480334804348053480634807348083480934810348113481234813348143481534816348173481834819348203482134822348233482434825348263482734828348293483034831348323483334834348353483634837348383483934840348413484234843348443484534846348473484834849348503485134852348533485434855348563485734858348593486034861348623486334864348653486634867348683486934870348713487234873348743487534876348773487834879348803488134882348833488434885348863488734888348893489034891348923489334894348953489634897348983489934900349013490234903349043490534906349073490834909349103491134912349133491434915349163491734918349193492034921349223492334924349253492634927349283492934930349313493234933349343493534936349373493834939349403494134942349433494434945349463494734948349493495034951349523495334954349553495634957349583495934960349613496234963349643496534966349673496834969349703497134972349733497434975349763497734978349793498034981349823498334984349853498634987349883498934990349913499234993349943499534996349973499834999350003500135002350033500435005350063500735008350093501035011350123501335014350153501635017350183501935020350213502235023350243502535026350273502835029350303503135032350333503435035350363503735038350393504035041350423504335044350453504635047350483504935050350513505235053350543505535056350573505835059350603506135062350633506435065350663506735068350693507035071350723507335074350753507635077350783507935080350813508235083350843508535086350873508835089350903509135092350933509435095350963509735098350993510035101351023510335104351053510635107351083510935110351113511235113351143511535116351173511835119351203512135122351233512435125351263512735128351293513035131351323513335134351353513635137351383513935140351413514235143351443514535146351473514835149351503515135152351533515435155351563515735158351593516035161351623516335164351653516635167351683516935170351713517235173351743517535176351773517835179351803518135182351833518435185351863518735188351893519035191351923519335194351953519635197351983519935200352013520235203352043520535206352073520835209352103521135212352133521435215352163521735218352193522035221352223522335224352253522635227352283522935230352313523235233352343523535236352373523835239352403524135242352433524435245352463524735248352493525035251352523525335254352553525635257352583525935260352613526235263352643526535266352673526835269352703527135272352733527435275352763527735278352793528035281352823528335284352853528635287352883528935290352913529235293352943529535296352973529835299353003530135302353033530435305353063530735308353093531035311353123531335314353153531635317353183531935320353213532235323353243532535326353273532835329353303533135332353333533435335353363533735338353393534035341353423534335344353453534635347353483534935350353513535235353353543535535356353573535835359353603536135362353633536435365353663536735368353693537035371353723537335374353753537635377353783537935380353813538235383353843538535386353873538835389353903539135392353933539435395353963539735398353993540035401354023540335404354053540635407354083540935410354113541235413354143541535416354173541835419354203542135422354233542435425354263542735428354293543035431354323543335434354353543635437354383543935440354413544235443354443544535446354473544835449354503545135452354533545435455354563545735458354593546035461354623546335464354653546635467354683546935470354713547235473354743547535476354773547835479354803548135482354833548435485354863548735488354893549035491354923549335494354953549635497354983549935500355013550235503355043550535506355073550835509355103551135512355133551435515355163551735518355193552035521355223552335524355253552635527355283552935530355313553235533355343553535536355373553835539355403554135542355433554435545355463554735548355493555035551355523555335554355553555635557355583555935560355613556235563355643556535566355673556835569355703557135572355733557435575355763557735578355793558035581355823558335584355853558635587355883558935590355913559235593355943559535596355973559835599356003560135602356033560435605356063560735608356093561035611356123561335614356153561635617356183561935620356213562235623356243562535626356273562835629356303563135632356333563435635356363563735638356393564035641356423564335644356453564635647356483564935650356513565235653356543565535656356573565835659356603566135662356633566435665356663566735668356693567035671356723567335674356753567635677356783567935680356813568235683356843568535686356873568835689356903569135692356933569435695356963569735698356993570035701357023570335704357053570635707357083570935710357113571235713357143571535716357173571835719357203572135722357233572435725357263572735728357293573035731357323573335734357353573635737357383573935740357413574235743357443574535746357473574835749357503575135752357533575435755357563575735758357593576035761357623576335764357653576635767357683576935770357713577235773357743577535776357773577835779357803578135782357833578435785357863578735788357893579035791357923579335794357953579635797357983579935800358013580235803358043580535806358073580835809358103581135812358133581435815358163581735818358193582035821358223582335824358253582635827358283582935830358313583235833358343583535836358373583835839358403584135842358433584435845358463584735848358493585035851358523585335854358553585635857358583585935860358613586235863358643586535866358673586835869358703587135872358733587435875358763587735878358793588035881358823588335884358853588635887358883588935890358913589235893358943589535896358973589835899359003590135902359033590435905359063590735908359093591035911359123591335914359153591635917359183591935920359213592235923359243592535926359273592835929359303593135932359333593435935359363593735938359393594035941359423594335944359453594635947359483594935950359513595235953359543595535956359573595835959359603596135962359633596435965359663596735968359693597035971359723597335974359753597635977359783597935980359813598235983359843598535986359873598835989359903599135992359933599435995359963599735998359993600036001360023600336004360053600636007360083600936010360113601236013360143601536016360173601836019360203602136022360233602436025360263602736028360293603036031360323603336034360353603636037360383603936040360413604236043360443604536046360473604836049360503605136052360533605436055360563605736058360593606036061360623606336064360653606636067360683606936070360713607236073360743607536076360773607836079360803608136082360833608436085360863608736088360893609036091360923609336094360953609636097360983609936100361013610236103361043610536106361073610836109361103611136112361133611436115361163611736118361193612036121361223612336124361253612636127361283612936130361313613236133361343613536136361373613836139361403614136142361433614436145361463614736148361493615036151361523615336154361553615636157361583615936160361613616236163361643616536166361673616836169361703617136172361733617436175361763617736178361793618036181361823618336184361853618636187361883618936190361913619236193361943619536196361973619836199362003620136202362033620436205362063620736208362093621036211362123621336214362153621636217362183621936220362213622236223362243622536226362273622836229362303623136232362333623436235362363623736238362393624036241362423624336244362453624636247362483624936250362513625236253362543625536256362573625836259362603626136262362633626436265362663626736268362693627036271362723627336274362753627636277362783627936280362813628236283362843628536286362873628836289362903629136292362933629436295362963629736298362993630036301363023630336304363053630636307363083630936310363113631236313363143631536316363173631836319363203632136322363233632436325363263632736328363293633036331363323633336334363353633636337363383633936340363413634236343363443634536346363473634836349363503635136352363533635436355363563635736358363593636036361363623636336364363653636636367363683636936370363713637236373363743637536376363773637836379363803638136382363833638436385363863638736388363893639036391363923639336394363953639636397363983639936400364013640236403364043640536406364073640836409364103641136412364133641436415364163641736418364193642036421364223642336424364253642636427364283642936430364313643236433364343643536436364373643836439364403644136442364433644436445364463644736448364493645036451364523645336454364553645636457364583645936460364613646236463364643646536466364673646836469364703647136472364733647436475364763647736478364793648036481364823648336484364853648636487364883648936490364913649236493364943649536496364973649836499365003650136502365033650436505365063650736508365093651036511365123651336514365153651636517365183651936520365213652236523365243652536526365273652836529365303653136532365333653436535365363653736538365393654036541365423654336544365453654636547365483654936550365513655236553365543655536556365573655836559365603656136562365633656436565365663656736568365693657036571365723657336574365753657636577365783657936580365813658236583365843658536586365873658836589365903659136592365933659436595365963659736598365993660036601366023660336604366053660636607366083660936610366113661236613366143661536616366173661836619366203662136622366233662436625366263662736628366293663036631366323663336634366353663636637366383663936640366413664236643366443664536646366473664836649366503665136652366533665436655366563665736658366593666036661366623666336664366653666636667366683666936670366713667236673366743667536676366773667836679366803668136682366833668436685366863668736688366893669036691366923669336694366953669636697366983669936700367013670236703367043670536706367073670836709367103671136712367133671436715367163671736718367193672036721367223672336724367253672636727367283672936730367313673236733367343673536736367373673836739367403674136742367433674436745367463674736748367493675036751367523675336754367553675636757367583675936760367613676236763367643676536766367673676836769367703677136772367733677436775367763677736778367793678036781367823678336784367853678636787367883678936790367913679236793367943679536796367973679836799368003680136802368033680436805368063680736808368093681036811368123681336814368153681636817368183681936820368213682236823368243682536826368273682836829368303683136832368333683436835368363683736838368393684036841368423684336844368453684636847368483684936850368513685236853368543685536856368573685836859368603686136862368633686436865368663686736868368693687036871368723687336874368753687636877368783687936880368813688236883368843688536886368873688836889368903689136892368933689436895368963689736898368993690036901369023690336904369053690636907369083690936910369113691236913369143691536916369173691836919369203692136922369233692436925369263692736928369293693036931369323693336934369353693636937369383693936940369413694236943369443694536946369473694836949369503695136952369533695436955369563695736958369593696036961369623696336964369653696636967369683696936970369713697236973369743697536976369773697836979369803698136982369833698436985369863698736988369893699036991369923699336994369953699636997369983699937000370013700237003370043700537006370073700837009370103701137012370133701437015370163701737018370193702037021370223702337024370253702637027370283702937030370313703237033370343703537036370373703837039370403704137042370433704437045370463704737048370493705037051370523705337054370553705637057370583705937060370613706237063370643706537066370673706837069370703707137072370733707437075370763707737078370793708037081370823708337084370853708637087370883708937090370913709237093370943709537096370973709837099371003710137102371033710437105371063710737108371093711037111371123711337114371153711637117371183711937120371213712237123371243712537126371273712837129371303713137132371333713437135371363713737138371393714037141371423714337144371453714637147371483714937150371513715237153371543715537156371573715837159371603716137162371633716437165371663716737168371693717037171371723717337174371753717637177371783717937180371813718237183371843718537186371873718837189371903719137192371933719437195371963719737198371993720037201372023720337204372053720637207372083720937210372113721237213372143721537216372173721837219372203722137222372233722437225372263722737228372293723037231372323723337234372353723637237372383723937240372413724237243372443724537246372473724837249372503725137252372533725437255372563725737258372593726037261372623726337264372653726637267372683726937270372713727237273372743727537276372773727837279372803728137282372833728437285372863728737288372893729037291372923729337294372953729637297372983729937300373013730237303373043730537306373073730837309373103731137312373133731437315373163731737318373193732037321373223732337324373253732637327373283732937330373313733237333373343733537336373373733837339373403734137342373433734437345373463734737348373493735037351373523735337354373553735637357373583735937360373613736237363373643736537366373673736837369373703737137372373733737437375373763737737378373793738037381373823738337384373853738637387373883738937390373913739237393373943739537396373973739837399374003740137402374033740437405374063740737408374093741037411374123741337414374153741637417374183741937420374213742237423374243742537426374273742837429374303743137432374333743437435374363743737438374393744037441374423744337444374453744637447374483744937450374513745237453374543745537456374573745837459374603746137462374633746437465374663746737468374693747037471374723747337474374753747637477374783747937480374813748237483374843748537486374873748837489374903749137492374933749437495374963749737498374993750037501375023750337504375053750637507375083750937510375113751237513375143751537516375173751837519375203752137522375233752437525375263752737528375293753037531375323753337534375353753637537375383753937540375413754237543375443754537546375473754837549375503755137552375533755437555375563755737558375593756037561375623756337564375653756637567375683756937570375713757237573375743757537576375773757837579375803758137582375833758437585375863758737588375893759037591375923759337594375953759637597375983759937600376013760237603376043760537606376073760837609376103761137612376133761437615376163761737618376193762037621376223762337624376253762637627376283762937630376313763237633376343763537636376373763837639376403764137642376433764437645376463764737648376493765037651376523765337654376553765637657376583765937660376613766237663376643766537666376673766837669376703767137672376733767437675376763767737678376793768037681376823768337684376853768637687376883768937690376913769237693376943769537696376973769837699377003770137702377033770437705377063770737708377093771037711377123771337714377153771637717377183771937720377213772237723377243772537726377273772837729377303773137732377333773437735377363773737738377393774037741377423774337744377453774637747377483774937750377513775237753377543775537756377573775837759377603776137762377633776437765377663776737768377693777037771377723777337774377753777637777377783777937780377813778237783377843778537786377873778837789377903779137792377933779437795377963779737798377993780037801378023780337804378053780637807378083780937810378113781237813378143781537816378173781837819378203782137822378233782437825378263782737828378293783037831378323783337834378353783637837378383783937840378413784237843378443784537846378473784837849378503785137852378533785437855378563785737858378593786037861378623786337864378653786637867378683786937870378713787237873378743787537876378773787837879378803788137882378833788437885378863788737888378893789037891378923789337894378953789637897378983789937900379013790237903379043790537906379073790837909379103791137912379133791437915379163791737918379193792037921379223792337924379253792637927379283792937930379313793237933379343793537936379373793837939379403794137942379433794437945379463794737948379493795037951379523795337954379553795637957379583795937960379613796237963379643796537966379673796837969379703797137972379733797437975379763797737978379793798037981379823798337984379853798637987379883798937990379913799237993379943799537996379973799837999380003800138002380033800438005380063800738008380093801038011380123801338014380153801638017380183801938020380213802238023380243802538026380273802838029380303803138032380333803438035380363803738038380393804038041380423804338044380453804638047380483804938050380513805238053380543805538056380573805838059380603806138062380633806438065380663806738068380693807038071380723807338074380753807638077380783807938080380813808238083380843808538086380873808838089380903809138092380933809438095380963809738098380993810038101381023810338104381053810638107381083810938110381113811238113381143811538116381173811838119381203812138122381233812438125381263812738128381293813038131381323813338134381353813638137381383813938140381413814238143381443814538146381473814838149381503815138152381533815438155381563815738158381593816038161381623816338164381653816638167381683816938170381713817238173381743817538176381773817838179381803818138182381833818438185381863818738188381893819038191381923819338194381953819638197381983819938200382013820238203382043820538206382073820838209382103821138212382133821438215382163821738218382193822038221382223822338224382253822638227382283822938230382313823238233382343823538236382373823838239382403824138242382433824438245382463824738248382493825038251382523825338254382553825638257382583825938260382613826238263382643826538266382673826838269382703827138272382733827438275382763827738278382793828038281382823828338284382853828638287382883828938290382913829238293382943829538296382973829838299383003830138302383033830438305383063830738308383093831038311383123831338314383153831638317383183831938320383213832238323383243832538326383273832838329383303833138332383333833438335383363833738338383393834038341383423834338344383453834638347383483834938350383513835238353383543835538356383573835838359383603836138362383633836438365383663836738368383693837038371383723837338374383753837638377383783837938380383813838238383383843838538386383873838838389383903839138392383933839438395383963839738398383993840038401384023840338404384053840638407384083840938410384113841238413384143841538416384173841838419384203842138422384233842438425384263842738428384293843038431384323843338434384353843638437384383843938440384413844238443384443844538446384473844838449384503845138452384533845438455384563845738458384593846038461384623846338464384653846638467384683846938470384713847238473384743847538476384773847838479384803848138482384833848438485384863848738488384893849038491384923849338494384953849638497384983849938500385013850238503385043850538506385073850838509385103851138512385133851438515385163851738518385193852038521385223852338524385253852638527385283852938530385313853238533385343853538536385373853838539385403854138542385433854438545385463854738548385493855038551385523855338554385553855638557385583855938560385613856238563385643856538566385673856838569385703857138572385733857438575385763857738578385793858038581385823858338584385853858638587385883858938590385913859238593385943859538596385973859838599386003860138602386033860438605386063860738608386093861038611386123861338614386153861638617386183861938620386213862238623386243862538626386273862838629386303863138632386333863438635386363863738638386393864038641386423864338644386453864638647386483864938650386513865238653386543865538656386573865838659386603866138662386633866438665386663866738668386693867038671386723867338674386753867638677386783867938680386813868238683386843868538686386873868838689386903869138692386933869438695386963869738698386993870038701387023870338704387053870638707387083870938710387113871238713387143871538716387173871838719387203872138722387233872438725387263872738728387293873038731387323873338734387353873638737387383873938740387413874238743387443874538746387473874838749387503875138752387533875438755387563875738758387593876038761387623876338764387653876638767387683876938770387713877238773387743877538776387773877838779387803878138782387833878438785387863878738788387893879038791387923879338794387953879638797387983879938800388013880238803388043880538806388073880838809388103881138812388133881438815388163881738818388193882038821388223882338824388253882638827388283882938830388313883238833388343883538836388373883838839388403884138842388433884438845388463884738848388493885038851388523885338854388553885638857388583885938860388613886238863388643886538866388673886838869388703887138872388733887438875388763887738878388793888038881388823888338884388853888638887388883888938890388913889238893388943889538896388973889838899389003890138902389033890438905389063890738908389093891038911389123891338914389153891638917389183891938920389213892238923389243892538926389273892838929389303893138932389333893438935389363893738938389393894038941389423894338944389453894638947389483894938950389513895238953389543895538956389573895838959389603896138962389633896438965389663896738968389693897038971389723897338974389753897638977389783897938980389813898238983389843898538986389873898838989389903899138992389933899438995389963899738998389993900039001390023900339004390053900639007390083900939010390113901239013390143901539016390173901839019390203902139022390233902439025390263902739028390293903039031390323903339034390353903639037390383903939040390413904239043390443904539046390473904839049390503905139052390533905439055390563905739058390593906039061390623906339064390653906639067390683906939070390713907239073390743907539076390773907839079390803908139082390833908439085390863908739088390893909039091390923909339094390953909639097390983909939100391013910239103391043910539106391073910839109391103911139112391133911439115391163911739118391193912039121391223912339124391253912639127391283912939130391313913239133391343913539136391373913839139391403914139142391433914439145391463914739148391493915039151391523915339154391553915639157391583915939160391613916239163391643916539166391673916839169391703917139172391733917439175391763917739178391793918039181391823918339184391853918639187391883918939190391913919239193391943919539196391973919839199392003920139202392033920439205392063920739208392093921039211392123921339214392153921639217392183921939220392213922239223392243922539226392273922839229392303923139232392333923439235392363923739238392393924039241392423924339244392453924639247392483924939250392513925239253392543925539256392573925839259392603926139262392633926439265392663926739268392693927039271392723927339274392753927639277392783927939280392813928239283392843928539286392873928839289392903929139292392933929439295392963929739298392993930039301393023930339304393053930639307393083930939310393113931239313393143931539316393173931839319393203932139322393233932439325393263932739328393293933039331393323933339334393353933639337393383933939340393413934239343393443934539346393473934839349393503935139352393533935439355393563935739358393593936039361393623936339364393653936639367393683936939370393713937239373393743937539376393773937839379393803938139382393833938439385393863938739388393893939039391393923939339394393953939639397393983939939400394013940239403394043940539406394073940839409394103941139412394133941439415394163941739418394193942039421394223942339424394253942639427394283942939430394313943239433394343943539436394373943839439394403944139442394433944439445394463944739448394493945039451394523945339454394553945639457394583945939460394613946239463394643946539466394673946839469394703947139472394733947439475394763947739478394793948039481394823948339484394853948639487394883948939490394913949239493394943949539496394973949839499395003950139502395033950439505395063950739508395093951039511395123951339514395153951639517395183951939520395213952239523395243952539526395273952839529395303953139532395333953439535395363953739538395393954039541395423954339544395453954639547395483954939550395513955239553395543955539556395573955839559395603956139562395633956439565395663956739568395693957039571395723957339574395753957639577395783957939580395813958239583395843958539586395873958839589395903959139592395933959439595395963959739598395993960039601396023960339604396053960639607396083960939610396113961239613396143961539616396173961839619396203962139622396233962439625396263962739628396293963039631396323963339634396353963639637396383963939640396413964239643396443964539646396473964839649396503965139652396533965439655396563965739658396593966039661396623966339664396653966639667396683966939670396713967239673396743967539676396773967839679396803968139682396833968439685396863968739688396893969039691396923969339694396953969639697396983969939700397013970239703397043970539706397073970839709397103971139712397133971439715397163971739718397193972039721397223972339724397253972639727397283972939730397313973239733397343973539736397373973839739397403974139742397433974439745397463974739748397493975039751397523975339754397553975639757397583975939760397613976239763397643976539766397673976839769397703977139772397733977439775397763977739778397793978039781397823978339784397853978639787397883978939790397913979239793397943979539796397973979839799398003980139802398033980439805398063980739808398093981039811398123981339814398153981639817398183981939820398213982239823398243982539826398273982839829398303983139832398333983439835398363983739838398393984039841398423984339844398453984639847398483984939850398513985239853398543985539856398573985839859398603986139862398633986439865398663986739868398693987039871398723987339874398753987639877398783987939880398813988239883398843988539886398873988839889398903989139892398933989439895398963989739898398993990039901399023990339904399053990639907399083990939910399113991239913399143991539916399173991839919399203992139922399233992439925399263992739928399293993039931399323993339934399353993639937399383993939940399413994239943399443994539946399473994839949399503995139952399533995439955399563995739958399593996039961399623996339964399653996639967399683996939970399713997239973399743997539976399773997839979399803998139982399833998439985399863998739988399893999039991399923999339994399953999639997399983999940000400014000240003400044000540006400074000840009400104001140012400134001440015400164001740018400194002040021400224002340024400254002640027400284002940030400314003240033400344003540036400374003840039400404004140042400434004440045400464004740048400494005040051400524005340054400554005640057400584005940060400614006240063400644006540066400674006840069400704007140072400734007440075400764007740078400794008040081400824008340084400854008640087400884008940090400914009240093400944009540096400974009840099401004010140102401034010440105401064010740108401094011040111401124011340114401154011640117401184011940120401214012240123401244012540126401274012840129401304013140132401334013440135401364013740138401394014040141401424014340144401454014640147401484014940150401514015240153401544015540156401574015840159401604016140162401634016440165401664016740168401694017040171401724017340174401754017640177401784017940180401814018240183401844018540186401874018840189401904019140192401934019440195401964019740198401994020040201402024020340204402054020640207402084020940210402114021240213402144021540216402174021840219402204022140222402234022440225402264022740228402294023040231402324023340234402354023640237402384023940240402414024240243402444024540246402474024840249402504025140252402534025440255402564025740258402594026040261402624026340264402654026640267402684026940270402714027240273402744027540276402774027840279402804028140282402834028440285402864028740288402894029040291402924029340294402954029640297402984029940300403014030240303403044030540306403074030840309403104031140312403134031440315403164031740318403194032040321403224032340324403254032640327403284032940330403314033240333403344033540336403374033840339403404034140342403434034440345403464034740348403494035040351403524035340354403554035640357403584035940360403614036240363403644036540366403674036840369403704037140372403734037440375403764037740378403794038040381403824038340384403854038640387403884038940390403914039240393403944039540396403974039840399404004040140402404034040440405404064040740408404094041040411404124041340414404154041640417404184041940420404214042240423404244042540426404274042840429404304043140432404334043440435404364043740438404394044040441404424044340444404454044640447404484044940450404514045240453404544045540456404574045840459404604046140462404634046440465404664046740468404694047040471404724047340474404754047640477404784047940480404814048240483404844048540486404874048840489404904049140492404934049440495404964049740498404994050040501405024050340504405054050640507405084050940510405114051240513405144051540516405174051840519405204052140522405234052440525405264052740528405294053040531405324053340534405354053640537405384053940540405414054240543405444054540546405474054840549405504055140552405534055440555405564055740558405594056040561405624056340564405654056640567405684056940570405714057240573405744057540576405774057840579405804058140582405834058440585405864058740588405894059040591405924059340594405954059640597405984059940600406014060240603406044060540606406074060840609406104061140612406134061440615406164061740618406194062040621406224062340624406254062640627406284062940630406314063240633406344063540636406374063840639406404064140642406434064440645406464064740648406494065040651406524065340654406554065640657406584065940660406614066240663406644066540666406674066840669406704067140672406734067440675406764067740678406794068040681406824068340684406854068640687406884068940690406914069240693406944069540696406974069840699407004070140702407034070440705407064070740708407094071040711407124071340714407154071640717407184071940720407214072240723407244072540726407274072840729407304073140732407334073440735407364073740738407394074040741407424074340744407454074640747407484074940750407514075240753407544075540756407574075840759407604076140762407634076440765407664076740768407694077040771407724077340774407754077640777407784077940780407814078240783407844078540786407874078840789407904079140792407934079440795407964079740798407994080040801408024080340804408054080640807408084080940810408114081240813408144081540816408174081840819408204082140822408234082440825408264082740828408294083040831408324083340834408354083640837408384083940840408414084240843408444084540846408474084840849408504085140852408534085440855408564085740858408594086040861408624086340864408654086640867408684086940870408714087240873408744087540876408774087840879408804088140882408834088440885408864088740888408894089040891408924089340894408954089640897408984089940900409014090240903409044090540906409074090840909409104091140912409134091440915409164091740918409194092040921409224092340924409254092640927409284092940930409314093240933409344093540936409374093840939409404094140942409434094440945409464094740948409494095040951409524095340954409554095640957409584095940960409614096240963409644096540966409674096840969409704097140972409734097440975409764097740978409794098040981409824098340984409854098640987409884098940990409914099240993409944099540996409974099840999410004100141002410034100441005410064100741008410094101041011410124101341014410154101641017410184101941020410214102241023410244102541026410274102841029410304103141032410334103441035410364103741038410394104041041410424104341044410454104641047410484104941050410514105241053410544105541056410574105841059410604106141062410634106441065410664106741068410694107041071410724107341074410754107641077410784107941080410814108241083410844108541086410874108841089410904109141092410934109441095410964109741098410994110041101411024110341104411054110641107411084110941110411114111241113411144111541116411174111841119411204112141122411234112441125411264112741128411294113041131411324113341134411354113641137411384113941140411414114241143411444114541146411474114841149411504115141152411534115441155411564115741158411594116041161411624116341164411654116641167411684116941170411714117241173411744117541176411774117841179411804118141182411834118441185411864118741188411894119041191411924119341194411954119641197411984119941200412014120241203412044120541206412074120841209412104121141212412134121441215412164121741218412194122041221412224122341224412254122641227412284122941230412314123241233412344123541236412374123841239412404124141242412434124441245412464124741248412494125041251412524125341254412554125641257412584125941260412614126241263412644126541266412674126841269412704127141272412734127441275412764127741278412794128041281412824128341284412854128641287412884128941290412914129241293412944129541296412974129841299413004130141302413034130441305413064130741308413094131041311413124131341314413154131641317413184131941320413214132241323413244132541326413274132841329413304133141332413334133441335413364133741338413394134041341413424134341344413454134641347413484134941350413514135241353413544135541356413574135841359413604136141362413634136441365413664136741368413694137041371413724137341374413754137641377413784137941380413814138241383413844138541386413874138841389413904139141392413934139441395413964139741398413994140041401414024140341404414054140641407414084140941410414114141241413414144141541416414174141841419414204142141422414234142441425414264142741428414294143041431414324143341434414354143641437414384143941440414414144241443414444144541446414474144841449414504145141452414534145441455414564145741458414594146041461414624146341464414654146641467414684146941470414714147241473414744147541476414774147841479414804148141482414834148441485414864148741488414894149041491414924149341494414954149641497414984149941500415014150241503415044150541506415074150841509415104151141512415134151441515415164151741518415194152041521415224152341524415254152641527415284152941530415314153241533415344153541536415374153841539415404154141542415434154441545415464154741548415494155041551415524155341554415554155641557415584155941560415614156241563415644156541566415674156841569415704157141572415734157441575415764157741578415794158041581415824158341584415854158641587415884158941590415914159241593415944159541596415974159841599416004160141602416034160441605416064160741608416094161041611416124161341614416154161641617416184161941620416214162241623416244162541626416274162841629416304163141632416334163441635416364163741638416394164041641416424164341644416454164641647416484164941650416514165241653416544165541656416574165841659416604166141662416634166441665416664166741668416694167041671416724167341674416754167641677416784167941680416814168241683416844168541686416874168841689416904169141692416934169441695416964169741698416994170041701417024170341704417054170641707417084170941710417114171241713417144171541716417174171841719417204172141722417234172441725417264172741728417294173041731417324173341734417354173641737417384173941740417414174241743417444174541746417474174841749417504175141752417534175441755417564175741758417594176041761417624176341764417654176641767417684176941770417714177241773417744177541776417774177841779417804178141782417834178441785417864178741788417894179041791417924179341794417954179641797417984179941800418014180241803418044180541806418074180841809418104181141812418134181441815418164181741818418194182041821418224182341824418254182641827418284182941830418314183241833418344183541836418374183841839418404184141842418434184441845418464184741848418494185041851418524185341854418554185641857418584185941860418614186241863418644186541866418674186841869418704187141872418734187441875418764187741878418794188041881418824188341884418854188641887418884188941890418914189241893418944189541896418974189841899419004190141902419034190441905419064190741908419094191041911419124191341914419154191641917419184191941920419214192241923419244192541926419274192841929419304193141932419334193441935419364193741938419394194041941419424194341944419454194641947419484194941950419514195241953419544195541956419574195841959419604196141962419634196441965419664196741968419694197041971419724197341974419754197641977419784197941980419814198241983419844198541986419874198841989419904199141992419934199441995419964199741998419994200042001420024200342004420054200642007420084200942010420114201242013420144201542016420174201842019420204202142022420234202442025420264202742028420294203042031420324203342034420354203642037420384203942040420414204242043420444204542046420474204842049420504205142052420534205442055420564205742058420594206042061420624206342064420654206642067420684206942070420714207242073420744207542076420774207842079420804208142082420834208442085420864208742088420894209042091420924209342094420954209642097420984209942100421014210242103421044210542106421074210842109421104211142112421134211442115421164211742118421194212042121421224212342124421254212642127421284212942130421314213242133421344213542136421374213842139421404214142142421434214442145421464214742148421494215042151421524215342154421554215642157421584215942160421614216242163421644216542166421674216842169421704217142172421734217442175421764217742178421794218042181421824218342184421854218642187421884218942190421914219242193421944219542196421974219842199422004220142202422034220442205422064220742208422094221042211422124221342214422154221642217422184221942220422214222242223422244222542226422274222842229422304223142232422334223442235422364223742238422394224042241422424224342244422454224642247422484224942250422514225242253422544225542256422574225842259422604226142262422634226442265422664226742268422694227042271422724227342274422754227642277422784227942280422814228242283422844228542286422874228842289422904229142292422934229442295422964229742298422994230042301423024230342304423054230642307423084230942310423114231242313423144231542316423174231842319423204232142322423234232442325423264232742328423294233042331423324233342334423354233642337423384233942340423414234242343423444234542346423474234842349423504235142352423534235442355423564235742358423594236042361423624236342364423654236642367423684236942370423714237242373423744237542376423774237842379423804238142382423834238442385423864238742388423894239042391423924239342394423954239642397423984239942400424014240242403424044240542406424074240842409424104241142412424134241442415424164241742418424194242042421424224242342424424254242642427424284242942430424314243242433424344243542436424374243842439424404244142442424434244442445424464244742448424494245042451424524245342454424554245642457424584245942460424614246242463424644246542466424674246842469424704247142472424734247442475424764247742478424794248042481424824248342484424854248642487424884248942490424914249242493424944249542496424974249842499425004250142502425034250442505425064250742508425094251042511425124251342514425154251642517425184251942520425214252242523425244252542526425274252842529425304253142532425334253442535425364253742538425394254042541425424254342544425454254642547425484254942550425514255242553425544255542556425574255842559425604256142562425634256442565425664256742568425694257042571425724257342574425754257642577425784257942580425814258242583425844258542586425874258842589425904259142592425934259442595425964259742598425994260042601426024260342604426054260642607426084260942610426114261242613426144261542616426174261842619426204262142622426234262442625426264262742628426294263042631426324263342634426354263642637426384263942640426414264242643426444264542646426474264842649426504265142652426534265442655426564265742658426594266042661426624266342664426654266642667426684266942670426714267242673426744267542676426774267842679426804268142682426834268442685426864268742688426894269042691426924269342694426954269642697426984269942700427014270242703427044270542706427074270842709427104271142712427134271442715427164271742718427194272042721427224272342724427254272642727427284272942730427314273242733427344273542736427374273842739427404274142742427434274442745427464274742748427494275042751427524275342754427554275642757427584275942760427614276242763427644276542766427674276842769427704277142772427734277442775427764277742778427794278042781427824278342784427854278642787427884278942790427914279242793427944279542796427974279842799428004280142802428034280442805428064280742808428094281042811428124281342814428154281642817428184281942820428214282242823428244282542826428274282842829428304283142832428334283442835428364283742838428394284042841428424284342844428454284642847428484284942850428514285242853428544285542856428574285842859428604286142862428634286442865428664286742868428694287042871428724287342874428754287642877428784287942880428814288242883428844288542886428874288842889428904289142892428934289442895428964289742898428994290042901429024290342904429054290642907429084290942910429114291242913429144291542916429174291842919429204292142922429234292442925429264292742928429294293042931429324293342934429354293642937429384293942940429414294242943429444294542946429474294842949429504295142952429534295442955429564295742958429594296042961429624296342964429654296642967429684296942970429714297242973429744297542976429774297842979429804298142982429834298442985429864298742988429894299042991429924299342994429954299642997429984299943000430014300243003430044300543006430074300843009430104301143012430134301443015430164301743018430194302043021430224302343024430254302643027430284302943030430314303243033430344303543036430374303843039430404304143042430434304443045430464304743048430494305043051430524305343054430554305643057430584305943060430614306243063430644306543066430674306843069430704307143072430734307443075430764307743078430794308043081430824308343084430854308643087430884308943090430914309243093430944309543096430974309843099431004310143102431034310443105431064310743108431094311043111431124311343114431154311643117431184311943120431214312243123431244312543126431274312843129431304313143132431334313443135431364313743138431394314043141431424314343144431454314643147431484314943150431514315243153431544315543156431574315843159431604316143162431634316443165431664316743168431694317043171431724317343174431754317643177431784317943180431814318243183431844318543186431874318843189431904319143192431934319443195431964319743198431994320043201432024320343204432054320643207432084320943210432114321243213432144321543216432174321843219432204322143222432234322443225432264322743228432294323043231432324323343234432354323643237432384323943240432414324243243432444324543246432474324843249432504325143252432534325443255432564325743258432594326043261432624326343264432654326643267432684326943270432714327243273432744327543276432774327843279432804328143282432834328443285432864328743288432894329043291432924329343294432954329643297432984329943300433014330243303433044330543306433074330843309433104331143312433134331443315433164331743318433194332043321433224332343324433254332643327433284332943330433314333243333433344333543336433374333843339433404334143342433434334443345433464334743348433494335043351433524335343354433554335643357433584335943360433614336243363433644336543366433674336843369433704337143372433734337443375433764337743378433794338043381433824338343384433854338643387433884338943390433914339243393433944339543396433974339843399434004340143402434034340443405434064340743408434094341043411434124341343414434154341643417434184341943420434214342243423434244342543426434274342843429434304343143432434334343443435434364343743438434394344043441434424344343444434454344643447434484344943450434514345243453434544345543456434574345843459434604346143462434634346443465434664346743468434694347043471434724347343474434754347643477434784347943480434814348243483434844348543486434874348843489434904349143492434934349443495434964349743498434994350043501435024350343504435054350643507435084350943510435114351243513435144351543516435174351843519435204352143522435234352443525435264352743528435294353043531435324353343534435354353643537435384353943540435414354243543435444354543546435474354843549435504355143552435534355443555435564355743558435594356043561435624356343564435654356643567435684356943570435714357243573435744357543576435774357843579435804358143582435834358443585435864358743588435894359043591435924359343594435954359643597435984359943600436014360243603436044360543606436074360843609436104361143612436134361443615436164361743618436194362043621436224362343624436254362643627436284362943630436314363243633436344363543636436374363843639436404364143642436434364443645436464364743648436494365043651436524365343654436554365643657436584365943660436614366243663436644366543666436674366843669436704367143672436734367443675436764367743678436794368043681436824368343684436854368643687436884368943690436914369243693436944369543696436974369843699437004370143702437034370443705437064370743708437094371043711437124371343714437154371643717437184371943720437214372243723437244372543726437274372843729437304373143732437334373443735437364373743738437394374043741437424374343744437454374643747437484374943750437514375243753437544375543756437574375843759437604376143762437634376443765437664376743768437694377043771437724377343774437754377643777437784377943780437814378243783437844378543786437874378843789437904379143792437934379443795437964379743798437994380043801438024380343804438054380643807438084380943810438114381243813438144381543816438174381843819438204382143822438234382443825438264382743828438294383043831438324383343834438354383643837438384383943840438414384243843438444384543846438474384843849438504385143852438534385443855438564385743858438594386043861438624386343864438654386643867438684386943870438714387243873438744387543876438774387843879438804388143882438834388443885438864388743888438894389043891438924389343894438954389643897438984389943900439014390243903439044390543906439074390843909439104391143912439134391443915439164391743918439194392043921439224392343924439254392643927439284392943930439314393243933439344393543936439374393843939439404394143942439434394443945439464394743948439494395043951439524395343954439554395643957439584395943960439614396243963439644396543966439674396843969439704397143972439734397443975439764397743978439794398043981439824398343984439854398643987439884398943990439914399243993439944399543996439974399843999440004400144002440034400444005440064400744008440094401044011440124401344014440154401644017440184401944020440214402244023440244402544026440274402844029440304403144032440334403444035440364403744038440394404044041440424404344044440454404644047440484404944050440514405244053440544405544056440574405844059440604406144062440634406444065440664406744068440694407044071440724407344074440754407644077440784407944080440814408244083440844408544086440874408844089440904409144092440934409444095440964409744098440994410044101441024410344104441054410644107441084410944110441114411244113441144411544116441174411844119441204412144122441234412444125441264412744128441294413044131441324413344134441354413644137441384413944140441414414244143441444414544146441474414844149441504415144152441534415444155441564415744158441594416044161441624416344164441654416644167441684416944170441714417244173441744417544176441774417844179441804418144182441834418444185441864418744188441894419044191441924419344194441954419644197441984419944200442014420244203442044420544206442074420844209442104421144212442134421444215442164421744218442194422044221442224422344224442254422644227442284422944230442314423244233442344423544236442374423844239442404424144242442434424444245442464424744248442494425044251442524425344254442554425644257442584425944260442614426244263442644426544266442674426844269442704427144272442734427444275442764427744278442794428044281442824428344284442854428644287442884428944290442914429244293442944429544296442974429844299443004430144302443034430444305443064430744308443094431044311443124431344314443154431644317443184431944320443214432244323443244432544326443274432844329443304433144332443334433444335443364433744338443394434044341443424434344344443454434644347443484434944350443514435244353443544435544356443574435844359443604436144362443634436444365443664436744368443694437044371443724437344374443754437644377443784437944380443814438244383443844438544386443874438844389443904439144392443934439444395443964439744398443994440044401444024440344404444054440644407444084440944410444114441244413444144441544416444174441844419444204442144422444234442444425444264442744428444294443044431444324443344434444354443644437444384443944440444414444244443444444444544446444474444844449444504445144452444534445444455444564445744458444594446044461444624446344464444654446644467444684446944470444714447244473444744447544476444774447844479444804448144482444834448444485444864448744488444894449044491444924449344494444954449644497444984449944500445014450244503445044450544506445074450844509445104451144512445134451444515445164451744518445194452044521445224452344524445254452644527445284452944530445314453244533445344453544536445374453844539445404454144542445434454444545445464454744548445494455044551445524455344554445554455644557445584455944560445614456244563445644456544566445674456844569445704457144572445734457444575445764457744578445794458044581445824458344584445854458644587445884458944590445914459244593445944459544596445974459844599446004460144602446034460444605446064460744608446094461044611446124461344614446154461644617446184461944620446214462244623446244462544626446274462844629446304463144632446334463444635446364463744638446394464044641446424464344644446454464644647446484464944650446514465244653446544465544656446574465844659446604466144662446634466444665446664466744668446694467044671446724467344674446754467644677446784467944680446814468244683446844468544686446874468844689446904469144692446934469444695446964469744698446994470044701447024470344704447054470644707447084470944710447114471244713447144471544716447174471844719447204472144722447234472444725447264472744728447294473044731447324473344734447354473644737447384473944740447414474244743447444474544746447474474844749447504475144752447534475444755447564475744758447594476044761447624476344764447654476644767447684476944770447714477244773447744477544776447774477844779447804478144782447834478444785447864478744788447894479044791447924479344794447954479644797447984479944800448014480244803448044480544806448074480844809448104481144812448134481444815448164481744818448194482044821448224482344824448254482644827448284482944830448314483244833448344483544836448374483844839448404484144842448434484444845448464484744848448494485044851448524485344854448554485644857448584485944860448614486244863448644486544866448674486844869448704487144872448734487444875448764487744878448794488044881448824488344884448854488644887448884488944890448914489244893448944489544896448974489844899449004490144902449034490444905449064490744908449094491044911449124491344914449154491644917449184491944920449214492244923449244492544926449274492844929449304493144932449334493444935449364493744938449394494044941449424494344944449454494644947449484494944950449514495244953449544495544956449574495844959449604496144962449634496444965449664496744968449694497044971449724497344974449754497644977449784497944980449814498244983449844498544986449874498844989449904499144992449934499444995449964499744998449994500045001450024500345004450054500645007450084500945010450114501245013450144501545016450174501845019450204502145022450234502445025450264502745028450294503045031450324503345034450354503645037450384503945040450414504245043450444504545046450474504845049450504505145052450534505445055450564505745058450594506045061450624506345064450654506645067450684506945070450714507245073450744507545076450774507845079450804508145082450834508445085450864508745088450894509045091450924509345094450954509645097450984509945100451014510245103451044510545106451074510845109451104511145112451134511445115451164511745118451194512045121451224512345124451254512645127451284512945130451314513245133451344513545136451374513845139451404514145142451434514445145451464514745148451494515045151451524515345154451554515645157451584515945160451614516245163451644516545166451674516845169451704517145172451734517445175451764517745178451794518045181451824518345184451854518645187451884518945190451914519245193451944519545196451974519845199452004520145202452034520445205452064520745208452094521045211452124521345214452154521645217452184521945220452214522245223452244522545226452274522845229452304523145232452334523445235452364523745238452394524045241452424524345244452454524645247452484524945250452514525245253452544525545256452574525845259452604526145262452634526445265452664526745268452694527045271452724527345274452754527645277452784527945280452814528245283452844528545286452874528845289452904529145292452934529445295452964529745298452994530045301453024530345304453054530645307453084530945310453114531245313453144531545316453174531845319453204532145322453234532445325453264532745328453294533045331453324533345334453354533645337453384533945340453414534245343453444534545346453474534845349453504535145352453534535445355453564535745358453594536045361453624536345364453654536645367453684536945370453714537245373453744537545376453774537845379453804538145382453834538445385453864538745388453894539045391453924539345394453954539645397453984539945400454014540245403454044540545406454074540845409454104541145412454134541445415454164541745418454194542045421454224542345424454254542645427454284542945430454314543245433454344543545436454374543845439454404544145442454434544445445454464544745448454494545045451454524545345454454554545645457454584545945460454614546245463454644546545466454674546845469454704547145472454734547445475454764547745478454794548045481454824548345484454854548645487454884548945490454914549245493454944549545496454974549845499455004550145502455034550445505455064550745508455094551045511455124551345514455154551645517455184551945520455214552245523455244552545526455274552845529455304553145532455334553445535455364553745538455394554045541455424554345544455454554645547455484554945550455514555245553455544555545556455574555845559455604556145562455634556445565455664556745568455694557045571455724557345574455754557645577455784557945580455814558245583455844558545586455874558845589455904559145592455934559445595455964559745598455994560045601456024560345604456054560645607456084560945610456114561245613456144561545616456174561845619456204562145622456234562445625456264562745628456294563045631456324563345634456354563645637456384563945640456414564245643456444564545646456474564845649456504565145652456534565445655456564565745658456594566045661456624566345664456654566645667456684566945670456714567245673456744567545676456774567845679456804568145682456834568445685456864568745688456894569045691456924569345694456954569645697456984569945700457014570245703457044570545706457074570845709457104571145712457134571445715457164571745718457194572045721457224572345724457254572645727457284572945730457314573245733457344573545736457374573845739457404574145742457434574445745457464574745748457494575045751457524575345754457554575645757457584575945760457614576245763457644576545766457674576845769457704577145772457734577445775457764577745778457794578045781457824578345784457854578645787457884578945790457914579245793457944579545796457974579845799458004580145802458034580445805458064580745808458094581045811458124581345814458154581645817458184581945820458214582245823458244582545826458274582845829458304583145832458334583445835458364583745838458394584045841458424584345844458454584645847458484584945850458514585245853458544585545856458574585845859458604586145862458634586445865458664586745868458694587045871458724587345874458754587645877458784587945880458814588245883458844588545886458874588845889458904589145892458934589445895458964589745898458994590045901459024590345904459054590645907459084590945910459114591245913459144591545916459174591845919459204592145922459234592445925459264592745928459294593045931459324593345934459354593645937459384593945940459414594245943459444594545946459474594845949459504595145952459534595445955459564595745958459594596045961459624596345964459654596645967459684596945970459714597245973459744597545976459774597845979459804598145982459834598445985459864598745988459894599045991459924599345994459954599645997459984599946000460014600246003460044600546006460074600846009460104601146012460134601446015460164601746018460194602046021460224602346024460254602646027460284602946030460314603246033460344603546036460374603846039460404604146042460434604446045460464604746048460494605046051460524605346054460554605646057460584605946060460614606246063460644606546066460674606846069460704607146072460734607446075460764607746078460794608046081460824608346084460854608646087460884608946090460914609246093460944609546096460974609846099461004610146102461034610446105461064610746108461094611046111461124611346114461154611646117461184611946120461214612246123461244612546126461274612846129461304613146132461334613446135461364613746138461394614046141461424614346144461454614646147461484614946150461514615246153461544615546156461574615846159461604616146162461634616446165461664616746168461694617046171461724617346174461754617646177461784617946180461814618246183461844618546186461874618846189461904619146192461934619446195461964619746198461994620046201462024620346204462054620646207462084620946210462114621246213462144621546216462174621846219462204622146222462234622446225462264622746228462294623046231462324623346234462354623646237462384623946240462414624246243462444624546246462474624846249462504625146252462534625446255462564625746258462594626046261462624626346264462654626646267462684626946270462714627246273462744627546276462774627846279462804628146282462834628446285462864628746288462894629046291462924629346294462954629646297462984629946300463014630246303463044630546306463074630846309463104631146312463134631446315463164631746318463194632046321463224632346324463254632646327463284632946330463314633246333463344633546336463374633846339463404634146342463434634446345463464634746348463494635046351463524635346354463554635646357463584635946360463614636246363463644636546366463674636846369463704637146372463734637446375463764637746378463794638046381463824638346384463854638646387463884638946390463914639246393463944639546396463974639846399464004640146402464034640446405464064640746408464094641046411464124641346414464154641646417464184641946420464214642246423464244642546426464274642846429464304643146432464334643446435464364643746438464394644046441464424644346444464454644646447464484644946450464514645246453464544645546456464574645846459464604646146462464634646446465464664646746468464694647046471464724647346474464754647646477464784647946480464814648246483464844648546486464874648846489464904649146492464934649446495464964649746498464994650046501465024650346504465054650646507465084650946510465114651246513465144651546516465174651846519465204652146522465234652446525465264652746528465294653046531465324653346534465354653646537465384653946540465414654246543465444654546546465474654846549465504655146552465534655446555465564655746558465594656046561465624656346564465654656646567465684656946570465714657246573465744657546576465774657846579465804658146582465834658446585465864658746588465894659046591465924659346594465954659646597465984659946600466014660246603466044660546606466074660846609466104661146612466134661446615466164661746618466194662046621466224662346624466254662646627466284662946630466314663246633466344663546636466374663846639466404664146642466434664446645466464664746648466494665046651466524665346654466554665646657466584665946660466614666246663466644666546666466674666846669466704667146672466734667446675466764667746678466794668046681466824668346684466854668646687466884668946690466914669246693466944669546696466974669846699467004670146702467034670446705467064670746708467094671046711467124671346714467154671646717467184671946720467214672246723467244672546726467274672846729467304673146732467334673446735467364673746738467394674046741467424674346744467454674646747467484674946750467514675246753467544675546756467574675846759467604676146762467634676446765467664676746768467694677046771467724677346774467754677646777467784677946780467814678246783467844678546786467874678846789467904679146792467934679446795467964679746798467994680046801468024680346804468054680646807468084680946810468114681246813468144681546816468174681846819468204682146822468234682446825468264682746828468294683046831468324683346834468354683646837468384683946840468414684246843468444684546846468474684846849468504685146852468534685446855468564685746858468594686046861468624686346864468654686646867468684686946870468714687246873468744687546876468774687846879468804688146882468834688446885468864688746888468894689046891468924689346894468954689646897468984689946900469014690246903469044690546906469074690846909469104691146912469134691446915469164691746918469194692046921469224692346924469254692646927469284692946930469314693246933469344693546936469374693846939469404694146942469434694446945469464694746948469494695046951469524695346954469554695646957469584695946960469614696246963469644696546966469674696846969469704697146972469734697446975469764697746978469794698046981469824698346984469854698646987469884698946990469914699246993469944699546996469974699846999470004700147002470034700447005470064700747008470094701047011470124701347014470154701647017470184701947020470214702247023470244702547026470274702847029470304703147032470334703447035470364703747038470394704047041470424704347044470454704647047470484704947050470514705247053470544705547056470574705847059470604706147062470634706447065470664706747068470694707047071470724707347074470754707647077470784707947080470814708247083470844708547086470874708847089470904709147092470934709447095470964709747098470994710047101471024710347104471054710647107471084710947110471114711247113471144711547116471174711847119471204712147122471234712447125471264712747128471294713047131471324713347134471354713647137471384713947140471414714247143471444714547146471474714847149471504715147152471534715447155471564715747158471594716047161471624716347164471654716647167471684716947170471714717247173471744717547176471774717847179471804718147182471834718447185471864718747188471894719047191471924719347194471954719647197471984719947200472014720247203472044720547206472074720847209472104721147212472134721447215472164721747218472194722047221472224722347224472254722647227472284722947230472314723247233472344723547236472374723847239472404724147242472434724447245472464724747248472494725047251472524725347254472554725647257472584725947260472614726247263472644726547266472674726847269472704727147272472734727447275472764727747278472794728047281472824728347284472854728647287472884728947290472914729247293472944729547296472974729847299473004730147302473034730447305473064730747308473094731047311473124731347314473154731647317473184731947320473214732247323473244732547326473274732847329473304733147332473334733447335473364733747338473394734047341473424734347344473454734647347473484734947350473514735247353473544735547356473574735847359473604736147362473634736447365473664736747368473694737047371473724737347374473754737647377473784737947380473814738247383473844738547386473874738847389473904739147392473934739447395473964739747398473994740047401474024740347404474054740647407474084740947410474114741247413474144741547416474174741847419474204742147422474234742447425474264742747428474294743047431474324743347434474354743647437474384743947440474414744247443474444744547446474474744847449474504745147452474534745447455474564745747458474594746047461474624746347464474654746647467474684746947470474714747247473474744747547476474774747847479474804748147482474834748447485474864748747488474894749047491474924749347494474954749647497474984749947500475014750247503475044750547506475074750847509475104751147512475134751447515475164751747518475194752047521475224752347524475254752647527475284752947530475314753247533475344753547536475374753847539475404754147542475434754447545475464754747548475494755047551475524755347554475554755647557475584755947560475614756247563475644756547566475674756847569475704757147572475734757447575475764757747578475794758047581475824758347584475854758647587475884758947590475914759247593475944759547596475974759847599476004760147602476034760447605476064760747608476094761047611476124761347614476154761647617476184761947620476214762247623476244762547626476274762847629476304763147632476334763447635476364763747638476394764047641476424764347644476454764647647476484764947650476514765247653476544765547656476574765847659476604766147662476634766447665476664766747668476694767047671476724767347674476754767647677476784767947680476814768247683476844768547686476874768847689476904769147692476934769447695476964769747698476994770047701477024770347704477054770647707477084770947710477114771247713477144771547716477174771847719477204772147722477234772447725477264772747728477294773047731477324773347734477354773647737477384773947740477414774247743477444774547746477474774847749477504775147752477534775447755477564775747758477594776047761477624776347764477654776647767477684776947770477714777247773477744777547776477774777847779477804778147782477834778447785477864778747788477894779047791477924779347794477954779647797477984779947800478014780247803478044780547806478074780847809478104781147812478134781447815478164781747818478194782047821478224782347824478254782647827478284782947830478314783247833478344783547836478374783847839478404784147842478434784447845478464784747848478494785047851478524785347854478554785647857478584785947860478614786247863478644786547866478674786847869478704787147872478734787447875478764787747878478794788047881478824788347884478854788647887478884788947890478914789247893478944789547896478974789847899479004790147902479034790447905479064790747908479094791047911479124791347914479154791647917479184791947920479214792247923479244792547926479274792847929479304793147932479334793447935479364793747938479394794047941479424794347944479454794647947479484794947950479514795247953479544795547956479574795847959479604796147962479634796447965479664796747968479694797047971479724797347974479754797647977479784797947980479814798247983479844798547986479874798847989479904799147992479934799447995479964799747998479994800048001480024800348004480054800648007480084800948010480114801248013480144801548016480174801848019480204802148022480234802448025480264802748028480294803048031480324803348034480354803648037480384803948040480414804248043480444804548046480474804848049480504805148052480534805448055480564805748058480594806048061480624806348064480654806648067480684806948070480714807248073480744807548076480774807848079480804808148082480834808448085480864808748088480894809048091480924809348094480954809648097480984809948100481014810248103481044810548106481074810848109481104811148112481134811448115481164811748118481194812048121481224812348124481254812648127481284812948130481314813248133481344813548136481374813848139481404814148142481434814448145481464814748148481494815048151481524815348154481554815648157481584815948160481614816248163481644816548166481674816848169481704817148172481734817448175481764817748178481794818048181481824818348184481854818648187481884818948190481914819248193481944819548196481974819848199482004820148202482034820448205482064820748208482094821048211482124821348214482154821648217482184821948220482214822248223482244822548226482274822848229482304823148232482334823448235482364823748238482394824048241482424824348244482454824648247482484824948250482514825248253482544825548256482574825848259482604826148262482634826448265482664826748268482694827048271482724827348274482754827648277482784827948280482814828248283482844828548286482874828848289482904829148292482934829448295482964829748298482994830048301483024830348304483054830648307483084830948310483114831248313483144831548316483174831848319483204832148322483234832448325483264832748328483294833048331483324833348334483354833648337483384833948340483414834248343483444834548346483474834848349483504835148352483534835448355483564835748358483594836048361483624836348364483654836648367483684836948370483714837248373483744837548376483774837848379483804838148382483834838448385483864838748388483894839048391483924839348394483954839648397483984839948400484014840248403484044840548406484074840848409484104841148412484134841448415484164841748418484194842048421484224842348424484254842648427484284842948430484314843248433484344843548436484374843848439484404844148442484434844448445484464844748448484494845048451484524845348454484554845648457484584845948460484614846248463484644846548466484674846848469484704847148472484734847448475484764847748478484794848048481484824848348484484854848648487484884848948490484914849248493484944849548496484974849848499485004850148502485034850448505485064850748508485094851048511485124851348514485154851648517485184851948520485214852248523485244852548526485274852848529485304853148532485334853448535485364853748538485394854048541485424854348544485454854648547485484854948550485514855248553485544855548556485574855848559485604856148562485634856448565485664856748568485694857048571485724857348574485754857648577485784857948580485814858248583485844858548586485874858848589485904859148592485934859448595485964859748598485994860048601486024860348604486054860648607486084860948610486114861248613486144861548616486174861848619486204862148622486234862448625486264862748628486294863048631486324863348634486354863648637486384863948640486414864248643486444864548646486474864848649486504865148652486534865448655486564865748658486594866048661486624866348664486654866648667486684866948670486714867248673486744867548676486774867848679486804868148682486834868448685486864868748688486894869048691486924869348694486954869648697486984869948700487014870248703487044870548706487074870848709487104871148712487134871448715487164871748718487194872048721487224872348724487254872648727487284872948730487314873248733487344873548736487374873848739487404874148742487434874448745487464874748748487494875048751487524875348754487554875648757487584875948760487614876248763487644876548766487674876848769487704877148772487734877448775487764877748778487794878048781487824878348784487854878648787487884878948790487914879248793487944879548796487974879848799488004880148802488034880448805488064880748808488094881048811488124881348814488154881648817488184881948820488214882248823488244882548826488274882848829488304883148832488334883448835488364883748838488394884048841488424884348844488454884648847488484884948850488514885248853488544885548856488574885848859488604886148862488634886448865488664886748868488694887048871488724887348874488754887648877488784887948880488814888248883488844888548886488874888848889488904889148892488934889448895488964889748898488994890048901489024890348904489054890648907489084890948910489114891248913489144891548916489174891848919489204892148922489234892448925489264892748928489294893048931489324893348934489354893648937489384893948940489414894248943489444894548946489474894848949489504895148952489534895448955489564895748958489594896048961489624896348964489654896648967489684896948970489714897248973489744897548976489774897848979489804898148982489834898448985489864898748988489894899048991489924899348994489954899648997489984899949000490014900249003490044900549006490074900849009490104901149012490134901449015490164901749018490194902049021490224902349024490254902649027490284902949030490314903249033490344903549036490374903849039490404904149042490434904449045490464904749048490494905049051490524905349054490554905649057490584905949060490614906249063490644906549066490674906849069490704907149072490734907449075490764907749078490794908049081490824908349084490854908649087490884908949090490914909249093490944909549096490974909849099491004910149102491034910449105491064910749108491094911049111491124911349114491154911649117491184911949120491214912249123491244912549126491274912849129491304913149132491334913449135491364913749138491394914049141491424914349144491454914649147491484914949150491514915249153491544915549156491574915849159491604916149162491634916449165491664916749168491694917049171491724917349174491754917649177491784917949180491814918249183491844918549186491874918849189491904919149192491934919449195491964919749198491994920049201492024920349204492054920649207492084920949210492114921249213492144921549216492174921849219492204922149222492234922449225492264922749228492294923049231492324923349234492354923649237492384923949240492414924249243492444924549246492474924849249492504925149252492534925449255492564925749258492594926049261492624926349264492654926649267492684926949270492714927249273492744927549276492774927849279492804928149282492834928449285492864928749288492894929049291492924929349294492954929649297492984929949300493014930249303493044930549306493074930849309493104931149312493134931449315493164931749318493194932049321493224932349324493254932649327493284932949330493314933249333493344933549336493374933849339493404934149342493434934449345493464934749348493494935049351493524935349354493554935649357493584935949360493614936249363493644936549366493674936849369493704937149372493734937449375493764937749378493794938049381493824938349384493854938649387493884938949390493914939249393493944939549396493974939849399494004940149402494034940449405494064940749408494094941049411494124941349414494154941649417494184941949420494214942249423494244942549426494274942849429494304943149432494334943449435494364943749438494394944049441494424944349444494454944649447494484944949450494514945249453494544945549456494574945849459494604946149462494634946449465494664946749468494694947049471494724947349474494754947649477494784947949480494814948249483494844948549486494874948849489494904949149492494934949449495494964949749498494994950049501495024950349504495054950649507495084950949510495114951249513495144951549516495174951849519495204952149522495234952449525495264952749528495294953049531495324953349534495354953649537495384953949540495414954249543495444954549546495474954849549495504955149552495534955449555495564955749558495594956049561495624956349564495654956649567495684956949570495714957249573495744957549576495774957849579495804958149582495834958449585495864958749588495894959049591495924959349594495954959649597495984959949600496014960249603496044960549606496074960849609496104961149612496134961449615496164961749618496194962049621496224962349624496254962649627496284962949630496314963249633496344963549636496374963849639496404964149642496434964449645496464964749648496494965049651496524965349654496554965649657496584965949660496614966249663496644966549666496674966849669496704967149672496734967449675496764967749678496794968049681496824968349684496854968649687496884968949690496914969249693496944969549696496974969849699497004970149702497034970449705497064970749708497094971049711497124971349714497154971649717497184971949720497214972249723497244972549726497274972849729497304973149732497334973449735497364973749738497394974049741497424974349744497454974649747497484974949750497514975249753497544975549756497574975849759497604976149762497634976449765497664976749768497694977049771497724977349774497754977649777497784977949780497814978249783497844978549786497874978849789497904979149792497934979449795497964979749798497994980049801498024980349804498054980649807498084980949810498114981249813498144981549816498174981849819498204982149822498234982449825498264982749828498294983049831498324983349834498354983649837498384983949840498414984249843498444984549846498474984849849498504985149852498534985449855498564985749858498594986049861498624986349864498654986649867498684986949870498714987249873498744987549876498774987849879498804988149882498834988449885498864988749888498894989049891498924989349894498954989649897498984989949900499014990249903499044990549906499074990849909499104991149912499134991449915499164991749918499194992049921499224992349924499254992649927499284992949930499314993249933499344993549936499374993849939499404994149942499434994449945499464994749948499494995049951499524995349954499554995649957499584995949960499614996249963499644996549966499674996849969499704997149972499734997449975499764997749978499794998049981499824998349984499854998649987499884998949990499914999249993499944999549996499974999849999500005000150002500035000450005500065000750008500095001050011500125001350014500155001650017500185001950020500215002250023500245002550026500275002850029500305003150032500335003450035500365003750038500395004050041500425004350044500455004650047500485004950050500515005250053500545005550056500575005850059500605006150062500635006450065500665006750068500695007050071500725007350074500755007650077500785007950080500815008250083500845008550086500875008850089500905009150092500935009450095500965009750098500995010050101501025010350104501055010650107501085010950110501115011250113501145011550116501175011850119501205012150122501235012450125501265012750128501295013050131501325013350134501355013650137501385013950140501415014250143501445014550146501475014850149501505015150152501535015450155501565015750158501595016050161501625016350164501655016650167501685016950170501715017250173501745017550176501775017850179501805018150182501835018450185501865018750188501895019050191501925019350194501955019650197501985019950200502015020250203502045020550206502075020850209502105021150212502135021450215502165021750218502195022050221502225022350224502255022650227502285022950230502315023250233502345023550236502375023850239502405024150242502435024450245502465024750248502495025050251502525025350254502555025650257502585025950260502615026250263502645026550266502675026850269502705027150272502735027450275502765027750278502795028050281502825028350284502855028650287502885028950290502915029250293502945029550296502975029850299503005030150302503035030450305503065030750308503095031050311503125031350314503155031650317503185031950320503215032250323503245032550326503275032850329503305033150332503335033450335503365033750338503395034050341503425034350344503455034650347503485034950350503515035250353503545035550356503575035850359503605036150362503635036450365503665036750368503695037050371503725037350374503755037650377503785037950380503815038250383503845038550386503875038850389503905039150392503935039450395503965039750398503995040050401504025040350404504055040650407504085040950410504115041250413504145041550416504175041850419504205042150422504235042450425504265042750428504295043050431504325043350434504355043650437504385043950440504415044250443504445044550446504475044850449504505045150452504535045450455504565045750458504595046050461504625046350464504655046650467504685046950470504715047250473504745047550476504775047850479504805048150482504835048450485504865048750488504895049050491504925049350494504955049650497504985049950500505015050250503505045050550506505075050850509505105051150512505135051450515505165051750518505195052050521505225052350524505255052650527505285052950530505315053250533505345053550536505375053850539505405054150542505435054450545505465054750548505495055050551505525055350554505555055650557505585055950560505615056250563505645056550566505675056850569505705057150572505735057450575505765057750578505795058050581505825058350584505855058650587505885058950590505915059250593505945059550596505975059850599506005060150602506035060450605506065060750608506095061050611506125061350614506155061650617506185061950620506215062250623506245062550626506275062850629506305063150632506335063450635506365063750638506395064050641506425064350644506455064650647506485064950650506515065250653506545065550656506575065850659506605066150662506635066450665506665066750668506695067050671506725067350674506755067650677506785067950680506815068250683506845068550686506875068850689506905069150692506935069450695506965069750698506995070050701507025070350704507055070650707507085070950710507115071250713507145071550716507175071850719507205072150722507235072450725507265072750728507295073050731507325073350734507355073650737507385073950740507415074250743507445074550746507475074850749507505075150752507535075450755507565075750758507595076050761507625076350764507655076650767507685076950770507715077250773507745077550776507775077850779507805078150782507835078450785507865078750788507895079050791507925079350794507955079650797507985079950800508015080250803508045080550806508075080850809508105081150812508135081450815508165081750818508195082050821508225082350824508255082650827508285082950830508315083250833508345083550836508375083850839508405084150842508435084450845508465084750848508495085050851508525085350854508555085650857508585085950860508615086250863508645086550866508675086850869508705087150872508735087450875508765087750878508795088050881508825088350884508855088650887508885088950890508915089250893508945089550896508975089850899509005090150902509035090450905509065090750908509095091050911509125091350914509155091650917509185091950920509215092250923509245092550926509275092850929509305093150932509335093450935509365093750938509395094050941509425094350944509455094650947509485094950950509515095250953509545095550956509575095850959509605096150962509635096450965509665096750968509695097050971509725097350974509755097650977509785097950980509815098250983509845098550986509875098850989509905099150992509935099450995509965099750998509995100051001510025100351004510055100651007510085100951010510115101251013510145101551016510175101851019510205102151022510235102451025510265102751028510295103051031510325103351034510355103651037510385103951040510415104251043510445104551046510475104851049510505105151052510535105451055510565105751058510595106051061510625106351064510655106651067510685106951070510715107251073510745107551076510775107851079510805108151082510835108451085510865108751088510895109051091510925109351094510955109651097510985109951100511015110251103511045110551106511075110851109511105111151112511135111451115511165111751118511195112051121511225112351124511255112651127511285112951130511315113251133511345113551136511375113851139511405114151142511435114451145511465114751148511495115051151511525115351154511555115651157511585115951160511615116251163511645116551166511675116851169511705117151172511735117451175511765117751178511795118051181511825118351184511855118651187511885118951190511915119251193511945119551196511975119851199512005120151202512035120451205512065120751208512095121051211512125121351214512155121651217512185121951220512215122251223512245122551226512275122851229512305123151232512335123451235512365123751238512395124051241512425124351244512455124651247512485124951250512515125251253512545125551256512575125851259512605126151262512635126451265512665126751268512695127051271512725127351274512755127651277512785127951280512815128251283512845128551286512875128851289512905129151292512935129451295512965129751298512995130051301513025130351304513055130651307513085130951310513115131251313513145131551316513175131851319513205132151322513235132451325513265132751328513295133051331513325133351334513355133651337513385133951340513415134251343513445134551346513475134851349513505135151352513535135451355513565135751358513595136051361513625136351364513655136651367513685136951370513715137251373513745137551376513775137851379513805138151382513835138451385513865138751388513895139051391513925139351394513955139651397513985139951400514015140251403514045140551406514075140851409514105141151412514135141451415514165141751418514195142051421514225142351424514255142651427514285142951430514315143251433514345143551436514375143851439514405144151442514435144451445514465144751448514495145051451514525145351454514555145651457514585145951460514615146251463514645146551466514675146851469514705147151472514735147451475514765147751478514795148051481514825148351484514855148651487514885148951490514915149251493514945149551496514975149851499515005150151502515035150451505515065150751508515095151051511515125151351514515155151651517515185151951520515215152251523515245152551526515275152851529515305153151532515335153451535515365153751538515395154051541515425154351544515455154651547515485154951550515515155251553515545155551556515575155851559515605156151562515635156451565515665156751568515695157051571515725157351574515755157651577515785157951580515815158251583515845158551586515875158851589515905159151592515935159451595515965159751598515995160051601516025160351604516055160651607516085160951610516115161251613516145161551616516175161851619516205162151622516235162451625516265162751628516295163051631516325163351634516355163651637516385163951640516415164251643516445164551646516475164851649516505165151652516535165451655516565165751658516595166051661516625166351664516655166651667516685166951670516715167251673516745167551676516775167851679516805168151682516835168451685516865168751688516895169051691516925169351694516955169651697516985169951700517015170251703517045170551706517075170851709517105171151712517135171451715517165171751718517195172051721517225172351724517255172651727517285172951730517315173251733517345173551736517375173851739517405174151742517435174451745517465174751748517495175051751517525175351754517555175651757517585175951760517615176251763517645176551766517675176851769517705177151772517735177451775517765177751778517795178051781517825178351784517855178651787517885178951790517915179251793517945179551796517975179851799518005180151802518035180451805518065180751808518095181051811518125181351814518155181651817518185181951820518215182251823518245182551826518275182851829518305183151832518335183451835518365183751838518395184051841518425184351844518455184651847518485184951850518515185251853518545185551856518575185851859518605186151862518635186451865518665186751868518695187051871518725187351874518755187651877518785187951880518815188251883518845188551886518875188851889518905189151892518935189451895518965189751898518995190051901519025190351904519055190651907519085190951910519115191251913519145191551916519175191851919519205192151922519235192451925519265192751928519295193051931519325193351934519355193651937519385193951940519415194251943519445194551946519475194851949519505195151952519535195451955519565195751958519595196051961519625196351964519655196651967519685196951970519715197251973519745197551976519775197851979519805198151982519835198451985519865198751988519895199051991519925199351994519955199651997519985199952000520015200252003520045200552006520075200852009520105201152012520135201452015520165201752018520195202052021520225202352024520255202652027520285202952030520315203252033520345203552036520375203852039520405204152042520435204452045520465204752048520495205052051520525205352054520555205652057520585205952060520615206252063520645206552066520675206852069520705207152072520735207452075520765207752078520795208052081520825208352084520855208652087520885208952090520915209252093520945209552096520975209852099521005210152102521035210452105521065210752108521095211052111521125211352114521155211652117521185211952120521215212252123521245212552126521275212852129521305213152132521335213452135521365213752138521395214052141521425214352144521455214652147521485214952150521515215252153521545215552156521575215852159521605216152162521635216452165521665216752168521695217052171521725217352174521755217652177521785217952180521815218252183521845218552186521875218852189521905219152192521935219452195521965219752198521995220052201522025220352204522055220652207522085220952210522115221252213522145221552216522175221852219522205222152222522235222452225522265222752228522295223052231522325223352234522355223652237522385223952240522415224252243522445224552246522475224852249522505225152252522535225452255522565225752258522595226052261522625226352264522655226652267522685226952270522715227252273522745227552276522775227852279522805228152282522835228452285522865228752288522895229052291522925229352294522955229652297522985229952300523015230252303523045230552306523075230852309523105231152312523135231452315523165231752318523195232052321523225232352324523255232652327523285232952330523315233252333523345233552336523375233852339523405234152342523435234452345523465234752348523495235052351523525235352354523555235652357523585235952360523615236252363523645236552366523675236852369523705237152372523735237452375523765237752378523795238052381523825238352384523855238652387523885238952390523915239252393523945239552396523975239852399524005240152402524035240452405524065240752408524095241052411524125241352414524155241652417524185241952420524215242252423524245242552426524275242852429524305243152432524335243452435524365243752438524395244052441524425244352444524455244652447524485244952450524515245252453524545245552456524575245852459524605246152462524635246452465524665246752468524695247052471524725247352474524755247652477524785247952480524815248252483524845248552486524875248852489524905249152492524935249452495524965249752498524995250052501525025250352504525055250652507525085250952510525115251252513525145251552516525175251852519525205252152522525235252452525525265252752528525295253052531525325253352534525355253652537525385253952540525415254252543525445254552546525475254852549525505255152552525535255452555525565255752558525595256052561525625256352564525655256652567525685256952570525715257252573525745257552576525775257852579525805258152582525835258452585525865258752588525895259052591525925259352594525955259652597525985259952600526015260252603526045260552606526075260852609526105261152612526135261452615526165261752618526195262052621526225262352624526255262652627526285262952630526315263252633526345263552636526375263852639526405264152642526435264452645526465264752648526495265052651526525265352654526555265652657526585265952660526615266252663526645266552666526675266852669526705267152672526735267452675526765267752678526795268052681526825268352684526855268652687526885268952690526915269252693526945269552696526975269852699527005270152702527035270452705527065270752708527095271052711527125271352714527155271652717527185271952720527215272252723527245272552726527275272852729527305273152732527335273452735527365273752738527395274052741527425274352744527455274652747527485274952750527515275252753527545275552756527575275852759527605276152762527635276452765527665276752768527695277052771527725277352774527755277652777527785277952780527815278252783527845278552786527875278852789527905279152792527935279452795527965279752798527995280052801528025280352804528055280652807528085280952810528115281252813528145281552816528175281852819528205282152822528235282452825528265282752828528295283052831528325283352834528355283652837528385283952840528415284252843528445284552846528475284852849528505285152852528535285452855528565285752858528595286052861528625286352864528655286652867528685286952870528715287252873528745287552876528775287852879528805288152882528835288452885528865288752888528895289052891528925289352894528955289652897528985289952900529015290252903529045290552906529075290852909529105291152912529135291452915529165291752918529195292052921529225292352924529255292652927529285292952930529315293252933529345293552936529375293852939529405294152942529435294452945529465294752948529495295052951529525295352954529555295652957529585295952960529615296252963529645296552966529675296852969529705297152972529735297452975529765297752978529795298052981529825298352984529855298652987529885298952990529915299252993529945299552996529975299852999530005300153002530035300453005530065300753008530095301053011530125301353014530155301653017530185301953020530215302253023530245302553026530275302853029530305303153032530335303453035530365303753038530395304053041530425304353044530455304653047530485304953050530515305253053530545305553056530575305853059530605306153062530635306453065530665306753068530695307053071530725307353074530755307653077530785307953080530815308253083530845308553086530875308853089530905309153092530935309453095530965309753098530995310053101531025310353104531055310653107531085310953110531115311253113531145311553116531175311853119531205312153122531235312453125531265312753128531295313053131531325313353134531355313653137531385313953140531415314253143531445314553146531475314853149531505315153152531535315453155531565315753158531595316053161531625316353164531655316653167531685316953170531715317253173531745317553176531775317853179531805318153182531835318453185531865318753188531895319053191531925319353194531955319653197531985319953200532015320253203532045320553206532075320853209532105321153212532135321453215532165321753218532195322053221532225322353224532255322653227532285322953230532315323253233532345323553236532375323853239532405324153242532435324453245532465324753248532495325053251532525325353254532555325653257532585325953260532615326253263532645326553266532675326853269532705327153272532735327453275532765327753278532795328053281532825328353284532855328653287532885328953290532915329253293532945329553296532975329853299533005330153302533035330453305533065330753308533095331053311533125331353314533155331653317533185331953320533215332253323533245332553326533275332853329533305333153332533335333453335533365333753338533395334053341533425334353344533455334653347533485334953350533515335253353533545335553356533575335853359533605336153362533635336453365533665336753368533695337053371533725337353374533755337653377533785337953380533815338253383533845338553386533875338853389533905339153392533935339453395533965339753398533995340053401534025340353404534055340653407534085340953410534115341253413534145341553416534175341853419534205342153422534235342453425534265342753428534295343053431534325343353434534355343653437534385343953440534415344253443534445344553446534475344853449534505345153452534535345453455534565345753458534595346053461534625346353464534655346653467534685346953470534715347253473534745347553476534775347853479534805348153482534835348453485534865348753488534895349053491534925349353494534955349653497534985349953500535015350253503535045350553506535075350853509535105351153512535135351453515535165351753518535195352053521535225352353524535255352653527535285352953530535315353253533535345353553536535375353853539535405354153542535435354453545535465354753548535495355053551535525355353554535555355653557535585355953560535615356253563535645356553566535675356853569535705357153572535735357453575535765357753578535795358053581535825358353584535855358653587535885358953590535915359253593535945359553596535975359853599536005360153602536035360453605536065360753608536095361053611536125361353614536155361653617536185361953620536215362253623536245362553626536275362853629536305363153632536335363453635536365363753638536395364053641536425364353644536455364653647536485364953650536515365253653536545365553656536575365853659536605366153662536635366453665536665366753668536695367053671536725367353674536755367653677536785367953680536815368253683536845368553686536875368853689536905369153692536935369453695536965369753698536995370053701537025370353704537055370653707537085370953710537115371253713537145371553716537175371853719537205372153722537235372453725537265372753728537295373053731537325373353734537355373653737537385373953740537415374253743537445374553746537475374853749537505375153752537535375453755537565375753758537595376053761537625376353764537655376653767537685376953770537715377253773537745377553776537775377853779537805378153782537835378453785537865378753788537895379053791537925379353794537955379653797537985379953800538015380253803538045380553806538075380853809538105381153812538135381453815538165381753818538195382053821538225382353824538255382653827538285382953830538315383253833538345383553836538375383853839538405384153842538435384453845538465384753848538495385053851538525385353854538555385653857538585385953860538615386253863538645386553866538675386853869538705387153872538735387453875538765387753878538795388053881538825388353884538855388653887538885388953890538915389253893538945389553896538975389853899539005390153902539035390453905539065390753908539095391053911539125391353914539155391653917539185391953920539215392253923539245392553926539275392853929539305393153932539335393453935539365393753938539395394053941539425394353944539455394653947539485394953950539515395253953539545395553956539575395853959539605396153962539635396453965539665396753968539695397053971539725397353974539755397653977539785397953980539815398253983539845398553986539875398853989539905399153992539935399453995539965399753998539995400054001540025400354004540055400654007540085400954010540115401254013540145401554016540175401854019540205402154022540235402454025540265402754028540295403054031540325403354034540355403654037540385403954040540415404254043540445404554046540475404854049540505405154052540535405454055540565405754058540595406054061540625406354064540655406654067540685406954070540715407254073540745407554076540775407854079540805408154082540835408454085540865408754088540895409054091540925409354094540955409654097540985409954100541015410254103541045410554106541075410854109541105411154112541135411454115541165411754118541195412054121541225412354124541255412654127541285412954130541315413254133541345413554136541375413854139541405414154142541435414454145541465414754148541495415054151541525415354154541555415654157541585415954160541615416254163541645416554166541675416854169541705417154172541735417454175541765417754178541795418054181541825418354184541855418654187541885418954190541915419254193541945419554196541975419854199542005420154202542035420454205542065420754208542095421054211542125421354214542155421654217542185421954220542215422254223542245422554226542275422854229542305423154232542335423454235542365423754238542395424054241542425424354244542455424654247542485424954250542515425254253542545425554256542575425854259542605426154262542635426454265542665426754268542695427054271542725427354274542755427654277542785427954280542815428254283542845428554286542875428854289542905429154292542935429454295542965429754298542995430054301543025430354304543055430654307543085430954310543115431254313543145431554316543175431854319543205432154322543235432454325543265432754328543295433054331543325433354334543355433654337543385433954340543415434254343543445434554346543475434854349543505435154352543535435454355543565435754358543595436054361543625436354364543655436654367543685436954370543715437254373543745437554376543775437854379543805438154382543835438454385543865438754388543895439054391543925439354394543955439654397543985439954400544015440254403544045440554406544075440854409544105441154412544135441454415544165441754418544195442054421544225442354424544255442654427544285442954430544315443254433544345443554436544375443854439544405444154442544435444454445544465444754448544495445054451544525445354454544555445654457544585445954460544615446254463544645446554466544675446854469544705447154472544735447454475544765447754478544795448054481544825448354484544855448654487544885448954490544915449254493544945449554496544975449854499545005450154502545035450454505545065450754508545095451054511545125451354514545155451654517545185451954520545215452254523545245452554526545275452854529545305453154532545335453454535545365453754538545395454054541545425454354544545455454654547545485454954550545515455254553545545455554556545575455854559545605456154562545635456454565545665456754568545695457054571545725457354574545755457654577545785457954580545815458254583545845458554586545875458854589545905459154592545935459454595545965459754598545995460054601546025460354604546055460654607546085460954610546115461254613546145461554616546175461854619546205462154622546235462454625546265462754628546295463054631546325463354634546355463654637546385463954640546415464254643546445464554646546475464854649546505465154652546535465454655546565465754658546595466054661546625466354664546655466654667546685466954670546715467254673546745467554676546775467854679546805468154682546835468454685546865468754688546895469054691546925469354694546955469654697546985469954700547015470254703547045470554706547075470854709547105471154712547135471454715547165471754718547195472054721547225472354724547255472654727547285472954730547315473254733547345473554736547375473854739547405474154742547435474454745547465474754748547495475054751547525475354754547555475654757547585475954760547615476254763547645476554766547675476854769547705477154772547735477454775547765477754778547795478054781547825478354784547855478654787547885478954790547915479254793547945479554796547975479854799548005480154802548035480454805548065480754808548095481054811548125481354814548155481654817548185481954820548215482254823548245482554826548275482854829548305483154832548335483454835548365483754838548395484054841548425484354844548455484654847548485484954850548515485254853548545485554856548575485854859548605486154862548635486454865548665486754868548695487054871548725487354874548755487654877548785487954880548815488254883548845488554886548875488854889548905489154892548935489454895548965489754898548995490054901549025490354904549055490654907549085490954910549115491254913549145491554916549175491854919549205492154922549235492454925549265492754928549295493054931549325493354934549355493654937549385493954940549415494254943549445494554946549475494854949549505495154952549535495454955549565495754958549595496054961549625496354964549655496654967549685496954970549715497254973549745497554976549775497854979549805498154982549835498454985549865498754988549895499054991549925499354994549955499654997549985499955000550015500255003550045500555006550075500855009550105501155012550135501455015550165501755018550195502055021550225502355024550255502655027550285502955030550315503255033550345503555036550375503855039550405504155042550435504455045550465504755048550495505055051550525505355054550555505655057550585505955060550615506255063550645506555066550675506855069550705507155072550735507455075550765507755078550795508055081550825508355084550855508655087550885508955090550915509255093550945509555096550975509855099551005510155102551035510455105551065510755108551095511055111551125511355114551155511655117551185511955120551215512255123551245512555126551275512855129551305513155132551335513455135551365513755138551395514055141551425514355144551455514655147551485514955150551515515255153551545515555156551575515855159551605516155162551635516455165551665516755168551695517055171551725517355174551755517655177551785517955180551815518255183551845518555186551875518855189551905519155192551935519455195551965519755198551995520055201552025520355204552055520655207552085520955210552115521255213552145521555216552175521855219552205522155222552235522455225552265522755228552295523055231552325523355234552355523655237552385523955240552415524255243552445524555246552475524855249552505525155252552535525455255552565525755258552595526055261552625526355264552655526655267552685526955270552715527255273552745527555276552775527855279552805528155282552835528455285552865528755288552895529055291552925529355294552955529655297552985529955300553015530255303553045530555306553075530855309553105531155312553135531455315553165531755318553195532055321553225532355324553255532655327553285532955330553315533255333553345533555336553375533855339553405534155342553435534455345553465534755348553495535055351553525535355354553555535655357553585535955360553615536255363553645536555366553675536855369553705537155372553735537455375553765537755378553795538055381553825538355384553855538655387553885538955390553915539255393553945539555396553975539855399554005540155402554035540455405554065540755408554095541055411554125541355414554155541655417554185541955420554215542255423554245542555426554275542855429554305543155432554335543455435554365543755438554395544055441554425544355444554455544655447554485544955450554515545255453554545545555456554575545855459554605546155462554635546455465554665546755468554695547055471554725547355474554755547655477554785547955480554815548255483554845548555486554875548855489554905549155492554935549455495554965549755498554995550055501555025550355504555055550655507555085550955510555115551255513555145551555516555175551855519555205552155522555235552455525555265552755528555295553055531555325553355534555355553655537555385553955540555415554255543555445554555546555475554855549555505555155552555535555455555555565555755558555595556055561555625556355564555655556655567555685556955570555715557255573555745557555576555775557855579555805558155582555835558455585555865558755588555895559055591555925559355594555955559655597555985559955600556015560255603556045560555606556075560855609556105561155612556135561455615556165561755618556195562055621556225562355624556255562655627556285562955630556315563255633556345563555636556375563855639556405564155642556435564455645556465564755648556495565055651556525565355654556555565655657556585565955660556615566255663556645566555666556675566855669556705567155672556735567455675556765567755678556795568055681556825568355684556855568655687556885568955690556915569255693556945569555696556975569855699557005570155702557035570455705557065570755708557095571055711557125571355714557155571655717557185571955720557215572255723557245572555726557275572855729557305573155732557335573455735557365573755738557395574055741557425574355744557455574655747557485574955750557515575255753557545575555756557575575855759557605576155762557635576455765557665576755768557695577055771557725577355774557755577655777557785577955780557815578255783557845578555786557875578855789557905579155792557935579455795557965579755798557995580055801558025580355804558055580655807558085580955810558115581255813558145581555816558175581855819558205582155822558235582455825558265582755828558295583055831558325583355834558355583655837558385583955840558415584255843558445584555846558475584855849558505585155852558535585455855558565585755858558595586055861558625586355864558655586655867558685586955870558715587255873558745587555876558775587855879558805588155882558835588455885558865588755888558895589055891558925589355894558955589655897558985589955900559015590255903559045590555906559075590855909559105591155912559135591455915559165591755918559195592055921559225592355924559255592655927559285592955930559315593255933559345593555936559375593855939559405594155942559435594455945559465594755948559495595055951559525595355954559555595655957559585595955960559615596255963559645596555966559675596855969559705597155972559735597455975559765597755978559795598055981559825598355984559855598655987559885598955990559915599255993559945599555996559975599855999560005600156002560035600456005560065600756008560095601056011560125601356014560155601656017560185601956020560215602256023560245602556026560275602856029560305603156032560335603456035560365603756038560395604056041560425604356044560455604656047560485604956050560515605256053560545605556056560575605856059560605606156062560635606456065560665606756068560695607056071560725607356074560755607656077560785607956080560815608256083560845608556086560875608856089560905609156092560935609456095560965609756098560995610056101561025610356104561055610656107561085610956110561115611256113561145611556116561175611856119561205612156122561235612456125561265612756128561295613056131561325613356134561355613656137561385613956140561415614256143561445614556146561475614856149561505615156152561535615456155561565615756158561595616056161561625616356164561655616656167561685616956170561715617256173561745617556176561775617856179561805618156182561835618456185561865618756188561895619056191561925619356194561955619656197561985619956200562015620256203562045620556206562075620856209562105621156212562135621456215562165621756218562195622056221562225622356224562255622656227562285622956230562315623256233562345623556236562375623856239562405624156242562435624456245562465624756248562495625056251562525625356254562555625656257562585625956260562615626256263562645626556266562675626856269562705627156272562735627456275562765627756278562795628056281562825628356284562855628656287562885628956290562915629256293562945629556296562975629856299563005630156302563035630456305563065630756308563095631056311563125631356314563155631656317563185631956320563215632256323563245632556326563275632856329563305633156332563335633456335563365633756338563395634056341563425634356344563455634656347563485634956350563515635256353563545635556356563575635856359563605636156362563635636456365563665636756368563695637056371563725637356374563755637656377563785637956380563815638256383563845638556386563875638856389563905639156392563935639456395563965639756398563995640056401564025640356404564055640656407564085640956410564115641256413564145641556416564175641856419564205642156422564235642456425564265642756428564295643056431564325643356434564355643656437564385643956440564415644256443564445644556446564475644856449564505645156452564535645456455564565645756458564595646056461564625646356464564655646656467564685646956470564715647256473564745647556476564775647856479564805648156482564835648456485564865648756488564895649056491564925649356494564955649656497564985649956500565015650256503565045650556506565075650856509565105651156512565135651456515565165651756518565195652056521565225652356524565255652656527565285652956530565315653256533565345653556536565375653856539565405654156542565435654456545565465654756548565495655056551565525655356554565555655656557565585655956560565615656256563565645656556566565675656856569565705657156572565735657456575565765657756578565795658056581565825658356584565855658656587565885658956590565915659256593565945659556596565975659856599566005660156602566035660456605566065660756608566095661056611566125661356614566155661656617566185661956620566215662256623566245662556626566275662856629566305663156632566335663456635566365663756638566395664056641566425664356644566455664656647566485664956650566515665256653566545665556656566575665856659566605666156662566635666456665566665666756668566695667056671566725667356674566755667656677566785667956680566815668256683566845668556686566875668856689566905669156692566935669456695566965669756698566995670056701567025670356704567055670656707567085670956710567115671256713567145671556716567175671856719567205672156722567235672456725567265672756728567295673056731567325673356734567355673656737567385673956740567415674256743567445674556746567475674856749567505675156752567535675456755567565675756758567595676056761567625676356764567655676656767567685676956770567715677256773567745677556776567775677856779567805678156782567835678456785567865678756788567895679056791567925679356794567955679656797567985679956800568015680256803568045680556806568075680856809568105681156812568135681456815568165681756818568195682056821568225682356824568255682656827568285682956830568315683256833568345683556836568375683856839568405684156842568435684456845568465684756848568495685056851568525685356854568555685656857568585685956860568615686256863568645686556866568675686856869568705687156872568735687456875568765687756878568795688056881568825688356884568855688656887568885688956890568915689256893568945689556896568975689856899569005690156902569035690456905569065690756908569095691056911569125691356914569155691656917569185691956920569215692256923569245692556926569275692856929569305693156932569335693456935569365693756938569395694056941569425694356944569455694656947569485694956950569515695256953569545695556956569575695856959569605696156962569635696456965569665696756968569695697056971569725697356974569755697656977569785697956980569815698256983569845698556986569875698856989569905699156992569935699456995569965699756998569995700057001570025700357004570055700657007570085700957010570115701257013570145701557016570175701857019570205702157022570235702457025570265702757028570295703057031570325703357034570355703657037570385703957040570415704257043570445704557046570475704857049570505705157052570535705457055570565705757058570595706057061570625706357064570655706657067570685706957070570715707257073570745707557076570775707857079570805708157082570835708457085570865708757088570895709057091570925709357094570955709657097570985709957100571015710257103571045710557106571075710857109571105711157112571135711457115571165711757118571195712057121571225712357124571255712657127571285712957130571315713257133571345713557136571375713857139571405714157142571435714457145571465714757148571495715057151571525715357154571555715657157571585715957160571615716257163571645716557166571675716857169571705717157172571735717457175571765717757178571795718057181571825718357184571855718657187571885718957190571915719257193571945719557196571975719857199572005720157202572035720457205572065720757208572095721057211572125721357214572155721657217572185721957220572215722257223572245722557226572275722857229572305723157232572335723457235572365723757238572395724057241572425724357244572455724657247572485724957250572515725257253572545725557256572575725857259572605726157262572635726457265572665726757268572695727057271572725727357274572755727657277572785727957280572815728257283572845728557286572875728857289572905729157292572935729457295572965729757298572995730057301573025730357304573055730657307573085730957310573115731257313573145731557316573175731857319573205732157322573235732457325573265732757328573295733057331573325733357334573355733657337573385733957340573415734257343573445734557346573475734857349573505735157352573535735457355573565735757358573595736057361573625736357364573655736657367573685736957370573715737257373573745737557376573775737857379573805738157382573835738457385573865738757388573895739057391573925739357394573955739657397573985739957400574015740257403574045740557406574075740857409574105741157412574135741457415574165741757418574195742057421574225742357424574255742657427574285742957430574315743257433574345743557436574375743857439574405744157442574435744457445574465744757448574495745057451574525745357454574555745657457574585745957460574615746257463574645746557466574675746857469574705747157472574735747457475574765747757478574795748057481574825748357484574855748657487574885748957490574915749257493574945749557496574975749857499575005750157502575035750457505575065750757508575095751057511575125751357514575155751657517575185751957520575215752257523575245752557526575275752857529575305753157532575335753457535575365753757538575395754057541575425754357544575455754657547575485754957550575515755257553575545755557556575575755857559575605756157562575635756457565575665756757568575695757057571575725757357574575755757657577575785757957580575815758257583575845758557586575875758857589575905759157592575935759457595575965759757598575995760057601576025760357604576055760657607576085760957610576115761257613576145761557616576175761857619576205762157622576235762457625576265762757628576295763057631576325763357634576355763657637576385763957640576415764257643576445764557646576475764857649576505765157652576535765457655576565765757658576595766057661576625766357664576655766657667576685766957670576715767257673576745767557676576775767857679576805768157682576835768457685576865768757688576895769057691576925769357694576955769657697576985769957700577015770257703577045770557706577075770857709577105771157712577135771457715577165771757718577195772057721577225772357724577255772657727577285772957730577315773257733577345773557736577375773857739577405774157742577435774457745577465774757748577495775057751577525775357754577555775657757577585775957760577615776257763577645776557766577675776857769577705777157772577735777457775577765777757778577795778057781577825778357784577855778657787577885778957790577915779257793577945779557796577975779857799578005780157802578035780457805578065780757808578095781057811578125781357814578155781657817578185781957820578215782257823578245782557826578275782857829578305783157832578335783457835578365783757838578395784057841578425784357844578455784657847578485784957850578515785257853578545785557856578575785857859578605786157862578635786457865578665786757868578695787057871578725787357874578755787657877578785787957880578815788257883578845788557886578875788857889578905789157892578935789457895578965789757898578995790057901579025790357904579055790657907579085790957910579115791257913579145791557916579175791857919579205792157922579235792457925579265792757928579295793057931579325793357934579355793657937579385793957940579415794257943579445794557946579475794857949579505795157952579535795457955579565795757958579595796057961579625796357964579655796657967579685796957970579715797257973579745797557976579775797857979579805798157982579835798457985579865798757988579895799057991579925799357994579955799657997579985799958000580015800258003580045800558006580075800858009580105801158012580135801458015580165801758018580195802058021580225802358024580255802658027580285802958030580315803258033580345803558036580375803858039580405804158042580435804458045580465804758048580495805058051580525805358054580555805658057580585805958060580615806258063580645806558066580675806858069580705807158072580735807458075580765807758078580795808058081580825808358084580855808658087580885808958090580915809258093580945809558096580975809858099581005810158102581035810458105581065810758108581095811058111581125811358114581155811658117581185811958120581215812258123581245812558126581275812858129581305813158132581335813458135581365813758138581395814058141581425814358144581455814658147581485814958150581515815258153581545815558156581575815858159581605816158162581635816458165581665816758168581695817058171581725817358174581755817658177581785817958180581815818258183581845818558186581875818858189581905819158192581935819458195581965819758198581995820058201582025820358204582055820658207582085820958210582115821258213582145821558216582175821858219582205822158222582235822458225582265822758228582295823058231582325823358234582355823658237582385823958240582415824258243582445824558246582475824858249582505825158252582535825458255582565825758258582595826058261582625826358264582655826658267582685826958270582715827258273582745827558276582775827858279582805828158282582835828458285582865828758288582895829058291582925829358294582955829658297582985829958300583015830258303583045830558306583075830858309583105831158312583135831458315583165831758318583195832058321583225832358324583255832658327583285832958330583315833258333583345833558336583375833858339583405834158342583435834458345583465834758348583495835058351583525835358354583555835658357583585835958360583615836258363583645836558366583675836858369583705837158372583735837458375583765837758378583795838058381583825838358384583855838658387583885838958390583915839258393583945839558396583975839858399584005840158402584035840458405584065840758408584095841058411584125841358414584155841658417584185841958420584215842258423584245842558426584275842858429584305843158432584335843458435584365843758438584395844058441584425844358444584455844658447584485844958450584515845258453584545845558456584575845858459584605846158462584635846458465584665846758468584695847058471584725847358474584755847658477584785847958480584815848258483584845848558486584875848858489584905849158492584935849458495584965849758498584995850058501585025850358504585055850658507585085850958510585115851258513585145851558516585175851858519585205852158522585235852458525585265852758528585295853058531585325853358534585355853658537585385853958540585415854258543585445854558546585475854858549585505855158552585535855458555585565855758558585595856058561585625856358564585655856658567585685856958570585715857258573585745857558576585775857858579585805858158582585835858458585585865858758588585895859058591585925859358594585955859658597585985859958600586015860258603586045860558606586075860858609586105861158612586135861458615586165861758618586195862058621586225862358624586255862658627586285862958630586315863258633586345863558636586375863858639586405864158642586435864458645586465864758648586495865058651586525865358654586555865658657586585865958660586615866258663586645866558666586675866858669586705867158672586735867458675586765867758678586795868058681586825868358684586855868658687586885868958690586915869258693586945869558696586975869858699587005870158702587035870458705587065870758708587095871058711587125871358714587155871658717587185871958720587215872258723587245872558726587275872858729587305873158732587335873458735587365873758738587395874058741587425874358744587455874658747587485874958750587515875258753587545875558756587575875858759587605876158762587635876458765587665876758768587695877058771587725877358774587755877658777587785877958780587815878258783587845878558786587875878858789587905879158792587935879458795587965879758798587995880058801588025880358804588055880658807588085880958810588115881258813588145881558816588175881858819588205882158822588235882458825588265882758828588295883058831588325883358834588355883658837588385883958840588415884258843588445884558846588475884858849588505885158852588535885458855588565885758858588595886058861588625886358864588655886658867588685886958870588715887258873588745887558876588775887858879588805888158882588835888458885588865888758888588895889058891588925889358894588955889658897588985889958900589015890258903589045890558906589075890858909589105891158912589135891458915589165891758918589195892058921589225892358924589255892658927589285892958930589315893258933589345893558936589375893858939589405894158942589435894458945589465894758948589495895058951589525895358954589555895658957589585895958960589615896258963589645896558966589675896858969589705897158972589735897458975589765897758978589795898058981589825898358984589855898658987589885898958990589915899258993589945899558996589975899858999590005900159002590035900459005590065900759008590095901059011590125901359014590155901659017590185901959020590215902259023590245902559026590275902859029590305903159032590335903459035590365903759038590395904059041590425904359044590455904659047590485904959050590515905259053590545905559056590575905859059590605906159062590635906459065590665906759068590695907059071590725907359074590755907659077590785907959080590815908259083590845908559086590875908859089590905909159092590935909459095590965909759098590995910059101591025910359104591055910659107591085910959110591115911259113591145911559116591175911859119591205912159122591235912459125591265912759128591295913059131591325913359134591355913659137591385913959140591415914259143591445914559146591475914859149591505915159152591535915459155591565915759158591595916059161591625916359164591655916659167591685916959170591715917259173591745917559176591775917859179591805918159182591835918459185591865918759188591895919059191591925919359194591955919659197591985919959200592015920259203592045920559206592075920859209592105921159212592135921459215592165921759218592195922059221592225922359224592255922659227592285922959230592315923259233592345923559236592375923859239592405924159242592435924459245592465924759248592495925059251592525925359254592555925659257592585925959260592615926259263592645926559266592675926859269592705927159272592735927459275592765927759278592795928059281592825928359284592855928659287592885928959290592915929259293592945929559296592975929859299593005930159302593035930459305593065930759308593095931059311593125931359314593155931659317593185931959320593215932259323593245932559326593275932859329593305933159332593335933459335593365933759338593395934059341593425934359344593455934659347593485934959350593515935259353593545935559356593575935859359593605936159362593635936459365593665936759368593695937059371593725937359374593755937659377593785937959380593815938259383593845938559386593875938859389593905939159392593935939459395593965939759398593995940059401594025940359404594055940659407594085940959410594115941259413594145941559416594175941859419594205942159422594235942459425594265942759428594295943059431594325943359434594355943659437594385943959440594415944259443594445944559446594475944859449594505945159452594535945459455594565945759458594595946059461594625946359464594655946659467594685946959470594715947259473594745947559476594775947859479594805948159482594835948459485594865948759488594895949059491594925949359494594955949659497594985949959500595015950259503595045950559506595075950859509595105951159512595135951459515595165951759518595195952059521595225952359524595255952659527595285952959530595315953259533595345953559536595375953859539595405954159542595435954459545595465954759548595495955059551595525955359554595555955659557595585955959560595615956259563595645956559566595675956859569595705957159572595735957459575595765957759578595795958059581595825958359584595855958659587595885958959590595915959259593595945959559596595975959859599596005960159602596035960459605596065960759608596095961059611596125961359614596155961659617596185961959620596215962259623596245962559626596275962859629596305963159632596335963459635596365963759638596395964059641596425964359644596455964659647596485964959650596515965259653596545965559656596575965859659596605966159662596635966459665596665966759668596695967059671596725967359674596755967659677596785967959680596815968259683596845968559686596875968859689596905969159692596935969459695596965969759698596995970059701597025970359704597055970659707597085970959710597115971259713597145971559716597175971859719597205972159722597235972459725597265972759728597295973059731597325973359734597355973659737597385973959740597415974259743597445974559746597475974859749597505975159752597535975459755597565975759758597595976059761597625976359764597655976659767597685976959770597715977259773597745977559776597775977859779597805978159782597835978459785597865978759788597895979059791597925979359794597955979659797597985979959800598015980259803598045980559806598075980859809598105981159812598135981459815598165981759818598195982059821598225982359824598255982659827598285982959830598315983259833598345983559836598375983859839598405984159842598435984459845598465984759848598495985059851598525985359854598555985659857598585985959860598615986259863598645986559866598675986859869598705987159872598735987459875598765987759878598795988059881598825988359884598855988659887598885988959890598915989259893598945989559896598975989859899599005990159902599035990459905599065990759908599095991059911599125991359914599155991659917599185991959920599215992259923599245992559926599275992859929599305993159932599335993459935599365993759938599395994059941599425994359944599455994659947599485994959950599515995259953599545995559956599575995859959599605996159962599635996459965599665996759968599695997059971599725997359974599755997659977599785997959980599815998259983599845998559986599875998859989599905999159992599935999459995599965999759998599996000060001600026000360004600056000660007600086000960010600116001260013600146001560016600176001860019600206002160022600236002460025600266002760028600296003060031600326003360034600356003660037600386003960040600416004260043600446004560046600476004860049600506005160052600536005460055600566005760058600596006060061600626006360064600656006660067600686006960070600716007260073600746007560076600776007860079600806008160082600836008460085600866008760088600896009060091600926009360094600956009660097600986009960100601016010260103601046010560106601076010860109601106011160112601136011460115601166011760118601196012060121601226012360124601256012660127601286012960130601316013260133601346013560136601376013860139601406014160142601436014460145601466014760148601496015060151601526015360154601556015660157601586015960160601616016260163601646016560166601676016860169601706017160172601736017460175601766017760178601796018060181601826018360184601856018660187601886018960190601916019260193601946019560196601976019860199602006020160202602036020460205602066020760208602096021060211602126021360214602156021660217602186021960220602216022260223602246022560226602276022860229602306023160232602336023460235602366023760238602396024060241602426024360244602456024660247602486024960250602516025260253602546025560256602576025860259602606026160262602636026460265602666026760268602696027060271602726027360274602756027660277602786027960280602816028260283602846028560286602876028860289602906029160292602936029460295602966029760298602996030060301603026030360304603056030660307603086030960310603116031260313603146031560316603176031860319603206032160322603236032460325603266032760328603296033060331603326033360334603356033660337603386033960340603416034260343603446034560346603476034860349603506035160352603536035460355603566035760358603596036060361603626036360364603656036660367603686036960370603716037260373603746037560376603776037860379603806038160382603836038460385603866038760388603896039060391603926039360394603956039660397603986039960400604016040260403604046040560406604076040860409604106041160412604136041460415604166041760418604196042060421604226042360424604256042660427604286042960430604316043260433604346043560436604376043860439604406044160442604436044460445604466044760448604496045060451604526045360454604556045660457604586045960460604616046260463604646046560466604676046860469604706047160472604736047460475604766047760478604796048060481604826048360484604856048660487604886048960490604916049260493604946049560496604976049860499605006050160502605036050460505605066050760508605096051060511605126051360514605156051660517605186051960520605216052260523605246052560526605276052860529605306053160532605336053460535605366053760538605396054060541605426054360544605456054660547605486054960550605516055260553605546055560556605576055860559605606056160562605636056460565605666056760568605696057060571605726057360574605756057660577605786057960580605816058260583605846058560586605876058860589605906059160592605936059460595605966059760598605996060060601606026060360604606056060660607606086060960610606116061260613606146061560616606176061860619606206062160622606236062460625606266062760628606296063060631606326063360634606356063660637606386063960640606416064260643606446064560646606476064860649606506065160652606536065460655606566065760658606596066060661606626066360664606656066660667606686066960670606716067260673606746067560676606776067860679606806068160682606836068460685606866068760688606896069060691606926069360694606956069660697606986069960700607016070260703607046070560706607076070860709607106071160712607136071460715607166071760718607196072060721607226072360724607256072660727607286072960730607316073260733607346073560736607376073860739607406074160742607436074460745607466074760748607496075060751607526075360754607556075660757607586075960760607616076260763607646076560766607676076860769607706077160772607736077460775607766077760778607796078060781607826078360784607856078660787607886078960790607916079260793607946079560796607976079860799608006080160802608036080460805608066080760808608096081060811608126081360814608156081660817608186081960820608216082260823608246082560826608276082860829608306083160832608336083460835608366083760838608396084060841608426084360844608456084660847608486084960850608516085260853608546085560856608576085860859608606086160862608636086460865608666086760868608696087060871608726087360874608756087660877608786087960880608816088260883608846088560886608876088860889608906089160892608936089460895608966089760898608996090060901609026090360904609056090660907609086090960910609116091260913609146091560916609176091860919609206092160922609236092460925609266092760928609296093060931609326093360934609356093660937609386093960940609416094260943609446094560946609476094860949609506095160952609536095460955609566095760958609596096060961609626096360964609656096660967609686096960970609716097260973609746097560976609776097860979609806098160982609836098460985609866098760988609896099060991609926099360994609956099660997609986099961000610016100261003610046100561006610076100861009610106101161012610136101461015610166101761018610196102061021610226102361024610256102661027610286102961030610316103261033610346103561036610376103861039610406104161042610436104461045610466104761048610496105061051610526105361054610556105661057610586105961060610616106261063610646106561066610676106861069610706107161072610736107461075610766107761078610796108061081610826108361084610856108661087610886108961090610916109261093610946109561096610976109861099611006110161102611036110461105611066110761108611096111061111611126111361114611156111661117611186111961120611216112261123611246112561126611276112861129611306113161132611336113461135611366113761138611396114061141611426114361144611456114661147611486114961150611516115261153611546115561156611576115861159611606116161162611636116461165611666116761168611696117061171611726117361174611756117661177611786117961180611816118261183611846118561186611876118861189611906119161192611936119461195611966119761198611996120061201612026120361204612056120661207612086120961210612116121261213612146121561216612176121861219612206122161222612236122461225612266122761228612296123061231612326123361234612356123661237612386123961240612416124261243612446124561246612476124861249612506125161252612536125461255612566125761258612596126061261612626126361264612656126661267612686126961270612716127261273612746127561276612776127861279612806128161282612836128461285612866128761288612896129061291612926129361294612956129661297612986129961300613016130261303613046130561306613076130861309613106131161312613136131461315613166131761318613196132061321613226132361324613256132661327613286132961330613316133261333613346133561336613376133861339613406134161342613436134461345613466134761348613496135061351613526135361354613556135661357613586135961360613616136261363613646136561366613676136861369613706137161372613736137461375613766137761378613796138061381613826138361384613856138661387613886138961390613916139261393613946139561396613976139861399614006140161402614036140461405614066140761408614096141061411614126141361414614156141661417614186141961420614216142261423614246142561426614276142861429614306143161432614336143461435614366143761438614396144061441614426144361444614456144661447614486144961450614516145261453614546145561456614576145861459614606146161462614636146461465614666146761468614696147061471614726147361474614756147661477614786147961480614816148261483614846148561486614876148861489614906149161492614936149461495614966149761498614996150061501615026150361504615056150661507615086150961510615116151261513615146151561516615176151861519615206152161522615236152461525615266152761528615296153061531615326153361534615356153661537615386153961540615416154261543615446154561546615476154861549615506155161552615536155461555615566155761558615596156061561615626156361564615656156661567615686156961570615716157261573615746157561576615776157861579615806158161582615836158461585615866158761588615896159061591615926159361594615956159661597615986159961600616016160261603616046160561606616076160861609616106161161612616136161461615616166161761618616196162061621616226162361624616256162661627616286162961630616316163261633616346163561636616376163861639616406164161642616436164461645616466164761648616496165061651616526165361654616556165661657616586165961660616616166261663616646166561666616676166861669616706167161672616736167461675616766167761678616796168061681616826168361684616856168661687616886168961690616916169261693616946169561696616976169861699617006170161702617036170461705617066170761708617096171061711617126171361714617156171661717617186171961720617216172261723617246172561726617276172861729617306173161732617336173461735617366173761738617396174061741617426174361744617456174661747617486174961750617516175261753617546175561756617576175861759617606176161762617636176461765617666176761768617696177061771617726177361774617756177661777617786177961780617816178261783617846178561786617876178861789617906179161792617936179461795617966179761798617996180061801618026180361804618056180661807618086180961810618116181261813618146181561816618176181861819618206182161822618236182461825618266182761828618296183061831618326183361834618356183661837618386183961840618416184261843618446184561846618476184861849618506185161852618536185461855618566185761858618596186061861618626186361864618656186661867618686186961870618716187261873618746187561876618776187861879618806188161882618836188461885618866188761888618896189061891618926189361894618956189661897618986189961900619016190261903619046190561906619076190861909619106191161912619136191461915619166191761918619196192061921619226192361924619256192661927619286192961930619316193261933619346193561936619376193861939619406194161942619436194461945619466194761948619496195061951619526195361954619556195661957619586195961960619616196261963619646196561966619676196861969619706197161972619736197461975619766197761978619796198061981619826198361984619856198661987619886198961990619916199261993619946199561996619976199861999620006200162002620036200462005620066200762008620096201062011620126201362014620156201662017620186201962020620216202262023620246202562026620276202862029620306203162032620336203462035620366203762038620396204062041620426204362044620456204662047620486204962050620516205262053620546205562056620576205862059620606206162062620636206462065620666206762068620696207062071620726207362074620756207662077620786207962080620816208262083620846208562086620876208862089620906209162092620936209462095620966209762098620996210062101621026210362104621056210662107621086210962110621116211262113621146211562116621176211862119621206212162122621236212462125621266212762128621296213062131621326213362134621356213662137621386213962140621416214262143621446214562146621476214862149621506215162152621536215462155621566215762158621596216062161621626216362164621656216662167621686216962170621716217262173621746217562176621776217862179621806218162182621836218462185621866218762188621896219062191621926219362194621956219662197621986219962200622016220262203622046220562206622076220862209622106221162212622136221462215622166221762218622196222062221622226222362224622256222662227622286222962230622316223262233622346223562236622376223862239622406224162242622436224462245622466224762248622496225062251622526225362254622556225662257622586225962260622616226262263622646226562266622676226862269622706227162272622736227462275622766227762278622796228062281622826228362284622856228662287622886228962290622916229262293622946229562296622976229862299623006230162302623036230462305623066230762308623096231062311623126231362314623156231662317623186231962320623216232262323623246232562326623276232862329623306233162332623336233462335623366233762338623396234062341623426234362344623456234662347623486234962350623516235262353623546235562356623576235862359623606236162362623636236462365623666236762368623696237062371623726237362374623756237662377623786237962380623816238262383623846238562386623876238862389623906239162392623936239462395623966239762398623996240062401624026240362404624056240662407624086240962410624116241262413624146241562416624176241862419624206242162422624236242462425624266242762428624296243062431624326243362434624356243662437624386243962440624416244262443624446244562446624476244862449624506245162452624536245462455624566245762458624596246062461624626246362464624656246662467624686246962470624716247262473624746247562476624776247862479624806248162482624836248462485624866248762488624896249062491624926249362494624956249662497624986249962500625016250262503625046250562506625076250862509625106251162512625136251462515625166251762518625196252062521625226252362524625256252662527625286252962530625316253262533625346253562536625376253862539625406254162542625436254462545625466254762548625496255062551625526255362554625556255662557625586255962560625616256262563625646256562566625676256862569625706257162572625736257462575625766257762578625796258062581625826258362584625856258662587625886258962590625916259262593625946259562596625976259862599626006260162602626036260462605626066260762608626096261062611626126261362614626156261662617626186261962620626216262262623626246262562626626276262862629626306263162632626336263462635626366263762638626396264062641626426264362644626456264662647626486264962650626516265262653626546265562656626576265862659626606266162662626636266462665626666266762668626696267062671626726267362674626756267662677626786267962680626816268262683626846268562686626876268862689626906269162692626936269462695626966269762698626996270062701627026270362704627056270662707627086270962710627116271262713627146271562716627176271862719627206272162722627236272462725627266272762728627296273062731627326273362734627356273662737627386273962740627416274262743627446274562746627476274862749627506275162752627536275462755627566275762758627596276062761627626276362764627656276662767627686276962770627716277262773627746277562776627776277862779627806278162782627836278462785627866278762788627896279062791627926279362794627956279662797627986279962800628016280262803628046280562806628076280862809628106281162812628136281462815628166281762818628196282062821628226282362824628256282662827628286282962830628316283262833628346283562836628376283862839628406284162842628436284462845628466284762848628496285062851628526285362854628556285662857628586285962860628616286262863628646286562866628676286862869628706287162872628736287462875628766287762878628796288062881628826288362884628856288662887628886288962890628916289262893628946289562896628976289862899629006290162902629036290462905629066290762908629096291062911629126291362914629156291662917629186291962920629216292262923629246292562926629276292862929629306293162932629336293462935629366293762938629396294062941629426294362944629456294662947629486294962950629516295262953629546295562956629576295862959629606296162962629636296462965629666296762968629696297062971629726297362974629756297662977629786297962980629816298262983629846298562986629876298862989629906299162992629936299462995629966299762998629996300063001630026300363004630056300663007630086300963010630116301263013630146301563016630176301863019630206302163022630236302463025630266302763028630296303063031630326303363034630356303663037630386303963040630416304263043630446304563046630476304863049630506305163052630536305463055630566305763058630596306063061630626306363064630656306663067630686306963070630716307263073630746307563076630776307863079630806308163082630836308463085630866308763088630896309063091630926309363094630956309663097630986309963100631016310263103631046310563106631076310863109631106311163112631136311463115631166311763118631196312063121631226312363124631256312663127631286312963130631316313263133631346313563136631376313863139631406314163142631436314463145631466314763148631496315063151631526315363154631556315663157631586315963160631616316263163631646316563166631676316863169631706317163172631736317463175631766317763178631796318063181631826318363184631856318663187631886318963190631916319263193631946319563196631976319863199632006320163202632036320463205632066320763208632096321063211632126321363214632156321663217632186321963220632216322263223632246322563226632276322863229632306323163232632336323463235632366323763238632396324063241632426324363244632456324663247632486324963250632516325263253632546325563256632576325863259632606326163262632636326463265632666326763268632696327063271632726327363274632756327663277632786327963280632816328263283632846328563286632876328863289632906329163292632936329463295632966329763298632996330063301633026330363304633056330663307633086330963310633116331263313633146331563316633176331863319633206332163322633236332463325633266332763328633296333063331633326333363334633356333663337633386333963340633416334263343633446334563346633476334863349633506335163352633536335463355633566335763358633596336063361633626336363364633656336663367633686336963370633716337263373633746337563376633776337863379633806338163382633836338463385633866338763388633896339063391633926339363394633956339663397633986339963400634016340263403634046340563406634076340863409634106341163412634136341463415634166341763418634196342063421634226342363424634256342663427634286342963430634316343263433634346343563436634376343863439634406344163442634436344463445634466344763448634496345063451634526345363454634556345663457634586345963460634616346263463634646346563466634676346863469634706347163472634736347463475634766347763478634796348063481634826348363484634856348663487634886348963490634916349263493634946349563496634976349863499635006350163502635036350463505635066350763508635096351063511635126351363514635156351663517635186351963520635216352263523635246352563526635276352863529635306353163532635336353463535635366353763538635396354063541635426354363544635456354663547635486354963550635516355263553635546355563556635576355863559635606356163562635636356463565635666356763568635696357063571635726357363574635756357663577635786357963580635816358263583635846358563586635876358863589635906359163592635936359463595635966359763598635996360063601636026360363604636056360663607636086360963610636116361263613636146361563616636176361863619636206362163622636236362463625636266362763628636296363063631636326363363634636356363663637636386363963640636416364263643636446364563646636476364863649636506365163652636536365463655636566365763658636596366063661636626366363664636656366663667636686366963670636716367263673636746367563676636776367863679636806368163682636836368463685636866368763688636896369063691636926369363694636956369663697636986369963700637016370263703637046370563706637076370863709637106371163712637136371463715637166371763718637196372063721637226372363724637256372663727637286372963730637316373263733637346373563736637376373863739637406374163742637436374463745637466374763748637496375063751637526375363754637556375663757637586375963760637616376263763637646376563766637676376863769637706377163772637736377463775637766377763778637796378063781637826378363784637856378663787637886378963790637916379263793637946379563796637976379863799638006380163802638036380463805638066380763808638096381063811638126381363814638156381663817638186381963820638216382263823638246382563826638276382863829638306383163832638336383463835638366383763838638396384063841638426384363844638456384663847638486384963850638516385263853638546385563856638576385863859638606386163862638636386463865638666386763868638696387063871638726387363874638756387663877638786387963880638816388263883638846388563886638876388863889638906389163892638936389463895638966389763898638996390063901639026390363904639056390663907639086390963910639116391263913639146391563916639176391863919639206392163922639236392463925639266392763928639296393063931639326393363934639356393663937639386393963940639416394263943639446394563946639476394863949639506395163952639536395463955639566395763958639596396063961639626396363964639656396663967639686396963970639716397263973639746397563976639776397863979639806398163982639836398463985639866398763988639896399063991639926399363994639956399663997639986399964000640016400264003640046400564006640076400864009640106401164012640136401464015640166401764018640196402064021640226402364024640256402664027640286402964030640316403264033640346403564036640376403864039640406404164042640436404464045640466404764048640496405064051
  1. /******/ (function(modules) { // webpackBootstrap
  2. /******/ // The module cache
  3. /******/ var installedModules = {};
  4. /******/
  5. /******/ // The require function
  6. /******/ function __webpack_require__(moduleId) {
  7. /******/
  8. /******/ // Check if module is in cache
  9. /******/ if(installedModules[moduleId]) {
  10. /******/ return installedModules[moduleId].exports;
  11. /******/ }
  12. /******/ // Create a new module (and put it into the cache)
  13. /******/ var module = installedModules[moduleId] = {
  14. /******/ i: moduleId,
  15. /******/ l: false,
  16. /******/ exports: {}
  17. /******/ };
  18. /******/
  19. /******/ // Execute the module function
  20. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  21. /******/
  22. /******/ // Flag the module as loaded
  23. /******/ module.l = true;
  24. /******/
  25. /******/ // Return the exports of the module
  26. /******/ return module.exports;
  27. /******/ }
  28. /******/
  29. /******/
  30. /******/ // expose the modules object (__webpack_modules__)
  31. /******/ __webpack_require__.m = modules;
  32. /******/
  33. /******/ // expose the module cache
  34. /******/ __webpack_require__.c = installedModules;
  35. /******/
  36. /******/ // define getter function for harmony exports
  37. /******/ __webpack_require__.d = function(exports, name, getter) {
  38. /******/ if(!__webpack_require__.o(exports, name)) {
  39. /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
  40. /******/ }
  41. /******/ };
  42. /******/
  43. /******/ // define __esModule on exports
  44. /******/ __webpack_require__.r = function(exports) {
  45. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  46. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  47. /******/ }
  48. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  49. /******/ };
  50. /******/
  51. /******/ // create a fake namespace object
  52. /******/ // mode & 1: value is a module id, require it
  53. /******/ // mode & 2: merge all properties of value into the ns
  54. /******/ // mode & 4: return value when already ns object
  55. /******/ // mode & 8|1: behave like require
  56. /******/ __webpack_require__.t = function(value, mode) {
  57. /******/ if(mode & 1) value = __webpack_require__(value);
  58. /******/ if(mode & 8) return value;
  59. /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
  60. /******/ var ns = Object.create(null);
  61. /******/ __webpack_require__.r(ns);
  62. /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
  63. /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
  64. /******/ return ns;
  65. /******/ };
  66. /******/
  67. /******/ // getDefaultExport function for compatibility with non-harmony modules
  68. /******/ __webpack_require__.n = function(module) {
  69. /******/ var getter = module && module.__esModule ?
  70. /******/ function getDefault() { return module['default']; } :
  71. /******/ function getModuleExports() { return module; };
  72. /******/ __webpack_require__.d(getter, 'a', getter);
  73. /******/ return getter;
  74. /******/ };
  75. /******/
  76. /******/ // Object.prototype.hasOwnProperty.call
  77. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  78. /******/
  79. /******/ // __webpack_public_path__
  80. /******/ __webpack_require__.p = "/";
  81. /******/
  82. /******/
  83. /******/ // Load entry module and return exports
  84. /******/ return __webpack_require__(__webpack_require__.s = 0);
  85. /******/ })
  86. /************************************************************************/
  87. /******/ ({
  88. /***/ "./node_modules/axios/index.js":
  89. /*!*************************************!*\
  90. !*** ./node_modules/axios/index.js ***!
  91. \*************************************/
  92. /*! no static exports found */
  93. /***/ (function(module, exports, __webpack_require__) {
  94. module.exports = __webpack_require__(/*! ./lib/axios */ "./node_modules/axios/lib/axios.js");
  95. /***/ }),
  96. /***/ "./node_modules/axios/lib/adapters/xhr.js":
  97. /*!************************************************!*\
  98. !*** ./node_modules/axios/lib/adapters/xhr.js ***!
  99. \************************************************/
  100. /*! no static exports found */
  101. /***/ (function(module, exports, __webpack_require__) {
  102. "use strict";
  103. var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js");
  104. var settle = __webpack_require__(/*! ./../core/settle */ "./node_modules/axios/lib/core/settle.js");
  105. var buildURL = __webpack_require__(/*! ./../helpers/buildURL */ "./node_modules/axios/lib/helpers/buildURL.js");
  106. var buildFullPath = __webpack_require__(/*! ../core/buildFullPath */ "./node_modules/axios/lib/core/buildFullPath.js");
  107. var parseHeaders = __webpack_require__(/*! ./../helpers/parseHeaders */ "./node_modules/axios/lib/helpers/parseHeaders.js");
  108. var isURLSameOrigin = __webpack_require__(/*! ./../helpers/isURLSameOrigin */ "./node_modules/axios/lib/helpers/isURLSameOrigin.js");
  109. var createError = __webpack_require__(/*! ../core/createError */ "./node_modules/axios/lib/core/createError.js");
  110. module.exports = function xhrAdapter(config) {
  111. return new Promise(function dispatchXhrRequest(resolve, reject) {
  112. var requestData = config.data;
  113. var requestHeaders = config.headers;
  114. if (utils.isFormData(requestData)) {
  115. delete requestHeaders['Content-Type']; // Let the browser set it
  116. }
  117. var request = new XMLHttpRequest();
  118. // HTTP basic authentication
  119. if (config.auth) {
  120. var username = config.auth.username || '';
  121. var password = config.auth.password || '';
  122. requestHeaders.Authorization = 'Basic ' + btoa(username + ':' + password);
  123. }
  124. var fullPath = buildFullPath(config.baseURL, config.url);
  125. request.open(config.method.toUpperCase(), buildURL(fullPath, config.params, config.paramsSerializer), true);
  126. // Set the request timeout in MS
  127. request.timeout = config.timeout;
  128. // Listen for ready state
  129. request.onreadystatechange = function handleLoad() {
  130. if (!request || request.readyState !== 4) {
  131. return;
  132. }
  133. // The request errored out and we didn't get a response, this will be
  134. // handled by onerror instead
  135. // With one exception: request that using file: protocol, most browsers
  136. // will return status as 0 even though it's a successful request
  137. if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) {
  138. return;
  139. }
  140. // Prepare the response
  141. var responseHeaders = 'getAllResponseHeaders' in request ? parseHeaders(request.getAllResponseHeaders()) : null;
  142. var responseData = !config.responseType || config.responseType === 'text' ? request.responseText : request.response;
  143. var response = {
  144. data: responseData,
  145. status: request.status,
  146. statusText: request.statusText,
  147. headers: responseHeaders,
  148. config: config,
  149. request: request
  150. };
  151. settle(resolve, reject, response);
  152. // Clean up request
  153. request = null;
  154. };
  155. // Handle browser request cancellation (as opposed to a manual cancellation)
  156. request.onabort = function handleAbort() {
  157. if (!request) {
  158. return;
  159. }
  160. reject(createError('Request aborted', config, 'ECONNABORTED', request));
  161. // Clean up request
  162. request = null;
  163. };
  164. // Handle low level network errors
  165. request.onerror = function handleError() {
  166. // Real errors are hidden from us by the browser
  167. // onerror should only fire if it's a network error
  168. reject(createError('Network Error', config, null, request));
  169. // Clean up request
  170. request = null;
  171. };
  172. // Handle timeout
  173. request.ontimeout = function handleTimeout() {
  174. var timeoutErrorMessage = 'timeout of ' + config.timeout + 'ms exceeded';
  175. if (config.timeoutErrorMessage) {
  176. timeoutErrorMessage = config.timeoutErrorMessage;
  177. }
  178. reject(createError(timeoutErrorMessage, config, 'ECONNABORTED',
  179. request));
  180. // Clean up request
  181. request = null;
  182. };
  183. // Add xsrf header
  184. // This is only done if running in a standard browser environment.
  185. // Specifically not if we're in a web worker, or react-native.
  186. if (utils.isStandardBrowserEnv()) {
  187. var cookies = __webpack_require__(/*! ./../helpers/cookies */ "./node_modules/axios/lib/helpers/cookies.js");
  188. // Add xsrf header
  189. var xsrfValue = (config.withCredentials || isURLSameOrigin(fullPath)) && config.xsrfCookieName ?
  190. cookies.read(config.xsrfCookieName) :
  191. undefined;
  192. if (xsrfValue) {
  193. requestHeaders[config.xsrfHeaderName] = xsrfValue;
  194. }
  195. }
  196. // Add headers to the request
  197. if ('setRequestHeader' in request) {
  198. utils.forEach(requestHeaders, function setRequestHeader(val, key) {
  199. if (typeof requestData === 'undefined' && key.toLowerCase() === 'content-type') {
  200. // Remove Content-Type if data is undefined
  201. delete requestHeaders[key];
  202. } else {
  203. // Otherwise add header to the request
  204. request.setRequestHeader(key, val);
  205. }
  206. });
  207. }
  208. // Add withCredentials to request if needed
  209. if (!utils.isUndefined(config.withCredentials)) {
  210. request.withCredentials = !!config.withCredentials;
  211. }
  212. // Add responseType to request if needed
  213. if (config.responseType) {
  214. try {
  215. request.responseType = config.responseType;
  216. } catch (e) {
  217. // Expected DOMException thrown by browsers not compatible XMLHttpRequest Level 2.
  218. // But, this can be suppressed for 'json' type as it can be parsed by default 'transformResponse' function.
  219. if (config.responseType !== 'json') {
  220. throw e;
  221. }
  222. }
  223. }
  224. // Handle progress if needed
  225. if (typeof config.onDownloadProgress === 'function') {
  226. request.addEventListener('progress', config.onDownloadProgress);
  227. }
  228. // Not all browsers support upload events
  229. if (typeof config.onUploadProgress === 'function' && request.upload) {
  230. request.upload.addEventListener('progress', config.onUploadProgress);
  231. }
  232. if (config.cancelToken) {
  233. // Handle cancellation
  234. config.cancelToken.promise.then(function onCanceled(cancel) {
  235. if (!request) {
  236. return;
  237. }
  238. request.abort();
  239. reject(cancel);
  240. // Clean up request
  241. request = null;
  242. });
  243. }
  244. if (requestData === undefined) {
  245. requestData = null;
  246. }
  247. // Send the request
  248. request.send(requestData);
  249. });
  250. };
  251. /***/ }),
  252. /***/ "./node_modules/axios/lib/axios.js":
  253. /*!*****************************************!*\
  254. !*** ./node_modules/axios/lib/axios.js ***!
  255. \*****************************************/
  256. /*! no static exports found */
  257. /***/ (function(module, exports, __webpack_require__) {
  258. "use strict";
  259. var utils = __webpack_require__(/*! ./utils */ "./node_modules/axios/lib/utils.js");
  260. var bind = __webpack_require__(/*! ./helpers/bind */ "./node_modules/axios/lib/helpers/bind.js");
  261. var Axios = __webpack_require__(/*! ./core/Axios */ "./node_modules/axios/lib/core/Axios.js");
  262. var mergeConfig = __webpack_require__(/*! ./core/mergeConfig */ "./node_modules/axios/lib/core/mergeConfig.js");
  263. var defaults = __webpack_require__(/*! ./defaults */ "./node_modules/axios/lib/defaults.js");
  264. /**
  265. * Create an instance of Axios
  266. *
  267. * @param {Object} defaultConfig The default config for the instance
  268. * @return {Axios} A new instance of Axios
  269. */
  270. function createInstance(defaultConfig) {
  271. var context = new Axios(defaultConfig);
  272. var instance = bind(Axios.prototype.request, context);
  273. // Copy axios.prototype to instance
  274. utils.extend(instance, Axios.prototype, context);
  275. // Copy context to instance
  276. utils.extend(instance, context);
  277. return instance;
  278. }
  279. // Create the default instance to be exported
  280. var axios = createInstance(defaults);
  281. // Expose Axios class to allow class inheritance
  282. axios.Axios = Axios;
  283. // Factory for creating new instances
  284. axios.create = function create(instanceConfig) {
  285. return createInstance(mergeConfig(axios.defaults, instanceConfig));
  286. };
  287. // Expose Cancel & CancelToken
  288. axios.Cancel = __webpack_require__(/*! ./cancel/Cancel */ "./node_modules/axios/lib/cancel/Cancel.js");
  289. axios.CancelToken = __webpack_require__(/*! ./cancel/CancelToken */ "./node_modules/axios/lib/cancel/CancelToken.js");
  290. axios.isCancel = __webpack_require__(/*! ./cancel/isCancel */ "./node_modules/axios/lib/cancel/isCancel.js");
  291. // Expose all/spread
  292. axios.all = function all(promises) {
  293. return Promise.all(promises);
  294. };
  295. axios.spread = __webpack_require__(/*! ./helpers/spread */ "./node_modules/axios/lib/helpers/spread.js");
  296. module.exports = axios;
  297. // Allow use of default import syntax in TypeScript
  298. module.exports.default = axios;
  299. /***/ }),
  300. /***/ "./node_modules/axios/lib/cancel/Cancel.js":
  301. /*!*************************************************!*\
  302. !*** ./node_modules/axios/lib/cancel/Cancel.js ***!
  303. \*************************************************/
  304. /*! no static exports found */
  305. /***/ (function(module, exports, __webpack_require__) {
  306. "use strict";
  307. /**
  308. * A `Cancel` is an object that is thrown when an operation is canceled.
  309. *
  310. * @class
  311. * @param {string=} message The message.
  312. */
  313. function Cancel(message) {
  314. this.message = message;
  315. }
  316. Cancel.prototype.toString = function toString() {
  317. return 'Cancel' + (this.message ? ': ' + this.message : '');
  318. };
  319. Cancel.prototype.__CANCEL__ = true;
  320. module.exports = Cancel;
  321. /***/ }),
  322. /***/ "./node_modules/axios/lib/cancel/CancelToken.js":
  323. /*!******************************************************!*\
  324. !*** ./node_modules/axios/lib/cancel/CancelToken.js ***!
  325. \******************************************************/
  326. /*! no static exports found */
  327. /***/ (function(module, exports, __webpack_require__) {
  328. "use strict";
  329. var Cancel = __webpack_require__(/*! ./Cancel */ "./node_modules/axios/lib/cancel/Cancel.js");
  330. /**
  331. * A `CancelToken` is an object that can be used to request cancellation of an operation.
  332. *
  333. * @class
  334. * @param {Function} executor The executor function.
  335. */
  336. function CancelToken(executor) {
  337. if (typeof executor !== 'function') {
  338. throw new TypeError('executor must be a function.');
  339. }
  340. var resolvePromise;
  341. this.promise = new Promise(function promiseExecutor(resolve) {
  342. resolvePromise = resolve;
  343. });
  344. var token = this;
  345. executor(function cancel(message) {
  346. if (token.reason) {
  347. // Cancellation has already been requested
  348. return;
  349. }
  350. token.reason = new Cancel(message);
  351. resolvePromise(token.reason);
  352. });
  353. }
  354. /**
  355. * Throws a `Cancel` if cancellation has been requested.
  356. */
  357. CancelToken.prototype.throwIfRequested = function throwIfRequested() {
  358. if (this.reason) {
  359. throw this.reason;
  360. }
  361. };
  362. /**
  363. * Returns an object that contains a new `CancelToken` and a function that, when called,
  364. * cancels the `CancelToken`.
  365. */
  366. CancelToken.source = function source() {
  367. var cancel;
  368. var token = new CancelToken(function executor(c) {
  369. cancel = c;
  370. });
  371. return {
  372. token: token,
  373. cancel: cancel
  374. };
  375. };
  376. module.exports = CancelToken;
  377. /***/ }),
  378. /***/ "./node_modules/axios/lib/cancel/isCancel.js":
  379. /*!***************************************************!*\
  380. !*** ./node_modules/axios/lib/cancel/isCancel.js ***!
  381. \***************************************************/
  382. /*! no static exports found */
  383. /***/ (function(module, exports, __webpack_require__) {
  384. "use strict";
  385. module.exports = function isCancel(value) {
  386. return !!(value && value.__CANCEL__);
  387. };
  388. /***/ }),
  389. /***/ "./node_modules/axios/lib/core/Axios.js":
  390. /*!**********************************************!*\
  391. !*** ./node_modules/axios/lib/core/Axios.js ***!
  392. \**********************************************/
  393. /*! no static exports found */
  394. /***/ (function(module, exports, __webpack_require__) {
  395. "use strict";
  396. var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js");
  397. var buildURL = __webpack_require__(/*! ../helpers/buildURL */ "./node_modules/axios/lib/helpers/buildURL.js");
  398. var InterceptorManager = __webpack_require__(/*! ./InterceptorManager */ "./node_modules/axios/lib/core/InterceptorManager.js");
  399. var dispatchRequest = __webpack_require__(/*! ./dispatchRequest */ "./node_modules/axios/lib/core/dispatchRequest.js");
  400. var mergeConfig = __webpack_require__(/*! ./mergeConfig */ "./node_modules/axios/lib/core/mergeConfig.js");
  401. /**
  402. * Create a new instance of Axios
  403. *
  404. * @param {Object} instanceConfig The default config for the instance
  405. */
  406. function Axios(instanceConfig) {
  407. this.defaults = instanceConfig;
  408. this.interceptors = {
  409. request: new InterceptorManager(),
  410. response: new InterceptorManager()
  411. };
  412. }
  413. /**
  414. * Dispatch a request
  415. *
  416. * @param {Object} config The config specific for this request (merged with this.defaults)
  417. */
  418. Axios.prototype.request = function request(config) {
  419. /*eslint no-param-reassign:0*/
  420. // Allow for axios('example/url'[, config]) a la fetch API
  421. if (typeof config === 'string') {
  422. config = arguments[1] || {};
  423. config.url = arguments[0];
  424. } else {
  425. config = config || {};
  426. }
  427. config = mergeConfig(this.defaults, config);
  428. // Set config.method
  429. if (config.method) {
  430. config.method = config.method.toLowerCase();
  431. } else if (this.defaults.method) {
  432. config.method = this.defaults.method.toLowerCase();
  433. } else {
  434. config.method = 'get';
  435. }
  436. // Hook up interceptors middleware
  437. var chain = [dispatchRequest, undefined];
  438. var promise = Promise.resolve(config);
  439. this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {
  440. chain.unshift(interceptor.fulfilled, interceptor.rejected);
  441. });
  442. this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {
  443. chain.push(interceptor.fulfilled, interceptor.rejected);
  444. });
  445. while (chain.length) {
  446. promise = promise.then(chain.shift(), chain.shift());
  447. }
  448. return promise;
  449. };
  450. Axios.prototype.getUri = function getUri(config) {
  451. config = mergeConfig(this.defaults, config);
  452. return buildURL(config.url, config.params, config.paramsSerializer).replace(/^\?/, '');
  453. };
  454. // Provide aliases for supported request methods
  455. utils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {
  456. /*eslint func-names:0*/
  457. Axios.prototype[method] = function(url, config) {
  458. return this.request(utils.merge(config || {}, {
  459. method: method,
  460. url: url
  461. }));
  462. };
  463. });
  464. utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
  465. /*eslint func-names:0*/
  466. Axios.prototype[method] = function(url, data, config) {
  467. return this.request(utils.merge(config || {}, {
  468. method: method,
  469. url: url,
  470. data: data
  471. }));
  472. };
  473. });
  474. module.exports = Axios;
  475. /***/ }),
  476. /***/ "./node_modules/axios/lib/core/InterceptorManager.js":
  477. /*!***********************************************************!*\
  478. !*** ./node_modules/axios/lib/core/InterceptorManager.js ***!
  479. \***********************************************************/
  480. /*! no static exports found */
  481. /***/ (function(module, exports, __webpack_require__) {
  482. "use strict";
  483. var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js");
  484. function InterceptorManager() {
  485. this.handlers = [];
  486. }
  487. /**
  488. * Add a new interceptor to the stack
  489. *
  490. * @param {Function} fulfilled The function to handle `then` for a `Promise`
  491. * @param {Function} rejected The function to handle `reject` for a `Promise`
  492. *
  493. * @return {Number} An ID used to remove interceptor later
  494. */
  495. InterceptorManager.prototype.use = function use(fulfilled, rejected) {
  496. this.handlers.push({
  497. fulfilled: fulfilled,
  498. rejected: rejected
  499. });
  500. return this.handlers.length - 1;
  501. };
  502. /**
  503. * Remove an interceptor from the stack
  504. *
  505. * @param {Number} id The ID that was returned by `use`
  506. */
  507. InterceptorManager.prototype.eject = function eject(id) {
  508. if (this.handlers[id]) {
  509. this.handlers[id] = null;
  510. }
  511. };
  512. /**
  513. * Iterate over all the registered interceptors
  514. *
  515. * This method is particularly useful for skipping over any
  516. * interceptors that may have become `null` calling `eject`.
  517. *
  518. * @param {Function} fn The function to call for each interceptor
  519. */
  520. InterceptorManager.prototype.forEach = function forEach(fn) {
  521. utils.forEach(this.handlers, function forEachHandler(h) {
  522. if (h !== null) {
  523. fn(h);
  524. }
  525. });
  526. };
  527. module.exports = InterceptorManager;
  528. /***/ }),
  529. /***/ "./node_modules/axios/lib/core/buildFullPath.js":
  530. /*!******************************************************!*\
  531. !*** ./node_modules/axios/lib/core/buildFullPath.js ***!
  532. \******************************************************/
  533. /*! no static exports found */
  534. /***/ (function(module, exports, __webpack_require__) {
  535. "use strict";
  536. var isAbsoluteURL = __webpack_require__(/*! ../helpers/isAbsoluteURL */ "./node_modules/axios/lib/helpers/isAbsoluteURL.js");
  537. var combineURLs = __webpack_require__(/*! ../helpers/combineURLs */ "./node_modules/axios/lib/helpers/combineURLs.js");
  538. /**
  539. * Creates a new URL by combining the baseURL with the requestedURL,
  540. * only when the requestedURL is not already an absolute URL.
  541. * If the requestURL is absolute, this function returns the requestedURL untouched.
  542. *
  543. * @param {string} baseURL The base URL
  544. * @param {string} requestedURL Absolute or relative URL to combine
  545. * @returns {string} The combined full path
  546. */
  547. module.exports = function buildFullPath(baseURL, requestedURL) {
  548. if (baseURL && !isAbsoluteURL(requestedURL)) {
  549. return combineURLs(baseURL, requestedURL);
  550. }
  551. return requestedURL;
  552. };
  553. /***/ }),
  554. /***/ "./node_modules/axios/lib/core/createError.js":
  555. /*!****************************************************!*\
  556. !*** ./node_modules/axios/lib/core/createError.js ***!
  557. \****************************************************/
  558. /*! no static exports found */
  559. /***/ (function(module, exports, __webpack_require__) {
  560. "use strict";
  561. var enhanceError = __webpack_require__(/*! ./enhanceError */ "./node_modules/axios/lib/core/enhanceError.js");
  562. /**
  563. * Create an Error with the specified message, config, error code, request and response.
  564. *
  565. * @param {string} message The error message.
  566. * @param {Object} config The config.
  567. * @param {string} [code] The error code (for example, 'ECONNABORTED').
  568. * @param {Object} [request] The request.
  569. * @param {Object} [response] The response.
  570. * @returns {Error} The created error.
  571. */
  572. module.exports = function createError(message, config, code, request, response) {
  573. var error = new Error(message);
  574. return enhanceError(error, config, code, request, response);
  575. };
  576. /***/ }),
  577. /***/ "./node_modules/axios/lib/core/dispatchRequest.js":
  578. /*!********************************************************!*\
  579. !*** ./node_modules/axios/lib/core/dispatchRequest.js ***!
  580. \********************************************************/
  581. /*! no static exports found */
  582. /***/ (function(module, exports, __webpack_require__) {
  583. "use strict";
  584. var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js");
  585. var transformData = __webpack_require__(/*! ./transformData */ "./node_modules/axios/lib/core/transformData.js");
  586. var isCancel = __webpack_require__(/*! ../cancel/isCancel */ "./node_modules/axios/lib/cancel/isCancel.js");
  587. var defaults = __webpack_require__(/*! ../defaults */ "./node_modules/axios/lib/defaults.js");
  588. /**
  589. * Throws a `Cancel` if cancellation has been requested.
  590. */
  591. function throwIfCancellationRequested(config) {
  592. if (config.cancelToken) {
  593. config.cancelToken.throwIfRequested();
  594. }
  595. }
  596. /**
  597. * Dispatch a request to the server using the configured adapter.
  598. *
  599. * @param {object} config The config that is to be used for the request
  600. * @returns {Promise} The Promise to be fulfilled
  601. */
  602. module.exports = function dispatchRequest(config) {
  603. throwIfCancellationRequested(config);
  604. // Ensure headers exist
  605. config.headers = config.headers || {};
  606. // Transform request data
  607. config.data = transformData(
  608. config.data,
  609. config.headers,
  610. config.transformRequest
  611. );
  612. // Flatten headers
  613. config.headers = utils.merge(
  614. config.headers.common || {},
  615. config.headers[config.method] || {},
  616. config.headers
  617. );
  618. utils.forEach(
  619. ['delete', 'get', 'head', 'post', 'put', 'patch', 'common'],
  620. function cleanHeaderConfig(method) {
  621. delete config.headers[method];
  622. }
  623. );
  624. var adapter = config.adapter || defaults.adapter;
  625. return adapter(config).then(function onAdapterResolution(response) {
  626. throwIfCancellationRequested(config);
  627. // Transform response data
  628. response.data = transformData(
  629. response.data,
  630. response.headers,
  631. config.transformResponse
  632. );
  633. return response;
  634. }, function onAdapterRejection(reason) {
  635. if (!isCancel(reason)) {
  636. throwIfCancellationRequested(config);
  637. // Transform response data
  638. if (reason && reason.response) {
  639. reason.response.data = transformData(
  640. reason.response.data,
  641. reason.response.headers,
  642. config.transformResponse
  643. );
  644. }
  645. }
  646. return Promise.reject(reason);
  647. });
  648. };
  649. /***/ }),
  650. /***/ "./node_modules/axios/lib/core/enhanceError.js":
  651. /*!*****************************************************!*\
  652. !*** ./node_modules/axios/lib/core/enhanceError.js ***!
  653. \*****************************************************/
  654. /*! no static exports found */
  655. /***/ (function(module, exports, __webpack_require__) {
  656. "use strict";
  657. /**
  658. * Update an Error with the specified config, error code, and response.
  659. *
  660. * @param {Error} error The error to update.
  661. * @param {Object} config The config.
  662. * @param {string} [code] The error code (for example, 'ECONNABORTED').
  663. * @param {Object} [request] The request.
  664. * @param {Object} [response] The response.
  665. * @returns {Error} The error.
  666. */
  667. module.exports = function enhanceError(error, config, code, request, response) {
  668. error.config = config;
  669. if (code) {
  670. error.code = code;
  671. }
  672. error.request = request;
  673. error.response = response;
  674. error.isAxiosError = true;
  675. error.toJSON = function() {
  676. return {
  677. // Standard
  678. message: this.message,
  679. name: this.name,
  680. // Microsoft
  681. description: this.description,
  682. number: this.number,
  683. // Mozilla
  684. fileName: this.fileName,
  685. lineNumber: this.lineNumber,
  686. columnNumber: this.columnNumber,
  687. stack: this.stack,
  688. // Axios
  689. config: this.config,
  690. code: this.code
  691. };
  692. };
  693. return error;
  694. };
  695. /***/ }),
  696. /***/ "./node_modules/axios/lib/core/mergeConfig.js":
  697. /*!****************************************************!*\
  698. !*** ./node_modules/axios/lib/core/mergeConfig.js ***!
  699. \****************************************************/
  700. /*! no static exports found */
  701. /***/ (function(module, exports, __webpack_require__) {
  702. "use strict";
  703. var utils = __webpack_require__(/*! ../utils */ "./node_modules/axios/lib/utils.js");
  704. /**
  705. * Config-specific merge-function which creates a new config-object
  706. * by merging two configuration objects together.
  707. *
  708. * @param {Object} config1
  709. * @param {Object} config2
  710. * @returns {Object} New object resulting from merging config2 to config1
  711. */
  712. module.exports = function mergeConfig(config1, config2) {
  713. // eslint-disable-next-line no-param-reassign
  714. config2 = config2 || {};
  715. var config = {};
  716. var valueFromConfig2Keys = ['url', 'method', 'params', 'data'];
  717. var mergeDeepPropertiesKeys = ['headers', 'auth', 'proxy'];
  718. var defaultToConfig2Keys = [
  719. 'baseURL', 'url', 'transformRequest', 'transformResponse', 'paramsSerializer',
  720. 'timeout', 'withCredentials', 'adapter', 'responseType', 'xsrfCookieName',
  721. 'xsrfHeaderName', 'onUploadProgress', 'onDownloadProgress',
  722. 'maxContentLength', 'validateStatus', 'maxRedirects', 'httpAgent',
  723. 'httpsAgent', 'cancelToken', 'socketPath'
  724. ];
  725. utils.forEach(valueFromConfig2Keys, function valueFromConfig2(prop) {
  726. if (typeof config2[prop] !== 'undefined') {
  727. config[prop] = config2[prop];
  728. }
  729. });
  730. utils.forEach(mergeDeepPropertiesKeys, function mergeDeepProperties(prop) {
  731. if (utils.isObject(config2[prop])) {
  732. config[prop] = utils.deepMerge(config1[prop], config2[prop]);
  733. } else if (typeof config2[prop] !== 'undefined') {
  734. config[prop] = config2[prop];
  735. } else if (utils.isObject(config1[prop])) {
  736. config[prop] = utils.deepMerge(config1[prop]);
  737. } else if (typeof config1[prop] !== 'undefined') {
  738. config[prop] = config1[prop];
  739. }
  740. });
  741. utils.forEach(defaultToConfig2Keys, function defaultToConfig2(prop) {
  742. if (typeof config2[prop] !== 'undefined') {
  743. config[prop] = config2[prop];
  744. } else if (typeof config1[prop] !== 'undefined') {
  745. config[prop] = config1[prop];
  746. }
  747. });
  748. var axiosKeys = valueFromConfig2Keys
  749. .concat(mergeDeepPropertiesKeys)
  750. .concat(defaultToConfig2Keys);
  751. var otherKeys = Object
  752. .keys(config2)
  753. .filter(function filterAxiosKeys(key) {
  754. return axiosKeys.indexOf(key) === -1;
  755. });
  756. utils.forEach(otherKeys, function otherKeysDefaultToConfig2(prop) {
  757. if (typeof config2[prop] !== 'undefined') {
  758. config[prop] = config2[prop];
  759. } else if (typeof config1[prop] !== 'undefined') {
  760. config[prop] = config1[prop];
  761. }
  762. });
  763. return config;
  764. };
  765. /***/ }),
  766. /***/ "./node_modules/axios/lib/core/settle.js":
  767. /*!***********************************************!*\
  768. !*** ./node_modules/axios/lib/core/settle.js ***!
  769. \***********************************************/
  770. /*! no static exports found */
  771. /***/ (function(module, exports, __webpack_require__) {
  772. "use strict";
  773. var createError = __webpack_require__(/*! ./createError */ "./node_modules/axios/lib/core/createError.js");
  774. /**
  775. * Resolve or reject a Promise based on response status.
  776. *
  777. * @param {Function} resolve A function that resolves the promise.
  778. * @param {Function} reject A function that rejects the promise.
  779. * @param {object} response The response.
  780. */
  781. module.exports = function settle(resolve, reject, response) {
  782. var validateStatus = response.config.validateStatus;
  783. if (!validateStatus || validateStatus(response.status)) {
  784. resolve(response);
  785. } else {
  786. reject(createError(
  787. 'Request failed with status code ' + response.status,
  788. response.config,
  789. null,
  790. response.request,
  791. response
  792. ));
  793. }
  794. };
  795. /***/ }),
  796. /***/ "./node_modules/axios/lib/core/transformData.js":
  797. /*!******************************************************!*\
  798. !*** ./node_modules/axios/lib/core/transformData.js ***!
  799. \******************************************************/
  800. /*! no static exports found */
  801. /***/ (function(module, exports, __webpack_require__) {
  802. "use strict";
  803. var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js");
  804. /**
  805. * Transform the data for a request or a response
  806. *
  807. * @param {Object|String} data The data to be transformed
  808. * @param {Array} headers The headers for the request or response
  809. * @param {Array|Function} fns A single function or Array of functions
  810. * @returns {*} The resulting transformed data
  811. */
  812. module.exports = function transformData(data, headers, fns) {
  813. /*eslint no-param-reassign:0*/
  814. utils.forEach(fns, function transform(fn) {
  815. data = fn(data, headers);
  816. });
  817. return data;
  818. };
  819. /***/ }),
  820. /***/ "./node_modules/axios/lib/defaults.js":
  821. /*!********************************************!*\
  822. !*** ./node_modules/axios/lib/defaults.js ***!
  823. \********************************************/
  824. /*! no static exports found */
  825. /***/ (function(module, exports, __webpack_require__) {
  826. "use strict";
  827. /* WEBPACK VAR INJECTION */(function(process) {
  828. var utils = __webpack_require__(/*! ./utils */ "./node_modules/axios/lib/utils.js");
  829. var normalizeHeaderName = __webpack_require__(/*! ./helpers/normalizeHeaderName */ "./node_modules/axios/lib/helpers/normalizeHeaderName.js");
  830. var DEFAULT_CONTENT_TYPE = {
  831. 'Content-Type': 'application/x-www-form-urlencoded'
  832. };
  833. function setContentTypeIfUnset(headers, value) {
  834. if (!utils.isUndefined(headers) && utils.isUndefined(headers['Content-Type'])) {
  835. headers['Content-Type'] = value;
  836. }
  837. }
  838. function getDefaultAdapter() {
  839. var adapter;
  840. if (typeof XMLHttpRequest !== 'undefined') {
  841. // For browsers use XHR adapter
  842. adapter = __webpack_require__(/*! ./adapters/xhr */ "./node_modules/axios/lib/adapters/xhr.js");
  843. } else if (typeof process !== 'undefined' && Object.prototype.toString.call(process) === '[object process]') {
  844. // For node use HTTP adapter
  845. adapter = __webpack_require__(/*! ./adapters/http */ "./node_modules/axios/lib/adapters/xhr.js");
  846. }
  847. return adapter;
  848. }
  849. var defaults = {
  850. adapter: getDefaultAdapter(),
  851. transformRequest: [function transformRequest(data, headers) {
  852. normalizeHeaderName(headers, 'Accept');
  853. normalizeHeaderName(headers, 'Content-Type');
  854. if (utils.isFormData(data) ||
  855. utils.isArrayBuffer(data) ||
  856. utils.isBuffer(data) ||
  857. utils.isStream(data) ||
  858. utils.isFile(data) ||
  859. utils.isBlob(data)
  860. ) {
  861. return data;
  862. }
  863. if (utils.isArrayBufferView(data)) {
  864. return data.buffer;
  865. }
  866. if (utils.isURLSearchParams(data)) {
  867. setContentTypeIfUnset(headers, 'application/x-www-form-urlencoded;charset=utf-8');
  868. return data.toString();
  869. }
  870. if (utils.isObject(data)) {
  871. setContentTypeIfUnset(headers, 'application/json;charset=utf-8');
  872. return JSON.stringify(data);
  873. }
  874. return data;
  875. }],
  876. transformResponse: [function transformResponse(data) {
  877. /*eslint no-param-reassign:0*/
  878. if (typeof data === 'string') {
  879. try {
  880. data = JSON.parse(data);
  881. } catch (e) { /* Ignore */ }
  882. }
  883. return data;
  884. }],
  885. /**
  886. * A timeout in milliseconds to abort a request. If set to 0 (default) a
  887. * timeout is not created.
  888. */
  889. timeout: 0,
  890. xsrfCookieName: 'XSRF-TOKEN',
  891. xsrfHeaderName: 'X-XSRF-TOKEN',
  892. maxContentLength: -1,
  893. validateStatus: function validateStatus(status) {
  894. return status >= 200 && status < 300;
  895. }
  896. };
  897. defaults.headers = {
  898. common: {
  899. 'Accept': 'application/json, text/plain, */*'
  900. }
  901. };
  902. utils.forEach(['delete', 'get', 'head'], function forEachMethodNoData(method) {
  903. defaults.headers[method] = {};
  904. });
  905. utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
  906. defaults.headers[method] = utils.merge(DEFAULT_CONTENT_TYPE);
  907. });
  908. module.exports = defaults;
  909. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../process/browser.js */ "./node_modules/process/browser.js")))
  910. /***/ }),
  911. /***/ "./node_modules/axios/lib/helpers/bind.js":
  912. /*!************************************************!*\
  913. !*** ./node_modules/axios/lib/helpers/bind.js ***!
  914. \************************************************/
  915. /*! no static exports found */
  916. /***/ (function(module, exports, __webpack_require__) {
  917. "use strict";
  918. module.exports = function bind(fn, thisArg) {
  919. return function wrap() {
  920. var args = new Array(arguments.length);
  921. for (var i = 0; i < args.length; i++) {
  922. args[i] = arguments[i];
  923. }
  924. return fn.apply(thisArg, args);
  925. };
  926. };
  927. /***/ }),
  928. /***/ "./node_modules/axios/lib/helpers/buildURL.js":
  929. /*!****************************************************!*\
  930. !*** ./node_modules/axios/lib/helpers/buildURL.js ***!
  931. \****************************************************/
  932. /*! no static exports found */
  933. /***/ (function(module, exports, __webpack_require__) {
  934. "use strict";
  935. var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js");
  936. function encode(val) {
  937. return encodeURIComponent(val).
  938. replace(/%40/gi, '@').
  939. replace(/%3A/gi, ':').
  940. replace(/%24/g, '$').
  941. replace(/%2C/gi, ',').
  942. replace(/%20/g, '+').
  943. replace(/%5B/gi, '[').
  944. replace(/%5D/gi, ']');
  945. }
  946. /**
  947. * Build a URL by appending params to the end
  948. *
  949. * @param {string} url The base of the url (e.g., http://www.google.com)
  950. * @param {object} [params] The params to be appended
  951. * @returns {string} The formatted url
  952. */
  953. module.exports = function buildURL(url, params, paramsSerializer) {
  954. /*eslint no-param-reassign:0*/
  955. if (!params) {
  956. return url;
  957. }
  958. var serializedParams;
  959. if (paramsSerializer) {
  960. serializedParams = paramsSerializer(params);
  961. } else if (utils.isURLSearchParams(params)) {
  962. serializedParams = params.toString();
  963. } else {
  964. var parts = [];
  965. utils.forEach(params, function serialize(val, key) {
  966. if (val === null || typeof val === 'undefined') {
  967. return;
  968. }
  969. if (utils.isArray(val)) {
  970. key = key + '[]';
  971. } else {
  972. val = [val];
  973. }
  974. utils.forEach(val, function parseValue(v) {
  975. if (utils.isDate(v)) {
  976. v = v.toISOString();
  977. } else if (utils.isObject(v)) {
  978. v = JSON.stringify(v);
  979. }
  980. parts.push(encode(key) + '=' + encode(v));
  981. });
  982. });
  983. serializedParams = parts.join('&');
  984. }
  985. if (serializedParams) {
  986. var hashmarkIndex = url.indexOf('#');
  987. if (hashmarkIndex !== -1) {
  988. url = url.slice(0, hashmarkIndex);
  989. }
  990. url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;
  991. }
  992. return url;
  993. };
  994. /***/ }),
  995. /***/ "./node_modules/axios/lib/helpers/combineURLs.js":
  996. /*!*******************************************************!*\
  997. !*** ./node_modules/axios/lib/helpers/combineURLs.js ***!
  998. \*******************************************************/
  999. /*! no static exports found */
  1000. /***/ (function(module, exports, __webpack_require__) {
  1001. "use strict";
  1002. /**
  1003. * Creates a new URL by combining the specified URLs
  1004. *
  1005. * @param {string} baseURL The base URL
  1006. * @param {string} relativeURL The relative URL
  1007. * @returns {string} The combined URL
  1008. */
  1009. module.exports = function combineURLs(baseURL, relativeURL) {
  1010. return relativeURL
  1011. ? baseURL.replace(/\/+$/, '') + '/' + relativeURL.replace(/^\/+/, '')
  1012. : baseURL;
  1013. };
  1014. /***/ }),
  1015. /***/ "./node_modules/axios/lib/helpers/cookies.js":
  1016. /*!***************************************************!*\
  1017. !*** ./node_modules/axios/lib/helpers/cookies.js ***!
  1018. \***************************************************/
  1019. /*! no static exports found */
  1020. /***/ (function(module, exports, __webpack_require__) {
  1021. "use strict";
  1022. var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js");
  1023. module.exports = (
  1024. utils.isStandardBrowserEnv() ?
  1025. // Standard browser envs support document.cookie
  1026. (function standardBrowserEnv() {
  1027. return {
  1028. write: function write(name, value, expires, path, domain, secure) {
  1029. var cookie = [];
  1030. cookie.push(name + '=' + encodeURIComponent(value));
  1031. if (utils.isNumber(expires)) {
  1032. cookie.push('expires=' + new Date(expires).toGMTString());
  1033. }
  1034. if (utils.isString(path)) {
  1035. cookie.push('path=' + path);
  1036. }
  1037. if (utils.isString(domain)) {
  1038. cookie.push('domain=' + domain);
  1039. }
  1040. if (secure === true) {
  1041. cookie.push('secure');
  1042. }
  1043. document.cookie = cookie.join('; ');
  1044. },
  1045. read: function read(name) {
  1046. var match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)'));
  1047. return (match ? decodeURIComponent(match[3]) : null);
  1048. },
  1049. remove: function remove(name) {
  1050. this.write(name, '', Date.now() - 86400000);
  1051. }
  1052. };
  1053. })() :
  1054. // Non standard browser env (web workers, react-native) lack needed support.
  1055. (function nonStandardBrowserEnv() {
  1056. return {
  1057. write: function write() {},
  1058. read: function read() { return null; },
  1059. remove: function remove() {}
  1060. };
  1061. })()
  1062. );
  1063. /***/ }),
  1064. /***/ "./node_modules/axios/lib/helpers/isAbsoluteURL.js":
  1065. /*!*********************************************************!*\
  1066. !*** ./node_modules/axios/lib/helpers/isAbsoluteURL.js ***!
  1067. \*********************************************************/
  1068. /*! no static exports found */
  1069. /***/ (function(module, exports, __webpack_require__) {
  1070. "use strict";
  1071. /**
  1072. * Determines whether the specified URL is absolute
  1073. *
  1074. * @param {string} url The URL to test
  1075. * @returns {boolean} True if the specified URL is absolute, otherwise false
  1076. */
  1077. module.exports = function isAbsoluteURL(url) {
  1078. // A URL is considered absolute if it begins with "<scheme>://" or "//" (protocol-relative URL).
  1079. // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed
  1080. // by any combination of letters, digits, plus, period, or hyphen.
  1081. return /^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(url);
  1082. };
  1083. /***/ }),
  1084. /***/ "./node_modules/axios/lib/helpers/isURLSameOrigin.js":
  1085. /*!***********************************************************!*\
  1086. !*** ./node_modules/axios/lib/helpers/isURLSameOrigin.js ***!
  1087. \***********************************************************/
  1088. /*! no static exports found */
  1089. /***/ (function(module, exports, __webpack_require__) {
  1090. "use strict";
  1091. var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js");
  1092. module.exports = (
  1093. utils.isStandardBrowserEnv() ?
  1094. // Standard browser envs have full support of the APIs needed to test
  1095. // whether the request URL is of the same origin as current location.
  1096. (function standardBrowserEnv() {
  1097. var msie = /(msie|trident)/i.test(navigator.userAgent);
  1098. var urlParsingNode = document.createElement('a');
  1099. var originURL;
  1100. /**
  1101. * Parse a URL to discover it's components
  1102. *
  1103. * @param {String} url The URL to be parsed
  1104. * @returns {Object}
  1105. */
  1106. function resolveURL(url) {
  1107. var href = url;
  1108. if (msie) {
  1109. // IE needs attribute set twice to normalize properties
  1110. urlParsingNode.setAttribute('href', href);
  1111. href = urlParsingNode.href;
  1112. }
  1113. urlParsingNode.setAttribute('href', href);
  1114. // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils
  1115. return {
  1116. href: urlParsingNode.href,
  1117. protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',
  1118. host: urlParsingNode.host,
  1119. search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, '') : '',
  1120. hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',
  1121. hostname: urlParsingNode.hostname,
  1122. port: urlParsingNode.port,
  1123. pathname: (urlParsingNode.pathname.charAt(0) === '/') ?
  1124. urlParsingNode.pathname :
  1125. '/' + urlParsingNode.pathname
  1126. };
  1127. }
  1128. originURL = resolveURL(window.location.href);
  1129. /**
  1130. * Determine if a URL shares the same origin as the current location
  1131. *
  1132. * @param {String} requestURL The URL to test
  1133. * @returns {boolean} True if URL shares the same origin, otherwise false
  1134. */
  1135. return function isURLSameOrigin(requestURL) {
  1136. var parsed = (utils.isString(requestURL)) ? resolveURL(requestURL) : requestURL;
  1137. return (parsed.protocol === originURL.protocol &&
  1138. parsed.host === originURL.host);
  1139. };
  1140. })() :
  1141. // Non standard browser envs (web workers, react-native) lack needed support.
  1142. (function nonStandardBrowserEnv() {
  1143. return function isURLSameOrigin() {
  1144. return true;
  1145. };
  1146. })()
  1147. );
  1148. /***/ }),
  1149. /***/ "./node_modules/axios/lib/helpers/normalizeHeaderName.js":
  1150. /*!***************************************************************!*\
  1151. !*** ./node_modules/axios/lib/helpers/normalizeHeaderName.js ***!
  1152. \***************************************************************/
  1153. /*! no static exports found */
  1154. /***/ (function(module, exports, __webpack_require__) {
  1155. "use strict";
  1156. var utils = __webpack_require__(/*! ../utils */ "./node_modules/axios/lib/utils.js");
  1157. module.exports = function normalizeHeaderName(headers, normalizedName) {
  1158. utils.forEach(headers, function processHeader(value, name) {
  1159. if (name !== normalizedName && name.toUpperCase() === normalizedName.toUpperCase()) {
  1160. headers[normalizedName] = value;
  1161. delete headers[name];
  1162. }
  1163. });
  1164. };
  1165. /***/ }),
  1166. /***/ "./node_modules/axios/lib/helpers/parseHeaders.js":
  1167. /*!********************************************************!*\
  1168. !*** ./node_modules/axios/lib/helpers/parseHeaders.js ***!
  1169. \********************************************************/
  1170. /*! no static exports found */
  1171. /***/ (function(module, exports, __webpack_require__) {
  1172. "use strict";
  1173. var utils = __webpack_require__(/*! ./../utils */ "./node_modules/axios/lib/utils.js");
  1174. // Headers whose duplicates are ignored by node
  1175. // c.f. https://nodejs.org/api/http.html#http_message_headers
  1176. var ignoreDuplicateOf = [
  1177. 'age', 'authorization', 'content-length', 'content-type', 'etag',
  1178. 'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since',
  1179. 'last-modified', 'location', 'max-forwards', 'proxy-authorization',
  1180. 'referer', 'retry-after', 'user-agent'
  1181. ];
  1182. /**
  1183. * Parse headers into an object
  1184. *
  1185. * ```
  1186. * Date: Wed, 27 Aug 2014 08:58:49 GMT
  1187. * Content-Type: application/json
  1188. * Connection: keep-alive
  1189. * Transfer-Encoding: chunked
  1190. * ```
  1191. *
  1192. * @param {String} headers Headers needing to be parsed
  1193. * @returns {Object} Headers parsed into an object
  1194. */
  1195. module.exports = function parseHeaders(headers) {
  1196. var parsed = {};
  1197. var key;
  1198. var val;
  1199. var i;
  1200. if (!headers) { return parsed; }
  1201. utils.forEach(headers.split('\n'), function parser(line) {
  1202. i = line.indexOf(':');
  1203. key = utils.trim(line.substr(0, i)).toLowerCase();
  1204. val = utils.trim(line.substr(i + 1));
  1205. if (key) {
  1206. if (parsed[key] && ignoreDuplicateOf.indexOf(key) >= 0) {
  1207. return;
  1208. }
  1209. if (key === 'set-cookie') {
  1210. parsed[key] = (parsed[key] ? parsed[key] : []).concat([val]);
  1211. } else {
  1212. parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
  1213. }
  1214. }
  1215. });
  1216. return parsed;
  1217. };
  1218. /***/ }),
  1219. /***/ "./node_modules/axios/lib/helpers/spread.js":
  1220. /*!**************************************************!*\
  1221. !*** ./node_modules/axios/lib/helpers/spread.js ***!
  1222. \**************************************************/
  1223. /*! no static exports found */
  1224. /***/ (function(module, exports, __webpack_require__) {
  1225. "use strict";
  1226. /**
  1227. * Syntactic sugar for invoking a function and expanding an array for arguments.
  1228. *
  1229. * Common use case would be to use `Function.prototype.apply`.
  1230. *
  1231. * ```js
  1232. * function f(x, y, z) {}
  1233. * var args = [1, 2, 3];
  1234. * f.apply(null, args);
  1235. * ```
  1236. *
  1237. * With `spread` this example can be re-written.
  1238. *
  1239. * ```js
  1240. * spread(function(x, y, z) {})([1, 2, 3]);
  1241. * ```
  1242. *
  1243. * @param {Function} callback
  1244. * @returns {Function}
  1245. */
  1246. module.exports = function spread(callback) {
  1247. return function wrap(arr) {
  1248. return callback.apply(null, arr);
  1249. };
  1250. };
  1251. /***/ }),
  1252. /***/ "./node_modules/axios/lib/utils.js":
  1253. /*!*****************************************!*\
  1254. !*** ./node_modules/axios/lib/utils.js ***!
  1255. \*****************************************/
  1256. /*! no static exports found */
  1257. /***/ (function(module, exports, __webpack_require__) {
  1258. "use strict";
  1259. var bind = __webpack_require__(/*! ./helpers/bind */ "./node_modules/axios/lib/helpers/bind.js");
  1260. /*global toString:true*/
  1261. // utils is a library of generic helper functions non-specific to axios
  1262. var toString = Object.prototype.toString;
  1263. /**
  1264. * Determine if a value is an Array
  1265. *
  1266. * @param {Object} val The value to test
  1267. * @returns {boolean} True if value is an Array, otherwise false
  1268. */
  1269. function isArray(val) {
  1270. return toString.call(val) === '[object Array]';
  1271. }
  1272. /**
  1273. * Determine if a value is undefined
  1274. *
  1275. * @param {Object} val The value to test
  1276. * @returns {boolean} True if the value is undefined, otherwise false
  1277. */
  1278. function isUndefined(val) {
  1279. return typeof val === 'undefined';
  1280. }
  1281. /**
  1282. * Determine if a value is a Buffer
  1283. *
  1284. * @param {Object} val The value to test
  1285. * @returns {boolean} True if value is a Buffer, otherwise false
  1286. */
  1287. function isBuffer(val) {
  1288. return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor)
  1289. && typeof val.constructor.isBuffer === 'function' && val.constructor.isBuffer(val);
  1290. }
  1291. /**
  1292. * Determine if a value is an ArrayBuffer
  1293. *
  1294. * @param {Object} val The value to test
  1295. * @returns {boolean} True if value is an ArrayBuffer, otherwise false
  1296. */
  1297. function isArrayBuffer(val) {
  1298. return toString.call(val) === '[object ArrayBuffer]';
  1299. }
  1300. /**
  1301. * Determine if a value is a FormData
  1302. *
  1303. * @param {Object} val The value to test
  1304. * @returns {boolean} True if value is an FormData, otherwise false
  1305. */
  1306. function isFormData(val) {
  1307. return (typeof FormData !== 'undefined') && (val instanceof FormData);
  1308. }
  1309. /**
  1310. * Determine if a value is a view on an ArrayBuffer
  1311. *
  1312. * @param {Object} val The value to test
  1313. * @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false
  1314. */
  1315. function isArrayBufferView(val) {
  1316. var result;
  1317. if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) {
  1318. result = ArrayBuffer.isView(val);
  1319. } else {
  1320. result = (val) && (val.buffer) && (val.buffer instanceof ArrayBuffer);
  1321. }
  1322. return result;
  1323. }
  1324. /**
  1325. * Determine if a value is a String
  1326. *
  1327. * @param {Object} val The value to test
  1328. * @returns {boolean} True if value is a String, otherwise false
  1329. */
  1330. function isString(val) {
  1331. return typeof val === 'string';
  1332. }
  1333. /**
  1334. * Determine if a value is a Number
  1335. *
  1336. * @param {Object} val The value to test
  1337. * @returns {boolean} True if value is a Number, otherwise false
  1338. */
  1339. function isNumber(val) {
  1340. return typeof val === 'number';
  1341. }
  1342. /**
  1343. * Determine if a value is an Object
  1344. *
  1345. * @param {Object} val The value to test
  1346. * @returns {boolean} True if value is an Object, otherwise false
  1347. */
  1348. function isObject(val) {
  1349. return val !== null && typeof val === 'object';
  1350. }
  1351. /**
  1352. * Determine if a value is a Date
  1353. *
  1354. * @param {Object} val The value to test
  1355. * @returns {boolean} True if value is a Date, otherwise false
  1356. */
  1357. function isDate(val) {
  1358. return toString.call(val) === '[object Date]';
  1359. }
  1360. /**
  1361. * Determine if a value is a File
  1362. *
  1363. * @param {Object} val The value to test
  1364. * @returns {boolean} True if value is a File, otherwise false
  1365. */
  1366. function isFile(val) {
  1367. return toString.call(val) === '[object File]';
  1368. }
  1369. /**
  1370. * Determine if a value is a Blob
  1371. *
  1372. * @param {Object} val The value to test
  1373. * @returns {boolean} True if value is a Blob, otherwise false
  1374. */
  1375. function isBlob(val) {
  1376. return toString.call(val) === '[object Blob]';
  1377. }
  1378. /**
  1379. * Determine if a value is a Function
  1380. *
  1381. * @param {Object} val The value to test
  1382. * @returns {boolean} True if value is a Function, otherwise false
  1383. */
  1384. function isFunction(val) {
  1385. return toString.call(val) === '[object Function]';
  1386. }
  1387. /**
  1388. * Determine if a value is a Stream
  1389. *
  1390. * @param {Object} val The value to test
  1391. * @returns {boolean} True if value is a Stream, otherwise false
  1392. */
  1393. function isStream(val) {
  1394. return isObject(val) && isFunction(val.pipe);
  1395. }
  1396. /**
  1397. * Determine if a value is a URLSearchParams object
  1398. *
  1399. * @param {Object} val The value to test
  1400. * @returns {boolean} True if value is a URLSearchParams object, otherwise false
  1401. */
  1402. function isURLSearchParams(val) {
  1403. return typeof URLSearchParams !== 'undefined' && val instanceof URLSearchParams;
  1404. }
  1405. /**
  1406. * Trim excess whitespace off the beginning and end of a string
  1407. *
  1408. * @param {String} str The String to trim
  1409. * @returns {String} The String freed of excess whitespace
  1410. */
  1411. function trim(str) {
  1412. return str.replace(/^\s*/, '').replace(/\s*$/, '');
  1413. }
  1414. /**
  1415. * Determine if we're running in a standard browser environment
  1416. *
  1417. * This allows axios to run in a web worker, and react-native.
  1418. * Both environments support XMLHttpRequest, but not fully standard globals.
  1419. *
  1420. * web workers:
  1421. * typeof window -> undefined
  1422. * typeof document -> undefined
  1423. *
  1424. * react-native:
  1425. * navigator.product -> 'ReactNative'
  1426. * nativescript
  1427. * navigator.product -> 'NativeScript' or 'NS'
  1428. */
  1429. function isStandardBrowserEnv() {
  1430. if (typeof navigator !== 'undefined' && (navigator.product === 'ReactNative' ||
  1431. navigator.product === 'NativeScript' ||
  1432. navigator.product === 'NS')) {
  1433. return false;
  1434. }
  1435. return (
  1436. typeof window !== 'undefined' &&
  1437. typeof document !== 'undefined'
  1438. );
  1439. }
  1440. /**
  1441. * Iterate over an Array or an Object invoking a function for each item.
  1442. *
  1443. * If `obj` is an Array callback will be called passing
  1444. * the value, index, and complete array for each item.
  1445. *
  1446. * If 'obj' is an Object callback will be called passing
  1447. * the value, key, and complete object for each property.
  1448. *
  1449. * @param {Object|Array} obj The object to iterate
  1450. * @param {Function} fn The callback to invoke for each item
  1451. */
  1452. function forEach(obj, fn) {
  1453. // Don't bother if no value provided
  1454. if (obj === null || typeof obj === 'undefined') {
  1455. return;
  1456. }
  1457. // Force an array if not already something iterable
  1458. if (typeof obj !== 'object') {
  1459. /*eslint no-param-reassign:0*/
  1460. obj = [obj];
  1461. }
  1462. if (isArray(obj)) {
  1463. // Iterate over array values
  1464. for (var i = 0, l = obj.length; i < l; i++) {
  1465. fn.call(null, obj[i], i, obj);
  1466. }
  1467. } else {
  1468. // Iterate over object keys
  1469. for (var key in obj) {
  1470. if (Object.prototype.hasOwnProperty.call(obj, key)) {
  1471. fn.call(null, obj[key], key, obj);
  1472. }
  1473. }
  1474. }
  1475. }
  1476. /**
  1477. * Accepts varargs expecting each argument to be an object, then
  1478. * immutably merges the properties of each object and returns result.
  1479. *
  1480. * When multiple objects contain the same key the later object in
  1481. * the arguments list will take precedence.
  1482. *
  1483. * Example:
  1484. *
  1485. * ```js
  1486. * var result = merge({foo: 123}, {foo: 456});
  1487. * console.log(result.foo); // outputs 456
  1488. * ```
  1489. *
  1490. * @param {Object} obj1 Object to merge
  1491. * @returns {Object} Result of all merge properties
  1492. */
  1493. function merge(/* obj1, obj2, obj3, ... */) {
  1494. var result = {};
  1495. function assignValue(val, key) {
  1496. if (typeof result[key] === 'object' && typeof val === 'object') {
  1497. result[key] = merge(result[key], val);
  1498. } else {
  1499. result[key] = val;
  1500. }
  1501. }
  1502. for (var i = 0, l = arguments.length; i < l; i++) {
  1503. forEach(arguments[i], assignValue);
  1504. }
  1505. return result;
  1506. }
  1507. /**
  1508. * Function equal to merge with the difference being that no reference
  1509. * to original objects is kept.
  1510. *
  1511. * @see merge
  1512. * @param {Object} obj1 Object to merge
  1513. * @returns {Object} Result of all merge properties
  1514. */
  1515. function deepMerge(/* obj1, obj2, obj3, ... */) {
  1516. var result = {};
  1517. function assignValue(val, key) {
  1518. if (typeof result[key] === 'object' && typeof val === 'object') {
  1519. result[key] = deepMerge(result[key], val);
  1520. } else if (typeof val === 'object') {
  1521. result[key] = deepMerge({}, val);
  1522. } else {
  1523. result[key] = val;
  1524. }
  1525. }
  1526. for (var i = 0, l = arguments.length; i < l; i++) {
  1527. forEach(arguments[i], assignValue);
  1528. }
  1529. return result;
  1530. }
  1531. /**
  1532. * Extends object a by mutably adding to it the properties of object b.
  1533. *
  1534. * @param {Object} a The object to be extended
  1535. * @param {Object} b The object to copy properties from
  1536. * @param {Object} thisArg The object to bind function to
  1537. * @return {Object} The resulting value of object a
  1538. */
  1539. function extend(a, b, thisArg) {
  1540. forEach(b, function assignValue(val, key) {
  1541. if (thisArg && typeof val === 'function') {
  1542. a[key] = bind(val, thisArg);
  1543. } else {
  1544. a[key] = val;
  1545. }
  1546. });
  1547. return a;
  1548. }
  1549. module.exports = {
  1550. isArray: isArray,
  1551. isArrayBuffer: isArrayBuffer,
  1552. isBuffer: isBuffer,
  1553. isFormData: isFormData,
  1554. isArrayBufferView: isArrayBufferView,
  1555. isString: isString,
  1556. isNumber: isNumber,
  1557. isObject: isObject,
  1558. isUndefined: isUndefined,
  1559. isDate: isDate,
  1560. isFile: isFile,
  1561. isBlob: isBlob,
  1562. isFunction: isFunction,
  1563. isStream: isStream,
  1564. isURLSearchParams: isURLSearchParams,
  1565. isStandardBrowserEnv: isStandardBrowserEnv,
  1566. forEach: forEach,
  1567. merge: merge,
  1568. deepMerge: deepMerge,
  1569. extend: extend,
  1570. trim: trim
  1571. };
  1572. /***/ }),
  1573. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/ExampleComponent.vue?vue&type=script&lang=js&":
  1574. /*!***************************************************************************************************************************************************************************!*\
  1575. !*** ./node_modules/babel-loader/lib??ref--4-0!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/ExampleComponent.vue?vue&type=script&lang=js& ***!
  1576. \***************************************************************************************************************************************************************************/
  1577. /*! exports provided: default */
  1578. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1579. "use strict";
  1580. __webpack_require__.r(__webpack_exports__);
  1581. //
  1582. //
  1583. //
  1584. //
  1585. //
  1586. //
  1587. //
  1588. //
  1589. //
  1590. //
  1591. //
  1592. //
  1593. //
  1594. //
  1595. //
  1596. //
  1597. /* harmony default export */ __webpack_exports__["default"] = ({
  1598. mounted: function mounted() {
  1599. console.log('Component mounted.');
  1600. }
  1601. });
  1602. /***/ }),
  1603. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/assetinfo.vue?vue&type=script&lang=js&":
  1604. /*!********************************************************************************************************************************************************************!*\
  1605. !*** ./node_modules/babel-loader/lib??ref--4-0!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/assetinfo.vue?vue&type=script&lang=js& ***!
  1606. \********************************************************************************************************************************************************************/
  1607. /*! exports provided: default */
  1608. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1609. "use strict";
  1610. __webpack_require__.r(__webpack_exports__);
  1611. //
  1612. //
  1613. //
  1614. //
  1615. //
  1616. //
  1617. //
  1618. //
  1619. //
  1620. //
  1621. //
  1622. //
  1623. //
  1624. //
  1625. //
  1626. //
  1627. //
  1628. //
  1629. //
  1630. //
  1631. //
  1632. //
  1633. //
  1634. //
  1635. //
  1636. //
  1637. //
  1638. //
  1639. //
  1640. //
  1641. //
  1642. //
  1643. //
  1644. //
  1645. //
  1646. //
  1647. //
  1648. //
  1649. //
  1650. //
  1651. //
  1652. //
  1653. //
  1654. //
  1655. //
  1656. //
  1657. //
  1658. //
  1659. //
  1660. //
  1661. //
  1662. //
  1663. //
  1664. //
  1665. //
  1666. //
  1667. /* harmony default export */ __webpack_exports__["default"] = ({
  1668. props: ['asset', 'pcextraStart'],
  1669. data: function data() {
  1670. return {
  1671. data: JSON.parse(this.asset),
  1672. pcextra: JSON.parse(this.pcextraStart)
  1673. };
  1674. },
  1675. mounted: function mounted() {
  1676. var _this = this;
  1677. Echo.channel('asset.' + this.data.pcid).listen('AssetUpdated', function (e) {
  1678. _this.data = e.data;
  1679. _this.pcextra = JSON.parse(e.pcextra);
  1680. });
  1681. },
  1682. methods: {
  1683. updateAsset: function updateAsset() {
  1684. this.data.pcextra = this.pcextra;
  1685. axios.put('/api/assets/' + this.data.pcid, this.data).then(function (response) {})["catch"](function (error) {});
  1686. $('#asseteditModal').modal('hide');
  1687. }
  1688. }
  1689. });
  1690. /***/ }),
  1691. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/autocomplete-custom-dropdown.vue?vue&type=script&lang=js&":
  1692. /*!***************************************************************************************************************************************************************************************!*\
  1693. !*** ./node_modules/babel-loader/lib??ref--4-0!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/autocomplete-custom-dropdown.vue?vue&type=script&lang=js& ***!
  1694. \***************************************************************************************************************************************************************************************/
  1695. /*! exports provided: default */
  1696. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1697. "use strict";
  1698. __webpack_require__.r(__webpack_exports__);
  1699. //
  1700. //
  1701. //
  1702. //
  1703. //
  1704. //
  1705. //
  1706. //
  1707. //
  1708. //
  1709. //
  1710. //
  1711. //
  1712. //
  1713. //
  1714. //
  1715. //
  1716. //
  1717. //
  1718. //
  1719. //
  1720. /* harmony default export */ __webpack_exports__["default"] = ({
  1721. props: {
  1722. value: null,
  1723. // An object with the following format
  1724. // {
  1725. // key: value,
  1726. // key: value,
  1727. // }
  1728. options: {
  1729. type: Object,
  1730. required: true
  1731. },
  1732. allowCustom: {
  1733. type: Boolean,
  1734. "default": false
  1735. }
  1736. },
  1737. data: function data() {
  1738. return {
  1739. searchText: '',
  1740. selectedOption: null,
  1741. open: false,
  1742. // allows for checking whether button was clicked or text was typed.
  1743. // If button was clicked, we show all options without having to clear
  1744. // out any searchText that was autofilled when page loaded.
  1745. isSearching: false
  1746. };
  1747. },
  1748. computed: {
  1749. matches: function matches() {
  1750. var _this = this;
  1751. // If button was clicked, show all options, if typing, filter
  1752. // options based on searchText
  1753. return Object.entries(this.options).filter(function (option) {
  1754. var optionText = option[1].toUpperCase();
  1755. if (_this.isSearching) {
  1756. return optionText.match(_this.searchText.toUpperCase());
  1757. } else {
  1758. return optionText.match('');
  1759. }
  1760. });
  1761. }
  1762. },
  1763. methods: {
  1764. // if button is clicked, show all options
  1765. setOpen: function setOpen(isOpen) {
  1766. this.open = isOpen;
  1767. this.isSearching = false;
  1768. },
  1769. // if typing in the box, start filtering options
  1770. searchChanged: function searchChanged() {
  1771. if (!this.open) {
  1772. this.open = true;
  1773. }
  1774. if (!this.isSearching) {
  1775. this.isSearching = true;
  1776. } // If custom values are allowed, emits {id: 'custom', name: searchtext}
  1777. if (this.allowCustom) {
  1778. this.$emit('input', {
  1779. 'id': 'custom',
  1780. 'name': this.searchText
  1781. });
  1782. }
  1783. },
  1784. // emits { id: suggestion_id, name: suggestion_name} to v-model when
  1785. // a suggestion is selected
  1786. suggestionSelected: function suggestionSelected(suggestion) {
  1787. this.open = false;
  1788. this.searchText = suggestion[1];
  1789. this.$emit('input', {
  1790. 'id': suggestion[0],
  1791. 'name': suggestion[1]
  1792. });
  1793. },
  1794. updateComponentWithValue: function updateComponentWithValue(newValue) {
  1795. if (this.allowCustom) {
  1796. this.searchText = this.value.name;
  1797. } else {
  1798. if (newValue.id > -1) {
  1799. // Find the matching text for the supplied option value
  1800. for (var id in this.options) {
  1801. if (this.options.hasOwnProperty(id)) {
  1802. if (this.options[id] === this.options[newValue.id]) {
  1803. this.searchText = this.options[id];
  1804. }
  1805. }
  1806. }
  1807. }
  1808. }
  1809. }
  1810. },
  1811. mounted: function mounted() {
  1812. this.updateComponentWithValue(this.value);
  1813. },
  1814. watch: {
  1815. value: function value(newValue) {
  1816. this.updateComponentWithValue(newValue);
  1817. }
  1818. }
  1819. });
  1820. /***/ }),
  1821. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/credential-form-modal.vue?vue&type=script&lang=js&":
  1822. /*!********************************************************************************************************************************************************************************!*\
  1823. !*** ./node_modules/babel-loader/lib??ref--4-0!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/credential-form-modal.vue?vue&type=script&lang=js& ***!
  1824. \********************************************************************************************************************************************************************************/
  1825. /*! exports provided: default */
  1826. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1827. "use strict";
  1828. __webpack_require__.r(__webpack_exports__);
  1829. //
  1830. //
  1831. //
  1832. //
  1833. //
  1834. //
  1835. //
  1836. //
  1837. //
  1838. //
  1839. //
  1840. //
  1841. //
  1842. //
  1843. //
  1844. //
  1845. //
  1846. //
  1847. //
  1848. //
  1849. //
  1850. //
  1851. //
  1852. //
  1853. //
  1854. //
  1855. /* harmony default export */ __webpack_exports__["default"] = ({
  1856. props: {
  1857. populateWith: {
  1858. type: Object,
  1859. "default": function _default() {
  1860. return {
  1861. creddesc: null,
  1862. creduser: null,
  1863. credpass: null,
  1864. groupid: null,
  1865. pcid: null,
  1866. credtype: null
  1867. };
  1868. }
  1869. },
  1870. modalId: {
  1871. type: String,
  1872. required: true
  1873. },
  1874. descriptions: {
  1875. type: Object,
  1876. required: true
  1877. },
  1878. create: {
  1879. type: Boolean
  1880. },
  1881. pcid: {
  1882. type: Number
  1883. },
  1884. groupid: {
  1885. type: Number
  1886. }
  1887. },
  1888. data: function data() {
  1889. return {
  1890. data: JSON.parse(JSON.stringify(this.populateWith)),
  1891. creddesc: {},
  1892. id: this.modalId,
  1893. errors: []
  1894. };
  1895. },
  1896. mounted: function mounted() {
  1897. this.creddesc = {
  1898. 'id': this.data.credtype,
  1899. 'name': this.data.creddesc
  1900. };
  1901. },
  1902. methods: {
  1903. rndStr: function rndStr(len) {
  1904. var text = "";
  1905. var chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890!@#$%";
  1906. for (var i = 0; i < len; i++) {
  1907. text += chars.charAt(Math.floor(Math.random() * chars.length));
  1908. }
  1909. return text;
  1910. },
  1911. getRandomPassword: function getRandomPassword(id) {
  1912. this.data.credpass = this.rndStr(16);
  1913. },
  1914. updateCredential: function updateCredential() {
  1915. var _this = this;
  1916. if (this.creddesc.id === "custom") {
  1917. this.data.credtype = 1;
  1918. this.data.creddesc = this.creddesc.name;
  1919. } else {
  1920. this.data.credtype = this.creddesc.id;
  1921. this.data.creddesc = this.creddesc.name;
  1922. }
  1923. if (this.create) {
  1924. if (this.pcid) {
  1925. this.data.pcid = this.pcid;
  1926. }
  1927. if (this.groupid) {
  1928. this.data.groupid = this.groupid;
  1929. }
  1930. axios.post('/api/credentials/', this.data).then(function (response) {
  1931. $('#' + _this.id).modal('hide');
  1932. });
  1933. } else {
  1934. axios.put('/api/credentials/' + this.data.credid, this.data).then(function (response) {
  1935. $('#' + _this.id).modal('hide');
  1936. })["catch"](function (error) {
  1937. console.error(error);
  1938. });
  1939. }
  1940. }
  1941. }
  1942. });
  1943. /***/ }),
  1944. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/credential-list.vue?vue&type=script&lang=js&":
  1945. /*!**************************************************************************************************************************************************************************!*\
  1946. !*** ./node_modules/babel-loader/lib??ref--4-0!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/credential-list.vue?vue&type=script&lang=js& ***!
  1947. \**************************************************************************************************************************************************************************/
  1948. /*! exports provided: default */
  1949. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1950. "use strict";
  1951. __webpack_require__.r(__webpack_exports__);
  1952. //
  1953. //
  1954. //
  1955. //
  1956. //
  1957. //
  1958. //
  1959. //
  1960. //
  1961. /* harmony default export */ __webpack_exports__["default"] = ({
  1962. props: {
  1963. credentialList: {
  1964. type: Array,
  1965. required: true
  1966. },
  1967. descriptions: {
  1968. type: Array,
  1969. required: true
  1970. },
  1971. pcid: {
  1972. type: Number
  1973. },
  1974. groupid: {
  1975. type: Number
  1976. }
  1977. },
  1978. data: function data() {
  1979. return {
  1980. credentials: this.credentialList
  1981. };
  1982. },
  1983. computed: {
  1984. creddescList: function creddescList() {
  1985. var list = {};
  1986. this.descriptions.map(function (val) {
  1987. list[val.creddescid] = val.credtitle;
  1988. });
  1989. return list;
  1990. }
  1991. },
  1992. methods: {
  1993. deleteCred: function deleteCred(index) {
  1994. this.credentials.splice(index, 1);
  1995. }
  1996. },
  1997. mounted: function mounted() {
  1998. var _this = this;
  1999. if (this.pcid) {
  2000. Echo.channel('credlist.pcid.' + this.pcid).listen('CredentialDeleted', function (e) {
  2001. var deletedCred = e.credential;
  2002. var index = _this.credentials.findIndex(function (credential) {
  2003. return credential.credid === deletedCred['credid'];
  2004. });
  2005. $('#credential' + deletedCred['credid'] + 'deleteModal').modal('hide');
  2006. _this.deleteCred(index);
  2007. }).listen('CredentialAdded', function (e) {
  2008. _this.credentials.unshift(e.credential);
  2009. });
  2010. }
  2011. if (this.groupid) {
  2012. Echo.channel('credlist.groupid.' + this.groupid).listen('CredentialDeleted', function (e) {
  2013. var deletedCred = e.credential;
  2014. var index = _this.credentials.findIndex(function (credential) {
  2015. return credential.groupid === deletedCred['groupid'];
  2016. });
  2017. $('#credential' + deletedCred['credid'] + 'deleteModal').modal('hide');
  2018. _this.deleteCred(index);
  2019. }).listen('CredentialAdded', function (e) {
  2020. _this.credentials.unshift(e.credential);
  2021. });
  2022. }
  2023. }
  2024. });
  2025. /***/ }),
  2026. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/credential.vue?vue&type=script&lang=js&":
  2027. /*!*********************************************************************************************************************************************************************!*\
  2028. !*** ./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& ***!
  2029. \*********************************************************************************************************************************************************************/
  2030. /*! exports provided: default */
  2031. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2032. "use strict";
  2033. __webpack_require__.r(__webpack_exports__);
  2034. //
  2035. //
  2036. //
  2037. //
  2038. //
  2039. //
  2040. //
  2041. //
  2042. //
  2043. //
  2044. //
  2045. //
  2046. //
  2047. //
  2048. //
  2049. //
  2050. //
  2051. //
  2052. //
  2053. //
  2054. //
  2055. //
  2056. //
  2057. //
  2058. //
  2059. //
  2060. //
  2061. //
  2062. //
  2063. //
  2064. //
  2065. //
  2066. //
  2067. //
  2068. //
  2069. //
  2070. //
  2071. //
  2072. //
  2073. //
  2074. //
  2075. //
  2076. //
  2077. /* harmony default export */ __webpack_exports__["default"] = ({
  2078. props: ['credential', 'descriptions'],
  2079. data: function data() {
  2080. return {
  2081. data: this.credential,
  2082. creddescList: this.descriptions
  2083. };
  2084. },
  2085. mounted: function mounted() {
  2086. var _this = this;
  2087. Echo.channel('credential.' + this.data.credid).listen('CredentialUpdated', function (e) {
  2088. _this.data = e.credential;
  2089. });
  2090. },
  2091. methods: {
  2092. deleteCredential: function deleteCredential() {
  2093. var _this2 = this;
  2094. axios["delete"]('/api/credentials/' + this.data.credid, this.data).then(function (response) {
  2095. $('#credential' + _this2.data.credid + 'deleteModal').modal('hide');
  2096. })["catch"](function (error) {
  2097. console.error(error);
  2098. });
  2099. }
  2100. }
  2101. });
  2102. /***/ }),
  2103. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/errorlist.vue?vue&type=script&lang=js&":
  2104. /*!********************************************************************************************************************************************************************!*\
  2105. !*** ./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& ***!
  2106. \********************************************************************************************************************************************************************/
  2107. /*! exports provided: default */
  2108. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2109. "use strict";
  2110. __webpack_require__.r(__webpack_exports__);
  2111. //
  2112. //
  2113. //
  2114. //
  2115. //
  2116. /* harmony default export */ __webpack_exports__["default"] = ({
  2117. props: ['errors'],
  2118. data: function data() {
  2119. return {
  2120. errorList: this.errors
  2121. };
  2122. },
  2123. watch: {
  2124. errors: function errors(newErrors) {
  2125. this.errorList = newErrors;
  2126. }
  2127. }
  2128. });
  2129. /***/ }),
  2130. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/note-form-modal.vue?vue&type=script&lang=js&":
  2131. /*!**************************************************************************************************************************************************************************!*\
  2132. !*** ./node_modules/babel-loader/lib??ref--4-0!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/note-form-modal.vue?vue&type=script&lang=js& ***!
  2133. \**************************************************************************************************************************************************************************/
  2134. /*! exports provided: default */
  2135. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2136. "use strict";
  2137. __webpack_require__.r(__webpack_exports__);
  2138. //
  2139. //
  2140. //
  2141. //
  2142. //
  2143. //
  2144. //
  2145. //
  2146. //
  2147. //
  2148. //
  2149. //
  2150. //
  2151. //
  2152. //
  2153. //
  2154. //
  2155. /* harmony default export */ __webpack_exports__["default"] = ({
  2156. props: {
  2157. populateWith: {
  2158. type: Object,
  2159. require: true
  2160. },
  2161. modalId: {
  2162. type: String,
  2163. require: true
  2164. },
  2165. noteType: {
  2166. type: Number
  2167. },
  2168. noteUser: {
  2169. type: String
  2170. },
  2171. woid: {
  2172. type: Number
  2173. }
  2174. },
  2175. data: function data() {
  2176. return {
  2177. note: JSON.parse(JSON.stringify(this.populateWith))
  2178. };
  2179. },
  2180. methods: {
  2181. updateNote: function updateNote(note) {
  2182. axios.put('/api/workorders/notes/' + note.noteid, note).then(function (response) {
  2183. hideModal();
  2184. });
  2185. },
  2186. hideModal: function hideModal() {
  2187. $('#' + this.modalId).modal('hide');
  2188. }
  2189. }
  2190. });
  2191. /***/ }),
  2192. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/notes.vue?vue&type=script&lang=js&":
  2193. /*!****************************************************************************************************************************************************************!*\
  2194. !*** ./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& ***!
  2195. \****************************************************************************************************************************************************************/
  2196. /*! exports provided: default */
  2197. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2198. "use strict";
  2199. __webpack_require__.r(__webpack_exports__);
  2200. /* harmony import */ var _mixins_dateMixin__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../mixins/dateMixin */ "./resources/js/mixins/dateMixin.js");
  2201. //
  2202. //
  2203. //
  2204. //
  2205. //
  2206. //
  2207. //
  2208. //
  2209. //
  2210. //
  2211. //
  2212. //
  2213. //
  2214. //
  2215. //
  2216. //
  2217. //
  2218. //
  2219. //
  2220. //
  2221. //
  2222. //
  2223. //
  2224. //
  2225. //
  2226. //
  2227. //
  2228. //
  2229. //
  2230. //
  2231. //
  2232. //
  2233. //
  2234. //
  2235. //
  2236. //
  2237. //
  2238. //
  2239. /* harmony default export */ __webpack_exports__["default"] = ({
  2240. mixins: [_mixins_dateMixin__WEBPACK_IMPORTED_MODULE_0__["default"]],
  2241. props: ['initialnotes', 'authusername', 'noteType', 'woid'],
  2242. data: function data() {
  2243. return {
  2244. notes: Object.values(this.initialnotes),
  2245. currentOrder: 'order-first',
  2246. newNote: {
  2247. notetype: this.noteType,
  2248. thenote: '',
  2249. noteuser: this.authusername,
  2250. woid: this.woid
  2251. }
  2252. };
  2253. },
  2254. mounted: function mounted() {
  2255. var _this = this;
  2256. Echo.channel('wonotes.' + this.noteType + '.' + this.woid).listen('WorkOrderNoteAdded', function (e) {
  2257. _this.notes.push(e.note);
  2258. }).listen('WorkOrderNoteEdited', function (e) {
  2259. var index = _this.notes.findIndex(function (note) {
  2260. return note.noteid === e.note.noteid;
  2261. });
  2262. _this.notes[index] = e.note;
  2263. }).listen('WorkOrderNoteDeleted', function (e) {
  2264. var index = _this.notes.findIndex(function (note) {
  2265. return note.noteid === e.noteid;
  2266. });
  2267. _this.notes.splice(index, 1);
  2268. });
  2269. },
  2270. methods: {
  2271. createNote: function createNote() {
  2272. var _this2 = this;
  2273. axios.post('/api/workorders/notes', this.newNote).then(function (response) {
  2274. $('#note' + _this2.noteType + 'add').collapse('hide');
  2275. _this2.newNote.thenote = '';
  2276. });
  2277. }
  2278. }
  2279. });
  2280. /***/ }),
  2281. /***/ "./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&":
  2282. /*!****************************************************************************************************************************************************************************!*\
  2283. !*** ./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& ***!
  2284. \****************************************************************************************************************************************************************************/
  2285. /*! exports provided: default */
  2286. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2287. "use strict";
  2288. __webpack_require__.r(__webpack_exports__);
  2289. //
  2290. //
  2291. //
  2292. //
  2293. //
  2294. //
  2295. //
  2296. //
  2297. //
  2298. //
  2299. //
  2300. //
  2301. //
  2302. //
  2303. //
  2304. //
  2305. //
  2306. //
  2307. //
  2308. //
  2309. //
  2310. //
  2311. //
  2312. //
  2313. //
  2314. //
  2315. //
  2316. //
  2317. //
  2318. //
  2319. //
  2320. //
  2321. //
  2322. /* harmony default export */ __webpack_exports__["default"] = ({
  2323. props: ['populateWith', 'storeList', 'modalId'],
  2324. data: function data() {
  2325. return {
  2326. // Copies object from prop, so it doesn't mutate the object
  2327. // from the parent component. Parent component will be updated via
  2328. // Websocket if updateWorkOrder is successful.
  2329. data: JSON.parse(JSON.stringify(this.populateWith)),
  2330. id: this.modalId,
  2331. store: {},
  2332. errors: []
  2333. };
  2334. },
  2335. mounted: function mounted() {
  2336. this.store = {
  2337. 'id': this.data.storeid,
  2338. 'name': this.storeList[this.data.storeid]
  2339. };
  2340. },
  2341. methods: {
  2342. updateWorkOrder: function updateWorkOrder() {
  2343. var _this = this;
  2344. this.data.storeid = this.store.id;
  2345. axios.put('/api/workorders/' + this.data.woid, this.data).then(function (response) {
  2346. $('#workordereditModal').modal('hide');
  2347. })["catch"](function (error) {
  2348. _this.errors = JSON.parse(error.response.request.response).errors;
  2349. });
  2350. }
  2351. }
  2352. });
  2353. /***/ }),
  2354. /***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/woinfo.vue?vue&type=script&lang=js&":
  2355. /*!*****************************************************************************************************************************************************************!*\
  2356. !*** ./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& ***!
  2357. \*****************************************************************************************************************************************************************/
  2358. /*! exports provided: default */
  2359. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2360. "use strict";
  2361. __webpack_require__.r(__webpack_exports__);
  2362. /* harmony import */ var _mixins_dateMixin__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../mixins/dateMixin */ "./resources/js/mixins/dateMixin.js");
  2363. //
  2364. //
  2365. //
  2366. //
  2367. //
  2368. //
  2369. //
  2370. //
  2371. //
  2372. //
  2373. //
  2374. //
  2375. //
  2376. //
  2377. //
  2378. //
  2379. //
  2380. //
  2381. //
  2382. //
  2383. /* harmony default export */ __webpack_exports__["default"] = ({
  2384. mixins: [_mixins_dateMixin__WEBPACK_IMPORTED_MODULE_0__["default"]],
  2385. props: ['workOrder', 'stores'],
  2386. data: function data() {
  2387. return {
  2388. data: JSON.parse(this.workOrder)
  2389. };
  2390. },
  2391. computed: {
  2392. storeList: function storeList() {
  2393. var list = {};
  2394. JSON.parse(this.stores).map(function (val) {
  2395. list[val.storeid] = val.storesname;
  2396. });
  2397. return list;
  2398. }
  2399. },
  2400. mounted: function mounted() {
  2401. var _this = this;
  2402. Echo.channel('work-order.' + this.data.woid).listen('WorkOrderUpdated', function (e) {
  2403. _this.data = e.data;
  2404. });
  2405. }
  2406. });
  2407. /***/ }),
  2408. /***/ "./node_modules/base64-js/index.js":
  2409. /*!*****************************************!*\
  2410. !*** ./node_modules/base64-js/index.js ***!
  2411. \*****************************************/
  2412. /*! no static exports found */
  2413. /***/ (function(module, exports, __webpack_require__) {
  2414. "use strict";
  2415. exports.byteLength = byteLength
  2416. exports.toByteArray = toByteArray
  2417. exports.fromByteArray = fromByteArray
  2418. var lookup = []
  2419. var revLookup = []
  2420. var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array
  2421. var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
  2422. for (var i = 0, len = code.length; i < len; ++i) {
  2423. lookup[i] = code[i]
  2424. revLookup[code.charCodeAt(i)] = i
  2425. }
  2426. // Support decoding URL-safe base64 strings, as Node.js does.
  2427. // See: https://en.wikipedia.org/wiki/Base64#URL_applications
  2428. revLookup['-'.charCodeAt(0)] = 62
  2429. revLookup['_'.charCodeAt(0)] = 63
  2430. function getLens (b64) {
  2431. var len = b64.length
  2432. if (len % 4 > 0) {
  2433. throw new Error('Invalid string. Length must be a multiple of 4')
  2434. }
  2435. // Trim off extra bytes after placeholder bytes are found
  2436. // See: https://github.com/beatgammit/base64-js/issues/42
  2437. var validLen = b64.indexOf('=')
  2438. if (validLen === -1) validLen = len
  2439. var placeHoldersLen = validLen === len
  2440. ? 0
  2441. : 4 - (validLen % 4)
  2442. return [validLen, placeHoldersLen]
  2443. }
  2444. // base64 is 4/3 + up to two characters of the original data
  2445. function byteLength (b64) {
  2446. var lens = getLens(b64)
  2447. var validLen = lens[0]
  2448. var placeHoldersLen = lens[1]
  2449. return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
  2450. }
  2451. function _byteLength (b64, validLen, placeHoldersLen) {
  2452. return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
  2453. }
  2454. function toByteArray (b64) {
  2455. var tmp
  2456. var lens = getLens(b64)
  2457. var validLen = lens[0]
  2458. var placeHoldersLen = lens[1]
  2459. var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen))
  2460. var curByte = 0
  2461. // if there are placeholders, only get up to the last complete 4 chars
  2462. var len = placeHoldersLen > 0
  2463. ? validLen - 4
  2464. : validLen
  2465. var i
  2466. for (i = 0; i < len; i += 4) {
  2467. tmp =
  2468. (revLookup[b64.charCodeAt(i)] << 18) |
  2469. (revLookup[b64.charCodeAt(i + 1)] << 12) |
  2470. (revLookup[b64.charCodeAt(i + 2)] << 6) |
  2471. revLookup[b64.charCodeAt(i + 3)]
  2472. arr[curByte++] = (tmp >> 16) & 0xFF
  2473. arr[curByte++] = (tmp >> 8) & 0xFF
  2474. arr[curByte++] = tmp & 0xFF
  2475. }
  2476. if (placeHoldersLen === 2) {
  2477. tmp =
  2478. (revLookup[b64.charCodeAt(i)] << 2) |
  2479. (revLookup[b64.charCodeAt(i + 1)] >> 4)
  2480. arr[curByte++] = tmp & 0xFF
  2481. }
  2482. if (placeHoldersLen === 1) {
  2483. tmp =
  2484. (revLookup[b64.charCodeAt(i)] << 10) |
  2485. (revLookup[b64.charCodeAt(i + 1)] << 4) |
  2486. (revLookup[b64.charCodeAt(i + 2)] >> 2)
  2487. arr[curByte++] = (tmp >> 8) & 0xFF
  2488. arr[curByte++] = tmp & 0xFF
  2489. }
  2490. return arr
  2491. }
  2492. function tripletToBase64 (num) {
  2493. return lookup[num >> 18 & 0x3F] +
  2494. lookup[num >> 12 & 0x3F] +
  2495. lookup[num >> 6 & 0x3F] +
  2496. lookup[num & 0x3F]
  2497. }
  2498. function encodeChunk (uint8, start, end) {
  2499. var tmp
  2500. var output = []
  2501. for (var i = start; i < end; i += 3) {
  2502. tmp =
  2503. ((uint8[i] << 16) & 0xFF0000) +
  2504. ((uint8[i + 1] << 8) & 0xFF00) +
  2505. (uint8[i + 2] & 0xFF)
  2506. output.push(tripletToBase64(tmp))
  2507. }
  2508. return output.join('')
  2509. }
  2510. function fromByteArray (uint8) {
  2511. var tmp
  2512. var len = uint8.length
  2513. var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes
  2514. var parts = []
  2515. var maxChunkLength = 16383 // must be multiple of 3
  2516. // go through the array every three bytes, we'll deal with trailing stuff later
  2517. for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {
  2518. parts.push(encodeChunk(
  2519. uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)
  2520. ))
  2521. }
  2522. // pad the end with zeros, but make sure to not forget the extra bytes
  2523. if (extraBytes === 1) {
  2524. tmp = uint8[len - 1]
  2525. parts.push(
  2526. lookup[tmp >> 2] +
  2527. lookup[(tmp << 4) & 0x3F] +
  2528. '=='
  2529. )
  2530. } else if (extraBytes === 2) {
  2531. tmp = (uint8[len - 2] << 8) + uint8[len - 1]
  2532. parts.push(
  2533. lookup[tmp >> 10] +
  2534. lookup[(tmp >> 4) & 0x3F] +
  2535. lookup[(tmp << 2) & 0x3F] +
  2536. '='
  2537. )
  2538. }
  2539. return parts.join('')
  2540. }
  2541. /***/ }),
  2542. /***/ "./node_modules/bootstrap/dist/js/bootstrap.js":
  2543. /*!*****************************************************!*\
  2544. !*** ./node_modules/bootstrap/dist/js/bootstrap.js ***!
  2545. \*****************************************************/
  2546. /*! no static exports found */
  2547. /***/ (function(module, exports, __webpack_require__) {
  2548. /*!
  2549. * Bootstrap v4.4.1 (https://getbootstrap.com/)
  2550. * Copyright 2011-2019 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
  2551. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  2552. */
  2553. (function (global, factory) {
  2554. true ? factory(exports, __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js"), __webpack_require__(/*! popper.js */ "./node_modules/popper.js/dist/esm/popper.js")) :
  2555. undefined;
  2556. }(this, (function (exports, $, Popper) { 'use strict';
  2557. $ = $ && $.hasOwnProperty('default') ? $['default'] : $;
  2558. Popper = Popper && Popper.hasOwnProperty('default') ? Popper['default'] : Popper;
  2559. function _defineProperties(target, props) {
  2560. for (var i = 0; i < props.length; i++) {
  2561. var descriptor = props[i];
  2562. descriptor.enumerable = descriptor.enumerable || false;
  2563. descriptor.configurable = true;
  2564. if ("value" in descriptor) descriptor.writable = true;
  2565. Object.defineProperty(target, descriptor.key, descriptor);
  2566. }
  2567. }
  2568. function _createClass(Constructor, protoProps, staticProps) {
  2569. if (protoProps) _defineProperties(Constructor.prototype, protoProps);
  2570. if (staticProps) _defineProperties(Constructor, staticProps);
  2571. return Constructor;
  2572. }
  2573. function _defineProperty(obj, key, value) {
  2574. if (key in obj) {
  2575. Object.defineProperty(obj, key, {
  2576. value: value,
  2577. enumerable: true,
  2578. configurable: true,
  2579. writable: true
  2580. });
  2581. } else {
  2582. obj[key] = value;
  2583. }
  2584. return obj;
  2585. }
  2586. function ownKeys(object, enumerableOnly) {
  2587. var keys = Object.keys(object);
  2588. if (Object.getOwnPropertySymbols) {
  2589. var symbols = Object.getOwnPropertySymbols(object);
  2590. if (enumerableOnly) symbols = symbols.filter(function (sym) {
  2591. return Object.getOwnPropertyDescriptor(object, sym).enumerable;
  2592. });
  2593. keys.push.apply(keys, symbols);
  2594. }
  2595. return keys;
  2596. }
  2597. function _objectSpread2(target) {
  2598. for (var i = 1; i < arguments.length; i++) {
  2599. var source = arguments[i] != null ? arguments[i] : {};
  2600. if (i % 2) {
  2601. ownKeys(Object(source), true).forEach(function (key) {
  2602. _defineProperty(target, key, source[key]);
  2603. });
  2604. } else if (Object.getOwnPropertyDescriptors) {
  2605. Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
  2606. } else {
  2607. ownKeys(Object(source)).forEach(function (key) {
  2608. Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
  2609. });
  2610. }
  2611. }
  2612. return target;
  2613. }
  2614. function _inheritsLoose(subClass, superClass) {
  2615. subClass.prototype = Object.create(superClass.prototype);
  2616. subClass.prototype.constructor = subClass;
  2617. subClass.__proto__ = superClass;
  2618. }
  2619. /**
  2620. * --------------------------------------------------------------------------
  2621. * Bootstrap (v4.4.1): util.js
  2622. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  2623. * --------------------------------------------------------------------------
  2624. */
  2625. /**
  2626. * ------------------------------------------------------------------------
  2627. * Private TransitionEnd Helpers
  2628. * ------------------------------------------------------------------------
  2629. */
  2630. var TRANSITION_END = 'transitionend';
  2631. var MAX_UID = 1000000;
  2632. var MILLISECONDS_MULTIPLIER = 1000; // Shoutout AngusCroll (https://goo.gl/pxwQGp)
  2633. function toType(obj) {
  2634. return {}.toString.call(obj).match(/\s([a-z]+)/i)[1].toLowerCase();
  2635. }
  2636. function getSpecialTransitionEndEvent() {
  2637. return {
  2638. bindType: TRANSITION_END,
  2639. delegateType: TRANSITION_END,
  2640. handle: function handle(event) {
  2641. if ($(event.target).is(this)) {
  2642. return event.handleObj.handler.apply(this, arguments); // eslint-disable-line prefer-rest-params
  2643. }
  2644. return undefined; // eslint-disable-line no-undefined
  2645. }
  2646. };
  2647. }
  2648. function transitionEndEmulator(duration) {
  2649. var _this = this;
  2650. var called = false;
  2651. $(this).one(Util.TRANSITION_END, function () {
  2652. called = true;
  2653. });
  2654. setTimeout(function () {
  2655. if (!called) {
  2656. Util.triggerTransitionEnd(_this);
  2657. }
  2658. }, duration);
  2659. return this;
  2660. }
  2661. function setTransitionEndSupport() {
  2662. $.fn.emulateTransitionEnd = transitionEndEmulator;
  2663. $.event.special[Util.TRANSITION_END] = getSpecialTransitionEndEvent();
  2664. }
  2665. /**
  2666. * --------------------------------------------------------------------------
  2667. * Public Util Api
  2668. * --------------------------------------------------------------------------
  2669. */
  2670. var Util = {
  2671. TRANSITION_END: 'bsTransitionEnd',
  2672. getUID: function getUID(prefix) {
  2673. do {
  2674. // eslint-disable-next-line no-bitwise
  2675. prefix += ~~(Math.random() * MAX_UID); // "~~" acts like a faster Math.floor() here
  2676. } while (document.getElementById(prefix));
  2677. return prefix;
  2678. },
  2679. getSelectorFromElement: function getSelectorFromElement(element) {
  2680. var selector = element.getAttribute('data-target');
  2681. if (!selector || selector === '#') {
  2682. var hrefAttr = element.getAttribute('href');
  2683. selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : '';
  2684. }
  2685. try {
  2686. return document.querySelector(selector) ? selector : null;
  2687. } catch (err) {
  2688. return null;
  2689. }
  2690. },
  2691. getTransitionDurationFromElement: function getTransitionDurationFromElement(element) {
  2692. if (!element) {
  2693. return 0;
  2694. } // Get transition-duration of the element
  2695. var transitionDuration = $(element).css('transition-duration');
  2696. var transitionDelay = $(element).css('transition-delay');
  2697. var floatTransitionDuration = parseFloat(transitionDuration);
  2698. var floatTransitionDelay = parseFloat(transitionDelay); // Return 0 if element or transition duration is not found
  2699. if (!floatTransitionDuration && !floatTransitionDelay) {
  2700. return 0;
  2701. } // If multiple durations are defined, take the first
  2702. transitionDuration = transitionDuration.split(',')[0];
  2703. transitionDelay = transitionDelay.split(',')[0];
  2704. return (parseFloat(transitionDuration) + parseFloat(transitionDelay)) * MILLISECONDS_MULTIPLIER;
  2705. },
  2706. reflow: function reflow(element) {
  2707. return element.offsetHeight;
  2708. },
  2709. triggerTransitionEnd: function triggerTransitionEnd(element) {
  2710. $(element).trigger(TRANSITION_END);
  2711. },
  2712. // TODO: Remove in v5
  2713. supportsTransitionEnd: function supportsTransitionEnd() {
  2714. return Boolean(TRANSITION_END);
  2715. },
  2716. isElement: function isElement(obj) {
  2717. return (obj[0] || obj).nodeType;
  2718. },
  2719. typeCheckConfig: function typeCheckConfig(componentName, config, configTypes) {
  2720. for (var property in configTypes) {
  2721. if (Object.prototype.hasOwnProperty.call(configTypes, property)) {
  2722. var expectedTypes = configTypes[property];
  2723. var value = config[property];
  2724. var valueType = value && Util.isElement(value) ? 'element' : toType(value);
  2725. if (!new RegExp(expectedTypes).test(valueType)) {
  2726. throw new Error(componentName.toUpperCase() + ": " + ("Option \"" + property + "\" provided type \"" + valueType + "\" ") + ("but expected type \"" + expectedTypes + "\"."));
  2727. }
  2728. }
  2729. }
  2730. },
  2731. findShadowRoot: function findShadowRoot(element) {
  2732. if (!document.documentElement.attachShadow) {
  2733. return null;
  2734. } // Can find the shadow root otherwise it'll return the document
  2735. if (typeof element.getRootNode === 'function') {
  2736. var root = element.getRootNode();
  2737. return root instanceof ShadowRoot ? root : null;
  2738. }
  2739. if (element instanceof ShadowRoot) {
  2740. return element;
  2741. } // when we don't find a shadow root
  2742. if (!element.parentNode) {
  2743. return null;
  2744. }
  2745. return Util.findShadowRoot(element.parentNode);
  2746. },
  2747. jQueryDetection: function jQueryDetection() {
  2748. if (typeof $ === 'undefined') {
  2749. throw new TypeError('Bootstrap\'s JavaScript requires jQuery. jQuery must be included before Bootstrap\'s JavaScript.');
  2750. }
  2751. var version = $.fn.jquery.split(' ')[0].split('.');
  2752. var minMajor = 1;
  2753. var ltMajor = 2;
  2754. var minMinor = 9;
  2755. var minPatch = 1;
  2756. var maxMajor = 4;
  2757. if (version[0] < ltMajor && version[1] < minMinor || version[0] === minMajor && version[1] === minMinor && version[2] < minPatch || version[0] >= maxMajor) {
  2758. throw new Error('Bootstrap\'s JavaScript requires at least jQuery v1.9.1 but less than v4.0.0');
  2759. }
  2760. }
  2761. };
  2762. Util.jQueryDetection();
  2763. setTransitionEndSupport();
  2764. /**
  2765. * ------------------------------------------------------------------------
  2766. * Constants
  2767. * ------------------------------------------------------------------------
  2768. */
  2769. var NAME = 'alert';
  2770. var VERSION = '4.4.1';
  2771. var DATA_KEY = 'bs.alert';
  2772. var EVENT_KEY = "." + DATA_KEY;
  2773. var DATA_API_KEY = '.data-api';
  2774. var JQUERY_NO_CONFLICT = $.fn[NAME];
  2775. var Selector = {
  2776. DISMISS: '[data-dismiss="alert"]'
  2777. };
  2778. var Event = {
  2779. CLOSE: "close" + EVENT_KEY,
  2780. CLOSED: "closed" + EVENT_KEY,
  2781. CLICK_DATA_API: "click" + EVENT_KEY + DATA_API_KEY
  2782. };
  2783. var ClassName = {
  2784. ALERT: 'alert',
  2785. FADE: 'fade',
  2786. SHOW: 'show'
  2787. };
  2788. /**
  2789. * ------------------------------------------------------------------------
  2790. * Class Definition
  2791. * ------------------------------------------------------------------------
  2792. */
  2793. var Alert =
  2794. /*#__PURE__*/
  2795. function () {
  2796. function Alert(element) {
  2797. this._element = element;
  2798. } // Getters
  2799. var _proto = Alert.prototype;
  2800. // Public
  2801. _proto.close = function close(element) {
  2802. var rootElement = this._element;
  2803. if (element) {
  2804. rootElement = this._getRootElement(element);
  2805. }
  2806. var customEvent = this._triggerCloseEvent(rootElement);
  2807. if (customEvent.isDefaultPrevented()) {
  2808. return;
  2809. }
  2810. this._removeElement(rootElement);
  2811. };
  2812. _proto.dispose = function dispose() {
  2813. $.removeData(this._element, DATA_KEY);
  2814. this._element = null;
  2815. } // Private
  2816. ;
  2817. _proto._getRootElement = function _getRootElement(element) {
  2818. var selector = Util.getSelectorFromElement(element);
  2819. var parent = false;
  2820. if (selector) {
  2821. parent = document.querySelector(selector);
  2822. }
  2823. if (!parent) {
  2824. parent = $(element).closest("." + ClassName.ALERT)[0];
  2825. }
  2826. return parent;
  2827. };
  2828. _proto._triggerCloseEvent = function _triggerCloseEvent(element) {
  2829. var closeEvent = $.Event(Event.CLOSE);
  2830. $(element).trigger(closeEvent);
  2831. return closeEvent;
  2832. };
  2833. _proto._removeElement = function _removeElement(element) {
  2834. var _this = this;
  2835. $(element).removeClass(ClassName.SHOW);
  2836. if (!$(element).hasClass(ClassName.FADE)) {
  2837. this._destroyElement(element);
  2838. return;
  2839. }
  2840. var transitionDuration = Util.getTransitionDurationFromElement(element);
  2841. $(element).one(Util.TRANSITION_END, function (event) {
  2842. return _this._destroyElement(element, event);
  2843. }).emulateTransitionEnd(transitionDuration);
  2844. };
  2845. _proto._destroyElement = function _destroyElement(element) {
  2846. $(element).detach().trigger(Event.CLOSED).remove();
  2847. } // Static
  2848. ;
  2849. Alert._jQueryInterface = function _jQueryInterface(config) {
  2850. return this.each(function () {
  2851. var $element = $(this);
  2852. var data = $element.data(DATA_KEY);
  2853. if (!data) {
  2854. data = new Alert(this);
  2855. $element.data(DATA_KEY, data);
  2856. }
  2857. if (config === 'close') {
  2858. data[config](this);
  2859. }
  2860. });
  2861. };
  2862. Alert._handleDismiss = function _handleDismiss(alertInstance) {
  2863. return function (event) {
  2864. if (event) {
  2865. event.preventDefault();
  2866. }
  2867. alertInstance.close(this);
  2868. };
  2869. };
  2870. _createClass(Alert, null, [{
  2871. key: "VERSION",
  2872. get: function get() {
  2873. return VERSION;
  2874. }
  2875. }]);
  2876. return Alert;
  2877. }();
  2878. /**
  2879. * ------------------------------------------------------------------------
  2880. * Data Api implementation
  2881. * ------------------------------------------------------------------------
  2882. */
  2883. $(document).on(Event.CLICK_DATA_API, Selector.DISMISS, Alert._handleDismiss(new Alert()));
  2884. /**
  2885. * ------------------------------------------------------------------------
  2886. * jQuery
  2887. * ------------------------------------------------------------------------
  2888. */
  2889. $.fn[NAME] = Alert._jQueryInterface;
  2890. $.fn[NAME].Constructor = Alert;
  2891. $.fn[NAME].noConflict = function () {
  2892. $.fn[NAME] = JQUERY_NO_CONFLICT;
  2893. return Alert._jQueryInterface;
  2894. };
  2895. /**
  2896. * ------------------------------------------------------------------------
  2897. * Constants
  2898. * ------------------------------------------------------------------------
  2899. */
  2900. var NAME$1 = 'button';
  2901. var VERSION$1 = '4.4.1';
  2902. var DATA_KEY$1 = 'bs.button';
  2903. var EVENT_KEY$1 = "." + DATA_KEY$1;
  2904. var DATA_API_KEY$1 = '.data-api';
  2905. var JQUERY_NO_CONFLICT$1 = $.fn[NAME$1];
  2906. var ClassName$1 = {
  2907. ACTIVE: 'active',
  2908. BUTTON: 'btn',
  2909. FOCUS: 'focus'
  2910. };
  2911. var Selector$1 = {
  2912. DATA_TOGGLE_CARROT: '[data-toggle^="button"]',
  2913. DATA_TOGGLES: '[data-toggle="buttons"]',
  2914. DATA_TOGGLE: '[data-toggle="button"]',
  2915. DATA_TOGGLES_BUTTONS: '[data-toggle="buttons"] .btn',
  2916. INPUT: 'input:not([type="hidden"])',
  2917. ACTIVE: '.active',
  2918. BUTTON: '.btn'
  2919. };
  2920. var Event$1 = {
  2921. CLICK_DATA_API: "click" + EVENT_KEY$1 + DATA_API_KEY$1,
  2922. FOCUS_BLUR_DATA_API: "focus" + EVENT_KEY$1 + DATA_API_KEY$1 + " " + ("blur" + EVENT_KEY$1 + DATA_API_KEY$1),
  2923. LOAD_DATA_API: "load" + EVENT_KEY$1 + DATA_API_KEY$1
  2924. };
  2925. /**
  2926. * ------------------------------------------------------------------------
  2927. * Class Definition
  2928. * ------------------------------------------------------------------------
  2929. */
  2930. var Button =
  2931. /*#__PURE__*/
  2932. function () {
  2933. function Button(element) {
  2934. this._element = element;
  2935. } // Getters
  2936. var _proto = Button.prototype;
  2937. // Public
  2938. _proto.toggle = function toggle() {
  2939. var triggerChangeEvent = true;
  2940. var addAriaPressed = true;
  2941. var rootElement = $(this._element).closest(Selector$1.DATA_TOGGLES)[0];
  2942. if (rootElement) {
  2943. var input = this._element.querySelector(Selector$1.INPUT);
  2944. if (input) {
  2945. if (input.type === 'radio') {
  2946. if (input.checked && this._element.classList.contains(ClassName$1.ACTIVE)) {
  2947. triggerChangeEvent = false;
  2948. } else {
  2949. var activeElement = rootElement.querySelector(Selector$1.ACTIVE);
  2950. if (activeElement) {
  2951. $(activeElement).removeClass(ClassName$1.ACTIVE);
  2952. }
  2953. }
  2954. } else if (input.type === 'checkbox') {
  2955. if (this._element.tagName === 'LABEL' && input.checked === this._element.classList.contains(ClassName$1.ACTIVE)) {
  2956. triggerChangeEvent = false;
  2957. }
  2958. } else {
  2959. // if it's not a radio button or checkbox don't add a pointless/invalid checked property to the input
  2960. triggerChangeEvent = false;
  2961. }
  2962. if (triggerChangeEvent) {
  2963. input.checked = !this._element.classList.contains(ClassName$1.ACTIVE);
  2964. $(input).trigger('change');
  2965. }
  2966. input.focus();
  2967. addAriaPressed = false;
  2968. }
  2969. }
  2970. if (!(this._element.hasAttribute('disabled') || this._element.classList.contains('disabled'))) {
  2971. if (addAriaPressed) {
  2972. this._element.setAttribute('aria-pressed', !this._element.classList.contains(ClassName$1.ACTIVE));
  2973. }
  2974. if (triggerChangeEvent) {
  2975. $(this._element).toggleClass(ClassName$1.ACTIVE);
  2976. }
  2977. }
  2978. };
  2979. _proto.dispose = function dispose() {
  2980. $.removeData(this._element, DATA_KEY$1);
  2981. this._element = null;
  2982. } // Static
  2983. ;
  2984. Button._jQueryInterface = function _jQueryInterface(config) {
  2985. return this.each(function () {
  2986. var data = $(this).data(DATA_KEY$1);
  2987. if (!data) {
  2988. data = new Button(this);
  2989. $(this).data(DATA_KEY$1, data);
  2990. }
  2991. if (config === 'toggle') {
  2992. data[config]();
  2993. }
  2994. });
  2995. };
  2996. _createClass(Button, null, [{
  2997. key: "VERSION",
  2998. get: function get() {
  2999. return VERSION$1;
  3000. }
  3001. }]);
  3002. return Button;
  3003. }();
  3004. /**
  3005. * ------------------------------------------------------------------------
  3006. * Data Api implementation
  3007. * ------------------------------------------------------------------------
  3008. */
  3009. $(document).on(Event$1.CLICK_DATA_API, Selector$1.DATA_TOGGLE_CARROT, function (event) {
  3010. var button = event.target;
  3011. if (!$(button).hasClass(ClassName$1.BUTTON)) {
  3012. button = $(button).closest(Selector$1.BUTTON)[0];
  3013. }
  3014. if (!button || button.hasAttribute('disabled') || button.classList.contains('disabled')) {
  3015. event.preventDefault(); // work around Firefox bug #1540995
  3016. } else {
  3017. var inputBtn = button.querySelector(Selector$1.INPUT);
  3018. if (inputBtn && (inputBtn.hasAttribute('disabled') || inputBtn.classList.contains('disabled'))) {
  3019. event.preventDefault(); // work around Firefox bug #1540995
  3020. return;
  3021. }
  3022. Button._jQueryInterface.call($(button), 'toggle');
  3023. }
  3024. }).on(Event$1.FOCUS_BLUR_DATA_API, Selector$1.DATA_TOGGLE_CARROT, function (event) {
  3025. var button = $(event.target).closest(Selector$1.BUTTON)[0];
  3026. $(button).toggleClass(ClassName$1.FOCUS, /^focus(in)?$/.test(event.type));
  3027. });
  3028. $(window).on(Event$1.LOAD_DATA_API, function () {
  3029. // ensure correct active class is set to match the controls' actual values/states
  3030. // find all checkboxes/readio buttons inside data-toggle groups
  3031. var buttons = [].slice.call(document.querySelectorAll(Selector$1.DATA_TOGGLES_BUTTONS));
  3032. for (var i = 0, len = buttons.length; i < len; i++) {
  3033. var button = buttons[i];
  3034. var input = button.querySelector(Selector$1.INPUT);
  3035. if (input.checked || input.hasAttribute('checked')) {
  3036. button.classList.add(ClassName$1.ACTIVE);
  3037. } else {
  3038. button.classList.remove(ClassName$1.ACTIVE);
  3039. }
  3040. } // find all button toggles
  3041. buttons = [].slice.call(document.querySelectorAll(Selector$1.DATA_TOGGLE));
  3042. for (var _i = 0, _len = buttons.length; _i < _len; _i++) {
  3043. var _button = buttons[_i];
  3044. if (_button.getAttribute('aria-pressed') === 'true') {
  3045. _button.classList.add(ClassName$1.ACTIVE);
  3046. } else {
  3047. _button.classList.remove(ClassName$1.ACTIVE);
  3048. }
  3049. }
  3050. });
  3051. /**
  3052. * ------------------------------------------------------------------------
  3053. * jQuery
  3054. * ------------------------------------------------------------------------
  3055. */
  3056. $.fn[NAME$1] = Button._jQueryInterface;
  3057. $.fn[NAME$1].Constructor = Button;
  3058. $.fn[NAME$1].noConflict = function () {
  3059. $.fn[NAME$1] = JQUERY_NO_CONFLICT$1;
  3060. return Button._jQueryInterface;
  3061. };
  3062. /**
  3063. * ------------------------------------------------------------------------
  3064. * Constants
  3065. * ------------------------------------------------------------------------
  3066. */
  3067. var NAME$2 = 'carousel';
  3068. var VERSION$2 = '4.4.1';
  3069. var DATA_KEY$2 = 'bs.carousel';
  3070. var EVENT_KEY$2 = "." + DATA_KEY$2;
  3071. var DATA_API_KEY$2 = '.data-api';
  3072. var JQUERY_NO_CONFLICT$2 = $.fn[NAME$2];
  3073. var ARROW_LEFT_KEYCODE = 37; // KeyboardEvent.which value for left arrow key
  3074. var ARROW_RIGHT_KEYCODE = 39; // KeyboardEvent.which value for right arrow key
  3075. var TOUCHEVENT_COMPAT_WAIT = 500; // Time for mouse compat events to fire after touch
  3076. var SWIPE_THRESHOLD = 40;
  3077. var Default = {
  3078. interval: 5000,
  3079. keyboard: true,
  3080. slide: false,
  3081. pause: 'hover',
  3082. wrap: true,
  3083. touch: true
  3084. };
  3085. var DefaultType = {
  3086. interval: '(number|boolean)',
  3087. keyboard: 'boolean',
  3088. slide: '(boolean|string)',
  3089. pause: '(string|boolean)',
  3090. wrap: 'boolean',
  3091. touch: 'boolean'
  3092. };
  3093. var Direction = {
  3094. NEXT: 'next',
  3095. PREV: 'prev',
  3096. LEFT: 'left',
  3097. RIGHT: 'right'
  3098. };
  3099. var Event$2 = {
  3100. SLIDE: "slide" + EVENT_KEY$2,
  3101. SLID: "slid" + EVENT_KEY$2,
  3102. KEYDOWN: "keydown" + EVENT_KEY$2,
  3103. MOUSEENTER: "mouseenter" + EVENT_KEY$2,
  3104. MOUSELEAVE: "mouseleave" + EVENT_KEY$2,
  3105. TOUCHSTART: "touchstart" + EVENT_KEY$2,
  3106. TOUCHMOVE: "touchmove" + EVENT_KEY$2,
  3107. TOUCHEND: "touchend" + EVENT_KEY$2,
  3108. POINTERDOWN: "pointerdown" + EVENT_KEY$2,
  3109. POINTERUP: "pointerup" + EVENT_KEY$2,
  3110. DRAG_START: "dragstart" + EVENT_KEY$2,
  3111. LOAD_DATA_API: "load" + EVENT_KEY$2 + DATA_API_KEY$2,
  3112. CLICK_DATA_API: "click" + EVENT_KEY$2 + DATA_API_KEY$2
  3113. };
  3114. var ClassName$2 = {
  3115. CAROUSEL: 'carousel',
  3116. ACTIVE: 'active',
  3117. SLIDE: 'slide',
  3118. RIGHT: 'carousel-item-right',
  3119. LEFT: 'carousel-item-left',
  3120. NEXT: 'carousel-item-next',
  3121. PREV: 'carousel-item-prev',
  3122. ITEM: 'carousel-item',
  3123. POINTER_EVENT: 'pointer-event'
  3124. };
  3125. var Selector$2 = {
  3126. ACTIVE: '.active',
  3127. ACTIVE_ITEM: '.active.carousel-item',
  3128. ITEM: '.carousel-item',
  3129. ITEM_IMG: '.carousel-item img',
  3130. NEXT_PREV: '.carousel-item-next, .carousel-item-prev',
  3131. INDICATORS: '.carousel-indicators',
  3132. DATA_SLIDE: '[data-slide], [data-slide-to]',
  3133. DATA_RIDE: '[data-ride="carousel"]'
  3134. };
  3135. var PointerType = {
  3136. TOUCH: 'touch',
  3137. PEN: 'pen'
  3138. };
  3139. /**
  3140. * ------------------------------------------------------------------------
  3141. * Class Definition
  3142. * ------------------------------------------------------------------------
  3143. */
  3144. var Carousel =
  3145. /*#__PURE__*/
  3146. function () {
  3147. function Carousel(element, config) {
  3148. this._items = null;
  3149. this._interval = null;
  3150. this._activeElement = null;
  3151. this._isPaused = false;
  3152. this._isSliding = false;
  3153. this.touchTimeout = null;
  3154. this.touchStartX = 0;
  3155. this.touchDeltaX = 0;
  3156. this._config = this._getConfig(config);
  3157. this._element = element;
  3158. this._indicatorsElement = this._element.querySelector(Selector$2.INDICATORS);
  3159. this._touchSupported = 'ontouchstart' in document.documentElement || navigator.maxTouchPoints > 0;
  3160. this._pointerEvent = Boolean(window.PointerEvent || window.MSPointerEvent);
  3161. this._addEventListeners();
  3162. } // Getters
  3163. var _proto = Carousel.prototype;
  3164. // Public
  3165. _proto.next = function next() {
  3166. if (!this._isSliding) {
  3167. this._slide(Direction.NEXT);
  3168. }
  3169. };
  3170. _proto.nextWhenVisible = function nextWhenVisible() {
  3171. // Don't call next when the page isn't visible
  3172. // or the carousel or its parent isn't visible
  3173. if (!document.hidden && $(this._element).is(':visible') && $(this._element).css('visibility') !== 'hidden') {
  3174. this.next();
  3175. }
  3176. };
  3177. _proto.prev = function prev() {
  3178. if (!this._isSliding) {
  3179. this._slide(Direction.PREV);
  3180. }
  3181. };
  3182. _proto.pause = function pause(event) {
  3183. if (!event) {
  3184. this._isPaused = true;
  3185. }
  3186. if (this._element.querySelector(Selector$2.NEXT_PREV)) {
  3187. Util.triggerTransitionEnd(this._element);
  3188. this.cycle(true);
  3189. }
  3190. clearInterval(this._interval);
  3191. this._interval = null;
  3192. };
  3193. _proto.cycle = function cycle(event) {
  3194. if (!event) {
  3195. this._isPaused = false;
  3196. }
  3197. if (this._interval) {
  3198. clearInterval(this._interval);
  3199. this._interval = null;
  3200. }
  3201. if (this._config.interval && !this._isPaused) {
  3202. this._interval = setInterval((document.visibilityState ? this.nextWhenVisible : this.next).bind(this), this._config.interval);
  3203. }
  3204. };
  3205. _proto.to = function to(index) {
  3206. var _this = this;
  3207. this._activeElement = this._element.querySelector(Selector$2.ACTIVE_ITEM);
  3208. var activeIndex = this._getItemIndex(this._activeElement);
  3209. if (index > this._items.length - 1 || index < 0) {
  3210. return;
  3211. }
  3212. if (this._isSliding) {
  3213. $(this._element).one(Event$2.SLID, function () {
  3214. return _this.to(index);
  3215. });
  3216. return;
  3217. }
  3218. if (activeIndex === index) {
  3219. this.pause();
  3220. this.cycle();
  3221. return;
  3222. }
  3223. var direction = index > activeIndex ? Direction.NEXT : Direction.PREV;
  3224. this._slide(direction, this._items[index]);
  3225. };
  3226. _proto.dispose = function dispose() {
  3227. $(this._element).off(EVENT_KEY$2);
  3228. $.removeData(this._element, DATA_KEY$2);
  3229. this._items = null;
  3230. this._config = null;
  3231. this._element = null;
  3232. this._interval = null;
  3233. this._isPaused = null;
  3234. this._isSliding = null;
  3235. this._activeElement = null;
  3236. this._indicatorsElement = null;
  3237. } // Private
  3238. ;
  3239. _proto._getConfig = function _getConfig(config) {
  3240. config = _objectSpread2({}, Default, {}, config);
  3241. Util.typeCheckConfig(NAME$2, config, DefaultType);
  3242. return config;
  3243. };
  3244. _proto._handleSwipe = function _handleSwipe() {
  3245. var absDeltax = Math.abs(this.touchDeltaX);
  3246. if (absDeltax <= SWIPE_THRESHOLD) {
  3247. return;
  3248. }
  3249. var direction = absDeltax / this.touchDeltaX;
  3250. this.touchDeltaX = 0; // swipe left
  3251. if (direction > 0) {
  3252. this.prev();
  3253. } // swipe right
  3254. if (direction < 0) {
  3255. this.next();
  3256. }
  3257. };
  3258. _proto._addEventListeners = function _addEventListeners() {
  3259. var _this2 = this;
  3260. if (this._config.keyboard) {
  3261. $(this._element).on(Event$2.KEYDOWN, function (event) {
  3262. return _this2._keydown(event);
  3263. });
  3264. }
  3265. if (this._config.pause === 'hover') {
  3266. $(this._element).on(Event$2.MOUSEENTER, function (event) {
  3267. return _this2.pause(event);
  3268. }).on(Event$2.MOUSELEAVE, function (event) {
  3269. return _this2.cycle(event);
  3270. });
  3271. }
  3272. if (this._config.touch) {
  3273. this._addTouchEventListeners();
  3274. }
  3275. };
  3276. _proto._addTouchEventListeners = function _addTouchEventListeners() {
  3277. var _this3 = this;
  3278. if (!this._touchSupported) {
  3279. return;
  3280. }
  3281. var start = function start(event) {
  3282. if (_this3._pointerEvent && PointerType[event.originalEvent.pointerType.toUpperCase()]) {
  3283. _this3.touchStartX = event.originalEvent.clientX;
  3284. } else if (!_this3._pointerEvent) {
  3285. _this3.touchStartX = event.originalEvent.touches[0].clientX;
  3286. }
  3287. };
  3288. var move = function move(event) {
  3289. // ensure swiping with one touch and not pinching
  3290. if (event.originalEvent.touches && event.originalEvent.touches.length > 1) {
  3291. _this3.touchDeltaX = 0;
  3292. } else {
  3293. _this3.touchDeltaX = event.originalEvent.touches[0].clientX - _this3.touchStartX;
  3294. }
  3295. };
  3296. var end = function end(event) {
  3297. if (_this3._pointerEvent && PointerType[event.originalEvent.pointerType.toUpperCase()]) {
  3298. _this3.touchDeltaX = event.originalEvent.clientX - _this3.touchStartX;
  3299. }
  3300. _this3._handleSwipe();
  3301. if (_this3._config.pause === 'hover') {
  3302. // If it's a touch-enabled device, mouseenter/leave are fired as
  3303. // part of the mouse compatibility events on first tap - the carousel
  3304. // would stop cycling until user tapped out of it;
  3305. // here, we listen for touchend, explicitly pause the carousel
  3306. // (as if it's the second time we tap on it, mouseenter compat event
  3307. // is NOT fired) and after a timeout (to allow for mouse compatibility
  3308. // events to fire) we explicitly restart cycling
  3309. _this3.pause();
  3310. if (_this3.touchTimeout) {
  3311. clearTimeout(_this3.touchTimeout);
  3312. }
  3313. _this3.touchTimeout = setTimeout(function (event) {
  3314. return _this3.cycle(event);
  3315. }, TOUCHEVENT_COMPAT_WAIT + _this3._config.interval);
  3316. }
  3317. };
  3318. $(this._element.querySelectorAll(Selector$2.ITEM_IMG)).on(Event$2.DRAG_START, function (e) {
  3319. return e.preventDefault();
  3320. });
  3321. if (this._pointerEvent) {
  3322. $(this._element).on(Event$2.POINTERDOWN, function (event) {
  3323. return start(event);
  3324. });
  3325. $(this._element).on(Event$2.POINTERUP, function (event) {
  3326. return end(event);
  3327. });
  3328. this._element.classList.add(ClassName$2.POINTER_EVENT);
  3329. } else {
  3330. $(this._element).on(Event$2.TOUCHSTART, function (event) {
  3331. return start(event);
  3332. });
  3333. $(this._element).on(Event$2.TOUCHMOVE, function (event) {
  3334. return move(event);
  3335. });
  3336. $(this._element).on(Event$2.TOUCHEND, function (event) {
  3337. return end(event);
  3338. });
  3339. }
  3340. };
  3341. _proto._keydown = function _keydown(event) {
  3342. if (/input|textarea/i.test(event.target.tagName)) {
  3343. return;
  3344. }
  3345. switch (event.which) {
  3346. case ARROW_LEFT_KEYCODE:
  3347. event.preventDefault();
  3348. this.prev();
  3349. break;
  3350. case ARROW_RIGHT_KEYCODE:
  3351. event.preventDefault();
  3352. this.next();
  3353. break;
  3354. }
  3355. };
  3356. _proto._getItemIndex = function _getItemIndex(element) {
  3357. this._items = element && element.parentNode ? [].slice.call(element.parentNode.querySelectorAll(Selector$2.ITEM)) : [];
  3358. return this._items.indexOf(element);
  3359. };
  3360. _proto._getItemByDirection = function _getItemByDirection(direction, activeElement) {
  3361. var isNextDirection = direction === Direction.NEXT;
  3362. var isPrevDirection = direction === Direction.PREV;
  3363. var activeIndex = this._getItemIndex(activeElement);
  3364. var lastItemIndex = this._items.length - 1;
  3365. var isGoingToWrap = isPrevDirection && activeIndex === 0 || isNextDirection && activeIndex === lastItemIndex;
  3366. if (isGoingToWrap && !this._config.wrap) {
  3367. return activeElement;
  3368. }
  3369. var delta = direction === Direction.PREV ? -1 : 1;
  3370. var itemIndex = (activeIndex + delta) % this._items.length;
  3371. return itemIndex === -1 ? this._items[this._items.length - 1] : this._items[itemIndex];
  3372. };
  3373. _proto._triggerSlideEvent = function _triggerSlideEvent(relatedTarget, eventDirectionName) {
  3374. var targetIndex = this._getItemIndex(relatedTarget);
  3375. var fromIndex = this._getItemIndex(this._element.querySelector(Selector$2.ACTIVE_ITEM));
  3376. var slideEvent = $.Event(Event$2.SLIDE, {
  3377. relatedTarget: relatedTarget,
  3378. direction: eventDirectionName,
  3379. from: fromIndex,
  3380. to: targetIndex
  3381. });
  3382. $(this._element).trigger(slideEvent);
  3383. return slideEvent;
  3384. };
  3385. _proto._setActiveIndicatorElement = function _setActiveIndicatorElement(element) {
  3386. if (this._indicatorsElement) {
  3387. var indicators = [].slice.call(this._indicatorsElement.querySelectorAll(Selector$2.ACTIVE));
  3388. $(indicators).removeClass(ClassName$2.ACTIVE);
  3389. var nextIndicator = this._indicatorsElement.children[this._getItemIndex(element)];
  3390. if (nextIndicator) {
  3391. $(nextIndicator).addClass(ClassName$2.ACTIVE);
  3392. }
  3393. }
  3394. };
  3395. _proto._slide = function _slide(direction, element) {
  3396. var _this4 = this;
  3397. var activeElement = this._element.querySelector(Selector$2.ACTIVE_ITEM);
  3398. var activeElementIndex = this._getItemIndex(activeElement);
  3399. var nextElement = element || activeElement && this._getItemByDirection(direction, activeElement);
  3400. var nextElementIndex = this._getItemIndex(nextElement);
  3401. var isCycling = Boolean(this._interval);
  3402. var directionalClassName;
  3403. var orderClassName;
  3404. var eventDirectionName;
  3405. if (direction === Direction.NEXT) {
  3406. directionalClassName = ClassName$2.LEFT;
  3407. orderClassName = ClassName$2.NEXT;
  3408. eventDirectionName = Direction.LEFT;
  3409. } else {
  3410. directionalClassName = ClassName$2.RIGHT;
  3411. orderClassName = ClassName$2.PREV;
  3412. eventDirectionName = Direction.RIGHT;
  3413. }
  3414. if (nextElement && $(nextElement).hasClass(ClassName$2.ACTIVE)) {
  3415. this._isSliding = false;
  3416. return;
  3417. }
  3418. var slideEvent = this._triggerSlideEvent(nextElement, eventDirectionName);
  3419. if (slideEvent.isDefaultPrevented()) {
  3420. return;
  3421. }
  3422. if (!activeElement || !nextElement) {
  3423. // Some weirdness is happening, so we bail
  3424. return;
  3425. }
  3426. this._isSliding = true;
  3427. if (isCycling) {
  3428. this.pause();
  3429. }
  3430. this._setActiveIndicatorElement(nextElement);
  3431. var slidEvent = $.Event(Event$2.SLID, {
  3432. relatedTarget: nextElement,
  3433. direction: eventDirectionName,
  3434. from: activeElementIndex,
  3435. to: nextElementIndex
  3436. });
  3437. if ($(this._element).hasClass(ClassName$2.SLIDE)) {
  3438. $(nextElement).addClass(orderClassName);
  3439. Util.reflow(nextElement);
  3440. $(activeElement).addClass(directionalClassName);
  3441. $(nextElement).addClass(directionalClassName);
  3442. var nextElementInterval = parseInt(nextElement.getAttribute('data-interval'), 10);
  3443. if (nextElementInterval) {
  3444. this._config.defaultInterval = this._config.defaultInterval || this._config.interval;
  3445. this._config.interval = nextElementInterval;
  3446. } else {
  3447. this._config.interval = this._config.defaultInterval || this._config.interval;
  3448. }
  3449. var transitionDuration = Util.getTransitionDurationFromElement(activeElement);
  3450. $(activeElement).one(Util.TRANSITION_END, function () {
  3451. $(nextElement).removeClass(directionalClassName + " " + orderClassName).addClass(ClassName$2.ACTIVE);
  3452. $(activeElement).removeClass(ClassName$2.ACTIVE + " " + orderClassName + " " + directionalClassName);
  3453. _this4._isSliding = false;
  3454. setTimeout(function () {
  3455. return $(_this4._element).trigger(slidEvent);
  3456. }, 0);
  3457. }).emulateTransitionEnd(transitionDuration);
  3458. } else {
  3459. $(activeElement).removeClass(ClassName$2.ACTIVE);
  3460. $(nextElement).addClass(ClassName$2.ACTIVE);
  3461. this._isSliding = false;
  3462. $(this._element).trigger(slidEvent);
  3463. }
  3464. if (isCycling) {
  3465. this.cycle();
  3466. }
  3467. } // Static
  3468. ;
  3469. Carousel._jQueryInterface = function _jQueryInterface(config) {
  3470. return this.each(function () {
  3471. var data = $(this).data(DATA_KEY$2);
  3472. var _config = _objectSpread2({}, Default, {}, $(this).data());
  3473. if (typeof config === 'object') {
  3474. _config = _objectSpread2({}, _config, {}, config);
  3475. }
  3476. var action = typeof config === 'string' ? config : _config.slide;
  3477. if (!data) {
  3478. data = new Carousel(this, _config);
  3479. $(this).data(DATA_KEY$2, data);
  3480. }
  3481. if (typeof config === 'number') {
  3482. data.to(config);
  3483. } else if (typeof action === 'string') {
  3484. if (typeof data[action] === 'undefined') {
  3485. throw new TypeError("No method named \"" + action + "\"");
  3486. }
  3487. data[action]();
  3488. } else if (_config.interval && _config.ride) {
  3489. data.pause();
  3490. data.cycle();
  3491. }
  3492. });
  3493. };
  3494. Carousel._dataApiClickHandler = function _dataApiClickHandler(event) {
  3495. var selector = Util.getSelectorFromElement(this);
  3496. if (!selector) {
  3497. return;
  3498. }
  3499. var target = $(selector)[0];
  3500. if (!target || !$(target).hasClass(ClassName$2.CAROUSEL)) {
  3501. return;
  3502. }
  3503. var config = _objectSpread2({}, $(target).data(), {}, $(this).data());
  3504. var slideIndex = this.getAttribute('data-slide-to');
  3505. if (slideIndex) {
  3506. config.interval = false;
  3507. }
  3508. Carousel._jQueryInterface.call($(target), config);
  3509. if (slideIndex) {
  3510. $(target).data(DATA_KEY$2).to(slideIndex);
  3511. }
  3512. event.preventDefault();
  3513. };
  3514. _createClass(Carousel, null, [{
  3515. key: "VERSION",
  3516. get: function get() {
  3517. return VERSION$2;
  3518. }
  3519. }, {
  3520. key: "Default",
  3521. get: function get() {
  3522. return Default;
  3523. }
  3524. }]);
  3525. return Carousel;
  3526. }();
  3527. /**
  3528. * ------------------------------------------------------------------------
  3529. * Data Api implementation
  3530. * ------------------------------------------------------------------------
  3531. */
  3532. $(document).on(Event$2.CLICK_DATA_API, Selector$2.DATA_SLIDE, Carousel._dataApiClickHandler);
  3533. $(window).on(Event$2.LOAD_DATA_API, function () {
  3534. var carousels = [].slice.call(document.querySelectorAll(Selector$2.DATA_RIDE));
  3535. for (var i = 0, len = carousels.length; i < len; i++) {
  3536. var $carousel = $(carousels[i]);
  3537. Carousel._jQueryInterface.call($carousel, $carousel.data());
  3538. }
  3539. });
  3540. /**
  3541. * ------------------------------------------------------------------------
  3542. * jQuery
  3543. * ------------------------------------------------------------------------
  3544. */
  3545. $.fn[NAME$2] = Carousel._jQueryInterface;
  3546. $.fn[NAME$2].Constructor = Carousel;
  3547. $.fn[NAME$2].noConflict = function () {
  3548. $.fn[NAME$2] = JQUERY_NO_CONFLICT$2;
  3549. return Carousel._jQueryInterface;
  3550. };
  3551. /**
  3552. * ------------------------------------------------------------------------
  3553. * Constants
  3554. * ------------------------------------------------------------------------
  3555. */
  3556. var NAME$3 = 'collapse';
  3557. var VERSION$3 = '4.4.1';
  3558. var DATA_KEY$3 = 'bs.collapse';
  3559. var EVENT_KEY$3 = "." + DATA_KEY$3;
  3560. var DATA_API_KEY$3 = '.data-api';
  3561. var JQUERY_NO_CONFLICT$3 = $.fn[NAME$3];
  3562. var Default$1 = {
  3563. toggle: true,
  3564. parent: ''
  3565. };
  3566. var DefaultType$1 = {
  3567. toggle: 'boolean',
  3568. parent: '(string|element)'
  3569. };
  3570. var Event$3 = {
  3571. SHOW: "show" + EVENT_KEY$3,
  3572. SHOWN: "shown" + EVENT_KEY$3,
  3573. HIDE: "hide" + EVENT_KEY$3,
  3574. HIDDEN: "hidden" + EVENT_KEY$3,
  3575. CLICK_DATA_API: "click" + EVENT_KEY$3 + DATA_API_KEY$3
  3576. };
  3577. var ClassName$3 = {
  3578. SHOW: 'show',
  3579. COLLAPSE: 'collapse',
  3580. COLLAPSING: 'collapsing',
  3581. COLLAPSED: 'collapsed'
  3582. };
  3583. var Dimension = {
  3584. WIDTH: 'width',
  3585. HEIGHT: 'height'
  3586. };
  3587. var Selector$3 = {
  3588. ACTIVES: '.show, .collapsing',
  3589. DATA_TOGGLE: '[data-toggle="collapse"]'
  3590. };
  3591. /**
  3592. * ------------------------------------------------------------------------
  3593. * Class Definition
  3594. * ------------------------------------------------------------------------
  3595. */
  3596. var Collapse =
  3597. /*#__PURE__*/
  3598. function () {
  3599. function Collapse(element, config) {
  3600. this._isTransitioning = false;
  3601. this._element = element;
  3602. this._config = this._getConfig(config);
  3603. this._triggerArray = [].slice.call(document.querySelectorAll("[data-toggle=\"collapse\"][href=\"#" + element.id + "\"]," + ("[data-toggle=\"collapse\"][data-target=\"#" + element.id + "\"]")));
  3604. var toggleList = [].slice.call(document.querySelectorAll(Selector$3.DATA_TOGGLE));
  3605. for (var i = 0, len = toggleList.length; i < len; i++) {
  3606. var elem = toggleList[i];
  3607. var selector = Util.getSelectorFromElement(elem);
  3608. var filterElement = [].slice.call(document.querySelectorAll(selector)).filter(function (foundElem) {
  3609. return foundElem === element;
  3610. });
  3611. if (selector !== null && filterElement.length > 0) {
  3612. this._selector = selector;
  3613. this._triggerArray.push(elem);
  3614. }
  3615. }
  3616. this._parent = this._config.parent ? this._getParent() : null;
  3617. if (!this._config.parent) {
  3618. this._addAriaAndCollapsedClass(this._element, this._triggerArray);
  3619. }
  3620. if (this._config.toggle) {
  3621. this.toggle();
  3622. }
  3623. } // Getters
  3624. var _proto = Collapse.prototype;
  3625. // Public
  3626. _proto.toggle = function toggle() {
  3627. if ($(this._element).hasClass(ClassName$3.SHOW)) {
  3628. this.hide();
  3629. } else {
  3630. this.show();
  3631. }
  3632. };
  3633. _proto.show = function show() {
  3634. var _this = this;
  3635. if (this._isTransitioning || $(this._element).hasClass(ClassName$3.SHOW)) {
  3636. return;
  3637. }
  3638. var actives;
  3639. var activesData;
  3640. if (this._parent) {
  3641. actives = [].slice.call(this._parent.querySelectorAll(Selector$3.ACTIVES)).filter(function (elem) {
  3642. if (typeof _this._config.parent === 'string') {
  3643. return elem.getAttribute('data-parent') === _this._config.parent;
  3644. }
  3645. return elem.classList.contains(ClassName$3.COLLAPSE);
  3646. });
  3647. if (actives.length === 0) {
  3648. actives = null;
  3649. }
  3650. }
  3651. if (actives) {
  3652. activesData = $(actives).not(this._selector).data(DATA_KEY$3);
  3653. if (activesData && activesData._isTransitioning) {
  3654. return;
  3655. }
  3656. }
  3657. var startEvent = $.Event(Event$3.SHOW);
  3658. $(this._element).trigger(startEvent);
  3659. if (startEvent.isDefaultPrevented()) {
  3660. return;
  3661. }
  3662. if (actives) {
  3663. Collapse._jQueryInterface.call($(actives).not(this._selector), 'hide');
  3664. if (!activesData) {
  3665. $(actives).data(DATA_KEY$3, null);
  3666. }
  3667. }
  3668. var dimension = this._getDimension();
  3669. $(this._element).removeClass(ClassName$3.COLLAPSE).addClass(ClassName$3.COLLAPSING);
  3670. this._element.style[dimension] = 0;
  3671. if (this._triggerArray.length) {
  3672. $(this._triggerArray).removeClass(ClassName$3.COLLAPSED).attr('aria-expanded', true);
  3673. }
  3674. this.setTransitioning(true);
  3675. var complete = function complete() {
  3676. $(_this._element).removeClass(ClassName$3.COLLAPSING).addClass(ClassName$3.COLLAPSE).addClass(ClassName$3.SHOW);
  3677. _this._element.style[dimension] = '';
  3678. _this.setTransitioning(false);
  3679. $(_this._element).trigger(Event$3.SHOWN);
  3680. };
  3681. var capitalizedDimension = dimension[0].toUpperCase() + dimension.slice(1);
  3682. var scrollSize = "scroll" + capitalizedDimension;
  3683. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  3684. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  3685. this._element.style[dimension] = this._element[scrollSize] + "px";
  3686. };
  3687. _proto.hide = function hide() {
  3688. var _this2 = this;
  3689. if (this._isTransitioning || !$(this._element).hasClass(ClassName$3.SHOW)) {
  3690. return;
  3691. }
  3692. var startEvent = $.Event(Event$3.HIDE);
  3693. $(this._element).trigger(startEvent);
  3694. if (startEvent.isDefaultPrevented()) {
  3695. return;
  3696. }
  3697. var dimension = this._getDimension();
  3698. this._element.style[dimension] = this._element.getBoundingClientRect()[dimension] + "px";
  3699. Util.reflow(this._element);
  3700. $(this._element).addClass(ClassName$3.COLLAPSING).removeClass(ClassName$3.COLLAPSE).removeClass(ClassName$3.SHOW);
  3701. var triggerArrayLength = this._triggerArray.length;
  3702. if (triggerArrayLength > 0) {
  3703. for (var i = 0; i < triggerArrayLength; i++) {
  3704. var trigger = this._triggerArray[i];
  3705. var selector = Util.getSelectorFromElement(trigger);
  3706. if (selector !== null) {
  3707. var $elem = $([].slice.call(document.querySelectorAll(selector)));
  3708. if (!$elem.hasClass(ClassName$3.SHOW)) {
  3709. $(trigger).addClass(ClassName$3.COLLAPSED).attr('aria-expanded', false);
  3710. }
  3711. }
  3712. }
  3713. }
  3714. this.setTransitioning(true);
  3715. var complete = function complete() {
  3716. _this2.setTransitioning(false);
  3717. $(_this2._element).removeClass(ClassName$3.COLLAPSING).addClass(ClassName$3.COLLAPSE).trigger(Event$3.HIDDEN);
  3718. };
  3719. this._element.style[dimension] = '';
  3720. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  3721. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  3722. };
  3723. _proto.setTransitioning = function setTransitioning(isTransitioning) {
  3724. this._isTransitioning = isTransitioning;
  3725. };
  3726. _proto.dispose = function dispose() {
  3727. $.removeData(this._element, DATA_KEY$3);
  3728. this._config = null;
  3729. this._parent = null;
  3730. this._element = null;
  3731. this._triggerArray = null;
  3732. this._isTransitioning = null;
  3733. } // Private
  3734. ;
  3735. _proto._getConfig = function _getConfig(config) {
  3736. config = _objectSpread2({}, Default$1, {}, config);
  3737. config.toggle = Boolean(config.toggle); // Coerce string values
  3738. Util.typeCheckConfig(NAME$3, config, DefaultType$1);
  3739. return config;
  3740. };
  3741. _proto._getDimension = function _getDimension() {
  3742. var hasWidth = $(this._element).hasClass(Dimension.WIDTH);
  3743. return hasWidth ? Dimension.WIDTH : Dimension.HEIGHT;
  3744. };
  3745. _proto._getParent = function _getParent() {
  3746. var _this3 = this;
  3747. var parent;
  3748. if (Util.isElement(this._config.parent)) {
  3749. parent = this._config.parent; // It's a jQuery object
  3750. if (typeof this._config.parent.jquery !== 'undefined') {
  3751. parent = this._config.parent[0];
  3752. }
  3753. } else {
  3754. parent = document.querySelector(this._config.parent);
  3755. }
  3756. var selector = "[data-toggle=\"collapse\"][data-parent=\"" + this._config.parent + "\"]";
  3757. var children = [].slice.call(parent.querySelectorAll(selector));
  3758. $(children).each(function (i, element) {
  3759. _this3._addAriaAndCollapsedClass(Collapse._getTargetFromElement(element), [element]);
  3760. });
  3761. return parent;
  3762. };
  3763. _proto._addAriaAndCollapsedClass = function _addAriaAndCollapsedClass(element, triggerArray) {
  3764. var isOpen = $(element).hasClass(ClassName$3.SHOW);
  3765. if (triggerArray.length) {
  3766. $(triggerArray).toggleClass(ClassName$3.COLLAPSED, !isOpen).attr('aria-expanded', isOpen);
  3767. }
  3768. } // Static
  3769. ;
  3770. Collapse._getTargetFromElement = function _getTargetFromElement(element) {
  3771. var selector = Util.getSelectorFromElement(element);
  3772. return selector ? document.querySelector(selector) : null;
  3773. };
  3774. Collapse._jQueryInterface = function _jQueryInterface(config) {
  3775. return this.each(function () {
  3776. var $this = $(this);
  3777. var data = $this.data(DATA_KEY$3);
  3778. var _config = _objectSpread2({}, Default$1, {}, $this.data(), {}, typeof config === 'object' && config ? config : {});
  3779. if (!data && _config.toggle && /show|hide/.test(config)) {
  3780. _config.toggle = false;
  3781. }
  3782. if (!data) {
  3783. data = new Collapse(this, _config);
  3784. $this.data(DATA_KEY$3, data);
  3785. }
  3786. if (typeof config === 'string') {
  3787. if (typeof data[config] === 'undefined') {
  3788. throw new TypeError("No method named \"" + config + "\"");
  3789. }
  3790. data[config]();
  3791. }
  3792. });
  3793. };
  3794. _createClass(Collapse, null, [{
  3795. key: "VERSION",
  3796. get: function get() {
  3797. return VERSION$3;
  3798. }
  3799. }, {
  3800. key: "Default",
  3801. get: function get() {
  3802. return Default$1;
  3803. }
  3804. }]);
  3805. return Collapse;
  3806. }();
  3807. /**
  3808. * ------------------------------------------------------------------------
  3809. * Data Api implementation
  3810. * ------------------------------------------------------------------------
  3811. */
  3812. $(document).on(Event$3.CLICK_DATA_API, Selector$3.DATA_TOGGLE, function (event) {
  3813. // preventDefault only for <a> elements (which change the URL) not inside the collapsible element
  3814. if (event.currentTarget.tagName === 'A') {
  3815. event.preventDefault();
  3816. }
  3817. var $trigger = $(this);
  3818. var selector = Util.getSelectorFromElement(this);
  3819. var selectors = [].slice.call(document.querySelectorAll(selector));
  3820. $(selectors).each(function () {
  3821. var $target = $(this);
  3822. var data = $target.data(DATA_KEY$3);
  3823. var config = data ? 'toggle' : $trigger.data();
  3824. Collapse._jQueryInterface.call($target, config);
  3825. });
  3826. });
  3827. /**
  3828. * ------------------------------------------------------------------------
  3829. * jQuery
  3830. * ------------------------------------------------------------------------
  3831. */
  3832. $.fn[NAME$3] = Collapse._jQueryInterface;
  3833. $.fn[NAME$3].Constructor = Collapse;
  3834. $.fn[NAME$3].noConflict = function () {
  3835. $.fn[NAME$3] = JQUERY_NO_CONFLICT$3;
  3836. return Collapse._jQueryInterface;
  3837. };
  3838. /**
  3839. * ------------------------------------------------------------------------
  3840. * Constants
  3841. * ------------------------------------------------------------------------
  3842. */
  3843. var NAME$4 = 'dropdown';
  3844. var VERSION$4 = '4.4.1';
  3845. var DATA_KEY$4 = 'bs.dropdown';
  3846. var EVENT_KEY$4 = "." + DATA_KEY$4;
  3847. var DATA_API_KEY$4 = '.data-api';
  3848. var JQUERY_NO_CONFLICT$4 = $.fn[NAME$4];
  3849. var ESCAPE_KEYCODE = 27; // KeyboardEvent.which value for Escape (Esc) key
  3850. var SPACE_KEYCODE = 32; // KeyboardEvent.which value for space key
  3851. var TAB_KEYCODE = 9; // KeyboardEvent.which value for tab key
  3852. var ARROW_UP_KEYCODE = 38; // KeyboardEvent.which value for up arrow key
  3853. var ARROW_DOWN_KEYCODE = 40; // KeyboardEvent.which value for down arrow key
  3854. var RIGHT_MOUSE_BUTTON_WHICH = 3; // MouseEvent.which value for the right button (assuming a right-handed mouse)
  3855. var REGEXP_KEYDOWN = new RegExp(ARROW_UP_KEYCODE + "|" + ARROW_DOWN_KEYCODE + "|" + ESCAPE_KEYCODE);
  3856. var Event$4 = {
  3857. HIDE: "hide" + EVENT_KEY$4,
  3858. HIDDEN: "hidden" + EVENT_KEY$4,
  3859. SHOW: "show" + EVENT_KEY$4,
  3860. SHOWN: "shown" + EVENT_KEY$4,
  3861. CLICK: "click" + EVENT_KEY$4,
  3862. CLICK_DATA_API: "click" + EVENT_KEY$4 + DATA_API_KEY$4,
  3863. KEYDOWN_DATA_API: "keydown" + EVENT_KEY$4 + DATA_API_KEY$4,
  3864. KEYUP_DATA_API: "keyup" + EVENT_KEY$4 + DATA_API_KEY$4
  3865. };
  3866. var ClassName$4 = {
  3867. DISABLED: 'disabled',
  3868. SHOW: 'show',
  3869. DROPUP: 'dropup',
  3870. DROPRIGHT: 'dropright',
  3871. DROPLEFT: 'dropleft',
  3872. MENURIGHT: 'dropdown-menu-right',
  3873. MENULEFT: 'dropdown-menu-left',
  3874. POSITION_STATIC: 'position-static'
  3875. };
  3876. var Selector$4 = {
  3877. DATA_TOGGLE: '[data-toggle="dropdown"]',
  3878. FORM_CHILD: '.dropdown form',
  3879. MENU: '.dropdown-menu',
  3880. NAVBAR_NAV: '.navbar-nav',
  3881. VISIBLE_ITEMS: '.dropdown-menu .dropdown-item:not(.disabled):not(:disabled)'
  3882. };
  3883. var AttachmentMap = {
  3884. TOP: 'top-start',
  3885. TOPEND: 'top-end',
  3886. BOTTOM: 'bottom-start',
  3887. BOTTOMEND: 'bottom-end',
  3888. RIGHT: 'right-start',
  3889. RIGHTEND: 'right-end',
  3890. LEFT: 'left-start',
  3891. LEFTEND: 'left-end'
  3892. };
  3893. var Default$2 = {
  3894. offset: 0,
  3895. flip: true,
  3896. boundary: 'scrollParent',
  3897. reference: 'toggle',
  3898. display: 'dynamic',
  3899. popperConfig: null
  3900. };
  3901. var DefaultType$2 = {
  3902. offset: '(number|string|function)',
  3903. flip: 'boolean',
  3904. boundary: '(string|element)',
  3905. reference: '(string|element)',
  3906. display: 'string',
  3907. popperConfig: '(null|object)'
  3908. };
  3909. /**
  3910. * ------------------------------------------------------------------------
  3911. * Class Definition
  3912. * ------------------------------------------------------------------------
  3913. */
  3914. var Dropdown =
  3915. /*#__PURE__*/
  3916. function () {
  3917. function Dropdown(element, config) {
  3918. this._element = element;
  3919. this._popper = null;
  3920. this._config = this._getConfig(config);
  3921. this._menu = this._getMenuElement();
  3922. this._inNavbar = this._detectNavbar();
  3923. this._addEventListeners();
  3924. } // Getters
  3925. var _proto = Dropdown.prototype;
  3926. // Public
  3927. _proto.toggle = function toggle() {
  3928. if (this._element.disabled || $(this._element).hasClass(ClassName$4.DISABLED)) {
  3929. return;
  3930. }
  3931. var isActive = $(this._menu).hasClass(ClassName$4.SHOW);
  3932. Dropdown._clearMenus();
  3933. if (isActive) {
  3934. return;
  3935. }
  3936. this.show(true);
  3937. };
  3938. _proto.show = function show(usePopper) {
  3939. if (usePopper === void 0) {
  3940. usePopper = false;
  3941. }
  3942. if (this._element.disabled || $(this._element).hasClass(ClassName$4.DISABLED) || $(this._menu).hasClass(ClassName$4.SHOW)) {
  3943. return;
  3944. }
  3945. var relatedTarget = {
  3946. relatedTarget: this._element
  3947. };
  3948. var showEvent = $.Event(Event$4.SHOW, relatedTarget);
  3949. var parent = Dropdown._getParentFromElement(this._element);
  3950. $(parent).trigger(showEvent);
  3951. if (showEvent.isDefaultPrevented()) {
  3952. return;
  3953. } // Disable totally Popper.js for Dropdown in Navbar
  3954. if (!this._inNavbar && usePopper) {
  3955. /**
  3956. * Check for Popper dependency
  3957. * Popper - https://popper.js.org
  3958. */
  3959. if (typeof Popper === 'undefined') {
  3960. throw new TypeError('Bootstrap\'s dropdowns require Popper.js (https://popper.js.org/)');
  3961. }
  3962. var referenceElement = this._element;
  3963. if (this._config.reference === 'parent') {
  3964. referenceElement = parent;
  3965. } else if (Util.isElement(this._config.reference)) {
  3966. referenceElement = this._config.reference; // Check if it's jQuery element
  3967. if (typeof this._config.reference.jquery !== 'undefined') {
  3968. referenceElement = this._config.reference[0];
  3969. }
  3970. } // If boundary is not `scrollParent`, then set position to `static`
  3971. // to allow the menu to "escape" the scroll parent's boundaries
  3972. // https://github.com/twbs/bootstrap/issues/24251
  3973. if (this._config.boundary !== 'scrollParent') {
  3974. $(parent).addClass(ClassName$4.POSITION_STATIC);
  3975. }
  3976. this._popper = new Popper(referenceElement, this._menu, this._getPopperConfig());
  3977. } // If this is a touch-enabled device we add extra
  3978. // empty mouseover listeners to the body's immediate children;
  3979. // only needed because of broken event delegation on iOS
  3980. // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html
  3981. if ('ontouchstart' in document.documentElement && $(parent).closest(Selector$4.NAVBAR_NAV).length === 0) {
  3982. $(document.body).children().on('mouseover', null, $.noop);
  3983. }
  3984. this._element.focus();
  3985. this._element.setAttribute('aria-expanded', true);
  3986. $(this._menu).toggleClass(ClassName$4.SHOW);
  3987. $(parent).toggleClass(ClassName$4.SHOW).trigger($.Event(Event$4.SHOWN, relatedTarget));
  3988. };
  3989. _proto.hide = function hide() {
  3990. if (this._element.disabled || $(this._element).hasClass(ClassName$4.DISABLED) || !$(this._menu).hasClass(ClassName$4.SHOW)) {
  3991. return;
  3992. }
  3993. var relatedTarget = {
  3994. relatedTarget: this._element
  3995. };
  3996. var hideEvent = $.Event(Event$4.HIDE, relatedTarget);
  3997. var parent = Dropdown._getParentFromElement(this._element);
  3998. $(parent).trigger(hideEvent);
  3999. if (hideEvent.isDefaultPrevented()) {
  4000. return;
  4001. }
  4002. if (this._popper) {
  4003. this._popper.destroy();
  4004. }
  4005. $(this._menu).toggleClass(ClassName$4.SHOW);
  4006. $(parent).toggleClass(ClassName$4.SHOW).trigger($.Event(Event$4.HIDDEN, relatedTarget));
  4007. };
  4008. _proto.dispose = function dispose() {
  4009. $.removeData(this._element, DATA_KEY$4);
  4010. $(this._element).off(EVENT_KEY$4);
  4011. this._element = null;
  4012. this._menu = null;
  4013. if (this._popper !== null) {
  4014. this._popper.destroy();
  4015. this._popper = null;
  4016. }
  4017. };
  4018. _proto.update = function update() {
  4019. this._inNavbar = this._detectNavbar();
  4020. if (this._popper !== null) {
  4021. this._popper.scheduleUpdate();
  4022. }
  4023. } // Private
  4024. ;
  4025. _proto._addEventListeners = function _addEventListeners() {
  4026. var _this = this;
  4027. $(this._element).on(Event$4.CLICK, function (event) {
  4028. event.preventDefault();
  4029. event.stopPropagation();
  4030. _this.toggle();
  4031. });
  4032. };
  4033. _proto._getConfig = function _getConfig(config) {
  4034. config = _objectSpread2({}, this.constructor.Default, {}, $(this._element).data(), {}, config);
  4035. Util.typeCheckConfig(NAME$4, config, this.constructor.DefaultType);
  4036. return config;
  4037. };
  4038. _proto._getMenuElement = function _getMenuElement() {
  4039. if (!this._menu) {
  4040. var parent = Dropdown._getParentFromElement(this._element);
  4041. if (parent) {
  4042. this._menu = parent.querySelector(Selector$4.MENU);
  4043. }
  4044. }
  4045. return this._menu;
  4046. };
  4047. _proto._getPlacement = function _getPlacement() {
  4048. var $parentDropdown = $(this._element.parentNode);
  4049. var placement = AttachmentMap.BOTTOM; // Handle dropup
  4050. if ($parentDropdown.hasClass(ClassName$4.DROPUP)) {
  4051. placement = AttachmentMap.TOP;
  4052. if ($(this._menu).hasClass(ClassName$4.MENURIGHT)) {
  4053. placement = AttachmentMap.TOPEND;
  4054. }
  4055. } else if ($parentDropdown.hasClass(ClassName$4.DROPRIGHT)) {
  4056. placement = AttachmentMap.RIGHT;
  4057. } else if ($parentDropdown.hasClass(ClassName$4.DROPLEFT)) {
  4058. placement = AttachmentMap.LEFT;
  4059. } else if ($(this._menu).hasClass(ClassName$4.MENURIGHT)) {
  4060. placement = AttachmentMap.BOTTOMEND;
  4061. }
  4062. return placement;
  4063. };
  4064. _proto._detectNavbar = function _detectNavbar() {
  4065. return $(this._element).closest('.navbar').length > 0;
  4066. };
  4067. _proto._getOffset = function _getOffset() {
  4068. var _this2 = this;
  4069. var offset = {};
  4070. if (typeof this._config.offset === 'function') {
  4071. offset.fn = function (data) {
  4072. data.offsets = _objectSpread2({}, data.offsets, {}, _this2._config.offset(data.offsets, _this2._element) || {});
  4073. return data;
  4074. };
  4075. } else {
  4076. offset.offset = this._config.offset;
  4077. }
  4078. return offset;
  4079. };
  4080. _proto._getPopperConfig = function _getPopperConfig() {
  4081. var popperConfig = {
  4082. placement: this._getPlacement(),
  4083. modifiers: {
  4084. offset: this._getOffset(),
  4085. flip: {
  4086. enabled: this._config.flip
  4087. },
  4088. preventOverflow: {
  4089. boundariesElement: this._config.boundary
  4090. }
  4091. }
  4092. }; // Disable Popper.js if we have a static display
  4093. if (this._config.display === 'static') {
  4094. popperConfig.modifiers.applyStyle = {
  4095. enabled: false
  4096. };
  4097. }
  4098. return _objectSpread2({}, popperConfig, {}, this._config.popperConfig);
  4099. } // Static
  4100. ;
  4101. Dropdown._jQueryInterface = function _jQueryInterface(config) {
  4102. return this.each(function () {
  4103. var data = $(this).data(DATA_KEY$4);
  4104. var _config = typeof config === 'object' ? config : null;
  4105. if (!data) {
  4106. data = new Dropdown(this, _config);
  4107. $(this).data(DATA_KEY$4, data);
  4108. }
  4109. if (typeof config === 'string') {
  4110. if (typeof data[config] === 'undefined') {
  4111. throw new TypeError("No method named \"" + config + "\"");
  4112. }
  4113. data[config]();
  4114. }
  4115. });
  4116. };
  4117. Dropdown._clearMenus = function _clearMenus(event) {
  4118. if (event && (event.which === RIGHT_MOUSE_BUTTON_WHICH || event.type === 'keyup' && event.which !== TAB_KEYCODE)) {
  4119. return;
  4120. }
  4121. var toggles = [].slice.call(document.querySelectorAll(Selector$4.DATA_TOGGLE));
  4122. for (var i = 0, len = toggles.length; i < len; i++) {
  4123. var parent = Dropdown._getParentFromElement(toggles[i]);
  4124. var context = $(toggles[i]).data(DATA_KEY$4);
  4125. var relatedTarget = {
  4126. relatedTarget: toggles[i]
  4127. };
  4128. if (event && event.type === 'click') {
  4129. relatedTarget.clickEvent = event;
  4130. }
  4131. if (!context) {
  4132. continue;
  4133. }
  4134. var dropdownMenu = context._menu;
  4135. if (!$(parent).hasClass(ClassName$4.SHOW)) {
  4136. continue;
  4137. }
  4138. if (event && (event.type === 'click' && /input|textarea/i.test(event.target.tagName) || event.type === 'keyup' && event.which === TAB_KEYCODE) && $.contains(parent, event.target)) {
  4139. continue;
  4140. }
  4141. var hideEvent = $.Event(Event$4.HIDE, relatedTarget);
  4142. $(parent).trigger(hideEvent);
  4143. if (hideEvent.isDefaultPrevented()) {
  4144. continue;
  4145. } // If this is a touch-enabled device we remove the extra
  4146. // empty mouseover listeners we added for iOS support
  4147. if ('ontouchstart' in document.documentElement) {
  4148. $(document.body).children().off('mouseover', null, $.noop);
  4149. }
  4150. toggles[i].setAttribute('aria-expanded', 'false');
  4151. if (context._popper) {
  4152. context._popper.destroy();
  4153. }
  4154. $(dropdownMenu).removeClass(ClassName$4.SHOW);
  4155. $(parent).removeClass(ClassName$4.SHOW).trigger($.Event(Event$4.HIDDEN, relatedTarget));
  4156. }
  4157. };
  4158. Dropdown._getParentFromElement = function _getParentFromElement(element) {
  4159. var parent;
  4160. var selector = Util.getSelectorFromElement(element);
  4161. if (selector) {
  4162. parent = document.querySelector(selector);
  4163. }
  4164. return parent || element.parentNode;
  4165. } // eslint-disable-next-line complexity
  4166. ;
  4167. Dropdown._dataApiKeydownHandler = function _dataApiKeydownHandler(event) {
  4168. // If not input/textarea:
  4169. // - And not a key in REGEXP_KEYDOWN => not a dropdown command
  4170. // If input/textarea:
  4171. // - If space key => not a dropdown command
  4172. // - If key is other than escape
  4173. // - If key is not up or down => not a dropdown command
  4174. // - If trigger inside the menu => not a dropdown command
  4175. 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)) {
  4176. return;
  4177. }
  4178. event.preventDefault();
  4179. event.stopPropagation();
  4180. if (this.disabled || $(this).hasClass(ClassName$4.DISABLED)) {
  4181. return;
  4182. }
  4183. var parent = Dropdown._getParentFromElement(this);
  4184. var isActive = $(parent).hasClass(ClassName$4.SHOW);
  4185. if (!isActive && event.which === ESCAPE_KEYCODE) {
  4186. return;
  4187. }
  4188. if (!isActive || isActive && (event.which === ESCAPE_KEYCODE || event.which === SPACE_KEYCODE)) {
  4189. if (event.which === ESCAPE_KEYCODE) {
  4190. var toggle = parent.querySelector(Selector$4.DATA_TOGGLE);
  4191. $(toggle).trigger('focus');
  4192. }
  4193. $(this).trigger('click');
  4194. return;
  4195. }
  4196. var items = [].slice.call(parent.querySelectorAll(Selector$4.VISIBLE_ITEMS)).filter(function (item) {
  4197. return $(item).is(':visible');
  4198. });
  4199. if (items.length === 0) {
  4200. return;
  4201. }
  4202. var index = items.indexOf(event.target);
  4203. if (event.which === ARROW_UP_KEYCODE && index > 0) {
  4204. // Up
  4205. index--;
  4206. }
  4207. if (event.which === ARROW_DOWN_KEYCODE && index < items.length - 1) {
  4208. // Down
  4209. index++;
  4210. }
  4211. if (index < 0) {
  4212. index = 0;
  4213. }
  4214. items[index].focus();
  4215. };
  4216. _createClass(Dropdown, null, [{
  4217. key: "VERSION",
  4218. get: function get() {
  4219. return VERSION$4;
  4220. }
  4221. }, {
  4222. key: "Default",
  4223. get: function get() {
  4224. return Default$2;
  4225. }
  4226. }, {
  4227. key: "DefaultType",
  4228. get: function get() {
  4229. return DefaultType$2;
  4230. }
  4231. }]);
  4232. return Dropdown;
  4233. }();
  4234. /**
  4235. * ------------------------------------------------------------------------
  4236. * Data Api implementation
  4237. * ------------------------------------------------------------------------
  4238. */
  4239. $(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) {
  4240. event.preventDefault();
  4241. event.stopPropagation();
  4242. Dropdown._jQueryInterface.call($(this), 'toggle');
  4243. }).on(Event$4.CLICK_DATA_API, Selector$4.FORM_CHILD, function (e) {
  4244. e.stopPropagation();
  4245. });
  4246. /**
  4247. * ------------------------------------------------------------------------
  4248. * jQuery
  4249. * ------------------------------------------------------------------------
  4250. */
  4251. $.fn[NAME$4] = Dropdown._jQueryInterface;
  4252. $.fn[NAME$4].Constructor = Dropdown;
  4253. $.fn[NAME$4].noConflict = function () {
  4254. $.fn[NAME$4] = JQUERY_NO_CONFLICT$4;
  4255. return Dropdown._jQueryInterface;
  4256. };
  4257. /**
  4258. * ------------------------------------------------------------------------
  4259. * Constants
  4260. * ------------------------------------------------------------------------
  4261. */
  4262. var NAME$5 = 'modal';
  4263. var VERSION$5 = '4.4.1';
  4264. var DATA_KEY$5 = 'bs.modal';
  4265. var EVENT_KEY$5 = "." + DATA_KEY$5;
  4266. var DATA_API_KEY$5 = '.data-api';
  4267. var JQUERY_NO_CONFLICT$5 = $.fn[NAME$5];
  4268. var ESCAPE_KEYCODE$1 = 27; // KeyboardEvent.which value for Escape (Esc) key
  4269. var Default$3 = {
  4270. backdrop: true,
  4271. keyboard: true,
  4272. focus: true,
  4273. show: true
  4274. };
  4275. var DefaultType$3 = {
  4276. backdrop: '(boolean|string)',
  4277. keyboard: 'boolean',
  4278. focus: 'boolean',
  4279. show: 'boolean'
  4280. };
  4281. var Event$5 = {
  4282. HIDE: "hide" + EVENT_KEY$5,
  4283. HIDE_PREVENTED: "hidePrevented" + EVENT_KEY$5,
  4284. HIDDEN: "hidden" + EVENT_KEY$5,
  4285. SHOW: "show" + EVENT_KEY$5,
  4286. SHOWN: "shown" + EVENT_KEY$5,
  4287. FOCUSIN: "focusin" + EVENT_KEY$5,
  4288. RESIZE: "resize" + EVENT_KEY$5,
  4289. CLICK_DISMISS: "click.dismiss" + EVENT_KEY$5,
  4290. KEYDOWN_DISMISS: "keydown.dismiss" + EVENT_KEY$5,
  4291. MOUSEUP_DISMISS: "mouseup.dismiss" + EVENT_KEY$5,
  4292. MOUSEDOWN_DISMISS: "mousedown.dismiss" + EVENT_KEY$5,
  4293. CLICK_DATA_API: "click" + EVENT_KEY$5 + DATA_API_KEY$5
  4294. };
  4295. var ClassName$5 = {
  4296. SCROLLABLE: 'modal-dialog-scrollable',
  4297. SCROLLBAR_MEASURER: 'modal-scrollbar-measure',
  4298. BACKDROP: 'modal-backdrop',
  4299. OPEN: 'modal-open',
  4300. FADE: 'fade',
  4301. SHOW: 'show',
  4302. STATIC: 'modal-static'
  4303. };
  4304. var Selector$5 = {
  4305. DIALOG: '.modal-dialog',
  4306. MODAL_BODY: '.modal-body',
  4307. DATA_TOGGLE: '[data-toggle="modal"]',
  4308. DATA_DISMISS: '[data-dismiss="modal"]',
  4309. FIXED_CONTENT: '.fixed-top, .fixed-bottom, .is-fixed, .sticky-top',
  4310. STICKY_CONTENT: '.sticky-top'
  4311. };
  4312. /**
  4313. * ------------------------------------------------------------------------
  4314. * Class Definition
  4315. * ------------------------------------------------------------------------
  4316. */
  4317. var Modal =
  4318. /*#__PURE__*/
  4319. function () {
  4320. function Modal(element, config) {
  4321. this._config = this._getConfig(config);
  4322. this._element = element;
  4323. this._dialog = element.querySelector(Selector$5.DIALOG);
  4324. this._backdrop = null;
  4325. this._isShown = false;
  4326. this._isBodyOverflowing = false;
  4327. this._ignoreBackdropClick = false;
  4328. this._isTransitioning = false;
  4329. this._scrollbarWidth = 0;
  4330. } // Getters
  4331. var _proto = Modal.prototype;
  4332. // Public
  4333. _proto.toggle = function toggle(relatedTarget) {
  4334. return this._isShown ? this.hide() : this.show(relatedTarget);
  4335. };
  4336. _proto.show = function show(relatedTarget) {
  4337. var _this = this;
  4338. if (this._isShown || this._isTransitioning) {
  4339. return;
  4340. }
  4341. if ($(this._element).hasClass(ClassName$5.FADE)) {
  4342. this._isTransitioning = true;
  4343. }
  4344. var showEvent = $.Event(Event$5.SHOW, {
  4345. relatedTarget: relatedTarget
  4346. });
  4347. $(this._element).trigger(showEvent);
  4348. if (this._isShown || showEvent.isDefaultPrevented()) {
  4349. return;
  4350. }
  4351. this._isShown = true;
  4352. this._checkScrollbar();
  4353. this._setScrollbar();
  4354. this._adjustDialog();
  4355. this._setEscapeEvent();
  4356. this._setResizeEvent();
  4357. $(this._element).on(Event$5.CLICK_DISMISS, Selector$5.DATA_DISMISS, function (event) {
  4358. return _this.hide(event);
  4359. });
  4360. $(this._dialog).on(Event$5.MOUSEDOWN_DISMISS, function () {
  4361. $(_this._element).one(Event$5.MOUSEUP_DISMISS, function (event) {
  4362. if ($(event.target).is(_this._element)) {
  4363. _this._ignoreBackdropClick = true;
  4364. }
  4365. });
  4366. });
  4367. this._showBackdrop(function () {
  4368. return _this._showElement(relatedTarget);
  4369. });
  4370. };
  4371. _proto.hide = function hide(event) {
  4372. var _this2 = this;
  4373. if (event) {
  4374. event.preventDefault();
  4375. }
  4376. if (!this._isShown || this._isTransitioning) {
  4377. return;
  4378. }
  4379. var hideEvent = $.Event(Event$5.HIDE);
  4380. $(this._element).trigger(hideEvent);
  4381. if (!this._isShown || hideEvent.isDefaultPrevented()) {
  4382. return;
  4383. }
  4384. this._isShown = false;
  4385. var transition = $(this._element).hasClass(ClassName$5.FADE);
  4386. if (transition) {
  4387. this._isTransitioning = true;
  4388. }
  4389. this._setEscapeEvent();
  4390. this._setResizeEvent();
  4391. $(document).off(Event$5.FOCUSIN);
  4392. $(this._element).removeClass(ClassName$5.SHOW);
  4393. $(this._element).off(Event$5.CLICK_DISMISS);
  4394. $(this._dialog).off(Event$5.MOUSEDOWN_DISMISS);
  4395. if (transition) {
  4396. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  4397. $(this._element).one(Util.TRANSITION_END, function (event) {
  4398. return _this2._hideModal(event);
  4399. }).emulateTransitionEnd(transitionDuration);
  4400. } else {
  4401. this._hideModal();
  4402. }
  4403. };
  4404. _proto.dispose = function dispose() {
  4405. [window, this._element, this._dialog].forEach(function (htmlElement) {
  4406. return $(htmlElement).off(EVENT_KEY$5);
  4407. });
  4408. /**
  4409. * `document` has 2 events `Event.FOCUSIN` and `Event.CLICK_DATA_API`
  4410. * Do not move `document` in `htmlElements` array
  4411. * It will remove `Event.CLICK_DATA_API` event that should remain
  4412. */
  4413. $(document).off(Event$5.FOCUSIN);
  4414. $.removeData(this._element, DATA_KEY$5);
  4415. this._config = null;
  4416. this._element = null;
  4417. this._dialog = null;
  4418. this._backdrop = null;
  4419. this._isShown = null;
  4420. this._isBodyOverflowing = null;
  4421. this._ignoreBackdropClick = null;
  4422. this._isTransitioning = null;
  4423. this._scrollbarWidth = null;
  4424. };
  4425. _proto.handleUpdate = function handleUpdate() {
  4426. this._adjustDialog();
  4427. } // Private
  4428. ;
  4429. _proto._getConfig = function _getConfig(config) {
  4430. config = _objectSpread2({}, Default$3, {}, config);
  4431. Util.typeCheckConfig(NAME$5, config, DefaultType$3);
  4432. return config;
  4433. };
  4434. _proto._triggerBackdropTransition = function _triggerBackdropTransition() {
  4435. var _this3 = this;
  4436. if (this._config.backdrop === 'static') {
  4437. var hideEventPrevented = $.Event(Event$5.HIDE_PREVENTED);
  4438. $(this._element).trigger(hideEventPrevented);
  4439. if (hideEventPrevented.defaultPrevented) {
  4440. return;
  4441. }
  4442. this._element.classList.add(ClassName$5.STATIC);
  4443. var modalTransitionDuration = Util.getTransitionDurationFromElement(this._element);
  4444. $(this._element).one(Util.TRANSITION_END, function () {
  4445. _this3._element.classList.remove(ClassName$5.STATIC);
  4446. }).emulateTransitionEnd(modalTransitionDuration);
  4447. this._element.focus();
  4448. } else {
  4449. this.hide();
  4450. }
  4451. };
  4452. _proto._showElement = function _showElement(relatedTarget) {
  4453. var _this4 = this;
  4454. var transition = $(this._element).hasClass(ClassName$5.FADE);
  4455. var modalBody = this._dialog ? this._dialog.querySelector(Selector$5.MODAL_BODY) : null;
  4456. if (!this._element.parentNode || this._element.parentNode.nodeType !== Node.ELEMENT_NODE) {
  4457. // Don't move modal's DOM position
  4458. document.body.appendChild(this._element);
  4459. }
  4460. this._element.style.display = 'block';
  4461. this._element.removeAttribute('aria-hidden');
  4462. this._element.setAttribute('aria-modal', true);
  4463. if ($(this._dialog).hasClass(ClassName$5.SCROLLABLE) && modalBody) {
  4464. modalBody.scrollTop = 0;
  4465. } else {
  4466. this._element.scrollTop = 0;
  4467. }
  4468. if (transition) {
  4469. Util.reflow(this._element);
  4470. }
  4471. $(this._element).addClass(ClassName$5.SHOW);
  4472. if (this._config.focus) {
  4473. this._enforceFocus();
  4474. }
  4475. var shownEvent = $.Event(Event$5.SHOWN, {
  4476. relatedTarget: relatedTarget
  4477. });
  4478. var transitionComplete = function transitionComplete() {
  4479. if (_this4._config.focus) {
  4480. _this4._element.focus();
  4481. }
  4482. _this4._isTransitioning = false;
  4483. $(_this4._element).trigger(shownEvent);
  4484. };
  4485. if (transition) {
  4486. var transitionDuration = Util.getTransitionDurationFromElement(this._dialog);
  4487. $(this._dialog).one(Util.TRANSITION_END, transitionComplete).emulateTransitionEnd(transitionDuration);
  4488. } else {
  4489. transitionComplete();
  4490. }
  4491. };
  4492. _proto._enforceFocus = function _enforceFocus() {
  4493. var _this5 = this;
  4494. $(document).off(Event$5.FOCUSIN) // Guard against infinite focus loop
  4495. .on(Event$5.FOCUSIN, function (event) {
  4496. if (document !== event.target && _this5._element !== event.target && $(_this5._element).has(event.target).length === 0) {
  4497. _this5._element.focus();
  4498. }
  4499. });
  4500. };
  4501. _proto._setEscapeEvent = function _setEscapeEvent() {
  4502. var _this6 = this;
  4503. if (this._isShown && this._config.keyboard) {
  4504. $(this._element).on(Event$5.KEYDOWN_DISMISS, function (event) {
  4505. if (event.which === ESCAPE_KEYCODE$1) {
  4506. _this6._triggerBackdropTransition();
  4507. }
  4508. });
  4509. } else if (!this._isShown) {
  4510. $(this._element).off(Event$5.KEYDOWN_DISMISS);
  4511. }
  4512. };
  4513. _proto._setResizeEvent = function _setResizeEvent() {
  4514. var _this7 = this;
  4515. if (this._isShown) {
  4516. $(window).on(Event$5.RESIZE, function (event) {
  4517. return _this7.handleUpdate(event);
  4518. });
  4519. } else {
  4520. $(window).off(Event$5.RESIZE);
  4521. }
  4522. };
  4523. _proto._hideModal = function _hideModal() {
  4524. var _this8 = this;
  4525. this._element.style.display = 'none';
  4526. this._element.setAttribute('aria-hidden', true);
  4527. this._element.removeAttribute('aria-modal');
  4528. this._isTransitioning = false;
  4529. this._showBackdrop(function () {
  4530. $(document.body).removeClass(ClassName$5.OPEN);
  4531. _this8._resetAdjustments();
  4532. _this8._resetScrollbar();
  4533. $(_this8._element).trigger(Event$5.HIDDEN);
  4534. });
  4535. };
  4536. _proto._removeBackdrop = function _removeBackdrop() {
  4537. if (this._backdrop) {
  4538. $(this._backdrop).remove();
  4539. this._backdrop = null;
  4540. }
  4541. };
  4542. _proto._showBackdrop = function _showBackdrop(callback) {
  4543. var _this9 = this;
  4544. var animate = $(this._element).hasClass(ClassName$5.FADE) ? ClassName$5.FADE : '';
  4545. if (this._isShown && this._config.backdrop) {
  4546. this._backdrop = document.createElement('div');
  4547. this._backdrop.className = ClassName$5.BACKDROP;
  4548. if (animate) {
  4549. this._backdrop.classList.add(animate);
  4550. }
  4551. $(this._backdrop).appendTo(document.body);
  4552. $(this._element).on(Event$5.CLICK_DISMISS, function (event) {
  4553. if (_this9._ignoreBackdropClick) {
  4554. _this9._ignoreBackdropClick = false;
  4555. return;
  4556. }
  4557. if (event.target !== event.currentTarget) {
  4558. return;
  4559. }
  4560. _this9._triggerBackdropTransition();
  4561. });
  4562. if (animate) {
  4563. Util.reflow(this._backdrop);
  4564. }
  4565. $(this._backdrop).addClass(ClassName$5.SHOW);
  4566. if (!callback) {
  4567. return;
  4568. }
  4569. if (!animate) {
  4570. callback();
  4571. return;
  4572. }
  4573. var backdropTransitionDuration = Util.getTransitionDurationFromElement(this._backdrop);
  4574. $(this._backdrop).one(Util.TRANSITION_END, callback).emulateTransitionEnd(backdropTransitionDuration);
  4575. } else if (!this._isShown && this._backdrop) {
  4576. $(this._backdrop).removeClass(ClassName$5.SHOW);
  4577. var callbackRemove = function callbackRemove() {
  4578. _this9._removeBackdrop();
  4579. if (callback) {
  4580. callback();
  4581. }
  4582. };
  4583. if ($(this._element).hasClass(ClassName$5.FADE)) {
  4584. var _backdropTransitionDuration = Util.getTransitionDurationFromElement(this._backdrop);
  4585. $(this._backdrop).one(Util.TRANSITION_END, callbackRemove).emulateTransitionEnd(_backdropTransitionDuration);
  4586. } else {
  4587. callbackRemove();
  4588. }
  4589. } else if (callback) {
  4590. callback();
  4591. }
  4592. } // ----------------------------------------------------------------------
  4593. // the following methods are used to handle overflowing modals
  4594. // todo (fat): these should probably be refactored out of modal.js
  4595. // ----------------------------------------------------------------------
  4596. ;
  4597. _proto._adjustDialog = function _adjustDialog() {
  4598. var isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight;
  4599. if (!this._isBodyOverflowing && isModalOverflowing) {
  4600. this._element.style.paddingLeft = this._scrollbarWidth + "px";
  4601. }
  4602. if (this._isBodyOverflowing && !isModalOverflowing) {
  4603. this._element.style.paddingRight = this._scrollbarWidth + "px";
  4604. }
  4605. };
  4606. _proto._resetAdjustments = function _resetAdjustments() {
  4607. this._element.style.paddingLeft = '';
  4608. this._element.style.paddingRight = '';
  4609. };
  4610. _proto._checkScrollbar = function _checkScrollbar() {
  4611. var rect = document.body.getBoundingClientRect();
  4612. this._isBodyOverflowing = rect.left + rect.right < window.innerWidth;
  4613. this._scrollbarWidth = this._getScrollbarWidth();
  4614. };
  4615. _proto._setScrollbar = function _setScrollbar() {
  4616. var _this10 = this;
  4617. if (this._isBodyOverflowing) {
  4618. // Note: DOMNode.style.paddingRight returns the actual value or '' if not set
  4619. // while $(DOMNode).css('padding-right') returns the calculated value or 0 if not set
  4620. var fixedContent = [].slice.call(document.querySelectorAll(Selector$5.FIXED_CONTENT));
  4621. var stickyContent = [].slice.call(document.querySelectorAll(Selector$5.STICKY_CONTENT)); // Adjust fixed content padding
  4622. $(fixedContent).each(function (index, element) {
  4623. var actualPadding = element.style.paddingRight;
  4624. var calculatedPadding = $(element).css('padding-right');
  4625. $(element).data('padding-right', actualPadding).css('padding-right', parseFloat(calculatedPadding) + _this10._scrollbarWidth + "px");
  4626. }); // Adjust sticky content margin
  4627. $(stickyContent).each(function (index, element) {
  4628. var actualMargin = element.style.marginRight;
  4629. var calculatedMargin = $(element).css('margin-right');
  4630. $(element).data('margin-right', actualMargin).css('margin-right', parseFloat(calculatedMargin) - _this10._scrollbarWidth + "px");
  4631. }); // Adjust body padding
  4632. var actualPadding = document.body.style.paddingRight;
  4633. var calculatedPadding = $(document.body).css('padding-right');
  4634. $(document.body).data('padding-right', actualPadding).css('padding-right', parseFloat(calculatedPadding) + this._scrollbarWidth + "px");
  4635. }
  4636. $(document.body).addClass(ClassName$5.OPEN);
  4637. };
  4638. _proto._resetScrollbar = function _resetScrollbar() {
  4639. // Restore fixed content padding
  4640. var fixedContent = [].slice.call(document.querySelectorAll(Selector$5.FIXED_CONTENT));
  4641. $(fixedContent).each(function (index, element) {
  4642. var padding = $(element).data('padding-right');
  4643. $(element).removeData('padding-right');
  4644. element.style.paddingRight = padding ? padding : '';
  4645. }); // Restore sticky content
  4646. var elements = [].slice.call(document.querySelectorAll("" + Selector$5.STICKY_CONTENT));
  4647. $(elements).each(function (index, element) {
  4648. var margin = $(element).data('margin-right');
  4649. if (typeof margin !== 'undefined') {
  4650. $(element).css('margin-right', margin).removeData('margin-right');
  4651. }
  4652. }); // Restore body padding
  4653. var padding = $(document.body).data('padding-right');
  4654. $(document.body).removeData('padding-right');
  4655. document.body.style.paddingRight = padding ? padding : '';
  4656. };
  4657. _proto._getScrollbarWidth = function _getScrollbarWidth() {
  4658. // thx d.walsh
  4659. var scrollDiv = document.createElement('div');
  4660. scrollDiv.className = ClassName$5.SCROLLBAR_MEASURER;
  4661. document.body.appendChild(scrollDiv);
  4662. var scrollbarWidth = scrollDiv.getBoundingClientRect().width - scrollDiv.clientWidth;
  4663. document.body.removeChild(scrollDiv);
  4664. return scrollbarWidth;
  4665. } // Static
  4666. ;
  4667. Modal._jQueryInterface = function _jQueryInterface(config, relatedTarget) {
  4668. return this.each(function () {
  4669. var data = $(this).data(DATA_KEY$5);
  4670. var _config = _objectSpread2({}, Default$3, {}, $(this).data(), {}, typeof config === 'object' && config ? config : {});
  4671. if (!data) {
  4672. data = new Modal(this, _config);
  4673. $(this).data(DATA_KEY$5, data);
  4674. }
  4675. if (typeof config === 'string') {
  4676. if (typeof data[config] === 'undefined') {
  4677. throw new TypeError("No method named \"" + config + "\"");
  4678. }
  4679. data[config](relatedTarget);
  4680. } else if (_config.show) {
  4681. data.show(relatedTarget);
  4682. }
  4683. });
  4684. };
  4685. _createClass(Modal, null, [{
  4686. key: "VERSION",
  4687. get: function get() {
  4688. return VERSION$5;
  4689. }
  4690. }, {
  4691. key: "Default",
  4692. get: function get() {
  4693. return Default$3;
  4694. }
  4695. }]);
  4696. return Modal;
  4697. }();
  4698. /**
  4699. * ------------------------------------------------------------------------
  4700. * Data Api implementation
  4701. * ------------------------------------------------------------------------
  4702. */
  4703. $(document).on(Event$5.CLICK_DATA_API, Selector$5.DATA_TOGGLE, function (event) {
  4704. var _this11 = this;
  4705. var target;
  4706. var selector = Util.getSelectorFromElement(this);
  4707. if (selector) {
  4708. target = document.querySelector(selector);
  4709. }
  4710. var config = $(target).data(DATA_KEY$5) ? 'toggle' : _objectSpread2({}, $(target).data(), {}, $(this).data());
  4711. if (this.tagName === 'A' || this.tagName === 'AREA') {
  4712. event.preventDefault();
  4713. }
  4714. var $target = $(target).one(Event$5.SHOW, function (showEvent) {
  4715. if (showEvent.isDefaultPrevented()) {
  4716. // Only register focus restorer if modal will actually get shown
  4717. return;
  4718. }
  4719. $target.one(Event$5.HIDDEN, function () {
  4720. if ($(_this11).is(':visible')) {
  4721. _this11.focus();
  4722. }
  4723. });
  4724. });
  4725. Modal._jQueryInterface.call($(target), config, this);
  4726. });
  4727. /**
  4728. * ------------------------------------------------------------------------
  4729. * jQuery
  4730. * ------------------------------------------------------------------------
  4731. */
  4732. $.fn[NAME$5] = Modal._jQueryInterface;
  4733. $.fn[NAME$5].Constructor = Modal;
  4734. $.fn[NAME$5].noConflict = function () {
  4735. $.fn[NAME$5] = JQUERY_NO_CONFLICT$5;
  4736. return Modal._jQueryInterface;
  4737. };
  4738. /**
  4739. * --------------------------------------------------------------------------
  4740. * Bootstrap (v4.4.1): tools/sanitizer.js
  4741. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  4742. * --------------------------------------------------------------------------
  4743. */
  4744. var uriAttrs = ['background', 'cite', 'href', 'itemtype', 'longdesc', 'poster', 'src', 'xlink:href'];
  4745. var ARIA_ATTRIBUTE_PATTERN = /^aria-[\w-]*$/i;
  4746. var DefaultWhitelist = {
  4747. // Global attributes allowed on any supplied element below.
  4748. '*': ['class', 'dir', 'id', 'lang', 'role', ARIA_ATTRIBUTE_PATTERN],
  4749. a: ['target', 'href', 'title', 'rel'],
  4750. area: [],
  4751. b: [],
  4752. br: [],
  4753. col: [],
  4754. code: [],
  4755. div: [],
  4756. em: [],
  4757. hr: [],
  4758. h1: [],
  4759. h2: [],
  4760. h3: [],
  4761. h4: [],
  4762. h5: [],
  4763. h6: [],
  4764. i: [],
  4765. img: ['src', 'alt', 'title', 'width', 'height'],
  4766. li: [],
  4767. ol: [],
  4768. p: [],
  4769. pre: [],
  4770. s: [],
  4771. small: [],
  4772. span: [],
  4773. sub: [],
  4774. sup: [],
  4775. strong: [],
  4776. u: [],
  4777. ul: []
  4778. };
  4779. /**
  4780. * A pattern that recognizes a commonly useful subset of URLs that are safe.
  4781. *
  4782. * Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts
  4783. */
  4784. var SAFE_URL_PATTERN = /^(?:(?:https?|mailto|ftp|tel|file):|[^&:/?#]*(?:[/?#]|$))/gi;
  4785. /**
  4786. * A pattern that matches safe data URLs. Only matches image, video and audio types.
  4787. *
  4788. * Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts
  4789. */
  4790. 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;
  4791. function allowedAttribute(attr, allowedAttributeList) {
  4792. var attrName = attr.nodeName.toLowerCase();
  4793. if (allowedAttributeList.indexOf(attrName) !== -1) {
  4794. if (uriAttrs.indexOf(attrName) !== -1) {
  4795. return Boolean(attr.nodeValue.match(SAFE_URL_PATTERN) || attr.nodeValue.match(DATA_URL_PATTERN));
  4796. }
  4797. return true;
  4798. }
  4799. var regExp = allowedAttributeList.filter(function (attrRegex) {
  4800. return attrRegex instanceof RegExp;
  4801. }); // Check if a regular expression validates the attribute.
  4802. for (var i = 0, l = regExp.length; i < l; i++) {
  4803. if (attrName.match(regExp[i])) {
  4804. return true;
  4805. }
  4806. }
  4807. return false;
  4808. }
  4809. function sanitizeHtml(unsafeHtml, whiteList, sanitizeFn) {
  4810. if (unsafeHtml.length === 0) {
  4811. return unsafeHtml;
  4812. }
  4813. if (sanitizeFn && typeof sanitizeFn === 'function') {
  4814. return sanitizeFn(unsafeHtml);
  4815. }
  4816. var domParser = new window.DOMParser();
  4817. var createdDocument = domParser.parseFromString(unsafeHtml, 'text/html');
  4818. var whitelistKeys = Object.keys(whiteList);
  4819. var elements = [].slice.call(createdDocument.body.querySelectorAll('*'));
  4820. var _loop = function _loop(i, len) {
  4821. var el = elements[i];
  4822. var elName = el.nodeName.toLowerCase();
  4823. if (whitelistKeys.indexOf(el.nodeName.toLowerCase()) === -1) {
  4824. el.parentNode.removeChild(el);
  4825. return "continue";
  4826. }
  4827. var attributeList = [].slice.call(el.attributes);
  4828. var whitelistedAttributes = [].concat(whiteList['*'] || [], whiteList[elName] || []);
  4829. attributeList.forEach(function (attr) {
  4830. if (!allowedAttribute(attr, whitelistedAttributes)) {
  4831. el.removeAttribute(attr.nodeName);
  4832. }
  4833. });
  4834. };
  4835. for (var i = 0, len = elements.length; i < len; i++) {
  4836. var _ret = _loop(i);
  4837. if (_ret === "continue") continue;
  4838. }
  4839. return createdDocument.body.innerHTML;
  4840. }
  4841. /**
  4842. * ------------------------------------------------------------------------
  4843. * Constants
  4844. * ------------------------------------------------------------------------
  4845. */
  4846. var NAME$6 = 'tooltip';
  4847. var VERSION$6 = '4.4.1';
  4848. var DATA_KEY$6 = 'bs.tooltip';
  4849. var EVENT_KEY$6 = "." + DATA_KEY$6;
  4850. var JQUERY_NO_CONFLICT$6 = $.fn[NAME$6];
  4851. var CLASS_PREFIX = 'bs-tooltip';
  4852. var BSCLS_PREFIX_REGEX = new RegExp("(^|\\s)" + CLASS_PREFIX + "\\S+", 'g');
  4853. var DISALLOWED_ATTRIBUTES = ['sanitize', 'whiteList', 'sanitizeFn'];
  4854. var DefaultType$4 = {
  4855. animation: 'boolean',
  4856. template: 'string',
  4857. title: '(string|element|function)',
  4858. trigger: 'string',
  4859. delay: '(number|object)',
  4860. html: 'boolean',
  4861. selector: '(string|boolean)',
  4862. placement: '(string|function)',
  4863. offset: '(number|string|function)',
  4864. container: '(string|element|boolean)',
  4865. fallbackPlacement: '(string|array)',
  4866. boundary: '(string|element)',
  4867. sanitize: 'boolean',
  4868. sanitizeFn: '(null|function)',
  4869. whiteList: 'object',
  4870. popperConfig: '(null|object)'
  4871. };
  4872. var AttachmentMap$1 = {
  4873. AUTO: 'auto',
  4874. TOP: 'top',
  4875. RIGHT: 'right',
  4876. BOTTOM: 'bottom',
  4877. LEFT: 'left'
  4878. };
  4879. var Default$4 = {
  4880. animation: true,
  4881. template: '<div class="tooltip" role="tooltip">' + '<div class="arrow"></div>' + '<div class="tooltip-inner"></div></div>',
  4882. trigger: 'hover focus',
  4883. title: '',
  4884. delay: 0,
  4885. html: false,
  4886. selector: false,
  4887. placement: 'top',
  4888. offset: 0,
  4889. container: false,
  4890. fallbackPlacement: 'flip',
  4891. boundary: 'scrollParent',
  4892. sanitize: true,
  4893. sanitizeFn: null,
  4894. whiteList: DefaultWhitelist,
  4895. popperConfig: null
  4896. };
  4897. var HoverState = {
  4898. SHOW: 'show',
  4899. OUT: 'out'
  4900. };
  4901. var Event$6 = {
  4902. HIDE: "hide" + EVENT_KEY$6,
  4903. HIDDEN: "hidden" + EVENT_KEY$6,
  4904. SHOW: "show" + EVENT_KEY$6,
  4905. SHOWN: "shown" + EVENT_KEY$6,
  4906. INSERTED: "inserted" + EVENT_KEY$6,
  4907. CLICK: "click" + EVENT_KEY$6,
  4908. FOCUSIN: "focusin" + EVENT_KEY$6,
  4909. FOCUSOUT: "focusout" + EVENT_KEY$6,
  4910. MOUSEENTER: "mouseenter" + EVENT_KEY$6,
  4911. MOUSELEAVE: "mouseleave" + EVENT_KEY$6
  4912. };
  4913. var ClassName$6 = {
  4914. FADE: 'fade',
  4915. SHOW: 'show'
  4916. };
  4917. var Selector$6 = {
  4918. TOOLTIP: '.tooltip',
  4919. TOOLTIP_INNER: '.tooltip-inner',
  4920. ARROW: '.arrow'
  4921. };
  4922. var Trigger = {
  4923. HOVER: 'hover',
  4924. FOCUS: 'focus',
  4925. CLICK: 'click',
  4926. MANUAL: 'manual'
  4927. };
  4928. /**
  4929. * ------------------------------------------------------------------------
  4930. * Class Definition
  4931. * ------------------------------------------------------------------------
  4932. */
  4933. var Tooltip =
  4934. /*#__PURE__*/
  4935. function () {
  4936. function Tooltip(element, config) {
  4937. if (typeof Popper === 'undefined') {
  4938. throw new TypeError('Bootstrap\'s tooltips require Popper.js (https://popper.js.org/)');
  4939. } // private
  4940. this._isEnabled = true;
  4941. this._timeout = 0;
  4942. this._hoverState = '';
  4943. this._activeTrigger = {};
  4944. this._popper = null; // Protected
  4945. this.element = element;
  4946. this.config = this._getConfig(config);
  4947. this.tip = null;
  4948. this._setListeners();
  4949. } // Getters
  4950. var _proto = Tooltip.prototype;
  4951. // Public
  4952. _proto.enable = function enable() {
  4953. this._isEnabled = true;
  4954. };
  4955. _proto.disable = function disable() {
  4956. this._isEnabled = false;
  4957. };
  4958. _proto.toggleEnabled = function toggleEnabled() {
  4959. this._isEnabled = !this._isEnabled;
  4960. };
  4961. _proto.toggle = function toggle(event) {
  4962. if (!this._isEnabled) {
  4963. return;
  4964. }
  4965. if (event) {
  4966. var dataKey = this.constructor.DATA_KEY;
  4967. var context = $(event.currentTarget).data(dataKey);
  4968. if (!context) {
  4969. context = new this.constructor(event.currentTarget, this._getDelegateConfig());
  4970. $(event.currentTarget).data(dataKey, context);
  4971. }
  4972. context._activeTrigger.click = !context._activeTrigger.click;
  4973. if (context._isWithActiveTrigger()) {
  4974. context._enter(null, context);
  4975. } else {
  4976. context._leave(null, context);
  4977. }
  4978. } else {
  4979. if ($(this.getTipElement()).hasClass(ClassName$6.SHOW)) {
  4980. this._leave(null, this);
  4981. return;
  4982. }
  4983. this._enter(null, this);
  4984. }
  4985. };
  4986. _proto.dispose = function dispose() {
  4987. clearTimeout(this._timeout);
  4988. $.removeData(this.element, this.constructor.DATA_KEY);
  4989. $(this.element).off(this.constructor.EVENT_KEY);
  4990. $(this.element).closest('.modal').off('hide.bs.modal', this._hideModalHandler);
  4991. if (this.tip) {
  4992. $(this.tip).remove();
  4993. }
  4994. this._isEnabled = null;
  4995. this._timeout = null;
  4996. this._hoverState = null;
  4997. this._activeTrigger = null;
  4998. if (this._popper) {
  4999. this._popper.destroy();
  5000. }
  5001. this._popper = null;
  5002. this.element = null;
  5003. this.config = null;
  5004. this.tip = null;
  5005. };
  5006. _proto.show = function show() {
  5007. var _this = this;
  5008. if ($(this.element).css('display') === 'none') {
  5009. throw new Error('Please use show on visible elements');
  5010. }
  5011. var showEvent = $.Event(this.constructor.Event.SHOW);
  5012. if (this.isWithContent() && this._isEnabled) {
  5013. $(this.element).trigger(showEvent);
  5014. var shadowRoot = Util.findShadowRoot(this.element);
  5015. var isInTheDom = $.contains(shadowRoot !== null ? shadowRoot : this.element.ownerDocument.documentElement, this.element);
  5016. if (showEvent.isDefaultPrevented() || !isInTheDom) {
  5017. return;
  5018. }
  5019. var tip = this.getTipElement();
  5020. var tipId = Util.getUID(this.constructor.NAME);
  5021. tip.setAttribute('id', tipId);
  5022. this.element.setAttribute('aria-describedby', tipId);
  5023. this.setContent();
  5024. if (this.config.animation) {
  5025. $(tip).addClass(ClassName$6.FADE);
  5026. }
  5027. var placement = typeof this.config.placement === 'function' ? this.config.placement.call(this, tip, this.element) : this.config.placement;
  5028. var attachment = this._getAttachment(placement);
  5029. this.addAttachmentClass(attachment);
  5030. var container = this._getContainer();
  5031. $(tip).data(this.constructor.DATA_KEY, this);
  5032. if (!$.contains(this.element.ownerDocument.documentElement, this.tip)) {
  5033. $(tip).appendTo(container);
  5034. }
  5035. $(this.element).trigger(this.constructor.Event.INSERTED);
  5036. this._popper = new Popper(this.element, tip, this._getPopperConfig(attachment));
  5037. $(tip).addClass(ClassName$6.SHOW); // If this is a touch-enabled device we add extra
  5038. // empty mouseover listeners to the body's immediate children;
  5039. // only needed because of broken event delegation on iOS
  5040. // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html
  5041. if ('ontouchstart' in document.documentElement) {
  5042. $(document.body).children().on('mouseover', null, $.noop);
  5043. }
  5044. var complete = function complete() {
  5045. if (_this.config.animation) {
  5046. _this._fixTransition();
  5047. }
  5048. var prevHoverState = _this._hoverState;
  5049. _this._hoverState = null;
  5050. $(_this.element).trigger(_this.constructor.Event.SHOWN);
  5051. if (prevHoverState === HoverState.OUT) {
  5052. _this._leave(null, _this);
  5053. }
  5054. };
  5055. if ($(this.tip).hasClass(ClassName$6.FADE)) {
  5056. var transitionDuration = Util.getTransitionDurationFromElement(this.tip);
  5057. $(this.tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  5058. } else {
  5059. complete();
  5060. }
  5061. }
  5062. };
  5063. _proto.hide = function hide(callback) {
  5064. var _this2 = this;
  5065. var tip = this.getTipElement();
  5066. var hideEvent = $.Event(this.constructor.Event.HIDE);
  5067. var complete = function complete() {
  5068. if (_this2._hoverState !== HoverState.SHOW && tip.parentNode) {
  5069. tip.parentNode.removeChild(tip);
  5070. }
  5071. _this2._cleanTipClass();
  5072. _this2.element.removeAttribute('aria-describedby');
  5073. $(_this2.element).trigger(_this2.constructor.Event.HIDDEN);
  5074. if (_this2._popper !== null) {
  5075. _this2._popper.destroy();
  5076. }
  5077. if (callback) {
  5078. callback();
  5079. }
  5080. };
  5081. $(this.element).trigger(hideEvent);
  5082. if (hideEvent.isDefaultPrevented()) {
  5083. return;
  5084. }
  5085. $(tip).removeClass(ClassName$6.SHOW); // If this is a touch-enabled device we remove the extra
  5086. // empty mouseover listeners we added for iOS support
  5087. if ('ontouchstart' in document.documentElement) {
  5088. $(document.body).children().off('mouseover', null, $.noop);
  5089. }
  5090. this._activeTrigger[Trigger.CLICK] = false;
  5091. this._activeTrigger[Trigger.FOCUS] = false;
  5092. this._activeTrigger[Trigger.HOVER] = false;
  5093. if ($(this.tip).hasClass(ClassName$6.FADE)) {
  5094. var transitionDuration = Util.getTransitionDurationFromElement(tip);
  5095. $(tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  5096. } else {
  5097. complete();
  5098. }
  5099. this._hoverState = '';
  5100. };
  5101. _proto.update = function update() {
  5102. if (this._popper !== null) {
  5103. this._popper.scheduleUpdate();
  5104. }
  5105. } // Protected
  5106. ;
  5107. _proto.isWithContent = function isWithContent() {
  5108. return Boolean(this.getTitle());
  5109. };
  5110. _proto.addAttachmentClass = function addAttachmentClass(attachment) {
  5111. $(this.getTipElement()).addClass(CLASS_PREFIX + "-" + attachment);
  5112. };
  5113. _proto.getTipElement = function getTipElement() {
  5114. this.tip = this.tip || $(this.config.template)[0];
  5115. return this.tip;
  5116. };
  5117. _proto.setContent = function setContent() {
  5118. var tip = this.getTipElement();
  5119. this.setElementContent($(tip.querySelectorAll(Selector$6.TOOLTIP_INNER)), this.getTitle());
  5120. $(tip).removeClass(ClassName$6.FADE + " " + ClassName$6.SHOW);
  5121. };
  5122. _proto.setElementContent = function setElementContent($element, content) {
  5123. if (typeof content === 'object' && (content.nodeType || content.jquery)) {
  5124. // Content is a DOM node or a jQuery
  5125. if (this.config.html) {
  5126. if (!$(content).parent().is($element)) {
  5127. $element.empty().append(content);
  5128. }
  5129. } else {
  5130. $element.text($(content).text());
  5131. }
  5132. return;
  5133. }
  5134. if (this.config.html) {
  5135. if (this.config.sanitize) {
  5136. content = sanitizeHtml(content, this.config.whiteList, this.config.sanitizeFn);
  5137. }
  5138. $element.html(content);
  5139. } else {
  5140. $element.text(content);
  5141. }
  5142. };
  5143. _proto.getTitle = function getTitle() {
  5144. var title = this.element.getAttribute('data-original-title');
  5145. if (!title) {
  5146. title = typeof this.config.title === 'function' ? this.config.title.call(this.element) : this.config.title;
  5147. }
  5148. return title;
  5149. } // Private
  5150. ;
  5151. _proto._getPopperConfig = function _getPopperConfig(attachment) {
  5152. var _this3 = this;
  5153. var defaultBsConfig = {
  5154. placement: attachment,
  5155. modifiers: {
  5156. offset: this._getOffset(),
  5157. flip: {
  5158. behavior: this.config.fallbackPlacement
  5159. },
  5160. arrow: {
  5161. element: Selector$6.ARROW
  5162. },
  5163. preventOverflow: {
  5164. boundariesElement: this.config.boundary
  5165. }
  5166. },
  5167. onCreate: function onCreate(data) {
  5168. if (data.originalPlacement !== data.placement) {
  5169. _this3._handlePopperPlacementChange(data);
  5170. }
  5171. },
  5172. onUpdate: function onUpdate(data) {
  5173. return _this3._handlePopperPlacementChange(data);
  5174. }
  5175. };
  5176. return _objectSpread2({}, defaultBsConfig, {}, this.config.popperConfig);
  5177. };
  5178. _proto._getOffset = function _getOffset() {
  5179. var _this4 = this;
  5180. var offset = {};
  5181. if (typeof this.config.offset === 'function') {
  5182. offset.fn = function (data) {
  5183. data.offsets = _objectSpread2({}, data.offsets, {}, _this4.config.offset(data.offsets, _this4.element) || {});
  5184. return data;
  5185. };
  5186. } else {
  5187. offset.offset = this.config.offset;
  5188. }
  5189. return offset;
  5190. };
  5191. _proto._getContainer = function _getContainer() {
  5192. if (this.config.container === false) {
  5193. return document.body;
  5194. }
  5195. if (Util.isElement(this.config.container)) {
  5196. return $(this.config.container);
  5197. }
  5198. return $(document).find(this.config.container);
  5199. };
  5200. _proto._getAttachment = function _getAttachment(placement) {
  5201. return AttachmentMap$1[placement.toUpperCase()];
  5202. };
  5203. _proto._setListeners = function _setListeners() {
  5204. var _this5 = this;
  5205. var triggers = this.config.trigger.split(' ');
  5206. triggers.forEach(function (trigger) {
  5207. if (trigger === 'click') {
  5208. $(_this5.element).on(_this5.constructor.Event.CLICK, _this5.config.selector, function (event) {
  5209. return _this5.toggle(event);
  5210. });
  5211. } else if (trigger !== Trigger.MANUAL) {
  5212. var eventIn = trigger === Trigger.HOVER ? _this5.constructor.Event.MOUSEENTER : _this5.constructor.Event.FOCUSIN;
  5213. var eventOut = trigger === Trigger.HOVER ? _this5.constructor.Event.MOUSELEAVE : _this5.constructor.Event.FOCUSOUT;
  5214. $(_this5.element).on(eventIn, _this5.config.selector, function (event) {
  5215. return _this5._enter(event);
  5216. }).on(eventOut, _this5.config.selector, function (event) {
  5217. return _this5._leave(event);
  5218. });
  5219. }
  5220. });
  5221. this._hideModalHandler = function () {
  5222. if (_this5.element) {
  5223. _this5.hide();
  5224. }
  5225. };
  5226. $(this.element).closest('.modal').on('hide.bs.modal', this._hideModalHandler);
  5227. if (this.config.selector) {
  5228. this.config = _objectSpread2({}, this.config, {
  5229. trigger: 'manual',
  5230. selector: ''
  5231. });
  5232. } else {
  5233. this._fixTitle();
  5234. }
  5235. };
  5236. _proto._fixTitle = function _fixTitle() {
  5237. var titleType = typeof this.element.getAttribute('data-original-title');
  5238. if (this.element.getAttribute('title') || titleType !== 'string') {
  5239. this.element.setAttribute('data-original-title', this.element.getAttribute('title') || '');
  5240. this.element.setAttribute('title', '');
  5241. }
  5242. };
  5243. _proto._enter = function _enter(event, context) {
  5244. var dataKey = this.constructor.DATA_KEY;
  5245. context = context || $(event.currentTarget).data(dataKey);
  5246. if (!context) {
  5247. context = new this.constructor(event.currentTarget, this._getDelegateConfig());
  5248. $(event.currentTarget).data(dataKey, context);
  5249. }
  5250. if (event) {
  5251. context._activeTrigger[event.type === 'focusin' ? Trigger.FOCUS : Trigger.HOVER] = true;
  5252. }
  5253. if ($(context.getTipElement()).hasClass(ClassName$6.SHOW) || context._hoverState === HoverState.SHOW) {
  5254. context._hoverState = HoverState.SHOW;
  5255. return;
  5256. }
  5257. clearTimeout(context._timeout);
  5258. context._hoverState = HoverState.SHOW;
  5259. if (!context.config.delay || !context.config.delay.show) {
  5260. context.show();
  5261. return;
  5262. }
  5263. context._timeout = setTimeout(function () {
  5264. if (context._hoverState === HoverState.SHOW) {
  5265. context.show();
  5266. }
  5267. }, context.config.delay.show);
  5268. };
  5269. _proto._leave = function _leave(event, context) {
  5270. var dataKey = this.constructor.DATA_KEY;
  5271. context = context || $(event.currentTarget).data(dataKey);
  5272. if (!context) {
  5273. context = new this.constructor(event.currentTarget, this._getDelegateConfig());
  5274. $(event.currentTarget).data(dataKey, context);
  5275. }
  5276. if (event) {
  5277. context._activeTrigger[event.type === 'focusout' ? Trigger.FOCUS : Trigger.HOVER] = false;
  5278. }
  5279. if (context._isWithActiveTrigger()) {
  5280. return;
  5281. }
  5282. clearTimeout(context._timeout);
  5283. context._hoverState = HoverState.OUT;
  5284. if (!context.config.delay || !context.config.delay.hide) {
  5285. context.hide();
  5286. return;
  5287. }
  5288. context._timeout = setTimeout(function () {
  5289. if (context._hoverState === HoverState.OUT) {
  5290. context.hide();
  5291. }
  5292. }, context.config.delay.hide);
  5293. };
  5294. _proto._isWithActiveTrigger = function _isWithActiveTrigger() {
  5295. for (var trigger in this._activeTrigger) {
  5296. if (this._activeTrigger[trigger]) {
  5297. return true;
  5298. }
  5299. }
  5300. return false;
  5301. };
  5302. _proto._getConfig = function _getConfig(config) {
  5303. var dataAttributes = $(this.element).data();
  5304. Object.keys(dataAttributes).forEach(function (dataAttr) {
  5305. if (DISALLOWED_ATTRIBUTES.indexOf(dataAttr) !== -1) {
  5306. delete dataAttributes[dataAttr];
  5307. }
  5308. });
  5309. config = _objectSpread2({}, this.constructor.Default, {}, dataAttributes, {}, typeof config === 'object' && config ? config : {});
  5310. if (typeof config.delay === 'number') {
  5311. config.delay = {
  5312. show: config.delay,
  5313. hide: config.delay
  5314. };
  5315. }
  5316. if (typeof config.title === 'number') {
  5317. config.title = config.title.toString();
  5318. }
  5319. if (typeof config.content === 'number') {
  5320. config.content = config.content.toString();
  5321. }
  5322. Util.typeCheckConfig(NAME$6, config, this.constructor.DefaultType);
  5323. if (config.sanitize) {
  5324. config.template = sanitizeHtml(config.template, config.whiteList, config.sanitizeFn);
  5325. }
  5326. return config;
  5327. };
  5328. _proto._getDelegateConfig = function _getDelegateConfig() {
  5329. var config = {};
  5330. if (this.config) {
  5331. for (var key in this.config) {
  5332. if (this.constructor.Default[key] !== this.config[key]) {
  5333. config[key] = this.config[key];
  5334. }
  5335. }
  5336. }
  5337. return config;
  5338. };
  5339. _proto._cleanTipClass = function _cleanTipClass() {
  5340. var $tip = $(this.getTipElement());
  5341. var tabClass = $tip.attr('class').match(BSCLS_PREFIX_REGEX);
  5342. if (tabClass !== null && tabClass.length) {
  5343. $tip.removeClass(tabClass.join(''));
  5344. }
  5345. };
  5346. _proto._handlePopperPlacementChange = function _handlePopperPlacementChange(popperData) {
  5347. var popperInstance = popperData.instance;
  5348. this.tip = popperInstance.popper;
  5349. this._cleanTipClass();
  5350. this.addAttachmentClass(this._getAttachment(popperData.placement));
  5351. };
  5352. _proto._fixTransition = function _fixTransition() {
  5353. var tip = this.getTipElement();
  5354. var initConfigAnimation = this.config.animation;
  5355. if (tip.getAttribute('x-placement') !== null) {
  5356. return;
  5357. }
  5358. $(tip).removeClass(ClassName$6.FADE);
  5359. this.config.animation = false;
  5360. this.hide();
  5361. this.show();
  5362. this.config.animation = initConfigAnimation;
  5363. } // Static
  5364. ;
  5365. Tooltip._jQueryInterface = function _jQueryInterface(config) {
  5366. return this.each(function () {
  5367. var data = $(this).data(DATA_KEY$6);
  5368. var _config = typeof config === 'object' && config;
  5369. if (!data && /dispose|hide/.test(config)) {
  5370. return;
  5371. }
  5372. if (!data) {
  5373. data = new Tooltip(this, _config);
  5374. $(this).data(DATA_KEY$6, data);
  5375. }
  5376. if (typeof config === 'string') {
  5377. if (typeof data[config] === 'undefined') {
  5378. throw new TypeError("No method named \"" + config + "\"");
  5379. }
  5380. data[config]();
  5381. }
  5382. });
  5383. };
  5384. _createClass(Tooltip, null, [{
  5385. key: "VERSION",
  5386. get: function get() {
  5387. return VERSION$6;
  5388. }
  5389. }, {
  5390. key: "Default",
  5391. get: function get() {
  5392. return Default$4;
  5393. }
  5394. }, {
  5395. key: "NAME",
  5396. get: function get() {
  5397. return NAME$6;
  5398. }
  5399. }, {
  5400. key: "DATA_KEY",
  5401. get: function get() {
  5402. return DATA_KEY$6;
  5403. }
  5404. }, {
  5405. key: "Event",
  5406. get: function get() {
  5407. return Event$6;
  5408. }
  5409. }, {
  5410. key: "EVENT_KEY",
  5411. get: function get() {
  5412. return EVENT_KEY$6;
  5413. }
  5414. }, {
  5415. key: "DefaultType",
  5416. get: function get() {
  5417. return DefaultType$4;
  5418. }
  5419. }]);
  5420. return Tooltip;
  5421. }();
  5422. /**
  5423. * ------------------------------------------------------------------------
  5424. * jQuery
  5425. * ------------------------------------------------------------------------
  5426. */
  5427. $.fn[NAME$6] = Tooltip._jQueryInterface;
  5428. $.fn[NAME$6].Constructor = Tooltip;
  5429. $.fn[NAME$6].noConflict = function () {
  5430. $.fn[NAME$6] = JQUERY_NO_CONFLICT$6;
  5431. return Tooltip._jQueryInterface;
  5432. };
  5433. /**
  5434. * ------------------------------------------------------------------------
  5435. * Constants
  5436. * ------------------------------------------------------------------------
  5437. */
  5438. var NAME$7 = 'popover';
  5439. var VERSION$7 = '4.4.1';
  5440. var DATA_KEY$7 = 'bs.popover';
  5441. var EVENT_KEY$7 = "." + DATA_KEY$7;
  5442. var JQUERY_NO_CONFLICT$7 = $.fn[NAME$7];
  5443. var CLASS_PREFIX$1 = 'bs-popover';
  5444. var BSCLS_PREFIX_REGEX$1 = new RegExp("(^|\\s)" + CLASS_PREFIX$1 + "\\S+", 'g');
  5445. var Default$5 = _objectSpread2({}, Tooltip.Default, {
  5446. placement: 'right',
  5447. trigger: 'click',
  5448. content: '',
  5449. template: '<div class="popover" role="tooltip">' + '<div class="arrow"></div>' + '<h3 class="popover-header"></h3>' + '<div class="popover-body"></div></div>'
  5450. });
  5451. var DefaultType$5 = _objectSpread2({}, Tooltip.DefaultType, {
  5452. content: '(string|element|function)'
  5453. });
  5454. var ClassName$7 = {
  5455. FADE: 'fade',
  5456. SHOW: 'show'
  5457. };
  5458. var Selector$7 = {
  5459. TITLE: '.popover-header',
  5460. CONTENT: '.popover-body'
  5461. };
  5462. var Event$7 = {
  5463. HIDE: "hide" + EVENT_KEY$7,
  5464. HIDDEN: "hidden" + EVENT_KEY$7,
  5465. SHOW: "show" + EVENT_KEY$7,
  5466. SHOWN: "shown" + EVENT_KEY$7,
  5467. INSERTED: "inserted" + EVENT_KEY$7,
  5468. CLICK: "click" + EVENT_KEY$7,
  5469. FOCUSIN: "focusin" + EVENT_KEY$7,
  5470. FOCUSOUT: "focusout" + EVENT_KEY$7,
  5471. MOUSEENTER: "mouseenter" + EVENT_KEY$7,
  5472. MOUSELEAVE: "mouseleave" + EVENT_KEY$7
  5473. };
  5474. /**
  5475. * ------------------------------------------------------------------------
  5476. * Class Definition
  5477. * ------------------------------------------------------------------------
  5478. */
  5479. var Popover =
  5480. /*#__PURE__*/
  5481. function (_Tooltip) {
  5482. _inheritsLoose(Popover, _Tooltip);
  5483. function Popover() {
  5484. return _Tooltip.apply(this, arguments) || this;
  5485. }
  5486. var _proto = Popover.prototype;
  5487. // Overrides
  5488. _proto.isWithContent = function isWithContent() {
  5489. return this.getTitle() || this._getContent();
  5490. };
  5491. _proto.addAttachmentClass = function addAttachmentClass(attachment) {
  5492. $(this.getTipElement()).addClass(CLASS_PREFIX$1 + "-" + attachment);
  5493. };
  5494. _proto.getTipElement = function getTipElement() {
  5495. this.tip = this.tip || $(this.config.template)[0];
  5496. return this.tip;
  5497. };
  5498. _proto.setContent = function setContent() {
  5499. var $tip = $(this.getTipElement()); // We use append for html objects to maintain js events
  5500. this.setElementContent($tip.find(Selector$7.TITLE), this.getTitle());
  5501. var content = this._getContent();
  5502. if (typeof content === 'function') {
  5503. content = content.call(this.element);
  5504. }
  5505. this.setElementContent($tip.find(Selector$7.CONTENT), content);
  5506. $tip.removeClass(ClassName$7.FADE + " " + ClassName$7.SHOW);
  5507. } // Private
  5508. ;
  5509. _proto._getContent = function _getContent() {
  5510. return this.element.getAttribute('data-content') || this.config.content;
  5511. };
  5512. _proto._cleanTipClass = function _cleanTipClass() {
  5513. var $tip = $(this.getTipElement());
  5514. var tabClass = $tip.attr('class').match(BSCLS_PREFIX_REGEX$1);
  5515. if (tabClass !== null && tabClass.length > 0) {
  5516. $tip.removeClass(tabClass.join(''));
  5517. }
  5518. } // Static
  5519. ;
  5520. Popover._jQueryInterface = function _jQueryInterface(config) {
  5521. return this.each(function () {
  5522. var data = $(this).data(DATA_KEY$7);
  5523. var _config = typeof config === 'object' ? config : null;
  5524. if (!data && /dispose|hide/.test(config)) {
  5525. return;
  5526. }
  5527. if (!data) {
  5528. data = new Popover(this, _config);
  5529. $(this).data(DATA_KEY$7, data);
  5530. }
  5531. if (typeof config === 'string') {
  5532. if (typeof data[config] === 'undefined') {
  5533. throw new TypeError("No method named \"" + config + "\"");
  5534. }
  5535. data[config]();
  5536. }
  5537. });
  5538. };
  5539. _createClass(Popover, null, [{
  5540. key: "VERSION",
  5541. // Getters
  5542. get: function get() {
  5543. return VERSION$7;
  5544. }
  5545. }, {
  5546. key: "Default",
  5547. get: function get() {
  5548. return Default$5;
  5549. }
  5550. }, {
  5551. key: "NAME",
  5552. get: function get() {
  5553. return NAME$7;
  5554. }
  5555. }, {
  5556. key: "DATA_KEY",
  5557. get: function get() {
  5558. return DATA_KEY$7;
  5559. }
  5560. }, {
  5561. key: "Event",
  5562. get: function get() {
  5563. return Event$7;
  5564. }
  5565. }, {
  5566. key: "EVENT_KEY",
  5567. get: function get() {
  5568. return EVENT_KEY$7;
  5569. }
  5570. }, {
  5571. key: "DefaultType",
  5572. get: function get() {
  5573. return DefaultType$5;
  5574. }
  5575. }]);
  5576. return Popover;
  5577. }(Tooltip);
  5578. /**
  5579. * ------------------------------------------------------------------------
  5580. * jQuery
  5581. * ------------------------------------------------------------------------
  5582. */
  5583. $.fn[NAME$7] = Popover._jQueryInterface;
  5584. $.fn[NAME$7].Constructor = Popover;
  5585. $.fn[NAME$7].noConflict = function () {
  5586. $.fn[NAME$7] = JQUERY_NO_CONFLICT$7;
  5587. return Popover._jQueryInterface;
  5588. };
  5589. /**
  5590. * ------------------------------------------------------------------------
  5591. * Constants
  5592. * ------------------------------------------------------------------------
  5593. */
  5594. var NAME$8 = 'scrollspy';
  5595. var VERSION$8 = '4.4.1';
  5596. var DATA_KEY$8 = 'bs.scrollspy';
  5597. var EVENT_KEY$8 = "." + DATA_KEY$8;
  5598. var DATA_API_KEY$6 = '.data-api';
  5599. var JQUERY_NO_CONFLICT$8 = $.fn[NAME$8];
  5600. var Default$6 = {
  5601. offset: 10,
  5602. method: 'auto',
  5603. target: ''
  5604. };
  5605. var DefaultType$6 = {
  5606. offset: 'number',
  5607. method: 'string',
  5608. target: '(string|element)'
  5609. };
  5610. var Event$8 = {
  5611. ACTIVATE: "activate" + EVENT_KEY$8,
  5612. SCROLL: "scroll" + EVENT_KEY$8,
  5613. LOAD_DATA_API: "load" + EVENT_KEY$8 + DATA_API_KEY$6
  5614. };
  5615. var ClassName$8 = {
  5616. DROPDOWN_ITEM: 'dropdown-item',
  5617. DROPDOWN_MENU: 'dropdown-menu',
  5618. ACTIVE: 'active'
  5619. };
  5620. var Selector$8 = {
  5621. DATA_SPY: '[data-spy="scroll"]',
  5622. ACTIVE: '.active',
  5623. NAV_LIST_GROUP: '.nav, .list-group',
  5624. NAV_LINKS: '.nav-link',
  5625. NAV_ITEMS: '.nav-item',
  5626. LIST_ITEMS: '.list-group-item',
  5627. DROPDOWN: '.dropdown',
  5628. DROPDOWN_ITEMS: '.dropdown-item',
  5629. DROPDOWN_TOGGLE: '.dropdown-toggle'
  5630. };
  5631. var OffsetMethod = {
  5632. OFFSET: 'offset',
  5633. POSITION: 'position'
  5634. };
  5635. /**
  5636. * ------------------------------------------------------------------------
  5637. * Class Definition
  5638. * ------------------------------------------------------------------------
  5639. */
  5640. var ScrollSpy =
  5641. /*#__PURE__*/
  5642. function () {
  5643. function ScrollSpy(element, config) {
  5644. var _this = this;
  5645. this._element = element;
  5646. this._scrollElement = element.tagName === 'BODY' ? window : element;
  5647. this._config = this._getConfig(config);
  5648. this._selector = this._config.target + " " + Selector$8.NAV_LINKS + "," + (this._config.target + " " + Selector$8.LIST_ITEMS + ",") + (this._config.target + " " + Selector$8.DROPDOWN_ITEMS);
  5649. this._offsets = [];
  5650. this._targets = [];
  5651. this._activeTarget = null;
  5652. this._scrollHeight = 0;
  5653. $(this._scrollElement).on(Event$8.SCROLL, function (event) {
  5654. return _this._process(event);
  5655. });
  5656. this.refresh();
  5657. this._process();
  5658. } // Getters
  5659. var _proto = ScrollSpy.prototype;
  5660. // Public
  5661. _proto.refresh = function refresh() {
  5662. var _this2 = this;
  5663. var autoMethod = this._scrollElement === this._scrollElement.window ? OffsetMethod.OFFSET : OffsetMethod.POSITION;
  5664. var offsetMethod = this._config.method === 'auto' ? autoMethod : this._config.method;
  5665. var offsetBase = offsetMethod === OffsetMethod.POSITION ? this._getScrollTop() : 0;
  5666. this._offsets = [];
  5667. this._targets = [];
  5668. this._scrollHeight = this._getScrollHeight();
  5669. var targets = [].slice.call(document.querySelectorAll(this._selector));
  5670. targets.map(function (element) {
  5671. var target;
  5672. var targetSelector = Util.getSelectorFromElement(element);
  5673. if (targetSelector) {
  5674. target = document.querySelector(targetSelector);
  5675. }
  5676. if (target) {
  5677. var targetBCR = target.getBoundingClientRect();
  5678. if (targetBCR.width || targetBCR.height) {
  5679. // TODO (fat): remove sketch reliance on jQuery position/offset
  5680. return [$(target)[offsetMethod]().top + offsetBase, targetSelector];
  5681. }
  5682. }
  5683. return null;
  5684. }).filter(function (item) {
  5685. return item;
  5686. }).sort(function (a, b) {
  5687. return a[0] - b[0];
  5688. }).forEach(function (item) {
  5689. _this2._offsets.push(item[0]);
  5690. _this2._targets.push(item[1]);
  5691. });
  5692. };
  5693. _proto.dispose = function dispose() {
  5694. $.removeData(this._element, DATA_KEY$8);
  5695. $(this._scrollElement).off(EVENT_KEY$8);
  5696. this._element = null;
  5697. this._scrollElement = null;
  5698. this._config = null;
  5699. this._selector = null;
  5700. this._offsets = null;
  5701. this._targets = null;
  5702. this._activeTarget = null;
  5703. this._scrollHeight = null;
  5704. } // Private
  5705. ;
  5706. _proto._getConfig = function _getConfig(config) {
  5707. config = _objectSpread2({}, Default$6, {}, typeof config === 'object' && config ? config : {});
  5708. if (typeof config.target !== 'string') {
  5709. var id = $(config.target).attr('id');
  5710. if (!id) {
  5711. id = Util.getUID(NAME$8);
  5712. $(config.target).attr('id', id);
  5713. }
  5714. config.target = "#" + id;
  5715. }
  5716. Util.typeCheckConfig(NAME$8, config, DefaultType$6);
  5717. return config;
  5718. };
  5719. _proto._getScrollTop = function _getScrollTop() {
  5720. return this._scrollElement === window ? this._scrollElement.pageYOffset : this._scrollElement.scrollTop;
  5721. };
  5722. _proto._getScrollHeight = function _getScrollHeight() {
  5723. return this._scrollElement.scrollHeight || Math.max(document.body.scrollHeight, document.documentElement.scrollHeight);
  5724. };
  5725. _proto._getOffsetHeight = function _getOffsetHeight() {
  5726. return this._scrollElement === window ? window.innerHeight : this._scrollElement.getBoundingClientRect().height;
  5727. };
  5728. _proto._process = function _process() {
  5729. var scrollTop = this._getScrollTop() + this._config.offset;
  5730. var scrollHeight = this._getScrollHeight();
  5731. var maxScroll = this._config.offset + scrollHeight - this._getOffsetHeight();
  5732. if (this._scrollHeight !== scrollHeight) {
  5733. this.refresh();
  5734. }
  5735. if (scrollTop >= maxScroll) {
  5736. var target = this._targets[this._targets.length - 1];
  5737. if (this._activeTarget !== target) {
  5738. this._activate(target);
  5739. }
  5740. return;
  5741. }
  5742. if (this._activeTarget && scrollTop < this._offsets[0] && this._offsets[0] > 0) {
  5743. this._activeTarget = null;
  5744. this._clear();
  5745. return;
  5746. }
  5747. var offsetLength = this._offsets.length;
  5748. for (var i = offsetLength; i--;) {
  5749. var isActiveTarget = this._activeTarget !== this._targets[i] && scrollTop >= this._offsets[i] && (typeof this._offsets[i + 1] === 'undefined' || scrollTop < this._offsets[i + 1]);
  5750. if (isActiveTarget) {
  5751. this._activate(this._targets[i]);
  5752. }
  5753. }
  5754. };
  5755. _proto._activate = function _activate(target) {
  5756. this._activeTarget = target;
  5757. this._clear();
  5758. var queries = this._selector.split(',').map(function (selector) {
  5759. return selector + "[data-target=\"" + target + "\"]," + selector + "[href=\"" + target + "\"]";
  5760. });
  5761. var $link = $([].slice.call(document.querySelectorAll(queries.join(','))));
  5762. if ($link.hasClass(ClassName$8.DROPDOWN_ITEM)) {
  5763. $link.closest(Selector$8.DROPDOWN).find(Selector$8.DROPDOWN_TOGGLE).addClass(ClassName$8.ACTIVE);
  5764. $link.addClass(ClassName$8.ACTIVE);
  5765. } else {
  5766. // Set triggered link as active
  5767. $link.addClass(ClassName$8.ACTIVE); // Set triggered links parents as active
  5768. // With both <ul> and <nav> markup a parent is the previous sibling of any nav ancestor
  5769. $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
  5770. $link.parents(Selector$8.NAV_LIST_GROUP).prev(Selector$8.NAV_ITEMS).children(Selector$8.NAV_LINKS).addClass(ClassName$8.ACTIVE);
  5771. }
  5772. $(this._scrollElement).trigger(Event$8.ACTIVATE, {
  5773. relatedTarget: target
  5774. });
  5775. };
  5776. _proto._clear = function _clear() {
  5777. [].slice.call(document.querySelectorAll(this._selector)).filter(function (node) {
  5778. return node.classList.contains(ClassName$8.ACTIVE);
  5779. }).forEach(function (node) {
  5780. return node.classList.remove(ClassName$8.ACTIVE);
  5781. });
  5782. } // Static
  5783. ;
  5784. ScrollSpy._jQueryInterface = function _jQueryInterface(config) {
  5785. return this.each(function () {
  5786. var data = $(this).data(DATA_KEY$8);
  5787. var _config = typeof config === 'object' && config;
  5788. if (!data) {
  5789. data = new ScrollSpy(this, _config);
  5790. $(this).data(DATA_KEY$8, data);
  5791. }
  5792. if (typeof config === 'string') {
  5793. if (typeof data[config] === 'undefined') {
  5794. throw new TypeError("No method named \"" + config + "\"");
  5795. }
  5796. data[config]();
  5797. }
  5798. });
  5799. };
  5800. _createClass(ScrollSpy, null, [{
  5801. key: "VERSION",
  5802. get: function get() {
  5803. return VERSION$8;
  5804. }
  5805. }, {
  5806. key: "Default",
  5807. get: function get() {
  5808. return Default$6;
  5809. }
  5810. }]);
  5811. return ScrollSpy;
  5812. }();
  5813. /**
  5814. * ------------------------------------------------------------------------
  5815. * Data Api implementation
  5816. * ------------------------------------------------------------------------
  5817. */
  5818. $(window).on(Event$8.LOAD_DATA_API, function () {
  5819. var scrollSpys = [].slice.call(document.querySelectorAll(Selector$8.DATA_SPY));
  5820. var scrollSpysLength = scrollSpys.length;
  5821. for (var i = scrollSpysLength; i--;) {
  5822. var $spy = $(scrollSpys[i]);
  5823. ScrollSpy._jQueryInterface.call($spy, $spy.data());
  5824. }
  5825. });
  5826. /**
  5827. * ------------------------------------------------------------------------
  5828. * jQuery
  5829. * ------------------------------------------------------------------------
  5830. */
  5831. $.fn[NAME$8] = ScrollSpy._jQueryInterface;
  5832. $.fn[NAME$8].Constructor = ScrollSpy;
  5833. $.fn[NAME$8].noConflict = function () {
  5834. $.fn[NAME$8] = JQUERY_NO_CONFLICT$8;
  5835. return ScrollSpy._jQueryInterface;
  5836. };
  5837. /**
  5838. * ------------------------------------------------------------------------
  5839. * Constants
  5840. * ------------------------------------------------------------------------
  5841. */
  5842. var NAME$9 = 'tab';
  5843. var VERSION$9 = '4.4.1';
  5844. var DATA_KEY$9 = 'bs.tab';
  5845. var EVENT_KEY$9 = "." + DATA_KEY$9;
  5846. var DATA_API_KEY$7 = '.data-api';
  5847. var JQUERY_NO_CONFLICT$9 = $.fn[NAME$9];
  5848. var Event$9 = {
  5849. HIDE: "hide" + EVENT_KEY$9,
  5850. HIDDEN: "hidden" + EVENT_KEY$9,
  5851. SHOW: "show" + EVENT_KEY$9,
  5852. SHOWN: "shown" + EVENT_KEY$9,
  5853. CLICK_DATA_API: "click" + EVENT_KEY$9 + DATA_API_KEY$7
  5854. };
  5855. var ClassName$9 = {
  5856. DROPDOWN_MENU: 'dropdown-menu',
  5857. ACTIVE: 'active',
  5858. DISABLED: 'disabled',
  5859. FADE: 'fade',
  5860. SHOW: 'show'
  5861. };
  5862. var Selector$9 = {
  5863. DROPDOWN: '.dropdown',
  5864. NAV_LIST_GROUP: '.nav, .list-group',
  5865. ACTIVE: '.active',
  5866. ACTIVE_UL: '> li > .active',
  5867. DATA_TOGGLE: '[data-toggle="tab"], [data-toggle="pill"], [data-toggle="list"]',
  5868. DROPDOWN_TOGGLE: '.dropdown-toggle',
  5869. DROPDOWN_ACTIVE_CHILD: '> .dropdown-menu .active'
  5870. };
  5871. /**
  5872. * ------------------------------------------------------------------------
  5873. * Class Definition
  5874. * ------------------------------------------------------------------------
  5875. */
  5876. var Tab =
  5877. /*#__PURE__*/
  5878. function () {
  5879. function Tab(element) {
  5880. this._element = element;
  5881. } // Getters
  5882. var _proto = Tab.prototype;
  5883. // Public
  5884. _proto.show = function show() {
  5885. var _this = this;
  5886. if (this._element.parentNode && this._element.parentNode.nodeType === Node.ELEMENT_NODE && $(this._element).hasClass(ClassName$9.ACTIVE) || $(this._element).hasClass(ClassName$9.DISABLED)) {
  5887. return;
  5888. }
  5889. var target;
  5890. var previous;
  5891. var listElement = $(this._element).closest(Selector$9.NAV_LIST_GROUP)[0];
  5892. var selector = Util.getSelectorFromElement(this._element);
  5893. if (listElement) {
  5894. var itemSelector = listElement.nodeName === 'UL' || listElement.nodeName === 'OL' ? Selector$9.ACTIVE_UL : Selector$9.ACTIVE;
  5895. previous = $.makeArray($(listElement).find(itemSelector));
  5896. previous = previous[previous.length - 1];
  5897. }
  5898. var hideEvent = $.Event(Event$9.HIDE, {
  5899. relatedTarget: this._element
  5900. });
  5901. var showEvent = $.Event(Event$9.SHOW, {
  5902. relatedTarget: previous
  5903. });
  5904. if (previous) {
  5905. $(previous).trigger(hideEvent);
  5906. }
  5907. $(this._element).trigger(showEvent);
  5908. if (showEvent.isDefaultPrevented() || hideEvent.isDefaultPrevented()) {
  5909. return;
  5910. }
  5911. if (selector) {
  5912. target = document.querySelector(selector);
  5913. }
  5914. this._activate(this._element, listElement);
  5915. var complete = function complete() {
  5916. var hiddenEvent = $.Event(Event$9.HIDDEN, {
  5917. relatedTarget: _this._element
  5918. });
  5919. var shownEvent = $.Event(Event$9.SHOWN, {
  5920. relatedTarget: previous
  5921. });
  5922. $(previous).trigger(hiddenEvent);
  5923. $(_this._element).trigger(shownEvent);
  5924. };
  5925. if (target) {
  5926. this._activate(target, target.parentNode, complete);
  5927. } else {
  5928. complete();
  5929. }
  5930. };
  5931. _proto.dispose = function dispose() {
  5932. $.removeData(this._element, DATA_KEY$9);
  5933. this._element = null;
  5934. } // Private
  5935. ;
  5936. _proto._activate = function _activate(element, container, callback) {
  5937. var _this2 = this;
  5938. var activeElements = container && (container.nodeName === 'UL' || container.nodeName === 'OL') ? $(container).find(Selector$9.ACTIVE_UL) : $(container).children(Selector$9.ACTIVE);
  5939. var active = activeElements[0];
  5940. var isTransitioning = callback && active && $(active).hasClass(ClassName$9.FADE);
  5941. var complete = function complete() {
  5942. return _this2._transitionComplete(element, active, callback);
  5943. };
  5944. if (active && isTransitioning) {
  5945. var transitionDuration = Util.getTransitionDurationFromElement(active);
  5946. $(active).removeClass(ClassName$9.SHOW).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  5947. } else {
  5948. complete();
  5949. }
  5950. };
  5951. _proto._transitionComplete = function _transitionComplete(element, active, callback) {
  5952. if (active) {
  5953. $(active).removeClass(ClassName$9.ACTIVE);
  5954. var dropdownChild = $(active.parentNode).find(Selector$9.DROPDOWN_ACTIVE_CHILD)[0];
  5955. if (dropdownChild) {
  5956. $(dropdownChild).removeClass(ClassName$9.ACTIVE);
  5957. }
  5958. if (active.getAttribute('role') === 'tab') {
  5959. active.setAttribute('aria-selected', false);
  5960. }
  5961. }
  5962. $(element).addClass(ClassName$9.ACTIVE);
  5963. if (element.getAttribute('role') === 'tab') {
  5964. element.setAttribute('aria-selected', true);
  5965. }
  5966. Util.reflow(element);
  5967. if (element.classList.contains(ClassName$9.FADE)) {
  5968. element.classList.add(ClassName$9.SHOW);
  5969. }
  5970. if (element.parentNode && $(element.parentNode).hasClass(ClassName$9.DROPDOWN_MENU)) {
  5971. var dropdownElement = $(element).closest(Selector$9.DROPDOWN)[0];
  5972. if (dropdownElement) {
  5973. var dropdownToggleList = [].slice.call(dropdownElement.querySelectorAll(Selector$9.DROPDOWN_TOGGLE));
  5974. $(dropdownToggleList).addClass(ClassName$9.ACTIVE);
  5975. }
  5976. element.setAttribute('aria-expanded', true);
  5977. }
  5978. if (callback) {
  5979. callback();
  5980. }
  5981. } // Static
  5982. ;
  5983. Tab._jQueryInterface = function _jQueryInterface(config) {
  5984. return this.each(function () {
  5985. var $this = $(this);
  5986. var data = $this.data(DATA_KEY$9);
  5987. if (!data) {
  5988. data = new Tab(this);
  5989. $this.data(DATA_KEY$9, data);
  5990. }
  5991. if (typeof config === 'string') {
  5992. if (typeof data[config] === 'undefined') {
  5993. throw new TypeError("No method named \"" + config + "\"");
  5994. }
  5995. data[config]();
  5996. }
  5997. });
  5998. };
  5999. _createClass(Tab, null, [{
  6000. key: "VERSION",
  6001. get: function get() {
  6002. return VERSION$9;
  6003. }
  6004. }]);
  6005. return Tab;
  6006. }();
  6007. /**
  6008. * ------------------------------------------------------------------------
  6009. * Data Api implementation
  6010. * ------------------------------------------------------------------------
  6011. */
  6012. $(document).on(Event$9.CLICK_DATA_API, Selector$9.DATA_TOGGLE, function (event) {
  6013. event.preventDefault();
  6014. Tab._jQueryInterface.call($(this), 'show');
  6015. });
  6016. /**
  6017. * ------------------------------------------------------------------------
  6018. * jQuery
  6019. * ------------------------------------------------------------------------
  6020. */
  6021. $.fn[NAME$9] = Tab._jQueryInterface;
  6022. $.fn[NAME$9].Constructor = Tab;
  6023. $.fn[NAME$9].noConflict = function () {
  6024. $.fn[NAME$9] = JQUERY_NO_CONFLICT$9;
  6025. return Tab._jQueryInterface;
  6026. };
  6027. /**
  6028. * ------------------------------------------------------------------------
  6029. * Constants
  6030. * ------------------------------------------------------------------------
  6031. */
  6032. var NAME$a = 'toast';
  6033. var VERSION$a = '4.4.1';
  6034. var DATA_KEY$a = 'bs.toast';
  6035. var EVENT_KEY$a = "." + DATA_KEY$a;
  6036. var JQUERY_NO_CONFLICT$a = $.fn[NAME$a];
  6037. var Event$a = {
  6038. CLICK_DISMISS: "click.dismiss" + EVENT_KEY$a,
  6039. HIDE: "hide" + EVENT_KEY$a,
  6040. HIDDEN: "hidden" + EVENT_KEY$a,
  6041. SHOW: "show" + EVENT_KEY$a,
  6042. SHOWN: "shown" + EVENT_KEY$a
  6043. };
  6044. var ClassName$a = {
  6045. FADE: 'fade',
  6046. HIDE: 'hide',
  6047. SHOW: 'show',
  6048. SHOWING: 'showing'
  6049. };
  6050. var DefaultType$7 = {
  6051. animation: 'boolean',
  6052. autohide: 'boolean',
  6053. delay: 'number'
  6054. };
  6055. var Default$7 = {
  6056. animation: true,
  6057. autohide: true,
  6058. delay: 500
  6059. };
  6060. var Selector$a = {
  6061. DATA_DISMISS: '[data-dismiss="toast"]'
  6062. };
  6063. /**
  6064. * ------------------------------------------------------------------------
  6065. * Class Definition
  6066. * ------------------------------------------------------------------------
  6067. */
  6068. var Toast =
  6069. /*#__PURE__*/
  6070. function () {
  6071. function Toast(element, config) {
  6072. this._element = element;
  6073. this._config = this._getConfig(config);
  6074. this._timeout = null;
  6075. this._setListeners();
  6076. } // Getters
  6077. var _proto = Toast.prototype;
  6078. // Public
  6079. _proto.show = function show() {
  6080. var _this = this;
  6081. var showEvent = $.Event(Event$a.SHOW);
  6082. $(this._element).trigger(showEvent);
  6083. if (showEvent.isDefaultPrevented()) {
  6084. return;
  6085. }
  6086. if (this._config.animation) {
  6087. this._element.classList.add(ClassName$a.FADE);
  6088. }
  6089. var complete = function complete() {
  6090. _this._element.classList.remove(ClassName$a.SHOWING);
  6091. _this._element.classList.add(ClassName$a.SHOW);
  6092. $(_this._element).trigger(Event$a.SHOWN);
  6093. if (_this._config.autohide) {
  6094. _this._timeout = setTimeout(function () {
  6095. _this.hide();
  6096. }, _this._config.delay);
  6097. }
  6098. };
  6099. this._element.classList.remove(ClassName$a.HIDE);
  6100. Util.reflow(this._element);
  6101. this._element.classList.add(ClassName$a.SHOWING);
  6102. if (this._config.animation) {
  6103. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  6104. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  6105. } else {
  6106. complete();
  6107. }
  6108. };
  6109. _proto.hide = function hide() {
  6110. if (!this._element.classList.contains(ClassName$a.SHOW)) {
  6111. return;
  6112. }
  6113. var hideEvent = $.Event(Event$a.HIDE);
  6114. $(this._element).trigger(hideEvent);
  6115. if (hideEvent.isDefaultPrevented()) {
  6116. return;
  6117. }
  6118. this._close();
  6119. };
  6120. _proto.dispose = function dispose() {
  6121. clearTimeout(this._timeout);
  6122. this._timeout = null;
  6123. if (this._element.classList.contains(ClassName$a.SHOW)) {
  6124. this._element.classList.remove(ClassName$a.SHOW);
  6125. }
  6126. $(this._element).off(Event$a.CLICK_DISMISS);
  6127. $.removeData(this._element, DATA_KEY$a);
  6128. this._element = null;
  6129. this._config = null;
  6130. } // Private
  6131. ;
  6132. _proto._getConfig = function _getConfig(config) {
  6133. config = _objectSpread2({}, Default$7, {}, $(this._element).data(), {}, typeof config === 'object' && config ? config : {});
  6134. Util.typeCheckConfig(NAME$a, config, this.constructor.DefaultType);
  6135. return config;
  6136. };
  6137. _proto._setListeners = function _setListeners() {
  6138. var _this2 = this;
  6139. $(this._element).on(Event$a.CLICK_DISMISS, Selector$a.DATA_DISMISS, function () {
  6140. return _this2.hide();
  6141. });
  6142. };
  6143. _proto._close = function _close() {
  6144. var _this3 = this;
  6145. var complete = function complete() {
  6146. _this3._element.classList.add(ClassName$a.HIDE);
  6147. $(_this3._element).trigger(Event$a.HIDDEN);
  6148. };
  6149. this._element.classList.remove(ClassName$a.SHOW);
  6150. if (this._config.animation) {
  6151. var transitionDuration = Util.getTransitionDurationFromElement(this._element);
  6152. $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration);
  6153. } else {
  6154. complete();
  6155. }
  6156. } // Static
  6157. ;
  6158. Toast._jQueryInterface = function _jQueryInterface(config) {
  6159. return this.each(function () {
  6160. var $element = $(this);
  6161. var data = $element.data(DATA_KEY$a);
  6162. var _config = typeof config === 'object' && config;
  6163. if (!data) {
  6164. data = new Toast(this, _config);
  6165. $element.data(DATA_KEY$a, data);
  6166. }
  6167. if (typeof config === 'string') {
  6168. if (typeof data[config] === 'undefined') {
  6169. throw new TypeError("No method named \"" + config + "\"");
  6170. }
  6171. data[config](this);
  6172. }
  6173. });
  6174. };
  6175. _createClass(Toast, null, [{
  6176. key: "VERSION",
  6177. get: function get() {
  6178. return VERSION$a;
  6179. }
  6180. }, {
  6181. key: "DefaultType",
  6182. get: function get() {
  6183. return DefaultType$7;
  6184. }
  6185. }, {
  6186. key: "Default",
  6187. get: function get() {
  6188. return Default$7;
  6189. }
  6190. }]);
  6191. return Toast;
  6192. }();
  6193. /**
  6194. * ------------------------------------------------------------------------
  6195. * jQuery
  6196. * ------------------------------------------------------------------------
  6197. */
  6198. $.fn[NAME$a] = Toast._jQueryInterface;
  6199. $.fn[NAME$a].Constructor = Toast;
  6200. $.fn[NAME$a].noConflict = function () {
  6201. $.fn[NAME$a] = JQUERY_NO_CONFLICT$a;
  6202. return Toast._jQueryInterface;
  6203. };
  6204. exports.Alert = Alert;
  6205. exports.Button = Button;
  6206. exports.Carousel = Carousel;
  6207. exports.Collapse = Collapse;
  6208. exports.Dropdown = Dropdown;
  6209. exports.Modal = Modal;
  6210. exports.Popover = Popover;
  6211. exports.Scrollspy = ScrollSpy;
  6212. exports.Tab = Tab;
  6213. exports.Toast = Toast;
  6214. exports.Tooltip = Tooltip;
  6215. exports.Util = Util;
  6216. Object.defineProperty(exports, '__esModule', { value: true });
  6217. })));
  6218. //# sourceMappingURL=bootstrap.js.map
  6219. /***/ }),
  6220. /***/ "./node_modules/buffer/index.js":
  6221. /*!**************************************!*\
  6222. !*** ./node_modules/buffer/index.js ***!
  6223. \**************************************/
  6224. /*! no static exports found */
  6225. /***/ (function(module, exports, __webpack_require__) {
  6226. "use strict";
  6227. /* WEBPACK VAR INJECTION */(function(global) {/*!
  6228. * The buffer module from node.js, for the browser.
  6229. *
  6230. * @author Feross Aboukhadijeh <http://feross.org>
  6231. * @license MIT
  6232. */
  6233. /* eslint-disable no-proto */
  6234. var base64 = __webpack_require__(/*! base64-js */ "./node_modules/base64-js/index.js")
  6235. var ieee754 = __webpack_require__(/*! ieee754 */ "./node_modules/ieee754/index.js")
  6236. var isArray = __webpack_require__(/*! isarray */ "./node_modules/isarray/index.js")
  6237. exports.Buffer = Buffer
  6238. exports.SlowBuffer = SlowBuffer
  6239. exports.INSPECT_MAX_BYTES = 50
  6240. /**
  6241. * If `Buffer.TYPED_ARRAY_SUPPORT`:
  6242. * === true Use Uint8Array implementation (fastest)
  6243. * === false Use Object implementation (most compatible, even IE6)
  6244. *
  6245. * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,
  6246. * Opera 11.6+, iOS 4.2+.
  6247. *
  6248. * Due to various browser bugs, sometimes the Object implementation will be used even
  6249. * when the browser supports typed arrays.
  6250. *
  6251. * Note:
  6252. *
  6253. * - Firefox 4-29 lacks support for adding new properties to `Uint8Array` instances,
  6254. * See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438.
  6255. *
  6256. * - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function.
  6257. *
  6258. * - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of
  6259. * incorrect length in some situations.
  6260. * We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so they
  6261. * get the Object implementation, which is slower but behaves correctly.
  6262. */
  6263. Buffer.TYPED_ARRAY_SUPPORT = global.TYPED_ARRAY_SUPPORT !== undefined
  6264. ? global.TYPED_ARRAY_SUPPORT
  6265. : typedArraySupport()
  6266. /*
  6267. * Export kMaxLength after typed array support is determined.
  6268. */
  6269. exports.kMaxLength = kMaxLength()
  6270. function typedArraySupport () {
  6271. try {
  6272. var arr = new Uint8Array(1)
  6273. arr.__proto__ = {__proto__: Uint8Array.prototype, foo: function () { return 42 }}
  6274. return arr.foo() === 42 && // typed array instances can be augmented
  6275. typeof arr.subarray === 'function' && // chrome 9-10 lack `subarray`
  6276. arr.subarray(1, 1).byteLength === 0 // ie10 has broken `subarray`
  6277. } catch (e) {
  6278. return false
  6279. }
  6280. }
  6281. function kMaxLength () {
  6282. return Buffer.TYPED_ARRAY_SUPPORT
  6283. ? 0x7fffffff
  6284. : 0x3fffffff
  6285. }
  6286. function createBuffer (that, length) {
  6287. if (kMaxLength() < length) {
  6288. throw new RangeError('Invalid typed array length')
  6289. }
  6290. if (Buffer.TYPED_ARRAY_SUPPORT) {
  6291. // Return an augmented `Uint8Array` instance, for best performance
  6292. that = new Uint8Array(length)
  6293. that.__proto__ = Buffer.prototype
  6294. } else {
  6295. // Fallback: Return an object instance of the Buffer class
  6296. if (that === null) {
  6297. that = new Buffer(length)
  6298. }
  6299. that.length = length
  6300. }
  6301. return that
  6302. }
  6303. /**
  6304. * The Buffer constructor returns instances of `Uint8Array` that have their
  6305. * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of
  6306. * `Uint8Array`, so the returned instances will have all the node `Buffer` methods
  6307. * and the `Uint8Array` methods. Square bracket notation works as expected -- it
  6308. * returns a single octet.
  6309. *
  6310. * The `Uint8Array` prototype remains unmodified.
  6311. */
  6312. function Buffer (arg, encodingOrOffset, length) {
  6313. if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) {
  6314. return new Buffer(arg, encodingOrOffset, length)
  6315. }
  6316. // Common case.
  6317. if (typeof arg === 'number') {
  6318. if (typeof encodingOrOffset === 'string') {
  6319. throw new Error(
  6320. 'If encoding is specified then the first argument must be a string'
  6321. )
  6322. }
  6323. return allocUnsafe(this, arg)
  6324. }
  6325. return from(this, arg, encodingOrOffset, length)
  6326. }
  6327. Buffer.poolSize = 8192 // not used by this implementation
  6328. // TODO: Legacy, not needed anymore. Remove in next major version.
  6329. Buffer._augment = function (arr) {
  6330. arr.__proto__ = Buffer.prototype
  6331. return arr
  6332. }
  6333. function from (that, value, encodingOrOffset, length) {
  6334. if (typeof value === 'number') {
  6335. throw new TypeError('"value" argument must not be a number')
  6336. }
  6337. if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) {
  6338. return fromArrayBuffer(that, value, encodingOrOffset, length)
  6339. }
  6340. if (typeof value === 'string') {
  6341. return fromString(that, value, encodingOrOffset)
  6342. }
  6343. return fromObject(that, value)
  6344. }
  6345. /**
  6346. * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError
  6347. * if value is a number.
  6348. * Buffer.from(str[, encoding])
  6349. * Buffer.from(array)
  6350. * Buffer.from(buffer)
  6351. * Buffer.from(arrayBuffer[, byteOffset[, length]])
  6352. **/
  6353. Buffer.from = function (value, encodingOrOffset, length) {
  6354. return from(null, value, encodingOrOffset, length)
  6355. }
  6356. if (Buffer.TYPED_ARRAY_SUPPORT) {
  6357. Buffer.prototype.__proto__ = Uint8Array.prototype
  6358. Buffer.__proto__ = Uint8Array
  6359. if (typeof Symbol !== 'undefined' && Symbol.species &&
  6360. Buffer[Symbol.species] === Buffer) {
  6361. // Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97
  6362. Object.defineProperty(Buffer, Symbol.species, {
  6363. value: null,
  6364. configurable: true
  6365. })
  6366. }
  6367. }
  6368. function assertSize (size) {
  6369. if (typeof size !== 'number') {
  6370. throw new TypeError('"size" argument must be a number')
  6371. } else if (size < 0) {
  6372. throw new RangeError('"size" argument must not be negative')
  6373. }
  6374. }
  6375. function alloc (that, size, fill, encoding) {
  6376. assertSize(size)
  6377. if (size <= 0) {
  6378. return createBuffer(that, size)
  6379. }
  6380. if (fill !== undefined) {
  6381. // Only pay attention to encoding if it's a string. This
  6382. // prevents accidentally sending in a number that would
  6383. // be interpretted as a start offset.
  6384. return typeof encoding === 'string'
  6385. ? createBuffer(that, size).fill(fill, encoding)
  6386. : createBuffer(that, size).fill(fill)
  6387. }
  6388. return createBuffer(that, size)
  6389. }
  6390. /**
  6391. * Creates a new filled Buffer instance.
  6392. * alloc(size[, fill[, encoding]])
  6393. **/
  6394. Buffer.alloc = function (size, fill, encoding) {
  6395. return alloc(null, size, fill, encoding)
  6396. }
  6397. function allocUnsafe (that, size) {
  6398. assertSize(size)
  6399. that = createBuffer(that, size < 0 ? 0 : checked(size) | 0)
  6400. if (!Buffer.TYPED_ARRAY_SUPPORT) {
  6401. for (var i = 0; i < size; ++i) {
  6402. that[i] = 0
  6403. }
  6404. }
  6405. return that
  6406. }
  6407. /**
  6408. * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.
  6409. * */
  6410. Buffer.allocUnsafe = function (size) {
  6411. return allocUnsafe(null, size)
  6412. }
  6413. /**
  6414. * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
  6415. */
  6416. Buffer.allocUnsafeSlow = function (size) {
  6417. return allocUnsafe(null, size)
  6418. }
  6419. function fromString (that, string, encoding) {
  6420. if (typeof encoding !== 'string' || encoding === '') {
  6421. encoding = 'utf8'
  6422. }
  6423. if (!Buffer.isEncoding(encoding)) {
  6424. throw new TypeError('"encoding" must be a valid string encoding')
  6425. }
  6426. var length = byteLength(string, encoding) | 0
  6427. that = createBuffer(that, length)
  6428. var actual = that.write(string, encoding)
  6429. if (actual !== length) {
  6430. // Writing a hex string, for example, that contains invalid characters will
  6431. // cause everything after the first invalid character to be ignored. (e.g.
  6432. // 'abxxcd' will be treated as 'ab')
  6433. that = that.slice(0, actual)
  6434. }
  6435. return that
  6436. }
  6437. function fromArrayLike (that, array) {
  6438. var length = array.length < 0 ? 0 : checked(array.length) | 0
  6439. that = createBuffer(that, length)
  6440. for (var i = 0; i < length; i += 1) {
  6441. that[i] = array[i] & 255
  6442. }
  6443. return that
  6444. }
  6445. function fromArrayBuffer (that, array, byteOffset, length) {
  6446. array.byteLength // this throws if `array` is not a valid ArrayBuffer
  6447. if (byteOffset < 0 || array.byteLength < byteOffset) {
  6448. throw new RangeError('\'offset\' is out of bounds')
  6449. }
  6450. if (array.byteLength < byteOffset + (length || 0)) {
  6451. throw new RangeError('\'length\' is out of bounds')
  6452. }
  6453. if (byteOffset === undefined && length === undefined) {
  6454. array = new Uint8Array(array)
  6455. } else if (length === undefined) {
  6456. array = new Uint8Array(array, byteOffset)
  6457. } else {
  6458. array = new Uint8Array(array, byteOffset, length)
  6459. }
  6460. if (Buffer.TYPED_ARRAY_SUPPORT) {
  6461. // Return an augmented `Uint8Array` instance, for best performance
  6462. that = array
  6463. that.__proto__ = Buffer.prototype
  6464. } else {
  6465. // Fallback: Return an object instance of the Buffer class
  6466. that = fromArrayLike(that, array)
  6467. }
  6468. return that
  6469. }
  6470. function fromObject (that, obj) {
  6471. if (Buffer.isBuffer(obj)) {
  6472. var len = checked(obj.length) | 0
  6473. that = createBuffer(that, len)
  6474. if (that.length === 0) {
  6475. return that
  6476. }
  6477. obj.copy(that, 0, 0, len)
  6478. return that
  6479. }
  6480. if (obj) {
  6481. if ((typeof ArrayBuffer !== 'undefined' &&
  6482. obj.buffer instanceof ArrayBuffer) || 'length' in obj) {
  6483. if (typeof obj.length !== 'number' || isnan(obj.length)) {
  6484. return createBuffer(that, 0)
  6485. }
  6486. return fromArrayLike(that, obj)
  6487. }
  6488. if (obj.type === 'Buffer' && isArray(obj.data)) {
  6489. return fromArrayLike(that, obj.data)
  6490. }
  6491. }
  6492. throw new TypeError('First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.')
  6493. }
  6494. function checked (length) {
  6495. // Note: cannot use `length < kMaxLength()` here because that fails when
  6496. // length is NaN (which is otherwise coerced to zero.)
  6497. if (length >= kMaxLength()) {
  6498. throw new RangeError('Attempt to allocate Buffer larger than maximum ' +
  6499. 'size: 0x' + kMaxLength().toString(16) + ' bytes')
  6500. }
  6501. return length | 0
  6502. }
  6503. function SlowBuffer (length) {
  6504. if (+length != length) { // eslint-disable-line eqeqeq
  6505. length = 0
  6506. }
  6507. return Buffer.alloc(+length)
  6508. }
  6509. Buffer.isBuffer = function isBuffer (b) {
  6510. return !!(b != null && b._isBuffer)
  6511. }
  6512. Buffer.compare = function compare (a, b) {
  6513. if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {
  6514. throw new TypeError('Arguments must be Buffers')
  6515. }
  6516. if (a === b) return 0
  6517. var x = a.length
  6518. var y = b.length
  6519. for (var i = 0, len = Math.min(x, y); i < len; ++i) {
  6520. if (a[i] !== b[i]) {
  6521. x = a[i]
  6522. y = b[i]
  6523. break
  6524. }
  6525. }
  6526. if (x < y) return -1
  6527. if (y < x) return 1
  6528. return 0
  6529. }
  6530. Buffer.isEncoding = function isEncoding (encoding) {
  6531. switch (String(encoding).toLowerCase()) {
  6532. case 'hex':
  6533. case 'utf8':
  6534. case 'utf-8':
  6535. case 'ascii':
  6536. case 'latin1':
  6537. case 'binary':
  6538. case 'base64':
  6539. case 'ucs2':
  6540. case 'ucs-2':
  6541. case 'utf16le':
  6542. case 'utf-16le':
  6543. return true
  6544. default:
  6545. return false
  6546. }
  6547. }
  6548. Buffer.concat = function concat (list, length) {
  6549. if (!isArray(list)) {
  6550. throw new TypeError('"list" argument must be an Array of Buffers')
  6551. }
  6552. if (list.length === 0) {
  6553. return Buffer.alloc(0)
  6554. }
  6555. var i
  6556. if (length === undefined) {
  6557. length = 0
  6558. for (i = 0; i < list.length; ++i) {
  6559. length += list[i].length
  6560. }
  6561. }
  6562. var buffer = Buffer.allocUnsafe(length)
  6563. var pos = 0
  6564. for (i = 0; i < list.length; ++i) {
  6565. var buf = list[i]
  6566. if (!Buffer.isBuffer(buf)) {
  6567. throw new TypeError('"list" argument must be an Array of Buffers')
  6568. }
  6569. buf.copy(buffer, pos)
  6570. pos += buf.length
  6571. }
  6572. return buffer
  6573. }
  6574. function byteLength (string, encoding) {
  6575. if (Buffer.isBuffer(string)) {
  6576. return string.length
  6577. }
  6578. if (typeof ArrayBuffer !== 'undefined' && typeof ArrayBuffer.isView === 'function' &&
  6579. (ArrayBuffer.isView(string) || string instanceof ArrayBuffer)) {
  6580. return string.byteLength
  6581. }
  6582. if (typeof string !== 'string') {
  6583. string = '' + string
  6584. }
  6585. var len = string.length
  6586. if (len === 0) return 0
  6587. // Use a for loop to avoid recursion
  6588. var loweredCase = false
  6589. for (;;) {
  6590. switch (encoding) {
  6591. case 'ascii':
  6592. case 'latin1':
  6593. case 'binary':
  6594. return len
  6595. case 'utf8':
  6596. case 'utf-8':
  6597. case undefined:
  6598. return utf8ToBytes(string).length
  6599. case 'ucs2':
  6600. case 'ucs-2':
  6601. case 'utf16le':
  6602. case 'utf-16le':
  6603. return len * 2
  6604. case 'hex':
  6605. return len >>> 1
  6606. case 'base64':
  6607. return base64ToBytes(string).length
  6608. default:
  6609. if (loweredCase) return utf8ToBytes(string).length // assume utf8
  6610. encoding = ('' + encoding).toLowerCase()
  6611. loweredCase = true
  6612. }
  6613. }
  6614. }
  6615. Buffer.byteLength = byteLength
  6616. function slowToString (encoding, start, end) {
  6617. var loweredCase = false
  6618. // No need to verify that "this.length <= MAX_UINT32" since it's a read-only
  6619. // property of a typed array.
  6620. // This behaves neither like String nor Uint8Array in that we set start/end
  6621. // to their upper/lower bounds if the value passed is out of range.
  6622. // undefined is handled specially as per ECMA-262 6th Edition,
  6623. // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.
  6624. if (start === undefined || start < 0) {
  6625. start = 0
  6626. }
  6627. // Return early if start > this.length. Done here to prevent potential uint32
  6628. // coercion fail below.
  6629. if (start > this.length) {
  6630. return ''
  6631. }
  6632. if (end === undefined || end > this.length) {
  6633. end = this.length
  6634. }
  6635. if (end <= 0) {
  6636. return ''
  6637. }
  6638. // Force coersion to uint32. This will also coerce falsey/NaN values to 0.
  6639. end >>>= 0
  6640. start >>>= 0
  6641. if (end <= start) {
  6642. return ''
  6643. }
  6644. if (!encoding) encoding = 'utf8'
  6645. while (true) {
  6646. switch (encoding) {
  6647. case 'hex':
  6648. return hexSlice(this, start, end)
  6649. case 'utf8':
  6650. case 'utf-8':
  6651. return utf8Slice(this, start, end)
  6652. case 'ascii':
  6653. return asciiSlice(this, start, end)
  6654. case 'latin1':
  6655. case 'binary':
  6656. return latin1Slice(this, start, end)
  6657. case 'base64':
  6658. return base64Slice(this, start, end)
  6659. case 'ucs2':
  6660. case 'ucs-2':
  6661. case 'utf16le':
  6662. case 'utf-16le':
  6663. return utf16leSlice(this, start, end)
  6664. default:
  6665. if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
  6666. encoding = (encoding + '').toLowerCase()
  6667. loweredCase = true
  6668. }
  6669. }
  6670. }
  6671. // The property is used by `Buffer.isBuffer` and `is-buffer` (in Safari 5-7) to detect
  6672. // Buffer instances.
  6673. Buffer.prototype._isBuffer = true
  6674. function swap (b, n, m) {
  6675. var i = b[n]
  6676. b[n] = b[m]
  6677. b[m] = i
  6678. }
  6679. Buffer.prototype.swap16 = function swap16 () {
  6680. var len = this.length
  6681. if (len % 2 !== 0) {
  6682. throw new RangeError('Buffer size must be a multiple of 16-bits')
  6683. }
  6684. for (var i = 0; i < len; i += 2) {
  6685. swap(this, i, i + 1)
  6686. }
  6687. return this
  6688. }
  6689. Buffer.prototype.swap32 = function swap32 () {
  6690. var len = this.length
  6691. if (len % 4 !== 0) {
  6692. throw new RangeError('Buffer size must be a multiple of 32-bits')
  6693. }
  6694. for (var i = 0; i < len; i += 4) {
  6695. swap(this, i, i + 3)
  6696. swap(this, i + 1, i + 2)
  6697. }
  6698. return this
  6699. }
  6700. Buffer.prototype.swap64 = function swap64 () {
  6701. var len = this.length
  6702. if (len % 8 !== 0) {
  6703. throw new RangeError('Buffer size must be a multiple of 64-bits')
  6704. }
  6705. for (var i = 0; i < len; i += 8) {
  6706. swap(this, i, i + 7)
  6707. swap(this, i + 1, i + 6)
  6708. swap(this, i + 2, i + 5)
  6709. swap(this, i + 3, i + 4)
  6710. }
  6711. return this
  6712. }
  6713. Buffer.prototype.toString = function toString () {
  6714. var length = this.length | 0
  6715. if (length === 0) return ''
  6716. if (arguments.length === 0) return utf8Slice(this, 0, length)
  6717. return slowToString.apply(this, arguments)
  6718. }
  6719. Buffer.prototype.equals = function equals (b) {
  6720. if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')
  6721. if (this === b) return true
  6722. return Buffer.compare(this, b) === 0
  6723. }
  6724. Buffer.prototype.inspect = function inspect () {
  6725. var str = ''
  6726. var max = exports.INSPECT_MAX_BYTES
  6727. if (this.length > 0) {
  6728. str = this.toString('hex', 0, max).match(/.{2}/g).join(' ')
  6729. if (this.length > max) str += ' ... '
  6730. }
  6731. return '<Buffer ' + str + '>'
  6732. }
  6733. Buffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) {
  6734. if (!Buffer.isBuffer(target)) {
  6735. throw new TypeError('Argument must be a Buffer')
  6736. }
  6737. if (start === undefined) {
  6738. start = 0
  6739. }
  6740. if (end === undefined) {
  6741. end = target ? target.length : 0
  6742. }
  6743. if (thisStart === undefined) {
  6744. thisStart = 0
  6745. }
  6746. if (thisEnd === undefined) {
  6747. thisEnd = this.length
  6748. }
  6749. if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {
  6750. throw new RangeError('out of range index')
  6751. }
  6752. if (thisStart >= thisEnd && start >= end) {
  6753. return 0
  6754. }
  6755. if (thisStart >= thisEnd) {
  6756. return -1
  6757. }
  6758. if (start >= end) {
  6759. return 1
  6760. }
  6761. start >>>= 0
  6762. end >>>= 0
  6763. thisStart >>>= 0
  6764. thisEnd >>>= 0
  6765. if (this === target) return 0
  6766. var x = thisEnd - thisStart
  6767. var y = end - start
  6768. var len = Math.min(x, y)
  6769. var thisCopy = this.slice(thisStart, thisEnd)
  6770. var targetCopy = target.slice(start, end)
  6771. for (var i = 0; i < len; ++i) {
  6772. if (thisCopy[i] !== targetCopy[i]) {
  6773. x = thisCopy[i]
  6774. y = targetCopy[i]
  6775. break
  6776. }
  6777. }
  6778. if (x < y) return -1
  6779. if (y < x) return 1
  6780. return 0
  6781. }
  6782. // Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,
  6783. // OR the last index of `val` in `buffer` at offset <= `byteOffset`.
  6784. //
  6785. // Arguments:
  6786. // - buffer - a Buffer to search
  6787. // - val - a string, Buffer, or number
  6788. // - byteOffset - an index into `buffer`; will be clamped to an int32
  6789. // - encoding - an optional encoding, relevant is val is a string
  6790. // - dir - true for indexOf, false for lastIndexOf
  6791. function bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {
  6792. // Empty buffer means no match
  6793. if (buffer.length === 0) return -1
  6794. // Normalize byteOffset
  6795. if (typeof byteOffset === 'string') {
  6796. encoding = byteOffset
  6797. byteOffset = 0
  6798. } else if (byteOffset > 0x7fffffff) {
  6799. byteOffset = 0x7fffffff
  6800. } else if (byteOffset < -0x80000000) {
  6801. byteOffset = -0x80000000
  6802. }
  6803. byteOffset = +byteOffset // Coerce to Number.
  6804. if (isNaN(byteOffset)) {
  6805. // byteOffset: it it's undefined, null, NaN, "foo", etc, search whole buffer
  6806. byteOffset = dir ? 0 : (buffer.length - 1)
  6807. }
  6808. // Normalize byteOffset: negative offsets start from the end of the buffer
  6809. if (byteOffset < 0) byteOffset = buffer.length + byteOffset
  6810. if (byteOffset >= buffer.length) {
  6811. if (dir) return -1
  6812. else byteOffset = buffer.length - 1
  6813. } else if (byteOffset < 0) {
  6814. if (dir) byteOffset = 0
  6815. else return -1
  6816. }
  6817. // Normalize val
  6818. if (typeof val === 'string') {
  6819. val = Buffer.from(val, encoding)
  6820. }
  6821. // Finally, search either indexOf (if dir is true) or lastIndexOf
  6822. if (Buffer.isBuffer(val)) {
  6823. // Special case: looking for empty string/buffer always fails
  6824. if (val.length === 0) {
  6825. return -1
  6826. }
  6827. return arrayIndexOf(buffer, val, byteOffset, encoding, dir)
  6828. } else if (typeof val === 'number') {
  6829. val = val & 0xFF // Search for a byte value [0-255]
  6830. if (Buffer.TYPED_ARRAY_SUPPORT &&
  6831. typeof Uint8Array.prototype.indexOf === 'function') {
  6832. if (dir) {
  6833. return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset)
  6834. } else {
  6835. return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset)
  6836. }
  6837. }
  6838. return arrayIndexOf(buffer, [ val ], byteOffset, encoding, dir)
  6839. }
  6840. throw new TypeError('val must be string, number or Buffer')
  6841. }
  6842. function arrayIndexOf (arr, val, byteOffset, encoding, dir) {
  6843. var indexSize = 1
  6844. var arrLength = arr.length
  6845. var valLength = val.length
  6846. if (encoding !== undefined) {
  6847. encoding = String(encoding).toLowerCase()
  6848. if (encoding === 'ucs2' || encoding === 'ucs-2' ||
  6849. encoding === 'utf16le' || encoding === 'utf-16le') {
  6850. if (arr.length < 2 || val.length < 2) {
  6851. return -1
  6852. }
  6853. indexSize = 2
  6854. arrLength /= 2
  6855. valLength /= 2
  6856. byteOffset /= 2
  6857. }
  6858. }
  6859. function read (buf, i) {
  6860. if (indexSize === 1) {
  6861. return buf[i]
  6862. } else {
  6863. return buf.readUInt16BE(i * indexSize)
  6864. }
  6865. }
  6866. var i
  6867. if (dir) {
  6868. var foundIndex = -1
  6869. for (i = byteOffset; i < arrLength; i++) {
  6870. if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {
  6871. if (foundIndex === -1) foundIndex = i
  6872. if (i - foundIndex + 1 === valLength) return foundIndex * indexSize
  6873. } else {
  6874. if (foundIndex !== -1) i -= i - foundIndex
  6875. foundIndex = -1
  6876. }
  6877. }
  6878. } else {
  6879. if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength
  6880. for (i = byteOffset; i >= 0; i--) {
  6881. var found = true
  6882. for (var j = 0; j < valLength; j++) {
  6883. if (read(arr, i + j) !== read(val, j)) {
  6884. found = false
  6885. break
  6886. }
  6887. }
  6888. if (found) return i
  6889. }
  6890. }
  6891. return -1
  6892. }
  6893. Buffer.prototype.includes = function includes (val, byteOffset, encoding) {
  6894. return this.indexOf(val, byteOffset, encoding) !== -1
  6895. }
  6896. Buffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) {
  6897. return bidirectionalIndexOf(this, val, byteOffset, encoding, true)
  6898. }
  6899. Buffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) {
  6900. return bidirectionalIndexOf(this, val, byteOffset, encoding, false)
  6901. }
  6902. function hexWrite (buf, string, offset, length) {
  6903. offset = Number(offset) || 0
  6904. var remaining = buf.length - offset
  6905. if (!length) {
  6906. length = remaining
  6907. } else {
  6908. length = Number(length)
  6909. if (length > remaining) {
  6910. length = remaining
  6911. }
  6912. }
  6913. // must be an even number of digits
  6914. var strLen = string.length
  6915. if (strLen % 2 !== 0) throw new TypeError('Invalid hex string')
  6916. if (length > strLen / 2) {
  6917. length = strLen / 2
  6918. }
  6919. for (var i = 0; i < length; ++i) {
  6920. var parsed = parseInt(string.substr(i * 2, 2), 16)
  6921. if (isNaN(parsed)) return i
  6922. buf[offset + i] = parsed
  6923. }
  6924. return i
  6925. }
  6926. function utf8Write (buf, string, offset, length) {
  6927. return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)
  6928. }
  6929. function asciiWrite (buf, string, offset, length) {
  6930. return blitBuffer(asciiToBytes(string), buf, offset, length)
  6931. }
  6932. function latin1Write (buf, string, offset, length) {
  6933. return asciiWrite(buf, string, offset, length)
  6934. }
  6935. function base64Write (buf, string, offset, length) {
  6936. return blitBuffer(base64ToBytes(string), buf, offset, length)
  6937. }
  6938. function ucs2Write (buf, string, offset, length) {
  6939. return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)
  6940. }
  6941. Buffer.prototype.write = function write (string, offset, length, encoding) {
  6942. // Buffer#write(string)
  6943. if (offset === undefined) {
  6944. encoding = 'utf8'
  6945. length = this.length
  6946. offset = 0
  6947. // Buffer#write(string, encoding)
  6948. } else if (length === undefined && typeof offset === 'string') {
  6949. encoding = offset
  6950. length = this.length
  6951. offset = 0
  6952. // Buffer#write(string, offset[, length][, encoding])
  6953. } else if (isFinite(offset)) {
  6954. offset = offset | 0
  6955. if (isFinite(length)) {
  6956. length = length | 0
  6957. if (encoding === undefined) encoding = 'utf8'
  6958. } else {
  6959. encoding = length
  6960. length = undefined
  6961. }
  6962. // legacy write(string, encoding, offset, length) - remove in v0.13
  6963. } else {
  6964. throw new Error(
  6965. 'Buffer.write(string, encoding, offset[, length]) is no longer supported'
  6966. )
  6967. }
  6968. var remaining = this.length - offset
  6969. if (length === undefined || length > remaining) length = remaining
  6970. if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {
  6971. throw new RangeError('Attempt to write outside buffer bounds')
  6972. }
  6973. if (!encoding) encoding = 'utf8'
  6974. var loweredCase = false
  6975. for (;;) {
  6976. switch (encoding) {
  6977. case 'hex':
  6978. return hexWrite(this, string, offset, length)
  6979. case 'utf8':
  6980. case 'utf-8':
  6981. return utf8Write(this, string, offset, length)
  6982. case 'ascii':
  6983. return asciiWrite(this, string, offset, length)
  6984. case 'latin1':
  6985. case 'binary':
  6986. return latin1Write(this, string, offset, length)
  6987. case 'base64':
  6988. // Warning: maxLength not taken into account in base64Write
  6989. return base64Write(this, string, offset, length)
  6990. case 'ucs2':
  6991. case 'ucs-2':
  6992. case 'utf16le':
  6993. case 'utf-16le':
  6994. return ucs2Write(this, string, offset, length)
  6995. default:
  6996. if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
  6997. encoding = ('' + encoding).toLowerCase()
  6998. loweredCase = true
  6999. }
  7000. }
  7001. }
  7002. Buffer.prototype.toJSON = function toJSON () {
  7003. return {
  7004. type: 'Buffer',
  7005. data: Array.prototype.slice.call(this._arr || this, 0)
  7006. }
  7007. }
  7008. function base64Slice (buf, start, end) {
  7009. if (start === 0 && end === buf.length) {
  7010. return base64.fromByteArray(buf)
  7011. } else {
  7012. return base64.fromByteArray(buf.slice(start, end))
  7013. }
  7014. }
  7015. function utf8Slice (buf, start, end) {
  7016. end = Math.min(buf.length, end)
  7017. var res = []
  7018. var i = start
  7019. while (i < end) {
  7020. var firstByte = buf[i]
  7021. var codePoint = null
  7022. var bytesPerSequence = (firstByte > 0xEF) ? 4
  7023. : (firstByte > 0xDF) ? 3
  7024. : (firstByte > 0xBF) ? 2
  7025. : 1
  7026. if (i + bytesPerSequence <= end) {
  7027. var secondByte, thirdByte, fourthByte, tempCodePoint
  7028. switch (bytesPerSequence) {
  7029. case 1:
  7030. if (firstByte < 0x80) {
  7031. codePoint = firstByte
  7032. }
  7033. break
  7034. case 2:
  7035. secondByte = buf[i + 1]
  7036. if ((secondByte & 0xC0) === 0x80) {
  7037. tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F)
  7038. if (tempCodePoint > 0x7F) {
  7039. codePoint = tempCodePoint
  7040. }
  7041. }
  7042. break
  7043. case 3:
  7044. secondByte = buf[i + 1]
  7045. thirdByte = buf[i + 2]
  7046. if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {
  7047. tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F)
  7048. if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {
  7049. codePoint = tempCodePoint
  7050. }
  7051. }
  7052. break
  7053. case 4:
  7054. secondByte = buf[i + 1]
  7055. thirdByte = buf[i + 2]
  7056. fourthByte = buf[i + 3]
  7057. if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {
  7058. tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F)
  7059. if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {
  7060. codePoint = tempCodePoint
  7061. }
  7062. }
  7063. }
  7064. }
  7065. if (codePoint === null) {
  7066. // we did not generate a valid codePoint so insert a
  7067. // replacement char (U+FFFD) and advance only 1 byte
  7068. codePoint = 0xFFFD
  7069. bytesPerSequence = 1
  7070. } else if (codePoint > 0xFFFF) {
  7071. // encode to utf16 (surrogate pair dance)
  7072. codePoint -= 0x10000
  7073. res.push(codePoint >>> 10 & 0x3FF | 0xD800)
  7074. codePoint = 0xDC00 | codePoint & 0x3FF
  7075. }
  7076. res.push(codePoint)
  7077. i += bytesPerSequence
  7078. }
  7079. return decodeCodePointsArray(res)
  7080. }
  7081. // Based on http://stackoverflow.com/a/22747272/680742, the browser with
  7082. // the lowest limit is Chrome, with 0x10000 args.
  7083. // We go 1 magnitude less, for safety
  7084. var MAX_ARGUMENTS_LENGTH = 0x1000
  7085. function decodeCodePointsArray (codePoints) {
  7086. var len = codePoints.length
  7087. if (len <= MAX_ARGUMENTS_LENGTH) {
  7088. return String.fromCharCode.apply(String, codePoints) // avoid extra slice()
  7089. }
  7090. // Decode in chunks to avoid "call stack size exceeded".
  7091. var res = ''
  7092. var i = 0
  7093. while (i < len) {
  7094. res += String.fromCharCode.apply(
  7095. String,
  7096. codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)
  7097. )
  7098. }
  7099. return res
  7100. }
  7101. function asciiSlice (buf, start, end) {
  7102. var ret = ''
  7103. end = Math.min(buf.length, end)
  7104. for (var i = start; i < end; ++i) {
  7105. ret += String.fromCharCode(buf[i] & 0x7F)
  7106. }
  7107. return ret
  7108. }
  7109. function latin1Slice (buf, start, end) {
  7110. var ret = ''
  7111. end = Math.min(buf.length, end)
  7112. for (var i = start; i < end; ++i) {
  7113. ret += String.fromCharCode(buf[i])
  7114. }
  7115. return ret
  7116. }
  7117. function hexSlice (buf, start, end) {
  7118. var len = buf.length
  7119. if (!start || start < 0) start = 0
  7120. if (!end || end < 0 || end > len) end = len
  7121. var out = ''
  7122. for (var i = start; i < end; ++i) {
  7123. out += toHex(buf[i])
  7124. }
  7125. return out
  7126. }
  7127. function utf16leSlice (buf, start, end) {
  7128. var bytes = buf.slice(start, end)
  7129. var res = ''
  7130. for (var i = 0; i < bytes.length; i += 2) {
  7131. res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256)
  7132. }
  7133. return res
  7134. }
  7135. Buffer.prototype.slice = function slice (start, end) {
  7136. var len = this.length
  7137. start = ~~start
  7138. end = end === undefined ? len : ~~end
  7139. if (start < 0) {
  7140. start += len
  7141. if (start < 0) start = 0
  7142. } else if (start > len) {
  7143. start = len
  7144. }
  7145. if (end < 0) {
  7146. end += len
  7147. if (end < 0) end = 0
  7148. } else if (end > len) {
  7149. end = len
  7150. }
  7151. if (end < start) end = start
  7152. var newBuf
  7153. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7154. newBuf = this.subarray(start, end)
  7155. newBuf.__proto__ = Buffer.prototype
  7156. } else {
  7157. var sliceLen = end - start
  7158. newBuf = new Buffer(sliceLen, undefined)
  7159. for (var i = 0; i < sliceLen; ++i) {
  7160. newBuf[i] = this[i + start]
  7161. }
  7162. }
  7163. return newBuf
  7164. }
  7165. /*
  7166. * Need to make sure that buffer isn't trying to write out of bounds.
  7167. */
  7168. function checkOffset (offset, ext, length) {
  7169. if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')
  7170. if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')
  7171. }
  7172. Buffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {
  7173. offset = offset | 0
  7174. byteLength = byteLength | 0
  7175. if (!noAssert) checkOffset(offset, byteLength, this.length)
  7176. var val = this[offset]
  7177. var mul = 1
  7178. var i = 0
  7179. while (++i < byteLength && (mul *= 0x100)) {
  7180. val += this[offset + i] * mul
  7181. }
  7182. return val
  7183. }
  7184. Buffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {
  7185. offset = offset | 0
  7186. byteLength = byteLength | 0
  7187. if (!noAssert) {
  7188. checkOffset(offset, byteLength, this.length)
  7189. }
  7190. var val = this[offset + --byteLength]
  7191. var mul = 1
  7192. while (byteLength > 0 && (mul *= 0x100)) {
  7193. val += this[offset + --byteLength] * mul
  7194. }
  7195. return val
  7196. }
  7197. Buffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {
  7198. if (!noAssert) checkOffset(offset, 1, this.length)
  7199. return this[offset]
  7200. }
  7201. Buffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {
  7202. if (!noAssert) checkOffset(offset, 2, this.length)
  7203. return this[offset] | (this[offset + 1] << 8)
  7204. }
  7205. Buffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {
  7206. if (!noAssert) checkOffset(offset, 2, this.length)
  7207. return (this[offset] << 8) | this[offset + 1]
  7208. }
  7209. Buffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {
  7210. if (!noAssert) checkOffset(offset, 4, this.length)
  7211. return ((this[offset]) |
  7212. (this[offset + 1] << 8) |
  7213. (this[offset + 2] << 16)) +
  7214. (this[offset + 3] * 0x1000000)
  7215. }
  7216. Buffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {
  7217. if (!noAssert) checkOffset(offset, 4, this.length)
  7218. return (this[offset] * 0x1000000) +
  7219. ((this[offset + 1] << 16) |
  7220. (this[offset + 2] << 8) |
  7221. this[offset + 3])
  7222. }
  7223. Buffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {
  7224. offset = offset | 0
  7225. byteLength = byteLength | 0
  7226. if (!noAssert) checkOffset(offset, byteLength, this.length)
  7227. var val = this[offset]
  7228. var mul = 1
  7229. var i = 0
  7230. while (++i < byteLength && (mul *= 0x100)) {
  7231. val += this[offset + i] * mul
  7232. }
  7233. mul *= 0x80
  7234. if (val >= mul) val -= Math.pow(2, 8 * byteLength)
  7235. return val
  7236. }
  7237. Buffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {
  7238. offset = offset | 0
  7239. byteLength = byteLength | 0
  7240. if (!noAssert) checkOffset(offset, byteLength, this.length)
  7241. var i = byteLength
  7242. var mul = 1
  7243. var val = this[offset + --i]
  7244. while (i > 0 && (mul *= 0x100)) {
  7245. val += this[offset + --i] * mul
  7246. }
  7247. mul *= 0x80
  7248. if (val >= mul) val -= Math.pow(2, 8 * byteLength)
  7249. return val
  7250. }
  7251. Buffer.prototype.readInt8 = function readInt8 (offset, noAssert) {
  7252. if (!noAssert) checkOffset(offset, 1, this.length)
  7253. if (!(this[offset] & 0x80)) return (this[offset])
  7254. return ((0xff - this[offset] + 1) * -1)
  7255. }
  7256. Buffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {
  7257. if (!noAssert) checkOffset(offset, 2, this.length)
  7258. var val = this[offset] | (this[offset + 1] << 8)
  7259. return (val & 0x8000) ? val | 0xFFFF0000 : val
  7260. }
  7261. Buffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {
  7262. if (!noAssert) checkOffset(offset, 2, this.length)
  7263. var val = this[offset + 1] | (this[offset] << 8)
  7264. return (val & 0x8000) ? val | 0xFFFF0000 : val
  7265. }
  7266. Buffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {
  7267. if (!noAssert) checkOffset(offset, 4, this.length)
  7268. return (this[offset]) |
  7269. (this[offset + 1] << 8) |
  7270. (this[offset + 2] << 16) |
  7271. (this[offset + 3] << 24)
  7272. }
  7273. Buffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {
  7274. if (!noAssert) checkOffset(offset, 4, this.length)
  7275. return (this[offset] << 24) |
  7276. (this[offset + 1] << 16) |
  7277. (this[offset + 2] << 8) |
  7278. (this[offset + 3])
  7279. }
  7280. Buffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {
  7281. if (!noAssert) checkOffset(offset, 4, this.length)
  7282. return ieee754.read(this, offset, true, 23, 4)
  7283. }
  7284. Buffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {
  7285. if (!noAssert) checkOffset(offset, 4, this.length)
  7286. return ieee754.read(this, offset, false, 23, 4)
  7287. }
  7288. Buffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {
  7289. if (!noAssert) checkOffset(offset, 8, this.length)
  7290. return ieee754.read(this, offset, true, 52, 8)
  7291. }
  7292. Buffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {
  7293. if (!noAssert) checkOffset(offset, 8, this.length)
  7294. return ieee754.read(this, offset, false, 52, 8)
  7295. }
  7296. function checkInt (buf, value, offset, ext, max, min) {
  7297. if (!Buffer.isBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance')
  7298. if (value > max || value < min) throw new RangeError('"value" argument is out of bounds')
  7299. if (offset + ext > buf.length) throw new RangeError('Index out of range')
  7300. }
  7301. Buffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {
  7302. value = +value
  7303. offset = offset | 0
  7304. byteLength = byteLength | 0
  7305. if (!noAssert) {
  7306. var maxBytes = Math.pow(2, 8 * byteLength) - 1
  7307. checkInt(this, value, offset, byteLength, maxBytes, 0)
  7308. }
  7309. var mul = 1
  7310. var i = 0
  7311. this[offset] = value & 0xFF
  7312. while (++i < byteLength && (mul *= 0x100)) {
  7313. this[offset + i] = (value / mul) & 0xFF
  7314. }
  7315. return offset + byteLength
  7316. }
  7317. Buffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {
  7318. value = +value
  7319. offset = offset | 0
  7320. byteLength = byteLength | 0
  7321. if (!noAssert) {
  7322. var maxBytes = Math.pow(2, 8 * byteLength) - 1
  7323. checkInt(this, value, offset, byteLength, maxBytes, 0)
  7324. }
  7325. var i = byteLength - 1
  7326. var mul = 1
  7327. this[offset + i] = value & 0xFF
  7328. while (--i >= 0 && (mul *= 0x100)) {
  7329. this[offset + i] = (value / mul) & 0xFF
  7330. }
  7331. return offset + byteLength
  7332. }
  7333. Buffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {
  7334. value = +value
  7335. offset = offset | 0
  7336. if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0)
  7337. if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)
  7338. this[offset] = (value & 0xff)
  7339. return offset + 1
  7340. }
  7341. function objectWriteUInt16 (buf, value, offset, littleEndian) {
  7342. if (value < 0) value = 0xffff + value + 1
  7343. for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; ++i) {
  7344. buf[offset + i] = (value & (0xff << (8 * (littleEndian ? i : 1 - i)))) >>>
  7345. (littleEndian ? i : 1 - i) * 8
  7346. }
  7347. }
  7348. Buffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {
  7349. value = +value
  7350. offset = offset | 0
  7351. if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
  7352. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7353. this[offset] = (value & 0xff)
  7354. this[offset + 1] = (value >>> 8)
  7355. } else {
  7356. objectWriteUInt16(this, value, offset, true)
  7357. }
  7358. return offset + 2
  7359. }
  7360. Buffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {
  7361. value = +value
  7362. offset = offset | 0
  7363. if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
  7364. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7365. this[offset] = (value >>> 8)
  7366. this[offset + 1] = (value & 0xff)
  7367. } else {
  7368. objectWriteUInt16(this, value, offset, false)
  7369. }
  7370. return offset + 2
  7371. }
  7372. function objectWriteUInt32 (buf, value, offset, littleEndian) {
  7373. if (value < 0) value = 0xffffffff + value + 1
  7374. for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; ++i) {
  7375. buf[offset + i] = (value >>> (littleEndian ? i : 3 - i) * 8) & 0xff
  7376. }
  7377. }
  7378. Buffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {
  7379. value = +value
  7380. offset = offset | 0
  7381. if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
  7382. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7383. this[offset + 3] = (value >>> 24)
  7384. this[offset + 2] = (value >>> 16)
  7385. this[offset + 1] = (value >>> 8)
  7386. this[offset] = (value & 0xff)
  7387. } else {
  7388. objectWriteUInt32(this, value, offset, true)
  7389. }
  7390. return offset + 4
  7391. }
  7392. Buffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {
  7393. value = +value
  7394. offset = offset | 0
  7395. if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
  7396. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7397. this[offset] = (value >>> 24)
  7398. this[offset + 1] = (value >>> 16)
  7399. this[offset + 2] = (value >>> 8)
  7400. this[offset + 3] = (value & 0xff)
  7401. } else {
  7402. objectWriteUInt32(this, value, offset, false)
  7403. }
  7404. return offset + 4
  7405. }
  7406. Buffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {
  7407. value = +value
  7408. offset = offset | 0
  7409. if (!noAssert) {
  7410. var limit = Math.pow(2, 8 * byteLength - 1)
  7411. checkInt(this, value, offset, byteLength, limit - 1, -limit)
  7412. }
  7413. var i = 0
  7414. var mul = 1
  7415. var sub = 0
  7416. this[offset] = value & 0xFF
  7417. while (++i < byteLength && (mul *= 0x100)) {
  7418. if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {
  7419. sub = 1
  7420. }
  7421. this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
  7422. }
  7423. return offset + byteLength
  7424. }
  7425. Buffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {
  7426. value = +value
  7427. offset = offset | 0
  7428. if (!noAssert) {
  7429. var limit = Math.pow(2, 8 * byteLength - 1)
  7430. checkInt(this, value, offset, byteLength, limit - 1, -limit)
  7431. }
  7432. var i = byteLength - 1
  7433. var mul = 1
  7434. var sub = 0
  7435. this[offset + i] = value & 0xFF
  7436. while (--i >= 0 && (mul *= 0x100)) {
  7437. if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {
  7438. sub = 1
  7439. }
  7440. this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
  7441. }
  7442. return offset + byteLength
  7443. }
  7444. Buffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {
  7445. value = +value
  7446. offset = offset | 0
  7447. if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80)
  7448. if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)
  7449. if (value < 0) value = 0xff + value + 1
  7450. this[offset] = (value & 0xff)
  7451. return offset + 1
  7452. }
  7453. Buffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {
  7454. value = +value
  7455. offset = offset | 0
  7456. if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
  7457. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7458. this[offset] = (value & 0xff)
  7459. this[offset + 1] = (value >>> 8)
  7460. } else {
  7461. objectWriteUInt16(this, value, offset, true)
  7462. }
  7463. return offset + 2
  7464. }
  7465. Buffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {
  7466. value = +value
  7467. offset = offset | 0
  7468. if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
  7469. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7470. this[offset] = (value >>> 8)
  7471. this[offset + 1] = (value & 0xff)
  7472. } else {
  7473. objectWriteUInt16(this, value, offset, false)
  7474. }
  7475. return offset + 2
  7476. }
  7477. Buffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {
  7478. value = +value
  7479. offset = offset | 0
  7480. if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
  7481. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7482. this[offset] = (value & 0xff)
  7483. this[offset + 1] = (value >>> 8)
  7484. this[offset + 2] = (value >>> 16)
  7485. this[offset + 3] = (value >>> 24)
  7486. } else {
  7487. objectWriteUInt32(this, value, offset, true)
  7488. }
  7489. return offset + 4
  7490. }
  7491. Buffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {
  7492. value = +value
  7493. offset = offset | 0
  7494. if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
  7495. if (value < 0) value = 0xffffffff + value + 1
  7496. if (Buffer.TYPED_ARRAY_SUPPORT) {
  7497. this[offset] = (value >>> 24)
  7498. this[offset + 1] = (value >>> 16)
  7499. this[offset + 2] = (value >>> 8)
  7500. this[offset + 3] = (value & 0xff)
  7501. } else {
  7502. objectWriteUInt32(this, value, offset, false)
  7503. }
  7504. return offset + 4
  7505. }
  7506. function checkIEEE754 (buf, value, offset, ext, max, min) {
  7507. if (offset + ext > buf.length) throw new RangeError('Index out of range')
  7508. if (offset < 0) throw new RangeError('Index out of range')
  7509. }
  7510. function writeFloat (buf, value, offset, littleEndian, noAssert) {
  7511. if (!noAssert) {
  7512. checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38)
  7513. }
  7514. ieee754.write(buf, value, offset, littleEndian, 23, 4)
  7515. return offset + 4
  7516. }
  7517. Buffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {
  7518. return writeFloat(this, value, offset, true, noAssert)
  7519. }
  7520. Buffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {
  7521. return writeFloat(this, value, offset, false, noAssert)
  7522. }
  7523. function writeDouble (buf, value, offset, littleEndian, noAssert) {
  7524. if (!noAssert) {
  7525. checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308)
  7526. }
  7527. ieee754.write(buf, value, offset, littleEndian, 52, 8)
  7528. return offset + 8
  7529. }
  7530. Buffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {
  7531. return writeDouble(this, value, offset, true, noAssert)
  7532. }
  7533. Buffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {
  7534. return writeDouble(this, value, offset, false, noAssert)
  7535. }
  7536. // copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)
  7537. Buffer.prototype.copy = function copy (target, targetStart, start, end) {
  7538. if (!start) start = 0
  7539. if (!end && end !== 0) end = this.length
  7540. if (targetStart >= target.length) targetStart = target.length
  7541. if (!targetStart) targetStart = 0
  7542. if (end > 0 && end < start) end = start
  7543. // Copy 0 bytes; we're done
  7544. if (end === start) return 0
  7545. if (target.length === 0 || this.length === 0) return 0
  7546. // Fatal error conditions
  7547. if (targetStart < 0) {
  7548. throw new RangeError('targetStart out of bounds')
  7549. }
  7550. if (start < 0 || start >= this.length) throw new RangeError('sourceStart out of bounds')
  7551. if (end < 0) throw new RangeError('sourceEnd out of bounds')
  7552. // Are we oob?
  7553. if (end > this.length) end = this.length
  7554. if (target.length - targetStart < end - start) {
  7555. end = target.length - targetStart + start
  7556. }
  7557. var len = end - start
  7558. var i
  7559. if (this === target && start < targetStart && targetStart < end) {
  7560. // descending copy from end
  7561. for (i = len - 1; i >= 0; --i) {
  7562. target[i + targetStart] = this[i + start]
  7563. }
  7564. } else if (len < 1000 || !Buffer.TYPED_ARRAY_SUPPORT) {
  7565. // ascending copy from start
  7566. for (i = 0; i < len; ++i) {
  7567. target[i + targetStart] = this[i + start]
  7568. }
  7569. } else {
  7570. Uint8Array.prototype.set.call(
  7571. target,
  7572. this.subarray(start, start + len),
  7573. targetStart
  7574. )
  7575. }
  7576. return len
  7577. }
  7578. // Usage:
  7579. // buffer.fill(number[, offset[, end]])
  7580. // buffer.fill(buffer[, offset[, end]])
  7581. // buffer.fill(string[, offset[, end]][, encoding])
  7582. Buffer.prototype.fill = function fill (val, start, end, encoding) {
  7583. // Handle string cases:
  7584. if (typeof val === 'string') {
  7585. if (typeof start === 'string') {
  7586. encoding = start
  7587. start = 0
  7588. end = this.length
  7589. } else if (typeof end === 'string') {
  7590. encoding = end
  7591. end = this.length
  7592. }
  7593. if (val.length === 1) {
  7594. var code = val.charCodeAt(0)
  7595. if (code < 256) {
  7596. val = code
  7597. }
  7598. }
  7599. if (encoding !== undefined && typeof encoding !== 'string') {
  7600. throw new TypeError('encoding must be a string')
  7601. }
  7602. if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {
  7603. throw new TypeError('Unknown encoding: ' + encoding)
  7604. }
  7605. } else if (typeof val === 'number') {
  7606. val = val & 255
  7607. }
  7608. // Invalid ranges are not set to a default, so can range check early.
  7609. if (start < 0 || this.length < start || this.length < end) {
  7610. throw new RangeError('Out of range index')
  7611. }
  7612. if (end <= start) {
  7613. return this
  7614. }
  7615. start = start >>> 0
  7616. end = end === undefined ? this.length : end >>> 0
  7617. if (!val) val = 0
  7618. var i
  7619. if (typeof val === 'number') {
  7620. for (i = start; i < end; ++i) {
  7621. this[i] = val
  7622. }
  7623. } else {
  7624. var bytes = Buffer.isBuffer(val)
  7625. ? val
  7626. : utf8ToBytes(new Buffer(val, encoding).toString())
  7627. var len = bytes.length
  7628. for (i = 0; i < end - start; ++i) {
  7629. this[i + start] = bytes[i % len]
  7630. }
  7631. }
  7632. return this
  7633. }
  7634. // HELPER FUNCTIONS
  7635. // ================
  7636. var INVALID_BASE64_RE = /[^+\/0-9A-Za-z-_]/g
  7637. function base64clean (str) {
  7638. // Node strips out invalid characters like \n and \t from the string, base64-js does not
  7639. str = stringtrim(str).replace(INVALID_BASE64_RE, '')
  7640. // Node converts strings with length < 2 to ''
  7641. if (str.length < 2) return ''
  7642. // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not
  7643. while (str.length % 4 !== 0) {
  7644. str = str + '='
  7645. }
  7646. return str
  7647. }
  7648. function stringtrim (str) {
  7649. if (str.trim) return str.trim()
  7650. return str.replace(/^\s+|\s+$/g, '')
  7651. }
  7652. function toHex (n) {
  7653. if (n < 16) return '0' + n.toString(16)
  7654. return n.toString(16)
  7655. }
  7656. function utf8ToBytes (string, units) {
  7657. units = units || Infinity
  7658. var codePoint
  7659. var length = string.length
  7660. var leadSurrogate = null
  7661. var bytes = []
  7662. for (var i = 0; i < length; ++i) {
  7663. codePoint = string.charCodeAt(i)
  7664. // is surrogate component
  7665. if (codePoint > 0xD7FF && codePoint < 0xE000) {
  7666. // last char was a lead
  7667. if (!leadSurrogate) {
  7668. // no lead yet
  7669. if (codePoint > 0xDBFF) {
  7670. // unexpected trail
  7671. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  7672. continue
  7673. } else if (i + 1 === length) {
  7674. // unpaired lead
  7675. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  7676. continue
  7677. }
  7678. // valid lead
  7679. leadSurrogate = codePoint
  7680. continue
  7681. }
  7682. // 2 leads in a row
  7683. if (codePoint < 0xDC00) {
  7684. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  7685. leadSurrogate = codePoint
  7686. continue
  7687. }
  7688. // valid surrogate pair
  7689. codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000
  7690. } else if (leadSurrogate) {
  7691. // valid bmp char, but last char was a lead
  7692. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  7693. }
  7694. leadSurrogate = null
  7695. // encode utf8
  7696. if (codePoint < 0x80) {
  7697. if ((units -= 1) < 0) break
  7698. bytes.push(codePoint)
  7699. } else if (codePoint < 0x800) {
  7700. if ((units -= 2) < 0) break
  7701. bytes.push(
  7702. codePoint >> 0x6 | 0xC0,
  7703. codePoint & 0x3F | 0x80
  7704. )
  7705. } else if (codePoint < 0x10000) {
  7706. if ((units -= 3) < 0) break
  7707. bytes.push(
  7708. codePoint >> 0xC | 0xE0,
  7709. codePoint >> 0x6 & 0x3F | 0x80,
  7710. codePoint & 0x3F | 0x80
  7711. )
  7712. } else if (codePoint < 0x110000) {
  7713. if ((units -= 4) < 0) break
  7714. bytes.push(
  7715. codePoint >> 0x12 | 0xF0,
  7716. codePoint >> 0xC & 0x3F | 0x80,
  7717. codePoint >> 0x6 & 0x3F | 0x80,
  7718. codePoint & 0x3F | 0x80
  7719. )
  7720. } else {
  7721. throw new Error('Invalid code point')
  7722. }
  7723. }
  7724. return bytes
  7725. }
  7726. function asciiToBytes (str) {
  7727. var byteArray = []
  7728. for (var i = 0; i < str.length; ++i) {
  7729. // Node's code seems to be doing this and not & 0x7F..
  7730. byteArray.push(str.charCodeAt(i) & 0xFF)
  7731. }
  7732. return byteArray
  7733. }
  7734. function utf16leToBytes (str, units) {
  7735. var c, hi, lo
  7736. var byteArray = []
  7737. for (var i = 0; i < str.length; ++i) {
  7738. if ((units -= 2) < 0) break
  7739. c = str.charCodeAt(i)
  7740. hi = c >> 8
  7741. lo = c % 256
  7742. byteArray.push(lo)
  7743. byteArray.push(hi)
  7744. }
  7745. return byteArray
  7746. }
  7747. function base64ToBytes (str) {
  7748. return base64.toByteArray(base64clean(str))
  7749. }
  7750. function blitBuffer (src, dst, offset, length) {
  7751. for (var i = 0; i < length; ++i) {
  7752. if ((i + offset >= dst.length) || (i >= src.length)) break
  7753. dst[i + offset] = src[i]
  7754. }
  7755. return i
  7756. }
  7757. function isnan (val) {
  7758. return val !== val // eslint-disable-line no-self-compare
  7759. }
  7760. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")))
  7761. /***/ }),
  7762. /***/ "./node_modules/clipboard/dist/clipboard.js":
  7763. /*!**************************************************!*\
  7764. !*** ./node_modules/clipboard/dist/clipboard.js ***!
  7765. \**************************************************/
  7766. /*! no static exports found */
  7767. /***/ (function(module, exports, __webpack_require__) {
  7768. /*!
  7769. * clipboard.js v2.0.4
  7770. * https://zenorocha.github.io/clipboard.js
  7771. *
  7772. * Licensed MIT © Zeno Rocha
  7773. */
  7774. (function webpackUniversalModuleDefinition(root, factory) {
  7775. if(true)
  7776. module.exports = factory();
  7777. else {}
  7778. })(this, function() {
  7779. return /******/ (function(modules) { // webpackBootstrap
  7780. /******/ // The module cache
  7781. /******/ var installedModules = {};
  7782. /******/
  7783. /******/ // The require function
  7784. /******/ function __webpack_require__(moduleId) {
  7785. /******/
  7786. /******/ // Check if module is in cache
  7787. /******/ if(installedModules[moduleId]) {
  7788. /******/ return installedModules[moduleId].exports;
  7789. /******/ }
  7790. /******/ // Create a new module (and put it into the cache)
  7791. /******/ var module = installedModules[moduleId] = {
  7792. /******/ i: moduleId,
  7793. /******/ l: false,
  7794. /******/ exports: {}
  7795. /******/ };
  7796. /******/
  7797. /******/ // Execute the module function
  7798. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  7799. /******/
  7800. /******/ // Flag the module as loaded
  7801. /******/ module.l = true;
  7802. /******/
  7803. /******/ // Return the exports of the module
  7804. /******/ return module.exports;
  7805. /******/ }
  7806. /******/
  7807. /******/
  7808. /******/ // expose the modules object (__webpack_modules__)
  7809. /******/ __webpack_require__.m = modules;
  7810. /******/
  7811. /******/ // expose the module cache
  7812. /******/ __webpack_require__.c = installedModules;
  7813. /******/
  7814. /******/ // define getter function for harmony exports
  7815. /******/ __webpack_require__.d = function(exports, name, getter) {
  7816. /******/ if(!__webpack_require__.o(exports, name)) {
  7817. /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
  7818. /******/ }
  7819. /******/ };
  7820. /******/
  7821. /******/ // define __esModule on exports
  7822. /******/ __webpack_require__.r = function(exports) {
  7823. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  7824. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  7825. /******/ }
  7826. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  7827. /******/ };
  7828. /******/
  7829. /******/ // create a fake namespace object
  7830. /******/ // mode & 1: value is a module id, require it
  7831. /******/ // mode & 2: merge all properties of value into the ns
  7832. /******/ // mode & 4: return value when already ns object
  7833. /******/ // mode & 8|1: behave like require
  7834. /******/ __webpack_require__.t = function(value, mode) {
  7835. /******/ if(mode & 1) value = __webpack_require__(value);
  7836. /******/ if(mode & 8) return value;
  7837. /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
  7838. /******/ var ns = Object.create(null);
  7839. /******/ __webpack_require__.r(ns);
  7840. /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
  7841. /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
  7842. /******/ return ns;
  7843. /******/ };
  7844. /******/
  7845. /******/ // getDefaultExport function for compatibility with non-harmony modules
  7846. /******/ __webpack_require__.n = function(module) {
  7847. /******/ var getter = module && module.__esModule ?
  7848. /******/ function getDefault() { return module['default']; } :
  7849. /******/ function getModuleExports() { return module; };
  7850. /******/ __webpack_require__.d(getter, 'a', getter);
  7851. /******/ return getter;
  7852. /******/ };
  7853. /******/
  7854. /******/ // Object.prototype.hasOwnProperty.call
  7855. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  7856. /******/
  7857. /******/ // __webpack_public_path__
  7858. /******/ __webpack_require__.p = "";
  7859. /******/
  7860. /******/
  7861. /******/ // Load entry module and return exports
  7862. /******/ return __webpack_require__(__webpack_require__.s = 0);
  7863. /******/ })
  7864. /************************************************************************/
  7865. /******/ ([
  7866. /* 0 */
  7867. /***/ (function(module, exports, __webpack_require__) {
  7868. "use strict";
  7869. 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; };
  7870. 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; }; }();
  7871. var _clipboardAction = __webpack_require__(1);
  7872. var _clipboardAction2 = _interopRequireDefault(_clipboardAction);
  7873. var _tinyEmitter = __webpack_require__(3);
  7874. var _tinyEmitter2 = _interopRequireDefault(_tinyEmitter);
  7875. var _goodListener = __webpack_require__(4);
  7876. var _goodListener2 = _interopRequireDefault(_goodListener);
  7877. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  7878. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  7879. 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; }
  7880. 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; }
  7881. /**
  7882. * Base class which takes one or more elements, adds event listeners to them,
  7883. * and instantiates a new `ClipboardAction` on each click.
  7884. */
  7885. var Clipboard = function (_Emitter) {
  7886. _inherits(Clipboard, _Emitter);
  7887. /**
  7888. * @param {String|HTMLElement|HTMLCollection|NodeList} trigger
  7889. * @param {Object} options
  7890. */
  7891. function Clipboard(trigger, options) {
  7892. _classCallCheck(this, Clipboard);
  7893. var _this = _possibleConstructorReturn(this, (Clipboard.__proto__ || Object.getPrototypeOf(Clipboard)).call(this));
  7894. _this.resolveOptions(options);
  7895. _this.listenClick(trigger);
  7896. return _this;
  7897. }
  7898. /**
  7899. * Defines if attributes would be resolved using internal setter functions
  7900. * or custom functions that were passed in the constructor.
  7901. * @param {Object} options
  7902. */
  7903. _createClass(Clipboard, [{
  7904. key: 'resolveOptions',
  7905. value: function resolveOptions() {
  7906. var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  7907. this.action = typeof options.action === 'function' ? options.action : this.defaultAction;
  7908. this.target = typeof options.target === 'function' ? options.target : this.defaultTarget;
  7909. this.text = typeof options.text === 'function' ? options.text : this.defaultText;
  7910. this.container = _typeof(options.container) === 'object' ? options.container : document.body;
  7911. }
  7912. /**
  7913. * Adds a click event listener to the passed trigger.
  7914. * @param {String|HTMLElement|HTMLCollection|NodeList} trigger
  7915. */
  7916. }, {
  7917. key: 'listenClick',
  7918. value: function listenClick(trigger) {
  7919. var _this2 = this;
  7920. this.listener = (0, _goodListener2.default)(trigger, 'click', function (e) {
  7921. return _this2.onClick(e);
  7922. });
  7923. }
  7924. /**
  7925. * Defines a new `ClipboardAction` on each click event.
  7926. * @param {Event} e
  7927. */
  7928. }, {
  7929. key: 'onClick',
  7930. value: function onClick(e) {
  7931. var trigger = e.delegateTarget || e.currentTarget;
  7932. if (this.clipboardAction) {
  7933. this.clipboardAction = null;
  7934. }
  7935. this.clipboardAction = new _clipboardAction2.default({
  7936. action: this.action(trigger),
  7937. target: this.target(trigger),
  7938. text: this.text(trigger),
  7939. container: this.container,
  7940. trigger: trigger,
  7941. emitter: this
  7942. });
  7943. }
  7944. /**
  7945. * Default `action` lookup function.
  7946. * @param {Element} trigger
  7947. */
  7948. }, {
  7949. key: 'defaultAction',
  7950. value: function defaultAction(trigger) {
  7951. return getAttributeValue('action', trigger);
  7952. }
  7953. /**
  7954. * Default `target` lookup function.
  7955. * @param {Element} trigger
  7956. */
  7957. }, {
  7958. key: 'defaultTarget',
  7959. value: function defaultTarget(trigger) {
  7960. var selector = getAttributeValue('target', trigger);
  7961. if (selector) {
  7962. return document.querySelector(selector);
  7963. }
  7964. }
  7965. /**
  7966. * Returns the support of the given action, or all actions if no action is
  7967. * given.
  7968. * @param {String} [action]
  7969. */
  7970. }, {
  7971. key: 'defaultText',
  7972. /**
  7973. * Default `text` lookup function.
  7974. * @param {Element} trigger
  7975. */
  7976. value: function defaultText(trigger) {
  7977. return getAttributeValue('text', trigger);
  7978. }
  7979. /**
  7980. * Destroy lifecycle.
  7981. */
  7982. }, {
  7983. key: 'destroy',
  7984. value: function destroy() {
  7985. this.listener.destroy();
  7986. if (this.clipboardAction) {
  7987. this.clipboardAction.destroy();
  7988. this.clipboardAction = null;
  7989. }
  7990. }
  7991. }], [{
  7992. key: 'isSupported',
  7993. value: function isSupported() {
  7994. var action = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ['copy', 'cut'];
  7995. var actions = typeof action === 'string' ? [action] : action;
  7996. var support = !!document.queryCommandSupported;
  7997. actions.forEach(function (action) {
  7998. support = support && !!document.queryCommandSupported(action);
  7999. });
  8000. return support;
  8001. }
  8002. }]);
  8003. return Clipboard;
  8004. }(_tinyEmitter2.default);
  8005. /**
  8006. * Helper function to retrieve attribute value.
  8007. * @param {String} suffix
  8008. * @param {Element} element
  8009. */
  8010. function getAttributeValue(suffix, element) {
  8011. var attribute = 'data-clipboard-' + suffix;
  8012. if (!element.hasAttribute(attribute)) {
  8013. return;
  8014. }
  8015. return element.getAttribute(attribute);
  8016. }
  8017. module.exports = Clipboard;
  8018. /***/ }),
  8019. /* 1 */
  8020. /***/ (function(module, exports, __webpack_require__) {
  8021. "use strict";
  8022. 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; };
  8023. 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; }; }();
  8024. var _select = __webpack_require__(2);
  8025. var _select2 = _interopRequireDefault(_select);
  8026. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  8027. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  8028. /**
  8029. * Inner class which performs selection from either `text` or `target`
  8030. * properties and then executes copy or cut operations.
  8031. */
  8032. var ClipboardAction = function () {
  8033. /**
  8034. * @param {Object} options
  8035. */
  8036. function ClipboardAction(options) {
  8037. _classCallCheck(this, ClipboardAction);
  8038. this.resolveOptions(options);
  8039. this.initSelection();
  8040. }
  8041. /**
  8042. * Defines base properties passed from constructor.
  8043. * @param {Object} options
  8044. */
  8045. _createClass(ClipboardAction, [{
  8046. key: 'resolveOptions',
  8047. value: function resolveOptions() {
  8048. var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  8049. this.action = options.action;
  8050. this.container = options.container;
  8051. this.emitter = options.emitter;
  8052. this.target = options.target;
  8053. this.text = options.text;
  8054. this.trigger = options.trigger;
  8055. this.selectedText = '';
  8056. }
  8057. /**
  8058. * Decides which selection strategy is going to be applied based
  8059. * on the existence of `text` and `target` properties.
  8060. */
  8061. }, {
  8062. key: 'initSelection',
  8063. value: function initSelection() {
  8064. if (this.text) {
  8065. this.selectFake();
  8066. } else if (this.target) {
  8067. this.selectTarget();
  8068. }
  8069. }
  8070. /**
  8071. * Creates a fake textarea element, sets its value from `text` property,
  8072. * and makes a selection on it.
  8073. */
  8074. }, {
  8075. key: 'selectFake',
  8076. value: function selectFake() {
  8077. var _this = this;
  8078. var isRTL = document.documentElement.getAttribute('dir') == 'rtl';
  8079. this.removeFake();
  8080. this.fakeHandlerCallback = function () {
  8081. return _this.removeFake();
  8082. };
  8083. this.fakeHandler = this.container.addEventListener('click', this.fakeHandlerCallback) || true;
  8084. this.fakeElem = document.createElement('textarea');
  8085. // Prevent zooming on iOS
  8086. this.fakeElem.style.fontSize = '12pt';
  8087. // Reset box model
  8088. this.fakeElem.style.border = '0';
  8089. this.fakeElem.style.padding = '0';
  8090. this.fakeElem.style.margin = '0';
  8091. // Move element out of screen horizontally
  8092. this.fakeElem.style.position = 'absolute';
  8093. this.fakeElem.style[isRTL ? 'right' : 'left'] = '-9999px';
  8094. // Move element to the same position vertically
  8095. var yPosition = window.pageYOffset || document.documentElement.scrollTop;
  8096. this.fakeElem.style.top = yPosition + 'px';
  8097. this.fakeElem.setAttribute('readonly', '');
  8098. this.fakeElem.value = this.text;
  8099. this.container.appendChild(this.fakeElem);
  8100. this.selectedText = (0, _select2.default)(this.fakeElem);
  8101. this.copyText();
  8102. }
  8103. /**
  8104. * Only removes the fake element after another click event, that way
  8105. * a user can hit `Ctrl+C` to copy because selection still exists.
  8106. */
  8107. }, {
  8108. key: 'removeFake',
  8109. value: function removeFake() {
  8110. if (this.fakeHandler) {
  8111. this.container.removeEventListener('click', this.fakeHandlerCallback);
  8112. this.fakeHandler = null;
  8113. this.fakeHandlerCallback = null;
  8114. }
  8115. if (this.fakeElem) {
  8116. this.container.removeChild(this.fakeElem);
  8117. this.fakeElem = null;
  8118. }
  8119. }
  8120. /**
  8121. * Selects the content from element passed on `target` property.
  8122. */
  8123. }, {
  8124. key: 'selectTarget',
  8125. value: function selectTarget() {
  8126. this.selectedText = (0, _select2.default)(this.target);
  8127. this.copyText();
  8128. }
  8129. /**
  8130. * Executes the copy operation based on the current selection.
  8131. */
  8132. }, {
  8133. key: 'copyText',
  8134. value: function copyText() {
  8135. var succeeded = void 0;
  8136. try {
  8137. succeeded = document.execCommand(this.action);
  8138. } catch (err) {
  8139. succeeded = false;
  8140. }
  8141. this.handleResult(succeeded);
  8142. }
  8143. /**
  8144. * Fires an event based on the copy operation result.
  8145. * @param {Boolean} succeeded
  8146. */
  8147. }, {
  8148. key: 'handleResult',
  8149. value: function handleResult(succeeded) {
  8150. this.emitter.emit(succeeded ? 'success' : 'error', {
  8151. action: this.action,
  8152. text: this.selectedText,
  8153. trigger: this.trigger,
  8154. clearSelection: this.clearSelection.bind(this)
  8155. });
  8156. }
  8157. /**
  8158. * Moves focus away from `target` and back to the trigger, removes current selection.
  8159. */
  8160. }, {
  8161. key: 'clearSelection',
  8162. value: function clearSelection() {
  8163. if (this.trigger) {
  8164. this.trigger.focus();
  8165. }
  8166. window.getSelection().removeAllRanges();
  8167. }
  8168. /**
  8169. * Sets the `action` to be performed which can be either 'copy' or 'cut'.
  8170. * @param {String} action
  8171. */
  8172. }, {
  8173. key: 'destroy',
  8174. /**
  8175. * Destroy lifecycle.
  8176. */
  8177. value: function destroy() {
  8178. this.removeFake();
  8179. }
  8180. }, {
  8181. key: 'action',
  8182. set: function set() {
  8183. var action = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'copy';
  8184. this._action = action;
  8185. if (this._action !== 'copy' && this._action !== 'cut') {
  8186. throw new Error('Invalid "action" value, use either "copy" or "cut"');
  8187. }
  8188. }
  8189. /**
  8190. * Gets the `action` property.
  8191. * @return {String}
  8192. */
  8193. ,
  8194. get: function get() {
  8195. return this._action;
  8196. }
  8197. /**
  8198. * Sets the `target` property using an element
  8199. * that will be have its content copied.
  8200. * @param {Element} target
  8201. */
  8202. }, {
  8203. key: 'target',
  8204. set: function set(target) {
  8205. if (target !== undefined) {
  8206. if (target && (typeof target === 'undefined' ? 'undefined' : _typeof(target)) === 'object' && target.nodeType === 1) {
  8207. if (this.action === 'copy' && target.hasAttribute('disabled')) {
  8208. throw new Error('Invalid "target" attribute. Please use "readonly" instead of "disabled" attribute');
  8209. }
  8210. if (this.action === 'cut' && (target.hasAttribute('readonly') || target.hasAttribute('disabled'))) {
  8211. throw new Error('Invalid "target" attribute. You can\'t cut text from elements with "readonly" or "disabled" attributes');
  8212. }
  8213. this._target = target;
  8214. } else {
  8215. throw new Error('Invalid "target" value, use a valid Element');
  8216. }
  8217. }
  8218. }
  8219. /**
  8220. * Gets the `target` property.
  8221. * @return {String|HTMLElement}
  8222. */
  8223. ,
  8224. get: function get() {
  8225. return this._target;
  8226. }
  8227. }]);
  8228. return ClipboardAction;
  8229. }();
  8230. module.exports = ClipboardAction;
  8231. /***/ }),
  8232. /* 2 */
  8233. /***/ (function(module, exports) {
  8234. function select(element) {
  8235. var selectedText;
  8236. if (element.nodeName === 'SELECT') {
  8237. element.focus();
  8238. selectedText = element.value;
  8239. }
  8240. else if (element.nodeName === 'INPUT' || element.nodeName === 'TEXTAREA') {
  8241. var isReadOnly = element.hasAttribute('readonly');
  8242. if (!isReadOnly) {
  8243. element.setAttribute('readonly', '');
  8244. }
  8245. element.select();
  8246. element.setSelectionRange(0, element.value.length);
  8247. if (!isReadOnly) {
  8248. element.removeAttribute('readonly');
  8249. }
  8250. selectedText = element.value;
  8251. }
  8252. else {
  8253. if (element.hasAttribute('contenteditable')) {
  8254. element.focus();
  8255. }
  8256. var selection = window.getSelection();
  8257. var range = document.createRange();
  8258. range.selectNodeContents(element);
  8259. selection.removeAllRanges();
  8260. selection.addRange(range);
  8261. selectedText = selection.toString();
  8262. }
  8263. return selectedText;
  8264. }
  8265. module.exports = select;
  8266. /***/ }),
  8267. /* 3 */
  8268. /***/ (function(module, exports) {
  8269. function E () {
  8270. // Keep this empty so it's easier to inherit from
  8271. // (via https://github.com/lipsmack from https://github.com/scottcorgan/tiny-emitter/issues/3)
  8272. }
  8273. E.prototype = {
  8274. on: function (name, callback, ctx) {
  8275. var e = this.e || (this.e = {});
  8276. (e[name] || (e[name] = [])).push({
  8277. fn: callback,
  8278. ctx: ctx
  8279. });
  8280. return this;
  8281. },
  8282. once: function (name, callback, ctx) {
  8283. var self = this;
  8284. function listener () {
  8285. self.off(name, listener);
  8286. callback.apply(ctx, arguments);
  8287. };
  8288. listener._ = callback
  8289. return this.on(name, listener, ctx);
  8290. },
  8291. emit: function (name) {
  8292. var data = [].slice.call(arguments, 1);
  8293. var evtArr = ((this.e || (this.e = {}))[name] || []).slice();
  8294. var i = 0;
  8295. var len = evtArr.length;
  8296. for (i; i < len; i++) {
  8297. evtArr[i].fn.apply(evtArr[i].ctx, data);
  8298. }
  8299. return this;
  8300. },
  8301. off: function (name, callback) {
  8302. var e = this.e || (this.e = {});
  8303. var evts = e[name];
  8304. var liveEvents = [];
  8305. if (evts && callback) {
  8306. for (var i = 0, len = evts.length; i < len; i++) {
  8307. if (evts[i].fn !== callback && evts[i].fn._ !== callback)
  8308. liveEvents.push(evts[i]);
  8309. }
  8310. }
  8311. // Remove event from queue to prevent memory leak
  8312. // Suggested by https://github.com/lazd
  8313. // Ref: https://github.com/scottcorgan/tiny-emitter/commit/c6ebfaa9bc973b33d110a84a307742b7cf94c953#commitcomment-5024910
  8314. (liveEvents.length)
  8315. ? e[name] = liveEvents
  8316. : delete e[name];
  8317. return this;
  8318. }
  8319. };
  8320. module.exports = E;
  8321. /***/ }),
  8322. /* 4 */
  8323. /***/ (function(module, exports, __webpack_require__) {
  8324. var is = __webpack_require__(5);
  8325. var delegate = __webpack_require__(6);
  8326. /**
  8327. * Validates all params and calls the right
  8328. * listener function based on its target type.
  8329. *
  8330. * @param {String|HTMLElement|HTMLCollection|NodeList} target
  8331. * @param {String} type
  8332. * @param {Function} callback
  8333. * @return {Object}
  8334. */
  8335. function listen(target, type, callback) {
  8336. if (!target && !type && !callback) {
  8337. throw new Error('Missing required arguments');
  8338. }
  8339. if (!is.string(type)) {
  8340. throw new TypeError('Second argument must be a String');
  8341. }
  8342. if (!is.fn(callback)) {
  8343. throw new TypeError('Third argument must be a Function');
  8344. }
  8345. if (is.node(target)) {
  8346. return listenNode(target, type, callback);
  8347. }
  8348. else if (is.nodeList(target)) {
  8349. return listenNodeList(target, type, callback);
  8350. }
  8351. else if (is.string(target)) {
  8352. return listenSelector(target, type, callback);
  8353. }
  8354. else {
  8355. throw new TypeError('First argument must be a String, HTMLElement, HTMLCollection, or NodeList');
  8356. }
  8357. }
  8358. /**
  8359. * Adds an event listener to a HTML element
  8360. * and returns a remove listener function.
  8361. *
  8362. * @param {HTMLElement} node
  8363. * @param {String} type
  8364. * @param {Function} callback
  8365. * @return {Object}
  8366. */
  8367. function listenNode(node, type, callback) {
  8368. node.addEventListener(type, callback);
  8369. return {
  8370. destroy: function() {
  8371. node.removeEventListener(type, callback);
  8372. }
  8373. }
  8374. }
  8375. /**
  8376. * Add an event listener to a list of HTML elements
  8377. * and returns a remove listener function.
  8378. *
  8379. * @param {NodeList|HTMLCollection} nodeList
  8380. * @param {String} type
  8381. * @param {Function} callback
  8382. * @return {Object}
  8383. */
  8384. function listenNodeList(nodeList, type, callback) {
  8385. Array.prototype.forEach.call(nodeList, function(node) {
  8386. node.addEventListener(type, callback);
  8387. });
  8388. return {
  8389. destroy: function() {
  8390. Array.prototype.forEach.call(nodeList, function(node) {
  8391. node.removeEventListener(type, callback);
  8392. });
  8393. }
  8394. }
  8395. }
  8396. /**
  8397. * Add an event listener to a selector
  8398. * and returns a remove listener function.
  8399. *
  8400. * @param {String} selector
  8401. * @param {String} type
  8402. * @param {Function} callback
  8403. * @return {Object}
  8404. */
  8405. function listenSelector(selector, type, callback) {
  8406. return delegate(document.body, selector, type, callback);
  8407. }
  8408. module.exports = listen;
  8409. /***/ }),
  8410. /* 5 */
  8411. /***/ (function(module, exports) {
  8412. /**
  8413. * Check if argument is a HTML element.
  8414. *
  8415. * @param {Object} value
  8416. * @return {Boolean}
  8417. */
  8418. exports.node = function(value) {
  8419. return value !== undefined
  8420. && value instanceof HTMLElement
  8421. && value.nodeType === 1;
  8422. };
  8423. /**
  8424. * Check if argument is a list of HTML elements.
  8425. *
  8426. * @param {Object} value
  8427. * @return {Boolean}
  8428. */
  8429. exports.nodeList = function(value) {
  8430. var type = Object.prototype.toString.call(value);
  8431. return value !== undefined
  8432. && (type === '[object NodeList]' || type === '[object HTMLCollection]')
  8433. && ('length' in value)
  8434. && (value.length === 0 || exports.node(value[0]));
  8435. };
  8436. /**
  8437. * Check if argument is a string.
  8438. *
  8439. * @param {Object} value
  8440. * @return {Boolean}
  8441. */
  8442. exports.string = function(value) {
  8443. return typeof value === 'string'
  8444. || value instanceof String;
  8445. };
  8446. /**
  8447. * Check if argument is a function.
  8448. *
  8449. * @param {Object} value
  8450. * @return {Boolean}
  8451. */
  8452. exports.fn = function(value) {
  8453. var type = Object.prototype.toString.call(value);
  8454. return type === '[object Function]';
  8455. };
  8456. /***/ }),
  8457. /* 6 */
  8458. /***/ (function(module, exports, __webpack_require__) {
  8459. var closest = __webpack_require__(7);
  8460. /**
  8461. * Delegates event to a selector.
  8462. *
  8463. * @param {Element} element
  8464. * @param {String} selector
  8465. * @param {String} type
  8466. * @param {Function} callback
  8467. * @param {Boolean} useCapture
  8468. * @return {Object}
  8469. */
  8470. function _delegate(element, selector, type, callback, useCapture) {
  8471. var listenerFn = listener.apply(this, arguments);
  8472. element.addEventListener(type, listenerFn, useCapture);
  8473. return {
  8474. destroy: function() {
  8475. element.removeEventListener(type, listenerFn, useCapture);
  8476. }
  8477. }
  8478. }
  8479. /**
  8480. * Delegates event to a selector.
  8481. *
  8482. * @param {Element|String|Array} [elements]
  8483. * @param {String} selector
  8484. * @param {String} type
  8485. * @param {Function} callback
  8486. * @param {Boolean} useCapture
  8487. * @return {Object}
  8488. */
  8489. function delegate(elements, selector, type, callback, useCapture) {
  8490. // Handle the regular Element usage
  8491. if (typeof elements.addEventListener === 'function') {
  8492. return _delegate.apply(null, arguments);
  8493. }
  8494. // Handle Element-less usage, it defaults to global delegation
  8495. if (typeof type === 'function') {
  8496. // Use `document` as the first parameter, then apply arguments
  8497. // This is a short way to .unshift `arguments` without running into deoptimizations
  8498. return _delegate.bind(null, document).apply(null, arguments);
  8499. }
  8500. // Handle Selector-based usage
  8501. if (typeof elements === 'string') {
  8502. elements = document.querySelectorAll(elements);
  8503. }
  8504. // Handle Array-like based usage
  8505. return Array.prototype.map.call(elements, function (element) {
  8506. return _delegate(element, selector, type, callback, useCapture);
  8507. });
  8508. }
  8509. /**
  8510. * Finds closest match and invokes callback.
  8511. *
  8512. * @param {Element} element
  8513. * @param {String} selector
  8514. * @param {String} type
  8515. * @param {Function} callback
  8516. * @return {Function}
  8517. */
  8518. function listener(element, selector, type, callback) {
  8519. return function(e) {
  8520. e.delegateTarget = closest(e.target, selector);
  8521. if (e.delegateTarget) {
  8522. callback.call(element, e);
  8523. }
  8524. }
  8525. }
  8526. module.exports = delegate;
  8527. /***/ }),
  8528. /* 7 */
  8529. /***/ (function(module, exports) {
  8530. var DOCUMENT_NODE_TYPE = 9;
  8531. /**
  8532. * A polyfill for Element.matches()
  8533. */
  8534. if (typeof Element !== 'undefined' && !Element.prototype.matches) {
  8535. var proto = Element.prototype;
  8536. proto.matches = proto.matchesSelector ||
  8537. proto.mozMatchesSelector ||
  8538. proto.msMatchesSelector ||
  8539. proto.oMatchesSelector ||
  8540. proto.webkitMatchesSelector;
  8541. }
  8542. /**
  8543. * Finds the closest parent that matches a selector.
  8544. *
  8545. * @param {Element} element
  8546. * @param {String} selector
  8547. * @return {Function}
  8548. */
  8549. function closest (element, selector) {
  8550. while (element && element.nodeType !== DOCUMENT_NODE_TYPE) {
  8551. if (typeof element.matches === 'function' &&
  8552. element.matches(selector)) {
  8553. return element;
  8554. }
  8555. element = element.parentNode;
  8556. }
  8557. }
  8558. module.exports = closest;
  8559. /***/ })
  8560. /******/ ]);
  8561. });
  8562. /***/ }),
  8563. /***/ "./node_modules/ieee754/index.js":
  8564. /*!***************************************!*\
  8565. !*** ./node_modules/ieee754/index.js ***!
  8566. \***************************************/
  8567. /*! no static exports found */
  8568. /***/ (function(module, exports) {
  8569. exports.read = function (buffer, offset, isLE, mLen, nBytes) {
  8570. var e, m
  8571. var eLen = (nBytes * 8) - mLen - 1
  8572. var eMax = (1 << eLen) - 1
  8573. var eBias = eMax >> 1
  8574. var nBits = -7
  8575. var i = isLE ? (nBytes - 1) : 0
  8576. var d = isLE ? -1 : 1
  8577. var s = buffer[offset + i]
  8578. i += d
  8579. e = s & ((1 << (-nBits)) - 1)
  8580. s >>= (-nBits)
  8581. nBits += eLen
  8582. for (; nBits > 0; e = (e * 256) + buffer[offset + i], i += d, nBits -= 8) {}
  8583. m = e & ((1 << (-nBits)) - 1)
  8584. e >>= (-nBits)
  8585. nBits += mLen
  8586. for (; nBits > 0; m = (m * 256) + buffer[offset + i], i += d, nBits -= 8) {}
  8587. if (e === 0) {
  8588. e = 1 - eBias
  8589. } else if (e === eMax) {
  8590. return m ? NaN : ((s ? -1 : 1) * Infinity)
  8591. } else {
  8592. m = m + Math.pow(2, mLen)
  8593. e = e - eBias
  8594. }
  8595. return (s ? -1 : 1) * m * Math.pow(2, e - mLen)
  8596. }
  8597. exports.write = function (buffer, value, offset, isLE, mLen, nBytes) {
  8598. var e, m, c
  8599. var eLen = (nBytes * 8) - mLen - 1
  8600. var eMax = (1 << eLen) - 1
  8601. var eBias = eMax >> 1
  8602. var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0)
  8603. var i = isLE ? 0 : (nBytes - 1)
  8604. var d = isLE ? 1 : -1
  8605. var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0
  8606. value = Math.abs(value)
  8607. if (isNaN(value) || value === Infinity) {
  8608. m = isNaN(value) ? 1 : 0
  8609. e = eMax
  8610. } else {
  8611. e = Math.floor(Math.log(value) / Math.LN2)
  8612. if (value * (c = Math.pow(2, -e)) < 1) {
  8613. e--
  8614. c *= 2
  8615. }
  8616. if (e + eBias >= 1) {
  8617. value += rt / c
  8618. } else {
  8619. value += rt * Math.pow(2, 1 - eBias)
  8620. }
  8621. if (value * c >= 2) {
  8622. e++
  8623. c /= 2
  8624. }
  8625. if (e + eBias >= eMax) {
  8626. m = 0
  8627. e = eMax
  8628. } else if (e + eBias >= 1) {
  8629. m = ((value * c) - 1) * Math.pow(2, mLen)
  8630. e = e + eBias
  8631. } else {
  8632. m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen)
  8633. e = 0
  8634. }
  8635. }
  8636. for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}
  8637. e = (e << mLen) | m
  8638. eLen += mLen
  8639. for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}
  8640. buffer[offset + i - d] |= s * 128
  8641. }
  8642. /***/ }),
  8643. /***/ "./node_modules/isarray/index.js":
  8644. /*!***************************************!*\
  8645. !*** ./node_modules/isarray/index.js ***!
  8646. \***************************************/
  8647. /*! no static exports found */
  8648. /***/ (function(module, exports) {
  8649. var toString = {}.toString;
  8650. module.exports = Array.isArray || function (arr) {
  8651. return toString.call(arr) == '[object Array]';
  8652. };
  8653. /***/ }),
  8654. /***/ "./node_modules/jquery/dist/jquery.js":
  8655. /*!********************************************!*\
  8656. !*** ./node_modules/jquery/dist/jquery.js ***!
  8657. \********************************************/
  8658. /*! no static exports found */
  8659. /***/ (function(module, exports, __webpack_require__) {
  8660. var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
  8661. * jQuery JavaScript Library v3.4.1
  8662. * https://jquery.com/
  8663. *
  8664. * Includes Sizzle.js
  8665. * https://sizzlejs.com/
  8666. *
  8667. * Copyright JS Foundation and other contributors
  8668. * Released under the MIT license
  8669. * https://jquery.org/license
  8670. *
  8671. * Date: 2019-05-01T21:04Z
  8672. */
  8673. ( function( global, factory ) {
  8674. "use strict";
  8675. if ( true && typeof module.exports === "object" ) {
  8676. // For CommonJS and CommonJS-like environments where a proper `window`
  8677. // is present, execute the factory and get jQuery.
  8678. // For environments that do not have a `window` with a `document`
  8679. // (such as Node.js), expose a factory as module.exports.
  8680. // This accentuates the need for the creation of a real `window`.
  8681. // e.g. var jQuery = require("jquery")(window);
  8682. // See ticket #14549 for more info.
  8683. module.exports = global.document ?
  8684. factory( global, true ) :
  8685. function( w ) {
  8686. if ( !w.document ) {
  8687. throw new Error( "jQuery requires a window with a document" );
  8688. }
  8689. return factory( w );
  8690. };
  8691. } else {
  8692. factory( global );
  8693. }
  8694. // Pass this if window is not defined yet
  8695. } )( typeof window !== "undefined" ? window : this, function( window, noGlobal ) {
  8696. // Edge <= 12 - 13+, Firefox <=18 - 45+, IE 10 - 11, Safari 5.1 - 9+, iOS 6 - 9.1
  8697. // throw exceptions when non-strict code (e.g., ASP.NET 4.5) accesses strict mode
  8698. // arguments.callee.caller (trac-13335). But as of jQuery 3.0 (2016), strict mode should be common
  8699. // enough that all such attempts are guarded in a try block.
  8700. "use strict";
  8701. var arr = [];
  8702. var document = window.document;
  8703. var getProto = Object.getPrototypeOf;
  8704. var slice = arr.slice;
  8705. var concat = arr.concat;
  8706. var push = arr.push;
  8707. var indexOf = arr.indexOf;
  8708. var class2type = {};
  8709. var toString = class2type.toString;
  8710. var hasOwn = class2type.hasOwnProperty;
  8711. var fnToString = hasOwn.toString;
  8712. var ObjectFunctionString = fnToString.call( Object );
  8713. var support = {};
  8714. var isFunction = function isFunction( obj ) {
  8715. // Support: Chrome <=57, Firefox <=52
  8716. // In some browsers, typeof returns "function" for HTML <object> elements
  8717. // (i.e., `typeof document.createElement( "object" ) === "function"`).
  8718. // We don't want to classify *any* DOM node as a function.
  8719. return typeof obj === "function" && typeof obj.nodeType !== "number";
  8720. };
  8721. var isWindow = function isWindow( obj ) {
  8722. return obj != null && obj === obj.window;
  8723. };
  8724. var preservedScriptAttributes = {
  8725. type: true,
  8726. src: true,
  8727. nonce: true,
  8728. noModule: true
  8729. };
  8730. function DOMEval( code, node, doc ) {
  8731. doc = doc || document;
  8732. var i, val,
  8733. script = doc.createElement( "script" );
  8734. script.text = code;
  8735. if ( node ) {
  8736. for ( i in preservedScriptAttributes ) {
  8737. // Support: Firefox 64+, Edge 18+
  8738. // Some browsers don't support the "nonce" property on scripts.
  8739. // On the other hand, just using `getAttribute` is not enough as
  8740. // the `nonce` attribute is reset to an empty string whenever it
  8741. // becomes browsing-context connected.
  8742. // See https://github.com/whatwg/html/issues/2369
  8743. // See https://html.spec.whatwg.org/#nonce-attributes
  8744. // The `node.getAttribute` check was added for the sake of
  8745. // `jQuery.globalEval` so that it can fake a nonce-containing node
  8746. // via an object.
  8747. val = node[ i ] || node.getAttribute && node.getAttribute( i );
  8748. if ( val ) {
  8749. script.setAttribute( i, val );
  8750. }
  8751. }
  8752. }
  8753. doc.head.appendChild( script ).parentNode.removeChild( script );
  8754. }
  8755. function toType( obj ) {
  8756. if ( obj == null ) {
  8757. return obj + "";
  8758. }
  8759. // Support: Android <=2.3 only (functionish RegExp)
  8760. return typeof obj === "object" || typeof obj === "function" ?
  8761. class2type[ toString.call( obj ) ] || "object" :
  8762. typeof obj;
  8763. }
  8764. /* global Symbol */
  8765. // Defining this global in .eslintrc.json would create a danger of using the global
  8766. // unguarded in another place, it seems safer to define global only for this module
  8767. var
  8768. version = "3.4.1",
  8769. // Define a local copy of jQuery
  8770. jQuery = function( selector, context ) {
  8771. // The jQuery object is actually just the init constructor 'enhanced'
  8772. // Need init if jQuery is called (just allow error to be thrown if not included)
  8773. return new jQuery.fn.init( selector, context );
  8774. },
  8775. // Support: Android <=4.0 only
  8776. // Make sure we trim BOM and NBSP
  8777. rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;
  8778. jQuery.fn = jQuery.prototype = {
  8779. // The current version of jQuery being used
  8780. jquery: version,
  8781. constructor: jQuery,
  8782. // The default length of a jQuery object is 0
  8783. length: 0,
  8784. toArray: function() {
  8785. return slice.call( this );
  8786. },
  8787. // Get the Nth element in the matched element set OR
  8788. // Get the whole matched element set as a clean array
  8789. get: function( num ) {
  8790. // Return all the elements in a clean array
  8791. if ( num == null ) {
  8792. return slice.call( this );
  8793. }
  8794. // Return just the one element from the set
  8795. return num < 0 ? this[ num + this.length ] : this[ num ];
  8796. },
  8797. // Take an array of elements and push it onto the stack
  8798. // (returning the new matched element set)
  8799. pushStack: function( elems ) {
  8800. // Build a new jQuery matched element set
  8801. var ret = jQuery.merge( this.constructor(), elems );
  8802. // Add the old object onto the stack (as a reference)
  8803. ret.prevObject = this;
  8804. // Return the newly-formed element set
  8805. return ret;
  8806. },
  8807. // Execute a callback for every element in the matched set.
  8808. each: function( callback ) {
  8809. return jQuery.each( this, callback );
  8810. },
  8811. map: function( callback ) {
  8812. return this.pushStack( jQuery.map( this, function( elem, i ) {
  8813. return callback.call( elem, i, elem );
  8814. } ) );
  8815. },
  8816. slice: function() {
  8817. return this.pushStack( slice.apply( this, arguments ) );
  8818. },
  8819. first: function() {
  8820. return this.eq( 0 );
  8821. },
  8822. last: function() {
  8823. return this.eq( -1 );
  8824. },
  8825. eq: function( i ) {
  8826. var len = this.length,
  8827. j = +i + ( i < 0 ? len : 0 );
  8828. return this.pushStack( j >= 0 && j < len ? [ this[ j ] ] : [] );
  8829. },
  8830. end: function() {
  8831. return this.prevObject || this.constructor();
  8832. },
  8833. // For internal use only.
  8834. // Behaves like an Array's method, not like a jQuery method.
  8835. push: push,
  8836. sort: arr.sort,
  8837. splice: arr.splice
  8838. };
  8839. jQuery.extend = jQuery.fn.extend = function() {
  8840. var options, name, src, copy, copyIsArray, clone,
  8841. target = arguments[ 0 ] || {},
  8842. i = 1,
  8843. length = arguments.length,
  8844. deep = false;
  8845. // Handle a deep copy situation
  8846. if ( typeof target === "boolean" ) {
  8847. deep = target;
  8848. // Skip the boolean and the target
  8849. target = arguments[ i ] || {};
  8850. i++;
  8851. }
  8852. // Handle case when target is a string or something (possible in deep copy)
  8853. if ( typeof target !== "object" && !isFunction( target ) ) {
  8854. target = {};
  8855. }
  8856. // Extend jQuery itself if only one argument is passed
  8857. if ( i === length ) {
  8858. target = this;
  8859. i--;
  8860. }
  8861. for ( ; i < length; i++ ) {
  8862. // Only deal with non-null/undefined values
  8863. if ( ( options = arguments[ i ] ) != null ) {
  8864. // Extend the base object
  8865. for ( name in options ) {
  8866. copy = options[ name ];
  8867. // Prevent Object.prototype pollution
  8868. // Prevent never-ending loop
  8869. if ( name === "__proto__" || target === copy ) {
  8870. continue;
  8871. }
  8872. // Recurse if we're merging plain objects or arrays
  8873. if ( deep && copy && ( jQuery.isPlainObject( copy ) ||
  8874. ( copyIsArray = Array.isArray( copy ) ) ) ) {
  8875. src = target[ name ];
  8876. // Ensure proper type for the source value
  8877. if ( copyIsArray && !Array.isArray( src ) ) {
  8878. clone = [];
  8879. } else if ( !copyIsArray && !jQuery.isPlainObject( src ) ) {
  8880. clone = {};
  8881. } else {
  8882. clone = src;
  8883. }
  8884. copyIsArray = false;
  8885. // Never move original objects, clone them
  8886. target[ name ] = jQuery.extend( deep, clone, copy );
  8887. // Don't bring in undefined values
  8888. } else if ( copy !== undefined ) {
  8889. target[ name ] = copy;
  8890. }
  8891. }
  8892. }
  8893. }
  8894. // Return the modified object
  8895. return target;
  8896. };
  8897. jQuery.extend( {
  8898. // Unique for each copy of jQuery on the page
  8899. expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ),
  8900. // Assume jQuery is ready without the ready module
  8901. isReady: true,
  8902. error: function( msg ) {
  8903. throw new Error( msg );
  8904. },
  8905. noop: function() {},
  8906. isPlainObject: function( obj ) {
  8907. var proto, Ctor;
  8908. // Detect obvious negatives
  8909. // Use toString instead of jQuery.type to catch host objects
  8910. if ( !obj || toString.call( obj ) !== "[object Object]" ) {
  8911. return false;
  8912. }
  8913. proto = getProto( obj );
  8914. // Objects with no prototype (e.g., `Object.create( null )`) are plain
  8915. if ( !proto ) {
  8916. return true;
  8917. }
  8918. // Objects with prototype are plain iff they were constructed by a global Object function
  8919. Ctor = hasOwn.call( proto, "constructor" ) && proto.constructor;
  8920. return typeof Ctor === "function" && fnToString.call( Ctor ) === ObjectFunctionString;
  8921. },
  8922. isEmptyObject: function( obj ) {
  8923. var name;
  8924. for ( name in obj ) {
  8925. return false;
  8926. }
  8927. return true;
  8928. },
  8929. // Evaluates a script in a global context
  8930. globalEval: function( code, options ) {
  8931. DOMEval( code, { nonce: options && options.nonce } );
  8932. },
  8933. each: function( obj, callback ) {
  8934. var length, i = 0;
  8935. if ( isArrayLike( obj ) ) {
  8936. length = obj.length;
  8937. for ( ; i < length; i++ ) {
  8938. if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
  8939. break;
  8940. }
  8941. }
  8942. } else {
  8943. for ( i in obj ) {
  8944. if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
  8945. break;
  8946. }
  8947. }
  8948. }
  8949. return obj;
  8950. },
  8951. // Support: Android <=4.0 only
  8952. trim: function( text ) {
  8953. return text == null ?
  8954. "" :
  8955. ( text + "" ).replace( rtrim, "" );
  8956. },
  8957. // results is for internal usage only
  8958. makeArray: function( arr, results ) {
  8959. var ret = results || [];
  8960. if ( arr != null ) {
  8961. if ( isArrayLike( Object( arr ) ) ) {
  8962. jQuery.merge( ret,
  8963. typeof arr === "string" ?
  8964. [ arr ] : arr
  8965. );
  8966. } else {
  8967. push.call( ret, arr );
  8968. }
  8969. }
  8970. return ret;
  8971. },
  8972. inArray: function( elem, arr, i ) {
  8973. return arr == null ? -1 : indexOf.call( arr, elem, i );
  8974. },
  8975. // Support: Android <=4.0 only, PhantomJS 1 only
  8976. // push.apply(_, arraylike) throws on ancient WebKit
  8977. merge: function( first, second ) {
  8978. var len = +second.length,
  8979. j = 0,
  8980. i = first.length;
  8981. for ( ; j < len; j++ ) {
  8982. first[ i++ ] = second[ j ];
  8983. }
  8984. first.length = i;
  8985. return first;
  8986. },
  8987. grep: function( elems, callback, invert ) {
  8988. var callbackInverse,
  8989. matches = [],
  8990. i = 0,
  8991. length = elems.length,
  8992. callbackExpect = !invert;
  8993. // Go through the array, only saving the items
  8994. // that pass the validator function
  8995. for ( ; i < length; i++ ) {
  8996. callbackInverse = !callback( elems[ i ], i );
  8997. if ( callbackInverse !== callbackExpect ) {
  8998. matches.push( elems[ i ] );
  8999. }
  9000. }
  9001. return matches;
  9002. },
  9003. // arg is for internal usage only
  9004. map: function( elems, callback, arg ) {
  9005. var length, value,
  9006. i = 0,
  9007. ret = [];
  9008. // Go through the array, translating each of the items to their new values
  9009. if ( isArrayLike( elems ) ) {
  9010. length = elems.length;
  9011. for ( ; i < length; i++ ) {
  9012. value = callback( elems[ i ], i, arg );
  9013. if ( value != null ) {
  9014. ret.push( value );
  9015. }
  9016. }
  9017. // Go through every key on the object,
  9018. } else {
  9019. for ( i in elems ) {
  9020. value = callback( elems[ i ], i, arg );
  9021. if ( value != null ) {
  9022. ret.push( value );
  9023. }
  9024. }
  9025. }
  9026. // Flatten any nested arrays
  9027. return concat.apply( [], ret );
  9028. },
  9029. // A global GUID counter for objects
  9030. guid: 1,
  9031. // jQuery.support is not used in Core but other projects attach their
  9032. // properties to it so it needs to exist.
  9033. support: support
  9034. } );
  9035. if ( typeof Symbol === "function" ) {
  9036. jQuery.fn[ Symbol.iterator ] = arr[ Symbol.iterator ];
  9037. }
  9038. // Populate the class2type map
  9039. jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ),
  9040. function( i, name ) {
  9041. class2type[ "[object " + name + "]" ] = name.toLowerCase();
  9042. } );
  9043. function isArrayLike( obj ) {
  9044. // Support: real iOS 8.2 only (not reproducible in simulator)
  9045. // `in` check used to prevent JIT error (gh-2145)
  9046. // hasOwn isn't used here due to false negatives
  9047. // regarding Nodelist length in IE
  9048. var length = !!obj && "length" in obj && obj.length,
  9049. type = toType( obj );
  9050. if ( isFunction( obj ) || isWindow( obj ) ) {
  9051. return false;
  9052. }
  9053. return type === "array" || length === 0 ||
  9054. typeof length === "number" && length > 0 && ( length - 1 ) in obj;
  9055. }
  9056. var Sizzle =
  9057. /*!
  9058. * Sizzle CSS Selector Engine v2.3.4
  9059. * https://sizzlejs.com/
  9060. *
  9061. * Copyright JS Foundation and other contributors
  9062. * Released under the MIT license
  9063. * https://js.foundation/
  9064. *
  9065. * Date: 2019-04-08
  9066. */
  9067. (function( window ) {
  9068. var i,
  9069. support,
  9070. Expr,
  9071. getText,
  9072. isXML,
  9073. tokenize,
  9074. compile,
  9075. select,
  9076. outermostContext,
  9077. sortInput,
  9078. hasDuplicate,
  9079. // Local document vars
  9080. setDocument,
  9081. document,
  9082. docElem,
  9083. documentIsHTML,
  9084. rbuggyQSA,
  9085. rbuggyMatches,
  9086. matches,
  9087. contains,
  9088. // Instance-specific data
  9089. expando = "sizzle" + 1 * new Date(),
  9090. preferredDoc = window.document,
  9091. dirruns = 0,
  9092. done = 0,
  9093. classCache = createCache(),
  9094. tokenCache = createCache(),
  9095. compilerCache = createCache(),
  9096. nonnativeSelectorCache = createCache(),
  9097. sortOrder = function( a, b ) {
  9098. if ( a === b ) {
  9099. hasDuplicate = true;
  9100. }
  9101. return 0;
  9102. },
  9103. // Instance methods
  9104. hasOwn = ({}).hasOwnProperty,
  9105. arr = [],
  9106. pop = arr.pop,
  9107. push_native = arr.push,
  9108. push = arr.push,
  9109. slice = arr.slice,
  9110. // Use a stripped-down indexOf as it's faster than native
  9111. // https://jsperf.com/thor-indexof-vs-for/5
  9112. indexOf = function( list, elem ) {
  9113. var i = 0,
  9114. len = list.length;
  9115. for ( ; i < len; i++ ) {
  9116. if ( list[i] === elem ) {
  9117. return i;
  9118. }
  9119. }
  9120. return -1;
  9121. },
  9122. booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",
  9123. // Regular expressions
  9124. // http://www.w3.org/TR/css3-selectors/#whitespace
  9125. whitespace = "[\\x20\\t\\r\\n\\f]",
  9126. // http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier
  9127. identifier = "(?:\\\\.|[\\w-]|[^\0-\\xa0])+",
  9128. // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors
  9129. attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace +
  9130. // Operator (capture 2)
  9131. "*([*^$|!~]?=)" + whitespace +
  9132. // "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]"
  9133. "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace +
  9134. "*\\]",
  9135. pseudos = ":(" + identifier + ")(?:\\((" +
  9136. // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments:
  9137. // 1. quoted (capture 3; capture 4 or capture 5)
  9138. "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" +
  9139. // 2. simple (capture 6)
  9140. "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" +
  9141. // 3. anything else (capture 2)
  9142. ".*" +
  9143. ")\\)|)",
  9144. // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter
  9145. rwhitespace = new RegExp( whitespace + "+", "g" ),
  9146. rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ),
  9147. rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ),
  9148. rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ),
  9149. rdescend = new RegExp( whitespace + "|>" ),
  9150. rpseudo = new RegExp( pseudos ),
  9151. ridentifier = new RegExp( "^" + identifier + "$" ),
  9152. matchExpr = {
  9153. "ID": new RegExp( "^#(" + identifier + ")" ),
  9154. "CLASS": new RegExp( "^\\.(" + identifier + ")" ),
  9155. "TAG": new RegExp( "^(" + identifier + "|[*])" ),
  9156. "ATTR": new RegExp( "^" + attributes ),
  9157. "PSEUDO": new RegExp( "^" + pseudos ),
  9158. "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace +
  9159. "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace +
  9160. "*(\\d+)|))" + whitespace + "*\\)|)", "i" ),
  9161. "bool": new RegExp( "^(?:" + booleans + ")$", "i" ),
  9162. // For use in libraries implementing .is()
  9163. // We use this for POS matching in `select`
  9164. "needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" +
  9165. whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" )
  9166. },
  9167. rhtml = /HTML$/i,
  9168. rinputs = /^(?:input|select|textarea|button)$/i,
  9169. rheader = /^h\d$/i,
  9170. rnative = /^[^{]+\{\s*\[native \w/,
  9171. // Easily-parseable/retrievable ID or TAG or CLASS selectors
  9172. rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,
  9173. rsibling = /[+~]/,
  9174. // CSS escapes
  9175. // http://www.w3.org/TR/CSS21/syndata.html#escaped-characters
  9176. runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ),
  9177. funescape = function( _, escaped, escapedWhitespace ) {
  9178. var high = "0x" + escaped - 0x10000;
  9179. // NaN means non-codepoint
  9180. // Support: Firefox<24
  9181. // Workaround erroneous numeric interpretation of +"0x"
  9182. return high !== high || escapedWhitespace ?
  9183. escaped :
  9184. high < 0 ?
  9185. // BMP codepoint
  9186. String.fromCharCode( high + 0x10000 ) :
  9187. // Supplemental Plane codepoint (surrogate pair)
  9188. String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 );
  9189. },
  9190. // CSS string/identifier serialization
  9191. // https://drafts.csswg.org/cssom/#common-serializing-idioms
  9192. rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,
  9193. fcssescape = function( ch, asCodePoint ) {
  9194. if ( asCodePoint ) {
  9195. // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER
  9196. if ( ch === "\0" ) {
  9197. return "\uFFFD";
  9198. }
  9199. // Control characters and (dependent upon position) numbers get escaped as code points
  9200. return ch.slice( 0, -1 ) + "\\" + ch.charCodeAt( ch.length - 1 ).toString( 16 ) + " ";
  9201. }
  9202. // Other potentially-special ASCII characters get backslash-escaped
  9203. return "\\" + ch;
  9204. },
  9205. // Used for iframes
  9206. // See setDocument()
  9207. // Removing the function wrapper causes a "Permission Denied"
  9208. // error in IE
  9209. unloadHandler = function() {
  9210. setDocument();
  9211. },
  9212. inDisabledFieldset = addCombinator(
  9213. function( elem ) {
  9214. return elem.disabled === true && elem.nodeName.toLowerCase() === "fieldset";
  9215. },
  9216. { dir: "parentNode", next: "legend" }
  9217. );
  9218. // Optimize for push.apply( _, NodeList )
  9219. try {
  9220. push.apply(
  9221. (arr = slice.call( preferredDoc.childNodes )),
  9222. preferredDoc.childNodes
  9223. );
  9224. // Support: Android<4.0
  9225. // Detect silently failing push.apply
  9226. arr[ preferredDoc.childNodes.length ].nodeType;
  9227. } catch ( e ) {
  9228. push = { apply: arr.length ?
  9229. // Leverage slice if possible
  9230. function( target, els ) {
  9231. push_native.apply( target, slice.call(els) );
  9232. } :
  9233. // Support: IE<9
  9234. // Otherwise append directly
  9235. function( target, els ) {
  9236. var j = target.length,
  9237. i = 0;
  9238. // Can't trust NodeList.length
  9239. while ( (target[j++] = els[i++]) ) {}
  9240. target.length = j - 1;
  9241. }
  9242. };
  9243. }
  9244. function Sizzle( selector, context, results, seed ) {
  9245. var m, i, elem, nid, match, groups, newSelector,
  9246. newContext = context && context.ownerDocument,
  9247. // nodeType defaults to 9, since context defaults to document
  9248. nodeType = context ? context.nodeType : 9;
  9249. results = results || [];
  9250. // Return early from calls with invalid selector or context
  9251. if ( typeof selector !== "string" || !selector ||
  9252. nodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) {
  9253. return results;
  9254. }
  9255. // Try to shortcut find operations (as opposed to filters) in HTML documents
  9256. if ( !seed ) {
  9257. if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) {
  9258. setDocument( context );
  9259. }
  9260. context = context || document;
  9261. if ( documentIsHTML ) {
  9262. // If the selector is sufficiently simple, try using a "get*By*" DOM method
  9263. // (excepting DocumentFragment context, where the methods don't exist)
  9264. if ( nodeType !== 11 && (match = rquickExpr.exec( selector )) ) {
  9265. // ID selector
  9266. if ( (m = match[1]) ) {
  9267. // Document context
  9268. if ( nodeType === 9 ) {
  9269. if ( (elem = context.getElementById( m )) ) {
  9270. // Support: IE, Opera, Webkit
  9271. // TODO: identify versions
  9272. // getElementById can match elements by name instead of ID
  9273. if ( elem.id === m ) {
  9274. results.push( elem );
  9275. return results;
  9276. }
  9277. } else {
  9278. return results;
  9279. }
  9280. // Element context
  9281. } else {
  9282. // Support: IE, Opera, Webkit
  9283. // TODO: identify versions
  9284. // getElementById can match elements by name instead of ID
  9285. if ( newContext && (elem = newContext.getElementById( m )) &&
  9286. contains( context, elem ) &&
  9287. elem.id === m ) {
  9288. results.push( elem );
  9289. return results;
  9290. }
  9291. }
  9292. // Type selector
  9293. } else if ( match[2] ) {
  9294. push.apply( results, context.getElementsByTagName( selector ) );
  9295. return results;
  9296. // Class selector
  9297. } else if ( (m = match[3]) && support.getElementsByClassName &&
  9298. context.getElementsByClassName ) {
  9299. push.apply( results, context.getElementsByClassName( m ) );
  9300. return results;
  9301. }
  9302. }
  9303. // Take advantage of querySelectorAll
  9304. if ( support.qsa &&
  9305. !nonnativeSelectorCache[ selector + " " ] &&
  9306. (!rbuggyQSA || !rbuggyQSA.test( selector )) &&
  9307. // Support: IE 8 only
  9308. // Exclude object elements
  9309. (nodeType !== 1 || context.nodeName.toLowerCase() !== "object") ) {
  9310. newSelector = selector;
  9311. newContext = context;
  9312. // qSA considers elements outside a scoping root when evaluating child or
  9313. // descendant combinators, which is not what we want.
  9314. // In such cases, we work around the behavior by prefixing every selector in the
  9315. // list with an ID selector referencing the scope context.
  9316. // Thanks to Andrew Dupont for this technique.
  9317. if ( nodeType === 1 && rdescend.test( selector ) ) {
  9318. // Capture the context ID, setting it first if necessary
  9319. if ( (nid = context.getAttribute( "id" )) ) {
  9320. nid = nid.replace( rcssescape, fcssescape );
  9321. } else {
  9322. context.setAttribute( "id", (nid = expando) );
  9323. }
  9324. // Prefix every selector in the list
  9325. groups = tokenize( selector );
  9326. i = groups.length;
  9327. while ( i-- ) {
  9328. groups[i] = "#" + nid + " " + toSelector( groups[i] );
  9329. }
  9330. newSelector = groups.join( "," );
  9331. // Expand context for sibling selectors
  9332. newContext = rsibling.test( selector ) && testContext( context.parentNode ) ||
  9333. context;
  9334. }
  9335. try {
  9336. push.apply( results,
  9337. newContext.querySelectorAll( newSelector )
  9338. );
  9339. return results;
  9340. } catch ( qsaError ) {
  9341. nonnativeSelectorCache( selector, true );
  9342. } finally {
  9343. if ( nid === expando ) {
  9344. context.removeAttribute( "id" );
  9345. }
  9346. }
  9347. }
  9348. }
  9349. }
  9350. // All others
  9351. return select( selector.replace( rtrim, "$1" ), context, results, seed );
  9352. }
  9353. /**
  9354. * Create key-value caches of limited size
  9355. * @returns {function(string, object)} Returns the Object data after storing it on itself with
  9356. * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength)
  9357. * deleting the oldest entry
  9358. */
  9359. function createCache() {
  9360. var keys = [];
  9361. function cache( key, value ) {
  9362. // Use (key + " ") to avoid collision with native prototype properties (see Issue #157)
  9363. if ( keys.push( key + " " ) > Expr.cacheLength ) {
  9364. // Only keep the most recent entries
  9365. delete cache[ keys.shift() ];
  9366. }
  9367. return (cache[ key + " " ] = value);
  9368. }
  9369. return cache;
  9370. }
  9371. /**
  9372. * Mark a function for special use by Sizzle
  9373. * @param {Function} fn The function to mark
  9374. */
  9375. function markFunction( fn ) {
  9376. fn[ expando ] = true;
  9377. return fn;
  9378. }
  9379. /**
  9380. * Support testing using an element
  9381. * @param {Function} fn Passed the created element and returns a boolean result
  9382. */
  9383. function assert( fn ) {
  9384. var el = document.createElement("fieldset");
  9385. try {
  9386. return !!fn( el );
  9387. } catch (e) {
  9388. return false;
  9389. } finally {
  9390. // Remove from its parent by default
  9391. if ( el.parentNode ) {
  9392. el.parentNode.removeChild( el );
  9393. }
  9394. // release memory in IE
  9395. el = null;
  9396. }
  9397. }
  9398. /**
  9399. * Adds the same handler for all of the specified attrs
  9400. * @param {String} attrs Pipe-separated list of attributes
  9401. * @param {Function} handler The method that will be applied
  9402. */
  9403. function addHandle( attrs, handler ) {
  9404. var arr = attrs.split("|"),
  9405. i = arr.length;
  9406. while ( i-- ) {
  9407. Expr.attrHandle[ arr[i] ] = handler;
  9408. }
  9409. }
  9410. /**
  9411. * Checks document order of two siblings
  9412. * @param {Element} a
  9413. * @param {Element} b
  9414. * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b
  9415. */
  9416. function siblingCheck( a, b ) {
  9417. var cur = b && a,
  9418. diff = cur && a.nodeType === 1 && b.nodeType === 1 &&
  9419. a.sourceIndex - b.sourceIndex;
  9420. // Use IE sourceIndex if available on both nodes
  9421. if ( diff ) {
  9422. return diff;
  9423. }
  9424. // Check if b follows a
  9425. if ( cur ) {
  9426. while ( (cur = cur.nextSibling) ) {
  9427. if ( cur === b ) {
  9428. return -1;
  9429. }
  9430. }
  9431. }
  9432. return a ? 1 : -1;
  9433. }
  9434. /**
  9435. * Returns a function to use in pseudos for input types
  9436. * @param {String} type
  9437. */
  9438. function createInputPseudo( type ) {
  9439. return function( elem ) {
  9440. var name = elem.nodeName.toLowerCase();
  9441. return name === "input" && elem.type === type;
  9442. };
  9443. }
  9444. /**
  9445. * Returns a function to use in pseudos for buttons
  9446. * @param {String} type
  9447. */
  9448. function createButtonPseudo( type ) {
  9449. return function( elem ) {
  9450. var name = elem.nodeName.toLowerCase();
  9451. return (name === "input" || name === "button") && elem.type === type;
  9452. };
  9453. }
  9454. /**
  9455. * Returns a function to use in pseudos for :enabled/:disabled
  9456. * @param {Boolean} disabled true for :disabled; false for :enabled
  9457. */
  9458. function createDisabledPseudo( disabled ) {
  9459. // Known :disabled false positives: fieldset[disabled] > legend:nth-of-type(n+2) :can-disable
  9460. return function( elem ) {
  9461. // Only certain elements can match :enabled or :disabled
  9462. // https://html.spec.whatwg.org/multipage/scripting.html#selector-enabled
  9463. // https://html.spec.whatwg.org/multipage/scripting.html#selector-disabled
  9464. if ( "form" in elem ) {
  9465. // Check for inherited disabledness on relevant non-disabled elements:
  9466. // * listed form-associated elements in a disabled fieldset
  9467. // https://html.spec.whatwg.org/multipage/forms.html#category-listed
  9468. // https://html.spec.whatwg.org/multipage/forms.html#concept-fe-disabled
  9469. // * option elements in a disabled optgroup
  9470. // https://html.spec.whatwg.org/multipage/forms.html#concept-option-disabled
  9471. // All such elements have a "form" property.
  9472. if ( elem.parentNode && elem.disabled === false ) {
  9473. // Option elements defer to a parent optgroup if present
  9474. if ( "label" in elem ) {
  9475. if ( "label" in elem.parentNode ) {
  9476. return elem.parentNode.disabled === disabled;
  9477. } else {
  9478. return elem.disabled === disabled;
  9479. }
  9480. }
  9481. // Support: IE 6 - 11
  9482. // Use the isDisabled shortcut property to check for disabled fieldset ancestors
  9483. return elem.isDisabled === disabled ||
  9484. // Where there is no isDisabled, check manually
  9485. /* jshint -W018 */
  9486. elem.isDisabled !== !disabled &&
  9487. inDisabledFieldset( elem ) === disabled;
  9488. }
  9489. return elem.disabled === disabled;
  9490. // Try to winnow out elements that can't be disabled before trusting the disabled property.
  9491. // Some victims get caught in our net (label, legend, menu, track), but it shouldn't
  9492. // even exist on them, let alone have a boolean value.
  9493. } else if ( "label" in elem ) {
  9494. return elem.disabled === disabled;
  9495. }
  9496. // Remaining elements are neither :enabled nor :disabled
  9497. return false;
  9498. };
  9499. }
  9500. /**
  9501. * Returns a function to use in pseudos for positionals
  9502. * @param {Function} fn
  9503. */
  9504. function createPositionalPseudo( fn ) {
  9505. return markFunction(function( argument ) {
  9506. argument = +argument;
  9507. return markFunction(function( seed, matches ) {
  9508. var j,
  9509. matchIndexes = fn( [], seed.length, argument ),
  9510. i = matchIndexes.length;
  9511. // Match elements found at the specified indexes
  9512. while ( i-- ) {
  9513. if ( seed[ (j = matchIndexes[i]) ] ) {
  9514. seed[j] = !(matches[j] = seed[j]);
  9515. }
  9516. }
  9517. });
  9518. });
  9519. }
  9520. /**
  9521. * Checks a node for validity as a Sizzle context
  9522. * @param {Element|Object=} context
  9523. * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value
  9524. */
  9525. function testContext( context ) {
  9526. return context && typeof context.getElementsByTagName !== "undefined" && context;
  9527. }
  9528. // Expose support vars for convenience
  9529. support = Sizzle.support = {};
  9530. /**
  9531. * Detects XML nodes
  9532. * @param {Element|Object} elem An element or a document
  9533. * @returns {Boolean} True iff elem is a non-HTML XML node
  9534. */
  9535. isXML = Sizzle.isXML = function( elem ) {
  9536. var namespace = elem.namespaceURI,
  9537. docElem = (elem.ownerDocument || elem).documentElement;
  9538. // Support: IE <=8
  9539. // Assume HTML when documentElement doesn't yet exist, such as inside loading iframes
  9540. // https://bugs.jquery.com/ticket/4833
  9541. return !rhtml.test( namespace || docElem && docElem.nodeName || "HTML" );
  9542. };
  9543. /**
  9544. * Sets document-related variables once based on the current document
  9545. * @param {Element|Object} [doc] An element or document object to use to set the document
  9546. * @returns {Object} Returns the current document
  9547. */
  9548. setDocument = Sizzle.setDocument = function( node ) {
  9549. var hasCompare, subWindow,
  9550. doc = node ? node.ownerDocument || node : preferredDoc;
  9551. // Return early if doc is invalid or already selected
  9552. if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) {
  9553. return document;
  9554. }
  9555. // Update global variables
  9556. document = doc;
  9557. docElem = document.documentElement;
  9558. documentIsHTML = !isXML( document );
  9559. // Support: IE 9-11, Edge
  9560. // Accessing iframe documents after unload throws "permission denied" errors (jQuery #13936)
  9561. if ( preferredDoc !== document &&
  9562. (subWindow = document.defaultView) && subWindow.top !== subWindow ) {
  9563. // Support: IE 11, Edge
  9564. if ( subWindow.addEventListener ) {
  9565. subWindow.addEventListener( "unload", unloadHandler, false );
  9566. // Support: IE 9 - 10 only
  9567. } else if ( subWindow.attachEvent ) {
  9568. subWindow.attachEvent( "onunload", unloadHandler );
  9569. }
  9570. }
  9571. /* Attributes
  9572. ---------------------------------------------------------------------- */
  9573. // Support: IE<8
  9574. // Verify that getAttribute really returns attributes and not properties
  9575. // (excepting IE8 booleans)
  9576. support.attributes = assert(function( el ) {
  9577. el.className = "i";
  9578. return !el.getAttribute("className");
  9579. });
  9580. /* getElement(s)By*
  9581. ---------------------------------------------------------------------- */
  9582. // Check if getElementsByTagName("*") returns only elements
  9583. support.getElementsByTagName = assert(function( el ) {
  9584. el.appendChild( document.createComment("") );
  9585. return !el.getElementsByTagName("*").length;
  9586. });
  9587. // Support: IE<9
  9588. support.getElementsByClassName = rnative.test( document.getElementsByClassName );
  9589. // Support: IE<10
  9590. // Check if getElementById returns elements by name
  9591. // The broken getElementById methods don't pick up programmatically-set names,
  9592. // so use a roundabout getElementsByName test
  9593. support.getById = assert(function( el ) {
  9594. docElem.appendChild( el ).id = expando;
  9595. return !document.getElementsByName || !document.getElementsByName( expando ).length;
  9596. });
  9597. // ID filter and find
  9598. if ( support.getById ) {
  9599. Expr.filter["ID"] = function( id ) {
  9600. var attrId = id.replace( runescape, funescape );
  9601. return function( elem ) {
  9602. return elem.getAttribute("id") === attrId;
  9603. };
  9604. };
  9605. Expr.find["ID"] = function( id, context ) {
  9606. if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
  9607. var elem = context.getElementById( id );
  9608. return elem ? [ elem ] : [];
  9609. }
  9610. };
  9611. } else {
  9612. Expr.filter["ID"] = function( id ) {
  9613. var attrId = id.replace( runescape, funescape );
  9614. return function( elem ) {
  9615. var node = typeof elem.getAttributeNode !== "undefined" &&
  9616. elem.getAttributeNode("id");
  9617. return node && node.value === attrId;
  9618. };
  9619. };
  9620. // Support: IE 6 - 7 only
  9621. // getElementById is not reliable as a find shortcut
  9622. Expr.find["ID"] = function( id, context ) {
  9623. if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
  9624. var node, i, elems,
  9625. elem = context.getElementById( id );
  9626. if ( elem ) {
  9627. // Verify the id attribute
  9628. node = elem.getAttributeNode("id");
  9629. if ( node && node.value === id ) {
  9630. return [ elem ];
  9631. }
  9632. // Fall back on getElementsByName
  9633. elems = context.getElementsByName( id );
  9634. i = 0;
  9635. while ( (elem = elems[i++]) ) {
  9636. node = elem.getAttributeNode("id");
  9637. if ( node && node.value === id ) {
  9638. return [ elem ];
  9639. }
  9640. }
  9641. }
  9642. return [];
  9643. }
  9644. };
  9645. }
  9646. // Tag
  9647. Expr.find["TAG"] = support.getElementsByTagName ?
  9648. function( tag, context ) {
  9649. if ( typeof context.getElementsByTagName !== "undefined" ) {
  9650. return context.getElementsByTagName( tag );
  9651. // DocumentFragment nodes don't have gEBTN
  9652. } else if ( support.qsa ) {
  9653. return context.querySelectorAll( tag );
  9654. }
  9655. } :
  9656. function( tag, context ) {
  9657. var elem,
  9658. tmp = [],
  9659. i = 0,
  9660. // By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too
  9661. results = context.getElementsByTagName( tag );
  9662. // Filter out possible comments
  9663. if ( tag === "*" ) {
  9664. while ( (elem = results[i++]) ) {
  9665. if ( elem.nodeType === 1 ) {
  9666. tmp.push( elem );
  9667. }
  9668. }
  9669. return tmp;
  9670. }
  9671. return results;
  9672. };
  9673. // Class
  9674. Expr.find["CLASS"] = support.getElementsByClassName && function( className, context ) {
  9675. if ( typeof context.getElementsByClassName !== "undefined" && documentIsHTML ) {
  9676. return context.getElementsByClassName( className );
  9677. }
  9678. };
  9679. /* QSA/matchesSelector
  9680. ---------------------------------------------------------------------- */
  9681. // QSA and matchesSelector support
  9682. // matchesSelector(:active) reports false when true (IE9/Opera 11.5)
  9683. rbuggyMatches = [];
  9684. // qSa(:focus) reports false when true (Chrome 21)
  9685. // We allow this because of a bug in IE8/9 that throws an error
  9686. // whenever `document.activeElement` is accessed on an iframe
  9687. // So, we allow :focus to pass through QSA all the time to avoid the IE error
  9688. // See https://bugs.jquery.com/ticket/13378
  9689. rbuggyQSA = [];
  9690. if ( (support.qsa = rnative.test( document.querySelectorAll )) ) {
  9691. // Build QSA regex
  9692. // Regex strategy adopted from Diego Perini
  9693. assert(function( el ) {
  9694. // Select is set to empty string on purpose
  9695. // This is to test IE's treatment of not explicitly
  9696. // setting a boolean content attribute,
  9697. // since its presence should be enough
  9698. // https://bugs.jquery.com/ticket/12359
  9699. docElem.appendChild( el ).innerHTML = "<a id='" + expando + "'></a>" +
  9700. "<select id='" + expando + "-\r\\' msallowcapture=''>" +
  9701. "<option selected=''></option></select>";
  9702. // Support: IE8, Opera 11-12.16
  9703. // Nothing should be selected when empty strings follow ^= or $= or *=
  9704. // The test attribute must be unknown in Opera but "safe" for WinRT
  9705. // https://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section
  9706. if ( el.querySelectorAll("[msallowcapture^='']").length ) {
  9707. rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" );
  9708. }
  9709. // Support: IE8
  9710. // Boolean attributes and "value" are not treated correctly
  9711. if ( !el.querySelectorAll("[selected]").length ) {
  9712. rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" );
  9713. }
  9714. // Support: Chrome<29, Android<4.4, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.8+
  9715. if ( !el.querySelectorAll( "[id~=" + expando + "-]" ).length ) {
  9716. rbuggyQSA.push("~=");
  9717. }
  9718. // Webkit/Opera - :checked should return selected option elements
  9719. // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
  9720. // IE8 throws error here and will not see later tests
  9721. if ( !el.querySelectorAll(":checked").length ) {
  9722. rbuggyQSA.push(":checked");
  9723. }
  9724. // Support: Safari 8+, iOS 8+
  9725. // https://bugs.webkit.org/show_bug.cgi?id=136851
  9726. // In-page `selector#id sibling-combinator selector` fails
  9727. if ( !el.querySelectorAll( "a#" + expando + "+*" ).length ) {
  9728. rbuggyQSA.push(".#.+[+~]");
  9729. }
  9730. });
  9731. assert(function( el ) {
  9732. el.innerHTML = "<a href='' disabled='disabled'></a>" +
  9733. "<select disabled='disabled'><option/></select>";
  9734. // Support: Windows 8 Native Apps
  9735. // The type and name attributes are restricted during .innerHTML assignment
  9736. var input = document.createElement("input");
  9737. input.setAttribute( "type", "hidden" );
  9738. el.appendChild( input ).setAttribute( "name", "D" );
  9739. // Support: IE8
  9740. // Enforce case-sensitivity of name attribute
  9741. if ( el.querySelectorAll("[name=d]").length ) {
  9742. rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" );
  9743. }
  9744. // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)
  9745. // IE8 throws error here and will not see later tests
  9746. if ( el.querySelectorAll(":enabled").length !== 2 ) {
  9747. rbuggyQSA.push( ":enabled", ":disabled" );
  9748. }
  9749. // Support: IE9-11+
  9750. // IE's :disabled selector does not pick up the children of disabled fieldsets
  9751. docElem.appendChild( el ).disabled = true;
  9752. if ( el.querySelectorAll(":disabled").length !== 2 ) {
  9753. rbuggyQSA.push( ":enabled", ":disabled" );
  9754. }
  9755. // Opera 10-11 does not throw on post-comma invalid pseudos
  9756. el.querySelectorAll("*,:x");
  9757. rbuggyQSA.push(",.*:");
  9758. });
  9759. }
  9760. if ( (support.matchesSelector = rnative.test( (matches = docElem.matches ||
  9761. docElem.webkitMatchesSelector ||
  9762. docElem.mozMatchesSelector ||
  9763. docElem.oMatchesSelector ||
  9764. docElem.msMatchesSelector) )) ) {
  9765. assert(function( el ) {
  9766. // Check to see if it's possible to do matchesSelector
  9767. // on a disconnected node (IE 9)
  9768. support.disconnectedMatch = matches.call( el, "*" );
  9769. // This should fail with an exception
  9770. // Gecko does not error, returns false instead
  9771. matches.call( el, "[s!='']:x" );
  9772. rbuggyMatches.push( "!=", pseudos );
  9773. });
  9774. }
  9775. rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join("|") );
  9776. rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join("|") );
  9777. /* Contains
  9778. ---------------------------------------------------------------------- */
  9779. hasCompare = rnative.test( docElem.compareDocumentPosition );
  9780. // Element contains another
  9781. // Purposefully self-exclusive
  9782. // As in, an element does not contain itself
  9783. contains = hasCompare || rnative.test( docElem.contains ) ?
  9784. function( a, b ) {
  9785. var adown = a.nodeType === 9 ? a.documentElement : a,
  9786. bup = b && b.parentNode;
  9787. return a === bup || !!( bup && bup.nodeType === 1 && (
  9788. adown.contains ?
  9789. adown.contains( bup ) :
  9790. a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16
  9791. ));
  9792. } :
  9793. function( a, b ) {
  9794. if ( b ) {
  9795. while ( (b = b.parentNode) ) {
  9796. if ( b === a ) {
  9797. return true;
  9798. }
  9799. }
  9800. }
  9801. return false;
  9802. };
  9803. /* Sorting
  9804. ---------------------------------------------------------------------- */
  9805. // Document order sorting
  9806. sortOrder = hasCompare ?
  9807. function( a, b ) {
  9808. // Flag for duplicate removal
  9809. if ( a === b ) {
  9810. hasDuplicate = true;
  9811. return 0;
  9812. }
  9813. // Sort on method existence if only one input has compareDocumentPosition
  9814. var compare = !a.compareDocumentPosition - !b.compareDocumentPosition;
  9815. if ( compare ) {
  9816. return compare;
  9817. }
  9818. // Calculate position if both inputs belong to the same document
  9819. compare = ( a.ownerDocument || a ) === ( b.ownerDocument || b ) ?
  9820. a.compareDocumentPosition( b ) :
  9821. // Otherwise we know they are disconnected
  9822. 1;
  9823. // Disconnected nodes
  9824. if ( compare & 1 ||
  9825. (!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) {
  9826. // Choose the first element that is related to our preferred document
  9827. if ( a === document || a.ownerDocument === preferredDoc && contains(preferredDoc, a) ) {
  9828. return -1;
  9829. }
  9830. if ( b === document || b.ownerDocument === preferredDoc && contains(preferredDoc, b) ) {
  9831. return 1;
  9832. }
  9833. // Maintain original order
  9834. return sortInput ?
  9835. ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
  9836. 0;
  9837. }
  9838. return compare & 4 ? -1 : 1;
  9839. } :
  9840. function( a, b ) {
  9841. // Exit early if the nodes are identical
  9842. if ( a === b ) {
  9843. hasDuplicate = true;
  9844. return 0;
  9845. }
  9846. var cur,
  9847. i = 0,
  9848. aup = a.parentNode,
  9849. bup = b.parentNode,
  9850. ap = [ a ],
  9851. bp = [ b ];
  9852. // Parentless nodes are either documents or disconnected
  9853. if ( !aup || !bup ) {
  9854. return a === document ? -1 :
  9855. b === document ? 1 :
  9856. aup ? -1 :
  9857. bup ? 1 :
  9858. sortInput ?
  9859. ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
  9860. 0;
  9861. // If the nodes are siblings, we can do a quick check
  9862. } else if ( aup === bup ) {
  9863. return siblingCheck( a, b );
  9864. }
  9865. // Otherwise we need full lists of their ancestors for comparison
  9866. cur = a;
  9867. while ( (cur = cur.parentNode) ) {
  9868. ap.unshift( cur );
  9869. }
  9870. cur = b;
  9871. while ( (cur = cur.parentNode) ) {
  9872. bp.unshift( cur );
  9873. }
  9874. // Walk down the tree looking for a discrepancy
  9875. while ( ap[i] === bp[i] ) {
  9876. i++;
  9877. }
  9878. return i ?
  9879. // Do a sibling check if the nodes have a common ancestor
  9880. siblingCheck( ap[i], bp[i] ) :
  9881. // Otherwise nodes in our document sort first
  9882. ap[i] === preferredDoc ? -1 :
  9883. bp[i] === preferredDoc ? 1 :
  9884. 0;
  9885. };
  9886. return document;
  9887. };
  9888. Sizzle.matches = function( expr, elements ) {
  9889. return Sizzle( expr, null, null, elements );
  9890. };
  9891. Sizzle.matchesSelector = function( elem, expr ) {
  9892. // Set document vars if needed
  9893. if ( ( elem.ownerDocument || elem ) !== document ) {
  9894. setDocument( elem );
  9895. }
  9896. if ( support.matchesSelector && documentIsHTML &&
  9897. !nonnativeSelectorCache[ expr + " " ] &&
  9898. ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) &&
  9899. ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) {
  9900. try {
  9901. var ret = matches.call( elem, expr );
  9902. // IE 9's matchesSelector returns false on disconnected nodes
  9903. if ( ret || support.disconnectedMatch ||
  9904. // As well, disconnected nodes are said to be in a document
  9905. // fragment in IE 9
  9906. elem.document && elem.document.nodeType !== 11 ) {
  9907. return ret;
  9908. }
  9909. } catch (e) {
  9910. nonnativeSelectorCache( expr, true );
  9911. }
  9912. }
  9913. return Sizzle( expr, document, null, [ elem ] ).length > 0;
  9914. };
  9915. Sizzle.contains = function( context, elem ) {
  9916. // Set document vars if needed
  9917. if ( ( context.ownerDocument || context ) !== document ) {
  9918. setDocument( context );
  9919. }
  9920. return contains( context, elem );
  9921. };
  9922. Sizzle.attr = function( elem, name ) {
  9923. // Set document vars if needed
  9924. if ( ( elem.ownerDocument || elem ) !== document ) {
  9925. setDocument( elem );
  9926. }
  9927. var fn = Expr.attrHandle[ name.toLowerCase() ],
  9928. // Don't get fooled by Object.prototype properties (jQuery #13807)
  9929. val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ?
  9930. fn( elem, name, !documentIsHTML ) :
  9931. undefined;
  9932. return val !== undefined ?
  9933. val :
  9934. support.attributes || !documentIsHTML ?
  9935. elem.getAttribute( name ) :
  9936. (val = elem.getAttributeNode(name)) && val.specified ?
  9937. val.value :
  9938. null;
  9939. };
  9940. Sizzle.escape = function( sel ) {
  9941. return (sel + "").replace( rcssescape, fcssescape );
  9942. };
  9943. Sizzle.error = function( msg ) {
  9944. throw new Error( "Syntax error, unrecognized expression: " + msg );
  9945. };
  9946. /**
  9947. * Document sorting and removing duplicates
  9948. * @param {ArrayLike} results
  9949. */
  9950. Sizzle.uniqueSort = function( results ) {
  9951. var elem,
  9952. duplicates = [],
  9953. j = 0,
  9954. i = 0;
  9955. // Unless we *know* we can detect duplicates, assume their presence
  9956. hasDuplicate = !support.detectDuplicates;
  9957. sortInput = !support.sortStable && results.slice( 0 );
  9958. results.sort( sortOrder );
  9959. if ( hasDuplicate ) {
  9960. while ( (elem = results[i++]) ) {
  9961. if ( elem === results[ i ] ) {
  9962. j = duplicates.push( i );
  9963. }
  9964. }
  9965. while ( j-- ) {
  9966. results.splice( duplicates[ j ], 1 );
  9967. }
  9968. }
  9969. // Clear input after sorting to release objects
  9970. // See https://github.com/jquery/sizzle/pull/225
  9971. sortInput = null;
  9972. return results;
  9973. };
  9974. /**
  9975. * Utility function for retrieving the text value of an array of DOM nodes
  9976. * @param {Array|Element} elem
  9977. */
  9978. getText = Sizzle.getText = function( elem ) {
  9979. var node,
  9980. ret = "",
  9981. i = 0,
  9982. nodeType = elem.nodeType;
  9983. if ( !nodeType ) {
  9984. // If no nodeType, this is expected to be an array
  9985. while ( (node = elem[i++]) ) {
  9986. // Do not traverse comment nodes
  9987. ret += getText( node );
  9988. }
  9989. } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {
  9990. // Use textContent for elements
  9991. // innerText usage removed for consistency of new lines (jQuery #11153)
  9992. if ( typeof elem.textContent === "string" ) {
  9993. return elem.textContent;
  9994. } else {
  9995. // Traverse its children
  9996. for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
  9997. ret += getText( elem );
  9998. }
  9999. }
  10000. } else if ( nodeType === 3 || nodeType === 4 ) {
  10001. return elem.nodeValue;
  10002. }
  10003. // Do not include comment or processing instruction nodes
  10004. return ret;
  10005. };
  10006. Expr = Sizzle.selectors = {
  10007. // Can be adjusted by the user
  10008. cacheLength: 50,
  10009. createPseudo: markFunction,
  10010. match: matchExpr,
  10011. attrHandle: {},
  10012. find: {},
  10013. relative: {
  10014. ">": { dir: "parentNode", first: true },
  10015. " ": { dir: "parentNode" },
  10016. "+": { dir: "previousSibling", first: true },
  10017. "~": { dir: "previousSibling" }
  10018. },
  10019. preFilter: {
  10020. "ATTR": function( match ) {
  10021. match[1] = match[1].replace( runescape, funescape );
  10022. // Move the given value to match[3] whether quoted or unquoted
  10023. match[3] = ( match[3] || match[4] || match[5] || "" ).replace( runescape, funescape );
  10024. if ( match[2] === "~=" ) {
  10025. match[3] = " " + match[3] + " ";
  10026. }
  10027. return match.slice( 0, 4 );
  10028. },
  10029. "CHILD": function( match ) {
  10030. /* matches from matchExpr["CHILD"]
  10031. 1 type (only|nth|...)
  10032. 2 what (child|of-type)
  10033. 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...)
  10034. 4 xn-component of xn+y argument ([+-]?\d*n|)
  10035. 5 sign of xn-component
  10036. 6 x of xn-component
  10037. 7 sign of y-component
  10038. 8 y of y-component
  10039. */
  10040. match[1] = match[1].toLowerCase();
  10041. if ( match[1].slice( 0, 3 ) === "nth" ) {
  10042. // nth-* requires argument
  10043. if ( !match[3] ) {
  10044. Sizzle.error( match[0] );
  10045. }
  10046. // numeric x and y parameters for Expr.filter.CHILD
  10047. // remember that false/true cast respectively to 0/1
  10048. match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) );
  10049. match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" );
  10050. // other types prohibit arguments
  10051. } else if ( match[3] ) {
  10052. Sizzle.error( match[0] );
  10053. }
  10054. return match;
  10055. },
  10056. "PSEUDO": function( match ) {
  10057. var excess,
  10058. unquoted = !match[6] && match[2];
  10059. if ( matchExpr["CHILD"].test( match[0] ) ) {
  10060. return null;
  10061. }
  10062. // Accept quoted arguments as-is
  10063. if ( match[3] ) {
  10064. match[2] = match[4] || match[5] || "";
  10065. // Strip excess characters from unquoted arguments
  10066. } else if ( unquoted && rpseudo.test( unquoted ) &&
  10067. // Get excess from tokenize (recursively)
  10068. (excess = tokenize( unquoted, true )) &&
  10069. // advance to the next closing parenthesis
  10070. (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) {
  10071. // excess is a negative index
  10072. match[0] = match[0].slice( 0, excess );
  10073. match[2] = unquoted.slice( 0, excess );
  10074. }
  10075. // Return only captures needed by the pseudo filter method (type and argument)
  10076. return match.slice( 0, 3 );
  10077. }
  10078. },
  10079. filter: {
  10080. "TAG": function( nodeNameSelector ) {
  10081. var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase();
  10082. return nodeNameSelector === "*" ?
  10083. function() { return true; } :
  10084. function( elem ) {
  10085. return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;
  10086. };
  10087. },
  10088. "CLASS": function( className ) {
  10089. var pattern = classCache[ className + " " ];
  10090. return pattern ||
  10091. (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) &&
  10092. classCache( className, function( elem ) {
  10093. return pattern.test( typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== "undefined" && elem.getAttribute("class") || "" );
  10094. });
  10095. },
  10096. "ATTR": function( name, operator, check ) {
  10097. return function( elem ) {
  10098. var result = Sizzle.attr( elem, name );
  10099. if ( result == null ) {
  10100. return operator === "!=";
  10101. }
  10102. if ( !operator ) {
  10103. return true;
  10104. }
  10105. result += "";
  10106. return operator === "=" ? result === check :
  10107. operator === "!=" ? result !== check :
  10108. operator === "^=" ? check && result.indexOf( check ) === 0 :
  10109. operator === "*=" ? check && result.indexOf( check ) > -1 :
  10110. operator === "$=" ? check && result.slice( -check.length ) === check :
  10111. operator === "~=" ? ( " " + result.replace( rwhitespace, " " ) + " " ).indexOf( check ) > -1 :
  10112. operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" :
  10113. false;
  10114. };
  10115. },
  10116. "CHILD": function( type, what, argument, first, last ) {
  10117. var simple = type.slice( 0, 3 ) !== "nth",
  10118. forward = type.slice( -4 ) !== "last",
  10119. ofType = what === "of-type";
  10120. return first === 1 && last === 0 ?
  10121. // Shortcut for :nth-*(n)
  10122. function( elem ) {
  10123. return !!elem.parentNode;
  10124. } :
  10125. function( elem, context, xml ) {
  10126. var cache, uniqueCache, outerCache, node, nodeIndex, start,
  10127. dir = simple !== forward ? "nextSibling" : "previousSibling",
  10128. parent = elem.parentNode,
  10129. name = ofType && elem.nodeName.toLowerCase(),
  10130. useCache = !xml && !ofType,
  10131. diff = false;
  10132. if ( parent ) {
  10133. // :(first|last|only)-(child|of-type)
  10134. if ( simple ) {
  10135. while ( dir ) {
  10136. node = elem;
  10137. while ( (node = node[ dir ]) ) {
  10138. if ( ofType ?
  10139. node.nodeName.toLowerCase() === name :
  10140. node.nodeType === 1 ) {
  10141. return false;
  10142. }
  10143. }
  10144. // Reverse direction for :only-* (if we haven't yet done so)
  10145. start = dir = type === "only" && !start && "nextSibling";
  10146. }
  10147. return true;
  10148. }
  10149. start = [ forward ? parent.firstChild : parent.lastChild ];
  10150. // non-xml :nth-child(...) stores cache data on `parent`
  10151. if ( forward && useCache ) {
  10152. // Seek `elem` from a previously-cached index
  10153. // ...in a gzip-friendly way
  10154. node = parent;
  10155. outerCache = node[ expando ] || (node[ expando ] = {});
  10156. // Support: IE <9 only
  10157. // Defend against cloned attroperties (jQuery gh-1709)
  10158. uniqueCache = outerCache[ node.uniqueID ] ||
  10159. (outerCache[ node.uniqueID ] = {});
  10160. cache = uniqueCache[ type ] || [];
  10161. nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
  10162. diff = nodeIndex && cache[ 2 ];
  10163. node = nodeIndex && parent.childNodes[ nodeIndex ];
  10164. while ( (node = ++nodeIndex && node && node[ dir ] ||
  10165. // Fallback to seeking `elem` from the start
  10166. (diff = nodeIndex = 0) || start.pop()) ) {
  10167. // When found, cache indexes on `parent` and break
  10168. if ( node.nodeType === 1 && ++diff && node === elem ) {
  10169. uniqueCache[ type ] = [ dirruns, nodeIndex, diff ];
  10170. break;
  10171. }
  10172. }
  10173. } else {
  10174. // Use previously-cached element index if available
  10175. if ( useCache ) {
  10176. // ...in a gzip-friendly way
  10177. node = elem;
  10178. outerCache = node[ expando ] || (node[ expando ] = {});
  10179. // Support: IE <9 only
  10180. // Defend against cloned attroperties (jQuery gh-1709)
  10181. uniqueCache = outerCache[ node.uniqueID ] ||
  10182. (outerCache[ node.uniqueID ] = {});
  10183. cache = uniqueCache[ type ] || [];
  10184. nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
  10185. diff = nodeIndex;
  10186. }
  10187. // xml :nth-child(...)
  10188. // or :nth-last-child(...) or :nth(-last)?-of-type(...)
  10189. if ( diff === false ) {
  10190. // Use the same loop as above to seek `elem` from the start
  10191. while ( (node = ++nodeIndex && node && node[ dir ] ||
  10192. (diff = nodeIndex = 0) || start.pop()) ) {
  10193. if ( ( ofType ?
  10194. node.nodeName.toLowerCase() === name :
  10195. node.nodeType === 1 ) &&
  10196. ++diff ) {
  10197. // Cache the index of each encountered element
  10198. if ( useCache ) {
  10199. outerCache = node[ expando ] || (node[ expando ] = {});
  10200. // Support: IE <9 only
  10201. // Defend against cloned attroperties (jQuery gh-1709)
  10202. uniqueCache = outerCache[ node.uniqueID ] ||
  10203. (outerCache[ node.uniqueID ] = {});
  10204. uniqueCache[ type ] = [ dirruns, diff ];
  10205. }
  10206. if ( node === elem ) {
  10207. break;
  10208. }
  10209. }
  10210. }
  10211. }
  10212. }
  10213. // Incorporate the offset, then check against cycle size
  10214. diff -= last;
  10215. return diff === first || ( diff % first === 0 && diff / first >= 0 );
  10216. }
  10217. };
  10218. },
  10219. "PSEUDO": function( pseudo, argument ) {
  10220. // pseudo-class names are case-insensitive
  10221. // http://www.w3.org/TR/selectors/#pseudo-classes
  10222. // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters
  10223. // Remember that setFilters inherits from pseudos
  10224. var args,
  10225. fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] ||
  10226. Sizzle.error( "unsupported pseudo: " + pseudo );
  10227. // The user may use createPseudo to indicate that
  10228. // arguments are needed to create the filter function
  10229. // just as Sizzle does
  10230. if ( fn[ expando ] ) {
  10231. return fn( argument );
  10232. }
  10233. // But maintain support for old signatures
  10234. if ( fn.length > 1 ) {
  10235. args = [ pseudo, pseudo, "", argument ];
  10236. return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ?
  10237. markFunction(function( seed, matches ) {
  10238. var idx,
  10239. matched = fn( seed, argument ),
  10240. i = matched.length;
  10241. while ( i-- ) {
  10242. idx = indexOf( seed, matched[i] );
  10243. seed[ idx ] = !( matches[ idx ] = matched[i] );
  10244. }
  10245. }) :
  10246. function( elem ) {
  10247. return fn( elem, 0, args );
  10248. };
  10249. }
  10250. return fn;
  10251. }
  10252. },
  10253. pseudos: {
  10254. // Potentially complex pseudos
  10255. "not": markFunction(function( selector ) {
  10256. // Trim the selector passed to compile
  10257. // to avoid treating leading and trailing
  10258. // spaces as combinators
  10259. var input = [],
  10260. results = [],
  10261. matcher = compile( selector.replace( rtrim, "$1" ) );
  10262. return matcher[ expando ] ?
  10263. markFunction(function( seed, matches, context, xml ) {
  10264. var elem,
  10265. unmatched = matcher( seed, null, xml, [] ),
  10266. i = seed.length;
  10267. // Match elements unmatched by `matcher`
  10268. while ( i-- ) {
  10269. if ( (elem = unmatched[i]) ) {
  10270. seed[i] = !(matches[i] = elem);
  10271. }
  10272. }
  10273. }) :
  10274. function( elem, context, xml ) {
  10275. input[0] = elem;
  10276. matcher( input, null, xml, results );
  10277. // Don't keep the element (issue #299)
  10278. input[0] = null;
  10279. return !results.pop();
  10280. };
  10281. }),
  10282. "has": markFunction(function( selector ) {
  10283. return function( elem ) {
  10284. return Sizzle( selector, elem ).length > 0;
  10285. };
  10286. }),
  10287. "contains": markFunction(function( text ) {
  10288. text = text.replace( runescape, funescape );
  10289. return function( elem ) {
  10290. return ( elem.textContent || getText( elem ) ).indexOf( text ) > -1;
  10291. };
  10292. }),
  10293. // "Whether an element is represented by a :lang() selector
  10294. // is based solely on the element's language value
  10295. // being equal to the identifier C,
  10296. // or beginning with the identifier C immediately followed by "-".
  10297. // The matching of C against the element's language value is performed case-insensitively.
  10298. // The identifier C does not have to be a valid language name."
  10299. // http://www.w3.org/TR/selectors/#lang-pseudo
  10300. "lang": markFunction( function( lang ) {
  10301. // lang value must be a valid identifier
  10302. if ( !ridentifier.test(lang || "") ) {
  10303. Sizzle.error( "unsupported lang: " + lang );
  10304. }
  10305. lang = lang.replace( runescape, funescape ).toLowerCase();
  10306. return function( elem ) {
  10307. var elemLang;
  10308. do {
  10309. if ( (elemLang = documentIsHTML ?
  10310. elem.lang :
  10311. elem.getAttribute("xml:lang") || elem.getAttribute("lang")) ) {
  10312. elemLang = elemLang.toLowerCase();
  10313. return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0;
  10314. }
  10315. } while ( (elem = elem.parentNode) && elem.nodeType === 1 );
  10316. return false;
  10317. };
  10318. }),
  10319. // Miscellaneous
  10320. "target": function( elem ) {
  10321. var hash = window.location && window.location.hash;
  10322. return hash && hash.slice( 1 ) === elem.id;
  10323. },
  10324. "root": function( elem ) {
  10325. return elem === docElem;
  10326. },
  10327. "focus": function( elem ) {
  10328. return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex);
  10329. },
  10330. // Boolean properties
  10331. "enabled": createDisabledPseudo( false ),
  10332. "disabled": createDisabledPseudo( true ),
  10333. "checked": function( elem ) {
  10334. // In CSS3, :checked should return both checked and selected elements
  10335. // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
  10336. var nodeName = elem.nodeName.toLowerCase();
  10337. return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected);
  10338. },
  10339. "selected": function( elem ) {
  10340. // Accessing this property makes selected-by-default
  10341. // options in Safari work properly
  10342. if ( elem.parentNode ) {
  10343. elem.parentNode.selectedIndex;
  10344. }
  10345. return elem.selected === true;
  10346. },
  10347. // Contents
  10348. "empty": function( elem ) {
  10349. // http://www.w3.org/TR/selectors/#empty-pseudo
  10350. // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5),
  10351. // but not by others (comment: 8; processing instruction: 7; etc.)
  10352. // nodeType < 6 works because attributes (2) do not appear as children
  10353. for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
  10354. if ( elem.nodeType < 6 ) {
  10355. return false;
  10356. }
  10357. }
  10358. return true;
  10359. },
  10360. "parent": function( elem ) {
  10361. return !Expr.pseudos["empty"]( elem );
  10362. },
  10363. // Element/input types
  10364. "header": function( elem ) {
  10365. return rheader.test( elem.nodeName );
  10366. },
  10367. "input": function( elem ) {
  10368. return rinputs.test( elem.nodeName );
  10369. },
  10370. "button": function( elem ) {
  10371. var name = elem.nodeName.toLowerCase();
  10372. return name === "input" && elem.type === "button" || name === "button";
  10373. },
  10374. "text": function( elem ) {
  10375. var attr;
  10376. return elem.nodeName.toLowerCase() === "input" &&
  10377. elem.type === "text" &&
  10378. // Support: IE<8
  10379. // New HTML5 attribute values (e.g., "search") appear with elem.type === "text"
  10380. ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text" );
  10381. },
  10382. // Position-in-collection
  10383. "first": createPositionalPseudo(function() {
  10384. return [ 0 ];
  10385. }),
  10386. "last": createPositionalPseudo(function( matchIndexes, length ) {
  10387. return [ length - 1 ];
  10388. }),
  10389. "eq": createPositionalPseudo(function( matchIndexes, length, argument ) {
  10390. return [ argument < 0 ? argument + length : argument ];
  10391. }),
  10392. "even": createPositionalPseudo(function( matchIndexes, length ) {
  10393. var i = 0;
  10394. for ( ; i < length; i += 2 ) {
  10395. matchIndexes.push( i );
  10396. }
  10397. return matchIndexes;
  10398. }),
  10399. "odd": createPositionalPseudo(function( matchIndexes, length ) {
  10400. var i = 1;
  10401. for ( ; i < length; i += 2 ) {
  10402. matchIndexes.push( i );
  10403. }
  10404. return matchIndexes;
  10405. }),
  10406. "lt": createPositionalPseudo(function( matchIndexes, length, argument ) {
  10407. var i = argument < 0 ?
  10408. argument + length :
  10409. argument > length ?
  10410. length :
  10411. argument;
  10412. for ( ; --i >= 0; ) {
  10413. matchIndexes.push( i );
  10414. }
  10415. return matchIndexes;
  10416. }),
  10417. "gt": createPositionalPseudo(function( matchIndexes, length, argument ) {
  10418. var i = argument < 0 ? argument + length : argument;
  10419. for ( ; ++i < length; ) {
  10420. matchIndexes.push( i );
  10421. }
  10422. return matchIndexes;
  10423. })
  10424. }
  10425. };
  10426. Expr.pseudos["nth"] = Expr.pseudos["eq"];
  10427. // Add button/input type pseudos
  10428. for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) {
  10429. Expr.pseudos[ i ] = createInputPseudo( i );
  10430. }
  10431. for ( i in { submit: true, reset: true } ) {
  10432. Expr.pseudos[ i ] = createButtonPseudo( i );
  10433. }
  10434. // Easy API for creating new setFilters
  10435. function setFilters() {}
  10436. setFilters.prototype = Expr.filters = Expr.pseudos;
  10437. Expr.setFilters = new setFilters();
  10438. tokenize = Sizzle.tokenize = function( selector, parseOnly ) {
  10439. var matched, match, tokens, type,
  10440. soFar, groups, preFilters,
  10441. cached = tokenCache[ selector + " " ];
  10442. if ( cached ) {
  10443. return parseOnly ? 0 : cached.slice( 0 );
  10444. }
  10445. soFar = selector;
  10446. groups = [];
  10447. preFilters = Expr.preFilter;
  10448. while ( soFar ) {
  10449. // Comma and first run
  10450. if ( !matched || (match = rcomma.exec( soFar )) ) {
  10451. if ( match ) {
  10452. // Don't consume trailing commas as valid
  10453. soFar = soFar.slice( match[0].length ) || soFar;
  10454. }
  10455. groups.push( (tokens = []) );
  10456. }
  10457. matched = false;
  10458. // Combinators
  10459. if ( (match = rcombinators.exec( soFar )) ) {
  10460. matched = match.shift();
  10461. tokens.push({
  10462. value: matched,
  10463. // Cast descendant combinators to space
  10464. type: match[0].replace( rtrim, " " )
  10465. });
  10466. soFar = soFar.slice( matched.length );
  10467. }
  10468. // Filters
  10469. for ( type in Expr.filter ) {
  10470. if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] ||
  10471. (match = preFilters[ type ]( match ))) ) {
  10472. matched = match.shift();
  10473. tokens.push({
  10474. value: matched,
  10475. type: type,
  10476. matches: match
  10477. });
  10478. soFar = soFar.slice( matched.length );
  10479. }
  10480. }
  10481. if ( !matched ) {
  10482. break;
  10483. }
  10484. }
  10485. // Return the length of the invalid excess
  10486. // if we're just parsing
  10487. // Otherwise, throw an error or return tokens
  10488. return parseOnly ?
  10489. soFar.length :
  10490. soFar ?
  10491. Sizzle.error( selector ) :
  10492. // Cache the tokens
  10493. tokenCache( selector, groups ).slice( 0 );
  10494. };
  10495. function toSelector( tokens ) {
  10496. var i = 0,
  10497. len = tokens.length,
  10498. selector = "";
  10499. for ( ; i < len; i++ ) {
  10500. selector += tokens[i].value;
  10501. }
  10502. return selector;
  10503. }
  10504. function addCombinator( matcher, combinator, base ) {
  10505. var dir = combinator.dir,
  10506. skip = combinator.next,
  10507. key = skip || dir,
  10508. checkNonElements = base && key === "parentNode",
  10509. doneName = done++;
  10510. return combinator.first ?
  10511. // Check against closest ancestor/preceding element
  10512. function( elem, context, xml ) {
  10513. while ( (elem = elem[ dir ]) ) {
  10514. if ( elem.nodeType === 1 || checkNonElements ) {
  10515. return matcher( elem, context, xml );
  10516. }
  10517. }
  10518. return false;
  10519. } :
  10520. // Check against all ancestor/preceding elements
  10521. function( elem, context, xml ) {
  10522. var oldCache, uniqueCache, outerCache,
  10523. newCache = [ dirruns, doneName ];
  10524. // We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching
  10525. if ( xml ) {
  10526. while ( (elem = elem[ dir ]) ) {
  10527. if ( elem.nodeType === 1 || checkNonElements ) {
  10528. if ( matcher( elem, context, xml ) ) {
  10529. return true;
  10530. }
  10531. }
  10532. }
  10533. } else {
  10534. while ( (elem = elem[ dir ]) ) {
  10535. if ( elem.nodeType === 1 || checkNonElements ) {
  10536. outerCache = elem[ expando ] || (elem[ expando ] = {});
  10537. // Support: IE <9 only
  10538. // Defend against cloned attroperties (jQuery gh-1709)
  10539. uniqueCache = outerCache[ elem.uniqueID ] || (outerCache[ elem.uniqueID ] = {});
  10540. if ( skip && skip === elem.nodeName.toLowerCase() ) {
  10541. elem = elem[ dir ] || elem;
  10542. } else if ( (oldCache = uniqueCache[ key ]) &&
  10543. oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) {
  10544. // Assign to newCache so results back-propagate to previous elements
  10545. return (newCache[ 2 ] = oldCache[ 2 ]);
  10546. } else {
  10547. // Reuse newcache so results back-propagate to previous elements
  10548. uniqueCache[ key ] = newCache;
  10549. // A match means we're done; a fail means we have to keep checking
  10550. if ( (newCache[ 2 ] = matcher( elem, context, xml )) ) {
  10551. return true;
  10552. }
  10553. }
  10554. }
  10555. }
  10556. }
  10557. return false;
  10558. };
  10559. }
  10560. function elementMatcher( matchers ) {
  10561. return matchers.length > 1 ?
  10562. function( elem, context, xml ) {
  10563. var i = matchers.length;
  10564. while ( i-- ) {
  10565. if ( !matchers[i]( elem, context, xml ) ) {
  10566. return false;
  10567. }
  10568. }
  10569. return true;
  10570. } :
  10571. matchers[0];
  10572. }
  10573. function multipleContexts( selector, contexts, results ) {
  10574. var i = 0,
  10575. len = contexts.length;
  10576. for ( ; i < len; i++ ) {
  10577. Sizzle( selector, contexts[i], results );
  10578. }
  10579. return results;
  10580. }
  10581. function condense( unmatched, map, filter, context, xml ) {
  10582. var elem,
  10583. newUnmatched = [],
  10584. i = 0,
  10585. len = unmatched.length,
  10586. mapped = map != null;
  10587. for ( ; i < len; i++ ) {
  10588. if ( (elem = unmatched[i]) ) {
  10589. if ( !filter || filter( elem, context, xml ) ) {
  10590. newUnmatched.push( elem );
  10591. if ( mapped ) {
  10592. map.push( i );
  10593. }
  10594. }
  10595. }
  10596. }
  10597. return newUnmatched;
  10598. }
  10599. function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) {
  10600. if ( postFilter && !postFilter[ expando ] ) {
  10601. postFilter = setMatcher( postFilter );
  10602. }
  10603. if ( postFinder && !postFinder[ expando ] ) {
  10604. postFinder = setMatcher( postFinder, postSelector );
  10605. }
  10606. return markFunction(function( seed, results, context, xml ) {
  10607. var temp, i, elem,
  10608. preMap = [],
  10609. postMap = [],
  10610. preexisting = results.length,
  10611. // Get initial elements from seed or context
  10612. elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ),
  10613. // Prefilter to get matcher input, preserving a map for seed-results synchronization
  10614. matcherIn = preFilter && ( seed || !selector ) ?
  10615. condense( elems, preMap, preFilter, context, xml ) :
  10616. elems,
  10617. matcherOut = matcher ?
  10618. // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,
  10619. postFinder || ( seed ? preFilter : preexisting || postFilter ) ?
  10620. // ...intermediate processing is necessary
  10621. [] :
  10622. // ...otherwise use results directly
  10623. results :
  10624. matcherIn;
  10625. // Find primary matches
  10626. if ( matcher ) {
  10627. matcher( matcherIn, matcherOut, context, xml );
  10628. }
  10629. // Apply postFilter
  10630. if ( postFilter ) {
  10631. temp = condense( matcherOut, postMap );
  10632. postFilter( temp, [], context, xml );
  10633. // Un-match failing elements by moving them back to matcherIn
  10634. i = temp.length;
  10635. while ( i-- ) {
  10636. if ( (elem = temp[i]) ) {
  10637. matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem);
  10638. }
  10639. }
  10640. }
  10641. if ( seed ) {
  10642. if ( postFinder || preFilter ) {
  10643. if ( postFinder ) {
  10644. // Get the final matcherOut by condensing this intermediate into postFinder contexts
  10645. temp = [];
  10646. i = matcherOut.length;
  10647. while ( i-- ) {
  10648. if ( (elem = matcherOut[i]) ) {
  10649. // Restore matcherIn since elem is not yet a final match
  10650. temp.push( (matcherIn[i] = elem) );
  10651. }
  10652. }
  10653. postFinder( null, (matcherOut = []), temp, xml );
  10654. }
  10655. // Move matched elements from seed to results to keep them synchronized
  10656. i = matcherOut.length;
  10657. while ( i-- ) {
  10658. if ( (elem = matcherOut[i]) &&
  10659. (temp = postFinder ? indexOf( seed, elem ) : preMap[i]) > -1 ) {
  10660. seed[temp] = !(results[temp] = elem);
  10661. }
  10662. }
  10663. }
  10664. // Add elements to results, through postFinder if defined
  10665. } else {
  10666. matcherOut = condense(
  10667. matcherOut === results ?
  10668. matcherOut.splice( preexisting, matcherOut.length ) :
  10669. matcherOut
  10670. );
  10671. if ( postFinder ) {
  10672. postFinder( null, results, matcherOut, xml );
  10673. } else {
  10674. push.apply( results, matcherOut );
  10675. }
  10676. }
  10677. });
  10678. }
  10679. function matcherFromTokens( tokens ) {
  10680. var checkContext, matcher, j,
  10681. len = tokens.length,
  10682. leadingRelative = Expr.relative[ tokens[0].type ],
  10683. implicitRelative = leadingRelative || Expr.relative[" "],
  10684. i = leadingRelative ? 1 : 0,
  10685. // The foundational matcher ensures that elements are reachable from top-level context(s)
  10686. matchContext = addCombinator( function( elem ) {
  10687. return elem === checkContext;
  10688. }, implicitRelative, true ),
  10689. matchAnyContext = addCombinator( function( elem ) {
  10690. return indexOf( checkContext, elem ) > -1;
  10691. }, implicitRelative, true ),
  10692. matchers = [ function( elem, context, xml ) {
  10693. var ret = ( !leadingRelative && ( xml || context !== outermostContext ) ) || (
  10694. (checkContext = context).nodeType ?
  10695. matchContext( elem, context, xml ) :
  10696. matchAnyContext( elem, context, xml ) );
  10697. // Avoid hanging onto element (issue #299)
  10698. checkContext = null;
  10699. return ret;
  10700. } ];
  10701. for ( ; i < len; i++ ) {
  10702. if ( (matcher = Expr.relative[ tokens[i].type ]) ) {
  10703. matchers = [ addCombinator(elementMatcher( matchers ), matcher) ];
  10704. } else {
  10705. matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches );
  10706. // Return special upon seeing a positional matcher
  10707. if ( matcher[ expando ] ) {
  10708. // Find the next relative operator (if any) for proper handling
  10709. j = ++i;
  10710. for ( ; j < len; j++ ) {
  10711. if ( Expr.relative[ tokens[j].type ] ) {
  10712. break;
  10713. }
  10714. }
  10715. return setMatcher(
  10716. i > 1 && elementMatcher( matchers ),
  10717. i > 1 && toSelector(
  10718. // If the preceding token was a descendant combinator, insert an implicit any-element `*`
  10719. tokens.slice( 0, i - 1 ).concat({ value: tokens[ i - 2 ].type === " " ? "*" : "" })
  10720. ).replace( rtrim, "$1" ),
  10721. matcher,
  10722. i < j && matcherFromTokens( tokens.slice( i, j ) ),
  10723. j < len && matcherFromTokens( (tokens = tokens.slice( j )) ),
  10724. j < len && toSelector( tokens )
  10725. );
  10726. }
  10727. matchers.push( matcher );
  10728. }
  10729. }
  10730. return elementMatcher( matchers );
  10731. }
  10732. function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
  10733. var bySet = setMatchers.length > 0,
  10734. byElement = elementMatchers.length > 0,
  10735. superMatcher = function( seed, context, xml, results, outermost ) {
  10736. var elem, j, matcher,
  10737. matchedCount = 0,
  10738. i = "0",
  10739. unmatched = seed && [],
  10740. setMatched = [],
  10741. contextBackup = outermostContext,
  10742. // We must always have either seed elements or outermost context
  10743. elems = seed || byElement && Expr.find["TAG"]( "*", outermost ),
  10744. // Use integer dirruns iff this is the outermost matcher
  10745. dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1),
  10746. len = elems.length;
  10747. if ( outermost ) {
  10748. outermostContext = context === document || context || outermost;
  10749. }
  10750. // Add elements passing elementMatchers directly to results
  10751. // Support: IE<9, Safari
  10752. // Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id
  10753. for ( ; i !== len && (elem = elems[i]) != null; i++ ) {
  10754. if ( byElement && elem ) {
  10755. j = 0;
  10756. if ( !context && elem.ownerDocument !== document ) {
  10757. setDocument( elem );
  10758. xml = !documentIsHTML;
  10759. }
  10760. while ( (matcher = elementMatchers[j++]) ) {
  10761. if ( matcher( elem, context || document, xml) ) {
  10762. results.push( elem );
  10763. break;
  10764. }
  10765. }
  10766. if ( outermost ) {
  10767. dirruns = dirrunsUnique;
  10768. }
  10769. }
  10770. // Track unmatched elements for set filters
  10771. if ( bySet ) {
  10772. // They will have gone through all possible matchers
  10773. if ( (elem = !matcher && elem) ) {
  10774. matchedCount--;
  10775. }
  10776. // Lengthen the array for every element, matched or not
  10777. if ( seed ) {
  10778. unmatched.push( elem );
  10779. }
  10780. }
  10781. }
  10782. // `i` is now the count of elements visited above, and adding it to `matchedCount`
  10783. // makes the latter nonnegative.
  10784. matchedCount += i;
  10785. // Apply set filters to unmatched elements
  10786. // NOTE: This can be skipped if there are no unmatched elements (i.e., `matchedCount`
  10787. // equals `i`), unless we didn't visit _any_ elements in the above loop because we have
  10788. // no element matchers and no seed.
  10789. // Incrementing an initially-string "0" `i` allows `i` to remain a string only in that
  10790. // case, which will result in a "00" `matchedCount` that differs from `i` but is also
  10791. // numerically zero.
  10792. if ( bySet && i !== matchedCount ) {
  10793. j = 0;
  10794. while ( (matcher = setMatchers[j++]) ) {
  10795. matcher( unmatched, setMatched, context, xml );
  10796. }
  10797. if ( seed ) {
  10798. // Reintegrate element matches to eliminate the need for sorting
  10799. if ( matchedCount > 0 ) {
  10800. while ( i-- ) {
  10801. if ( !(unmatched[i] || setMatched[i]) ) {
  10802. setMatched[i] = pop.call( results );
  10803. }
  10804. }
  10805. }
  10806. // Discard index placeholder values to get only actual matches
  10807. setMatched = condense( setMatched );
  10808. }
  10809. // Add matches to results
  10810. push.apply( results, setMatched );
  10811. // Seedless set matches succeeding multiple successful matchers stipulate sorting
  10812. if ( outermost && !seed && setMatched.length > 0 &&
  10813. ( matchedCount + setMatchers.length ) > 1 ) {
  10814. Sizzle.uniqueSort( results );
  10815. }
  10816. }
  10817. // Override manipulation of globals by nested matchers
  10818. if ( outermost ) {
  10819. dirruns = dirrunsUnique;
  10820. outermostContext = contextBackup;
  10821. }
  10822. return unmatched;
  10823. };
  10824. return bySet ?
  10825. markFunction( superMatcher ) :
  10826. superMatcher;
  10827. }
  10828. compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) {
  10829. var i,
  10830. setMatchers = [],
  10831. elementMatchers = [],
  10832. cached = compilerCache[ selector + " " ];
  10833. if ( !cached ) {
  10834. // Generate a function of recursive functions that can be used to check each element
  10835. if ( !match ) {
  10836. match = tokenize( selector );
  10837. }
  10838. i = match.length;
  10839. while ( i-- ) {
  10840. cached = matcherFromTokens( match[i] );
  10841. if ( cached[ expando ] ) {
  10842. setMatchers.push( cached );
  10843. } else {
  10844. elementMatchers.push( cached );
  10845. }
  10846. }
  10847. // Cache the compiled function
  10848. cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) );
  10849. // Save selector and tokenization
  10850. cached.selector = selector;
  10851. }
  10852. return cached;
  10853. };
  10854. /**
  10855. * A low-level selection function that works with Sizzle's compiled
  10856. * selector functions
  10857. * @param {String|Function} selector A selector or a pre-compiled
  10858. * selector function built with Sizzle.compile
  10859. * @param {Element} context
  10860. * @param {Array} [results]
  10861. * @param {Array} [seed] A set of elements to match against
  10862. */
  10863. select = Sizzle.select = function( selector, context, results, seed ) {
  10864. var i, tokens, token, type, find,
  10865. compiled = typeof selector === "function" && selector,
  10866. match = !seed && tokenize( (selector = compiled.selector || selector) );
  10867. results = results || [];
  10868. // Try to minimize operations if there is only one selector in the list and no seed
  10869. // (the latter of which guarantees us context)
  10870. if ( match.length === 1 ) {
  10871. // Reduce context if the leading compound selector is an ID
  10872. tokens = match[0] = match[0].slice( 0 );
  10873. if ( tokens.length > 2 && (token = tokens[0]).type === "ID" &&
  10874. context.nodeType === 9 && documentIsHTML && Expr.relative[ tokens[1].type ] ) {
  10875. context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0];
  10876. if ( !context ) {
  10877. return results;
  10878. // Precompiled matchers will still verify ancestry, so step up a level
  10879. } else if ( compiled ) {
  10880. context = context.parentNode;
  10881. }
  10882. selector = selector.slice( tokens.shift().value.length );
  10883. }
  10884. // Fetch a seed set for right-to-left matching
  10885. i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length;
  10886. while ( i-- ) {
  10887. token = tokens[i];
  10888. // Abort if we hit a combinator
  10889. if ( Expr.relative[ (type = token.type) ] ) {
  10890. break;
  10891. }
  10892. if ( (find = Expr.find[ type ]) ) {
  10893. // Search, expanding context for leading sibling combinators
  10894. if ( (seed = find(
  10895. token.matches[0].replace( runescape, funescape ),
  10896. rsibling.test( tokens[0].type ) && testContext( context.parentNode ) || context
  10897. )) ) {
  10898. // If seed is empty or no tokens remain, we can return early
  10899. tokens.splice( i, 1 );
  10900. selector = seed.length && toSelector( tokens );
  10901. if ( !selector ) {
  10902. push.apply( results, seed );
  10903. return results;
  10904. }
  10905. break;
  10906. }
  10907. }
  10908. }
  10909. }
  10910. // Compile and execute a filtering function if one is not provided
  10911. // Provide `match` to avoid retokenization if we modified the selector above
  10912. ( compiled || compile( selector, match ) )(
  10913. seed,
  10914. context,
  10915. !documentIsHTML,
  10916. results,
  10917. !context || rsibling.test( selector ) && testContext( context.parentNode ) || context
  10918. );
  10919. return results;
  10920. };
  10921. // One-time assignments
  10922. // Sort stability
  10923. support.sortStable = expando.split("").sort( sortOrder ).join("") === expando;
  10924. // Support: Chrome 14-35+
  10925. // Always assume duplicates if they aren't passed to the comparison function
  10926. support.detectDuplicates = !!hasDuplicate;
  10927. // Initialize against the default document
  10928. setDocument();
  10929. // Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27)
  10930. // Detached nodes confoundingly follow *each other*
  10931. support.sortDetached = assert(function( el ) {
  10932. // Should return 1, but returns 4 (following)
  10933. return el.compareDocumentPosition( document.createElement("fieldset") ) & 1;
  10934. });
  10935. // Support: IE<8
  10936. // Prevent attribute/property "interpolation"
  10937. // https://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
  10938. if ( !assert(function( el ) {
  10939. el.innerHTML = "<a href='#'></a>";
  10940. return el.firstChild.getAttribute("href") === "#" ;
  10941. }) ) {
  10942. addHandle( "type|href|height|width", function( elem, name, isXML ) {
  10943. if ( !isXML ) {
  10944. return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 );
  10945. }
  10946. });
  10947. }
  10948. // Support: IE<9
  10949. // Use defaultValue in place of getAttribute("value")
  10950. if ( !support.attributes || !assert(function( el ) {
  10951. el.innerHTML = "<input/>";
  10952. el.firstChild.setAttribute( "value", "" );
  10953. return el.firstChild.getAttribute( "value" ) === "";
  10954. }) ) {
  10955. addHandle( "value", function( elem, name, isXML ) {
  10956. if ( !isXML && elem.nodeName.toLowerCase() === "input" ) {
  10957. return elem.defaultValue;
  10958. }
  10959. });
  10960. }
  10961. // Support: IE<9
  10962. // Use getAttributeNode to fetch booleans when getAttribute lies
  10963. if ( !assert(function( el ) {
  10964. return el.getAttribute("disabled") == null;
  10965. }) ) {
  10966. addHandle( booleans, function( elem, name, isXML ) {
  10967. var val;
  10968. if ( !isXML ) {
  10969. return elem[ name ] === true ? name.toLowerCase() :
  10970. (val = elem.getAttributeNode( name )) && val.specified ?
  10971. val.value :
  10972. null;
  10973. }
  10974. });
  10975. }
  10976. return Sizzle;
  10977. })( window );
  10978. jQuery.find = Sizzle;
  10979. jQuery.expr = Sizzle.selectors;
  10980. // Deprecated
  10981. jQuery.expr[ ":" ] = jQuery.expr.pseudos;
  10982. jQuery.uniqueSort = jQuery.unique = Sizzle.uniqueSort;
  10983. jQuery.text = Sizzle.getText;
  10984. jQuery.isXMLDoc = Sizzle.isXML;
  10985. jQuery.contains = Sizzle.contains;
  10986. jQuery.escapeSelector = Sizzle.escape;
  10987. var dir = function( elem, dir, until ) {
  10988. var matched = [],
  10989. truncate = until !== undefined;
  10990. while ( ( elem = elem[ dir ] ) && elem.nodeType !== 9 ) {
  10991. if ( elem.nodeType === 1 ) {
  10992. if ( truncate && jQuery( elem ).is( until ) ) {
  10993. break;
  10994. }
  10995. matched.push( elem );
  10996. }
  10997. }
  10998. return matched;
  10999. };
  11000. var siblings = function( n, elem ) {
  11001. var matched = [];
  11002. for ( ; n; n = n.nextSibling ) {
  11003. if ( n.nodeType === 1 && n !== elem ) {
  11004. matched.push( n );
  11005. }
  11006. }
  11007. return matched;
  11008. };
  11009. var rneedsContext = jQuery.expr.match.needsContext;
  11010. function nodeName( elem, name ) {
  11011. return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
  11012. };
  11013. var rsingleTag = ( /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i );
  11014. // Implement the identical functionality for filter and not
  11015. function winnow( elements, qualifier, not ) {
  11016. if ( isFunction( qualifier ) ) {
  11017. return jQuery.grep( elements, function( elem, i ) {
  11018. return !!qualifier.call( elem, i, elem ) !== not;
  11019. } );
  11020. }
  11021. // Single element
  11022. if ( qualifier.nodeType ) {
  11023. return jQuery.grep( elements, function( elem ) {
  11024. return ( elem === qualifier ) !== not;
  11025. } );
  11026. }
  11027. // Arraylike of elements (jQuery, arguments, Array)
  11028. if ( typeof qualifier !== "string" ) {
  11029. return jQuery.grep( elements, function( elem ) {
  11030. return ( indexOf.call( qualifier, elem ) > -1 ) !== not;
  11031. } );
  11032. }
  11033. // Filtered directly for both simple and complex selectors
  11034. return jQuery.filter( qualifier, elements, not );
  11035. }
  11036. jQuery.filter = function( expr, elems, not ) {
  11037. var elem = elems[ 0 ];
  11038. if ( not ) {
  11039. expr = ":not(" + expr + ")";
  11040. }
  11041. if ( elems.length === 1 && elem.nodeType === 1 ) {
  11042. return jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : [];
  11043. }
  11044. return jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) {
  11045. return elem.nodeType === 1;
  11046. } ) );
  11047. };
  11048. jQuery.fn.extend( {
  11049. find: function( selector ) {
  11050. var i, ret,
  11051. len = this.length,
  11052. self = this;
  11053. if ( typeof selector !== "string" ) {
  11054. return this.pushStack( jQuery( selector ).filter( function() {
  11055. for ( i = 0; i < len; i++ ) {
  11056. if ( jQuery.contains( self[ i ], this ) ) {
  11057. return true;
  11058. }
  11059. }
  11060. } ) );
  11061. }
  11062. ret = this.pushStack( [] );
  11063. for ( i = 0; i < len; i++ ) {
  11064. jQuery.find( selector, self[ i ], ret );
  11065. }
  11066. return len > 1 ? jQuery.uniqueSort( ret ) : ret;
  11067. },
  11068. filter: function( selector ) {
  11069. return this.pushStack( winnow( this, selector || [], false ) );
  11070. },
  11071. not: function( selector ) {
  11072. return this.pushStack( winnow( this, selector || [], true ) );
  11073. },
  11074. is: function( selector ) {
  11075. return !!winnow(
  11076. this,
  11077. // If this is a positional/relative selector, check membership in the returned set
  11078. // so $("p:first").is("p:last") won't return true for a doc with two "p".
  11079. typeof selector === "string" && rneedsContext.test( selector ) ?
  11080. jQuery( selector ) :
  11081. selector || [],
  11082. false
  11083. ).length;
  11084. }
  11085. } );
  11086. // Initialize a jQuery object
  11087. // A central reference to the root jQuery(document)
  11088. var rootjQuery,
  11089. // A simple way to check for HTML strings
  11090. // Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
  11091. // Strict HTML recognition (#11290: must start with <)
  11092. // Shortcut simple #id case for speed
  11093. rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/,
  11094. init = jQuery.fn.init = function( selector, context, root ) {
  11095. var match, elem;
  11096. // HANDLE: $(""), $(null), $(undefined), $(false)
  11097. if ( !selector ) {
  11098. return this;
  11099. }
  11100. // Method init() accepts an alternate rootjQuery
  11101. // so migrate can support jQuery.sub (gh-2101)
  11102. root = root || rootjQuery;
  11103. // Handle HTML strings
  11104. if ( typeof selector === "string" ) {
  11105. if ( selector[ 0 ] === "<" &&
  11106. selector[ selector.length - 1 ] === ">" &&
  11107. selector.length >= 3 ) {
  11108. // Assume that strings that start and end with <> are HTML and skip the regex check
  11109. match = [ null, selector, null ];
  11110. } else {
  11111. match = rquickExpr.exec( selector );
  11112. }
  11113. // Match html or make sure no context is specified for #id
  11114. if ( match && ( match[ 1 ] || !context ) ) {
  11115. // HANDLE: $(html) -> $(array)
  11116. if ( match[ 1 ] ) {
  11117. context = context instanceof jQuery ? context[ 0 ] : context;
  11118. // Option to run scripts is true for back-compat
  11119. // Intentionally let the error be thrown if parseHTML is not present
  11120. jQuery.merge( this, jQuery.parseHTML(
  11121. match[ 1 ],
  11122. context && context.nodeType ? context.ownerDocument || context : document,
  11123. true
  11124. ) );
  11125. // HANDLE: $(html, props)
  11126. if ( rsingleTag.test( match[ 1 ] ) && jQuery.isPlainObject( context ) ) {
  11127. for ( match in context ) {
  11128. // Properties of context are called as methods if possible
  11129. if ( isFunction( this[ match ] ) ) {
  11130. this[ match ]( context[ match ] );
  11131. // ...and otherwise set as attributes
  11132. } else {
  11133. this.attr( match, context[ match ] );
  11134. }
  11135. }
  11136. }
  11137. return this;
  11138. // HANDLE: $(#id)
  11139. } else {
  11140. elem = document.getElementById( match[ 2 ] );
  11141. if ( elem ) {
  11142. // Inject the element directly into the jQuery object
  11143. this[ 0 ] = elem;
  11144. this.length = 1;
  11145. }
  11146. return this;
  11147. }
  11148. // HANDLE: $(expr, $(...))
  11149. } else if ( !context || context.jquery ) {
  11150. return ( context || root ).find( selector );
  11151. // HANDLE: $(expr, context)
  11152. // (which is just equivalent to: $(context).find(expr)
  11153. } else {
  11154. return this.constructor( context ).find( selector );
  11155. }
  11156. // HANDLE: $(DOMElement)
  11157. } else if ( selector.nodeType ) {
  11158. this[ 0 ] = selector;
  11159. this.length = 1;
  11160. return this;
  11161. // HANDLE: $(function)
  11162. // Shortcut for document ready
  11163. } else if ( isFunction( selector ) ) {
  11164. return root.ready !== undefined ?
  11165. root.ready( selector ) :
  11166. // Execute immediately if ready is not present
  11167. selector( jQuery );
  11168. }
  11169. return jQuery.makeArray( selector, this );
  11170. };
  11171. // Give the init function the jQuery prototype for later instantiation
  11172. init.prototype = jQuery.fn;
  11173. // Initialize central reference
  11174. rootjQuery = jQuery( document );
  11175. var rparentsprev = /^(?:parents|prev(?:Until|All))/,
  11176. // Methods guaranteed to produce a unique set when starting from a unique set
  11177. guaranteedUnique = {
  11178. children: true,
  11179. contents: true,
  11180. next: true,
  11181. prev: true
  11182. };
  11183. jQuery.fn.extend( {
  11184. has: function( target ) {
  11185. var targets = jQuery( target, this ),
  11186. l = targets.length;
  11187. return this.filter( function() {
  11188. var i = 0;
  11189. for ( ; i < l; i++ ) {
  11190. if ( jQuery.contains( this, targets[ i ] ) ) {
  11191. return true;
  11192. }
  11193. }
  11194. } );
  11195. },
  11196. closest: function( selectors, context ) {
  11197. var cur,
  11198. i = 0,
  11199. l = this.length,
  11200. matched = [],
  11201. targets = typeof selectors !== "string" && jQuery( selectors );
  11202. // Positional selectors never match, since there's no _selection_ context
  11203. if ( !rneedsContext.test( selectors ) ) {
  11204. for ( ; i < l; i++ ) {
  11205. for ( cur = this[ i ]; cur && cur !== context; cur = cur.parentNode ) {
  11206. // Always skip document fragments
  11207. if ( cur.nodeType < 11 && ( targets ?
  11208. targets.index( cur ) > -1 :
  11209. // Don't pass non-elements to Sizzle
  11210. cur.nodeType === 1 &&
  11211. jQuery.find.matchesSelector( cur, selectors ) ) ) {
  11212. matched.push( cur );
  11213. break;
  11214. }
  11215. }
  11216. }
  11217. }
  11218. return this.pushStack( matched.length > 1 ? jQuery.uniqueSort( matched ) : matched );
  11219. },
  11220. // Determine the position of an element within the set
  11221. index: function( elem ) {
  11222. // No argument, return index in parent
  11223. if ( !elem ) {
  11224. return ( this[ 0 ] && this[ 0 ].parentNode ) ? this.first().prevAll().length : -1;
  11225. }
  11226. // Index in selector
  11227. if ( typeof elem === "string" ) {
  11228. return indexOf.call( jQuery( elem ), this[ 0 ] );
  11229. }
  11230. // Locate the position of the desired element
  11231. return indexOf.call( this,
  11232. // If it receives a jQuery object, the first element is used
  11233. elem.jquery ? elem[ 0 ] : elem
  11234. );
  11235. },
  11236. add: function( selector, context ) {
  11237. return this.pushStack(
  11238. jQuery.uniqueSort(
  11239. jQuery.merge( this.get(), jQuery( selector, context ) )
  11240. )
  11241. );
  11242. },
  11243. addBack: function( selector ) {
  11244. return this.add( selector == null ?
  11245. this.prevObject : this.prevObject.filter( selector )
  11246. );
  11247. }
  11248. } );
  11249. function sibling( cur, dir ) {
  11250. while ( ( cur = cur[ dir ] ) && cur.nodeType !== 1 ) {}
  11251. return cur;
  11252. }
  11253. jQuery.each( {
  11254. parent: function( elem ) {
  11255. var parent = elem.parentNode;
  11256. return parent && parent.nodeType !== 11 ? parent : null;
  11257. },
  11258. parents: function( elem ) {
  11259. return dir( elem, "parentNode" );
  11260. },
  11261. parentsUntil: function( elem, i, until ) {
  11262. return dir( elem, "parentNode", until );
  11263. },
  11264. next: function( elem ) {
  11265. return sibling( elem, "nextSibling" );
  11266. },
  11267. prev: function( elem ) {
  11268. return sibling( elem, "previousSibling" );
  11269. },
  11270. nextAll: function( elem ) {
  11271. return dir( elem, "nextSibling" );
  11272. },
  11273. prevAll: function( elem ) {
  11274. return dir( elem, "previousSibling" );
  11275. },
  11276. nextUntil: function( elem, i, until ) {
  11277. return dir( elem, "nextSibling", until );
  11278. },
  11279. prevUntil: function( elem, i, until ) {
  11280. return dir( elem, "previousSibling", until );
  11281. },
  11282. siblings: function( elem ) {
  11283. return siblings( ( elem.parentNode || {} ).firstChild, elem );
  11284. },
  11285. children: function( elem ) {
  11286. return siblings( elem.firstChild );
  11287. },
  11288. contents: function( elem ) {
  11289. if ( typeof elem.contentDocument !== "undefined" ) {
  11290. return elem.contentDocument;
  11291. }
  11292. // Support: IE 9 - 11 only, iOS 7 only, Android Browser <=4.3 only
  11293. // Treat the template element as a regular one in browsers that
  11294. // don't support it.
  11295. if ( nodeName( elem, "template" ) ) {
  11296. elem = elem.content || elem;
  11297. }
  11298. return jQuery.merge( [], elem.childNodes );
  11299. }
  11300. }, function( name, fn ) {
  11301. jQuery.fn[ name ] = function( until, selector ) {
  11302. var matched = jQuery.map( this, fn, until );
  11303. if ( name.slice( -5 ) !== "Until" ) {
  11304. selector = until;
  11305. }
  11306. if ( selector && typeof selector === "string" ) {
  11307. matched = jQuery.filter( selector, matched );
  11308. }
  11309. if ( this.length > 1 ) {
  11310. // Remove duplicates
  11311. if ( !guaranteedUnique[ name ] ) {
  11312. jQuery.uniqueSort( matched );
  11313. }
  11314. // Reverse order for parents* and prev-derivatives
  11315. if ( rparentsprev.test( name ) ) {
  11316. matched.reverse();
  11317. }
  11318. }
  11319. return this.pushStack( matched );
  11320. };
  11321. } );
  11322. var rnothtmlwhite = ( /[^\x20\t\r\n\f]+/g );
  11323. // Convert String-formatted options into Object-formatted ones
  11324. function createOptions( options ) {
  11325. var object = {};
  11326. jQuery.each( options.match( rnothtmlwhite ) || [], function( _, flag ) {
  11327. object[ flag ] = true;
  11328. } );
  11329. return object;
  11330. }
  11331. /*
  11332. * Create a callback list using the following parameters:
  11333. *
  11334. * options: an optional list of space-separated options that will change how
  11335. * the callback list behaves or a more traditional option object
  11336. *
  11337. * By default a callback list will act like an event callback list and can be
  11338. * "fired" multiple times.
  11339. *
  11340. * Possible options:
  11341. *
  11342. * once: will ensure the callback list can only be fired once (like a Deferred)
  11343. *
  11344. * memory: will keep track of previous values and will call any callback added
  11345. * after the list has been fired right away with the latest "memorized"
  11346. * values (like a Deferred)
  11347. *
  11348. * unique: will ensure a callback can only be added once (no duplicate in the list)
  11349. *
  11350. * stopOnFalse: interrupt callings when a callback returns false
  11351. *
  11352. */
  11353. jQuery.Callbacks = function( options ) {
  11354. // Convert options from String-formatted to Object-formatted if needed
  11355. // (we check in cache first)
  11356. options = typeof options === "string" ?
  11357. createOptions( options ) :
  11358. jQuery.extend( {}, options );
  11359. var // Flag to know if list is currently firing
  11360. firing,
  11361. // Last fire value for non-forgettable lists
  11362. memory,
  11363. // Flag to know if list was already fired
  11364. fired,
  11365. // Flag to prevent firing
  11366. locked,
  11367. // Actual callback list
  11368. list = [],
  11369. // Queue of execution data for repeatable lists
  11370. queue = [],
  11371. // Index of currently firing callback (modified by add/remove as needed)
  11372. firingIndex = -1,
  11373. // Fire callbacks
  11374. fire = function() {
  11375. // Enforce single-firing
  11376. locked = locked || options.once;
  11377. // Execute callbacks for all pending executions,
  11378. // respecting firingIndex overrides and runtime changes
  11379. fired = firing = true;
  11380. for ( ; queue.length; firingIndex = -1 ) {
  11381. memory = queue.shift();
  11382. while ( ++firingIndex < list.length ) {
  11383. // Run callback and check for early termination
  11384. if ( list[ firingIndex ].apply( memory[ 0 ], memory[ 1 ] ) === false &&
  11385. options.stopOnFalse ) {
  11386. // Jump to end and forget the data so .add doesn't re-fire
  11387. firingIndex = list.length;
  11388. memory = false;
  11389. }
  11390. }
  11391. }
  11392. // Forget the data if we're done with it
  11393. if ( !options.memory ) {
  11394. memory = false;
  11395. }
  11396. firing = false;
  11397. // Clean up if we're done firing for good
  11398. if ( locked ) {
  11399. // Keep an empty list if we have data for future add calls
  11400. if ( memory ) {
  11401. list = [];
  11402. // Otherwise, this object is spent
  11403. } else {
  11404. list = "";
  11405. }
  11406. }
  11407. },
  11408. // Actual Callbacks object
  11409. self = {
  11410. // Add a callback or a collection of callbacks to the list
  11411. add: function() {
  11412. if ( list ) {
  11413. // If we have memory from a past run, we should fire after adding
  11414. if ( memory && !firing ) {
  11415. firingIndex = list.length - 1;
  11416. queue.push( memory );
  11417. }
  11418. ( function add( args ) {
  11419. jQuery.each( args, function( _, arg ) {
  11420. if ( isFunction( arg ) ) {
  11421. if ( !options.unique || !self.has( arg ) ) {
  11422. list.push( arg );
  11423. }
  11424. } else if ( arg && arg.length && toType( arg ) !== "string" ) {
  11425. // Inspect recursively
  11426. add( arg );
  11427. }
  11428. } );
  11429. } )( arguments );
  11430. if ( memory && !firing ) {
  11431. fire();
  11432. }
  11433. }
  11434. return this;
  11435. },
  11436. // Remove a callback from the list
  11437. remove: function() {
  11438. jQuery.each( arguments, function( _, arg ) {
  11439. var index;
  11440. while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) {
  11441. list.splice( index, 1 );
  11442. // Handle firing indexes
  11443. if ( index <= firingIndex ) {
  11444. firingIndex--;
  11445. }
  11446. }
  11447. } );
  11448. return this;
  11449. },
  11450. // Check if a given callback is in the list.
  11451. // If no argument is given, return whether or not list has callbacks attached.
  11452. has: function( fn ) {
  11453. return fn ?
  11454. jQuery.inArray( fn, list ) > -1 :
  11455. list.length > 0;
  11456. },
  11457. // Remove all callbacks from the list
  11458. empty: function() {
  11459. if ( list ) {
  11460. list = [];
  11461. }
  11462. return this;
  11463. },
  11464. // Disable .fire and .add
  11465. // Abort any current/pending executions
  11466. // Clear all callbacks and values
  11467. disable: function() {
  11468. locked = queue = [];
  11469. list = memory = "";
  11470. return this;
  11471. },
  11472. disabled: function() {
  11473. return !list;
  11474. },
  11475. // Disable .fire
  11476. // Also disable .add unless we have memory (since it would have no effect)
  11477. // Abort any pending executions
  11478. lock: function() {
  11479. locked = queue = [];
  11480. if ( !memory && !firing ) {
  11481. list = memory = "";
  11482. }
  11483. return this;
  11484. },
  11485. locked: function() {
  11486. return !!locked;
  11487. },
  11488. // Call all callbacks with the given context and arguments
  11489. fireWith: function( context, args ) {
  11490. if ( !locked ) {
  11491. args = args || [];
  11492. args = [ context, args.slice ? args.slice() : args ];
  11493. queue.push( args );
  11494. if ( !firing ) {
  11495. fire();
  11496. }
  11497. }
  11498. return this;
  11499. },
  11500. // Call all the callbacks with the given arguments
  11501. fire: function() {
  11502. self.fireWith( this, arguments );
  11503. return this;
  11504. },
  11505. // To know if the callbacks have already been called at least once
  11506. fired: function() {
  11507. return !!fired;
  11508. }
  11509. };
  11510. return self;
  11511. };
  11512. function Identity( v ) {
  11513. return v;
  11514. }
  11515. function Thrower( ex ) {
  11516. throw ex;
  11517. }
  11518. function adoptValue( value, resolve, reject, noValue ) {
  11519. var method;
  11520. try {
  11521. // Check for promise aspect first to privilege synchronous behavior
  11522. if ( value && isFunction( ( method = value.promise ) ) ) {
  11523. method.call( value ).done( resolve ).fail( reject );
  11524. // Other thenables
  11525. } else if ( value && isFunction( ( method = value.then ) ) ) {
  11526. method.call( value, resolve, reject );
  11527. // Other non-thenables
  11528. } else {
  11529. // Control `resolve` arguments by letting Array#slice cast boolean `noValue` to integer:
  11530. // * false: [ value ].slice( 0 ) => resolve( value )
  11531. // * true: [ value ].slice( 1 ) => resolve()
  11532. resolve.apply( undefined, [ value ].slice( noValue ) );
  11533. }
  11534. // For Promises/A+, convert exceptions into rejections
  11535. // Since jQuery.when doesn't unwrap thenables, we can skip the extra checks appearing in
  11536. // Deferred#then to conditionally suppress rejection.
  11537. } catch ( value ) {
  11538. // Support: Android 4.0 only
  11539. // Strict mode functions invoked without .call/.apply get global-object context
  11540. reject.apply( undefined, [ value ] );
  11541. }
  11542. }
  11543. jQuery.extend( {
  11544. Deferred: function( func ) {
  11545. var tuples = [
  11546. // action, add listener, callbacks,
  11547. // ... .then handlers, argument index, [final state]
  11548. [ "notify", "progress", jQuery.Callbacks( "memory" ),
  11549. jQuery.Callbacks( "memory" ), 2 ],
  11550. [ "resolve", "done", jQuery.Callbacks( "once memory" ),
  11551. jQuery.Callbacks( "once memory" ), 0, "resolved" ],
  11552. [ "reject", "fail", jQuery.Callbacks( "once memory" ),
  11553. jQuery.Callbacks( "once memory" ), 1, "rejected" ]
  11554. ],
  11555. state = "pending",
  11556. promise = {
  11557. state: function() {
  11558. return state;
  11559. },
  11560. always: function() {
  11561. deferred.done( arguments ).fail( arguments );
  11562. return this;
  11563. },
  11564. "catch": function( fn ) {
  11565. return promise.then( null, fn );
  11566. },
  11567. // Keep pipe for back-compat
  11568. pipe: function( /* fnDone, fnFail, fnProgress */ ) {
  11569. var fns = arguments;
  11570. return jQuery.Deferred( function( newDefer ) {
  11571. jQuery.each( tuples, function( i, tuple ) {
  11572. // Map tuples (progress, done, fail) to arguments (done, fail, progress)
  11573. var fn = isFunction( fns[ tuple[ 4 ] ] ) && fns[ tuple[ 4 ] ];
  11574. // deferred.progress(function() { bind to newDefer or newDefer.notify })
  11575. // deferred.done(function() { bind to newDefer or newDefer.resolve })
  11576. // deferred.fail(function() { bind to newDefer or newDefer.reject })
  11577. deferred[ tuple[ 1 ] ]( function() {
  11578. var returned = fn && fn.apply( this, arguments );
  11579. if ( returned && isFunction( returned.promise ) ) {
  11580. returned.promise()
  11581. .progress( newDefer.notify )
  11582. .done( newDefer.resolve )
  11583. .fail( newDefer.reject );
  11584. } else {
  11585. newDefer[ tuple[ 0 ] + "With" ](
  11586. this,
  11587. fn ? [ returned ] : arguments
  11588. );
  11589. }
  11590. } );
  11591. } );
  11592. fns = null;
  11593. } ).promise();
  11594. },
  11595. then: function( onFulfilled, onRejected, onProgress ) {
  11596. var maxDepth = 0;
  11597. function resolve( depth, deferred, handler, special ) {
  11598. return function() {
  11599. var that = this,
  11600. args = arguments,
  11601. mightThrow = function() {
  11602. var returned, then;
  11603. // Support: Promises/A+ section 2.3.3.3.3
  11604. // https://promisesaplus.com/#point-59
  11605. // Ignore double-resolution attempts
  11606. if ( depth < maxDepth ) {
  11607. return;
  11608. }
  11609. returned = handler.apply( that, args );
  11610. // Support: Promises/A+ section 2.3.1
  11611. // https://promisesaplus.com/#point-48
  11612. if ( returned === deferred.promise() ) {
  11613. throw new TypeError( "Thenable self-resolution" );
  11614. }
  11615. // Support: Promises/A+ sections 2.3.3.1, 3.5
  11616. // https://promisesaplus.com/#point-54
  11617. // https://promisesaplus.com/#point-75
  11618. // Retrieve `then` only once
  11619. then = returned &&
  11620. // Support: Promises/A+ section 2.3.4
  11621. // https://promisesaplus.com/#point-64
  11622. // Only check objects and functions for thenability
  11623. ( typeof returned === "object" ||
  11624. typeof returned === "function" ) &&
  11625. returned.then;
  11626. // Handle a returned thenable
  11627. if ( isFunction( then ) ) {
  11628. // Special processors (notify) just wait for resolution
  11629. if ( special ) {
  11630. then.call(
  11631. returned,
  11632. resolve( maxDepth, deferred, Identity, special ),
  11633. resolve( maxDepth, deferred, Thrower, special )
  11634. );
  11635. // Normal processors (resolve) also hook into progress
  11636. } else {
  11637. // ...and disregard older resolution values
  11638. maxDepth++;
  11639. then.call(
  11640. returned,
  11641. resolve( maxDepth, deferred, Identity, special ),
  11642. resolve( maxDepth, deferred, Thrower, special ),
  11643. resolve( maxDepth, deferred, Identity,
  11644. deferred.notifyWith )
  11645. );
  11646. }
  11647. // Handle all other returned values
  11648. } else {
  11649. // Only substitute handlers pass on context
  11650. // and multiple values (non-spec behavior)
  11651. if ( handler !== Identity ) {
  11652. that = undefined;
  11653. args = [ returned ];
  11654. }
  11655. // Process the value(s)
  11656. // Default process is resolve
  11657. ( special || deferred.resolveWith )( that, args );
  11658. }
  11659. },
  11660. // Only normal processors (resolve) catch and reject exceptions
  11661. process = special ?
  11662. mightThrow :
  11663. function() {
  11664. try {
  11665. mightThrow();
  11666. } catch ( e ) {
  11667. if ( jQuery.Deferred.exceptionHook ) {
  11668. jQuery.Deferred.exceptionHook( e,
  11669. process.stackTrace );
  11670. }
  11671. // Support: Promises/A+ section 2.3.3.3.4.1
  11672. // https://promisesaplus.com/#point-61
  11673. // Ignore post-resolution exceptions
  11674. if ( depth + 1 >= maxDepth ) {
  11675. // Only substitute handlers pass on context
  11676. // and multiple values (non-spec behavior)
  11677. if ( handler !== Thrower ) {
  11678. that = undefined;
  11679. args = [ e ];
  11680. }
  11681. deferred.rejectWith( that, args );
  11682. }
  11683. }
  11684. };
  11685. // Support: Promises/A+ section 2.3.3.3.1
  11686. // https://promisesaplus.com/#point-57
  11687. // Re-resolve promises immediately to dodge false rejection from
  11688. // subsequent errors
  11689. if ( depth ) {
  11690. process();
  11691. } else {
  11692. // Call an optional hook to record the stack, in case of exception
  11693. // since it's otherwise lost when execution goes async
  11694. if ( jQuery.Deferred.getStackHook ) {
  11695. process.stackTrace = jQuery.Deferred.getStackHook();
  11696. }
  11697. window.setTimeout( process );
  11698. }
  11699. };
  11700. }
  11701. return jQuery.Deferred( function( newDefer ) {
  11702. // progress_handlers.add( ... )
  11703. tuples[ 0 ][ 3 ].add(
  11704. resolve(
  11705. 0,
  11706. newDefer,
  11707. isFunction( onProgress ) ?
  11708. onProgress :
  11709. Identity,
  11710. newDefer.notifyWith
  11711. )
  11712. );
  11713. // fulfilled_handlers.add( ... )
  11714. tuples[ 1 ][ 3 ].add(
  11715. resolve(
  11716. 0,
  11717. newDefer,
  11718. isFunction( onFulfilled ) ?
  11719. onFulfilled :
  11720. Identity
  11721. )
  11722. );
  11723. // rejected_handlers.add( ... )
  11724. tuples[ 2 ][ 3 ].add(
  11725. resolve(
  11726. 0,
  11727. newDefer,
  11728. isFunction( onRejected ) ?
  11729. onRejected :
  11730. Thrower
  11731. )
  11732. );
  11733. } ).promise();
  11734. },
  11735. // Get a promise for this deferred
  11736. // If obj is provided, the promise aspect is added to the object
  11737. promise: function( obj ) {
  11738. return obj != null ? jQuery.extend( obj, promise ) : promise;
  11739. }
  11740. },
  11741. deferred = {};
  11742. // Add list-specific methods
  11743. jQuery.each( tuples, function( i, tuple ) {
  11744. var list = tuple[ 2 ],
  11745. stateString = tuple[ 5 ];
  11746. // promise.progress = list.add
  11747. // promise.done = list.add
  11748. // promise.fail = list.add
  11749. promise[ tuple[ 1 ] ] = list.add;
  11750. // Handle state
  11751. if ( stateString ) {
  11752. list.add(
  11753. function() {
  11754. // state = "resolved" (i.e., fulfilled)
  11755. // state = "rejected"
  11756. state = stateString;
  11757. },
  11758. // rejected_callbacks.disable
  11759. // fulfilled_callbacks.disable
  11760. tuples[ 3 - i ][ 2 ].disable,
  11761. // rejected_handlers.disable
  11762. // fulfilled_handlers.disable
  11763. tuples[ 3 - i ][ 3 ].disable,
  11764. // progress_callbacks.lock
  11765. tuples[ 0 ][ 2 ].lock,
  11766. // progress_handlers.lock
  11767. tuples[ 0 ][ 3 ].lock
  11768. );
  11769. }
  11770. // progress_handlers.fire
  11771. // fulfilled_handlers.fire
  11772. // rejected_handlers.fire
  11773. list.add( tuple[ 3 ].fire );
  11774. // deferred.notify = function() { deferred.notifyWith(...) }
  11775. // deferred.resolve = function() { deferred.resolveWith(...) }
  11776. // deferred.reject = function() { deferred.rejectWith(...) }
  11777. deferred[ tuple[ 0 ] ] = function() {
  11778. deferred[ tuple[ 0 ] + "With" ]( this === deferred ? undefined : this, arguments );
  11779. return this;
  11780. };
  11781. // deferred.notifyWith = list.fireWith
  11782. // deferred.resolveWith = list.fireWith
  11783. // deferred.rejectWith = list.fireWith
  11784. deferred[ tuple[ 0 ] + "With" ] = list.fireWith;
  11785. } );
  11786. // Make the deferred a promise
  11787. promise.promise( deferred );
  11788. // Call given func if any
  11789. if ( func ) {
  11790. func.call( deferred, deferred );
  11791. }
  11792. // All done!
  11793. return deferred;
  11794. },
  11795. // Deferred helper
  11796. when: function( singleValue ) {
  11797. var
  11798. // count of uncompleted subordinates
  11799. remaining = arguments.length,
  11800. // count of unprocessed arguments
  11801. i = remaining,
  11802. // subordinate fulfillment data
  11803. resolveContexts = Array( i ),
  11804. resolveValues = slice.call( arguments ),
  11805. // the master Deferred
  11806. master = jQuery.Deferred(),
  11807. // subordinate callback factory
  11808. updateFunc = function( i ) {
  11809. return function( value ) {
  11810. resolveContexts[ i ] = this;
  11811. resolveValues[ i ] = arguments.length > 1 ? slice.call( arguments ) : value;
  11812. if ( !( --remaining ) ) {
  11813. master.resolveWith( resolveContexts, resolveValues );
  11814. }
  11815. };
  11816. };
  11817. // Single- and empty arguments are adopted like Promise.resolve
  11818. if ( remaining <= 1 ) {
  11819. adoptValue( singleValue, master.done( updateFunc( i ) ).resolve, master.reject,
  11820. !remaining );
  11821. // Use .then() to unwrap secondary thenables (cf. gh-3000)
  11822. if ( master.state() === "pending" ||
  11823. isFunction( resolveValues[ i ] && resolveValues[ i ].then ) ) {
  11824. return master.then();
  11825. }
  11826. }
  11827. // Multiple arguments are aggregated like Promise.all array elements
  11828. while ( i-- ) {
  11829. adoptValue( resolveValues[ i ], updateFunc( i ), master.reject );
  11830. }
  11831. return master.promise();
  11832. }
  11833. } );
  11834. // These usually indicate a programmer mistake during development,
  11835. // warn about them ASAP rather than swallowing them by default.
  11836. var rerrorNames = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;
  11837. jQuery.Deferred.exceptionHook = function( error, stack ) {
  11838. // Support: IE 8 - 9 only
  11839. // Console exists when dev tools are open, which can happen at any time
  11840. if ( window.console && window.console.warn && error && rerrorNames.test( error.name ) ) {
  11841. window.console.warn( "jQuery.Deferred exception: " + error.message, error.stack, stack );
  11842. }
  11843. };
  11844. jQuery.readyException = function( error ) {
  11845. window.setTimeout( function() {
  11846. throw error;
  11847. } );
  11848. };
  11849. // The deferred used on DOM ready
  11850. var readyList = jQuery.Deferred();
  11851. jQuery.fn.ready = function( fn ) {
  11852. readyList
  11853. .then( fn )
  11854. // Wrap jQuery.readyException in a function so that the lookup
  11855. // happens at the time of error handling instead of callback
  11856. // registration.
  11857. .catch( function( error ) {
  11858. jQuery.readyException( error );
  11859. } );
  11860. return this;
  11861. };
  11862. jQuery.extend( {
  11863. // Is the DOM ready to be used? Set to true once it occurs.
  11864. isReady: false,
  11865. // A counter to track how many items to wait for before
  11866. // the ready event fires. See #6781
  11867. readyWait: 1,
  11868. // Handle when the DOM is ready
  11869. ready: function( wait ) {
  11870. // Abort if there are pending holds or we're already ready
  11871. if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) {
  11872. return;
  11873. }
  11874. // Remember that the DOM is ready
  11875. jQuery.isReady = true;
  11876. // If a normal DOM Ready event fired, decrement, and wait if need be
  11877. if ( wait !== true && --jQuery.readyWait > 0 ) {
  11878. return;
  11879. }
  11880. // If there are functions bound, to execute
  11881. readyList.resolveWith( document, [ jQuery ] );
  11882. }
  11883. } );
  11884. jQuery.ready.then = readyList.then;
  11885. // The ready event handler and self cleanup method
  11886. function completed() {
  11887. document.removeEventListener( "DOMContentLoaded", completed );
  11888. window.removeEventListener( "load", completed );
  11889. jQuery.ready();
  11890. }
  11891. // Catch cases where $(document).ready() is called
  11892. // after the browser event has already occurred.
  11893. // Support: IE <=9 - 10 only
  11894. // Older IE sometimes signals "interactive" too soon
  11895. if ( document.readyState === "complete" ||
  11896. ( document.readyState !== "loading" && !document.documentElement.doScroll ) ) {
  11897. // Handle it asynchronously to allow scripts the opportunity to delay ready
  11898. window.setTimeout( jQuery.ready );
  11899. } else {
  11900. // Use the handy event callback
  11901. document.addEventListener( "DOMContentLoaded", completed );
  11902. // A fallback to window.onload, that will always work
  11903. window.addEventListener( "load", completed );
  11904. }
  11905. // Multifunctional method to get and set values of a collection
  11906. // The value/s can optionally be executed if it's a function
  11907. var access = function( elems, fn, key, value, chainable, emptyGet, raw ) {
  11908. var i = 0,
  11909. len = elems.length,
  11910. bulk = key == null;
  11911. // Sets many values
  11912. if ( toType( key ) === "object" ) {
  11913. chainable = true;
  11914. for ( i in key ) {
  11915. access( elems, fn, i, key[ i ], true, emptyGet, raw );
  11916. }
  11917. // Sets one value
  11918. } else if ( value !== undefined ) {
  11919. chainable = true;
  11920. if ( !isFunction( value ) ) {
  11921. raw = true;
  11922. }
  11923. if ( bulk ) {
  11924. // Bulk operations run against the entire set
  11925. if ( raw ) {
  11926. fn.call( elems, value );
  11927. fn = null;
  11928. // ...except when executing function values
  11929. } else {
  11930. bulk = fn;
  11931. fn = function( elem, key, value ) {
  11932. return bulk.call( jQuery( elem ), value );
  11933. };
  11934. }
  11935. }
  11936. if ( fn ) {
  11937. for ( ; i < len; i++ ) {
  11938. fn(
  11939. elems[ i ], key, raw ?
  11940. value :
  11941. value.call( elems[ i ], i, fn( elems[ i ], key ) )
  11942. );
  11943. }
  11944. }
  11945. }
  11946. if ( chainable ) {
  11947. return elems;
  11948. }
  11949. // Gets
  11950. if ( bulk ) {
  11951. return fn.call( elems );
  11952. }
  11953. return len ? fn( elems[ 0 ], key ) : emptyGet;
  11954. };
  11955. // Matches dashed string for camelizing
  11956. var rmsPrefix = /^-ms-/,
  11957. rdashAlpha = /-([a-z])/g;
  11958. // Used by camelCase as callback to replace()
  11959. function fcamelCase( all, letter ) {
  11960. return letter.toUpperCase();
  11961. }
  11962. // Convert dashed to camelCase; used by the css and data modules
  11963. // Support: IE <=9 - 11, Edge 12 - 15
  11964. // Microsoft forgot to hump their vendor prefix (#9572)
  11965. function camelCase( string ) {
  11966. return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
  11967. }
  11968. var acceptData = function( owner ) {
  11969. // Accepts only:
  11970. // - Node
  11971. // - Node.ELEMENT_NODE
  11972. // - Node.DOCUMENT_NODE
  11973. // - Object
  11974. // - Any
  11975. return owner.nodeType === 1 || owner.nodeType === 9 || !( +owner.nodeType );
  11976. };
  11977. function Data() {
  11978. this.expando = jQuery.expando + Data.uid++;
  11979. }
  11980. Data.uid = 1;
  11981. Data.prototype = {
  11982. cache: function( owner ) {
  11983. // Check if the owner object already has a cache
  11984. var value = owner[ this.expando ];
  11985. // If not, create one
  11986. if ( !value ) {
  11987. value = {};
  11988. // We can accept data for non-element nodes in modern browsers,
  11989. // but we should not, see #8335.
  11990. // Always return an empty object.
  11991. if ( acceptData( owner ) ) {
  11992. // If it is a node unlikely to be stringify-ed or looped over
  11993. // use plain assignment
  11994. if ( owner.nodeType ) {
  11995. owner[ this.expando ] = value;
  11996. // Otherwise secure it in a non-enumerable property
  11997. // configurable must be true to allow the property to be
  11998. // deleted when data is removed
  11999. } else {
  12000. Object.defineProperty( owner, this.expando, {
  12001. value: value,
  12002. configurable: true
  12003. } );
  12004. }
  12005. }
  12006. }
  12007. return value;
  12008. },
  12009. set: function( owner, data, value ) {
  12010. var prop,
  12011. cache = this.cache( owner );
  12012. // Handle: [ owner, key, value ] args
  12013. // Always use camelCase key (gh-2257)
  12014. if ( typeof data === "string" ) {
  12015. cache[ camelCase( data ) ] = value;
  12016. // Handle: [ owner, { properties } ] args
  12017. } else {
  12018. // Copy the properties one-by-one to the cache object
  12019. for ( prop in data ) {
  12020. cache[ camelCase( prop ) ] = data[ prop ];
  12021. }
  12022. }
  12023. return cache;
  12024. },
  12025. get: function( owner, key ) {
  12026. return key === undefined ?
  12027. this.cache( owner ) :
  12028. // Always use camelCase key (gh-2257)
  12029. owner[ this.expando ] && owner[ this.expando ][ camelCase( key ) ];
  12030. },
  12031. access: function( owner, key, value ) {
  12032. // In cases where either:
  12033. //
  12034. // 1. No key was specified
  12035. // 2. A string key was specified, but no value provided
  12036. //
  12037. // Take the "read" path and allow the get method to determine
  12038. // which value to return, respectively either:
  12039. //
  12040. // 1. The entire cache object
  12041. // 2. The data stored at the key
  12042. //
  12043. if ( key === undefined ||
  12044. ( ( key && typeof key === "string" ) && value === undefined ) ) {
  12045. return this.get( owner, key );
  12046. }
  12047. // When the key is not a string, or both a key and value
  12048. // are specified, set or extend (existing objects) with either:
  12049. //
  12050. // 1. An object of properties
  12051. // 2. A key and value
  12052. //
  12053. this.set( owner, key, value );
  12054. // Since the "set" path can have two possible entry points
  12055. // return the expected data based on which path was taken[*]
  12056. return value !== undefined ? value : key;
  12057. },
  12058. remove: function( owner, key ) {
  12059. var i,
  12060. cache = owner[ this.expando ];
  12061. if ( cache === undefined ) {
  12062. return;
  12063. }
  12064. if ( key !== undefined ) {
  12065. // Support array or space separated string of keys
  12066. if ( Array.isArray( key ) ) {
  12067. // If key is an array of keys...
  12068. // We always set camelCase keys, so remove that.
  12069. key = key.map( camelCase );
  12070. } else {
  12071. key = camelCase( key );
  12072. // If a key with the spaces exists, use it.
  12073. // Otherwise, create an array by matching non-whitespace
  12074. key = key in cache ?
  12075. [ key ] :
  12076. ( key.match( rnothtmlwhite ) || [] );
  12077. }
  12078. i = key.length;
  12079. while ( i-- ) {
  12080. delete cache[ key[ i ] ];
  12081. }
  12082. }
  12083. // Remove the expando if there's no more data
  12084. if ( key === undefined || jQuery.isEmptyObject( cache ) ) {
  12085. // Support: Chrome <=35 - 45
  12086. // Webkit & Blink performance suffers when deleting properties
  12087. // from DOM nodes, so set to undefined instead
  12088. // https://bugs.chromium.org/p/chromium/issues/detail?id=378607 (bug restricted)
  12089. if ( owner.nodeType ) {
  12090. owner[ this.expando ] = undefined;
  12091. } else {
  12092. delete owner[ this.expando ];
  12093. }
  12094. }
  12095. },
  12096. hasData: function( owner ) {
  12097. var cache = owner[ this.expando ];
  12098. return cache !== undefined && !jQuery.isEmptyObject( cache );
  12099. }
  12100. };
  12101. var dataPriv = new Data();
  12102. var dataUser = new Data();
  12103. // Implementation Summary
  12104. //
  12105. // 1. Enforce API surface and semantic compatibility with 1.9.x branch
  12106. // 2. Improve the module's maintainability by reducing the storage
  12107. // paths to a single mechanism.
  12108. // 3. Use the same single mechanism to support "private" and "user" data.
  12109. // 4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData)
  12110. // 5. Avoid exposing implementation details on user objects (eg. expando properties)
  12111. // 6. Provide a clear path for implementation upgrade to WeakMap in 2014
  12112. var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,
  12113. rmultiDash = /[A-Z]/g;
  12114. function getData( data ) {
  12115. if ( data === "true" ) {
  12116. return true;
  12117. }
  12118. if ( data === "false" ) {
  12119. return false;
  12120. }
  12121. if ( data === "null" ) {
  12122. return null;
  12123. }
  12124. // Only convert to a number if it doesn't change the string
  12125. if ( data === +data + "" ) {
  12126. return +data;
  12127. }
  12128. if ( rbrace.test( data ) ) {
  12129. return JSON.parse( data );
  12130. }
  12131. return data;
  12132. }
  12133. function dataAttr( elem, key, data ) {
  12134. var name;
  12135. // If nothing was found internally, try to fetch any
  12136. // data from the HTML5 data-* attribute
  12137. if ( data === undefined && elem.nodeType === 1 ) {
  12138. name = "data-" + key.replace( rmultiDash, "-$&" ).toLowerCase();
  12139. data = elem.getAttribute( name );
  12140. if ( typeof data === "string" ) {
  12141. try {
  12142. data = getData( data );
  12143. } catch ( e ) {}
  12144. // Make sure we set the data so it isn't changed later
  12145. dataUser.set( elem, key, data );
  12146. } else {
  12147. data = undefined;
  12148. }
  12149. }
  12150. return data;
  12151. }
  12152. jQuery.extend( {
  12153. hasData: function( elem ) {
  12154. return dataUser.hasData( elem ) || dataPriv.hasData( elem );
  12155. },
  12156. data: function( elem, name, data ) {
  12157. return dataUser.access( elem, name, data );
  12158. },
  12159. removeData: function( elem, name ) {
  12160. dataUser.remove( elem, name );
  12161. },
  12162. // TODO: Now that all calls to _data and _removeData have been replaced
  12163. // with direct calls to dataPriv methods, these can be deprecated.
  12164. _data: function( elem, name, data ) {
  12165. return dataPriv.access( elem, name, data );
  12166. },
  12167. _removeData: function( elem, name ) {
  12168. dataPriv.remove( elem, name );
  12169. }
  12170. } );
  12171. jQuery.fn.extend( {
  12172. data: function( key, value ) {
  12173. var i, name, data,
  12174. elem = this[ 0 ],
  12175. attrs = elem && elem.attributes;
  12176. // Gets all values
  12177. if ( key === undefined ) {
  12178. if ( this.length ) {
  12179. data = dataUser.get( elem );
  12180. if ( elem.nodeType === 1 && !dataPriv.get( elem, "hasDataAttrs" ) ) {
  12181. i = attrs.length;
  12182. while ( i-- ) {
  12183. // Support: IE 11 only
  12184. // The attrs elements can be null (#14894)
  12185. if ( attrs[ i ] ) {
  12186. name = attrs[ i ].name;
  12187. if ( name.indexOf( "data-" ) === 0 ) {
  12188. name = camelCase( name.slice( 5 ) );
  12189. dataAttr( elem, name, data[ name ] );
  12190. }
  12191. }
  12192. }
  12193. dataPriv.set( elem, "hasDataAttrs", true );
  12194. }
  12195. }
  12196. return data;
  12197. }
  12198. // Sets multiple values
  12199. if ( typeof key === "object" ) {
  12200. return this.each( function() {
  12201. dataUser.set( this, key );
  12202. } );
  12203. }
  12204. return access( this, function( value ) {
  12205. var data;
  12206. // The calling jQuery object (element matches) is not empty
  12207. // (and therefore has an element appears at this[ 0 ]) and the
  12208. // `value` parameter was not undefined. An empty jQuery object
  12209. // will result in `undefined` for elem = this[ 0 ] which will
  12210. // throw an exception if an attempt to read a data cache is made.
  12211. if ( elem && value === undefined ) {
  12212. // Attempt to get data from the cache
  12213. // The key will always be camelCased in Data
  12214. data = dataUser.get( elem, key );
  12215. if ( data !== undefined ) {
  12216. return data;
  12217. }
  12218. // Attempt to "discover" the data in
  12219. // HTML5 custom data-* attrs
  12220. data = dataAttr( elem, key );
  12221. if ( data !== undefined ) {
  12222. return data;
  12223. }
  12224. // We tried really hard, but the data doesn't exist.
  12225. return;
  12226. }
  12227. // Set the data...
  12228. this.each( function() {
  12229. // We always store the camelCased key
  12230. dataUser.set( this, key, value );
  12231. } );
  12232. }, null, value, arguments.length > 1, null, true );
  12233. },
  12234. removeData: function( key ) {
  12235. return this.each( function() {
  12236. dataUser.remove( this, key );
  12237. } );
  12238. }
  12239. } );
  12240. jQuery.extend( {
  12241. queue: function( elem, type, data ) {
  12242. var queue;
  12243. if ( elem ) {
  12244. type = ( type || "fx" ) + "queue";
  12245. queue = dataPriv.get( elem, type );
  12246. // Speed up dequeue by getting out quickly if this is just a lookup
  12247. if ( data ) {
  12248. if ( !queue || Array.isArray( data ) ) {
  12249. queue = dataPriv.access( elem, type, jQuery.makeArray( data ) );
  12250. } else {
  12251. queue.push( data );
  12252. }
  12253. }
  12254. return queue || [];
  12255. }
  12256. },
  12257. dequeue: function( elem, type ) {
  12258. type = type || "fx";
  12259. var queue = jQuery.queue( elem, type ),
  12260. startLength = queue.length,
  12261. fn = queue.shift(),
  12262. hooks = jQuery._queueHooks( elem, type ),
  12263. next = function() {
  12264. jQuery.dequeue( elem, type );
  12265. };
  12266. // If the fx queue is dequeued, always remove the progress sentinel
  12267. if ( fn === "inprogress" ) {
  12268. fn = queue.shift();
  12269. startLength--;
  12270. }
  12271. if ( fn ) {
  12272. // Add a progress sentinel to prevent the fx queue from being
  12273. // automatically dequeued
  12274. if ( type === "fx" ) {
  12275. queue.unshift( "inprogress" );
  12276. }
  12277. // Clear up the last queue stop function
  12278. delete hooks.stop;
  12279. fn.call( elem, next, hooks );
  12280. }
  12281. if ( !startLength && hooks ) {
  12282. hooks.empty.fire();
  12283. }
  12284. },
  12285. // Not public - generate a queueHooks object, or return the current one
  12286. _queueHooks: function( elem, type ) {
  12287. var key = type + "queueHooks";
  12288. return dataPriv.get( elem, key ) || dataPriv.access( elem, key, {
  12289. empty: jQuery.Callbacks( "once memory" ).add( function() {
  12290. dataPriv.remove( elem, [ type + "queue", key ] );
  12291. } )
  12292. } );
  12293. }
  12294. } );
  12295. jQuery.fn.extend( {
  12296. queue: function( type, data ) {
  12297. var setter = 2;
  12298. if ( typeof type !== "string" ) {
  12299. data = type;
  12300. type = "fx";
  12301. setter--;
  12302. }
  12303. if ( arguments.length < setter ) {
  12304. return jQuery.queue( this[ 0 ], type );
  12305. }
  12306. return data === undefined ?
  12307. this :
  12308. this.each( function() {
  12309. var queue = jQuery.queue( this, type, data );
  12310. // Ensure a hooks for this queue
  12311. jQuery._queueHooks( this, type );
  12312. if ( type === "fx" && queue[ 0 ] !== "inprogress" ) {
  12313. jQuery.dequeue( this, type );
  12314. }
  12315. } );
  12316. },
  12317. dequeue: function( type ) {
  12318. return this.each( function() {
  12319. jQuery.dequeue( this, type );
  12320. } );
  12321. },
  12322. clearQueue: function( type ) {
  12323. return this.queue( type || "fx", [] );
  12324. },
  12325. // Get a promise resolved when queues of a certain type
  12326. // are emptied (fx is the type by default)
  12327. promise: function( type, obj ) {
  12328. var tmp,
  12329. count = 1,
  12330. defer = jQuery.Deferred(),
  12331. elements = this,
  12332. i = this.length,
  12333. resolve = function() {
  12334. if ( !( --count ) ) {
  12335. defer.resolveWith( elements, [ elements ] );
  12336. }
  12337. };
  12338. if ( typeof type !== "string" ) {
  12339. obj = type;
  12340. type = undefined;
  12341. }
  12342. type = type || "fx";
  12343. while ( i-- ) {
  12344. tmp = dataPriv.get( elements[ i ], type + "queueHooks" );
  12345. if ( tmp && tmp.empty ) {
  12346. count++;
  12347. tmp.empty.add( resolve );
  12348. }
  12349. }
  12350. resolve();
  12351. return defer.promise( obj );
  12352. }
  12353. } );
  12354. var pnum = ( /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/ ).source;
  12355. var rcssNum = new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" );
  12356. var cssExpand = [ "Top", "Right", "Bottom", "Left" ];
  12357. var documentElement = document.documentElement;
  12358. var isAttached = function( elem ) {
  12359. return jQuery.contains( elem.ownerDocument, elem );
  12360. },
  12361. composed = { composed: true };
  12362. // Support: IE 9 - 11+, Edge 12 - 18+, iOS 10.0 - 10.2 only
  12363. // Check attachment across shadow DOM boundaries when possible (gh-3504)
  12364. // Support: iOS 10.0-10.2 only
  12365. // Early iOS 10 versions support `attachShadow` but not `getRootNode`,
  12366. // leading to errors. We need to check for `getRootNode`.
  12367. if ( documentElement.getRootNode ) {
  12368. isAttached = function( elem ) {
  12369. return jQuery.contains( elem.ownerDocument, elem ) ||
  12370. elem.getRootNode( composed ) === elem.ownerDocument;
  12371. };
  12372. }
  12373. var isHiddenWithinTree = function( elem, el ) {
  12374. // isHiddenWithinTree might be called from jQuery#filter function;
  12375. // in that case, element will be second argument
  12376. elem = el || elem;
  12377. // Inline style trumps all
  12378. return elem.style.display === "none" ||
  12379. elem.style.display === "" &&
  12380. // Otherwise, check computed style
  12381. // Support: Firefox <=43 - 45
  12382. // Disconnected elements can have computed display: none, so first confirm that elem is
  12383. // in the document.
  12384. isAttached( elem ) &&
  12385. jQuery.css( elem, "display" ) === "none";
  12386. };
  12387. var swap = function( elem, options, callback, args ) {
  12388. var ret, name,
  12389. old = {};
  12390. // Remember the old values, and insert the new ones
  12391. for ( name in options ) {
  12392. old[ name ] = elem.style[ name ];
  12393. elem.style[ name ] = options[ name ];
  12394. }
  12395. ret = callback.apply( elem, args || [] );
  12396. // Revert the old values
  12397. for ( name in options ) {
  12398. elem.style[ name ] = old[ name ];
  12399. }
  12400. return ret;
  12401. };
  12402. function adjustCSS( elem, prop, valueParts, tween ) {
  12403. var adjusted, scale,
  12404. maxIterations = 20,
  12405. currentValue = tween ?
  12406. function() {
  12407. return tween.cur();
  12408. } :
  12409. function() {
  12410. return jQuery.css( elem, prop, "" );
  12411. },
  12412. initial = currentValue(),
  12413. unit = valueParts && valueParts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ),
  12414. // Starting value computation is required for potential unit mismatches
  12415. initialInUnit = elem.nodeType &&
  12416. ( jQuery.cssNumber[ prop ] || unit !== "px" && +initial ) &&
  12417. rcssNum.exec( jQuery.css( elem, prop ) );
  12418. if ( initialInUnit && initialInUnit[ 3 ] !== unit ) {
  12419. // Support: Firefox <=54
  12420. // Halve the iteration target value to prevent interference from CSS upper bounds (gh-2144)
  12421. initial = initial / 2;
  12422. // Trust units reported by jQuery.css
  12423. unit = unit || initialInUnit[ 3 ];
  12424. // Iteratively approximate from a nonzero starting point
  12425. initialInUnit = +initial || 1;
  12426. while ( maxIterations-- ) {
  12427. // Evaluate and update our best guess (doubling guesses that zero out).
  12428. // Finish if the scale equals or crosses 1 (making the old*new product non-positive).
  12429. jQuery.style( elem, prop, initialInUnit + unit );
  12430. if ( ( 1 - scale ) * ( 1 - ( scale = currentValue() / initial || 0.5 ) ) <= 0 ) {
  12431. maxIterations = 0;
  12432. }
  12433. initialInUnit = initialInUnit / scale;
  12434. }
  12435. initialInUnit = initialInUnit * 2;
  12436. jQuery.style( elem, prop, initialInUnit + unit );
  12437. // Make sure we update the tween properties later on
  12438. valueParts = valueParts || [];
  12439. }
  12440. if ( valueParts ) {
  12441. initialInUnit = +initialInUnit || +initial || 0;
  12442. // Apply relative offset (+=/-=) if specified
  12443. adjusted = valueParts[ 1 ] ?
  12444. initialInUnit + ( valueParts[ 1 ] + 1 ) * valueParts[ 2 ] :
  12445. +valueParts[ 2 ];
  12446. if ( tween ) {
  12447. tween.unit = unit;
  12448. tween.start = initialInUnit;
  12449. tween.end = adjusted;
  12450. }
  12451. }
  12452. return adjusted;
  12453. }
  12454. var defaultDisplayMap = {};
  12455. function getDefaultDisplay( elem ) {
  12456. var temp,
  12457. doc = elem.ownerDocument,
  12458. nodeName = elem.nodeName,
  12459. display = defaultDisplayMap[ nodeName ];
  12460. if ( display ) {
  12461. return display;
  12462. }
  12463. temp = doc.body.appendChild( doc.createElement( nodeName ) );
  12464. display = jQuery.css( temp, "display" );
  12465. temp.parentNode.removeChild( temp );
  12466. if ( display === "none" ) {
  12467. display = "block";
  12468. }
  12469. defaultDisplayMap[ nodeName ] = display;
  12470. return display;
  12471. }
  12472. function showHide( elements, show ) {
  12473. var display, elem,
  12474. values = [],
  12475. index = 0,
  12476. length = elements.length;
  12477. // Determine new display value for elements that need to change
  12478. for ( ; index < length; index++ ) {
  12479. elem = elements[ index ];
  12480. if ( !elem.style ) {
  12481. continue;
  12482. }
  12483. display = elem.style.display;
  12484. if ( show ) {
  12485. // Since we force visibility upon cascade-hidden elements, an immediate (and slow)
  12486. // check is required in this first loop unless we have a nonempty display value (either
  12487. // inline or about-to-be-restored)
  12488. if ( display === "none" ) {
  12489. values[ index ] = dataPriv.get( elem, "display" ) || null;
  12490. if ( !values[ index ] ) {
  12491. elem.style.display = "";
  12492. }
  12493. }
  12494. if ( elem.style.display === "" && isHiddenWithinTree( elem ) ) {
  12495. values[ index ] = getDefaultDisplay( elem );
  12496. }
  12497. } else {
  12498. if ( display !== "none" ) {
  12499. values[ index ] = "none";
  12500. // Remember what we're overwriting
  12501. dataPriv.set( elem, "display", display );
  12502. }
  12503. }
  12504. }
  12505. // Set the display of the elements in a second loop to avoid constant reflow
  12506. for ( index = 0; index < length; index++ ) {
  12507. if ( values[ index ] != null ) {
  12508. elements[ index ].style.display = values[ index ];
  12509. }
  12510. }
  12511. return elements;
  12512. }
  12513. jQuery.fn.extend( {
  12514. show: function() {
  12515. return showHide( this, true );
  12516. },
  12517. hide: function() {
  12518. return showHide( this );
  12519. },
  12520. toggle: function( state ) {
  12521. if ( typeof state === "boolean" ) {
  12522. return state ? this.show() : this.hide();
  12523. }
  12524. return this.each( function() {
  12525. if ( isHiddenWithinTree( this ) ) {
  12526. jQuery( this ).show();
  12527. } else {
  12528. jQuery( this ).hide();
  12529. }
  12530. } );
  12531. }
  12532. } );
  12533. var rcheckableType = ( /^(?:checkbox|radio)$/i );
  12534. var rtagName = ( /<([a-z][^\/\0>\x20\t\r\n\f]*)/i );
  12535. var rscriptType = ( /^$|^module$|\/(?:java|ecma)script/i );
  12536. // We have to close these tags to support XHTML (#13200)
  12537. var wrapMap = {
  12538. // Support: IE <=9 only
  12539. option: [ 1, "<select multiple='multiple'>", "</select>" ],
  12540. // XHTML parsers do not magically insert elements in the
  12541. // same way that tag soup parsers do. So we cannot shorten
  12542. // this by omitting <tbody> or other required elements.
  12543. thead: [ 1, "<table>", "</table>" ],
  12544. col: [ 2, "<table><colgroup>", "</colgroup></table>" ],
  12545. tr: [ 2, "<table><tbody>", "</tbody></table>" ],
  12546. td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],
  12547. _default: [ 0, "", "" ]
  12548. };
  12549. // Support: IE <=9 only
  12550. wrapMap.optgroup = wrapMap.option;
  12551. wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
  12552. wrapMap.th = wrapMap.td;
  12553. function getAll( context, tag ) {
  12554. // Support: IE <=9 - 11 only
  12555. // Use typeof to avoid zero-argument method invocation on host objects (#15151)
  12556. var ret;
  12557. if ( typeof context.getElementsByTagName !== "undefined" ) {
  12558. ret = context.getElementsByTagName( tag || "*" );
  12559. } else if ( typeof context.querySelectorAll !== "undefined" ) {
  12560. ret = context.querySelectorAll( tag || "*" );
  12561. } else {
  12562. ret = [];
  12563. }
  12564. if ( tag === undefined || tag && nodeName( context, tag ) ) {
  12565. return jQuery.merge( [ context ], ret );
  12566. }
  12567. return ret;
  12568. }
  12569. // Mark scripts as having already been evaluated
  12570. function setGlobalEval( elems, refElements ) {
  12571. var i = 0,
  12572. l = elems.length;
  12573. for ( ; i < l; i++ ) {
  12574. dataPriv.set(
  12575. elems[ i ],
  12576. "globalEval",
  12577. !refElements || dataPriv.get( refElements[ i ], "globalEval" )
  12578. );
  12579. }
  12580. }
  12581. var rhtml = /<|&#?\w+;/;
  12582. function buildFragment( elems, context, scripts, selection, ignored ) {
  12583. var elem, tmp, tag, wrap, attached, j,
  12584. fragment = context.createDocumentFragment(),
  12585. nodes = [],
  12586. i = 0,
  12587. l = elems.length;
  12588. for ( ; i < l; i++ ) {
  12589. elem = elems[ i ];
  12590. if ( elem || elem === 0 ) {
  12591. // Add nodes directly
  12592. if ( toType( elem ) === "object" ) {
  12593. // Support: Android <=4.0 only, PhantomJS 1 only
  12594. // push.apply(_, arraylike) throws on ancient WebKit
  12595. jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem );
  12596. // Convert non-html into a text node
  12597. } else if ( !rhtml.test( elem ) ) {
  12598. nodes.push( context.createTextNode( elem ) );
  12599. // Convert html into DOM nodes
  12600. } else {
  12601. tmp = tmp || fragment.appendChild( context.createElement( "div" ) );
  12602. // Deserialize a standard representation
  12603. tag = ( rtagName.exec( elem ) || [ "", "" ] )[ 1 ].toLowerCase();
  12604. wrap = wrapMap[ tag ] || wrapMap._default;
  12605. tmp.innerHTML = wrap[ 1 ] + jQuery.htmlPrefilter( elem ) + wrap[ 2 ];
  12606. // Descend through wrappers to the right content
  12607. j = wrap[ 0 ];
  12608. while ( j-- ) {
  12609. tmp = tmp.lastChild;
  12610. }
  12611. // Support: Android <=4.0 only, PhantomJS 1 only
  12612. // push.apply(_, arraylike) throws on ancient WebKit
  12613. jQuery.merge( nodes, tmp.childNodes );
  12614. // Remember the top-level container
  12615. tmp = fragment.firstChild;
  12616. // Ensure the created nodes are orphaned (#12392)
  12617. tmp.textContent = "";
  12618. }
  12619. }
  12620. }
  12621. // Remove wrapper from fragment
  12622. fragment.textContent = "";
  12623. i = 0;
  12624. while ( ( elem = nodes[ i++ ] ) ) {
  12625. // Skip elements already in the context collection (trac-4087)
  12626. if ( selection && jQuery.inArray( elem, selection ) > -1 ) {
  12627. if ( ignored ) {
  12628. ignored.push( elem );
  12629. }
  12630. continue;
  12631. }
  12632. attached = isAttached( elem );
  12633. // Append to fragment
  12634. tmp = getAll( fragment.appendChild( elem ), "script" );
  12635. // Preserve script evaluation history
  12636. if ( attached ) {
  12637. setGlobalEval( tmp );
  12638. }
  12639. // Capture executables
  12640. if ( scripts ) {
  12641. j = 0;
  12642. while ( ( elem = tmp[ j++ ] ) ) {
  12643. if ( rscriptType.test( elem.type || "" ) ) {
  12644. scripts.push( elem );
  12645. }
  12646. }
  12647. }
  12648. }
  12649. return fragment;
  12650. }
  12651. ( function() {
  12652. var fragment = document.createDocumentFragment(),
  12653. div = fragment.appendChild( document.createElement( "div" ) ),
  12654. input = document.createElement( "input" );
  12655. // Support: Android 4.0 - 4.3 only
  12656. // Check state lost if the name is set (#11217)
  12657. // Support: Windows Web Apps (WWA)
  12658. // `name` and `type` must use .setAttribute for WWA (#14901)
  12659. input.setAttribute( "type", "radio" );
  12660. input.setAttribute( "checked", "checked" );
  12661. input.setAttribute( "name", "t" );
  12662. div.appendChild( input );
  12663. // Support: Android <=4.1 only
  12664. // Older WebKit doesn't clone checked state correctly in fragments
  12665. support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked;
  12666. // Support: IE <=11 only
  12667. // Make sure textarea (and checkbox) defaultValue is properly cloned
  12668. div.innerHTML = "<textarea>x</textarea>";
  12669. support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue;
  12670. } )();
  12671. var
  12672. rkeyEvent = /^key/,
  12673. rmouseEvent = /^(?:mouse|pointer|contextmenu|drag|drop)|click/,
  12674. rtypenamespace = /^([^.]*)(?:\.(.+)|)/;
  12675. function returnTrue() {
  12676. return true;
  12677. }
  12678. function returnFalse() {
  12679. return false;
  12680. }
  12681. // Support: IE <=9 - 11+
  12682. // focus() and blur() are asynchronous, except when they are no-op.
  12683. // So expect focus to be synchronous when the element is already active,
  12684. // and blur to be synchronous when the element is not already active.
  12685. // (focus and blur are always synchronous in other supported browsers,
  12686. // this just defines when we can count on it).
  12687. function expectSync( elem, type ) {
  12688. return ( elem === safeActiveElement() ) === ( type === "focus" );
  12689. }
  12690. // Support: IE <=9 only
  12691. // Accessing document.activeElement can throw unexpectedly
  12692. // https://bugs.jquery.com/ticket/13393
  12693. function safeActiveElement() {
  12694. try {
  12695. return document.activeElement;
  12696. } catch ( err ) { }
  12697. }
  12698. function on( elem, types, selector, data, fn, one ) {
  12699. var origFn, type;
  12700. // Types can be a map of types/handlers
  12701. if ( typeof types === "object" ) {
  12702. // ( types-Object, selector, data )
  12703. if ( typeof selector !== "string" ) {
  12704. // ( types-Object, data )
  12705. data = data || selector;
  12706. selector = undefined;
  12707. }
  12708. for ( type in types ) {
  12709. on( elem, type, selector, data, types[ type ], one );
  12710. }
  12711. return elem;
  12712. }
  12713. if ( data == null && fn == null ) {
  12714. // ( types, fn )
  12715. fn = selector;
  12716. data = selector = undefined;
  12717. } else if ( fn == null ) {
  12718. if ( typeof selector === "string" ) {
  12719. // ( types, selector, fn )
  12720. fn = data;
  12721. data = undefined;
  12722. } else {
  12723. // ( types, data, fn )
  12724. fn = data;
  12725. data = selector;
  12726. selector = undefined;
  12727. }
  12728. }
  12729. if ( fn === false ) {
  12730. fn = returnFalse;
  12731. } else if ( !fn ) {
  12732. return elem;
  12733. }
  12734. if ( one === 1 ) {
  12735. origFn = fn;
  12736. fn = function( event ) {
  12737. // Can use an empty set, since event contains the info
  12738. jQuery().off( event );
  12739. return origFn.apply( this, arguments );
  12740. };
  12741. // Use same guid so caller can remove using origFn
  12742. fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ );
  12743. }
  12744. return elem.each( function() {
  12745. jQuery.event.add( this, types, fn, data, selector );
  12746. } );
  12747. }
  12748. /*
  12749. * Helper functions for managing events -- not part of the public interface.
  12750. * Props to Dean Edwards' addEvent library for many of the ideas.
  12751. */
  12752. jQuery.event = {
  12753. global: {},
  12754. add: function( elem, types, handler, data, selector ) {
  12755. var handleObjIn, eventHandle, tmp,
  12756. events, t, handleObj,
  12757. special, handlers, type, namespaces, origType,
  12758. elemData = dataPriv.get( elem );
  12759. // Don't attach events to noData or text/comment nodes (but allow plain objects)
  12760. if ( !elemData ) {
  12761. return;
  12762. }
  12763. // Caller can pass in an object of custom data in lieu of the handler
  12764. if ( handler.handler ) {
  12765. handleObjIn = handler;
  12766. handler = handleObjIn.handler;
  12767. selector = handleObjIn.selector;
  12768. }
  12769. // Ensure that invalid selectors throw exceptions at attach time
  12770. // Evaluate against documentElement in case elem is a non-element node (e.g., document)
  12771. if ( selector ) {
  12772. jQuery.find.matchesSelector( documentElement, selector );
  12773. }
  12774. // Make sure that the handler has a unique ID, used to find/remove it later
  12775. if ( !handler.guid ) {
  12776. handler.guid = jQuery.guid++;
  12777. }
  12778. // Init the element's event structure and main handler, if this is the first
  12779. if ( !( events = elemData.events ) ) {
  12780. events = elemData.events = {};
  12781. }
  12782. if ( !( eventHandle = elemData.handle ) ) {
  12783. eventHandle = elemData.handle = function( e ) {
  12784. // Discard the second event of a jQuery.event.trigger() and
  12785. // when an event is called after a page has unloaded
  12786. return typeof jQuery !== "undefined" && jQuery.event.triggered !== e.type ?
  12787. jQuery.event.dispatch.apply( elem, arguments ) : undefined;
  12788. };
  12789. }
  12790. // Handle multiple events separated by a space
  12791. types = ( types || "" ).match( rnothtmlwhite ) || [ "" ];
  12792. t = types.length;
  12793. while ( t-- ) {
  12794. tmp = rtypenamespace.exec( types[ t ] ) || [];
  12795. type = origType = tmp[ 1 ];
  12796. namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
  12797. // There *must* be a type, no attaching namespace-only handlers
  12798. if ( !type ) {
  12799. continue;
  12800. }
  12801. // If event changes its type, use the special event handlers for the changed type
  12802. special = jQuery.event.special[ type ] || {};
  12803. // If selector defined, determine special event api type, otherwise given type
  12804. type = ( selector ? special.delegateType : special.bindType ) || type;
  12805. // Update special based on newly reset type
  12806. special = jQuery.event.special[ type ] || {};
  12807. // handleObj is passed to all event handlers
  12808. handleObj = jQuery.extend( {
  12809. type: type,
  12810. origType: origType,
  12811. data: data,
  12812. handler: handler,
  12813. guid: handler.guid,
  12814. selector: selector,
  12815. needsContext: selector && jQuery.expr.match.needsContext.test( selector ),
  12816. namespace: namespaces.join( "." )
  12817. }, handleObjIn );
  12818. // Init the event handler queue if we're the first
  12819. if ( !( handlers = events[ type ] ) ) {
  12820. handlers = events[ type ] = [];
  12821. handlers.delegateCount = 0;
  12822. // Only use addEventListener if the special events handler returns false
  12823. if ( !special.setup ||
  12824. special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
  12825. if ( elem.addEventListener ) {
  12826. elem.addEventListener( type, eventHandle );
  12827. }
  12828. }
  12829. }
  12830. if ( special.add ) {
  12831. special.add.call( elem, handleObj );
  12832. if ( !handleObj.handler.guid ) {
  12833. handleObj.handler.guid = handler.guid;
  12834. }
  12835. }
  12836. // Add to the element's handler list, delegates in front
  12837. if ( selector ) {
  12838. handlers.splice( handlers.delegateCount++, 0, handleObj );
  12839. } else {
  12840. handlers.push( handleObj );
  12841. }
  12842. // Keep track of which events have ever been used, for event optimization
  12843. jQuery.event.global[ type ] = true;
  12844. }
  12845. },
  12846. // Detach an event or set of events from an element
  12847. remove: function( elem, types, handler, selector, mappedTypes ) {
  12848. var j, origCount, tmp,
  12849. events, t, handleObj,
  12850. special, handlers, type, namespaces, origType,
  12851. elemData = dataPriv.hasData( elem ) && dataPriv.get( elem );
  12852. if ( !elemData || !( events = elemData.events ) ) {
  12853. return;
  12854. }
  12855. // Once for each type.namespace in types; type may be omitted
  12856. types = ( types || "" ).match( rnothtmlwhite ) || [ "" ];
  12857. t = types.length;
  12858. while ( t-- ) {
  12859. tmp = rtypenamespace.exec( types[ t ] ) || [];
  12860. type = origType = tmp[ 1 ];
  12861. namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
  12862. // Unbind all events (on this namespace, if provided) for the element
  12863. if ( !type ) {
  12864. for ( type in events ) {
  12865. jQuery.event.remove( elem, type + types[ t ], handler, selector, true );
  12866. }
  12867. continue;
  12868. }
  12869. special = jQuery.event.special[ type ] || {};
  12870. type = ( selector ? special.delegateType : special.bindType ) || type;
  12871. handlers = events[ type ] || [];
  12872. tmp = tmp[ 2 ] &&
  12873. new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" );
  12874. // Remove matching events
  12875. origCount = j = handlers.length;
  12876. while ( j-- ) {
  12877. handleObj = handlers[ j ];
  12878. if ( ( mappedTypes || origType === handleObj.origType ) &&
  12879. ( !handler || handler.guid === handleObj.guid ) &&
  12880. ( !tmp || tmp.test( handleObj.namespace ) ) &&
  12881. ( !selector || selector === handleObj.selector ||
  12882. selector === "**" && handleObj.selector ) ) {
  12883. handlers.splice( j, 1 );
  12884. if ( handleObj.selector ) {
  12885. handlers.delegateCount--;
  12886. }
  12887. if ( special.remove ) {
  12888. special.remove.call( elem, handleObj );
  12889. }
  12890. }
  12891. }
  12892. // Remove generic event handler if we removed something and no more handlers exist
  12893. // (avoids potential for endless recursion during removal of special event handlers)
  12894. if ( origCount && !handlers.length ) {
  12895. if ( !special.teardown ||
  12896. special.teardown.call( elem, namespaces, elemData.handle ) === false ) {
  12897. jQuery.removeEvent( elem, type, elemData.handle );
  12898. }
  12899. delete events[ type ];
  12900. }
  12901. }
  12902. // Remove data and the expando if it's no longer used
  12903. if ( jQuery.isEmptyObject( events ) ) {
  12904. dataPriv.remove( elem, "handle events" );
  12905. }
  12906. },
  12907. dispatch: function( nativeEvent ) {
  12908. // Make a writable jQuery.Event from the native event object
  12909. var event = jQuery.event.fix( nativeEvent );
  12910. var i, j, ret, matched, handleObj, handlerQueue,
  12911. args = new Array( arguments.length ),
  12912. handlers = ( dataPriv.get( this, "events" ) || {} )[ event.type ] || [],
  12913. special = jQuery.event.special[ event.type ] || {};
  12914. // Use the fix-ed jQuery.Event rather than the (read-only) native event
  12915. args[ 0 ] = event;
  12916. for ( i = 1; i < arguments.length; i++ ) {
  12917. args[ i ] = arguments[ i ];
  12918. }
  12919. event.delegateTarget = this;
  12920. // Call the preDispatch hook for the mapped type, and let it bail if desired
  12921. if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) {
  12922. return;
  12923. }
  12924. // Determine handlers
  12925. handlerQueue = jQuery.event.handlers.call( this, event, handlers );
  12926. // Run delegates first; they may want to stop propagation beneath us
  12927. i = 0;
  12928. while ( ( matched = handlerQueue[ i++ ] ) && !event.isPropagationStopped() ) {
  12929. event.currentTarget = matched.elem;
  12930. j = 0;
  12931. while ( ( handleObj = matched.handlers[ j++ ] ) &&
  12932. !event.isImmediatePropagationStopped() ) {
  12933. // If the event is namespaced, then each handler is only invoked if it is
  12934. // specially universal or its namespaces are a superset of the event's.
  12935. if ( !event.rnamespace || handleObj.namespace === false ||
  12936. event.rnamespace.test( handleObj.namespace ) ) {
  12937. event.handleObj = handleObj;
  12938. event.data = handleObj.data;
  12939. ret = ( ( jQuery.event.special[ handleObj.origType ] || {} ).handle ||
  12940. handleObj.handler ).apply( matched.elem, args );
  12941. if ( ret !== undefined ) {
  12942. if ( ( event.result = ret ) === false ) {
  12943. event.preventDefault();
  12944. event.stopPropagation();
  12945. }
  12946. }
  12947. }
  12948. }
  12949. }
  12950. // Call the postDispatch hook for the mapped type
  12951. if ( special.postDispatch ) {
  12952. special.postDispatch.call( this, event );
  12953. }
  12954. return event.result;
  12955. },
  12956. handlers: function( event, handlers ) {
  12957. var i, handleObj, sel, matchedHandlers, matchedSelectors,
  12958. handlerQueue = [],
  12959. delegateCount = handlers.delegateCount,
  12960. cur = event.target;
  12961. // Find delegate handlers
  12962. if ( delegateCount &&
  12963. // Support: IE <=9
  12964. // Black-hole SVG <use> instance trees (trac-13180)
  12965. cur.nodeType &&
  12966. // Support: Firefox <=42
  12967. // Suppress spec-violating clicks indicating a non-primary pointer button (trac-3861)
  12968. // https://www.w3.org/TR/DOM-Level-3-Events/#event-type-click
  12969. // Support: IE 11 only
  12970. // ...but not arrow key "clicks" of radio inputs, which can have `button` -1 (gh-2343)
  12971. !( event.type === "click" && event.button >= 1 ) ) {
  12972. for ( ; cur !== this; cur = cur.parentNode || this ) {
  12973. // Don't check non-elements (#13208)
  12974. // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764)
  12975. if ( cur.nodeType === 1 && !( event.type === "click" && cur.disabled === true ) ) {
  12976. matchedHandlers = [];
  12977. matchedSelectors = {};
  12978. for ( i = 0; i < delegateCount; i++ ) {
  12979. handleObj = handlers[ i ];
  12980. // Don't conflict with Object.prototype properties (#13203)
  12981. sel = handleObj.selector + " ";
  12982. if ( matchedSelectors[ sel ] === undefined ) {
  12983. matchedSelectors[ sel ] = handleObj.needsContext ?
  12984. jQuery( sel, this ).index( cur ) > -1 :
  12985. jQuery.find( sel, this, null, [ cur ] ).length;
  12986. }
  12987. if ( matchedSelectors[ sel ] ) {
  12988. matchedHandlers.push( handleObj );
  12989. }
  12990. }
  12991. if ( matchedHandlers.length ) {
  12992. handlerQueue.push( { elem: cur, handlers: matchedHandlers } );
  12993. }
  12994. }
  12995. }
  12996. }
  12997. // Add the remaining (directly-bound) handlers
  12998. cur = this;
  12999. if ( delegateCount < handlers.length ) {
  13000. handlerQueue.push( { elem: cur, handlers: handlers.slice( delegateCount ) } );
  13001. }
  13002. return handlerQueue;
  13003. },
  13004. addProp: function( name, hook ) {
  13005. Object.defineProperty( jQuery.Event.prototype, name, {
  13006. enumerable: true,
  13007. configurable: true,
  13008. get: isFunction( hook ) ?
  13009. function() {
  13010. if ( this.originalEvent ) {
  13011. return hook( this.originalEvent );
  13012. }
  13013. } :
  13014. function() {
  13015. if ( this.originalEvent ) {
  13016. return this.originalEvent[ name ];
  13017. }
  13018. },
  13019. set: function( value ) {
  13020. Object.defineProperty( this, name, {
  13021. enumerable: true,
  13022. configurable: true,
  13023. writable: true,
  13024. value: value
  13025. } );
  13026. }
  13027. } );
  13028. },
  13029. fix: function( originalEvent ) {
  13030. return originalEvent[ jQuery.expando ] ?
  13031. originalEvent :
  13032. new jQuery.Event( originalEvent );
  13033. },
  13034. special: {
  13035. load: {
  13036. // Prevent triggered image.load events from bubbling to window.load
  13037. noBubble: true
  13038. },
  13039. click: {
  13040. // Utilize native event to ensure correct state for checkable inputs
  13041. setup: function( data ) {
  13042. // For mutual compressibility with _default, replace `this` access with a local var.
  13043. // `|| data` is dead code meant only to preserve the variable through minification.
  13044. var el = this || data;
  13045. // Claim the first handler
  13046. if ( rcheckableType.test( el.type ) &&
  13047. el.click && nodeName( el, "input" ) ) {
  13048. // dataPriv.set( el, "click", ... )
  13049. leverageNative( el, "click", returnTrue );
  13050. }
  13051. // Return false to allow normal processing in the caller
  13052. return false;
  13053. },
  13054. trigger: function( data ) {
  13055. // For mutual compressibility with _default, replace `this` access with a local var.
  13056. // `|| data` is dead code meant only to preserve the variable through minification.
  13057. var el = this || data;
  13058. // Force setup before triggering a click
  13059. if ( rcheckableType.test( el.type ) &&
  13060. el.click && nodeName( el, "input" ) ) {
  13061. leverageNative( el, "click" );
  13062. }
  13063. // Return non-false to allow normal event-path propagation
  13064. return true;
  13065. },
  13066. // For cross-browser consistency, suppress native .click() on links
  13067. // Also prevent it if we're currently inside a leveraged native-event stack
  13068. _default: function( event ) {
  13069. var target = event.target;
  13070. return rcheckableType.test( target.type ) &&
  13071. target.click && nodeName( target, "input" ) &&
  13072. dataPriv.get( target, "click" ) ||
  13073. nodeName( target, "a" );
  13074. }
  13075. },
  13076. beforeunload: {
  13077. postDispatch: function( event ) {
  13078. // Support: Firefox 20+
  13079. // Firefox doesn't alert if the returnValue field is not set.
  13080. if ( event.result !== undefined && event.originalEvent ) {
  13081. event.originalEvent.returnValue = event.result;
  13082. }
  13083. }
  13084. }
  13085. }
  13086. };
  13087. // Ensure the presence of an event listener that handles manually-triggered
  13088. // synthetic events by interrupting progress until reinvoked in response to
  13089. // *native* events that it fires directly, ensuring that state changes have
  13090. // already occurred before other listeners are invoked.
  13091. function leverageNative( el, type, expectSync ) {
  13092. // Missing expectSync indicates a trigger call, which must force setup through jQuery.event.add
  13093. if ( !expectSync ) {
  13094. if ( dataPriv.get( el, type ) === undefined ) {
  13095. jQuery.event.add( el, type, returnTrue );
  13096. }
  13097. return;
  13098. }
  13099. // Register the controller as a special universal handler for all event namespaces
  13100. dataPriv.set( el, type, false );
  13101. jQuery.event.add( el, type, {
  13102. namespace: false,
  13103. handler: function( event ) {
  13104. var notAsync, result,
  13105. saved = dataPriv.get( this, type );
  13106. if ( ( event.isTrigger & 1 ) && this[ type ] ) {
  13107. // Interrupt processing of the outer synthetic .trigger()ed event
  13108. // Saved data should be false in such cases, but might be a leftover capture object
  13109. // from an async native handler (gh-4350)
  13110. if ( !saved.length ) {
  13111. // Store arguments for use when handling the inner native event
  13112. // There will always be at least one argument (an event object), so this array
  13113. // will not be confused with a leftover capture object.
  13114. saved = slice.call( arguments );
  13115. dataPriv.set( this, type, saved );
  13116. // Trigger the native event and capture its result
  13117. // Support: IE <=9 - 11+
  13118. // focus() and blur() are asynchronous
  13119. notAsync = expectSync( this, type );
  13120. this[ type ]();
  13121. result = dataPriv.get( this, type );
  13122. if ( saved !== result || notAsync ) {
  13123. dataPriv.set( this, type, false );
  13124. } else {
  13125. result = {};
  13126. }
  13127. if ( saved !== result ) {
  13128. // Cancel the outer synthetic event
  13129. event.stopImmediatePropagation();
  13130. event.preventDefault();
  13131. return result.value;
  13132. }
  13133. // If this is an inner synthetic event for an event with a bubbling surrogate
  13134. // (focus or blur), assume that the surrogate already propagated from triggering the
  13135. // native event and prevent that from happening again here.
  13136. // This technically gets the ordering wrong w.r.t. to `.trigger()` (in which the
  13137. // bubbling surrogate propagates *after* the non-bubbling base), but that seems
  13138. // less bad than duplication.
  13139. } else if ( ( jQuery.event.special[ type ] || {} ).delegateType ) {
  13140. event.stopPropagation();
  13141. }
  13142. // If this is a native event triggered above, everything is now in order
  13143. // Fire an inner synthetic event with the original arguments
  13144. } else if ( saved.length ) {
  13145. // ...and capture the result
  13146. dataPriv.set( this, type, {
  13147. value: jQuery.event.trigger(
  13148. // Support: IE <=9 - 11+
  13149. // Extend with the prototype to reset the above stopImmediatePropagation()
  13150. jQuery.extend( saved[ 0 ], jQuery.Event.prototype ),
  13151. saved.slice( 1 ),
  13152. this
  13153. )
  13154. } );
  13155. // Abort handling of the native event
  13156. event.stopImmediatePropagation();
  13157. }
  13158. }
  13159. } );
  13160. }
  13161. jQuery.removeEvent = function( elem, type, handle ) {
  13162. // This "if" is needed for plain objects
  13163. if ( elem.removeEventListener ) {
  13164. elem.removeEventListener( type, handle );
  13165. }
  13166. };
  13167. jQuery.Event = function( src, props ) {
  13168. // Allow instantiation without the 'new' keyword
  13169. if ( !( this instanceof jQuery.Event ) ) {
  13170. return new jQuery.Event( src, props );
  13171. }
  13172. // Event object
  13173. if ( src && src.type ) {
  13174. this.originalEvent = src;
  13175. this.type = src.type;
  13176. // Events bubbling up the document may have been marked as prevented
  13177. // by a handler lower down the tree; reflect the correct value.
  13178. this.isDefaultPrevented = src.defaultPrevented ||
  13179. src.defaultPrevented === undefined &&
  13180. // Support: Android <=2.3 only
  13181. src.returnValue === false ?
  13182. returnTrue :
  13183. returnFalse;
  13184. // Create target properties
  13185. // Support: Safari <=6 - 7 only
  13186. // Target should not be a text node (#504, #13143)
  13187. this.target = ( src.target && src.target.nodeType === 3 ) ?
  13188. src.target.parentNode :
  13189. src.target;
  13190. this.currentTarget = src.currentTarget;
  13191. this.relatedTarget = src.relatedTarget;
  13192. // Event type
  13193. } else {
  13194. this.type = src;
  13195. }
  13196. // Put explicitly provided properties onto the event object
  13197. if ( props ) {
  13198. jQuery.extend( this, props );
  13199. }
  13200. // Create a timestamp if incoming event doesn't have one
  13201. this.timeStamp = src && src.timeStamp || Date.now();
  13202. // Mark it as fixed
  13203. this[ jQuery.expando ] = true;
  13204. };
  13205. // jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
  13206. // https://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
  13207. jQuery.Event.prototype = {
  13208. constructor: jQuery.Event,
  13209. isDefaultPrevented: returnFalse,
  13210. isPropagationStopped: returnFalse,
  13211. isImmediatePropagationStopped: returnFalse,
  13212. isSimulated: false,
  13213. preventDefault: function() {
  13214. var e = this.originalEvent;
  13215. this.isDefaultPrevented = returnTrue;
  13216. if ( e && !this.isSimulated ) {
  13217. e.preventDefault();
  13218. }
  13219. },
  13220. stopPropagation: function() {
  13221. var e = this.originalEvent;
  13222. this.isPropagationStopped = returnTrue;
  13223. if ( e && !this.isSimulated ) {
  13224. e.stopPropagation();
  13225. }
  13226. },
  13227. stopImmediatePropagation: function() {
  13228. var e = this.originalEvent;
  13229. this.isImmediatePropagationStopped = returnTrue;
  13230. if ( e && !this.isSimulated ) {
  13231. e.stopImmediatePropagation();
  13232. }
  13233. this.stopPropagation();
  13234. }
  13235. };
  13236. // Includes all common event props including KeyEvent and MouseEvent specific props
  13237. jQuery.each( {
  13238. altKey: true,
  13239. bubbles: true,
  13240. cancelable: true,
  13241. changedTouches: true,
  13242. ctrlKey: true,
  13243. detail: true,
  13244. eventPhase: true,
  13245. metaKey: true,
  13246. pageX: true,
  13247. pageY: true,
  13248. shiftKey: true,
  13249. view: true,
  13250. "char": true,
  13251. code: true,
  13252. charCode: true,
  13253. key: true,
  13254. keyCode: true,
  13255. button: true,
  13256. buttons: true,
  13257. clientX: true,
  13258. clientY: true,
  13259. offsetX: true,
  13260. offsetY: true,
  13261. pointerId: true,
  13262. pointerType: true,
  13263. screenX: true,
  13264. screenY: true,
  13265. targetTouches: true,
  13266. toElement: true,
  13267. touches: true,
  13268. which: function( event ) {
  13269. var button = event.button;
  13270. // Add which for key events
  13271. if ( event.which == null && rkeyEvent.test( event.type ) ) {
  13272. return event.charCode != null ? event.charCode : event.keyCode;
  13273. }
  13274. // Add which for click: 1 === left; 2 === middle; 3 === right
  13275. if ( !event.which && button !== undefined && rmouseEvent.test( event.type ) ) {
  13276. if ( button & 1 ) {
  13277. return 1;
  13278. }
  13279. if ( button & 2 ) {
  13280. return 3;
  13281. }
  13282. if ( button & 4 ) {
  13283. return 2;
  13284. }
  13285. return 0;
  13286. }
  13287. return event.which;
  13288. }
  13289. }, jQuery.event.addProp );
  13290. jQuery.each( { focus: "focusin", blur: "focusout" }, function( type, delegateType ) {
  13291. jQuery.event.special[ type ] = {
  13292. // Utilize native event if possible so blur/focus sequence is correct
  13293. setup: function() {
  13294. // Claim the first handler
  13295. // dataPriv.set( this, "focus", ... )
  13296. // dataPriv.set( this, "blur", ... )
  13297. leverageNative( this, type, expectSync );
  13298. // Return false to allow normal processing in the caller
  13299. return false;
  13300. },
  13301. trigger: function() {
  13302. // Force setup before trigger
  13303. leverageNative( this, type );
  13304. // Return non-false to allow normal event-path propagation
  13305. return true;
  13306. },
  13307. delegateType: delegateType
  13308. };
  13309. } );
  13310. // Create mouseenter/leave events using mouseover/out and event-time checks
  13311. // so that event delegation works in jQuery.
  13312. // Do the same for pointerenter/pointerleave and pointerover/pointerout
  13313. //
  13314. // Support: Safari 7 only
  13315. // Safari sends mouseenter too often; see:
  13316. // https://bugs.chromium.org/p/chromium/issues/detail?id=470258
  13317. // for the description of the bug (it existed in older Chrome versions as well).
  13318. jQuery.each( {
  13319. mouseenter: "mouseover",
  13320. mouseleave: "mouseout",
  13321. pointerenter: "pointerover",
  13322. pointerleave: "pointerout"
  13323. }, function( orig, fix ) {
  13324. jQuery.event.special[ orig ] = {
  13325. delegateType: fix,
  13326. bindType: fix,
  13327. handle: function( event ) {
  13328. var ret,
  13329. target = this,
  13330. related = event.relatedTarget,
  13331. handleObj = event.handleObj;
  13332. // For mouseenter/leave call the handler if related is outside the target.
  13333. // NB: No relatedTarget if the mouse left/entered the browser window
  13334. if ( !related || ( related !== target && !jQuery.contains( target, related ) ) ) {
  13335. event.type = handleObj.origType;
  13336. ret = handleObj.handler.apply( this, arguments );
  13337. event.type = fix;
  13338. }
  13339. return ret;
  13340. }
  13341. };
  13342. } );
  13343. jQuery.fn.extend( {
  13344. on: function( types, selector, data, fn ) {
  13345. return on( this, types, selector, data, fn );
  13346. },
  13347. one: function( types, selector, data, fn ) {
  13348. return on( this, types, selector, data, fn, 1 );
  13349. },
  13350. off: function( types, selector, fn ) {
  13351. var handleObj, type;
  13352. if ( types && types.preventDefault && types.handleObj ) {
  13353. // ( event ) dispatched jQuery.Event
  13354. handleObj = types.handleObj;
  13355. jQuery( types.delegateTarget ).off(
  13356. handleObj.namespace ?
  13357. handleObj.origType + "." + handleObj.namespace :
  13358. handleObj.origType,
  13359. handleObj.selector,
  13360. handleObj.handler
  13361. );
  13362. return this;
  13363. }
  13364. if ( typeof types === "object" ) {
  13365. // ( types-object [, selector] )
  13366. for ( type in types ) {
  13367. this.off( type, selector, types[ type ] );
  13368. }
  13369. return this;
  13370. }
  13371. if ( selector === false || typeof selector === "function" ) {
  13372. // ( types [, fn] )
  13373. fn = selector;
  13374. selector = undefined;
  13375. }
  13376. if ( fn === false ) {
  13377. fn = returnFalse;
  13378. }
  13379. return this.each( function() {
  13380. jQuery.event.remove( this, types, fn, selector );
  13381. } );
  13382. }
  13383. } );
  13384. var
  13385. /* eslint-disable max-len */
  13386. // See https://github.com/eslint/eslint/issues/3229
  13387. rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([a-z][^\/\0>\x20\t\r\n\f]*)[^>]*)\/>/gi,
  13388. /* eslint-enable */
  13389. // Support: IE <=10 - 11, Edge 12 - 13 only
  13390. // In IE/Edge using regex groups here causes severe slowdowns.
  13391. // See https://connect.microsoft.com/IE/feedback/details/1736512/
  13392. rnoInnerhtml = /<script|<style|<link/i,
  13393. // checked="checked" or checked
  13394. rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
  13395. rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g;
  13396. // Prefer a tbody over its parent table for containing new rows
  13397. function manipulationTarget( elem, content ) {
  13398. if ( nodeName( elem, "table" ) &&
  13399. nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ) {
  13400. return jQuery( elem ).children( "tbody" )[ 0 ] || elem;
  13401. }
  13402. return elem;
  13403. }
  13404. // Replace/restore the type attribute of script elements for safe DOM manipulation
  13405. function disableScript( elem ) {
  13406. elem.type = ( elem.getAttribute( "type" ) !== null ) + "/" + elem.type;
  13407. return elem;
  13408. }
  13409. function restoreScript( elem ) {
  13410. if ( ( elem.type || "" ).slice( 0, 5 ) === "true/" ) {
  13411. elem.type = elem.type.slice( 5 );
  13412. } else {
  13413. elem.removeAttribute( "type" );
  13414. }
  13415. return elem;
  13416. }
  13417. function cloneCopyEvent( src, dest ) {
  13418. var i, l, type, pdataOld, pdataCur, udataOld, udataCur, events;
  13419. if ( dest.nodeType !== 1 ) {
  13420. return;
  13421. }
  13422. // 1. Copy private data: events, handlers, etc.
  13423. if ( dataPriv.hasData( src ) ) {
  13424. pdataOld = dataPriv.access( src );
  13425. pdataCur = dataPriv.set( dest, pdataOld );
  13426. events = pdataOld.events;
  13427. if ( events ) {
  13428. delete pdataCur.handle;
  13429. pdataCur.events = {};
  13430. for ( type in events ) {
  13431. for ( i = 0, l = events[ type ].length; i < l; i++ ) {
  13432. jQuery.event.add( dest, type, events[ type ][ i ] );
  13433. }
  13434. }
  13435. }
  13436. }
  13437. // 2. Copy user data
  13438. if ( dataUser.hasData( src ) ) {
  13439. udataOld = dataUser.access( src );
  13440. udataCur = jQuery.extend( {}, udataOld );
  13441. dataUser.set( dest, udataCur );
  13442. }
  13443. }
  13444. // Fix IE bugs, see support tests
  13445. function fixInput( src, dest ) {
  13446. var nodeName = dest.nodeName.toLowerCase();
  13447. // Fails to persist the checked state of a cloned checkbox or radio button.
  13448. if ( nodeName === "input" && rcheckableType.test( src.type ) ) {
  13449. dest.checked = src.checked;
  13450. // Fails to return the selected option to the default selected state when cloning options
  13451. } else if ( nodeName === "input" || nodeName === "textarea" ) {
  13452. dest.defaultValue = src.defaultValue;
  13453. }
  13454. }
  13455. function domManip( collection, args, callback, ignored ) {
  13456. // Flatten any nested arrays
  13457. args = concat.apply( [], args );
  13458. var fragment, first, scripts, hasScripts, node, doc,
  13459. i = 0,
  13460. l = collection.length,
  13461. iNoClone = l - 1,
  13462. value = args[ 0 ],
  13463. valueIsFunction = isFunction( value );
  13464. // We can't cloneNode fragments that contain checked, in WebKit
  13465. if ( valueIsFunction ||
  13466. ( l > 1 && typeof value === "string" &&
  13467. !support.checkClone && rchecked.test( value ) ) ) {
  13468. return collection.each( function( index ) {
  13469. var self = collection.eq( index );
  13470. if ( valueIsFunction ) {
  13471. args[ 0 ] = value.call( this, index, self.html() );
  13472. }
  13473. domManip( self, args, callback, ignored );
  13474. } );
  13475. }
  13476. if ( l ) {
  13477. fragment = buildFragment( args, collection[ 0 ].ownerDocument, false, collection, ignored );
  13478. first = fragment.firstChild;
  13479. if ( fragment.childNodes.length === 1 ) {
  13480. fragment = first;
  13481. }
  13482. // Require either new content or an interest in ignored elements to invoke the callback
  13483. if ( first || ignored ) {
  13484. scripts = jQuery.map( getAll( fragment, "script" ), disableScript );
  13485. hasScripts = scripts.length;
  13486. // Use the original fragment for the last item
  13487. // instead of the first because it can end up
  13488. // being emptied incorrectly in certain situations (#8070).
  13489. for ( ; i < l; i++ ) {
  13490. node = fragment;
  13491. if ( i !== iNoClone ) {
  13492. node = jQuery.clone( node, true, true );
  13493. // Keep references to cloned scripts for later restoration
  13494. if ( hasScripts ) {
  13495. // Support: Android <=4.0 only, PhantomJS 1 only
  13496. // push.apply(_, arraylike) throws on ancient WebKit
  13497. jQuery.merge( scripts, getAll( node, "script" ) );
  13498. }
  13499. }
  13500. callback.call( collection[ i ], node, i );
  13501. }
  13502. if ( hasScripts ) {
  13503. doc = scripts[ scripts.length - 1 ].ownerDocument;
  13504. // Reenable scripts
  13505. jQuery.map( scripts, restoreScript );
  13506. // Evaluate executable scripts on first document insertion
  13507. for ( i = 0; i < hasScripts; i++ ) {
  13508. node = scripts[ i ];
  13509. if ( rscriptType.test( node.type || "" ) &&
  13510. !dataPriv.access( node, "globalEval" ) &&
  13511. jQuery.contains( doc, node ) ) {
  13512. if ( node.src && ( node.type || "" ).toLowerCase() !== "module" ) {
  13513. // Optional AJAX dependency, but won't run scripts if not present
  13514. if ( jQuery._evalUrl && !node.noModule ) {
  13515. jQuery._evalUrl( node.src, {
  13516. nonce: node.nonce || node.getAttribute( "nonce" )
  13517. } );
  13518. }
  13519. } else {
  13520. DOMEval( node.textContent.replace( rcleanScript, "" ), node, doc );
  13521. }
  13522. }
  13523. }
  13524. }
  13525. }
  13526. }
  13527. return collection;
  13528. }
  13529. function remove( elem, selector, keepData ) {
  13530. var node,
  13531. nodes = selector ? jQuery.filter( selector, elem ) : elem,
  13532. i = 0;
  13533. for ( ; ( node = nodes[ i ] ) != null; i++ ) {
  13534. if ( !keepData && node.nodeType === 1 ) {
  13535. jQuery.cleanData( getAll( node ) );
  13536. }
  13537. if ( node.parentNode ) {
  13538. if ( keepData && isAttached( node ) ) {
  13539. setGlobalEval( getAll( node, "script" ) );
  13540. }
  13541. node.parentNode.removeChild( node );
  13542. }
  13543. }
  13544. return elem;
  13545. }
  13546. jQuery.extend( {
  13547. htmlPrefilter: function( html ) {
  13548. return html.replace( rxhtmlTag, "<$1></$2>" );
  13549. },
  13550. clone: function( elem, dataAndEvents, deepDataAndEvents ) {
  13551. var i, l, srcElements, destElements,
  13552. clone = elem.cloneNode( true ),
  13553. inPage = isAttached( elem );
  13554. // Fix IE cloning issues
  13555. if ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) &&
  13556. !jQuery.isXMLDoc( elem ) ) {
  13557. // We eschew Sizzle here for performance reasons: https://jsperf.com/getall-vs-sizzle/2
  13558. destElements = getAll( clone );
  13559. srcElements = getAll( elem );
  13560. for ( i = 0, l = srcElements.length; i < l; i++ ) {
  13561. fixInput( srcElements[ i ], destElements[ i ] );
  13562. }
  13563. }
  13564. // Copy the events from the original to the clone
  13565. if ( dataAndEvents ) {
  13566. if ( deepDataAndEvents ) {
  13567. srcElements = srcElements || getAll( elem );
  13568. destElements = destElements || getAll( clone );
  13569. for ( i = 0, l = srcElements.length; i < l; i++ ) {
  13570. cloneCopyEvent( srcElements[ i ], destElements[ i ] );
  13571. }
  13572. } else {
  13573. cloneCopyEvent( elem, clone );
  13574. }
  13575. }
  13576. // Preserve script evaluation history
  13577. destElements = getAll( clone, "script" );
  13578. if ( destElements.length > 0 ) {
  13579. setGlobalEval( destElements, !inPage && getAll( elem, "script" ) );
  13580. }
  13581. // Return the cloned set
  13582. return clone;
  13583. },
  13584. cleanData: function( elems ) {
  13585. var data, elem, type,
  13586. special = jQuery.event.special,
  13587. i = 0;
  13588. for ( ; ( elem = elems[ i ] ) !== undefined; i++ ) {
  13589. if ( acceptData( elem ) ) {
  13590. if ( ( data = elem[ dataPriv.expando ] ) ) {
  13591. if ( data.events ) {
  13592. for ( type in data.events ) {
  13593. if ( special[ type ] ) {
  13594. jQuery.event.remove( elem, type );
  13595. // This is a shortcut to avoid jQuery.event.remove's overhead
  13596. } else {
  13597. jQuery.removeEvent( elem, type, data.handle );
  13598. }
  13599. }
  13600. }
  13601. // Support: Chrome <=35 - 45+
  13602. // Assign undefined instead of using delete, see Data#remove
  13603. elem[ dataPriv.expando ] = undefined;
  13604. }
  13605. if ( elem[ dataUser.expando ] ) {
  13606. // Support: Chrome <=35 - 45+
  13607. // Assign undefined instead of using delete, see Data#remove
  13608. elem[ dataUser.expando ] = undefined;
  13609. }
  13610. }
  13611. }
  13612. }
  13613. } );
  13614. jQuery.fn.extend( {
  13615. detach: function( selector ) {
  13616. return remove( this, selector, true );
  13617. },
  13618. remove: function( selector ) {
  13619. return remove( this, selector );
  13620. },
  13621. text: function( value ) {
  13622. return access( this, function( value ) {
  13623. return value === undefined ?
  13624. jQuery.text( this ) :
  13625. this.empty().each( function() {
  13626. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  13627. this.textContent = value;
  13628. }
  13629. } );
  13630. }, null, value, arguments.length );
  13631. },
  13632. append: function() {
  13633. return domManip( this, arguments, function( elem ) {
  13634. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  13635. var target = manipulationTarget( this, elem );
  13636. target.appendChild( elem );
  13637. }
  13638. } );
  13639. },
  13640. prepend: function() {
  13641. return domManip( this, arguments, function( elem ) {
  13642. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  13643. var target = manipulationTarget( this, elem );
  13644. target.insertBefore( elem, target.firstChild );
  13645. }
  13646. } );
  13647. },
  13648. before: function() {
  13649. return domManip( this, arguments, function( elem ) {
  13650. if ( this.parentNode ) {
  13651. this.parentNode.insertBefore( elem, this );
  13652. }
  13653. } );
  13654. },
  13655. after: function() {
  13656. return domManip( this, arguments, function( elem ) {
  13657. if ( this.parentNode ) {
  13658. this.parentNode.insertBefore( elem, this.nextSibling );
  13659. }
  13660. } );
  13661. },
  13662. empty: function() {
  13663. var elem,
  13664. i = 0;
  13665. for ( ; ( elem = this[ i ] ) != null; i++ ) {
  13666. if ( elem.nodeType === 1 ) {
  13667. // Prevent memory leaks
  13668. jQuery.cleanData( getAll( elem, false ) );
  13669. // Remove any remaining nodes
  13670. elem.textContent = "";
  13671. }
  13672. }
  13673. return this;
  13674. },
  13675. clone: function( dataAndEvents, deepDataAndEvents ) {
  13676. dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
  13677. deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
  13678. return this.map( function() {
  13679. return jQuery.clone( this, dataAndEvents, deepDataAndEvents );
  13680. } );
  13681. },
  13682. html: function( value ) {
  13683. return access( this, function( value ) {
  13684. var elem = this[ 0 ] || {},
  13685. i = 0,
  13686. l = this.length;
  13687. if ( value === undefined && elem.nodeType === 1 ) {
  13688. return elem.innerHTML;
  13689. }
  13690. // See if we can take a shortcut and just use innerHTML
  13691. if ( typeof value === "string" && !rnoInnerhtml.test( value ) &&
  13692. !wrapMap[ ( rtagName.exec( value ) || [ "", "" ] )[ 1 ].toLowerCase() ] ) {
  13693. value = jQuery.htmlPrefilter( value );
  13694. try {
  13695. for ( ; i < l; i++ ) {
  13696. elem = this[ i ] || {};
  13697. // Remove element nodes and prevent memory leaks
  13698. if ( elem.nodeType === 1 ) {
  13699. jQuery.cleanData( getAll( elem, false ) );
  13700. elem.innerHTML = value;
  13701. }
  13702. }
  13703. elem = 0;
  13704. // If using innerHTML throws an exception, use the fallback method
  13705. } catch ( e ) {}
  13706. }
  13707. if ( elem ) {
  13708. this.empty().append( value );
  13709. }
  13710. }, null, value, arguments.length );
  13711. },
  13712. replaceWith: function() {
  13713. var ignored = [];
  13714. // Make the changes, replacing each non-ignored context element with the new content
  13715. return domManip( this, arguments, function( elem ) {
  13716. var parent = this.parentNode;
  13717. if ( jQuery.inArray( this, ignored ) < 0 ) {
  13718. jQuery.cleanData( getAll( this ) );
  13719. if ( parent ) {
  13720. parent.replaceChild( elem, this );
  13721. }
  13722. }
  13723. // Force callback invocation
  13724. }, ignored );
  13725. }
  13726. } );
  13727. jQuery.each( {
  13728. appendTo: "append",
  13729. prependTo: "prepend",
  13730. insertBefore: "before",
  13731. insertAfter: "after",
  13732. replaceAll: "replaceWith"
  13733. }, function( name, original ) {
  13734. jQuery.fn[ name ] = function( selector ) {
  13735. var elems,
  13736. ret = [],
  13737. insert = jQuery( selector ),
  13738. last = insert.length - 1,
  13739. i = 0;
  13740. for ( ; i <= last; i++ ) {
  13741. elems = i === last ? this : this.clone( true );
  13742. jQuery( insert[ i ] )[ original ]( elems );
  13743. // Support: Android <=4.0 only, PhantomJS 1 only
  13744. // .get() because push.apply(_, arraylike) throws on ancient WebKit
  13745. push.apply( ret, elems.get() );
  13746. }
  13747. return this.pushStack( ret );
  13748. };
  13749. } );
  13750. var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" );
  13751. var getStyles = function( elem ) {
  13752. // Support: IE <=11 only, Firefox <=30 (#15098, #14150)
  13753. // IE throws on elements created in popups
  13754. // FF meanwhile throws on frame elements through "defaultView.getComputedStyle"
  13755. var view = elem.ownerDocument.defaultView;
  13756. if ( !view || !view.opener ) {
  13757. view = window;
  13758. }
  13759. return view.getComputedStyle( elem );
  13760. };
  13761. var rboxStyle = new RegExp( cssExpand.join( "|" ), "i" );
  13762. ( function() {
  13763. // Executing both pixelPosition & boxSizingReliable tests require only one layout
  13764. // so they're executed at the same time to save the second computation.
  13765. function computeStyleTests() {
  13766. // This is a singleton, we need to execute it only once
  13767. if ( !div ) {
  13768. return;
  13769. }
  13770. container.style.cssText = "position:absolute;left:-11111px;width:60px;" +
  13771. "margin-top:1px;padding:0;border:0";
  13772. div.style.cssText =
  13773. "position:relative;display:block;box-sizing:border-box;overflow:scroll;" +
  13774. "margin:auto;border:1px;padding:1px;" +
  13775. "width:60%;top:1%";
  13776. documentElement.appendChild( container ).appendChild( div );
  13777. var divStyle = window.getComputedStyle( div );
  13778. pixelPositionVal = divStyle.top !== "1%";
  13779. // Support: Android 4.0 - 4.3 only, Firefox <=3 - 44
  13780. reliableMarginLeftVal = roundPixelMeasures( divStyle.marginLeft ) === 12;
  13781. // Support: Android 4.0 - 4.3 only, Safari <=9.1 - 10.1, iOS <=7.0 - 9.3
  13782. // Some styles come back with percentage values, even though they shouldn't
  13783. div.style.right = "60%";
  13784. pixelBoxStylesVal = roundPixelMeasures( divStyle.right ) === 36;
  13785. // Support: IE 9 - 11 only
  13786. // Detect misreporting of content dimensions for box-sizing:border-box elements
  13787. boxSizingReliableVal = roundPixelMeasures( divStyle.width ) === 36;
  13788. // Support: IE 9 only
  13789. // Detect overflow:scroll screwiness (gh-3699)
  13790. // Support: Chrome <=64
  13791. // Don't get tricked when zoom affects offsetWidth (gh-4029)
  13792. div.style.position = "absolute";
  13793. scrollboxSizeVal = roundPixelMeasures( div.offsetWidth / 3 ) === 12;
  13794. documentElement.removeChild( container );
  13795. // Nullify the div so it wouldn't be stored in the memory and
  13796. // it will also be a sign that checks already performed
  13797. div = null;
  13798. }
  13799. function roundPixelMeasures( measure ) {
  13800. return Math.round( parseFloat( measure ) );
  13801. }
  13802. var pixelPositionVal, boxSizingReliableVal, scrollboxSizeVal, pixelBoxStylesVal,
  13803. reliableMarginLeftVal,
  13804. container = document.createElement( "div" ),
  13805. div = document.createElement( "div" );
  13806. // Finish early in limited (non-browser) environments
  13807. if ( !div.style ) {
  13808. return;
  13809. }
  13810. // Support: IE <=9 - 11 only
  13811. // Style of cloned element affects source element cloned (#8908)
  13812. div.style.backgroundClip = "content-box";
  13813. div.cloneNode( true ).style.backgroundClip = "";
  13814. support.clearCloneStyle = div.style.backgroundClip === "content-box";
  13815. jQuery.extend( support, {
  13816. boxSizingReliable: function() {
  13817. computeStyleTests();
  13818. return boxSizingReliableVal;
  13819. },
  13820. pixelBoxStyles: function() {
  13821. computeStyleTests();
  13822. return pixelBoxStylesVal;
  13823. },
  13824. pixelPosition: function() {
  13825. computeStyleTests();
  13826. return pixelPositionVal;
  13827. },
  13828. reliableMarginLeft: function() {
  13829. computeStyleTests();
  13830. return reliableMarginLeftVal;
  13831. },
  13832. scrollboxSize: function() {
  13833. computeStyleTests();
  13834. return scrollboxSizeVal;
  13835. }
  13836. } );
  13837. } )();
  13838. function curCSS( elem, name, computed ) {
  13839. var width, minWidth, maxWidth, ret,
  13840. // Support: Firefox 51+
  13841. // Retrieving style before computed somehow
  13842. // fixes an issue with getting wrong values
  13843. // on detached elements
  13844. style = elem.style;
  13845. computed = computed || getStyles( elem );
  13846. // getPropertyValue is needed for:
  13847. // .css('filter') (IE 9 only, #12537)
  13848. // .css('--customProperty) (#3144)
  13849. if ( computed ) {
  13850. ret = computed.getPropertyValue( name ) || computed[ name ];
  13851. if ( ret === "" && !isAttached( elem ) ) {
  13852. ret = jQuery.style( elem, name );
  13853. }
  13854. // A tribute to the "awesome hack by Dean Edwards"
  13855. // Android Browser returns percentage for some values,
  13856. // but width seems to be reliably pixels.
  13857. // This is against the CSSOM draft spec:
  13858. // https://drafts.csswg.org/cssom/#resolved-values
  13859. if ( !support.pixelBoxStyles() && rnumnonpx.test( ret ) && rboxStyle.test( name ) ) {
  13860. // Remember the original values
  13861. width = style.width;
  13862. minWidth = style.minWidth;
  13863. maxWidth = style.maxWidth;
  13864. // Put in the new values to get a computed value out
  13865. style.minWidth = style.maxWidth = style.width = ret;
  13866. ret = computed.width;
  13867. // Revert the changed values
  13868. style.width = width;
  13869. style.minWidth = minWidth;
  13870. style.maxWidth = maxWidth;
  13871. }
  13872. }
  13873. return ret !== undefined ?
  13874. // Support: IE <=9 - 11 only
  13875. // IE returns zIndex value as an integer.
  13876. ret + "" :
  13877. ret;
  13878. }
  13879. function addGetHookIf( conditionFn, hookFn ) {
  13880. // Define the hook, we'll check on the first run if it's really needed.
  13881. return {
  13882. get: function() {
  13883. if ( conditionFn() ) {
  13884. // Hook not needed (or it's not possible to use it due
  13885. // to missing dependency), remove it.
  13886. delete this.get;
  13887. return;
  13888. }
  13889. // Hook needed; redefine it so that the support test is not executed again.
  13890. return ( this.get = hookFn ).apply( this, arguments );
  13891. }
  13892. };
  13893. }
  13894. var cssPrefixes = [ "Webkit", "Moz", "ms" ],
  13895. emptyStyle = document.createElement( "div" ).style,
  13896. vendorProps = {};
  13897. // Return a vendor-prefixed property or undefined
  13898. function vendorPropName( name ) {
  13899. // Check for vendor prefixed names
  13900. var capName = name[ 0 ].toUpperCase() + name.slice( 1 ),
  13901. i = cssPrefixes.length;
  13902. while ( i-- ) {
  13903. name = cssPrefixes[ i ] + capName;
  13904. if ( name in emptyStyle ) {
  13905. return name;
  13906. }
  13907. }
  13908. }
  13909. // Return a potentially-mapped jQuery.cssProps or vendor prefixed property
  13910. function finalPropName( name ) {
  13911. var final = jQuery.cssProps[ name ] || vendorProps[ name ];
  13912. if ( final ) {
  13913. return final;
  13914. }
  13915. if ( name in emptyStyle ) {
  13916. return name;
  13917. }
  13918. return vendorProps[ name ] = vendorPropName( name ) || name;
  13919. }
  13920. var
  13921. // Swappable if display is none or starts with table
  13922. // except "table", "table-cell", or "table-caption"
  13923. // See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display
  13924. rdisplayswap = /^(none|table(?!-c[ea]).+)/,
  13925. rcustomProp = /^--/,
  13926. cssShow = { position: "absolute", visibility: "hidden", display: "block" },
  13927. cssNormalTransform = {
  13928. letterSpacing: "0",
  13929. fontWeight: "400"
  13930. };
  13931. function setPositiveNumber( elem, value, subtract ) {
  13932. // Any relative (+/-) values have already been
  13933. // normalized at this point
  13934. var matches = rcssNum.exec( value );
  13935. return matches ?
  13936. // Guard against undefined "subtract", e.g., when used as in cssHooks
  13937. Math.max( 0, matches[ 2 ] - ( subtract || 0 ) ) + ( matches[ 3 ] || "px" ) :
  13938. value;
  13939. }
  13940. function boxModelAdjustment( elem, dimension, box, isBorderBox, styles, computedVal ) {
  13941. var i = dimension === "width" ? 1 : 0,
  13942. extra = 0,
  13943. delta = 0;
  13944. // Adjustment may not be necessary
  13945. if ( box === ( isBorderBox ? "border" : "content" ) ) {
  13946. return 0;
  13947. }
  13948. for ( ; i < 4; i += 2 ) {
  13949. // Both box models exclude margin
  13950. if ( box === "margin" ) {
  13951. delta += jQuery.css( elem, box + cssExpand[ i ], true, styles );
  13952. }
  13953. // If we get here with a content-box, we're seeking "padding" or "border" or "margin"
  13954. if ( !isBorderBox ) {
  13955. // Add padding
  13956. delta += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
  13957. // For "border" or "margin", add border
  13958. if ( box !== "padding" ) {
  13959. delta += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  13960. // But still keep track of it otherwise
  13961. } else {
  13962. extra += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  13963. }
  13964. // If we get here with a border-box (content + padding + border), we're seeking "content" or
  13965. // "padding" or "margin"
  13966. } else {
  13967. // For "content", subtract padding
  13968. if ( box === "content" ) {
  13969. delta -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
  13970. }
  13971. // For "content" or "padding", subtract border
  13972. if ( box !== "margin" ) {
  13973. delta -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  13974. }
  13975. }
  13976. }
  13977. // Account for positive content-box scroll gutter when requested by providing computedVal
  13978. if ( !isBorderBox && computedVal >= 0 ) {
  13979. // offsetWidth/offsetHeight is a rounded sum of content, padding, scroll gutter, and border
  13980. // Assuming integer scroll gutter, subtract the rest and round down
  13981. delta += Math.max( 0, Math.ceil(
  13982. elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] -
  13983. computedVal -
  13984. delta -
  13985. extra -
  13986. 0.5
  13987. // If offsetWidth/offsetHeight is unknown, then we can't determine content-box scroll gutter
  13988. // Use an explicit zero to avoid NaN (gh-3964)
  13989. ) ) || 0;
  13990. }
  13991. return delta;
  13992. }
  13993. function getWidthOrHeight( elem, dimension, extra ) {
  13994. // Start with computed style
  13995. var styles = getStyles( elem ),
  13996. // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-4322).
  13997. // Fake content-box until we know it's needed to know the true value.
  13998. boxSizingNeeded = !support.boxSizingReliable() || extra,
  13999. isBorderBox = boxSizingNeeded &&
  14000. jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
  14001. valueIsBorderBox = isBorderBox,
  14002. val = curCSS( elem, dimension, styles ),
  14003. offsetProp = "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 );
  14004. // Support: Firefox <=54
  14005. // Return a confounding non-pixel value or feign ignorance, as appropriate.
  14006. if ( rnumnonpx.test( val ) ) {
  14007. if ( !extra ) {
  14008. return val;
  14009. }
  14010. val = "auto";
  14011. }
  14012. // Fall back to offsetWidth/offsetHeight when value is "auto"
  14013. // This happens for inline elements with no explicit setting (gh-3571)
  14014. // Support: Android <=4.1 - 4.3 only
  14015. // Also use offsetWidth/offsetHeight for misreported inline dimensions (gh-3602)
  14016. // Support: IE 9-11 only
  14017. // Also use offsetWidth/offsetHeight for when box sizing is unreliable
  14018. // We use getClientRects() to check for hidden/disconnected.
  14019. // In those cases, the computed value can be trusted to be border-box
  14020. if ( ( !support.boxSizingReliable() && isBorderBox ||
  14021. val === "auto" ||
  14022. !parseFloat( val ) && jQuery.css( elem, "display", false, styles ) === "inline" ) &&
  14023. elem.getClientRects().length ) {
  14024. isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box";
  14025. // Where available, offsetWidth/offsetHeight approximate border box dimensions.
  14026. // Where not available (e.g., SVG), assume unreliable box-sizing and interpret the
  14027. // retrieved value as a content box dimension.
  14028. valueIsBorderBox = offsetProp in elem;
  14029. if ( valueIsBorderBox ) {
  14030. val = elem[ offsetProp ];
  14031. }
  14032. }
  14033. // Normalize "" and auto
  14034. val = parseFloat( val ) || 0;
  14035. // Adjust for the element's box model
  14036. return ( val +
  14037. boxModelAdjustment(
  14038. elem,
  14039. dimension,
  14040. extra || ( isBorderBox ? "border" : "content" ),
  14041. valueIsBorderBox,
  14042. styles,
  14043. // Provide the current computed size to request scroll gutter calculation (gh-3589)
  14044. val
  14045. )
  14046. ) + "px";
  14047. }
  14048. jQuery.extend( {
  14049. // Add in style property hooks for overriding the default
  14050. // behavior of getting and setting a style property
  14051. cssHooks: {
  14052. opacity: {
  14053. get: function( elem, computed ) {
  14054. if ( computed ) {
  14055. // We should always get a number back from opacity
  14056. var ret = curCSS( elem, "opacity" );
  14057. return ret === "" ? "1" : ret;
  14058. }
  14059. }
  14060. }
  14061. },
  14062. // Don't automatically add "px" to these possibly-unitless properties
  14063. cssNumber: {
  14064. "animationIterationCount": true,
  14065. "columnCount": true,
  14066. "fillOpacity": true,
  14067. "flexGrow": true,
  14068. "flexShrink": true,
  14069. "fontWeight": true,
  14070. "gridArea": true,
  14071. "gridColumn": true,
  14072. "gridColumnEnd": true,
  14073. "gridColumnStart": true,
  14074. "gridRow": true,
  14075. "gridRowEnd": true,
  14076. "gridRowStart": true,
  14077. "lineHeight": true,
  14078. "opacity": true,
  14079. "order": true,
  14080. "orphans": true,
  14081. "widows": true,
  14082. "zIndex": true,
  14083. "zoom": true
  14084. },
  14085. // Add in properties whose names you wish to fix before
  14086. // setting or getting the value
  14087. cssProps: {},
  14088. // Get and set the style property on a DOM Node
  14089. style: function( elem, name, value, extra ) {
  14090. // Don't set styles on text and comment nodes
  14091. if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {
  14092. return;
  14093. }
  14094. // Make sure that we're working with the right name
  14095. var ret, type, hooks,
  14096. origName = camelCase( name ),
  14097. isCustomProp = rcustomProp.test( name ),
  14098. style = elem.style;
  14099. // Make sure that we're working with the right name. We don't
  14100. // want to query the value if it is a CSS custom property
  14101. // since they are user-defined.
  14102. if ( !isCustomProp ) {
  14103. name = finalPropName( origName );
  14104. }
  14105. // Gets hook for the prefixed version, then unprefixed version
  14106. hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
  14107. // Check if we're setting a value
  14108. if ( value !== undefined ) {
  14109. type = typeof value;
  14110. // Convert "+=" or "-=" to relative numbers (#7345)
  14111. if ( type === "string" && ( ret = rcssNum.exec( value ) ) && ret[ 1 ] ) {
  14112. value = adjustCSS( elem, name, ret );
  14113. // Fixes bug #9237
  14114. type = "number";
  14115. }
  14116. // Make sure that null and NaN values aren't set (#7116)
  14117. if ( value == null || value !== value ) {
  14118. return;
  14119. }
  14120. // If a number was passed in, add the unit (except for certain CSS properties)
  14121. // The isCustomProp check can be removed in jQuery 4.0 when we only auto-append
  14122. // "px" to a few hardcoded values.
  14123. if ( type === "number" && !isCustomProp ) {
  14124. value += ret && ret[ 3 ] || ( jQuery.cssNumber[ origName ] ? "" : "px" );
  14125. }
  14126. // background-* props affect original clone's values
  14127. if ( !support.clearCloneStyle && value === "" && name.indexOf( "background" ) === 0 ) {
  14128. style[ name ] = "inherit";
  14129. }
  14130. // If a hook was provided, use that value, otherwise just set the specified value
  14131. if ( !hooks || !( "set" in hooks ) ||
  14132. ( value = hooks.set( elem, value, extra ) ) !== undefined ) {
  14133. if ( isCustomProp ) {
  14134. style.setProperty( name, value );
  14135. } else {
  14136. style[ name ] = value;
  14137. }
  14138. }
  14139. } else {
  14140. // If a hook was provided get the non-computed value from there
  14141. if ( hooks && "get" in hooks &&
  14142. ( ret = hooks.get( elem, false, extra ) ) !== undefined ) {
  14143. return ret;
  14144. }
  14145. // Otherwise just get the value from the style object
  14146. return style[ name ];
  14147. }
  14148. },
  14149. css: function( elem, name, extra, styles ) {
  14150. var val, num, hooks,
  14151. origName = camelCase( name ),
  14152. isCustomProp = rcustomProp.test( name );
  14153. // Make sure that we're working with the right name. We don't
  14154. // want to modify the value if it is a CSS custom property
  14155. // since they are user-defined.
  14156. if ( !isCustomProp ) {
  14157. name = finalPropName( origName );
  14158. }
  14159. // Try prefixed name followed by the unprefixed name
  14160. hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
  14161. // If a hook was provided get the computed value from there
  14162. if ( hooks && "get" in hooks ) {
  14163. val = hooks.get( elem, true, extra );
  14164. }
  14165. // Otherwise, if a way to get the computed value exists, use that
  14166. if ( val === undefined ) {
  14167. val = curCSS( elem, name, styles );
  14168. }
  14169. // Convert "normal" to computed value
  14170. if ( val === "normal" && name in cssNormalTransform ) {
  14171. val = cssNormalTransform[ name ];
  14172. }
  14173. // Make numeric if forced or a qualifier was provided and val looks numeric
  14174. if ( extra === "" || extra ) {
  14175. num = parseFloat( val );
  14176. return extra === true || isFinite( num ) ? num || 0 : val;
  14177. }
  14178. return val;
  14179. }
  14180. } );
  14181. jQuery.each( [ "height", "width" ], function( i, dimension ) {
  14182. jQuery.cssHooks[ dimension ] = {
  14183. get: function( elem, computed, extra ) {
  14184. if ( computed ) {
  14185. // Certain elements can have dimension info if we invisibly show them
  14186. // but it must have a current display style that would benefit
  14187. return rdisplayswap.test( jQuery.css( elem, "display" ) ) &&
  14188. // Support: Safari 8+
  14189. // Table columns in Safari have non-zero offsetWidth & zero
  14190. // getBoundingClientRect().width unless display is changed.
  14191. // Support: IE <=11 only
  14192. // Running getBoundingClientRect on a disconnected node
  14193. // in IE throws an error.
  14194. ( !elem.getClientRects().length || !elem.getBoundingClientRect().width ) ?
  14195. swap( elem, cssShow, function() {
  14196. return getWidthOrHeight( elem, dimension, extra );
  14197. } ) :
  14198. getWidthOrHeight( elem, dimension, extra );
  14199. }
  14200. },
  14201. set: function( elem, value, extra ) {
  14202. var matches,
  14203. styles = getStyles( elem ),
  14204. // Only read styles.position if the test has a chance to fail
  14205. // to avoid forcing a reflow.
  14206. scrollboxSizeBuggy = !support.scrollboxSize() &&
  14207. styles.position === "absolute",
  14208. // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-3991)
  14209. boxSizingNeeded = scrollboxSizeBuggy || extra,
  14210. isBorderBox = boxSizingNeeded &&
  14211. jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
  14212. subtract = extra ?
  14213. boxModelAdjustment(
  14214. elem,
  14215. dimension,
  14216. extra,
  14217. isBorderBox,
  14218. styles
  14219. ) :
  14220. 0;
  14221. // Account for unreliable border-box dimensions by comparing offset* to computed and
  14222. // faking a content-box to get border and padding (gh-3699)
  14223. if ( isBorderBox && scrollboxSizeBuggy ) {
  14224. subtract -= Math.ceil(
  14225. elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] -
  14226. parseFloat( styles[ dimension ] ) -
  14227. boxModelAdjustment( elem, dimension, "border", false, styles ) -
  14228. 0.5
  14229. );
  14230. }
  14231. // Convert to pixels if value adjustment is needed
  14232. if ( subtract && ( matches = rcssNum.exec( value ) ) &&
  14233. ( matches[ 3 ] || "px" ) !== "px" ) {
  14234. elem.style[ dimension ] = value;
  14235. value = jQuery.css( elem, dimension );
  14236. }
  14237. return setPositiveNumber( elem, value, subtract );
  14238. }
  14239. };
  14240. } );
  14241. jQuery.cssHooks.marginLeft = addGetHookIf( support.reliableMarginLeft,
  14242. function( elem, computed ) {
  14243. if ( computed ) {
  14244. return ( parseFloat( curCSS( elem, "marginLeft" ) ) ||
  14245. elem.getBoundingClientRect().left -
  14246. swap( elem, { marginLeft: 0 }, function() {
  14247. return elem.getBoundingClientRect().left;
  14248. } )
  14249. ) + "px";
  14250. }
  14251. }
  14252. );
  14253. // These hooks are used by animate to expand properties
  14254. jQuery.each( {
  14255. margin: "",
  14256. padding: "",
  14257. border: "Width"
  14258. }, function( prefix, suffix ) {
  14259. jQuery.cssHooks[ prefix + suffix ] = {
  14260. expand: function( value ) {
  14261. var i = 0,
  14262. expanded = {},
  14263. // Assumes a single number if not a string
  14264. parts = typeof value === "string" ? value.split( " " ) : [ value ];
  14265. for ( ; i < 4; i++ ) {
  14266. expanded[ prefix + cssExpand[ i ] + suffix ] =
  14267. parts[ i ] || parts[ i - 2 ] || parts[ 0 ];
  14268. }
  14269. return expanded;
  14270. }
  14271. };
  14272. if ( prefix !== "margin" ) {
  14273. jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber;
  14274. }
  14275. } );
  14276. jQuery.fn.extend( {
  14277. css: function( name, value ) {
  14278. return access( this, function( elem, name, value ) {
  14279. var styles, len,
  14280. map = {},
  14281. i = 0;
  14282. if ( Array.isArray( name ) ) {
  14283. styles = getStyles( elem );
  14284. len = name.length;
  14285. for ( ; i < len; i++ ) {
  14286. map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles );
  14287. }
  14288. return map;
  14289. }
  14290. return value !== undefined ?
  14291. jQuery.style( elem, name, value ) :
  14292. jQuery.css( elem, name );
  14293. }, name, value, arguments.length > 1 );
  14294. }
  14295. } );
  14296. function Tween( elem, options, prop, end, easing ) {
  14297. return new Tween.prototype.init( elem, options, prop, end, easing );
  14298. }
  14299. jQuery.Tween = Tween;
  14300. Tween.prototype = {
  14301. constructor: Tween,
  14302. init: function( elem, options, prop, end, easing, unit ) {
  14303. this.elem = elem;
  14304. this.prop = prop;
  14305. this.easing = easing || jQuery.easing._default;
  14306. this.options = options;
  14307. this.start = this.now = this.cur();
  14308. this.end = end;
  14309. this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" );
  14310. },
  14311. cur: function() {
  14312. var hooks = Tween.propHooks[ this.prop ];
  14313. return hooks && hooks.get ?
  14314. hooks.get( this ) :
  14315. Tween.propHooks._default.get( this );
  14316. },
  14317. run: function( percent ) {
  14318. var eased,
  14319. hooks = Tween.propHooks[ this.prop ];
  14320. if ( this.options.duration ) {
  14321. this.pos = eased = jQuery.easing[ this.easing ](
  14322. percent, this.options.duration * percent, 0, 1, this.options.duration
  14323. );
  14324. } else {
  14325. this.pos = eased = percent;
  14326. }
  14327. this.now = ( this.end - this.start ) * eased + this.start;
  14328. if ( this.options.step ) {
  14329. this.options.step.call( this.elem, this.now, this );
  14330. }
  14331. if ( hooks && hooks.set ) {
  14332. hooks.set( this );
  14333. } else {
  14334. Tween.propHooks._default.set( this );
  14335. }
  14336. return this;
  14337. }
  14338. };
  14339. Tween.prototype.init.prototype = Tween.prototype;
  14340. Tween.propHooks = {
  14341. _default: {
  14342. get: function( tween ) {
  14343. var result;
  14344. // Use a property on the element directly when it is not a DOM element,
  14345. // or when there is no matching style property that exists.
  14346. if ( tween.elem.nodeType !== 1 ||
  14347. tween.elem[ tween.prop ] != null && tween.elem.style[ tween.prop ] == null ) {
  14348. return tween.elem[ tween.prop ];
  14349. }
  14350. // Passing an empty string as a 3rd parameter to .css will automatically
  14351. // attempt a parseFloat and fallback to a string if the parse fails.
  14352. // Simple values such as "10px" are parsed to Float;
  14353. // complex values such as "rotate(1rad)" are returned as-is.
  14354. result = jQuery.css( tween.elem, tween.prop, "" );
  14355. // Empty strings, null, undefined and "auto" are converted to 0.
  14356. return !result || result === "auto" ? 0 : result;
  14357. },
  14358. set: function( tween ) {
  14359. // Use step hook for back compat.
  14360. // Use cssHook if its there.
  14361. // Use .style if available and use plain properties where available.
  14362. if ( jQuery.fx.step[ tween.prop ] ) {
  14363. jQuery.fx.step[ tween.prop ]( tween );
  14364. } else if ( tween.elem.nodeType === 1 && (
  14365. jQuery.cssHooks[ tween.prop ] ||
  14366. tween.elem.style[ finalPropName( tween.prop ) ] != null ) ) {
  14367. jQuery.style( tween.elem, tween.prop, tween.now + tween.unit );
  14368. } else {
  14369. tween.elem[ tween.prop ] = tween.now;
  14370. }
  14371. }
  14372. }
  14373. };
  14374. // Support: IE <=9 only
  14375. // Panic based approach to setting things on disconnected nodes
  14376. Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = {
  14377. set: function( tween ) {
  14378. if ( tween.elem.nodeType && tween.elem.parentNode ) {
  14379. tween.elem[ tween.prop ] = tween.now;
  14380. }
  14381. }
  14382. };
  14383. jQuery.easing = {
  14384. linear: function( p ) {
  14385. return p;
  14386. },
  14387. swing: function( p ) {
  14388. return 0.5 - Math.cos( p * Math.PI ) / 2;
  14389. },
  14390. _default: "swing"
  14391. };
  14392. jQuery.fx = Tween.prototype.init;
  14393. // Back compat <1.8 extension point
  14394. jQuery.fx.step = {};
  14395. var
  14396. fxNow, inProgress,
  14397. rfxtypes = /^(?:toggle|show|hide)$/,
  14398. rrun = /queueHooks$/;
  14399. function schedule() {
  14400. if ( inProgress ) {
  14401. if ( document.hidden === false && window.requestAnimationFrame ) {
  14402. window.requestAnimationFrame( schedule );
  14403. } else {
  14404. window.setTimeout( schedule, jQuery.fx.interval );
  14405. }
  14406. jQuery.fx.tick();
  14407. }
  14408. }
  14409. // Animations created synchronously will run synchronously
  14410. function createFxNow() {
  14411. window.setTimeout( function() {
  14412. fxNow = undefined;
  14413. } );
  14414. return ( fxNow = Date.now() );
  14415. }
  14416. // Generate parameters to create a standard animation
  14417. function genFx( type, includeWidth ) {
  14418. var which,
  14419. i = 0,
  14420. attrs = { height: type };
  14421. // If we include width, step value is 1 to do all cssExpand values,
  14422. // otherwise step value is 2 to skip over Left and Right
  14423. includeWidth = includeWidth ? 1 : 0;
  14424. for ( ; i < 4; i += 2 - includeWidth ) {
  14425. which = cssExpand[ i ];
  14426. attrs[ "margin" + which ] = attrs[ "padding" + which ] = type;
  14427. }
  14428. if ( includeWidth ) {
  14429. attrs.opacity = attrs.width = type;
  14430. }
  14431. return attrs;
  14432. }
  14433. function createTween( value, prop, animation ) {
  14434. var tween,
  14435. collection = ( Animation.tweeners[ prop ] || [] ).concat( Animation.tweeners[ "*" ] ),
  14436. index = 0,
  14437. length = collection.length;
  14438. for ( ; index < length; index++ ) {
  14439. if ( ( tween = collection[ index ].call( animation, prop, value ) ) ) {
  14440. // We're done with this property
  14441. return tween;
  14442. }
  14443. }
  14444. }
  14445. function defaultPrefilter( elem, props, opts ) {
  14446. var prop, value, toggle, hooks, oldfire, propTween, restoreDisplay, display,
  14447. isBox = "width" in props || "height" in props,
  14448. anim = this,
  14449. orig = {},
  14450. style = elem.style,
  14451. hidden = elem.nodeType && isHiddenWithinTree( elem ),
  14452. dataShow = dataPriv.get( elem, "fxshow" );
  14453. // Queue-skipping animations hijack the fx hooks
  14454. if ( !opts.queue ) {
  14455. hooks = jQuery._queueHooks( elem, "fx" );
  14456. if ( hooks.unqueued == null ) {
  14457. hooks.unqueued = 0;
  14458. oldfire = hooks.empty.fire;
  14459. hooks.empty.fire = function() {
  14460. if ( !hooks.unqueued ) {
  14461. oldfire();
  14462. }
  14463. };
  14464. }
  14465. hooks.unqueued++;
  14466. anim.always( function() {
  14467. // Ensure the complete handler is called before this completes
  14468. anim.always( function() {
  14469. hooks.unqueued--;
  14470. if ( !jQuery.queue( elem, "fx" ).length ) {
  14471. hooks.empty.fire();
  14472. }
  14473. } );
  14474. } );
  14475. }
  14476. // Detect show/hide animations
  14477. for ( prop in props ) {
  14478. value = props[ prop ];
  14479. if ( rfxtypes.test( value ) ) {
  14480. delete props[ prop ];
  14481. toggle = toggle || value === "toggle";
  14482. if ( value === ( hidden ? "hide" : "show" ) ) {
  14483. // Pretend to be hidden if this is a "show" and
  14484. // there is still data from a stopped show/hide
  14485. if ( value === "show" && dataShow && dataShow[ prop ] !== undefined ) {
  14486. hidden = true;
  14487. // Ignore all other no-op show/hide data
  14488. } else {
  14489. continue;
  14490. }
  14491. }
  14492. orig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop );
  14493. }
  14494. }
  14495. // Bail out if this is a no-op like .hide().hide()
  14496. propTween = !jQuery.isEmptyObject( props );
  14497. if ( !propTween && jQuery.isEmptyObject( orig ) ) {
  14498. return;
  14499. }
  14500. // Restrict "overflow" and "display" styles during box animations
  14501. if ( isBox && elem.nodeType === 1 ) {
  14502. // Support: IE <=9 - 11, Edge 12 - 15
  14503. // Record all 3 overflow attributes because IE does not infer the shorthand
  14504. // from identically-valued overflowX and overflowY and Edge just mirrors
  14505. // the overflowX value there.
  14506. opts.overflow = [ style.overflow, style.overflowX, style.overflowY ];
  14507. // Identify a display type, preferring old show/hide data over the CSS cascade
  14508. restoreDisplay = dataShow && dataShow.display;
  14509. if ( restoreDisplay == null ) {
  14510. restoreDisplay = dataPriv.get( elem, "display" );
  14511. }
  14512. display = jQuery.css( elem, "display" );
  14513. if ( display === "none" ) {
  14514. if ( restoreDisplay ) {
  14515. display = restoreDisplay;
  14516. } else {
  14517. // Get nonempty value(s) by temporarily forcing visibility
  14518. showHide( [ elem ], true );
  14519. restoreDisplay = elem.style.display || restoreDisplay;
  14520. display = jQuery.css( elem, "display" );
  14521. showHide( [ elem ] );
  14522. }
  14523. }
  14524. // Animate inline elements as inline-block
  14525. if ( display === "inline" || display === "inline-block" && restoreDisplay != null ) {
  14526. if ( jQuery.css( elem, "float" ) === "none" ) {
  14527. // Restore the original display value at the end of pure show/hide animations
  14528. if ( !propTween ) {
  14529. anim.done( function() {
  14530. style.display = restoreDisplay;
  14531. } );
  14532. if ( restoreDisplay == null ) {
  14533. display = style.display;
  14534. restoreDisplay = display === "none" ? "" : display;
  14535. }
  14536. }
  14537. style.display = "inline-block";
  14538. }
  14539. }
  14540. }
  14541. if ( opts.overflow ) {
  14542. style.overflow = "hidden";
  14543. anim.always( function() {
  14544. style.overflow = opts.overflow[ 0 ];
  14545. style.overflowX = opts.overflow[ 1 ];
  14546. style.overflowY = opts.overflow[ 2 ];
  14547. } );
  14548. }
  14549. // Implement show/hide animations
  14550. propTween = false;
  14551. for ( prop in orig ) {
  14552. // General show/hide setup for this element animation
  14553. if ( !propTween ) {
  14554. if ( dataShow ) {
  14555. if ( "hidden" in dataShow ) {
  14556. hidden = dataShow.hidden;
  14557. }
  14558. } else {
  14559. dataShow = dataPriv.access( elem, "fxshow", { display: restoreDisplay } );
  14560. }
  14561. // Store hidden/visible for toggle so `.stop().toggle()` "reverses"
  14562. if ( toggle ) {
  14563. dataShow.hidden = !hidden;
  14564. }
  14565. // Show elements before animating them
  14566. if ( hidden ) {
  14567. showHide( [ elem ], true );
  14568. }
  14569. /* eslint-disable no-loop-func */
  14570. anim.done( function() {
  14571. /* eslint-enable no-loop-func */
  14572. // The final step of a "hide" animation is actually hiding the element
  14573. if ( !hidden ) {
  14574. showHide( [ elem ] );
  14575. }
  14576. dataPriv.remove( elem, "fxshow" );
  14577. for ( prop in orig ) {
  14578. jQuery.style( elem, prop, orig[ prop ] );
  14579. }
  14580. } );
  14581. }
  14582. // Per-property setup
  14583. propTween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim );
  14584. if ( !( prop in dataShow ) ) {
  14585. dataShow[ prop ] = propTween.start;
  14586. if ( hidden ) {
  14587. propTween.end = propTween.start;
  14588. propTween.start = 0;
  14589. }
  14590. }
  14591. }
  14592. }
  14593. function propFilter( props, specialEasing ) {
  14594. var index, name, easing, value, hooks;
  14595. // camelCase, specialEasing and expand cssHook pass
  14596. for ( index in props ) {
  14597. name = camelCase( index );
  14598. easing = specialEasing[ name ];
  14599. value = props[ index ];
  14600. if ( Array.isArray( value ) ) {
  14601. easing = value[ 1 ];
  14602. value = props[ index ] = value[ 0 ];
  14603. }
  14604. if ( index !== name ) {
  14605. props[ name ] = value;
  14606. delete props[ index ];
  14607. }
  14608. hooks = jQuery.cssHooks[ name ];
  14609. if ( hooks && "expand" in hooks ) {
  14610. value = hooks.expand( value );
  14611. delete props[ name ];
  14612. // Not quite $.extend, this won't overwrite existing keys.
  14613. // Reusing 'index' because we have the correct "name"
  14614. for ( index in value ) {
  14615. if ( !( index in props ) ) {
  14616. props[ index ] = value[ index ];
  14617. specialEasing[ index ] = easing;
  14618. }
  14619. }
  14620. } else {
  14621. specialEasing[ name ] = easing;
  14622. }
  14623. }
  14624. }
  14625. function Animation( elem, properties, options ) {
  14626. var result,
  14627. stopped,
  14628. index = 0,
  14629. length = Animation.prefilters.length,
  14630. deferred = jQuery.Deferred().always( function() {
  14631. // Don't match elem in the :animated selector
  14632. delete tick.elem;
  14633. } ),
  14634. tick = function() {
  14635. if ( stopped ) {
  14636. return false;
  14637. }
  14638. var currentTime = fxNow || createFxNow(),
  14639. remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ),
  14640. // Support: Android 2.3 only
  14641. // Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (#12497)
  14642. temp = remaining / animation.duration || 0,
  14643. percent = 1 - temp,
  14644. index = 0,
  14645. length = animation.tweens.length;
  14646. for ( ; index < length; index++ ) {
  14647. animation.tweens[ index ].run( percent );
  14648. }
  14649. deferred.notifyWith( elem, [ animation, percent, remaining ] );
  14650. // If there's more to do, yield
  14651. if ( percent < 1 && length ) {
  14652. return remaining;
  14653. }
  14654. // If this was an empty animation, synthesize a final progress notification
  14655. if ( !length ) {
  14656. deferred.notifyWith( elem, [ animation, 1, 0 ] );
  14657. }
  14658. // Resolve the animation and report its conclusion
  14659. deferred.resolveWith( elem, [ animation ] );
  14660. return false;
  14661. },
  14662. animation = deferred.promise( {
  14663. elem: elem,
  14664. props: jQuery.extend( {}, properties ),
  14665. opts: jQuery.extend( true, {
  14666. specialEasing: {},
  14667. easing: jQuery.easing._default
  14668. }, options ),
  14669. originalProperties: properties,
  14670. originalOptions: options,
  14671. startTime: fxNow || createFxNow(),
  14672. duration: options.duration,
  14673. tweens: [],
  14674. createTween: function( prop, end ) {
  14675. var tween = jQuery.Tween( elem, animation.opts, prop, end,
  14676. animation.opts.specialEasing[ prop ] || animation.opts.easing );
  14677. animation.tweens.push( tween );
  14678. return tween;
  14679. },
  14680. stop: function( gotoEnd ) {
  14681. var index = 0,
  14682. // If we are going to the end, we want to run all the tweens
  14683. // otherwise we skip this part
  14684. length = gotoEnd ? animation.tweens.length : 0;
  14685. if ( stopped ) {
  14686. return this;
  14687. }
  14688. stopped = true;
  14689. for ( ; index < length; index++ ) {
  14690. animation.tweens[ index ].run( 1 );
  14691. }
  14692. // Resolve when we played the last frame; otherwise, reject
  14693. if ( gotoEnd ) {
  14694. deferred.notifyWith( elem, [ animation, 1, 0 ] );
  14695. deferred.resolveWith( elem, [ animation, gotoEnd ] );
  14696. } else {
  14697. deferred.rejectWith( elem, [ animation, gotoEnd ] );
  14698. }
  14699. return this;
  14700. }
  14701. } ),
  14702. props = animation.props;
  14703. propFilter( props, animation.opts.specialEasing );
  14704. for ( ; index < length; index++ ) {
  14705. result = Animation.prefilters[ index ].call( animation, elem, props, animation.opts );
  14706. if ( result ) {
  14707. if ( isFunction( result.stop ) ) {
  14708. jQuery._queueHooks( animation.elem, animation.opts.queue ).stop =
  14709. result.stop.bind( result );
  14710. }
  14711. return result;
  14712. }
  14713. }
  14714. jQuery.map( props, createTween, animation );
  14715. if ( isFunction( animation.opts.start ) ) {
  14716. animation.opts.start.call( elem, animation );
  14717. }
  14718. // Attach callbacks from options
  14719. animation
  14720. .progress( animation.opts.progress )
  14721. .done( animation.opts.done, animation.opts.complete )
  14722. .fail( animation.opts.fail )
  14723. .always( animation.opts.always );
  14724. jQuery.fx.timer(
  14725. jQuery.extend( tick, {
  14726. elem: elem,
  14727. anim: animation,
  14728. queue: animation.opts.queue
  14729. } )
  14730. );
  14731. return animation;
  14732. }
  14733. jQuery.Animation = jQuery.extend( Animation, {
  14734. tweeners: {
  14735. "*": [ function( prop, value ) {
  14736. var tween = this.createTween( prop, value );
  14737. adjustCSS( tween.elem, prop, rcssNum.exec( value ), tween );
  14738. return tween;
  14739. } ]
  14740. },
  14741. tweener: function( props, callback ) {
  14742. if ( isFunction( props ) ) {
  14743. callback = props;
  14744. props = [ "*" ];
  14745. } else {
  14746. props = props.match( rnothtmlwhite );
  14747. }
  14748. var prop,
  14749. index = 0,
  14750. length = props.length;
  14751. for ( ; index < length; index++ ) {
  14752. prop = props[ index ];
  14753. Animation.tweeners[ prop ] = Animation.tweeners[ prop ] || [];
  14754. Animation.tweeners[ prop ].unshift( callback );
  14755. }
  14756. },
  14757. prefilters: [ defaultPrefilter ],
  14758. prefilter: function( callback, prepend ) {
  14759. if ( prepend ) {
  14760. Animation.prefilters.unshift( callback );
  14761. } else {
  14762. Animation.prefilters.push( callback );
  14763. }
  14764. }
  14765. } );
  14766. jQuery.speed = function( speed, easing, fn ) {
  14767. var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : {
  14768. complete: fn || !fn && easing ||
  14769. isFunction( speed ) && speed,
  14770. duration: speed,
  14771. easing: fn && easing || easing && !isFunction( easing ) && easing
  14772. };
  14773. // Go to the end state if fx are off
  14774. if ( jQuery.fx.off ) {
  14775. opt.duration = 0;
  14776. } else {
  14777. if ( typeof opt.duration !== "number" ) {
  14778. if ( opt.duration in jQuery.fx.speeds ) {
  14779. opt.duration = jQuery.fx.speeds[ opt.duration ];
  14780. } else {
  14781. opt.duration = jQuery.fx.speeds._default;
  14782. }
  14783. }
  14784. }
  14785. // Normalize opt.queue - true/undefined/null -> "fx"
  14786. if ( opt.queue == null || opt.queue === true ) {
  14787. opt.queue = "fx";
  14788. }
  14789. // Queueing
  14790. opt.old = opt.complete;
  14791. opt.complete = function() {
  14792. if ( isFunction( opt.old ) ) {
  14793. opt.old.call( this );
  14794. }
  14795. if ( opt.queue ) {
  14796. jQuery.dequeue( this, opt.queue );
  14797. }
  14798. };
  14799. return opt;
  14800. };
  14801. jQuery.fn.extend( {
  14802. fadeTo: function( speed, to, easing, callback ) {
  14803. // Show any hidden elements after setting opacity to 0
  14804. return this.filter( isHiddenWithinTree ).css( "opacity", 0 ).show()
  14805. // Animate to the value specified
  14806. .end().animate( { opacity: to }, speed, easing, callback );
  14807. },
  14808. animate: function( prop, speed, easing, callback ) {
  14809. var empty = jQuery.isEmptyObject( prop ),
  14810. optall = jQuery.speed( speed, easing, callback ),
  14811. doAnimation = function() {
  14812. // Operate on a copy of prop so per-property easing won't be lost
  14813. var anim = Animation( this, jQuery.extend( {}, prop ), optall );
  14814. // Empty animations, or finishing resolves immediately
  14815. if ( empty || dataPriv.get( this, "finish" ) ) {
  14816. anim.stop( true );
  14817. }
  14818. };
  14819. doAnimation.finish = doAnimation;
  14820. return empty || optall.queue === false ?
  14821. this.each( doAnimation ) :
  14822. this.queue( optall.queue, doAnimation );
  14823. },
  14824. stop: function( type, clearQueue, gotoEnd ) {
  14825. var stopQueue = function( hooks ) {
  14826. var stop = hooks.stop;
  14827. delete hooks.stop;
  14828. stop( gotoEnd );
  14829. };
  14830. if ( typeof type !== "string" ) {
  14831. gotoEnd = clearQueue;
  14832. clearQueue = type;
  14833. type = undefined;
  14834. }
  14835. if ( clearQueue && type !== false ) {
  14836. this.queue( type || "fx", [] );
  14837. }
  14838. return this.each( function() {
  14839. var dequeue = true,
  14840. index = type != null && type + "queueHooks",
  14841. timers = jQuery.timers,
  14842. data = dataPriv.get( this );
  14843. if ( index ) {
  14844. if ( data[ index ] && data[ index ].stop ) {
  14845. stopQueue( data[ index ] );
  14846. }
  14847. } else {
  14848. for ( index in data ) {
  14849. if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) {
  14850. stopQueue( data[ index ] );
  14851. }
  14852. }
  14853. }
  14854. for ( index = timers.length; index--; ) {
  14855. if ( timers[ index ].elem === this &&
  14856. ( type == null || timers[ index ].queue === type ) ) {
  14857. timers[ index ].anim.stop( gotoEnd );
  14858. dequeue = false;
  14859. timers.splice( index, 1 );
  14860. }
  14861. }
  14862. // Start the next in the queue if the last step wasn't forced.
  14863. // Timers currently will call their complete callbacks, which
  14864. // will dequeue but only if they were gotoEnd.
  14865. if ( dequeue || !gotoEnd ) {
  14866. jQuery.dequeue( this, type );
  14867. }
  14868. } );
  14869. },
  14870. finish: function( type ) {
  14871. if ( type !== false ) {
  14872. type = type || "fx";
  14873. }
  14874. return this.each( function() {
  14875. var index,
  14876. data = dataPriv.get( this ),
  14877. queue = data[ type + "queue" ],
  14878. hooks = data[ type + "queueHooks" ],
  14879. timers = jQuery.timers,
  14880. length = queue ? queue.length : 0;
  14881. // Enable finishing flag on private data
  14882. data.finish = true;
  14883. // Empty the queue first
  14884. jQuery.queue( this, type, [] );
  14885. if ( hooks && hooks.stop ) {
  14886. hooks.stop.call( this, true );
  14887. }
  14888. // Look for any active animations, and finish them
  14889. for ( index = timers.length; index--; ) {
  14890. if ( timers[ index ].elem === this && timers[ index ].queue === type ) {
  14891. timers[ index ].anim.stop( true );
  14892. timers.splice( index, 1 );
  14893. }
  14894. }
  14895. // Look for any animations in the old queue and finish them
  14896. for ( index = 0; index < length; index++ ) {
  14897. if ( queue[ index ] && queue[ index ].finish ) {
  14898. queue[ index ].finish.call( this );
  14899. }
  14900. }
  14901. // Turn off finishing flag
  14902. delete data.finish;
  14903. } );
  14904. }
  14905. } );
  14906. jQuery.each( [ "toggle", "show", "hide" ], function( i, name ) {
  14907. var cssFn = jQuery.fn[ name ];
  14908. jQuery.fn[ name ] = function( speed, easing, callback ) {
  14909. return speed == null || typeof speed === "boolean" ?
  14910. cssFn.apply( this, arguments ) :
  14911. this.animate( genFx( name, true ), speed, easing, callback );
  14912. };
  14913. } );
  14914. // Generate shortcuts for custom animations
  14915. jQuery.each( {
  14916. slideDown: genFx( "show" ),
  14917. slideUp: genFx( "hide" ),
  14918. slideToggle: genFx( "toggle" ),
  14919. fadeIn: { opacity: "show" },
  14920. fadeOut: { opacity: "hide" },
  14921. fadeToggle: { opacity: "toggle" }
  14922. }, function( name, props ) {
  14923. jQuery.fn[ name ] = function( speed, easing, callback ) {
  14924. return this.animate( props, speed, easing, callback );
  14925. };
  14926. } );
  14927. jQuery.timers = [];
  14928. jQuery.fx.tick = function() {
  14929. var timer,
  14930. i = 0,
  14931. timers = jQuery.timers;
  14932. fxNow = Date.now();
  14933. for ( ; i < timers.length; i++ ) {
  14934. timer = timers[ i ];
  14935. // Run the timer and safely remove it when done (allowing for external removal)
  14936. if ( !timer() && timers[ i ] === timer ) {
  14937. timers.splice( i--, 1 );
  14938. }
  14939. }
  14940. if ( !timers.length ) {
  14941. jQuery.fx.stop();
  14942. }
  14943. fxNow = undefined;
  14944. };
  14945. jQuery.fx.timer = function( timer ) {
  14946. jQuery.timers.push( timer );
  14947. jQuery.fx.start();
  14948. };
  14949. jQuery.fx.interval = 13;
  14950. jQuery.fx.start = function() {
  14951. if ( inProgress ) {
  14952. return;
  14953. }
  14954. inProgress = true;
  14955. schedule();
  14956. };
  14957. jQuery.fx.stop = function() {
  14958. inProgress = null;
  14959. };
  14960. jQuery.fx.speeds = {
  14961. slow: 600,
  14962. fast: 200,
  14963. // Default speed
  14964. _default: 400
  14965. };
  14966. // Based off of the plugin by Clint Helfers, with permission.
  14967. // https://web.archive.org/web/20100324014747/http://blindsignals.com/index.php/2009/07/jquery-delay/
  14968. jQuery.fn.delay = function( time, type ) {
  14969. time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time;
  14970. type = type || "fx";
  14971. return this.queue( type, function( next, hooks ) {
  14972. var timeout = window.setTimeout( next, time );
  14973. hooks.stop = function() {
  14974. window.clearTimeout( timeout );
  14975. };
  14976. } );
  14977. };
  14978. ( function() {
  14979. var input = document.createElement( "input" ),
  14980. select = document.createElement( "select" ),
  14981. opt = select.appendChild( document.createElement( "option" ) );
  14982. input.type = "checkbox";
  14983. // Support: Android <=4.3 only
  14984. // Default value for a checkbox should be "on"
  14985. support.checkOn = input.value !== "";
  14986. // Support: IE <=11 only
  14987. // Must access selectedIndex to make default options select
  14988. support.optSelected = opt.selected;
  14989. // Support: IE <=11 only
  14990. // An input loses its value after becoming a radio
  14991. input = document.createElement( "input" );
  14992. input.value = "t";
  14993. input.type = "radio";
  14994. support.radioValue = input.value === "t";
  14995. } )();
  14996. var boolHook,
  14997. attrHandle = jQuery.expr.attrHandle;
  14998. jQuery.fn.extend( {
  14999. attr: function( name, value ) {
  15000. return access( this, jQuery.attr, name, value, arguments.length > 1 );
  15001. },
  15002. removeAttr: function( name ) {
  15003. return this.each( function() {
  15004. jQuery.removeAttr( this, name );
  15005. } );
  15006. }
  15007. } );
  15008. jQuery.extend( {
  15009. attr: function( elem, name, value ) {
  15010. var ret, hooks,
  15011. nType = elem.nodeType;
  15012. // Don't get/set attributes on text, comment and attribute nodes
  15013. if ( nType === 3 || nType === 8 || nType === 2 ) {
  15014. return;
  15015. }
  15016. // Fallback to prop when attributes are not supported
  15017. if ( typeof elem.getAttribute === "undefined" ) {
  15018. return jQuery.prop( elem, name, value );
  15019. }
  15020. // Attribute hooks are determined by the lowercase version
  15021. // Grab necessary hook if one is defined
  15022. if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
  15023. hooks = jQuery.attrHooks[ name.toLowerCase() ] ||
  15024. ( jQuery.expr.match.bool.test( name ) ? boolHook : undefined );
  15025. }
  15026. if ( value !== undefined ) {
  15027. if ( value === null ) {
  15028. jQuery.removeAttr( elem, name );
  15029. return;
  15030. }
  15031. if ( hooks && "set" in hooks &&
  15032. ( ret = hooks.set( elem, value, name ) ) !== undefined ) {
  15033. return ret;
  15034. }
  15035. elem.setAttribute( name, value + "" );
  15036. return value;
  15037. }
  15038. if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
  15039. return ret;
  15040. }
  15041. ret = jQuery.find.attr( elem, name );
  15042. // Non-existent attributes return null, we normalize to undefined
  15043. return ret == null ? undefined : ret;
  15044. },
  15045. attrHooks: {
  15046. type: {
  15047. set: function( elem, value ) {
  15048. if ( !support.radioValue && value === "radio" &&
  15049. nodeName( elem, "input" ) ) {
  15050. var val = elem.value;
  15051. elem.setAttribute( "type", value );
  15052. if ( val ) {
  15053. elem.value = val;
  15054. }
  15055. return value;
  15056. }
  15057. }
  15058. }
  15059. },
  15060. removeAttr: function( elem, value ) {
  15061. var name,
  15062. i = 0,
  15063. // Attribute names can contain non-HTML whitespace characters
  15064. // https://html.spec.whatwg.org/multipage/syntax.html#attributes-2
  15065. attrNames = value && value.match( rnothtmlwhite );
  15066. if ( attrNames && elem.nodeType === 1 ) {
  15067. while ( ( name = attrNames[ i++ ] ) ) {
  15068. elem.removeAttribute( name );
  15069. }
  15070. }
  15071. }
  15072. } );
  15073. // Hooks for boolean attributes
  15074. boolHook = {
  15075. set: function( elem, value, name ) {
  15076. if ( value === false ) {
  15077. // Remove boolean attributes when set to false
  15078. jQuery.removeAttr( elem, name );
  15079. } else {
  15080. elem.setAttribute( name, name );
  15081. }
  15082. return name;
  15083. }
  15084. };
  15085. jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( i, name ) {
  15086. var getter = attrHandle[ name ] || jQuery.find.attr;
  15087. attrHandle[ name ] = function( elem, name, isXML ) {
  15088. var ret, handle,
  15089. lowercaseName = name.toLowerCase();
  15090. if ( !isXML ) {
  15091. // Avoid an infinite loop by temporarily removing this function from the getter
  15092. handle = attrHandle[ lowercaseName ];
  15093. attrHandle[ lowercaseName ] = ret;
  15094. ret = getter( elem, name, isXML ) != null ?
  15095. lowercaseName :
  15096. null;
  15097. attrHandle[ lowercaseName ] = handle;
  15098. }
  15099. return ret;
  15100. };
  15101. } );
  15102. var rfocusable = /^(?:input|select|textarea|button)$/i,
  15103. rclickable = /^(?:a|area)$/i;
  15104. jQuery.fn.extend( {
  15105. prop: function( name, value ) {
  15106. return access( this, jQuery.prop, name, value, arguments.length > 1 );
  15107. },
  15108. removeProp: function( name ) {
  15109. return this.each( function() {
  15110. delete this[ jQuery.propFix[ name ] || name ];
  15111. } );
  15112. }
  15113. } );
  15114. jQuery.extend( {
  15115. prop: function( elem, name, value ) {
  15116. var ret, hooks,
  15117. nType = elem.nodeType;
  15118. // Don't get/set properties on text, comment and attribute nodes
  15119. if ( nType === 3 || nType === 8 || nType === 2 ) {
  15120. return;
  15121. }
  15122. if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
  15123. // Fix name and attach hooks
  15124. name = jQuery.propFix[ name ] || name;
  15125. hooks = jQuery.propHooks[ name ];
  15126. }
  15127. if ( value !== undefined ) {
  15128. if ( hooks && "set" in hooks &&
  15129. ( ret = hooks.set( elem, value, name ) ) !== undefined ) {
  15130. return ret;
  15131. }
  15132. return ( elem[ name ] = value );
  15133. }
  15134. if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
  15135. return ret;
  15136. }
  15137. return elem[ name ];
  15138. },
  15139. propHooks: {
  15140. tabIndex: {
  15141. get: function( elem ) {
  15142. // Support: IE <=9 - 11 only
  15143. // elem.tabIndex doesn't always return the
  15144. // correct value when it hasn't been explicitly set
  15145. // https://web.archive.org/web/20141116233347/http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
  15146. // Use proper attribute retrieval(#12072)
  15147. var tabindex = jQuery.find.attr( elem, "tabindex" );
  15148. if ( tabindex ) {
  15149. return parseInt( tabindex, 10 );
  15150. }
  15151. if (
  15152. rfocusable.test( elem.nodeName ) ||
  15153. rclickable.test( elem.nodeName ) &&
  15154. elem.href
  15155. ) {
  15156. return 0;
  15157. }
  15158. return -1;
  15159. }
  15160. }
  15161. },
  15162. propFix: {
  15163. "for": "htmlFor",
  15164. "class": "className"
  15165. }
  15166. } );
  15167. // Support: IE <=11 only
  15168. // Accessing the selectedIndex property
  15169. // forces the browser to respect setting selected
  15170. // on the option
  15171. // The getter ensures a default option is selected
  15172. // when in an optgroup
  15173. // eslint rule "no-unused-expressions" is disabled for this code
  15174. // since it considers such accessions noop
  15175. if ( !support.optSelected ) {
  15176. jQuery.propHooks.selected = {
  15177. get: function( elem ) {
  15178. /* eslint no-unused-expressions: "off" */
  15179. var parent = elem.parentNode;
  15180. if ( parent && parent.parentNode ) {
  15181. parent.parentNode.selectedIndex;
  15182. }
  15183. return null;
  15184. },
  15185. set: function( elem ) {
  15186. /* eslint no-unused-expressions: "off" */
  15187. var parent = elem.parentNode;
  15188. if ( parent ) {
  15189. parent.selectedIndex;
  15190. if ( parent.parentNode ) {
  15191. parent.parentNode.selectedIndex;
  15192. }
  15193. }
  15194. }
  15195. };
  15196. }
  15197. jQuery.each( [
  15198. "tabIndex",
  15199. "readOnly",
  15200. "maxLength",
  15201. "cellSpacing",
  15202. "cellPadding",
  15203. "rowSpan",
  15204. "colSpan",
  15205. "useMap",
  15206. "frameBorder",
  15207. "contentEditable"
  15208. ], function() {
  15209. jQuery.propFix[ this.toLowerCase() ] = this;
  15210. } );
  15211. // Strip and collapse whitespace according to HTML spec
  15212. // https://infra.spec.whatwg.org/#strip-and-collapse-ascii-whitespace
  15213. function stripAndCollapse( value ) {
  15214. var tokens = value.match( rnothtmlwhite ) || [];
  15215. return tokens.join( " " );
  15216. }
  15217. function getClass( elem ) {
  15218. return elem.getAttribute && elem.getAttribute( "class" ) || "";
  15219. }
  15220. function classesToArray( value ) {
  15221. if ( Array.isArray( value ) ) {
  15222. return value;
  15223. }
  15224. if ( typeof value === "string" ) {
  15225. return value.match( rnothtmlwhite ) || [];
  15226. }
  15227. return [];
  15228. }
  15229. jQuery.fn.extend( {
  15230. addClass: function( value ) {
  15231. var classes, elem, cur, curValue, clazz, j, finalValue,
  15232. i = 0;
  15233. if ( isFunction( value ) ) {
  15234. return this.each( function( j ) {
  15235. jQuery( this ).addClass( value.call( this, j, getClass( this ) ) );
  15236. } );
  15237. }
  15238. classes = classesToArray( value );
  15239. if ( classes.length ) {
  15240. while ( ( elem = this[ i++ ] ) ) {
  15241. curValue = getClass( elem );
  15242. cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );
  15243. if ( cur ) {
  15244. j = 0;
  15245. while ( ( clazz = classes[ j++ ] ) ) {
  15246. if ( cur.indexOf( " " + clazz + " " ) < 0 ) {
  15247. cur += clazz + " ";
  15248. }
  15249. }
  15250. // Only assign if different to avoid unneeded rendering.
  15251. finalValue = stripAndCollapse( cur );
  15252. if ( curValue !== finalValue ) {
  15253. elem.setAttribute( "class", finalValue );
  15254. }
  15255. }
  15256. }
  15257. }
  15258. return this;
  15259. },
  15260. removeClass: function( value ) {
  15261. var classes, elem, cur, curValue, clazz, j, finalValue,
  15262. i = 0;
  15263. if ( isFunction( value ) ) {
  15264. return this.each( function( j ) {
  15265. jQuery( this ).removeClass( value.call( this, j, getClass( this ) ) );
  15266. } );
  15267. }
  15268. if ( !arguments.length ) {
  15269. return this.attr( "class", "" );
  15270. }
  15271. classes = classesToArray( value );
  15272. if ( classes.length ) {
  15273. while ( ( elem = this[ i++ ] ) ) {
  15274. curValue = getClass( elem );
  15275. // This expression is here for better compressibility (see addClass)
  15276. cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );
  15277. if ( cur ) {
  15278. j = 0;
  15279. while ( ( clazz = classes[ j++ ] ) ) {
  15280. // Remove *all* instances
  15281. while ( cur.indexOf( " " + clazz + " " ) > -1 ) {
  15282. cur = cur.replace( " " + clazz + " ", " " );
  15283. }
  15284. }
  15285. // Only assign if different to avoid unneeded rendering.
  15286. finalValue = stripAndCollapse( cur );
  15287. if ( curValue !== finalValue ) {
  15288. elem.setAttribute( "class", finalValue );
  15289. }
  15290. }
  15291. }
  15292. }
  15293. return this;
  15294. },
  15295. toggleClass: function( value, stateVal ) {
  15296. var type = typeof value,
  15297. isValidValue = type === "string" || Array.isArray( value );
  15298. if ( typeof stateVal === "boolean" && isValidValue ) {
  15299. return stateVal ? this.addClass( value ) : this.removeClass( value );
  15300. }
  15301. if ( isFunction( value ) ) {
  15302. return this.each( function( i ) {
  15303. jQuery( this ).toggleClass(
  15304. value.call( this, i, getClass( this ), stateVal ),
  15305. stateVal
  15306. );
  15307. } );
  15308. }
  15309. return this.each( function() {
  15310. var className, i, self, classNames;
  15311. if ( isValidValue ) {
  15312. // Toggle individual class names
  15313. i = 0;
  15314. self = jQuery( this );
  15315. classNames = classesToArray( value );
  15316. while ( ( className = classNames[ i++ ] ) ) {
  15317. // Check each className given, space separated list
  15318. if ( self.hasClass( className ) ) {
  15319. self.removeClass( className );
  15320. } else {
  15321. self.addClass( className );
  15322. }
  15323. }
  15324. // Toggle whole class name
  15325. } else if ( value === undefined || type === "boolean" ) {
  15326. className = getClass( this );
  15327. if ( className ) {
  15328. // Store className if set
  15329. dataPriv.set( this, "__className__", className );
  15330. }
  15331. // If the element has a class name or if we're passed `false`,
  15332. // then remove the whole classname (if there was one, the above saved it).
  15333. // Otherwise bring back whatever was previously saved (if anything),
  15334. // falling back to the empty string if nothing was stored.
  15335. if ( this.setAttribute ) {
  15336. this.setAttribute( "class",
  15337. className || value === false ?
  15338. "" :
  15339. dataPriv.get( this, "__className__" ) || ""
  15340. );
  15341. }
  15342. }
  15343. } );
  15344. },
  15345. hasClass: function( selector ) {
  15346. var className, elem,
  15347. i = 0;
  15348. className = " " + selector + " ";
  15349. while ( ( elem = this[ i++ ] ) ) {
  15350. if ( elem.nodeType === 1 &&
  15351. ( " " + stripAndCollapse( getClass( elem ) ) + " " ).indexOf( className ) > -1 ) {
  15352. return true;
  15353. }
  15354. }
  15355. return false;
  15356. }
  15357. } );
  15358. var rreturn = /\r/g;
  15359. jQuery.fn.extend( {
  15360. val: function( value ) {
  15361. var hooks, ret, valueIsFunction,
  15362. elem = this[ 0 ];
  15363. if ( !arguments.length ) {
  15364. if ( elem ) {
  15365. hooks = jQuery.valHooks[ elem.type ] ||
  15366. jQuery.valHooks[ elem.nodeName.toLowerCase() ];
  15367. if ( hooks &&
  15368. "get" in hooks &&
  15369. ( ret = hooks.get( elem, "value" ) ) !== undefined
  15370. ) {
  15371. return ret;
  15372. }
  15373. ret = elem.value;
  15374. // Handle most common string cases
  15375. if ( typeof ret === "string" ) {
  15376. return ret.replace( rreturn, "" );
  15377. }
  15378. // Handle cases where value is null/undef or number
  15379. return ret == null ? "" : ret;
  15380. }
  15381. return;
  15382. }
  15383. valueIsFunction = isFunction( value );
  15384. return this.each( function( i ) {
  15385. var val;
  15386. if ( this.nodeType !== 1 ) {
  15387. return;
  15388. }
  15389. if ( valueIsFunction ) {
  15390. val = value.call( this, i, jQuery( this ).val() );
  15391. } else {
  15392. val = value;
  15393. }
  15394. // Treat null/undefined as ""; convert numbers to string
  15395. if ( val == null ) {
  15396. val = "";
  15397. } else if ( typeof val === "number" ) {
  15398. val += "";
  15399. } else if ( Array.isArray( val ) ) {
  15400. val = jQuery.map( val, function( value ) {
  15401. return value == null ? "" : value + "";
  15402. } );
  15403. }
  15404. hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ];
  15405. // If set returns undefined, fall back to normal setting
  15406. if ( !hooks || !( "set" in hooks ) || hooks.set( this, val, "value" ) === undefined ) {
  15407. this.value = val;
  15408. }
  15409. } );
  15410. }
  15411. } );
  15412. jQuery.extend( {
  15413. valHooks: {
  15414. option: {
  15415. get: function( elem ) {
  15416. var val = jQuery.find.attr( elem, "value" );
  15417. return val != null ?
  15418. val :
  15419. // Support: IE <=10 - 11 only
  15420. // option.text throws exceptions (#14686, #14858)
  15421. // Strip and collapse whitespace
  15422. // https://html.spec.whatwg.org/#strip-and-collapse-whitespace
  15423. stripAndCollapse( jQuery.text( elem ) );
  15424. }
  15425. },
  15426. select: {
  15427. get: function( elem ) {
  15428. var value, option, i,
  15429. options = elem.options,
  15430. index = elem.selectedIndex,
  15431. one = elem.type === "select-one",
  15432. values = one ? null : [],
  15433. max = one ? index + 1 : options.length;
  15434. if ( index < 0 ) {
  15435. i = max;
  15436. } else {
  15437. i = one ? index : 0;
  15438. }
  15439. // Loop through all the selected options
  15440. for ( ; i < max; i++ ) {
  15441. option = options[ i ];
  15442. // Support: IE <=9 only
  15443. // IE8-9 doesn't update selected after form reset (#2551)
  15444. if ( ( option.selected || i === index ) &&
  15445. // Don't return options that are disabled or in a disabled optgroup
  15446. !option.disabled &&
  15447. ( !option.parentNode.disabled ||
  15448. !nodeName( option.parentNode, "optgroup" ) ) ) {
  15449. // Get the specific value for the option
  15450. value = jQuery( option ).val();
  15451. // We don't need an array for one selects
  15452. if ( one ) {
  15453. return value;
  15454. }
  15455. // Multi-Selects return an array
  15456. values.push( value );
  15457. }
  15458. }
  15459. return values;
  15460. },
  15461. set: function( elem, value ) {
  15462. var optionSet, option,
  15463. options = elem.options,
  15464. values = jQuery.makeArray( value ),
  15465. i = options.length;
  15466. while ( i-- ) {
  15467. option = options[ i ];
  15468. /* eslint-disable no-cond-assign */
  15469. if ( option.selected =
  15470. jQuery.inArray( jQuery.valHooks.option.get( option ), values ) > -1
  15471. ) {
  15472. optionSet = true;
  15473. }
  15474. /* eslint-enable no-cond-assign */
  15475. }
  15476. // Force browsers to behave consistently when non-matching value is set
  15477. if ( !optionSet ) {
  15478. elem.selectedIndex = -1;
  15479. }
  15480. return values;
  15481. }
  15482. }
  15483. }
  15484. } );
  15485. // Radios and checkboxes getter/setter
  15486. jQuery.each( [ "radio", "checkbox" ], function() {
  15487. jQuery.valHooks[ this ] = {
  15488. set: function( elem, value ) {
  15489. if ( Array.isArray( value ) ) {
  15490. return ( elem.checked = jQuery.inArray( jQuery( elem ).val(), value ) > -1 );
  15491. }
  15492. }
  15493. };
  15494. if ( !support.checkOn ) {
  15495. jQuery.valHooks[ this ].get = function( elem ) {
  15496. return elem.getAttribute( "value" ) === null ? "on" : elem.value;
  15497. };
  15498. }
  15499. } );
  15500. // Return jQuery for attributes-only inclusion
  15501. support.focusin = "onfocusin" in window;
  15502. var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
  15503. stopPropagationCallback = function( e ) {
  15504. e.stopPropagation();
  15505. };
  15506. jQuery.extend( jQuery.event, {
  15507. trigger: function( event, data, elem, onlyHandlers ) {
  15508. var i, cur, tmp, bubbleType, ontype, handle, special, lastElement,
  15509. eventPath = [ elem || document ],
  15510. type = hasOwn.call( event, "type" ) ? event.type : event,
  15511. namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split( "." ) : [];
  15512. cur = lastElement = tmp = elem = elem || document;
  15513. // Don't do events on text and comment nodes
  15514. if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
  15515. return;
  15516. }
  15517. // focus/blur morphs to focusin/out; ensure we're not firing them right now
  15518. if ( rfocusMorph.test( type + jQuery.event.triggered ) ) {
  15519. return;
  15520. }
  15521. if ( type.indexOf( "." ) > -1 ) {
  15522. // Namespaced trigger; create a regexp to match event type in handle()
  15523. namespaces = type.split( "." );
  15524. type = namespaces.shift();
  15525. namespaces.sort();
  15526. }
  15527. ontype = type.indexOf( ":" ) < 0 && "on" + type;
  15528. // Caller can pass in a jQuery.Event object, Object, or just an event type string
  15529. event = event[ jQuery.expando ] ?
  15530. event :
  15531. new jQuery.Event( type, typeof event === "object" && event );
  15532. // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true)
  15533. event.isTrigger = onlyHandlers ? 2 : 3;
  15534. event.namespace = namespaces.join( "." );
  15535. event.rnamespace = event.namespace ?
  15536. new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ) :
  15537. null;
  15538. // Clean up the event in case it is being reused
  15539. event.result = undefined;
  15540. if ( !event.target ) {
  15541. event.target = elem;
  15542. }
  15543. // Clone any incoming data and prepend the event, creating the handler arg list
  15544. data = data == null ?
  15545. [ event ] :
  15546. jQuery.makeArray( data, [ event ] );
  15547. // Allow special events to draw outside the lines
  15548. special = jQuery.event.special[ type ] || {};
  15549. if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) {
  15550. return;
  15551. }
  15552. // Determine event propagation path in advance, per W3C events spec (#9951)
  15553. // Bubble up to document, then to window; watch for a global ownerDocument var (#9724)
  15554. if ( !onlyHandlers && !special.noBubble && !isWindow( elem ) ) {
  15555. bubbleType = special.delegateType || type;
  15556. if ( !rfocusMorph.test( bubbleType + type ) ) {
  15557. cur = cur.parentNode;
  15558. }
  15559. for ( ; cur; cur = cur.parentNode ) {
  15560. eventPath.push( cur );
  15561. tmp = cur;
  15562. }
  15563. // Only add window if we got to document (e.g., not plain obj or detached DOM)
  15564. if ( tmp === ( elem.ownerDocument || document ) ) {
  15565. eventPath.push( tmp.defaultView || tmp.parentWindow || window );
  15566. }
  15567. }
  15568. // Fire handlers on the event path
  15569. i = 0;
  15570. while ( ( cur = eventPath[ i++ ] ) && !event.isPropagationStopped() ) {
  15571. lastElement = cur;
  15572. event.type = i > 1 ?
  15573. bubbleType :
  15574. special.bindType || type;
  15575. // jQuery handler
  15576. handle = ( dataPriv.get( cur, "events" ) || {} )[ event.type ] &&
  15577. dataPriv.get( cur, "handle" );
  15578. if ( handle ) {
  15579. handle.apply( cur, data );
  15580. }
  15581. // Native handler
  15582. handle = ontype && cur[ ontype ];
  15583. if ( handle && handle.apply && acceptData( cur ) ) {
  15584. event.result = handle.apply( cur, data );
  15585. if ( event.result === false ) {
  15586. event.preventDefault();
  15587. }
  15588. }
  15589. }
  15590. event.type = type;
  15591. // If nobody prevented the default action, do it now
  15592. if ( !onlyHandlers && !event.isDefaultPrevented() ) {
  15593. if ( ( !special._default ||
  15594. special._default.apply( eventPath.pop(), data ) === false ) &&
  15595. acceptData( elem ) ) {
  15596. // Call a native DOM method on the target with the same name as the event.
  15597. // Don't do default actions on window, that's where global variables be (#6170)
  15598. if ( ontype && isFunction( elem[ type ] ) && !isWindow( elem ) ) {
  15599. // Don't re-trigger an onFOO event when we call its FOO() method
  15600. tmp = elem[ ontype ];
  15601. if ( tmp ) {
  15602. elem[ ontype ] = null;
  15603. }
  15604. // Prevent re-triggering of the same event, since we already bubbled it above
  15605. jQuery.event.triggered = type;
  15606. if ( event.isPropagationStopped() ) {
  15607. lastElement.addEventListener( type, stopPropagationCallback );
  15608. }
  15609. elem[ type ]();
  15610. if ( event.isPropagationStopped() ) {
  15611. lastElement.removeEventListener( type, stopPropagationCallback );
  15612. }
  15613. jQuery.event.triggered = undefined;
  15614. if ( tmp ) {
  15615. elem[ ontype ] = tmp;
  15616. }
  15617. }
  15618. }
  15619. }
  15620. return event.result;
  15621. },
  15622. // Piggyback on a donor event to simulate a different one
  15623. // Used only for `focus(in | out)` events
  15624. simulate: function( type, elem, event ) {
  15625. var e = jQuery.extend(
  15626. new jQuery.Event(),
  15627. event,
  15628. {
  15629. type: type,
  15630. isSimulated: true
  15631. }
  15632. );
  15633. jQuery.event.trigger( e, null, elem );
  15634. }
  15635. } );
  15636. jQuery.fn.extend( {
  15637. trigger: function( type, data ) {
  15638. return this.each( function() {
  15639. jQuery.event.trigger( type, data, this );
  15640. } );
  15641. },
  15642. triggerHandler: function( type, data ) {
  15643. var elem = this[ 0 ];
  15644. if ( elem ) {
  15645. return jQuery.event.trigger( type, data, elem, true );
  15646. }
  15647. }
  15648. } );
  15649. // Support: Firefox <=44
  15650. // Firefox doesn't have focus(in | out) events
  15651. // Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787
  15652. //
  15653. // Support: Chrome <=48 - 49, Safari <=9.0 - 9.1
  15654. // focus(in | out) events fire after focus & blur events,
  15655. // which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order
  15656. // Related ticket - https://bugs.chromium.org/p/chromium/issues/detail?id=449857
  15657. if ( !support.focusin ) {
  15658. jQuery.each( { focus: "focusin", blur: "focusout" }, function( orig, fix ) {
  15659. // Attach a single capturing handler on the document while someone wants focusin/focusout
  15660. var handler = function( event ) {
  15661. jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ) );
  15662. };
  15663. jQuery.event.special[ fix ] = {
  15664. setup: function() {
  15665. var doc = this.ownerDocument || this,
  15666. attaches = dataPriv.access( doc, fix );
  15667. if ( !attaches ) {
  15668. doc.addEventListener( orig, handler, true );
  15669. }
  15670. dataPriv.access( doc, fix, ( attaches || 0 ) + 1 );
  15671. },
  15672. teardown: function() {
  15673. var doc = this.ownerDocument || this,
  15674. attaches = dataPriv.access( doc, fix ) - 1;
  15675. if ( !attaches ) {
  15676. doc.removeEventListener( orig, handler, true );
  15677. dataPriv.remove( doc, fix );
  15678. } else {
  15679. dataPriv.access( doc, fix, attaches );
  15680. }
  15681. }
  15682. };
  15683. } );
  15684. }
  15685. var location = window.location;
  15686. var nonce = Date.now();
  15687. var rquery = ( /\?/ );
  15688. // Cross-browser xml parsing
  15689. jQuery.parseXML = function( data ) {
  15690. var xml;
  15691. if ( !data || typeof data !== "string" ) {
  15692. return null;
  15693. }
  15694. // Support: IE 9 - 11 only
  15695. // IE throws on parseFromString with invalid input.
  15696. try {
  15697. xml = ( new window.DOMParser() ).parseFromString( data, "text/xml" );
  15698. } catch ( e ) {
  15699. xml = undefined;
  15700. }
  15701. if ( !xml || xml.getElementsByTagName( "parsererror" ).length ) {
  15702. jQuery.error( "Invalid XML: " + data );
  15703. }
  15704. return xml;
  15705. };
  15706. var
  15707. rbracket = /\[\]$/,
  15708. rCRLF = /\r?\n/g,
  15709. rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i,
  15710. rsubmittable = /^(?:input|select|textarea|keygen)/i;
  15711. function buildParams( prefix, obj, traditional, add ) {
  15712. var name;
  15713. if ( Array.isArray( obj ) ) {
  15714. // Serialize array item.
  15715. jQuery.each( obj, function( i, v ) {
  15716. if ( traditional || rbracket.test( prefix ) ) {
  15717. // Treat each array item as a scalar.
  15718. add( prefix, v );
  15719. } else {
  15720. // Item is non-scalar (array or object), encode its numeric index.
  15721. buildParams(
  15722. prefix + "[" + ( typeof v === "object" && v != null ? i : "" ) + "]",
  15723. v,
  15724. traditional,
  15725. add
  15726. );
  15727. }
  15728. } );
  15729. } else if ( !traditional && toType( obj ) === "object" ) {
  15730. // Serialize object item.
  15731. for ( name in obj ) {
  15732. buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );
  15733. }
  15734. } else {
  15735. // Serialize scalar item.
  15736. add( prefix, obj );
  15737. }
  15738. }
  15739. // Serialize an array of form elements or a set of
  15740. // key/values into a query string
  15741. jQuery.param = function( a, traditional ) {
  15742. var prefix,
  15743. s = [],
  15744. add = function( key, valueOrFunction ) {
  15745. // If value is a function, invoke it and use its return value
  15746. var value = isFunction( valueOrFunction ) ?
  15747. valueOrFunction() :
  15748. valueOrFunction;
  15749. s[ s.length ] = encodeURIComponent( key ) + "=" +
  15750. encodeURIComponent( value == null ? "" : value );
  15751. };
  15752. if ( a == null ) {
  15753. return "";
  15754. }
  15755. // If an array was passed in, assume that it is an array of form elements.
  15756. if ( Array.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) {
  15757. // Serialize the form elements
  15758. jQuery.each( a, function() {
  15759. add( this.name, this.value );
  15760. } );
  15761. } else {
  15762. // If traditional, encode the "old" way (the way 1.3.2 or older
  15763. // did it), otherwise encode params recursively.
  15764. for ( prefix in a ) {
  15765. buildParams( prefix, a[ prefix ], traditional, add );
  15766. }
  15767. }
  15768. // Return the resulting serialization
  15769. return s.join( "&" );
  15770. };
  15771. jQuery.fn.extend( {
  15772. serialize: function() {
  15773. return jQuery.param( this.serializeArray() );
  15774. },
  15775. serializeArray: function() {
  15776. return this.map( function() {
  15777. // Can add propHook for "elements" to filter or add form elements
  15778. var elements = jQuery.prop( this, "elements" );
  15779. return elements ? jQuery.makeArray( elements ) : this;
  15780. } )
  15781. .filter( function() {
  15782. var type = this.type;
  15783. // Use .is( ":disabled" ) so that fieldset[disabled] works
  15784. return this.name && !jQuery( this ).is( ":disabled" ) &&
  15785. rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) &&
  15786. ( this.checked || !rcheckableType.test( type ) );
  15787. } )
  15788. .map( function( i, elem ) {
  15789. var val = jQuery( this ).val();
  15790. if ( val == null ) {
  15791. return null;
  15792. }
  15793. if ( Array.isArray( val ) ) {
  15794. return jQuery.map( val, function( val ) {
  15795. return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
  15796. } );
  15797. }
  15798. return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
  15799. } ).get();
  15800. }
  15801. } );
  15802. var
  15803. r20 = /%20/g,
  15804. rhash = /#.*$/,
  15805. rantiCache = /([?&])_=[^&]*/,
  15806. rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg,
  15807. // #7653, #8125, #8152: local protocol detection
  15808. rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/,
  15809. rnoContent = /^(?:GET|HEAD)$/,
  15810. rprotocol = /^\/\//,
  15811. /* Prefilters
  15812. * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)
  15813. * 2) These are called:
  15814. * - BEFORE asking for a transport
  15815. * - AFTER param serialization (s.data is a string if s.processData is true)
  15816. * 3) key is the dataType
  15817. * 4) the catchall symbol "*" can be used
  15818. * 5) execution will start with transport dataType and THEN continue down to "*" if needed
  15819. */
  15820. prefilters = {},
  15821. /* Transports bindings
  15822. * 1) key is the dataType
  15823. * 2) the catchall symbol "*" can be used
  15824. * 3) selection will start with transport dataType and THEN go to "*" if needed
  15825. */
  15826. transports = {},
  15827. // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression
  15828. allTypes = "*/".concat( "*" ),
  15829. // Anchor tag for parsing the document origin
  15830. originAnchor = document.createElement( "a" );
  15831. originAnchor.href = location.href;
  15832. // Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
  15833. function addToPrefiltersOrTransports( structure ) {
  15834. // dataTypeExpression is optional and defaults to "*"
  15835. return function( dataTypeExpression, func ) {
  15836. if ( typeof dataTypeExpression !== "string" ) {
  15837. func = dataTypeExpression;
  15838. dataTypeExpression = "*";
  15839. }
  15840. var dataType,
  15841. i = 0,
  15842. dataTypes = dataTypeExpression.toLowerCase().match( rnothtmlwhite ) || [];
  15843. if ( isFunction( func ) ) {
  15844. // For each dataType in the dataTypeExpression
  15845. while ( ( dataType = dataTypes[ i++ ] ) ) {
  15846. // Prepend if requested
  15847. if ( dataType[ 0 ] === "+" ) {
  15848. dataType = dataType.slice( 1 ) || "*";
  15849. ( structure[ dataType ] = structure[ dataType ] || [] ).unshift( func );
  15850. // Otherwise append
  15851. } else {
  15852. ( structure[ dataType ] = structure[ dataType ] || [] ).push( func );
  15853. }
  15854. }
  15855. }
  15856. };
  15857. }
  15858. // Base inspection function for prefilters and transports
  15859. function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) {
  15860. var inspected = {},
  15861. seekingTransport = ( structure === transports );
  15862. function inspect( dataType ) {
  15863. var selected;
  15864. inspected[ dataType ] = true;
  15865. jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) {
  15866. var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR );
  15867. if ( typeof dataTypeOrTransport === "string" &&
  15868. !seekingTransport && !inspected[ dataTypeOrTransport ] ) {
  15869. options.dataTypes.unshift( dataTypeOrTransport );
  15870. inspect( dataTypeOrTransport );
  15871. return false;
  15872. } else if ( seekingTransport ) {
  15873. return !( selected = dataTypeOrTransport );
  15874. }
  15875. } );
  15876. return selected;
  15877. }
  15878. return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" );
  15879. }
  15880. // A special extend for ajax options
  15881. // that takes "flat" options (not to be deep extended)
  15882. // Fixes #9887
  15883. function ajaxExtend( target, src ) {
  15884. var key, deep,
  15885. flatOptions = jQuery.ajaxSettings.flatOptions || {};
  15886. for ( key in src ) {
  15887. if ( src[ key ] !== undefined ) {
  15888. ( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ];
  15889. }
  15890. }
  15891. if ( deep ) {
  15892. jQuery.extend( true, target, deep );
  15893. }
  15894. return target;
  15895. }
  15896. /* Handles responses to an ajax request:
  15897. * - finds the right dataType (mediates between content-type and expected dataType)
  15898. * - returns the corresponding response
  15899. */
  15900. function ajaxHandleResponses( s, jqXHR, responses ) {
  15901. var ct, type, finalDataType, firstDataType,
  15902. contents = s.contents,
  15903. dataTypes = s.dataTypes;
  15904. // Remove auto dataType and get content-type in the process
  15905. while ( dataTypes[ 0 ] === "*" ) {
  15906. dataTypes.shift();
  15907. if ( ct === undefined ) {
  15908. ct = s.mimeType || jqXHR.getResponseHeader( "Content-Type" );
  15909. }
  15910. }
  15911. // Check if we're dealing with a known content-type
  15912. if ( ct ) {
  15913. for ( type in contents ) {
  15914. if ( contents[ type ] && contents[ type ].test( ct ) ) {
  15915. dataTypes.unshift( type );
  15916. break;
  15917. }
  15918. }
  15919. }
  15920. // Check to see if we have a response for the expected dataType
  15921. if ( dataTypes[ 0 ] in responses ) {
  15922. finalDataType = dataTypes[ 0 ];
  15923. } else {
  15924. // Try convertible dataTypes
  15925. for ( type in responses ) {
  15926. if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[ 0 ] ] ) {
  15927. finalDataType = type;
  15928. break;
  15929. }
  15930. if ( !firstDataType ) {
  15931. firstDataType = type;
  15932. }
  15933. }
  15934. // Or just use first one
  15935. finalDataType = finalDataType || firstDataType;
  15936. }
  15937. // If we found a dataType
  15938. // We add the dataType to the list if needed
  15939. // and return the corresponding response
  15940. if ( finalDataType ) {
  15941. if ( finalDataType !== dataTypes[ 0 ] ) {
  15942. dataTypes.unshift( finalDataType );
  15943. }
  15944. return responses[ finalDataType ];
  15945. }
  15946. }
  15947. /* Chain conversions given the request and the original response
  15948. * Also sets the responseXXX fields on the jqXHR instance
  15949. */
  15950. function ajaxConvert( s, response, jqXHR, isSuccess ) {
  15951. var conv2, current, conv, tmp, prev,
  15952. converters = {},
  15953. // Work with a copy of dataTypes in case we need to modify it for conversion
  15954. dataTypes = s.dataTypes.slice();
  15955. // Create converters map with lowercased keys
  15956. if ( dataTypes[ 1 ] ) {
  15957. for ( conv in s.converters ) {
  15958. converters[ conv.toLowerCase() ] = s.converters[ conv ];
  15959. }
  15960. }
  15961. current = dataTypes.shift();
  15962. // Convert to each sequential dataType
  15963. while ( current ) {
  15964. if ( s.responseFields[ current ] ) {
  15965. jqXHR[ s.responseFields[ current ] ] = response;
  15966. }
  15967. // Apply the dataFilter if provided
  15968. if ( !prev && isSuccess && s.dataFilter ) {
  15969. response = s.dataFilter( response, s.dataType );
  15970. }
  15971. prev = current;
  15972. current = dataTypes.shift();
  15973. if ( current ) {
  15974. // There's only work to do if current dataType is non-auto
  15975. if ( current === "*" ) {
  15976. current = prev;
  15977. // Convert response if prev dataType is non-auto and differs from current
  15978. } else if ( prev !== "*" && prev !== current ) {
  15979. // Seek a direct converter
  15980. conv = converters[ prev + " " + current ] || converters[ "* " + current ];
  15981. // If none found, seek a pair
  15982. if ( !conv ) {
  15983. for ( conv2 in converters ) {
  15984. // If conv2 outputs current
  15985. tmp = conv2.split( " " );
  15986. if ( tmp[ 1 ] === current ) {
  15987. // If prev can be converted to accepted input
  15988. conv = converters[ prev + " " + tmp[ 0 ] ] ||
  15989. converters[ "* " + tmp[ 0 ] ];
  15990. if ( conv ) {
  15991. // Condense equivalence converters
  15992. if ( conv === true ) {
  15993. conv = converters[ conv2 ];
  15994. // Otherwise, insert the intermediate dataType
  15995. } else if ( converters[ conv2 ] !== true ) {
  15996. current = tmp[ 0 ];
  15997. dataTypes.unshift( tmp[ 1 ] );
  15998. }
  15999. break;
  16000. }
  16001. }
  16002. }
  16003. }
  16004. // Apply converter (if not an equivalence)
  16005. if ( conv !== true ) {
  16006. // Unless errors are allowed to bubble, catch and return them
  16007. if ( conv && s.throws ) {
  16008. response = conv( response );
  16009. } else {
  16010. try {
  16011. response = conv( response );
  16012. } catch ( e ) {
  16013. return {
  16014. state: "parsererror",
  16015. error: conv ? e : "No conversion from " + prev + " to " + current
  16016. };
  16017. }
  16018. }
  16019. }
  16020. }
  16021. }
  16022. }
  16023. return { state: "success", data: response };
  16024. }
  16025. jQuery.extend( {
  16026. // Counter for holding the number of active queries
  16027. active: 0,
  16028. // Last-Modified header cache for next request
  16029. lastModified: {},
  16030. etag: {},
  16031. ajaxSettings: {
  16032. url: location.href,
  16033. type: "GET",
  16034. isLocal: rlocalProtocol.test( location.protocol ),
  16035. global: true,
  16036. processData: true,
  16037. async: true,
  16038. contentType: "application/x-www-form-urlencoded; charset=UTF-8",
  16039. /*
  16040. timeout: 0,
  16041. data: null,
  16042. dataType: null,
  16043. username: null,
  16044. password: null,
  16045. cache: null,
  16046. throws: false,
  16047. traditional: false,
  16048. headers: {},
  16049. */
  16050. accepts: {
  16051. "*": allTypes,
  16052. text: "text/plain",
  16053. html: "text/html",
  16054. xml: "application/xml, text/xml",
  16055. json: "application/json, text/javascript"
  16056. },
  16057. contents: {
  16058. xml: /\bxml\b/,
  16059. html: /\bhtml/,
  16060. json: /\bjson\b/
  16061. },
  16062. responseFields: {
  16063. xml: "responseXML",
  16064. text: "responseText",
  16065. json: "responseJSON"
  16066. },
  16067. // Data converters
  16068. // Keys separate source (or catchall "*") and destination types with a single space
  16069. converters: {
  16070. // Convert anything to text
  16071. "* text": String,
  16072. // Text to html (true = no transformation)
  16073. "text html": true,
  16074. // Evaluate text as a json expression
  16075. "text json": JSON.parse,
  16076. // Parse text as xml
  16077. "text xml": jQuery.parseXML
  16078. },
  16079. // For options that shouldn't be deep extended:
  16080. // you can add your own custom options here if
  16081. // and when you create one that shouldn't be
  16082. // deep extended (see ajaxExtend)
  16083. flatOptions: {
  16084. url: true,
  16085. context: true
  16086. }
  16087. },
  16088. // Creates a full fledged settings object into target
  16089. // with both ajaxSettings and settings fields.
  16090. // If target is omitted, writes into ajaxSettings.
  16091. ajaxSetup: function( target, settings ) {
  16092. return settings ?
  16093. // Building a settings object
  16094. ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) :
  16095. // Extending ajaxSettings
  16096. ajaxExtend( jQuery.ajaxSettings, target );
  16097. },
  16098. ajaxPrefilter: addToPrefiltersOrTransports( prefilters ),
  16099. ajaxTransport: addToPrefiltersOrTransports( transports ),
  16100. // Main method
  16101. ajax: function( url, options ) {
  16102. // If url is an object, simulate pre-1.5 signature
  16103. if ( typeof url === "object" ) {
  16104. options = url;
  16105. url = undefined;
  16106. }
  16107. // Force options to be an object
  16108. options = options || {};
  16109. var transport,
  16110. // URL without anti-cache param
  16111. cacheURL,
  16112. // Response headers
  16113. responseHeadersString,
  16114. responseHeaders,
  16115. // timeout handle
  16116. timeoutTimer,
  16117. // Url cleanup var
  16118. urlAnchor,
  16119. // Request state (becomes false upon send and true upon completion)
  16120. completed,
  16121. // To know if global events are to be dispatched
  16122. fireGlobals,
  16123. // Loop variable
  16124. i,
  16125. // uncached part of the url
  16126. uncached,
  16127. // Create the final options object
  16128. s = jQuery.ajaxSetup( {}, options ),
  16129. // Callbacks context
  16130. callbackContext = s.context || s,
  16131. // Context for global events is callbackContext if it is a DOM node or jQuery collection
  16132. globalEventContext = s.context &&
  16133. ( callbackContext.nodeType || callbackContext.jquery ) ?
  16134. jQuery( callbackContext ) :
  16135. jQuery.event,
  16136. // Deferreds
  16137. deferred = jQuery.Deferred(),
  16138. completeDeferred = jQuery.Callbacks( "once memory" ),
  16139. // Status-dependent callbacks
  16140. statusCode = s.statusCode || {},
  16141. // Headers (they are sent all at once)
  16142. requestHeaders = {},
  16143. requestHeadersNames = {},
  16144. // Default abort message
  16145. strAbort = "canceled",
  16146. // Fake xhr
  16147. jqXHR = {
  16148. readyState: 0,
  16149. // Builds headers hashtable if needed
  16150. getResponseHeader: function( key ) {
  16151. var match;
  16152. if ( completed ) {
  16153. if ( !responseHeaders ) {
  16154. responseHeaders = {};
  16155. while ( ( match = rheaders.exec( responseHeadersString ) ) ) {
  16156. responseHeaders[ match[ 1 ].toLowerCase() + " " ] =
  16157. ( responseHeaders[ match[ 1 ].toLowerCase() + " " ] || [] )
  16158. .concat( match[ 2 ] );
  16159. }
  16160. }
  16161. match = responseHeaders[ key.toLowerCase() + " " ];
  16162. }
  16163. return match == null ? null : match.join( ", " );
  16164. },
  16165. // Raw string
  16166. getAllResponseHeaders: function() {
  16167. return completed ? responseHeadersString : null;
  16168. },
  16169. // Caches the header
  16170. setRequestHeader: function( name, value ) {
  16171. if ( completed == null ) {
  16172. name = requestHeadersNames[ name.toLowerCase() ] =
  16173. requestHeadersNames[ name.toLowerCase() ] || name;
  16174. requestHeaders[ name ] = value;
  16175. }
  16176. return this;
  16177. },
  16178. // Overrides response content-type header
  16179. overrideMimeType: function( type ) {
  16180. if ( completed == null ) {
  16181. s.mimeType = type;
  16182. }
  16183. return this;
  16184. },
  16185. // Status-dependent callbacks
  16186. statusCode: function( map ) {
  16187. var code;
  16188. if ( map ) {
  16189. if ( completed ) {
  16190. // Execute the appropriate callbacks
  16191. jqXHR.always( map[ jqXHR.status ] );
  16192. } else {
  16193. // Lazy-add the new callbacks in a way that preserves old ones
  16194. for ( code in map ) {
  16195. statusCode[ code ] = [ statusCode[ code ], map[ code ] ];
  16196. }
  16197. }
  16198. }
  16199. return this;
  16200. },
  16201. // Cancel the request
  16202. abort: function( statusText ) {
  16203. var finalText = statusText || strAbort;
  16204. if ( transport ) {
  16205. transport.abort( finalText );
  16206. }
  16207. done( 0, finalText );
  16208. return this;
  16209. }
  16210. };
  16211. // Attach deferreds
  16212. deferred.promise( jqXHR );
  16213. // Add protocol if not provided (prefilters might expect it)
  16214. // Handle falsy url in the settings object (#10093: consistency with old signature)
  16215. // We also use the url parameter if available
  16216. s.url = ( ( url || s.url || location.href ) + "" )
  16217. .replace( rprotocol, location.protocol + "//" );
  16218. // Alias method option to type as per ticket #12004
  16219. s.type = options.method || options.type || s.method || s.type;
  16220. // Extract dataTypes list
  16221. s.dataTypes = ( s.dataType || "*" ).toLowerCase().match( rnothtmlwhite ) || [ "" ];
  16222. // A cross-domain request is in order when the origin doesn't match the current origin.
  16223. if ( s.crossDomain == null ) {
  16224. urlAnchor = document.createElement( "a" );
  16225. // Support: IE <=8 - 11, Edge 12 - 15
  16226. // IE throws exception on accessing the href property if url is malformed,
  16227. // e.g. http://example.com:80x/
  16228. try {
  16229. urlAnchor.href = s.url;
  16230. // Support: IE <=8 - 11 only
  16231. // Anchor's host property isn't correctly set when s.url is relative
  16232. urlAnchor.href = urlAnchor.href;
  16233. s.crossDomain = originAnchor.protocol + "//" + originAnchor.host !==
  16234. urlAnchor.protocol + "//" + urlAnchor.host;
  16235. } catch ( e ) {
  16236. // If there is an error parsing the URL, assume it is crossDomain,
  16237. // it can be rejected by the transport if it is invalid
  16238. s.crossDomain = true;
  16239. }
  16240. }
  16241. // Convert data if not already a string
  16242. if ( s.data && s.processData && typeof s.data !== "string" ) {
  16243. s.data = jQuery.param( s.data, s.traditional );
  16244. }
  16245. // Apply prefilters
  16246. inspectPrefiltersOrTransports( prefilters, s, options, jqXHR );
  16247. // If request was aborted inside a prefilter, stop there
  16248. if ( completed ) {
  16249. return jqXHR;
  16250. }
  16251. // We can fire global events as of now if asked to
  16252. // Don't fire events if jQuery.event is undefined in an AMD-usage scenario (#15118)
  16253. fireGlobals = jQuery.event && s.global;
  16254. // Watch for a new set of requests
  16255. if ( fireGlobals && jQuery.active++ === 0 ) {
  16256. jQuery.event.trigger( "ajaxStart" );
  16257. }
  16258. // Uppercase the type
  16259. s.type = s.type.toUpperCase();
  16260. // Determine if request has content
  16261. s.hasContent = !rnoContent.test( s.type );
  16262. // Save the URL in case we're toying with the If-Modified-Since
  16263. // and/or If-None-Match header later on
  16264. // Remove hash to simplify url manipulation
  16265. cacheURL = s.url.replace( rhash, "" );
  16266. // More options handling for requests with no content
  16267. if ( !s.hasContent ) {
  16268. // Remember the hash so we can put it back
  16269. uncached = s.url.slice( cacheURL.length );
  16270. // If data is available and should be processed, append data to url
  16271. if ( s.data && ( s.processData || typeof s.data === "string" ) ) {
  16272. cacheURL += ( rquery.test( cacheURL ) ? "&" : "?" ) + s.data;
  16273. // #9682: remove data so that it's not used in an eventual retry
  16274. delete s.data;
  16275. }
  16276. // Add or update anti-cache param if needed
  16277. if ( s.cache === false ) {
  16278. cacheURL = cacheURL.replace( rantiCache, "$1" );
  16279. uncached = ( rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + ( nonce++ ) + uncached;
  16280. }
  16281. // Put hash and anti-cache on the URL that will be requested (gh-1732)
  16282. s.url = cacheURL + uncached;
  16283. // Change '%20' to '+' if this is encoded form body content (gh-2658)
  16284. } else if ( s.data && s.processData &&
  16285. ( s.contentType || "" ).indexOf( "application/x-www-form-urlencoded" ) === 0 ) {
  16286. s.data = s.data.replace( r20, "+" );
  16287. }
  16288. // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
  16289. if ( s.ifModified ) {
  16290. if ( jQuery.lastModified[ cacheURL ] ) {
  16291. jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] );
  16292. }
  16293. if ( jQuery.etag[ cacheURL ] ) {
  16294. jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] );
  16295. }
  16296. }
  16297. // Set the correct header, if data is being sent
  16298. if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) {
  16299. jqXHR.setRequestHeader( "Content-Type", s.contentType );
  16300. }
  16301. // Set the Accepts header for the server, depending on the dataType
  16302. jqXHR.setRequestHeader(
  16303. "Accept",
  16304. s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[ 0 ] ] ?
  16305. s.accepts[ s.dataTypes[ 0 ] ] +
  16306. ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) :
  16307. s.accepts[ "*" ]
  16308. );
  16309. // Check for headers option
  16310. for ( i in s.headers ) {
  16311. jqXHR.setRequestHeader( i, s.headers[ i ] );
  16312. }
  16313. // Allow custom headers/mimetypes and early abort
  16314. if ( s.beforeSend &&
  16315. ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || completed ) ) {
  16316. // Abort if not done already and return
  16317. return jqXHR.abort();
  16318. }
  16319. // Aborting is no longer a cancellation
  16320. strAbort = "abort";
  16321. // Install callbacks on deferreds
  16322. completeDeferred.add( s.complete );
  16323. jqXHR.done( s.success );
  16324. jqXHR.fail( s.error );
  16325. // Get transport
  16326. transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR );
  16327. // If no transport, we auto-abort
  16328. if ( !transport ) {
  16329. done( -1, "No Transport" );
  16330. } else {
  16331. jqXHR.readyState = 1;
  16332. // Send global event
  16333. if ( fireGlobals ) {
  16334. globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] );
  16335. }
  16336. // If request was aborted inside ajaxSend, stop there
  16337. if ( completed ) {
  16338. return jqXHR;
  16339. }
  16340. // Timeout
  16341. if ( s.async && s.timeout > 0 ) {
  16342. timeoutTimer = window.setTimeout( function() {
  16343. jqXHR.abort( "timeout" );
  16344. }, s.timeout );
  16345. }
  16346. try {
  16347. completed = false;
  16348. transport.send( requestHeaders, done );
  16349. } catch ( e ) {
  16350. // Rethrow post-completion exceptions
  16351. if ( completed ) {
  16352. throw e;
  16353. }
  16354. // Propagate others as results
  16355. done( -1, e );
  16356. }
  16357. }
  16358. // Callback for when everything is done
  16359. function done( status, nativeStatusText, responses, headers ) {
  16360. var isSuccess, success, error, response, modified,
  16361. statusText = nativeStatusText;
  16362. // Ignore repeat invocations
  16363. if ( completed ) {
  16364. return;
  16365. }
  16366. completed = true;
  16367. // Clear timeout if it exists
  16368. if ( timeoutTimer ) {
  16369. window.clearTimeout( timeoutTimer );
  16370. }
  16371. // Dereference transport for early garbage collection
  16372. // (no matter how long the jqXHR object will be used)
  16373. transport = undefined;
  16374. // Cache response headers
  16375. responseHeadersString = headers || "";
  16376. // Set readyState
  16377. jqXHR.readyState = status > 0 ? 4 : 0;
  16378. // Determine if successful
  16379. isSuccess = status >= 200 && status < 300 || status === 304;
  16380. // Get response data
  16381. if ( responses ) {
  16382. response = ajaxHandleResponses( s, jqXHR, responses );
  16383. }
  16384. // Convert no matter what (that way responseXXX fields are always set)
  16385. response = ajaxConvert( s, response, jqXHR, isSuccess );
  16386. // If successful, handle type chaining
  16387. if ( isSuccess ) {
  16388. // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
  16389. if ( s.ifModified ) {
  16390. modified = jqXHR.getResponseHeader( "Last-Modified" );
  16391. if ( modified ) {
  16392. jQuery.lastModified[ cacheURL ] = modified;
  16393. }
  16394. modified = jqXHR.getResponseHeader( "etag" );
  16395. if ( modified ) {
  16396. jQuery.etag[ cacheURL ] = modified;
  16397. }
  16398. }
  16399. // if no content
  16400. if ( status === 204 || s.type === "HEAD" ) {
  16401. statusText = "nocontent";
  16402. // if not modified
  16403. } else if ( status === 304 ) {
  16404. statusText = "notmodified";
  16405. // If we have data, let's convert it
  16406. } else {
  16407. statusText = response.state;
  16408. success = response.data;
  16409. error = response.error;
  16410. isSuccess = !error;
  16411. }
  16412. } else {
  16413. // Extract error from statusText and normalize for non-aborts
  16414. error = statusText;
  16415. if ( status || !statusText ) {
  16416. statusText = "error";
  16417. if ( status < 0 ) {
  16418. status = 0;
  16419. }
  16420. }
  16421. }
  16422. // Set data for the fake xhr object
  16423. jqXHR.status = status;
  16424. jqXHR.statusText = ( nativeStatusText || statusText ) + "";
  16425. // Success/Error
  16426. if ( isSuccess ) {
  16427. deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] );
  16428. } else {
  16429. deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] );
  16430. }
  16431. // Status-dependent callbacks
  16432. jqXHR.statusCode( statusCode );
  16433. statusCode = undefined;
  16434. if ( fireGlobals ) {
  16435. globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError",
  16436. [ jqXHR, s, isSuccess ? success : error ] );
  16437. }
  16438. // Complete
  16439. completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] );
  16440. if ( fireGlobals ) {
  16441. globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] );
  16442. // Handle the global AJAX counter
  16443. if ( !( --jQuery.active ) ) {
  16444. jQuery.event.trigger( "ajaxStop" );
  16445. }
  16446. }
  16447. }
  16448. return jqXHR;
  16449. },
  16450. getJSON: function( url, data, callback ) {
  16451. return jQuery.get( url, data, callback, "json" );
  16452. },
  16453. getScript: function( url, callback ) {
  16454. return jQuery.get( url, undefined, callback, "script" );
  16455. }
  16456. } );
  16457. jQuery.each( [ "get", "post" ], function( i, method ) {
  16458. jQuery[ method ] = function( url, data, callback, type ) {
  16459. // Shift arguments if data argument was omitted
  16460. if ( isFunction( data ) ) {
  16461. type = type || callback;
  16462. callback = data;
  16463. data = undefined;
  16464. }
  16465. // The url can be an options object (which then must have .url)
  16466. return jQuery.ajax( jQuery.extend( {
  16467. url: url,
  16468. type: method,
  16469. dataType: type,
  16470. data: data,
  16471. success: callback
  16472. }, jQuery.isPlainObject( url ) && url ) );
  16473. };
  16474. } );
  16475. jQuery._evalUrl = function( url, options ) {
  16476. return jQuery.ajax( {
  16477. url: url,
  16478. // Make this explicit, since user can override this through ajaxSetup (#11264)
  16479. type: "GET",
  16480. dataType: "script",
  16481. cache: true,
  16482. async: false,
  16483. global: false,
  16484. // Only evaluate the response if it is successful (gh-4126)
  16485. // dataFilter is not invoked for failure responses, so using it instead
  16486. // of the default converter is kludgy but it works.
  16487. converters: {
  16488. "text script": function() {}
  16489. },
  16490. dataFilter: function( response ) {
  16491. jQuery.globalEval( response, options );
  16492. }
  16493. } );
  16494. };
  16495. jQuery.fn.extend( {
  16496. wrapAll: function( html ) {
  16497. var wrap;
  16498. if ( this[ 0 ] ) {
  16499. if ( isFunction( html ) ) {
  16500. html = html.call( this[ 0 ] );
  16501. }
  16502. // The elements to wrap the target around
  16503. wrap = jQuery( html, this[ 0 ].ownerDocument ).eq( 0 ).clone( true );
  16504. if ( this[ 0 ].parentNode ) {
  16505. wrap.insertBefore( this[ 0 ] );
  16506. }
  16507. wrap.map( function() {
  16508. var elem = this;
  16509. while ( elem.firstElementChild ) {
  16510. elem = elem.firstElementChild;
  16511. }
  16512. return elem;
  16513. } ).append( this );
  16514. }
  16515. return this;
  16516. },
  16517. wrapInner: function( html ) {
  16518. if ( isFunction( html ) ) {
  16519. return this.each( function( i ) {
  16520. jQuery( this ).wrapInner( html.call( this, i ) );
  16521. } );
  16522. }
  16523. return this.each( function() {
  16524. var self = jQuery( this ),
  16525. contents = self.contents();
  16526. if ( contents.length ) {
  16527. contents.wrapAll( html );
  16528. } else {
  16529. self.append( html );
  16530. }
  16531. } );
  16532. },
  16533. wrap: function( html ) {
  16534. var htmlIsFunction = isFunction( html );
  16535. return this.each( function( i ) {
  16536. jQuery( this ).wrapAll( htmlIsFunction ? html.call( this, i ) : html );
  16537. } );
  16538. },
  16539. unwrap: function( selector ) {
  16540. this.parent( selector ).not( "body" ).each( function() {
  16541. jQuery( this ).replaceWith( this.childNodes );
  16542. } );
  16543. return this;
  16544. }
  16545. } );
  16546. jQuery.expr.pseudos.hidden = function( elem ) {
  16547. return !jQuery.expr.pseudos.visible( elem );
  16548. };
  16549. jQuery.expr.pseudos.visible = function( elem ) {
  16550. return !!( elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length );
  16551. };
  16552. jQuery.ajaxSettings.xhr = function() {
  16553. try {
  16554. return new window.XMLHttpRequest();
  16555. } catch ( e ) {}
  16556. };
  16557. var xhrSuccessStatus = {
  16558. // File protocol always yields status code 0, assume 200
  16559. 0: 200,
  16560. // Support: IE <=9 only
  16561. // #1450: sometimes IE returns 1223 when it should be 204
  16562. 1223: 204
  16563. },
  16564. xhrSupported = jQuery.ajaxSettings.xhr();
  16565. support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported );
  16566. support.ajax = xhrSupported = !!xhrSupported;
  16567. jQuery.ajaxTransport( function( options ) {
  16568. var callback, errorCallback;
  16569. // Cross domain only allowed if supported through XMLHttpRequest
  16570. if ( support.cors || xhrSupported && !options.crossDomain ) {
  16571. return {
  16572. send: function( headers, complete ) {
  16573. var i,
  16574. xhr = options.xhr();
  16575. xhr.open(
  16576. options.type,
  16577. options.url,
  16578. options.async,
  16579. options.username,
  16580. options.password
  16581. );
  16582. // Apply custom fields if provided
  16583. if ( options.xhrFields ) {
  16584. for ( i in options.xhrFields ) {
  16585. xhr[ i ] = options.xhrFields[ i ];
  16586. }
  16587. }
  16588. // Override mime type if needed
  16589. if ( options.mimeType && xhr.overrideMimeType ) {
  16590. xhr.overrideMimeType( options.mimeType );
  16591. }
  16592. // X-Requested-With header
  16593. // For cross-domain requests, seeing as conditions for a preflight are
  16594. // akin to a jigsaw puzzle, we simply never set it to be sure.
  16595. // (it can always be set on a per-request basis or even using ajaxSetup)
  16596. // For same-domain requests, won't change header if already provided.
  16597. if ( !options.crossDomain && !headers[ "X-Requested-With" ] ) {
  16598. headers[ "X-Requested-With" ] = "XMLHttpRequest";
  16599. }
  16600. // Set headers
  16601. for ( i in headers ) {
  16602. xhr.setRequestHeader( i, headers[ i ] );
  16603. }
  16604. // Callback
  16605. callback = function( type ) {
  16606. return function() {
  16607. if ( callback ) {
  16608. callback = errorCallback = xhr.onload =
  16609. xhr.onerror = xhr.onabort = xhr.ontimeout =
  16610. xhr.onreadystatechange = null;
  16611. if ( type === "abort" ) {
  16612. xhr.abort();
  16613. } else if ( type === "error" ) {
  16614. // Support: IE <=9 only
  16615. // On a manual native abort, IE9 throws
  16616. // errors on any property access that is not readyState
  16617. if ( typeof xhr.status !== "number" ) {
  16618. complete( 0, "error" );
  16619. } else {
  16620. complete(
  16621. // File: protocol always yields status 0; see #8605, #14207
  16622. xhr.status,
  16623. xhr.statusText
  16624. );
  16625. }
  16626. } else {
  16627. complete(
  16628. xhrSuccessStatus[ xhr.status ] || xhr.status,
  16629. xhr.statusText,
  16630. // Support: IE <=9 only
  16631. // IE9 has no XHR2 but throws on binary (trac-11426)
  16632. // For XHR2 non-text, let the caller handle it (gh-2498)
  16633. ( xhr.responseType || "text" ) !== "text" ||
  16634. typeof xhr.responseText !== "string" ?
  16635. { binary: xhr.response } :
  16636. { text: xhr.responseText },
  16637. xhr.getAllResponseHeaders()
  16638. );
  16639. }
  16640. }
  16641. };
  16642. };
  16643. // Listen to events
  16644. xhr.onload = callback();
  16645. errorCallback = xhr.onerror = xhr.ontimeout = callback( "error" );
  16646. // Support: IE 9 only
  16647. // Use onreadystatechange to replace onabort
  16648. // to handle uncaught aborts
  16649. if ( xhr.onabort !== undefined ) {
  16650. xhr.onabort = errorCallback;
  16651. } else {
  16652. xhr.onreadystatechange = function() {
  16653. // Check readyState before timeout as it changes
  16654. if ( xhr.readyState === 4 ) {
  16655. // Allow onerror to be called first,
  16656. // but that will not handle a native abort
  16657. // Also, save errorCallback to a variable
  16658. // as xhr.onerror cannot be accessed
  16659. window.setTimeout( function() {
  16660. if ( callback ) {
  16661. errorCallback();
  16662. }
  16663. } );
  16664. }
  16665. };
  16666. }
  16667. // Create the abort callback
  16668. callback = callback( "abort" );
  16669. try {
  16670. // Do send the request (this may raise an exception)
  16671. xhr.send( options.hasContent && options.data || null );
  16672. } catch ( e ) {
  16673. // #14683: Only rethrow if this hasn't been notified as an error yet
  16674. if ( callback ) {
  16675. throw e;
  16676. }
  16677. }
  16678. },
  16679. abort: function() {
  16680. if ( callback ) {
  16681. callback();
  16682. }
  16683. }
  16684. };
  16685. }
  16686. } );
  16687. // Prevent auto-execution of scripts when no explicit dataType was provided (See gh-2432)
  16688. jQuery.ajaxPrefilter( function( s ) {
  16689. if ( s.crossDomain ) {
  16690. s.contents.script = false;
  16691. }
  16692. } );
  16693. // Install script dataType
  16694. jQuery.ajaxSetup( {
  16695. accepts: {
  16696. script: "text/javascript, application/javascript, " +
  16697. "application/ecmascript, application/x-ecmascript"
  16698. },
  16699. contents: {
  16700. script: /\b(?:java|ecma)script\b/
  16701. },
  16702. converters: {
  16703. "text script": function( text ) {
  16704. jQuery.globalEval( text );
  16705. return text;
  16706. }
  16707. }
  16708. } );
  16709. // Handle cache's special case and crossDomain
  16710. jQuery.ajaxPrefilter( "script", function( s ) {
  16711. if ( s.cache === undefined ) {
  16712. s.cache = false;
  16713. }
  16714. if ( s.crossDomain ) {
  16715. s.type = "GET";
  16716. }
  16717. } );
  16718. // Bind script tag hack transport
  16719. jQuery.ajaxTransport( "script", function( s ) {
  16720. // This transport only deals with cross domain or forced-by-attrs requests
  16721. if ( s.crossDomain || s.scriptAttrs ) {
  16722. var script, callback;
  16723. return {
  16724. send: function( _, complete ) {
  16725. script = jQuery( "<script>" )
  16726. .attr( s.scriptAttrs || {} )
  16727. .prop( { charset: s.scriptCharset, src: s.url } )
  16728. .on( "load error", callback = function( evt ) {
  16729. script.remove();
  16730. callback = null;
  16731. if ( evt ) {
  16732. complete( evt.type === "error" ? 404 : 200, evt.type );
  16733. }
  16734. } );
  16735. // Use native DOM manipulation to avoid our domManip AJAX trickery
  16736. document.head.appendChild( script[ 0 ] );
  16737. },
  16738. abort: function() {
  16739. if ( callback ) {
  16740. callback();
  16741. }
  16742. }
  16743. };
  16744. }
  16745. } );
  16746. var oldCallbacks = [],
  16747. rjsonp = /(=)\?(?=&|$)|\?\?/;
  16748. // Default jsonp settings
  16749. jQuery.ajaxSetup( {
  16750. jsonp: "callback",
  16751. jsonpCallback: function() {
  16752. var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( nonce++ ) );
  16753. this[ callback ] = true;
  16754. return callback;
  16755. }
  16756. } );
  16757. // Detect, normalize options and install callbacks for jsonp requests
  16758. jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
  16759. var callbackName, overwritten, responseContainer,
  16760. jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ?
  16761. "url" :
  16762. typeof s.data === "string" &&
  16763. ( s.contentType || "" )
  16764. .indexOf( "application/x-www-form-urlencoded" ) === 0 &&
  16765. rjsonp.test( s.data ) && "data"
  16766. );
  16767. // Handle iff the expected data type is "jsonp" or we have a parameter to set
  16768. if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) {
  16769. // Get callback name, remembering preexisting value associated with it
  16770. callbackName = s.jsonpCallback = isFunction( s.jsonpCallback ) ?
  16771. s.jsonpCallback() :
  16772. s.jsonpCallback;
  16773. // Insert callback into url or form data
  16774. if ( jsonProp ) {
  16775. s[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName );
  16776. } else if ( s.jsonp !== false ) {
  16777. s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName;
  16778. }
  16779. // Use data converter to retrieve json after script execution
  16780. s.converters[ "script json" ] = function() {
  16781. if ( !responseContainer ) {
  16782. jQuery.error( callbackName + " was not called" );
  16783. }
  16784. return responseContainer[ 0 ];
  16785. };
  16786. // Force json dataType
  16787. s.dataTypes[ 0 ] = "json";
  16788. // Install callback
  16789. overwritten = window[ callbackName ];
  16790. window[ callbackName ] = function() {
  16791. responseContainer = arguments;
  16792. };
  16793. // Clean-up function (fires after converters)
  16794. jqXHR.always( function() {
  16795. // If previous value didn't exist - remove it
  16796. if ( overwritten === undefined ) {
  16797. jQuery( window ).removeProp( callbackName );
  16798. // Otherwise restore preexisting value
  16799. } else {
  16800. window[ callbackName ] = overwritten;
  16801. }
  16802. // Save back as free
  16803. if ( s[ callbackName ] ) {
  16804. // Make sure that re-using the options doesn't screw things around
  16805. s.jsonpCallback = originalSettings.jsonpCallback;
  16806. // Save the callback name for future use
  16807. oldCallbacks.push( callbackName );
  16808. }
  16809. // Call if it was a function and we have a response
  16810. if ( responseContainer && isFunction( overwritten ) ) {
  16811. overwritten( responseContainer[ 0 ] );
  16812. }
  16813. responseContainer = overwritten = undefined;
  16814. } );
  16815. // Delegate to script
  16816. return "script";
  16817. }
  16818. } );
  16819. // Support: Safari 8 only
  16820. // In Safari 8 documents created via document.implementation.createHTMLDocument
  16821. // collapse sibling forms: the second one becomes a child of the first one.
  16822. // Because of that, this security measure has to be disabled in Safari 8.
  16823. // https://bugs.webkit.org/show_bug.cgi?id=137337
  16824. support.createHTMLDocument = ( function() {
  16825. var body = document.implementation.createHTMLDocument( "" ).body;
  16826. body.innerHTML = "<form></form><form></form>";
  16827. return body.childNodes.length === 2;
  16828. } )();
  16829. // Argument "data" should be string of html
  16830. // context (optional): If specified, the fragment will be created in this context,
  16831. // defaults to document
  16832. // keepScripts (optional): If true, will include scripts passed in the html string
  16833. jQuery.parseHTML = function( data, context, keepScripts ) {
  16834. if ( typeof data !== "string" ) {
  16835. return [];
  16836. }
  16837. if ( typeof context === "boolean" ) {
  16838. keepScripts = context;
  16839. context = false;
  16840. }
  16841. var base, parsed, scripts;
  16842. if ( !context ) {
  16843. // Stop scripts or inline event handlers from being executed immediately
  16844. // by using document.implementation
  16845. if ( support.createHTMLDocument ) {
  16846. context = document.implementation.createHTMLDocument( "" );
  16847. // Set the base href for the created document
  16848. // so any parsed elements with URLs
  16849. // are based on the document's URL (gh-2965)
  16850. base = context.createElement( "base" );
  16851. base.href = document.location.href;
  16852. context.head.appendChild( base );
  16853. } else {
  16854. context = document;
  16855. }
  16856. }
  16857. parsed = rsingleTag.exec( data );
  16858. scripts = !keepScripts && [];
  16859. // Single tag
  16860. if ( parsed ) {
  16861. return [ context.createElement( parsed[ 1 ] ) ];
  16862. }
  16863. parsed = buildFragment( [ data ], context, scripts );
  16864. if ( scripts && scripts.length ) {
  16865. jQuery( scripts ).remove();
  16866. }
  16867. return jQuery.merge( [], parsed.childNodes );
  16868. };
  16869. /**
  16870. * Load a url into a page
  16871. */
  16872. jQuery.fn.load = function( url, params, callback ) {
  16873. var selector, type, response,
  16874. self = this,
  16875. off = url.indexOf( " " );
  16876. if ( off > -1 ) {
  16877. selector = stripAndCollapse( url.slice( off ) );
  16878. url = url.slice( 0, off );
  16879. }
  16880. // If it's a function
  16881. if ( isFunction( params ) ) {
  16882. // We assume that it's the callback
  16883. callback = params;
  16884. params = undefined;
  16885. // Otherwise, build a param string
  16886. } else if ( params && typeof params === "object" ) {
  16887. type = "POST";
  16888. }
  16889. // If we have elements to modify, make the request
  16890. if ( self.length > 0 ) {
  16891. jQuery.ajax( {
  16892. url: url,
  16893. // If "type" variable is undefined, then "GET" method will be used.
  16894. // Make value of this field explicit since
  16895. // user can override it through ajaxSetup method
  16896. type: type || "GET",
  16897. dataType: "html",
  16898. data: params
  16899. } ).done( function( responseText ) {
  16900. // Save response for use in complete callback
  16901. response = arguments;
  16902. self.html( selector ?
  16903. // If a selector was specified, locate the right elements in a dummy div
  16904. // Exclude scripts to avoid IE 'Permission Denied' errors
  16905. jQuery( "<div>" ).append( jQuery.parseHTML( responseText ) ).find( selector ) :
  16906. // Otherwise use the full result
  16907. responseText );
  16908. // If the request succeeds, this function gets "data", "status", "jqXHR"
  16909. // but they are ignored because response was set above.
  16910. // If it fails, this function gets "jqXHR", "status", "error"
  16911. } ).always( callback && function( jqXHR, status ) {
  16912. self.each( function() {
  16913. callback.apply( this, response || [ jqXHR.responseText, status, jqXHR ] );
  16914. } );
  16915. } );
  16916. }
  16917. return this;
  16918. };
  16919. // Attach a bunch of functions for handling common AJAX events
  16920. jQuery.each( [
  16921. "ajaxStart",
  16922. "ajaxStop",
  16923. "ajaxComplete",
  16924. "ajaxError",
  16925. "ajaxSuccess",
  16926. "ajaxSend"
  16927. ], function( i, type ) {
  16928. jQuery.fn[ type ] = function( fn ) {
  16929. return this.on( type, fn );
  16930. };
  16931. } );
  16932. jQuery.expr.pseudos.animated = function( elem ) {
  16933. return jQuery.grep( jQuery.timers, function( fn ) {
  16934. return elem === fn.elem;
  16935. } ).length;
  16936. };
  16937. jQuery.offset = {
  16938. setOffset: function( elem, options, i ) {
  16939. var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition,
  16940. position = jQuery.css( elem, "position" ),
  16941. curElem = jQuery( elem ),
  16942. props = {};
  16943. // Set position first, in-case top/left are set even on static elem
  16944. if ( position === "static" ) {
  16945. elem.style.position = "relative";
  16946. }
  16947. curOffset = curElem.offset();
  16948. curCSSTop = jQuery.css( elem, "top" );
  16949. curCSSLeft = jQuery.css( elem, "left" );
  16950. calculatePosition = ( position === "absolute" || position === "fixed" ) &&
  16951. ( curCSSTop + curCSSLeft ).indexOf( "auto" ) > -1;
  16952. // Need to be able to calculate position if either
  16953. // top or left is auto and position is either absolute or fixed
  16954. if ( calculatePosition ) {
  16955. curPosition = curElem.position();
  16956. curTop = curPosition.top;
  16957. curLeft = curPosition.left;
  16958. } else {
  16959. curTop = parseFloat( curCSSTop ) || 0;
  16960. curLeft = parseFloat( curCSSLeft ) || 0;
  16961. }
  16962. if ( isFunction( options ) ) {
  16963. // Use jQuery.extend here to allow modification of coordinates argument (gh-1848)
  16964. options = options.call( elem, i, jQuery.extend( {}, curOffset ) );
  16965. }
  16966. if ( options.top != null ) {
  16967. props.top = ( options.top - curOffset.top ) + curTop;
  16968. }
  16969. if ( options.left != null ) {
  16970. props.left = ( options.left - curOffset.left ) + curLeft;
  16971. }
  16972. if ( "using" in options ) {
  16973. options.using.call( elem, props );
  16974. } else {
  16975. curElem.css( props );
  16976. }
  16977. }
  16978. };
  16979. jQuery.fn.extend( {
  16980. // offset() relates an element's border box to the document origin
  16981. offset: function( options ) {
  16982. // Preserve chaining for setter
  16983. if ( arguments.length ) {
  16984. return options === undefined ?
  16985. this :
  16986. this.each( function( i ) {
  16987. jQuery.offset.setOffset( this, options, i );
  16988. } );
  16989. }
  16990. var rect, win,
  16991. elem = this[ 0 ];
  16992. if ( !elem ) {
  16993. return;
  16994. }
  16995. // Return zeros for disconnected and hidden (display: none) elements (gh-2310)
  16996. // Support: IE <=11 only
  16997. // Running getBoundingClientRect on a
  16998. // disconnected node in IE throws an error
  16999. if ( !elem.getClientRects().length ) {
  17000. return { top: 0, left: 0 };
  17001. }
  17002. // Get document-relative position by adding viewport scroll to viewport-relative gBCR
  17003. rect = elem.getBoundingClientRect();
  17004. win = elem.ownerDocument.defaultView;
  17005. return {
  17006. top: rect.top + win.pageYOffset,
  17007. left: rect.left + win.pageXOffset
  17008. };
  17009. },
  17010. // position() relates an element's margin box to its offset parent's padding box
  17011. // This corresponds to the behavior of CSS absolute positioning
  17012. position: function() {
  17013. if ( !this[ 0 ] ) {
  17014. return;
  17015. }
  17016. var offsetParent, offset, doc,
  17017. elem = this[ 0 ],
  17018. parentOffset = { top: 0, left: 0 };
  17019. // position:fixed elements are offset from the viewport, which itself always has zero offset
  17020. if ( jQuery.css( elem, "position" ) === "fixed" ) {
  17021. // Assume position:fixed implies availability of getBoundingClientRect
  17022. offset = elem.getBoundingClientRect();
  17023. } else {
  17024. offset = this.offset();
  17025. // Account for the *real* offset parent, which can be the document or its root element
  17026. // when a statically positioned element is identified
  17027. doc = elem.ownerDocument;
  17028. offsetParent = elem.offsetParent || doc.documentElement;
  17029. while ( offsetParent &&
  17030. ( offsetParent === doc.body || offsetParent === doc.documentElement ) &&
  17031. jQuery.css( offsetParent, "position" ) === "static" ) {
  17032. offsetParent = offsetParent.parentNode;
  17033. }
  17034. if ( offsetParent && offsetParent !== elem && offsetParent.nodeType === 1 ) {
  17035. // Incorporate borders into its offset, since they are outside its content origin
  17036. parentOffset = jQuery( offsetParent ).offset();
  17037. parentOffset.top += jQuery.css( offsetParent, "borderTopWidth", true );
  17038. parentOffset.left += jQuery.css( offsetParent, "borderLeftWidth", true );
  17039. }
  17040. }
  17041. // Subtract parent offsets and element margins
  17042. return {
  17043. top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ),
  17044. left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true )
  17045. };
  17046. },
  17047. // This method will return documentElement in the following cases:
  17048. // 1) For the element inside the iframe without offsetParent, this method will return
  17049. // documentElement of the parent window
  17050. // 2) For the hidden or detached element
  17051. // 3) For body or html element, i.e. in case of the html node - it will return itself
  17052. //
  17053. // but those exceptions were never presented as a real life use-cases
  17054. // and might be considered as more preferable results.
  17055. //
  17056. // This logic, however, is not guaranteed and can change at any point in the future
  17057. offsetParent: function() {
  17058. return this.map( function() {
  17059. var offsetParent = this.offsetParent;
  17060. while ( offsetParent && jQuery.css( offsetParent, "position" ) === "static" ) {
  17061. offsetParent = offsetParent.offsetParent;
  17062. }
  17063. return offsetParent || documentElement;
  17064. } );
  17065. }
  17066. } );
  17067. // Create scrollLeft and scrollTop methods
  17068. jQuery.each( { scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function( method, prop ) {
  17069. var top = "pageYOffset" === prop;
  17070. jQuery.fn[ method ] = function( val ) {
  17071. return access( this, function( elem, method, val ) {
  17072. // Coalesce documents and windows
  17073. var win;
  17074. if ( isWindow( elem ) ) {
  17075. win = elem;
  17076. } else if ( elem.nodeType === 9 ) {
  17077. win = elem.defaultView;
  17078. }
  17079. if ( val === undefined ) {
  17080. return win ? win[ prop ] : elem[ method ];
  17081. }
  17082. if ( win ) {
  17083. win.scrollTo(
  17084. !top ? val : win.pageXOffset,
  17085. top ? val : win.pageYOffset
  17086. );
  17087. } else {
  17088. elem[ method ] = val;
  17089. }
  17090. }, method, val, arguments.length );
  17091. };
  17092. } );
  17093. // Support: Safari <=7 - 9.1, Chrome <=37 - 49
  17094. // Add the top/left cssHooks using jQuery.fn.position
  17095. // Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084
  17096. // Blink bug: https://bugs.chromium.org/p/chromium/issues/detail?id=589347
  17097. // getComputedStyle returns percent when specified for top/left/bottom/right;
  17098. // rather than make the css module depend on the offset module, just check for it here
  17099. jQuery.each( [ "top", "left" ], function( i, prop ) {
  17100. jQuery.cssHooks[ prop ] = addGetHookIf( support.pixelPosition,
  17101. function( elem, computed ) {
  17102. if ( computed ) {
  17103. computed = curCSS( elem, prop );
  17104. // If curCSS returns percentage, fallback to offset
  17105. return rnumnonpx.test( computed ) ?
  17106. jQuery( elem ).position()[ prop ] + "px" :
  17107. computed;
  17108. }
  17109. }
  17110. );
  17111. } );
  17112. // Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods
  17113. jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
  17114. jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name },
  17115. function( defaultExtra, funcName ) {
  17116. // Margin is only for outerHeight, outerWidth
  17117. jQuery.fn[ funcName ] = function( margin, value ) {
  17118. var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ),
  17119. extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" );
  17120. return access( this, function( elem, type, value ) {
  17121. var doc;
  17122. if ( isWindow( elem ) ) {
  17123. // $( window ).outerWidth/Height return w/h including scrollbars (gh-1729)
  17124. return funcName.indexOf( "outer" ) === 0 ?
  17125. elem[ "inner" + name ] :
  17126. elem.document.documentElement[ "client" + name ];
  17127. }
  17128. // Get document width or height
  17129. if ( elem.nodeType === 9 ) {
  17130. doc = elem.documentElement;
  17131. // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height],
  17132. // whichever is greatest
  17133. return Math.max(
  17134. elem.body[ "scroll" + name ], doc[ "scroll" + name ],
  17135. elem.body[ "offset" + name ], doc[ "offset" + name ],
  17136. doc[ "client" + name ]
  17137. );
  17138. }
  17139. return value === undefined ?
  17140. // Get width or height on the element, requesting but not forcing parseFloat
  17141. jQuery.css( elem, type, extra ) :
  17142. // Set width or height on the element
  17143. jQuery.style( elem, type, value, extra );
  17144. }, type, chainable ? margin : undefined, chainable );
  17145. };
  17146. } );
  17147. } );
  17148. jQuery.each( ( "blur focus focusin focusout resize scroll click dblclick " +
  17149. "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
  17150. "change select submit keydown keypress keyup contextmenu" ).split( " " ),
  17151. function( i, name ) {
  17152. // Handle event binding
  17153. jQuery.fn[ name ] = function( data, fn ) {
  17154. return arguments.length > 0 ?
  17155. this.on( name, null, data, fn ) :
  17156. this.trigger( name );
  17157. };
  17158. } );
  17159. jQuery.fn.extend( {
  17160. hover: function( fnOver, fnOut ) {
  17161. return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
  17162. }
  17163. } );
  17164. jQuery.fn.extend( {
  17165. bind: function( types, data, fn ) {
  17166. return this.on( types, null, data, fn );
  17167. },
  17168. unbind: function( types, fn ) {
  17169. return this.off( types, null, fn );
  17170. },
  17171. delegate: function( selector, types, data, fn ) {
  17172. return this.on( types, selector, data, fn );
  17173. },
  17174. undelegate: function( selector, types, fn ) {
  17175. // ( namespace ) or ( selector, types [, fn] )
  17176. return arguments.length === 1 ?
  17177. this.off( selector, "**" ) :
  17178. this.off( types, selector || "**", fn );
  17179. }
  17180. } );
  17181. // Bind a function to a context, optionally partially applying any
  17182. // arguments.
  17183. // jQuery.proxy is deprecated to promote standards (specifically Function#bind)
  17184. // However, it is not slated for removal any time soon
  17185. jQuery.proxy = function( fn, context ) {
  17186. var tmp, args, proxy;
  17187. if ( typeof context === "string" ) {
  17188. tmp = fn[ context ];
  17189. context = fn;
  17190. fn = tmp;
  17191. }
  17192. // Quick check to determine if target is callable, in the spec
  17193. // this throws a TypeError, but we will just return undefined.
  17194. if ( !isFunction( fn ) ) {
  17195. return undefined;
  17196. }
  17197. // Simulated bind
  17198. args = slice.call( arguments, 2 );
  17199. proxy = function() {
  17200. return fn.apply( context || this, args.concat( slice.call( arguments ) ) );
  17201. };
  17202. // Set the guid of unique handler to the same of original handler, so it can be removed
  17203. proxy.guid = fn.guid = fn.guid || jQuery.guid++;
  17204. return proxy;
  17205. };
  17206. jQuery.holdReady = function( hold ) {
  17207. if ( hold ) {
  17208. jQuery.readyWait++;
  17209. } else {
  17210. jQuery.ready( true );
  17211. }
  17212. };
  17213. jQuery.isArray = Array.isArray;
  17214. jQuery.parseJSON = JSON.parse;
  17215. jQuery.nodeName = nodeName;
  17216. jQuery.isFunction = isFunction;
  17217. jQuery.isWindow = isWindow;
  17218. jQuery.camelCase = camelCase;
  17219. jQuery.type = toType;
  17220. jQuery.now = Date.now;
  17221. jQuery.isNumeric = function( obj ) {
  17222. // As of jQuery 3.0, isNumeric is limited to
  17223. // strings and numbers (primitives or objects)
  17224. // that can be coerced to finite numbers (gh-2662)
  17225. var type = jQuery.type( obj );
  17226. return ( type === "number" || type === "string" ) &&
  17227. // parseFloat NaNs numeric-cast false positives ("")
  17228. // ...but misinterprets leading-number strings, particularly hex literals ("0x...")
  17229. // subtraction forces infinities to NaN
  17230. !isNaN( obj - parseFloat( obj ) );
  17231. };
  17232. // Register as a named AMD module, since jQuery can be concatenated with other
  17233. // files that may use define, but not via a proper concatenation script that
  17234. // understands anonymous AMD modules. A named AMD is safest and most robust
  17235. // way to register. Lowercase jquery is used because AMD module names are
  17236. // derived from file names, and jQuery is normally delivered in a lowercase
  17237. // file name. Do this after creating the global so that if an AMD module wants
  17238. // to call noConflict to hide this version of jQuery, it will work.
  17239. // Note that for maximum portability, libraries that are not jQuery should
  17240. // declare themselves as anonymous modules, and avoid setting a global if an
  17241. // AMD loader is present. jQuery is a special case. For more information, see
  17242. // https://github.com/jrburke/requirejs/wiki/Updating-existing-libraries#wiki-anon
  17243. if ( true ) {
  17244. !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function() {
  17245. return jQuery;
  17246. }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
  17247. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  17248. }
  17249. var
  17250. // Map over jQuery in case of overwrite
  17251. _jQuery = window.jQuery,
  17252. // Map over the $ in case of overwrite
  17253. _$ = window.$;
  17254. jQuery.noConflict = function( deep ) {
  17255. if ( window.$ === jQuery ) {
  17256. window.$ = _$;
  17257. }
  17258. if ( deep && window.jQuery === jQuery ) {
  17259. window.jQuery = _jQuery;
  17260. }
  17261. return jQuery;
  17262. };
  17263. // Expose jQuery and $ identifiers, even in AMD
  17264. // (#7102#comment:10, https://github.com/jquery/jquery/pull/557)
  17265. // and CommonJS for browser emulators (#13566)
  17266. if ( !noGlobal ) {
  17267. window.jQuery = window.$ = jQuery;
  17268. }
  17269. return jQuery;
  17270. } );
  17271. /***/ }),
  17272. /***/ "./node_modules/laravel-echo/dist/echo.js":
  17273. /*!************************************************!*\
  17274. !*** ./node_modules/laravel-echo/dist/echo.js ***!
  17275. \************************************************/
  17276. /*! exports provided: default */
  17277. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  17278. "use strict";
  17279. __webpack_require__.r(__webpack_exports__);
  17280. var classCallCheck = function (instance, Constructor) {
  17281. if (!(instance instanceof Constructor)) {
  17282. throw new TypeError("Cannot call a class as a function");
  17283. }
  17284. };
  17285. var createClass = function () {
  17286. function defineProperties(target, props) {
  17287. for (var i = 0; i < props.length; i++) {
  17288. var descriptor = props[i];
  17289. descriptor.enumerable = descriptor.enumerable || false;
  17290. descriptor.configurable = true;
  17291. if ("value" in descriptor) descriptor.writable = true;
  17292. Object.defineProperty(target, descriptor.key, descriptor);
  17293. }
  17294. }
  17295. return function (Constructor, protoProps, staticProps) {
  17296. if (protoProps) defineProperties(Constructor.prototype, protoProps);
  17297. if (staticProps) defineProperties(Constructor, staticProps);
  17298. return Constructor;
  17299. };
  17300. }();
  17301. var _extends = Object.assign || function (target) {
  17302. for (var i = 1; i < arguments.length; i++) {
  17303. var source = arguments[i];
  17304. for (var key in source) {
  17305. if (Object.prototype.hasOwnProperty.call(source, key)) {
  17306. target[key] = source[key];
  17307. }
  17308. }
  17309. }
  17310. return target;
  17311. };
  17312. var inherits = function (subClass, superClass) {
  17313. if (typeof superClass !== "function" && superClass !== null) {
  17314. throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
  17315. }
  17316. subClass.prototype = Object.create(superClass && superClass.prototype, {
  17317. constructor: {
  17318. value: subClass,
  17319. enumerable: false,
  17320. writable: true,
  17321. configurable: true
  17322. }
  17323. });
  17324. if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
  17325. };
  17326. var possibleConstructorReturn = function (self, call) {
  17327. if (!self) {
  17328. throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  17329. }
  17330. return call && (typeof call === "object" || typeof call === "function") ? call : self;
  17331. };
  17332. var Connector = function () {
  17333. /**
  17334. * Create a new class instance.
  17335. */
  17336. function Connector(options) {
  17337. classCallCheck(this, Connector);
  17338. /**
  17339. * Default connector options.
  17340. */
  17341. this._defaultOptions = {
  17342. auth: {
  17343. headers: {}
  17344. },
  17345. authEndpoint: '/broadcasting/auth',
  17346. broadcaster: 'pusher',
  17347. csrfToken: null,
  17348. host: null,
  17349. key: null,
  17350. namespace: 'App.Events'
  17351. };
  17352. this.setOptions(options);
  17353. this.connect();
  17354. }
  17355. /**
  17356. * Merge the custom options with the defaults.
  17357. */
  17358. createClass(Connector, [{
  17359. key: 'setOptions',
  17360. value: function setOptions(options) {
  17361. this.options = _extends(this._defaultOptions, options);
  17362. if (this.csrfToken()) {
  17363. this.options.auth.headers['X-CSRF-TOKEN'] = this.csrfToken();
  17364. }
  17365. return options;
  17366. }
  17367. /**
  17368. * Extract the CSRF token from the page.
  17369. */
  17370. }, {
  17371. key: 'csrfToken',
  17372. value: function csrfToken() {
  17373. var selector = void 0;
  17374. if (typeof window !== 'undefined' && window['Laravel'] && window['Laravel'].csrfToken) {
  17375. return window['Laravel'].csrfToken;
  17376. } else if (this.options.csrfToken) {
  17377. return this.options.csrfToken;
  17378. } else if (typeof document !== 'undefined' && typeof document.querySelector === 'function' && (selector = document.querySelector('meta[name="csrf-token"]'))) {
  17379. return selector.getAttribute('content');
  17380. }
  17381. return null;
  17382. }
  17383. }]);
  17384. return Connector;
  17385. }();
  17386. /**
  17387. * This class represents a basic channel.
  17388. */
  17389. var Channel = function () {
  17390. function Channel() {
  17391. classCallCheck(this, Channel);
  17392. }
  17393. createClass(Channel, [{
  17394. key: 'listenForWhisper',
  17395. /**
  17396. * Listen for a whisper event on the channel instance.
  17397. */
  17398. value: function listenForWhisper(event, callback) {
  17399. return this.listen('.client-' + event, callback);
  17400. }
  17401. /**
  17402. * Listen for an event on the channel instance.
  17403. */
  17404. }, {
  17405. key: 'notification',
  17406. value: function notification(callback) {
  17407. return this.listen('.Illuminate\\Notifications\\Events\\BroadcastNotificationCreated', callback);
  17408. }
  17409. /**
  17410. * Stop listening for a whispser event on the channel instance.
  17411. */
  17412. }, {
  17413. key: 'stopListeningForWhisper',
  17414. value: function stopListeningForWhisper(event) {
  17415. return this.stopListening('.client-' + event);
  17416. }
  17417. }]);
  17418. return Channel;
  17419. }();
  17420. /**
  17421. * Event name formatter
  17422. */
  17423. var EventFormatter = function () {
  17424. /**
  17425. * Create a new class instance.
  17426. */
  17427. function EventFormatter(namespace) {
  17428. classCallCheck(this, EventFormatter);
  17429. this.setNamespace(namespace);
  17430. }
  17431. /**
  17432. * Format the given event name.
  17433. */
  17434. createClass(EventFormatter, [{
  17435. key: 'format',
  17436. value: function format(event) {
  17437. if (event.charAt(0) === '.' || event.charAt(0) === '\\') {
  17438. return event.substr(1);
  17439. } else if (this.namespace) {
  17440. event = this.namespace + '.' + event;
  17441. }
  17442. return event.replace(/\./g, '\\');
  17443. }
  17444. /**
  17445. * Set the event namespace.
  17446. */
  17447. }, {
  17448. key: 'setNamespace',
  17449. value: function setNamespace(value) {
  17450. this.namespace = value;
  17451. }
  17452. }]);
  17453. return EventFormatter;
  17454. }();
  17455. /**
  17456. * This class represents a Pusher channel.
  17457. */
  17458. var PusherChannel = function (_Channel) {
  17459. inherits(PusherChannel, _Channel);
  17460. /**
  17461. * Create a new class instance.
  17462. */
  17463. function PusherChannel(pusher, name, options) {
  17464. classCallCheck(this, PusherChannel);
  17465. var _this = possibleConstructorReturn(this, (PusherChannel.__proto__ || Object.getPrototypeOf(PusherChannel)).call(this));
  17466. _this.name = name;
  17467. _this.pusher = pusher;
  17468. _this.options = options;
  17469. _this.eventFormatter = new EventFormatter(_this.options.namespace);
  17470. _this.subscribe();
  17471. return _this;
  17472. }
  17473. /**
  17474. * Subscribe to a Pusher channel.
  17475. */
  17476. createClass(PusherChannel, [{
  17477. key: 'subscribe',
  17478. value: function subscribe() {
  17479. this.subscription = this.pusher.subscribe(this.name);
  17480. }
  17481. /**
  17482. * Unsubscribe from a Pusher channel.
  17483. */
  17484. }, {
  17485. key: 'unsubscribe',
  17486. value: function unsubscribe() {
  17487. this.pusher.unsubscribe(this.name);
  17488. }
  17489. /**
  17490. * Listen for an event on the channel instance.
  17491. */
  17492. }, {
  17493. key: 'listen',
  17494. value: function listen(event, callback) {
  17495. this.on(this.eventFormatter.format(event), callback);
  17496. return this;
  17497. }
  17498. /**
  17499. * Stop listening for an event on the channel instance.
  17500. */
  17501. }, {
  17502. key: 'stopListening',
  17503. value: function stopListening(event) {
  17504. this.subscription.unbind(this.eventFormatter.format(event));
  17505. return this;
  17506. }
  17507. /**
  17508. * Bind a channel to an event.
  17509. */
  17510. }, {
  17511. key: 'on',
  17512. value: function on(event, callback) {
  17513. this.subscription.bind(event, callback);
  17514. return this;
  17515. }
  17516. }]);
  17517. return PusherChannel;
  17518. }(Channel);
  17519. /**
  17520. * This class represents a Pusher private channel.
  17521. */
  17522. var PusherPrivateChannel = function (_PusherChannel) {
  17523. inherits(PusherPrivateChannel, _PusherChannel);
  17524. function PusherPrivateChannel() {
  17525. classCallCheck(this, PusherPrivateChannel);
  17526. return possibleConstructorReturn(this, (PusherPrivateChannel.__proto__ || Object.getPrototypeOf(PusherPrivateChannel)).apply(this, arguments));
  17527. }
  17528. createClass(PusherPrivateChannel, [{
  17529. key: 'whisper',
  17530. /**
  17531. * Trigger client event on the channel.
  17532. */
  17533. value: function whisper(eventName, data) {
  17534. this.pusher.channels.channels[this.name].trigger('client-' + eventName, data);
  17535. return this;
  17536. }
  17537. }]);
  17538. return PusherPrivateChannel;
  17539. }(PusherChannel);
  17540. /**
  17541. * This class represents a Pusher presence channel.
  17542. */
  17543. var PusherPresenceChannel = function (_PusherChannel) {
  17544. inherits(PusherPresenceChannel, _PusherChannel);
  17545. function PusherPresenceChannel() {
  17546. classCallCheck(this, PusherPresenceChannel);
  17547. return possibleConstructorReturn(this, (PusherPresenceChannel.__proto__ || Object.getPrototypeOf(PusherPresenceChannel)).apply(this, arguments));
  17548. }
  17549. createClass(PusherPresenceChannel, [{
  17550. key: 'here',
  17551. /**
  17552. * Register a callback to be called anytime the member list changes.
  17553. */
  17554. value: function here(callback) {
  17555. this.on('pusher:subscription_succeeded', function (data) {
  17556. callback(Object.keys(data.members).map(function (k) {
  17557. return data.members[k];
  17558. }));
  17559. });
  17560. return this;
  17561. }
  17562. /**
  17563. * Listen for someone joining the channel.
  17564. */
  17565. }, {
  17566. key: 'joining',
  17567. value: function joining(callback) {
  17568. this.on('pusher:member_added', function (member) {
  17569. callback(member.info);
  17570. });
  17571. return this;
  17572. }
  17573. /**
  17574. * Listen for someone leaving the channel.
  17575. */
  17576. }, {
  17577. key: 'leaving',
  17578. value: function leaving(callback) {
  17579. this.on('pusher:member_removed', function (member) {
  17580. callback(member.info);
  17581. });
  17582. return this;
  17583. }
  17584. /**
  17585. * Trigger client event on the channel.
  17586. */
  17587. }, {
  17588. key: 'whisper',
  17589. value: function whisper(eventName, data) {
  17590. this.pusher.channels.channels[this.name].trigger('client-' + eventName, data);
  17591. return this;
  17592. }
  17593. }]);
  17594. return PusherPresenceChannel;
  17595. }(PusherChannel);
  17596. /**
  17597. * This class represents a Socket.io channel.
  17598. */
  17599. var SocketIoChannel = function (_Channel) {
  17600. inherits(SocketIoChannel, _Channel);
  17601. /**
  17602. * Create a new class instance.
  17603. */
  17604. function SocketIoChannel(socket, name, options) {
  17605. classCallCheck(this, SocketIoChannel);
  17606. /**
  17607. * The event callbacks applied to the channel.
  17608. */
  17609. var _this = possibleConstructorReturn(this, (SocketIoChannel.__proto__ || Object.getPrototypeOf(SocketIoChannel)).call(this));
  17610. _this.events = {};
  17611. _this.name = name;
  17612. _this.socket = socket;
  17613. _this.options = options;
  17614. _this.eventFormatter = new EventFormatter(_this.options.namespace);
  17615. _this.subscribe();
  17616. _this.configureReconnector();
  17617. return _this;
  17618. }
  17619. /**
  17620. * Subscribe to a Socket.io channel.
  17621. */
  17622. createClass(SocketIoChannel, [{
  17623. key: 'subscribe',
  17624. value: function subscribe() {
  17625. this.socket.emit('subscribe', {
  17626. channel: this.name,
  17627. auth: this.options.auth || {}
  17628. });
  17629. }
  17630. /**
  17631. * Unsubscribe from channel and ubind event callbacks.
  17632. */
  17633. }, {
  17634. key: 'unsubscribe',
  17635. value: function unsubscribe() {
  17636. this.unbind();
  17637. this.socket.emit('unsubscribe', {
  17638. channel: this.name,
  17639. auth: this.options.auth || {}
  17640. });
  17641. }
  17642. /**
  17643. * Listen for an event on the channel instance.
  17644. */
  17645. }, {
  17646. key: 'listen',
  17647. value: function listen(event, callback) {
  17648. this.on(this.eventFormatter.format(event), callback);
  17649. return this;
  17650. }
  17651. /**
  17652. * Stop listening for an event on the channel instance.
  17653. */
  17654. }, {
  17655. key: 'stopListening',
  17656. value: function stopListening(event) {
  17657. var name = this.eventFormatter.format(event);
  17658. this.socket.removeListener(name);
  17659. delete this.events[name];
  17660. return this;
  17661. }
  17662. /**
  17663. * Bind the channel's socket to an event and store the callback.
  17664. */
  17665. }, {
  17666. key: 'on',
  17667. value: function on(event, callback) {
  17668. var _this2 = this;
  17669. var listener = function listener(channel, data) {
  17670. if (_this2.name == channel) {
  17671. callback(data);
  17672. }
  17673. };
  17674. this.socket.on(event, listener);
  17675. this.bind(event, listener);
  17676. }
  17677. /**
  17678. * Attach a 'reconnect' listener and bind the event.
  17679. */
  17680. }, {
  17681. key: 'configureReconnector',
  17682. value: function configureReconnector() {
  17683. var _this3 = this;
  17684. var listener = function listener() {
  17685. _this3.subscribe();
  17686. };
  17687. this.socket.on('reconnect', listener);
  17688. this.bind('reconnect', listener);
  17689. }
  17690. /**
  17691. * Bind the channel's socket to an event and store the callback.
  17692. */
  17693. }, {
  17694. key: 'bind',
  17695. value: function bind(event, callback) {
  17696. this.events[event] = this.events[event] || [];
  17697. this.events[event].push(callback);
  17698. }
  17699. /**
  17700. * Unbind the channel's socket from all stored event callbacks.
  17701. */
  17702. }, {
  17703. key: 'unbind',
  17704. value: function unbind() {
  17705. var _this4 = this;
  17706. Object.keys(this.events).forEach(function (event) {
  17707. _this4.events[event].forEach(function (callback) {
  17708. _this4.socket.removeListener(event, callback);
  17709. });
  17710. delete _this4.events[event];
  17711. });
  17712. }
  17713. }]);
  17714. return SocketIoChannel;
  17715. }(Channel);
  17716. /**
  17717. * This class represents a Socket.io presence channel.
  17718. */
  17719. var SocketIoPrivateChannel = function (_SocketIoChannel) {
  17720. inherits(SocketIoPrivateChannel, _SocketIoChannel);
  17721. function SocketIoPrivateChannel() {
  17722. classCallCheck(this, SocketIoPrivateChannel);
  17723. return possibleConstructorReturn(this, (SocketIoPrivateChannel.__proto__ || Object.getPrototypeOf(SocketIoPrivateChannel)).apply(this, arguments));
  17724. }
  17725. createClass(SocketIoPrivateChannel, [{
  17726. key: 'whisper',
  17727. /**
  17728. * Trigger client event on the channel.
  17729. */
  17730. value: function whisper(eventName, data) {
  17731. this.socket.emit('client event', {
  17732. channel: this.name,
  17733. event: 'client-' + eventName,
  17734. data: data
  17735. });
  17736. return this;
  17737. }
  17738. }]);
  17739. return SocketIoPrivateChannel;
  17740. }(SocketIoChannel);
  17741. /**
  17742. * This class represents a Socket.io presence channel.
  17743. */
  17744. var SocketIoPresenceChannel = function (_SocketIoPrivateChann) {
  17745. inherits(SocketIoPresenceChannel, _SocketIoPrivateChann);
  17746. function SocketIoPresenceChannel() {
  17747. classCallCheck(this, SocketIoPresenceChannel);
  17748. return possibleConstructorReturn(this, (SocketIoPresenceChannel.__proto__ || Object.getPrototypeOf(SocketIoPresenceChannel)).apply(this, arguments));
  17749. }
  17750. createClass(SocketIoPresenceChannel, [{
  17751. key: 'here',
  17752. /**
  17753. * Register a callback to be called anytime the member list changes.
  17754. */
  17755. value: function here(callback) {
  17756. this.on('presence:subscribed', function (members) {
  17757. callback(members.map(function (m) {
  17758. return m.user_info;
  17759. }));
  17760. });
  17761. return this;
  17762. }
  17763. /**
  17764. * Listen for someone joining the channel.
  17765. */
  17766. }, {
  17767. key: 'joining',
  17768. value: function joining(callback) {
  17769. this.on('presence:joining', function (member) {
  17770. return callback(member.user_info);
  17771. });
  17772. return this;
  17773. }
  17774. /**
  17775. * Listen for someone leaving the channel.
  17776. */
  17777. }, {
  17778. key: 'leaving',
  17779. value: function leaving(callback) {
  17780. this.on('presence:leaving', function (member) {
  17781. return callback(member.user_info);
  17782. });
  17783. return this;
  17784. }
  17785. }]);
  17786. return SocketIoPresenceChannel;
  17787. }(SocketIoPrivateChannel);
  17788. /**
  17789. * This class represents a null channel.
  17790. */
  17791. var NullChannel = function (_Channel) {
  17792. inherits(NullChannel, _Channel);
  17793. function NullChannel() {
  17794. classCallCheck(this, NullChannel);
  17795. return possibleConstructorReturn(this, (NullChannel.__proto__ || Object.getPrototypeOf(NullChannel)).apply(this, arguments));
  17796. }
  17797. createClass(NullChannel, [{
  17798. key: 'subscribe',
  17799. /**
  17800. * Subscribe to a channel.
  17801. */
  17802. value: function subscribe() {}
  17803. //
  17804. /**
  17805. * Unsubscribe from a channel.
  17806. */
  17807. }, {
  17808. key: 'unsubscribe',
  17809. value: function unsubscribe() {}
  17810. //
  17811. /**
  17812. * Listen for an event on the channel instance.
  17813. */
  17814. }, {
  17815. key: 'listen',
  17816. value: function listen(event, callback) {
  17817. return this;
  17818. }
  17819. /**
  17820. * Stop listening for an event on the channel instance.
  17821. */
  17822. }, {
  17823. key: 'stopListening',
  17824. value: function stopListening(event) {
  17825. return this;
  17826. }
  17827. /**
  17828. * Bind a channel to an event.
  17829. */
  17830. }, {
  17831. key: 'on',
  17832. value: function on(event, callback) {
  17833. return this;
  17834. }
  17835. }]);
  17836. return NullChannel;
  17837. }(Channel);
  17838. /**
  17839. * This class represents a null private channel.
  17840. */
  17841. var NullPrivateChannel = function (_NullChannel) {
  17842. inherits(NullPrivateChannel, _NullChannel);
  17843. function NullPrivateChannel() {
  17844. classCallCheck(this, NullPrivateChannel);
  17845. return possibleConstructorReturn(this, (NullPrivateChannel.__proto__ || Object.getPrototypeOf(NullPrivateChannel)).apply(this, arguments));
  17846. }
  17847. createClass(NullPrivateChannel, [{
  17848. key: 'whisper',
  17849. /**
  17850. * Trigger client event on the channel.
  17851. */
  17852. value: function whisper(eventName, data) {
  17853. return this;
  17854. }
  17855. }]);
  17856. return NullPrivateChannel;
  17857. }(NullChannel);
  17858. /**
  17859. * This class represents a null presence channel.
  17860. */
  17861. var NullPresenceChannel = function (_NullChannel) {
  17862. inherits(NullPresenceChannel, _NullChannel);
  17863. function NullPresenceChannel() {
  17864. classCallCheck(this, NullPresenceChannel);
  17865. return possibleConstructorReturn(this, (NullPresenceChannel.__proto__ || Object.getPrototypeOf(NullPresenceChannel)).apply(this, arguments));
  17866. }
  17867. createClass(NullPresenceChannel, [{
  17868. key: 'here',
  17869. /**
  17870. * Register a callback to be called anytime the member list changes.
  17871. */
  17872. value: function here(callback) {
  17873. return this;
  17874. }
  17875. /**
  17876. * Listen for someone joining the channel.
  17877. */
  17878. }, {
  17879. key: 'joining',
  17880. value: function joining(callback) {
  17881. return this;
  17882. }
  17883. /**
  17884. * Listen for someone leaving the channel.
  17885. */
  17886. }, {
  17887. key: 'leaving',
  17888. value: function leaving(callback) {
  17889. return this;
  17890. }
  17891. /**
  17892. * Trigger client event on the channel.
  17893. */
  17894. }, {
  17895. key: 'whisper',
  17896. value: function whisper(eventName, data) {
  17897. return this;
  17898. }
  17899. }]);
  17900. return NullPresenceChannel;
  17901. }(NullChannel);
  17902. /**
  17903. * This class creates a connector to Pusher.
  17904. */
  17905. var PusherConnector = function (_Connector) {
  17906. inherits(PusherConnector, _Connector);
  17907. function PusherConnector() {
  17908. classCallCheck(this, PusherConnector);
  17909. /**
  17910. * All of the subscribed channel names.
  17911. */
  17912. var _this = possibleConstructorReturn(this, (PusherConnector.__proto__ || Object.getPrototypeOf(PusherConnector)).apply(this, arguments));
  17913. _this.channels = {};
  17914. return _this;
  17915. }
  17916. /**
  17917. * Create a fresh Pusher connection.
  17918. */
  17919. createClass(PusherConnector, [{
  17920. key: 'connect',
  17921. value: function connect() {
  17922. if (typeof this.options.client !== 'undefined') {
  17923. this.pusher = this.options.client;
  17924. } else {
  17925. this.pusher = new Pusher(this.options.key, this.options);
  17926. }
  17927. }
  17928. /**
  17929. * Listen for an event on a channel instance.
  17930. */
  17931. }, {
  17932. key: 'listen',
  17933. value: function listen(name, event, callback) {
  17934. return this.channel(name).listen(event, callback);
  17935. }
  17936. /**
  17937. * Get a channel instance by name.
  17938. */
  17939. }, {
  17940. key: 'channel',
  17941. value: function channel(name) {
  17942. if (!this.channels[name]) {
  17943. this.channels[name] = new PusherChannel(this.pusher, name, this.options);
  17944. }
  17945. return this.channels[name];
  17946. }
  17947. /**
  17948. * Get a private channel instance by name.
  17949. */
  17950. }, {
  17951. key: 'privateChannel',
  17952. value: function privateChannel(name) {
  17953. if (!this.channels['private-' + name]) {
  17954. this.channels['private-' + name] = new PusherPrivateChannel(this.pusher, 'private-' + name, this.options);
  17955. }
  17956. return this.channels['private-' + name];
  17957. }
  17958. /**
  17959. * Get a presence channel instance by name.
  17960. */
  17961. }, {
  17962. key: 'presenceChannel',
  17963. value: function presenceChannel(name) {
  17964. if (!this.channels['presence-' + name]) {
  17965. this.channels['presence-' + name] = new PusherPresenceChannel(this.pusher, 'presence-' + name, this.options);
  17966. }
  17967. return this.channels['presence-' + name];
  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. var _this2 = this;
  17976. var channels = [name, 'private-' + name, 'presence-' + name];
  17977. channels.forEach(function (name, index) {
  17978. _this2.leaveChannel(name);
  17979. });
  17980. }
  17981. /**
  17982. * Leave the given channel.
  17983. */
  17984. }, {
  17985. key: 'leaveChannel',
  17986. value: function leaveChannel(name) {
  17987. if (this.channels[name]) {
  17988. this.channels[name].unsubscribe();
  17989. delete this.channels[name];
  17990. }
  17991. }
  17992. /**
  17993. * Get the socket ID for the connection.
  17994. */
  17995. }, {
  17996. key: 'socketId',
  17997. value: function socketId() {
  17998. return this.pusher.connection.socket_id;
  17999. }
  18000. /**
  18001. * Disconnect Pusher connection.
  18002. */
  18003. }, {
  18004. key: 'disconnect',
  18005. value: function disconnect() {
  18006. this.pusher.disconnect();
  18007. }
  18008. }]);
  18009. return PusherConnector;
  18010. }(Connector);
  18011. /**
  18012. * This class creates a connnector to a Socket.io server.
  18013. */
  18014. var SocketIoConnector = function (_Connector) {
  18015. inherits(SocketIoConnector, _Connector);
  18016. function SocketIoConnector() {
  18017. classCallCheck(this, SocketIoConnector);
  18018. /**
  18019. * All of the subscribed channel names.
  18020. */
  18021. var _this = possibleConstructorReturn(this, (SocketIoConnector.__proto__ || Object.getPrototypeOf(SocketIoConnector)).apply(this, arguments));
  18022. _this.channels = {};
  18023. return _this;
  18024. }
  18025. /**
  18026. * Create a fresh Socket.io connection.
  18027. */
  18028. createClass(SocketIoConnector, [{
  18029. key: 'connect',
  18030. value: function connect() {
  18031. var io = this.getSocketIO();
  18032. this.socket = io(this.options.host, this.options);
  18033. return this.socket;
  18034. }
  18035. /**
  18036. * Get socket.io module from global scope or options.
  18037. */
  18038. }, {
  18039. key: 'getSocketIO',
  18040. value: function getSocketIO() {
  18041. if (typeof this.options.client !== 'undefined') {
  18042. return this.options.client;
  18043. }
  18044. if (typeof io !== 'undefined') {
  18045. return io;
  18046. }
  18047. throw new Error('Socket.io client not found. Should be globally available or passed via options.client');
  18048. }
  18049. /**
  18050. * Listen for an event on a channel instance.
  18051. */
  18052. }, {
  18053. key: 'listen',
  18054. value: function listen(name, event, callback) {
  18055. return this.channel(name).listen(event, callback);
  18056. }
  18057. /**
  18058. * Get a channel instance by name.
  18059. */
  18060. }, {
  18061. key: 'channel',
  18062. value: function channel(name) {
  18063. if (!this.channels[name]) {
  18064. this.channels[name] = new SocketIoChannel(this.socket, name, this.options);
  18065. }
  18066. return this.channels[name];
  18067. }
  18068. /**
  18069. * Get a private channel instance by name.
  18070. */
  18071. }, {
  18072. key: 'privateChannel',
  18073. value: function privateChannel(name) {
  18074. if (!this.channels['private-' + name]) {
  18075. this.channels['private-' + name] = new SocketIoPrivateChannel(this.socket, 'private-' + name, this.options);
  18076. }
  18077. return this.channels['private-' + name];
  18078. }
  18079. /**
  18080. * Get a presence channel instance by name.
  18081. */
  18082. }, {
  18083. key: 'presenceChannel',
  18084. value: function presenceChannel(name) {
  18085. if (!this.channels['presence-' + name]) {
  18086. this.channels['presence-' + name] = new SocketIoPresenceChannel(this.socket, 'presence-' + name, this.options);
  18087. }
  18088. return this.channels['presence-' + name];
  18089. }
  18090. /**
  18091. * Leave the given channel, as well as its private and presence variants.
  18092. */
  18093. }, {
  18094. key: 'leave',
  18095. value: function leave(name) {
  18096. var _this2 = this;
  18097. var channels = [name, 'private-' + name, 'presence-' + name];
  18098. channels.forEach(function (name) {
  18099. _this2.leaveChannel(name);
  18100. });
  18101. }
  18102. /**
  18103. * Leave the given channel.
  18104. */
  18105. }, {
  18106. key: 'leaveChannel',
  18107. value: function leaveChannel(name) {
  18108. if (this.channels[name]) {
  18109. this.channels[name].unsubscribe();
  18110. delete this.channels[name];
  18111. }
  18112. }
  18113. /**
  18114. * Get the socket ID for the connection.
  18115. */
  18116. }, {
  18117. key: 'socketId',
  18118. value: function socketId() {
  18119. return this.socket.id;
  18120. }
  18121. /**
  18122. * Disconnect Socketio connection.
  18123. */
  18124. }, {
  18125. key: 'disconnect',
  18126. value: function disconnect() {
  18127. this.socket.disconnect();
  18128. }
  18129. }]);
  18130. return SocketIoConnector;
  18131. }(Connector);
  18132. /**
  18133. * This class creates a null connector.
  18134. */
  18135. var NullConnector = function (_Connector) {
  18136. inherits(NullConnector, _Connector);
  18137. function NullConnector() {
  18138. classCallCheck(this, NullConnector);
  18139. /**
  18140. * All of the subscribed channel names.
  18141. */
  18142. var _this = possibleConstructorReturn(this, (NullConnector.__proto__ || Object.getPrototypeOf(NullConnector)).apply(this, arguments));
  18143. _this.channels = {};
  18144. return _this;
  18145. }
  18146. /**
  18147. * Create a fresh connection.
  18148. */
  18149. createClass(NullConnector, [{
  18150. key: 'connect',
  18151. value: function connect() {}
  18152. //
  18153. /**
  18154. * Listen for an event on a channel instance.
  18155. */
  18156. }, {
  18157. key: 'listen',
  18158. value: function listen(name, event, callback) {
  18159. return new NullChannel();
  18160. }
  18161. /**
  18162. * Get a channel instance by name.
  18163. */
  18164. }, {
  18165. key: 'channel',
  18166. value: function channel(name) {
  18167. return new NullChannel();
  18168. }
  18169. /**
  18170. * Get a private channel instance by name.
  18171. */
  18172. }, {
  18173. key: 'privateChannel',
  18174. value: function privateChannel(name) {
  18175. return new NullPrivateChannel();
  18176. }
  18177. /**
  18178. * Get a presence channel instance by name.
  18179. */
  18180. }, {
  18181. key: 'presenceChannel',
  18182. value: function presenceChannel(name) {
  18183. return new NullPresenceChannel();
  18184. }
  18185. /**
  18186. * Leave the given channel, as well as its private and presence variants.
  18187. */
  18188. }, {
  18189. key: 'leave',
  18190. value: function leave(name) {}
  18191. //
  18192. /**
  18193. * Leave the given channel.
  18194. */
  18195. }, {
  18196. key: 'leaveChannel',
  18197. value: function leaveChannel(name) {}
  18198. //
  18199. /**
  18200. * Get the socket ID for the connection.
  18201. */
  18202. }, {
  18203. key: 'socketId',
  18204. value: function socketId() {
  18205. return 'fake-socket-id';
  18206. }
  18207. /**
  18208. * Disconnect the connection.
  18209. */
  18210. }, {
  18211. key: 'disconnect',
  18212. value: function disconnect() {
  18213. //
  18214. }
  18215. }]);
  18216. return NullConnector;
  18217. }(Connector);
  18218. /**
  18219. * This class is the primary API for interacting with broadcasting.
  18220. */
  18221. var Echo = function () {
  18222. /**
  18223. * Create a new class instance.
  18224. */
  18225. function Echo(options) {
  18226. classCallCheck(this, Echo);
  18227. this.options = options;
  18228. this.connect();
  18229. if (!this.options.withoutInterceptors) {
  18230. this.registerInterceptors();
  18231. }
  18232. }
  18233. /**
  18234. * Get a channel instance by name.
  18235. */
  18236. createClass(Echo, [{
  18237. key: 'channel',
  18238. value: function channel(_channel) {
  18239. return this.connector.channel(_channel);
  18240. }
  18241. /**
  18242. * Create a new connection.
  18243. */
  18244. }, {
  18245. key: 'connect',
  18246. value: function connect() {
  18247. if (this.options.broadcaster == 'pusher') {
  18248. this.connector = new PusherConnector(this.options);
  18249. } else if (this.options.broadcaster == 'socket.io') {
  18250. this.connector = new SocketIoConnector(this.options);
  18251. } else if (this.options.broadcaster == 'null') {
  18252. this.connector = new NullConnector(this.options);
  18253. } else if (typeof this.options.broadcaster == 'function') {
  18254. this.connector = new this.options.broadcaster(this.options);
  18255. }
  18256. }
  18257. /**
  18258. * Disconnect from the Echo server.
  18259. */
  18260. }, {
  18261. key: 'disconnect',
  18262. value: function disconnect() {
  18263. this.connector.disconnect();
  18264. }
  18265. /**
  18266. * Get a presence channel instance by name.
  18267. */
  18268. }, {
  18269. key: 'join',
  18270. value: function join(channel) {
  18271. return this.connector.presenceChannel(channel);
  18272. }
  18273. /**
  18274. * Leave the given channel, as well as its private and presence variants.
  18275. */
  18276. }, {
  18277. key: 'leave',
  18278. value: function leave(channel) {
  18279. this.connector.leave(channel);
  18280. }
  18281. /**
  18282. * Leave the given channel.
  18283. */
  18284. }, {
  18285. key: 'leaveChannel',
  18286. value: function leaveChannel(channel) {
  18287. this.connector.leaveChannel(channel);
  18288. }
  18289. /**
  18290. * Listen for an event on a channel instance.
  18291. */
  18292. }, {
  18293. key: 'listen',
  18294. value: function listen(channel, event, callback) {
  18295. return this.connector.listen(channel, event, callback);
  18296. }
  18297. /**
  18298. * Get a private channel instance by name.
  18299. */
  18300. }, {
  18301. key: 'private',
  18302. value: function _private(channel) {
  18303. return this.connector.privateChannel(channel);
  18304. }
  18305. /**
  18306. * Get the Socket ID for the connection.
  18307. */
  18308. }, {
  18309. key: 'socketId',
  18310. value: function socketId() {
  18311. return this.connector.socketId();
  18312. }
  18313. /**
  18314. * Register 3rd party request interceptiors. These are used to automatically
  18315. * send a connections socket id to a Laravel app with a X-Socket-Id header.
  18316. */
  18317. }, {
  18318. key: 'registerInterceptors',
  18319. value: function registerInterceptors() {
  18320. if (typeof Vue === 'function' && Vue.http) {
  18321. this.registerVueRequestInterceptor();
  18322. }
  18323. if (typeof axios === 'function') {
  18324. this.registerAxiosRequestInterceptor();
  18325. }
  18326. if (typeof jQuery === 'function') {
  18327. this.registerjQueryAjaxSetup();
  18328. }
  18329. }
  18330. /**
  18331. * Register a Vue HTTP interceptor to add the X-Socket-ID header.
  18332. */
  18333. }, {
  18334. key: 'registerVueRequestInterceptor',
  18335. value: function registerVueRequestInterceptor() {
  18336. var _this = this;
  18337. Vue.http.interceptors.push(function (request, next) {
  18338. if (_this.socketId()) {
  18339. request.headers.set('X-Socket-ID', _this.socketId());
  18340. }
  18341. next();
  18342. });
  18343. }
  18344. /**
  18345. * Register an Axios HTTP interceptor to add the X-Socket-ID header.
  18346. */
  18347. }, {
  18348. key: 'registerAxiosRequestInterceptor',
  18349. value: function registerAxiosRequestInterceptor() {
  18350. var _this2 = this;
  18351. axios.interceptors.request.use(function (config) {
  18352. if (_this2.socketId()) {
  18353. config.headers['X-Socket-Id'] = _this2.socketId();
  18354. }
  18355. return config;
  18356. });
  18357. }
  18358. /**
  18359. * Register jQuery AjaxPrefilter to add the X-Socket-ID header.
  18360. */
  18361. }, {
  18362. key: 'registerjQueryAjaxSetup',
  18363. value: function registerjQueryAjaxSetup() {
  18364. var _this3 = this;
  18365. if (typeof jQuery.ajax != 'undefined') {
  18366. jQuery.ajaxPrefilter(function (options, originalOptions, xhr) {
  18367. if (_this3.socketId()) {
  18368. xhr.setRequestHeader('X-Socket-Id', _this3.socketId());
  18369. }
  18370. });
  18371. }
  18372. }
  18373. }]);
  18374. return Echo;
  18375. }();
  18376. /* harmony default export */ __webpack_exports__["default"] = (Echo);
  18377. /***/ }),
  18378. /***/ "./node_modules/lodash/lodash.js":
  18379. /*!***************************************!*\
  18380. !*** ./node_modules/lodash/lodash.js ***!
  18381. \***************************************/
  18382. /*! no static exports found */
  18383. /***/ (function(module, exports, __webpack_require__) {
  18384. /* WEBPACK VAR INJECTION */(function(global, module) {var __WEBPACK_AMD_DEFINE_RESULT__;/**
  18385. * @license
  18386. * Lodash <https://lodash.com/>
  18387. * Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
  18388. * Released under MIT license <https://lodash.com/license>
  18389. * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
  18390. * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
  18391. */
  18392. ;(function() {
  18393. /** Used as a safe reference for `undefined` in pre-ES5 environments. */
  18394. var undefined;
  18395. /** Used as the semantic version number. */
  18396. var VERSION = '4.17.15';
  18397. /** Used as the size to enable large array optimizations. */
  18398. var LARGE_ARRAY_SIZE = 200;
  18399. /** Error message constants. */
  18400. var CORE_ERROR_TEXT = 'Unsupported core-js use. Try https://npms.io/search?q=ponyfill.',
  18401. FUNC_ERROR_TEXT = 'Expected a function';
  18402. /** Used to stand-in for `undefined` hash values. */
  18403. var HASH_UNDEFINED = '__lodash_hash_undefined__';
  18404. /** Used as the maximum memoize cache size. */
  18405. var MAX_MEMOIZE_SIZE = 500;
  18406. /** Used as the internal argument placeholder. */
  18407. var PLACEHOLDER = '__lodash_placeholder__';
  18408. /** Used to compose bitmasks for cloning. */
  18409. var CLONE_DEEP_FLAG = 1,
  18410. CLONE_FLAT_FLAG = 2,
  18411. CLONE_SYMBOLS_FLAG = 4;
  18412. /** Used to compose bitmasks for value comparisons. */
  18413. var COMPARE_PARTIAL_FLAG = 1,
  18414. COMPARE_UNORDERED_FLAG = 2;
  18415. /** Used to compose bitmasks for function metadata. */
  18416. var WRAP_BIND_FLAG = 1,
  18417. WRAP_BIND_KEY_FLAG = 2,
  18418. WRAP_CURRY_BOUND_FLAG = 4,
  18419. WRAP_CURRY_FLAG = 8,
  18420. WRAP_CURRY_RIGHT_FLAG = 16,
  18421. WRAP_PARTIAL_FLAG = 32,
  18422. WRAP_PARTIAL_RIGHT_FLAG = 64,
  18423. WRAP_ARY_FLAG = 128,
  18424. WRAP_REARG_FLAG = 256,
  18425. WRAP_FLIP_FLAG = 512;
  18426. /** Used as default options for `_.truncate`. */
  18427. var DEFAULT_TRUNC_LENGTH = 30,
  18428. DEFAULT_TRUNC_OMISSION = '...';
  18429. /** Used to detect hot functions by number of calls within a span of milliseconds. */
  18430. var HOT_COUNT = 800,
  18431. HOT_SPAN = 16;
  18432. /** Used to indicate the type of lazy iteratees. */
  18433. var LAZY_FILTER_FLAG = 1,
  18434. LAZY_MAP_FLAG = 2,
  18435. LAZY_WHILE_FLAG = 3;
  18436. /** Used as references for various `Number` constants. */
  18437. var INFINITY = 1 / 0,
  18438. MAX_SAFE_INTEGER = 9007199254740991,
  18439. MAX_INTEGER = 1.7976931348623157e+308,
  18440. NAN = 0 / 0;
  18441. /** Used as references for the maximum length and index of an array. */
  18442. var MAX_ARRAY_LENGTH = 4294967295,
  18443. MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1,
  18444. HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH >>> 1;
  18445. /** Used to associate wrap methods with their bit flags. */
  18446. var wrapFlags = [
  18447. ['ary', WRAP_ARY_FLAG],
  18448. ['bind', WRAP_BIND_FLAG],
  18449. ['bindKey', WRAP_BIND_KEY_FLAG],
  18450. ['curry', WRAP_CURRY_FLAG],
  18451. ['curryRight', WRAP_CURRY_RIGHT_FLAG],
  18452. ['flip', WRAP_FLIP_FLAG],
  18453. ['partial', WRAP_PARTIAL_FLAG],
  18454. ['partialRight', WRAP_PARTIAL_RIGHT_FLAG],
  18455. ['rearg', WRAP_REARG_FLAG]
  18456. ];
  18457. /** `Object#toString` result references. */
  18458. var argsTag = '[object Arguments]',
  18459. arrayTag = '[object Array]',
  18460. asyncTag = '[object AsyncFunction]',
  18461. boolTag = '[object Boolean]',
  18462. dateTag = '[object Date]',
  18463. domExcTag = '[object DOMException]',
  18464. errorTag = '[object Error]',
  18465. funcTag = '[object Function]',
  18466. genTag = '[object GeneratorFunction]',
  18467. mapTag = '[object Map]',
  18468. numberTag = '[object Number]',
  18469. nullTag = '[object Null]',
  18470. objectTag = '[object Object]',
  18471. promiseTag = '[object Promise]',
  18472. proxyTag = '[object Proxy]',
  18473. regexpTag = '[object RegExp]',
  18474. setTag = '[object Set]',
  18475. stringTag = '[object String]',
  18476. symbolTag = '[object Symbol]',
  18477. undefinedTag = '[object Undefined]',
  18478. weakMapTag = '[object WeakMap]',
  18479. weakSetTag = '[object WeakSet]';
  18480. var arrayBufferTag = '[object ArrayBuffer]',
  18481. dataViewTag = '[object DataView]',
  18482. float32Tag = '[object Float32Array]',
  18483. float64Tag = '[object Float64Array]',
  18484. int8Tag = '[object Int8Array]',
  18485. int16Tag = '[object Int16Array]',
  18486. int32Tag = '[object Int32Array]',
  18487. uint8Tag = '[object Uint8Array]',
  18488. uint8ClampedTag = '[object Uint8ClampedArray]',
  18489. uint16Tag = '[object Uint16Array]',
  18490. uint32Tag = '[object Uint32Array]';
  18491. /** Used to match empty string literals in compiled template source. */
  18492. var reEmptyStringLeading = /\b__p \+= '';/g,
  18493. reEmptyStringMiddle = /\b(__p \+=) '' \+/g,
  18494. reEmptyStringTrailing = /(__e\(.*?\)|\b__t\)) \+\n'';/g;
  18495. /** Used to match HTML entities and HTML characters. */
  18496. var reEscapedHtml = /&(?:amp|lt|gt|quot|#39);/g,
  18497. reUnescapedHtml = /[&<>"']/g,
  18498. reHasEscapedHtml = RegExp(reEscapedHtml.source),
  18499. reHasUnescapedHtml = RegExp(reUnescapedHtml.source);
  18500. /** Used to match template delimiters. */
  18501. var reEscape = /<%-([\s\S]+?)%>/g,
  18502. reEvaluate = /<%([\s\S]+?)%>/g,
  18503. reInterpolate = /<%=([\s\S]+?)%>/g;
  18504. /** Used to match property names within property paths. */
  18505. var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,
  18506. reIsPlainProp = /^\w*$/,
  18507. rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
  18508. /**
  18509. * Used to match `RegExp`
  18510. * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
  18511. */
  18512. var reRegExpChar = /[\\^$.*+?()[\]{}|]/g,
  18513. reHasRegExpChar = RegExp(reRegExpChar.source);
  18514. /** Used to match leading and trailing whitespace. */
  18515. var reTrim = /^\s+|\s+$/g,
  18516. reTrimStart = /^\s+/,
  18517. reTrimEnd = /\s+$/;
  18518. /** Used to match wrap detail comments. */
  18519. var reWrapComment = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,
  18520. reWrapDetails = /\{\n\/\* \[wrapped with (.+)\] \*/,
  18521. reSplitDetails = /,? & /;
  18522. /** Used to match words composed of alphanumeric characters. */
  18523. var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;
  18524. /** Used to match backslashes in property paths. */
  18525. var reEscapeChar = /\\(\\)?/g;
  18526. /**
  18527. * Used to match
  18528. * [ES template delimiters](http://ecma-international.org/ecma-262/7.0/#sec-template-literal-lexical-components).
  18529. */
  18530. var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g;
  18531. /** Used to match `RegExp` flags from their coerced string values. */
  18532. var reFlags = /\w*$/;
  18533. /** Used to detect bad signed hexadecimal string values. */
  18534. var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
  18535. /** Used to detect binary string values. */
  18536. var reIsBinary = /^0b[01]+$/i;
  18537. /** Used to detect host constructors (Safari). */
  18538. var reIsHostCtor = /^\[object .+?Constructor\]$/;
  18539. /** Used to detect octal string values. */
  18540. var reIsOctal = /^0o[0-7]+$/i;
  18541. /** Used to detect unsigned integer values. */
  18542. var reIsUint = /^(?:0|[1-9]\d*)$/;
  18543. /** Used to match Latin Unicode letters (excluding mathematical operators). */
  18544. var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g;
  18545. /** Used to ensure capturing order of template delimiters. */
  18546. var reNoMatch = /($^)/;
  18547. /** Used to match unescaped characters in compiled string literals. */
  18548. var reUnescapedString = /['\n\r\u2028\u2029\\]/g;
  18549. /** Used to compose unicode character classes. */
  18550. var rsAstralRange = '\\ud800-\\udfff',
  18551. rsComboMarksRange = '\\u0300-\\u036f',
  18552. reComboHalfMarksRange = '\\ufe20-\\ufe2f',
  18553. rsComboSymbolsRange = '\\u20d0-\\u20ff',
  18554. rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange,
  18555. rsDingbatRange = '\\u2700-\\u27bf',
  18556. rsLowerRange = 'a-z\\xdf-\\xf6\\xf8-\\xff',
  18557. rsMathOpRange = '\\xac\\xb1\\xd7\\xf7',
  18558. rsNonCharRange = '\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf',
  18559. rsPunctuationRange = '\\u2000-\\u206f',
  18560. 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',
  18561. rsUpperRange = 'A-Z\\xc0-\\xd6\\xd8-\\xde',
  18562. rsVarRange = '\\ufe0e\\ufe0f',
  18563. rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpaceRange;
  18564. /** Used to compose unicode capture groups. */
  18565. var rsApos = "['\u2019]",
  18566. rsAstral = '[' + rsAstralRange + ']',
  18567. rsBreak = '[' + rsBreakRange + ']',
  18568. rsCombo = '[' + rsComboRange + ']',
  18569. rsDigits = '\\d+',
  18570. rsDingbat = '[' + rsDingbatRange + ']',
  18571. rsLower = '[' + rsLowerRange + ']',
  18572. rsMisc = '[^' + rsAstralRange + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + ']',
  18573. rsFitz = '\\ud83c[\\udffb-\\udfff]',
  18574. rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')',
  18575. rsNonAstral = '[^' + rsAstralRange + ']',
  18576. rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}',
  18577. rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]',
  18578. rsUpper = '[' + rsUpperRange + ']',
  18579. rsZWJ = '\\u200d';
  18580. /** Used to compose unicode regexes. */
  18581. var rsMiscLower = '(?:' + rsLower + '|' + rsMisc + ')',
  18582. rsMiscUpper = '(?:' + rsUpper + '|' + rsMisc + ')',
  18583. rsOptContrLower = '(?:' + rsApos + '(?:d|ll|m|re|s|t|ve))?',
  18584. rsOptContrUpper = '(?:' + rsApos + '(?:D|LL|M|RE|S|T|VE))?',
  18585. reOptMod = rsModifier + '?',
  18586. rsOptVar = '[' + rsVarRange + ']?',
  18587. rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*',
  18588. rsOrdLower = '\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])',
  18589. rsOrdUpper = '\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])',
  18590. rsSeq = rsOptVar + reOptMod + rsOptJoin,
  18591. rsEmoji = '(?:' + [rsDingbat, rsRegional, rsSurrPair].join('|') + ')' + rsSeq,
  18592. rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')';
  18593. /** Used to match apostrophes. */
  18594. var reApos = RegExp(rsApos, 'g');
  18595. /**
  18596. * Used to match [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks) and
  18597. * [combining diacritical marks for symbols](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks_for_Symbols).
  18598. */
  18599. var reComboMark = RegExp(rsCombo, 'g');
  18600. /** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */
  18601. var reUnicode = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g');
  18602. /** Used to match complex or compound words. */
  18603. var reUnicodeWord = RegExp([
  18604. rsUpper + '?' + rsLower + '+' + rsOptContrLower + '(?=' + [rsBreak, rsUpper, '$'].join('|') + ')',
  18605. rsMiscUpper + '+' + rsOptContrUpper + '(?=' + [rsBreak, rsUpper + rsMiscLower, '$'].join('|') + ')',
  18606. rsUpper + '?' + rsMiscLower + '+' + rsOptContrLower,
  18607. rsUpper + '+' + rsOptContrUpper,
  18608. rsOrdUpper,
  18609. rsOrdLower,
  18610. rsDigits,
  18611. rsEmoji
  18612. ].join('|'), 'g');
  18613. /** 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/). */
  18614. var reHasUnicode = RegExp('[' + rsZWJ + rsAstralRange + rsComboRange + rsVarRange + ']');
  18615. /** Used to detect strings that need a more robust regexp to match words. */
  18616. 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 ]/;
  18617. /** Used to assign default `context` object properties. */
  18618. var contextProps = [
  18619. 'Array', 'Buffer', 'DataView', 'Date', 'Error', 'Float32Array', 'Float64Array',
  18620. 'Function', 'Int8Array', 'Int16Array', 'Int32Array', 'Map', 'Math', 'Object',
  18621. 'Promise', 'RegExp', 'Set', 'String', 'Symbol', 'TypeError', 'Uint8Array',
  18622. 'Uint8ClampedArray', 'Uint16Array', 'Uint32Array', 'WeakMap',
  18623. '_', 'clearTimeout', 'isFinite', 'parseInt', 'setTimeout'
  18624. ];
  18625. /** Used to make template sourceURLs easier to identify. */
  18626. var templateCounter = -1;
  18627. /** Used to identify `toStringTag` values of typed arrays. */
  18628. var typedArrayTags = {};
  18629. typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
  18630. typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
  18631. typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
  18632. typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
  18633. typedArrayTags[uint32Tag] = true;
  18634. typedArrayTags[argsTag] = typedArrayTags[arrayTag] =
  18635. typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =
  18636. typedArrayTags[dataViewTag] = typedArrayTags[dateTag] =
  18637. typedArrayTags[errorTag] = typedArrayTags[funcTag] =
  18638. typedArrayTags[mapTag] = typedArrayTags[numberTag] =
  18639. typedArrayTags[objectTag] = typedArrayTags[regexpTag] =
  18640. typedArrayTags[setTag] = typedArrayTags[stringTag] =
  18641. typedArrayTags[weakMapTag] = false;
  18642. /** Used to identify `toStringTag` values supported by `_.clone`. */
  18643. var cloneableTags = {};
  18644. cloneableTags[argsTag] = cloneableTags[arrayTag] =
  18645. cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] =
  18646. cloneableTags[boolTag] = cloneableTags[dateTag] =
  18647. cloneableTags[float32Tag] = cloneableTags[float64Tag] =
  18648. cloneableTags[int8Tag] = cloneableTags[int16Tag] =
  18649. cloneableTags[int32Tag] = cloneableTags[mapTag] =
  18650. cloneableTags[numberTag] = cloneableTags[objectTag] =
  18651. cloneableTags[regexpTag] = cloneableTags[setTag] =
  18652. cloneableTags[stringTag] = cloneableTags[symbolTag] =
  18653. cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] =
  18654. cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true;
  18655. cloneableTags[errorTag] = cloneableTags[funcTag] =
  18656. cloneableTags[weakMapTag] = false;
  18657. /** Used to map Latin Unicode letters to basic Latin letters. */
  18658. var deburredLetters = {
  18659. // Latin-1 Supplement block.
  18660. '\xc0': 'A', '\xc1': 'A', '\xc2': 'A', '\xc3': 'A', '\xc4': 'A', '\xc5': 'A',
  18661. '\xe0': 'a', '\xe1': 'a', '\xe2': 'a', '\xe3': 'a', '\xe4': 'a', '\xe5': 'a',
  18662. '\xc7': 'C', '\xe7': 'c',
  18663. '\xd0': 'D', '\xf0': 'd',
  18664. '\xc8': 'E', '\xc9': 'E', '\xca': 'E', '\xcb': 'E',
  18665. '\xe8': 'e', '\xe9': 'e', '\xea': 'e', '\xeb': 'e',
  18666. '\xcc': 'I', '\xcd': 'I', '\xce': 'I', '\xcf': 'I',
  18667. '\xec': 'i', '\xed': 'i', '\xee': 'i', '\xef': 'i',
  18668. '\xd1': 'N', '\xf1': 'n',
  18669. '\xd2': 'O', '\xd3': 'O', '\xd4': 'O', '\xd5': 'O', '\xd6': 'O', '\xd8': 'O',
  18670. '\xf2': 'o', '\xf3': 'o', '\xf4': 'o', '\xf5': 'o', '\xf6': 'o', '\xf8': 'o',
  18671. '\xd9': 'U', '\xda': 'U', '\xdb': 'U', '\xdc': 'U',
  18672. '\xf9': 'u', '\xfa': 'u', '\xfb': 'u', '\xfc': 'u',
  18673. '\xdd': 'Y', '\xfd': 'y', '\xff': 'y',
  18674. '\xc6': 'Ae', '\xe6': 'ae',
  18675. '\xde': 'Th', '\xfe': 'th',
  18676. '\xdf': 'ss',
  18677. // Latin Extended-A block.
  18678. '\u0100': 'A', '\u0102': 'A', '\u0104': 'A',
  18679. '\u0101': 'a', '\u0103': 'a', '\u0105': 'a',
  18680. '\u0106': 'C', '\u0108': 'C', '\u010a': 'C', '\u010c': 'C',
  18681. '\u0107': 'c', '\u0109': 'c', '\u010b': 'c', '\u010d': 'c',
  18682. '\u010e': 'D', '\u0110': 'D', '\u010f': 'd', '\u0111': 'd',
  18683. '\u0112': 'E', '\u0114': 'E', '\u0116': 'E', '\u0118': 'E', '\u011a': 'E',
  18684. '\u0113': 'e', '\u0115': 'e', '\u0117': 'e', '\u0119': 'e', '\u011b': 'e',
  18685. '\u011c': 'G', '\u011e': 'G', '\u0120': 'G', '\u0122': 'G',
  18686. '\u011d': 'g', '\u011f': 'g', '\u0121': 'g', '\u0123': 'g',
  18687. '\u0124': 'H', '\u0126': 'H', '\u0125': 'h', '\u0127': 'h',
  18688. '\u0128': 'I', '\u012a': 'I', '\u012c': 'I', '\u012e': 'I', '\u0130': 'I',
  18689. '\u0129': 'i', '\u012b': 'i', '\u012d': 'i', '\u012f': 'i', '\u0131': 'i',
  18690. '\u0134': 'J', '\u0135': 'j',
  18691. '\u0136': 'K', '\u0137': 'k', '\u0138': 'k',
  18692. '\u0139': 'L', '\u013b': 'L', '\u013d': 'L', '\u013f': 'L', '\u0141': 'L',
  18693. '\u013a': 'l', '\u013c': 'l', '\u013e': 'l', '\u0140': 'l', '\u0142': 'l',
  18694. '\u0143': 'N', '\u0145': 'N', '\u0147': 'N', '\u014a': 'N',
  18695. '\u0144': 'n', '\u0146': 'n', '\u0148': 'n', '\u014b': 'n',
  18696. '\u014c': 'O', '\u014e': 'O', '\u0150': 'O',
  18697. '\u014d': 'o', '\u014f': 'o', '\u0151': 'o',
  18698. '\u0154': 'R', '\u0156': 'R', '\u0158': 'R',
  18699. '\u0155': 'r', '\u0157': 'r', '\u0159': 'r',
  18700. '\u015a': 'S', '\u015c': 'S', '\u015e': 'S', '\u0160': 'S',
  18701. '\u015b': 's', '\u015d': 's', '\u015f': 's', '\u0161': 's',
  18702. '\u0162': 'T', '\u0164': 'T', '\u0166': 'T',
  18703. '\u0163': 't', '\u0165': 't', '\u0167': 't',
  18704. '\u0168': 'U', '\u016a': 'U', '\u016c': 'U', '\u016e': 'U', '\u0170': 'U', '\u0172': 'U',
  18705. '\u0169': 'u', '\u016b': 'u', '\u016d': 'u', '\u016f': 'u', '\u0171': 'u', '\u0173': 'u',
  18706. '\u0174': 'W', '\u0175': 'w',
  18707. '\u0176': 'Y', '\u0177': 'y', '\u0178': 'Y',
  18708. '\u0179': 'Z', '\u017b': 'Z', '\u017d': 'Z',
  18709. '\u017a': 'z', '\u017c': 'z', '\u017e': 'z',
  18710. '\u0132': 'IJ', '\u0133': 'ij',
  18711. '\u0152': 'Oe', '\u0153': 'oe',
  18712. '\u0149': "'n", '\u017f': 's'
  18713. };
  18714. /** Used to map characters to HTML entities. */
  18715. var htmlEscapes = {
  18716. '&': '&amp;',
  18717. '<': '&lt;',
  18718. '>': '&gt;',
  18719. '"': '&quot;',
  18720. "'": '&#39;'
  18721. };
  18722. /** Used to map HTML entities to characters. */
  18723. var htmlUnescapes = {
  18724. '&amp;': '&',
  18725. '&lt;': '<',
  18726. '&gt;': '>',
  18727. '&quot;': '"',
  18728. '&#39;': "'"
  18729. };
  18730. /** Used to escape characters for inclusion in compiled string literals. */
  18731. var stringEscapes = {
  18732. '\\': '\\',
  18733. "'": "'",
  18734. '\n': 'n',
  18735. '\r': 'r',
  18736. '\u2028': 'u2028',
  18737. '\u2029': 'u2029'
  18738. };
  18739. /** Built-in method references without a dependency on `root`. */
  18740. var freeParseFloat = parseFloat,
  18741. freeParseInt = parseInt;
  18742. /** Detect free variable `global` from Node.js. */
  18743. var freeGlobal = typeof global == 'object' && global && global.Object === Object && global;
  18744. /** Detect free variable `self`. */
  18745. var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
  18746. /** Used as a reference to the global object. */
  18747. var root = freeGlobal || freeSelf || Function('return this')();
  18748. /** Detect free variable `exports`. */
  18749. var freeExports = true && exports && !exports.nodeType && exports;
  18750. /** Detect free variable `module`. */
  18751. var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;
  18752. /** Detect the popular CommonJS extension `module.exports`. */
  18753. var moduleExports = freeModule && freeModule.exports === freeExports;
  18754. /** Detect free variable `process` from Node.js. */
  18755. var freeProcess = moduleExports && freeGlobal.process;
  18756. /** Used to access faster Node.js helpers. */
  18757. var nodeUtil = (function() {
  18758. try {
  18759. // Use `util.types` for Node.js 10+.
  18760. var types = freeModule && freeModule.require && freeModule.require('util').types;
  18761. if (types) {
  18762. return types;
  18763. }
  18764. // Legacy `process.binding('util')` for Node.js < 10.
  18765. return freeProcess && freeProcess.binding && freeProcess.binding('util');
  18766. } catch (e) {}
  18767. }());
  18768. /* Node.js helper references. */
  18769. var nodeIsArrayBuffer = nodeUtil && nodeUtil.isArrayBuffer,
  18770. nodeIsDate = nodeUtil && nodeUtil.isDate,
  18771. nodeIsMap = nodeUtil && nodeUtil.isMap,
  18772. nodeIsRegExp = nodeUtil && nodeUtil.isRegExp,
  18773. nodeIsSet = nodeUtil && nodeUtil.isSet,
  18774. nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
  18775. /*--------------------------------------------------------------------------*/
  18776. /**
  18777. * A faster alternative to `Function#apply`, this function invokes `func`
  18778. * with the `this` binding of `thisArg` and the arguments of `args`.
  18779. *
  18780. * @private
  18781. * @param {Function} func The function to invoke.
  18782. * @param {*} thisArg The `this` binding of `func`.
  18783. * @param {Array} args The arguments to invoke `func` with.
  18784. * @returns {*} Returns the result of `func`.
  18785. */
  18786. function apply(func, thisArg, args) {
  18787. switch (args.length) {
  18788. case 0: return func.call(thisArg);
  18789. case 1: return func.call(thisArg, args[0]);
  18790. case 2: return func.call(thisArg, args[0], args[1]);
  18791. case 3: return func.call(thisArg, args[0], args[1], args[2]);
  18792. }
  18793. return func.apply(thisArg, args);
  18794. }
  18795. /**
  18796. * A specialized version of `baseAggregator` for arrays.
  18797. *
  18798. * @private
  18799. * @param {Array} [array] The array to iterate over.
  18800. * @param {Function} setter The function to set `accumulator` values.
  18801. * @param {Function} iteratee The iteratee to transform keys.
  18802. * @param {Object} accumulator The initial aggregated object.
  18803. * @returns {Function} Returns `accumulator`.
  18804. */
  18805. function arrayAggregator(array, setter, iteratee, accumulator) {
  18806. var index = -1,
  18807. length = array == null ? 0 : array.length;
  18808. while (++index < length) {
  18809. var value = array[index];
  18810. setter(accumulator, value, iteratee(value), array);
  18811. }
  18812. return accumulator;
  18813. }
  18814. /**
  18815. * A specialized version of `_.forEach` for arrays without support for
  18816. * iteratee shorthands.
  18817. *
  18818. * @private
  18819. * @param {Array} [array] The array to iterate over.
  18820. * @param {Function} iteratee The function invoked per iteration.
  18821. * @returns {Array} Returns `array`.
  18822. */
  18823. function arrayEach(array, iteratee) {
  18824. var index = -1,
  18825. length = array == null ? 0 : array.length;
  18826. while (++index < length) {
  18827. if (iteratee(array[index], index, array) === false) {
  18828. break;
  18829. }
  18830. }
  18831. return array;
  18832. }
  18833. /**
  18834. * A specialized version of `_.forEachRight` for arrays without support for
  18835. * iteratee shorthands.
  18836. *
  18837. * @private
  18838. * @param {Array} [array] The array to iterate over.
  18839. * @param {Function} iteratee The function invoked per iteration.
  18840. * @returns {Array} Returns `array`.
  18841. */
  18842. function arrayEachRight(array, iteratee) {
  18843. var length = array == null ? 0 : array.length;
  18844. while (length--) {
  18845. if (iteratee(array[length], length, array) === false) {
  18846. break;
  18847. }
  18848. }
  18849. return array;
  18850. }
  18851. /**
  18852. * A specialized version of `_.every` for arrays without support for
  18853. * iteratee shorthands.
  18854. *
  18855. * @private
  18856. * @param {Array} [array] The array to iterate over.
  18857. * @param {Function} predicate The function invoked per iteration.
  18858. * @returns {boolean} Returns `true` if all elements pass the predicate check,
  18859. * else `false`.
  18860. */
  18861. function arrayEvery(array, predicate) {
  18862. var index = -1,
  18863. length = array == null ? 0 : array.length;
  18864. while (++index < length) {
  18865. if (!predicate(array[index], index, array)) {
  18866. return false;
  18867. }
  18868. }
  18869. return true;
  18870. }
  18871. /**
  18872. * A specialized version of `_.filter` for arrays without support for
  18873. * iteratee shorthands.
  18874. *
  18875. * @private
  18876. * @param {Array} [array] The array to iterate over.
  18877. * @param {Function} predicate The function invoked per iteration.
  18878. * @returns {Array} Returns the new filtered array.
  18879. */
  18880. function arrayFilter(array, predicate) {
  18881. var index = -1,
  18882. length = array == null ? 0 : array.length,
  18883. resIndex = 0,
  18884. result = [];
  18885. while (++index < length) {
  18886. var value = array[index];
  18887. if (predicate(value, index, array)) {
  18888. result[resIndex++] = value;
  18889. }
  18890. }
  18891. return result;
  18892. }
  18893. /**
  18894. * A specialized version of `_.includes` for arrays without support for
  18895. * specifying an index to search from.
  18896. *
  18897. * @private
  18898. * @param {Array} [array] The array to inspect.
  18899. * @param {*} target The value to search for.
  18900. * @returns {boolean} Returns `true` if `target` is found, else `false`.
  18901. */
  18902. function arrayIncludes(array, value) {
  18903. var length = array == null ? 0 : array.length;
  18904. return !!length && baseIndexOf(array, value, 0) > -1;
  18905. }
  18906. /**
  18907. * This function is like `arrayIncludes` except that it accepts a comparator.
  18908. *
  18909. * @private
  18910. * @param {Array} [array] The array to inspect.
  18911. * @param {*} target The value to search for.
  18912. * @param {Function} comparator The comparator invoked per element.
  18913. * @returns {boolean} Returns `true` if `target` is found, else `false`.
  18914. */
  18915. function arrayIncludesWith(array, value, comparator) {
  18916. var index = -1,
  18917. length = array == null ? 0 : array.length;
  18918. while (++index < length) {
  18919. if (comparator(value, array[index])) {
  18920. return true;
  18921. }
  18922. }
  18923. return false;
  18924. }
  18925. /**
  18926. * A specialized version of `_.map` for arrays without support for iteratee
  18927. * shorthands.
  18928. *
  18929. * @private
  18930. * @param {Array} [array] The array to iterate over.
  18931. * @param {Function} iteratee The function invoked per iteration.
  18932. * @returns {Array} Returns the new mapped array.
  18933. */
  18934. function arrayMap(array, iteratee) {
  18935. var index = -1,
  18936. length = array == null ? 0 : array.length,
  18937. result = Array(length);
  18938. while (++index < length) {
  18939. result[index] = iteratee(array[index], index, array);
  18940. }
  18941. return result;
  18942. }
  18943. /**
  18944. * Appends the elements of `values` to `array`.
  18945. *
  18946. * @private
  18947. * @param {Array} array The array to modify.
  18948. * @param {Array} values The values to append.
  18949. * @returns {Array} Returns `array`.
  18950. */
  18951. function arrayPush(array, values) {
  18952. var index = -1,
  18953. length = values.length,
  18954. offset = array.length;
  18955. while (++index < length) {
  18956. array[offset + index] = values[index];
  18957. }
  18958. return array;
  18959. }
  18960. /**
  18961. * A specialized version of `_.reduce` for arrays without support for
  18962. * iteratee shorthands.
  18963. *
  18964. * @private
  18965. * @param {Array} [array] The array 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 element of `array` as
  18969. * the initial value.
  18970. * @returns {*} Returns the accumulated value.
  18971. */
  18972. function arrayReduce(array, iteratee, accumulator, initAccum) {
  18973. var index = -1,
  18974. length = array == null ? 0 : array.length;
  18975. if (initAccum && length) {
  18976. accumulator = array[++index];
  18977. }
  18978. while (++index < length) {
  18979. accumulator = iteratee(accumulator, array[index], index, array);
  18980. }
  18981. return accumulator;
  18982. }
  18983. /**
  18984. * A specialized version of `_.reduceRight` for arrays without support for
  18985. * iteratee shorthands.
  18986. *
  18987. * @private
  18988. * @param {Array} [array] The array to iterate over.
  18989. * @param {Function} iteratee The function invoked per iteration.
  18990. * @param {*} [accumulator] The initial value.
  18991. * @param {boolean} [initAccum] Specify using the last element of `array` as
  18992. * the initial value.
  18993. * @returns {*} Returns the accumulated value.
  18994. */
  18995. function arrayReduceRight(array, iteratee, accumulator, initAccum) {
  18996. var length = array == null ? 0 : array.length;
  18997. if (initAccum && length) {
  18998. accumulator = array[--length];
  18999. }
  19000. while (length--) {
  19001. accumulator = iteratee(accumulator, array[length], length, array);
  19002. }
  19003. return accumulator;
  19004. }
  19005. /**
  19006. * A specialized version of `_.some` for arrays without support for iteratee
  19007. * shorthands.
  19008. *
  19009. * @private
  19010. * @param {Array} [array] The array to iterate over.
  19011. * @param {Function} predicate The function invoked per iteration.
  19012. * @returns {boolean} Returns `true` if any element passes the predicate check,
  19013. * else `false`.
  19014. */
  19015. function arraySome(array, predicate) {
  19016. var index = -1,
  19017. length = array == null ? 0 : array.length;
  19018. while (++index < length) {
  19019. if (predicate(array[index], index, array)) {
  19020. return true;
  19021. }
  19022. }
  19023. return false;
  19024. }
  19025. /**
  19026. * Gets the size of an ASCII `string`.
  19027. *
  19028. * @private
  19029. * @param {string} string The string inspect.
  19030. * @returns {number} Returns the string size.
  19031. */
  19032. var asciiSize = baseProperty('length');
  19033. /**
  19034. * Converts an ASCII `string` to an array.
  19035. *
  19036. * @private
  19037. * @param {string} string The string to convert.
  19038. * @returns {Array} Returns the converted array.
  19039. */
  19040. function asciiToArray(string) {
  19041. return string.split('');
  19042. }
  19043. /**
  19044. * Splits an ASCII `string` into an array of its words.
  19045. *
  19046. * @private
  19047. * @param {string} The string to inspect.
  19048. * @returns {Array} Returns the words of `string`.
  19049. */
  19050. function asciiWords(string) {
  19051. return string.match(reAsciiWord) || [];
  19052. }
  19053. /**
  19054. * The base implementation of methods like `_.findKey` and `_.findLastKey`,
  19055. * without support for iteratee shorthands, which iterates over `collection`
  19056. * using `eachFunc`.
  19057. *
  19058. * @private
  19059. * @param {Array|Object} collection The collection to inspect.
  19060. * @param {Function} predicate The function invoked per iteration.
  19061. * @param {Function} eachFunc The function to iterate over `collection`.
  19062. * @returns {*} Returns the found element or its key, else `undefined`.
  19063. */
  19064. function baseFindKey(collection, predicate, eachFunc) {
  19065. var result;
  19066. eachFunc(collection, function(value, key, collection) {
  19067. if (predicate(value, key, collection)) {
  19068. result = key;
  19069. return false;
  19070. }
  19071. });
  19072. return result;
  19073. }
  19074. /**
  19075. * The base implementation of `_.findIndex` and `_.findLastIndex` without
  19076. * support for iteratee shorthands.
  19077. *
  19078. * @private
  19079. * @param {Array} array The array to inspect.
  19080. * @param {Function} predicate The function invoked per iteration.
  19081. * @param {number} fromIndex The index to search from.
  19082. * @param {boolean} [fromRight] Specify iterating from right to left.
  19083. * @returns {number} Returns the index of the matched value, else `-1`.
  19084. */
  19085. function baseFindIndex(array, predicate, fromIndex, fromRight) {
  19086. var length = array.length,
  19087. index = fromIndex + (fromRight ? 1 : -1);
  19088. while ((fromRight ? index-- : ++index < length)) {
  19089. if (predicate(array[index], index, array)) {
  19090. return index;
  19091. }
  19092. }
  19093. return -1;
  19094. }
  19095. /**
  19096. * The base implementation of `_.indexOf` without `fromIndex` bounds checks.
  19097. *
  19098. * @private
  19099. * @param {Array} array The array to inspect.
  19100. * @param {*} value The value to search for.
  19101. * @param {number} fromIndex The index to search from.
  19102. * @returns {number} Returns the index of the matched value, else `-1`.
  19103. */
  19104. function baseIndexOf(array, value, fromIndex) {
  19105. return value === value
  19106. ? strictIndexOf(array, value, fromIndex)
  19107. : baseFindIndex(array, baseIsNaN, fromIndex);
  19108. }
  19109. /**
  19110. * This function is like `baseIndexOf` except that it accepts a comparator.
  19111. *
  19112. * @private
  19113. * @param {Array} array The array to inspect.
  19114. * @param {*} value The value to search for.
  19115. * @param {number} fromIndex The index to search from.
  19116. * @param {Function} comparator The comparator invoked per element.
  19117. * @returns {number} Returns the index of the matched value, else `-1`.
  19118. */
  19119. function baseIndexOfWith(array, value, fromIndex, comparator) {
  19120. var index = fromIndex - 1,
  19121. length = array.length;
  19122. while (++index < length) {
  19123. if (comparator(array[index], value)) {
  19124. return index;
  19125. }
  19126. }
  19127. return -1;
  19128. }
  19129. /**
  19130. * The base implementation of `_.isNaN` without support for number objects.
  19131. *
  19132. * @private
  19133. * @param {*} value The value to check.
  19134. * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
  19135. */
  19136. function baseIsNaN(value) {
  19137. return value !== value;
  19138. }
  19139. /**
  19140. * The base implementation of `_.mean` and `_.meanBy` without support for
  19141. * iteratee shorthands.
  19142. *
  19143. * @private
  19144. * @param {Array} array The array to iterate over.
  19145. * @param {Function} iteratee The function invoked per iteration.
  19146. * @returns {number} Returns the mean.
  19147. */
  19148. function baseMean(array, iteratee) {
  19149. var length = array == null ? 0 : array.length;
  19150. return length ? (baseSum(array, iteratee) / length) : NAN;
  19151. }
  19152. /**
  19153. * The base implementation of `_.property` without support for deep paths.
  19154. *
  19155. * @private
  19156. * @param {string} key The key of the property to get.
  19157. * @returns {Function} Returns the new accessor function.
  19158. */
  19159. function baseProperty(key) {
  19160. return function(object) {
  19161. return object == null ? undefined : object[key];
  19162. };
  19163. }
  19164. /**
  19165. * The base implementation of `_.propertyOf` without support for deep paths.
  19166. *
  19167. * @private
  19168. * @param {Object} object The object to query.
  19169. * @returns {Function} Returns the new accessor function.
  19170. */
  19171. function basePropertyOf(object) {
  19172. return function(key) {
  19173. return object == null ? undefined : object[key];
  19174. };
  19175. }
  19176. /**
  19177. * The base implementation of `_.reduce` and `_.reduceRight`, without support
  19178. * for iteratee shorthands, which iterates over `collection` using `eachFunc`.
  19179. *
  19180. * @private
  19181. * @param {Array|Object} collection The collection to iterate over.
  19182. * @param {Function} iteratee The function invoked per iteration.
  19183. * @param {*} accumulator The initial value.
  19184. * @param {boolean} initAccum Specify using the first or last element of
  19185. * `collection` as the initial value.
  19186. * @param {Function} eachFunc The function to iterate over `collection`.
  19187. * @returns {*} Returns the accumulated value.
  19188. */
  19189. function baseReduce(collection, iteratee, accumulator, initAccum, eachFunc) {
  19190. eachFunc(collection, function(value, index, collection) {
  19191. accumulator = initAccum
  19192. ? (initAccum = false, value)
  19193. : iteratee(accumulator, value, index, collection);
  19194. });
  19195. return accumulator;
  19196. }
  19197. /**
  19198. * The base implementation of `_.sortBy` which uses `comparer` to define the
  19199. * sort order of `array` and replaces criteria objects with their corresponding
  19200. * values.
  19201. *
  19202. * @private
  19203. * @param {Array} array The array to sort.
  19204. * @param {Function} comparer The function to define sort order.
  19205. * @returns {Array} Returns `array`.
  19206. */
  19207. function baseSortBy(array, comparer) {
  19208. var length = array.length;
  19209. array.sort(comparer);
  19210. while (length--) {
  19211. array[length] = array[length].value;
  19212. }
  19213. return array;
  19214. }
  19215. /**
  19216. * The base implementation of `_.sum` and `_.sumBy` without support for
  19217. * iteratee shorthands.
  19218. *
  19219. * @private
  19220. * @param {Array} array The array to iterate over.
  19221. * @param {Function} iteratee The function invoked per iteration.
  19222. * @returns {number} Returns the sum.
  19223. */
  19224. function baseSum(array, iteratee) {
  19225. var result,
  19226. index = -1,
  19227. length = array.length;
  19228. while (++index < length) {
  19229. var current = iteratee(array[index]);
  19230. if (current !== undefined) {
  19231. result = result === undefined ? current : (result + current);
  19232. }
  19233. }
  19234. return result;
  19235. }
  19236. /**
  19237. * The base implementation of `_.times` without support for iteratee shorthands
  19238. * or max array length checks.
  19239. *
  19240. * @private
  19241. * @param {number} n The number of times to invoke `iteratee`.
  19242. * @param {Function} iteratee The function invoked per iteration.
  19243. * @returns {Array} Returns the array of results.
  19244. */
  19245. function baseTimes(n, iteratee) {
  19246. var index = -1,
  19247. result = Array(n);
  19248. while (++index < n) {
  19249. result[index] = iteratee(index);
  19250. }
  19251. return result;
  19252. }
  19253. /**
  19254. * The base implementation of `_.toPairs` and `_.toPairsIn` which creates an array
  19255. * of key-value pairs for `object` corresponding to the property names of `props`.
  19256. *
  19257. * @private
  19258. * @param {Object} object The object to query.
  19259. * @param {Array} props The property names to get values for.
  19260. * @returns {Object} Returns the key-value pairs.
  19261. */
  19262. function baseToPairs(object, props) {
  19263. return arrayMap(props, function(key) {
  19264. return [key, object[key]];
  19265. });
  19266. }
  19267. /**
  19268. * The base implementation of `_.unary` without support for storing metadata.
  19269. *
  19270. * @private
  19271. * @param {Function} func The function to cap arguments for.
  19272. * @returns {Function} Returns the new capped function.
  19273. */
  19274. function baseUnary(func) {
  19275. return function(value) {
  19276. return func(value);
  19277. };
  19278. }
  19279. /**
  19280. * The base implementation of `_.values` and `_.valuesIn` which creates an
  19281. * array of `object` property values corresponding to the property names
  19282. * of `props`.
  19283. *
  19284. * @private
  19285. * @param {Object} object The object to query.
  19286. * @param {Array} props The property names to get values for.
  19287. * @returns {Object} Returns the array of property values.
  19288. */
  19289. function baseValues(object, props) {
  19290. return arrayMap(props, function(key) {
  19291. return object[key];
  19292. });
  19293. }
  19294. /**
  19295. * Checks if a `cache` value for `key` exists.
  19296. *
  19297. * @private
  19298. * @param {Object} cache The cache to query.
  19299. * @param {string} key The key of the entry to check.
  19300. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  19301. */
  19302. function cacheHas(cache, key) {
  19303. return cache.has(key);
  19304. }
  19305. /**
  19306. * Used by `_.trim` and `_.trimStart` to get the index of the first string symbol
  19307. * that is not found in the character symbols.
  19308. *
  19309. * @private
  19310. * @param {Array} strSymbols The string symbols to inspect.
  19311. * @param {Array} chrSymbols The character symbols to find.
  19312. * @returns {number} Returns the index of the first unmatched string symbol.
  19313. */
  19314. function charsStartIndex(strSymbols, chrSymbols) {
  19315. var index = -1,
  19316. length = strSymbols.length;
  19317. while (++index < length && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {}
  19318. return index;
  19319. }
  19320. /**
  19321. * Used by `_.trim` and `_.trimEnd` to get the index of the last string symbol
  19322. * that is not found in the character symbols.
  19323. *
  19324. * @private
  19325. * @param {Array} strSymbols The string symbols to inspect.
  19326. * @param {Array} chrSymbols The character symbols to find.
  19327. * @returns {number} Returns the index of the last unmatched string symbol.
  19328. */
  19329. function charsEndIndex(strSymbols, chrSymbols) {
  19330. var index = strSymbols.length;
  19331. while (index-- && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {}
  19332. return index;
  19333. }
  19334. /**
  19335. * Gets the number of `placeholder` occurrences in `array`.
  19336. *
  19337. * @private
  19338. * @param {Array} array The array to inspect.
  19339. * @param {*} placeholder The placeholder to search for.
  19340. * @returns {number} Returns the placeholder count.
  19341. */
  19342. function countHolders(array, placeholder) {
  19343. var length = array.length,
  19344. result = 0;
  19345. while (length--) {
  19346. if (array[length] === placeholder) {
  19347. ++result;
  19348. }
  19349. }
  19350. return result;
  19351. }
  19352. /**
  19353. * Used by `_.deburr` to convert Latin-1 Supplement and Latin Extended-A
  19354. * letters to basic Latin letters.
  19355. *
  19356. * @private
  19357. * @param {string} letter The matched letter to deburr.
  19358. * @returns {string} Returns the deburred letter.
  19359. */
  19360. var deburrLetter = basePropertyOf(deburredLetters);
  19361. /**
  19362. * Used by `_.escape` to convert characters to HTML entities.
  19363. *
  19364. * @private
  19365. * @param {string} chr The matched character to escape.
  19366. * @returns {string} Returns the escaped character.
  19367. */
  19368. var escapeHtmlChar = basePropertyOf(htmlEscapes);
  19369. /**
  19370. * Used by `_.template` to escape characters for inclusion in compiled string literals.
  19371. *
  19372. * @private
  19373. * @param {string} chr The matched character to escape.
  19374. * @returns {string} Returns the escaped character.
  19375. */
  19376. function escapeStringChar(chr) {
  19377. return '\\' + stringEscapes[chr];
  19378. }
  19379. /**
  19380. * Gets the value at `key` of `object`.
  19381. *
  19382. * @private
  19383. * @param {Object} [object] The object to query.
  19384. * @param {string} key The key of the property to get.
  19385. * @returns {*} Returns the property value.
  19386. */
  19387. function getValue(object, key) {
  19388. return object == null ? undefined : object[key];
  19389. }
  19390. /**
  19391. * Checks if `string` contains Unicode symbols.
  19392. *
  19393. * @private
  19394. * @param {string} string The string to inspect.
  19395. * @returns {boolean} Returns `true` if a symbol is found, else `false`.
  19396. */
  19397. function hasUnicode(string) {
  19398. return reHasUnicode.test(string);
  19399. }
  19400. /**
  19401. * Checks if `string` contains a word composed of Unicode symbols.
  19402. *
  19403. * @private
  19404. * @param {string} string The string to inspect.
  19405. * @returns {boolean} Returns `true` if a word is found, else `false`.
  19406. */
  19407. function hasUnicodeWord(string) {
  19408. return reHasUnicodeWord.test(string);
  19409. }
  19410. /**
  19411. * Converts `iterator` to an array.
  19412. *
  19413. * @private
  19414. * @param {Object} iterator The iterator to convert.
  19415. * @returns {Array} Returns the converted array.
  19416. */
  19417. function iteratorToArray(iterator) {
  19418. var data,
  19419. result = [];
  19420. while (!(data = iterator.next()).done) {
  19421. result.push(data.value);
  19422. }
  19423. return result;
  19424. }
  19425. /**
  19426. * Converts `map` to its key-value pairs.
  19427. *
  19428. * @private
  19429. * @param {Object} map The map to convert.
  19430. * @returns {Array} Returns the key-value pairs.
  19431. */
  19432. function mapToArray(map) {
  19433. var index = -1,
  19434. result = Array(map.size);
  19435. map.forEach(function(value, key) {
  19436. result[++index] = [key, value];
  19437. });
  19438. return result;
  19439. }
  19440. /**
  19441. * Creates a unary function that invokes `func` with its argument transformed.
  19442. *
  19443. * @private
  19444. * @param {Function} func The function to wrap.
  19445. * @param {Function} transform The argument transform.
  19446. * @returns {Function} Returns the new function.
  19447. */
  19448. function overArg(func, transform) {
  19449. return function(arg) {
  19450. return func(transform(arg));
  19451. };
  19452. }
  19453. /**
  19454. * Replaces all `placeholder` elements in `array` with an internal placeholder
  19455. * and returns an array of their indexes.
  19456. *
  19457. * @private
  19458. * @param {Array} array The array to modify.
  19459. * @param {*} placeholder The placeholder to replace.
  19460. * @returns {Array} Returns the new array of placeholder indexes.
  19461. */
  19462. function replaceHolders(array, placeholder) {
  19463. var index = -1,
  19464. length = array.length,
  19465. resIndex = 0,
  19466. result = [];
  19467. while (++index < length) {
  19468. var value = array[index];
  19469. if (value === placeholder || value === PLACEHOLDER) {
  19470. array[index] = PLACEHOLDER;
  19471. result[resIndex++] = index;
  19472. }
  19473. }
  19474. return result;
  19475. }
  19476. /**
  19477. * Converts `set` to an array of its values.
  19478. *
  19479. * @private
  19480. * @param {Object} set The set to convert.
  19481. * @returns {Array} Returns the values.
  19482. */
  19483. function setToArray(set) {
  19484. var index = -1,
  19485. result = Array(set.size);
  19486. set.forEach(function(value) {
  19487. result[++index] = value;
  19488. });
  19489. return result;
  19490. }
  19491. /**
  19492. * Converts `set` to its value-value pairs.
  19493. *
  19494. * @private
  19495. * @param {Object} set The set to convert.
  19496. * @returns {Array} Returns the value-value pairs.
  19497. */
  19498. function setToPairs(set) {
  19499. var index = -1,
  19500. result = Array(set.size);
  19501. set.forEach(function(value) {
  19502. result[++index] = [value, value];
  19503. });
  19504. return result;
  19505. }
  19506. /**
  19507. * A specialized version of `_.indexOf` which performs strict equality
  19508. * comparisons of values, i.e. `===`.
  19509. *
  19510. * @private
  19511. * @param {Array} array The array to inspect.
  19512. * @param {*} value The value to search for.
  19513. * @param {number} fromIndex The index to search from.
  19514. * @returns {number} Returns the index of the matched value, else `-1`.
  19515. */
  19516. function strictIndexOf(array, value, fromIndex) {
  19517. var index = fromIndex - 1,
  19518. length = array.length;
  19519. while (++index < length) {
  19520. if (array[index] === value) {
  19521. return index;
  19522. }
  19523. }
  19524. return -1;
  19525. }
  19526. /**
  19527. * A specialized version of `_.lastIndexOf` which performs strict equality
  19528. * comparisons of values, i.e. `===`.
  19529. *
  19530. * @private
  19531. * @param {Array} array The array to inspect.
  19532. * @param {*} value The value to search for.
  19533. * @param {number} fromIndex The index to search from.
  19534. * @returns {number} Returns the index of the matched value, else `-1`.
  19535. */
  19536. function strictLastIndexOf(array, value, fromIndex) {
  19537. var index = fromIndex + 1;
  19538. while (index--) {
  19539. if (array[index] === value) {
  19540. return index;
  19541. }
  19542. }
  19543. return index;
  19544. }
  19545. /**
  19546. * Gets the number of symbols in `string`.
  19547. *
  19548. * @private
  19549. * @param {string} string The string to inspect.
  19550. * @returns {number} Returns the string size.
  19551. */
  19552. function stringSize(string) {
  19553. return hasUnicode(string)
  19554. ? unicodeSize(string)
  19555. : asciiSize(string);
  19556. }
  19557. /**
  19558. * Converts `string` to an array.
  19559. *
  19560. * @private
  19561. * @param {string} string The string to convert.
  19562. * @returns {Array} Returns the converted array.
  19563. */
  19564. function stringToArray(string) {
  19565. return hasUnicode(string)
  19566. ? unicodeToArray(string)
  19567. : asciiToArray(string);
  19568. }
  19569. /**
  19570. * Used by `_.unescape` to convert HTML entities to characters.
  19571. *
  19572. * @private
  19573. * @param {string} chr The matched character to unescape.
  19574. * @returns {string} Returns the unescaped character.
  19575. */
  19576. var unescapeHtmlChar = basePropertyOf(htmlUnescapes);
  19577. /**
  19578. * Gets the size of a Unicode `string`.
  19579. *
  19580. * @private
  19581. * @param {string} string The string inspect.
  19582. * @returns {number} Returns the string size.
  19583. */
  19584. function unicodeSize(string) {
  19585. var result = reUnicode.lastIndex = 0;
  19586. while (reUnicode.test(string)) {
  19587. ++result;
  19588. }
  19589. return result;
  19590. }
  19591. /**
  19592. * Converts a Unicode `string` to an array.
  19593. *
  19594. * @private
  19595. * @param {string} string The string to convert.
  19596. * @returns {Array} Returns the converted array.
  19597. */
  19598. function unicodeToArray(string) {
  19599. return string.match(reUnicode) || [];
  19600. }
  19601. /**
  19602. * Splits a Unicode `string` into an array of its words.
  19603. *
  19604. * @private
  19605. * @param {string} The string to inspect.
  19606. * @returns {Array} Returns the words of `string`.
  19607. */
  19608. function unicodeWords(string) {
  19609. return string.match(reUnicodeWord) || [];
  19610. }
  19611. /*--------------------------------------------------------------------------*/
  19612. /**
  19613. * Create a new pristine `lodash` function using the `context` object.
  19614. *
  19615. * @static
  19616. * @memberOf _
  19617. * @since 1.1.0
  19618. * @category Util
  19619. * @param {Object} [context=root] The context object.
  19620. * @returns {Function} Returns a new `lodash` function.
  19621. * @example
  19622. *
  19623. * _.mixin({ 'foo': _.constant('foo') });
  19624. *
  19625. * var lodash = _.runInContext();
  19626. * lodash.mixin({ 'bar': lodash.constant('bar') });
  19627. *
  19628. * _.isFunction(_.foo);
  19629. * // => true
  19630. * _.isFunction(_.bar);
  19631. * // => false
  19632. *
  19633. * lodash.isFunction(lodash.foo);
  19634. * // => false
  19635. * lodash.isFunction(lodash.bar);
  19636. * // => true
  19637. *
  19638. * // Create a suped-up `defer` in Node.js.
  19639. * var defer = _.runInContext({ 'setTimeout': setImmediate }).defer;
  19640. */
  19641. var runInContext = (function runInContext(context) {
  19642. context = context == null ? root : _.defaults(root.Object(), context, _.pick(root, contextProps));
  19643. /** Built-in constructor references. */
  19644. var Array = context.Array,
  19645. Date = context.Date,
  19646. Error = context.Error,
  19647. Function = context.Function,
  19648. Math = context.Math,
  19649. Object = context.Object,
  19650. RegExp = context.RegExp,
  19651. String = context.String,
  19652. TypeError = context.TypeError;
  19653. /** Used for built-in method references. */
  19654. var arrayProto = Array.prototype,
  19655. funcProto = Function.prototype,
  19656. objectProto = Object.prototype;
  19657. /** Used to detect overreaching core-js shims. */
  19658. var coreJsData = context['__core-js_shared__'];
  19659. /** Used to resolve the decompiled source of functions. */
  19660. var funcToString = funcProto.toString;
  19661. /** Used to check objects for own properties. */
  19662. var hasOwnProperty = objectProto.hasOwnProperty;
  19663. /** Used to generate unique IDs. */
  19664. var idCounter = 0;
  19665. /** Used to detect methods masquerading as native. */
  19666. var maskSrcKey = (function() {
  19667. var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
  19668. return uid ? ('Symbol(src)_1.' + uid) : '';
  19669. }());
  19670. /**
  19671. * Used to resolve the
  19672. * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
  19673. * of values.
  19674. */
  19675. var nativeObjectToString = objectProto.toString;
  19676. /** Used to infer the `Object` constructor. */
  19677. var objectCtorString = funcToString.call(Object);
  19678. /** Used to restore the original `_` reference in `_.noConflict`. */
  19679. var oldDash = root._;
  19680. /** Used to detect if a method is native. */
  19681. var reIsNative = RegExp('^' +
  19682. funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&')
  19683. .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
  19684. );
  19685. /** Built-in value references. */
  19686. var Buffer = moduleExports ? context.Buffer : undefined,
  19687. Symbol = context.Symbol,
  19688. Uint8Array = context.Uint8Array,
  19689. allocUnsafe = Buffer ? Buffer.allocUnsafe : undefined,
  19690. getPrototype = overArg(Object.getPrototypeOf, Object),
  19691. objectCreate = Object.create,
  19692. propertyIsEnumerable = objectProto.propertyIsEnumerable,
  19693. splice = arrayProto.splice,
  19694. spreadableSymbol = Symbol ? Symbol.isConcatSpreadable : undefined,
  19695. symIterator = Symbol ? Symbol.iterator : undefined,
  19696. symToStringTag = Symbol ? Symbol.toStringTag : undefined;
  19697. var defineProperty = (function() {
  19698. try {
  19699. var func = getNative(Object, 'defineProperty');
  19700. func({}, '', {});
  19701. return func;
  19702. } catch (e) {}
  19703. }());
  19704. /** Mocked built-ins. */
  19705. var ctxClearTimeout = context.clearTimeout !== root.clearTimeout && context.clearTimeout,
  19706. ctxNow = Date && Date.now !== root.Date.now && Date.now,
  19707. ctxSetTimeout = context.setTimeout !== root.setTimeout && context.setTimeout;
  19708. /* Built-in method references for those with the same name as other `lodash` methods. */
  19709. var nativeCeil = Math.ceil,
  19710. nativeFloor = Math.floor,
  19711. nativeGetSymbols = Object.getOwnPropertySymbols,
  19712. nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined,
  19713. nativeIsFinite = context.isFinite,
  19714. nativeJoin = arrayProto.join,
  19715. nativeKeys = overArg(Object.keys, Object),
  19716. nativeMax = Math.max,
  19717. nativeMin = Math.min,
  19718. nativeNow = Date.now,
  19719. nativeParseInt = context.parseInt,
  19720. nativeRandom = Math.random,
  19721. nativeReverse = arrayProto.reverse;
  19722. /* Built-in method references that are verified to be native. */
  19723. var DataView = getNative(context, 'DataView'),
  19724. Map = getNative(context, 'Map'),
  19725. Promise = getNative(context, 'Promise'),
  19726. Set = getNative(context, 'Set'),
  19727. WeakMap = getNative(context, 'WeakMap'),
  19728. nativeCreate = getNative(Object, 'create');
  19729. /** Used to store function metadata. */
  19730. var metaMap = WeakMap && new WeakMap;
  19731. /** Used to lookup unminified function names. */
  19732. var realNames = {};
  19733. /** Used to detect maps, sets, and weakmaps. */
  19734. var dataViewCtorString = toSource(DataView),
  19735. mapCtorString = toSource(Map),
  19736. promiseCtorString = toSource(Promise),
  19737. setCtorString = toSource(Set),
  19738. weakMapCtorString = toSource(WeakMap);
  19739. /** Used to convert symbols to primitives and strings. */
  19740. var symbolProto = Symbol ? Symbol.prototype : undefined,
  19741. symbolValueOf = symbolProto ? symbolProto.valueOf : undefined,
  19742. symbolToString = symbolProto ? symbolProto.toString : undefined;
  19743. /*------------------------------------------------------------------------*/
  19744. /**
  19745. * Creates a `lodash` object which wraps `value` to enable implicit method
  19746. * chain sequences. Methods that operate on and return arrays, collections,
  19747. * and functions can be chained together. Methods that retrieve a single value
  19748. * or may return a primitive value will automatically end the chain sequence
  19749. * and return the unwrapped value. Otherwise, the value must be unwrapped
  19750. * with `_#value`.
  19751. *
  19752. * Explicit chain sequences, which must be unwrapped with `_#value`, may be
  19753. * enabled using `_.chain`.
  19754. *
  19755. * The execution of chained methods is lazy, that is, it's deferred until
  19756. * `_#value` is implicitly or explicitly called.
  19757. *
  19758. * Lazy evaluation allows several methods to support shortcut fusion.
  19759. * Shortcut fusion is an optimization to merge iteratee calls; this avoids
  19760. * the creation of intermediate arrays and can greatly reduce the number of
  19761. * iteratee executions. Sections of a chain sequence qualify for shortcut
  19762. * fusion if the section is applied to an array and iteratees accept only
  19763. * one argument. The heuristic for whether a section qualifies for shortcut
  19764. * fusion is subject to change.
  19765. *
  19766. * Chaining is supported in custom builds as long as the `_#value` method is
  19767. * directly or indirectly included in the build.
  19768. *
  19769. * In addition to lodash methods, wrappers have `Array` and `String` methods.
  19770. *
  19771. * The wrapper `Array` methods are:
  19772. * `concat`, `join`, `pop`, `push`, `shift`, `sort`, `splice`, and `unshift`
  19773. *
  19774. * The wrapper `String` methods are:
  19775. * `replace` and `split`
  19776. *
  19777. * The wrapper methods that support shortcut fusion are:
  19778. * `at`, `compact`, `drop`, `dropRight`, `dropWhile`, `filter`, `find`,
  19779. * `findLast`, `head`, `initial`, `last`, `map`, `reject`, `reverse`, `slice`,
  19780. * `tail`, `take`, `takeRight`, `takeRightWhile`, `takeWhile`, and `toArray`
  19781. *
  19782. * The chainable wrapper methods are:
  19783. * `after`, `ary`, `assign`, `assignIn`, `assignInWith`, `assignWith`, `at`,
  19784. * `before`, `bind`, `bindAll`, `bindKey`, `castArray`, `chain`, `chunk`,
  19785. * `commit`, `compact`, `concat`, `conforms`, `constant`, `countBy`, `create`,
  19786. * `curry`, `debounce`, `defaults`, `defaultsDeep`, `defer`, `delay`,
  19787. * `difference`, `differenceBy`, `differenceWith`, `drop`, `dropRight`,
  19788. * `dropRightWhile`, `dropWhile`, `extend`, `extendWith`, `fill`, `filter`,
  19789. * `flatMap`, `flatMapDeep`, `flatMapDepth`, `flatten`, `flattenDeep`,
  19790. * `flattenDepth`, `flip`, `flow`, `flowRight`, `fromPairs`, `functions`,
  19791. * `functionsIn`, `groupBy`, `initial`, `intersection`, `intersectionBy`,
  19792. * `intersectionWith`, `invert`, `invertBy`, `invokeMap`, `iteratee`, `keyBy`,
  19793. * `keys`, `keysIn`, `map`, `mapKeys`, `mapValues`, `matches`, `matchesProperty`,
  19794. * `memoize`, `merge`, `mergeWith`, `method`, `methodOf`, `mixin`, `negate`,
  19795. * `nthArg`, `omit`, `omitBy`, `once`, `orderBy`, `over`, `overArgs`,
  19796. * `overEvery`, `overSome`, `partial`, `partialRight`, `partition`, `pick`,
  19797. * `pickBy`, `plant`, `property`, `propertyOf`, `pull`, `pullAll`, `pullAllBy`,
  19798. * `pullAllWith`, `pullAt`, `push`, `range`, `rangeRight`, `rearg`, `reject`,
  19799. * `remove`, `rest`, `reverse`, `sampleSize`, `set`, `setWith`, `shuffle`,
  19800. * `slice`, `sort`, `sortBy`, `splice`, `spread`, `tail`, `take`, `takeRight`,
  19801. * `takeRightWhile`, `takeWhile`, `tap`, `throttle`, `thru`, `toArray`,
  19802. * `toPairs`, `toPairsIn`, `toPath`, `toPlainObject`, `transform`, `unary`,
  19803. * `union`, `unionBy`, `unionWith`, `uniq`, `uniqBy`, `uniqWith`, `unset`,
  19804. * `unshift`, `unzip`, `unzipWith`, `update`, `updateWith`, `values`,
  19805. * `valuesIn`, `without`, `wrap`, `xor`, `xorBy`, `xorWith`, `zip`,
  19806. * `zipObject`, `zipObjectDeep`, and `zipWith`
  19807. *
  19808. * The wrapper methods that are **not** chainable by default are:
  19809. * `add`, `attempt`, `camelCase`, `capitalize`, `ceil`, `clamp`, `clone`,
  19810. * `cloneDeep`, `cloneDeepWith`, `cloneWith`, `conformsTo`, `deburr`,
  19811. * `defaultTo`, `divide`, `each`, `eachRight`, `endsWith`, `eq`, `escape`,
  19812. * `escapeRegExp`, `every`, `find`, `findIndex`, `findKey`, `findLast`,
  19813. * `findLastIndex`, `findLastKey`, `first`, `floor`, `forEach`, `forEachRight`,
  19814. * `forIn`, `forInRight`, `forOwn`, `forOwnRight`, `get`, `gt`, `gte`, `has`,
  19815. * `hasIn`, `head`, `identity`, `includes`, `indexOf`, `inRange`, `invoke`,
  19816. * `isArguments`, `isArray`, `isArrayBuffer`, `isArrayLike`, `isArrayLikeObject`,
  19817. * `isBoolean`, `isBuffer`, `isDate`, `isElement`, `isEmpty`, `isEqual`,
  19818. * `isEqualWith`, `isError`, `isFinite`, `isFunction`, `isInteger`, `isLength`,
  19819. * `isMap`, `isMatch`, `isMatchWith`, `isNaN`, `isNative`, `isNil`, `isNull`,
  19820. * `isNumber`, `isObject`, `isObjectLike`, `isPlainObject`, `isRegExp`,
  19821. * `isSafeInteger`, `isSet`, `isString`, `isUndefined`, `isTypedArray`,
  19822. * `isWeakMap`, `isWeakSet`, `join`, `kebabCase`, `last`, `lastIndexOf`,
  19823. * `lowerCase`, `lowerFirst`, `lt`, `lte`, `max`, `maxBy`, `mean`, `meanBy`,
  19824. * `min`, `minBy`, `multiply`, `noConflict`, `noop`, `now`, `nth`, `pad`,
  19825. * `padEnd`, `padStart`, `parseInt`, `pop`, `random`, `reduce`, `reduceRight`,
  19826. * `repeat`, `result`, `round`, `runInContext`, `sample`, `shift`, `size`,
  19827. * `snakeCase`, `some`, `sortedIndex`, `sortedIndexBy`, `sortedLastIndex`,
  19828. * `sortedLastIndexBy`, `startCase`, `startsWith`, `stubArray`, `stubFalse`,
  19829. * `stubObject`, `stubString`, `stubTrue`, `subtract`, `sum`, `sumBy`,
  19830. * `template`, `times`, `toFinite`, `toInteger`, `toJSON`, `toLength`,
  19831. * `toLower`, `toNumber`, `toSafeInteger`, `toString`, `toUpper`, `trim`,
  19832. * `trimEnd`, `trimStart`, `truncate`, `unescape`, `uniqueId`, `upperCase`,
  19833. * `upperFirst`, `value`, and `words`
  19834. *
  19835. * @name _
  19836. * @constructor
  19837. * @category Seq
  19838. * @param {*} value The value to wrap in a `lodash` instance.
  19839. * @returns {Object} Returns the new `lodash` wrapper instance.
  19840. * @example
  19841. *
  19842. * function square(n) {
  19843. * return n * n;
  19844. * }
  19845. *
  19846. * var wrapped = _([1, 2, 3]);
  19847. *
  19848. * // Returns an unwrapped value.
  19849. * wrapped.reduce(_.add);
  19850. * // => 6
  19851. *
  19852. * // Returns a wrapped value.
  19853. * var squares = wrapped.map(square);
  19854. *
  19855. * _.isArray(squares);
  19856. * // => false
  19857. *
  19858. * _.isArray(squares.value());
  19859. * // => true
  19860. */
  19861. function lodash(value) {
  19862. if (isObjectLike(value) && !isArray(value) && !(value instanceof LazyWrapper)) {
  19863. if (value instanceof LodashWrapper) {
  19864. return value;
  19865. }
  19866. if (hasOwnProperty.call(value, '__wrapped__')) {
  19867. return wrapperClone(value);
  19868. }
  19869. }
  19870. return new LodashWrapper(value);
  19871. }
  19872. /**
  19873. * The base implementation of `_.create` without support for assigning
  19874. * properties to the created object.
  19875. *
  19876. * @private
  19877. * @param {Object} proto The object to inherit from.
  19878. * @returns {Object} Returns the new object.
  19879. */
  19880. var baseCreate = (function() {
  19881. function object() {}
  19882. return function(proto) {
  19883. if (!isObject(proto)) {
  19884. return {};
  19885. }
  19886. if (objectCreate) {
  19887. return objectCreate(proto);
  19888. }
  19889. object.prototype = proto;
  19890. var result = new object;
  19891. object.prototype = undefined;
  19892. return result;
  19893. };
  19894. }());
  19895. /**
  19896. * The function whose prototype chain sequence wrappers inherit from.
  19897. *
  19898. * @private
  19899. */
  19900. function baseLodash() {
  19901. // No operation performed.
  19902. }
  19903. /**
  19904. * The base constructor for creating `lodash` wrapper objects.
  19905. *
  19906. * @private
  19907. * @param {*} value The value to wrap.
  19908. * @param {boolean} [chainAll] Enable explicit method chain sequences.
  19909. */
  19910. function LodashWrapper(value, chainAll) {
  19911. this.__wrapped__ = value;
  19912. this.__actions__ = [];
  19913. this.__chain__ = !!chainAll;
  19914. this.__index__ = 0;
  19915. this.__values__ = undefined;
  19916. }
  19917. /**
  19918. * By default, the template delimiters used by lodash are like those in
  19919. * embedded Ruby (ERB) as well as ES2015 template strings. Change the
  19920. * following template settings to use alternative delimiters.
  19921. *
  19922. * @static
  19923. * @memberOf _
  19924. * @type {Object}
  19925. */
  19926. lodash.templateSettings = {
  19927. /**
  19928. * Used to detect `data` property values to be HTML-escaped.
  19929. *
  19930. * @memberOf _.templateSettings
  19931. * @type {RegExp}
  19932. */
  19933. 'escape': reEscape,
  19934. /**
  19935. * Used to detect code to be evaluated.
  19936. *
  19937. * @memberOf _.templateSettings
  19938. * @type {RegExp}
  19939. */
  19940. 'evaluate': reEvaluate,
  19941. /**
  19942. * Used to detect `data` property values to inject.
  19943. *
  19944. * @memberOf _.templateSettings
  19945. * @type {RegExp}
  19946. */
  19947. 'interpolate': reInterpolate,
  19948. /**
  19949. * Used to reference the data object in the template text.
  19950. *
  19951. * @memberOf _.templateSettings
  19952. * @type {string}
  19953. */
  19954. 'variable': '',
  19955. /**
  19956. * Used to import variables into the compiled template.
  19957. *
  19958. * @memberOf _.templateSettings
  19959. * @type {Object}
  19960. */
  19961. 'imports': {
  19962. /**
  19963. * A reference to the `lodash` function.
  19964. *
  19965. * @memberOf _.templateSettings.imports
  19966. * @type {Function}
  19967. */
  19968. '_': lodash
  19969. }
  19970. };
  19971. // Ensure wrappers are instances of `baseLodash`.
  19972. lodash.prototype = baseLodash.prototype;
  19973. lodash.prototype.constructor = lodash;
  19974. LodashWrapper.prototype = baseCreate(baseLodash.prototype);
  19975. LodashWrapper.prototype.constructor = LodashWrapper;
  19976. /*------------------------------------------------------------------------*/
  19977. /**
  19978. * Creates a lazy wrapper object which wraps `value` to enable lazy evaluation.
  19979. *
  19980. * @private
  19981. * @constructor
  19982. * @param {*} value The value to wrap.
  19983. */
  19984. function LazyWrapper(value) {
  19985. this.__wrapped__ = value;
  19986. this.__actions__ = [];
  19987. this.__dir__ = 1;
  19988. this.__filtered__ = false;
  19989. this.__iteratees__ = [];
  19990. this.__takeCount__ = MAX_ARRAY_LENGTH;
  19991. this.__views__ = [];
  19992. }
  19993. /**
  19994. * Creates a clone of the lazy wrapper object.
  19995. *
  19996. * @private
  19997. * @name clone
  19998. * @memberOf LazyWrapper
  19999. * @returns {Object} Returns the cloned `LazyWrapper` object.
  20000. */
  20001. function lazyClone() {
  20002. var result = new LazyWrapper(this.__wrapped__);
  20003. result.__actions__ = copyArray(this.__actions__);
  20004. result.__dir__ = this.__dir__;
  20005. result.__filtered__ = this.__filtered__;
  20006. result.__iteratees__ = copyArray(this.__iteratees__);
  20007. result.__takeCount__ = this.__takeCount__;
  20008. result.__views__ = copyArray(this.__views__);
  20009. return result;
  20010. }
  20011. /**
  20012. * Reverses the direction of lazy iteration.
  20013. *
  20014. * @private
  20015. * @name reverse
  20016. * @memberOf LazyWrapper
  20017. * @returns {Object} Returns the new reversed `LazyWrapper` object.
  20018. */
  20019. function lazyReverse() {
  20020. if (this.__filtered__) {
  20021. var result = new LazyWrapper(this);
  20022. result.__dir__ = -1;
  20023. result.__filtered__ = true;
  20024. } else {
  20025. result = this.clone();
  20026. result.__dir__ *= -1;
  20027. }
  20028. return result;
  20029. }
  20030. /**
  20031. * Extracts the unwrapped value from its lazy wrapper.
  20032. *
  20033. * @private
  20034. * @name value
  20035. * @memberOf LazyWrapper
  20036. * @returns {*} Returns the unwrapped value.
  20037. */
  20038. function lazyValue() {
  20039. var array = this.__wrapped__.value(),
  20040. dir = this.__dir__,
  20041. isArr = isArray(array),
  20042. isRight = dir < 0,
  20043. arrLength = isArr ? array.length : 0,
  20044. view = getView(0, arrLength, this.__views__),
  20045. start = view.start,
  20046. end = view.end,
  20047. length = end - start,
  20048. index = isRight ? end : (start - 1),
  20049. iteratees = this.__iteratees__,
  20050. iterLength = iteratees.length,
  20051. resIndex = 0,
  20052. takeCount = nativeMin(length, this.__takeCount__);
  20053. if (!isArr || (!isRight && arrLength == length && takeCount == length)) {
  20054. return baseWrapperValue(array, this.__actions__);
  20055. }
  20056. var result = [];
  20057. outer:
  20058. while (length-- && resIndex < takeCount) {
  20059. index += dir;
  20060. var iterIndex = -1,
  20061. value = array[index];
  20062. while (++iterIndex < iterLength) {
  20063. var data = iteratees[iterIndex],
  20064. iteratee = data.iteratee,
  20065. type = data.type,
  20066. computed = iteratee(value);
  20067. if (type == LAZY_MAP_FLAG) {
  20068. value = computed;
  20069. } else if (!computed) {
  20070. if (type == LAZY_FILTER_FLAG) {
  20071. continue outer;
  20072. } else {
  20073. break outer;
  20074. }
  20075. }
  20076. }
  20077. result[resIndex++] = value;
  20078. }
  20079. return result;
  20080. }
  20081. // Ensure `LazyWrapper` is an instance of `baseLodash`.
  20082. LazyWrapper.prototype = baseCreate(baseLodash.prototype);
  20083. LazyWrapper.prototype.constructor = LazyWrapper;
  20084. /*------------------------------------------------------------------------*/
  20085. /**
  20086. * Creates a hash object.
  20087. *
  20088. * @private
  20089. * @constructor
  20090. * @param {Array} [entries] The key-value pairs to cache.
  20091. */
  20092. function Hash(entries) {
  20093. var index = -1,
  20094. length = entries == null ? 0 : entries.length;
  20095. this.clear();
  20096. while (++index < length) {
  20097. var entry = entries[index];
  20098. this.set(entry[0], entry[1]);
  20099. }
  20100. }
  20101. /**
  20102. * Removes all key-value entries from the hash.
  20103. *
  20104. * @private
  20105. * @name clear
  20106. * @memberOf Hash
  20107. */
  20108. function hashClear() {
  20109. this.__data__ = nativeCreate ? nativeCreate(null) : {};
  20110. this.size = 0;
  20111. }
  20112. /**
  20113. * Removes `key` and its value from the hash.
  20114. *
  20115. * @private
  20116. * @name delete
  20117. * @memberOf Hash
  20118. * @param {Object} hash The hash to modify.
  20119. * @param {string} key The key of the value to remove.
  20120. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  20121. */
  20122. function hashDelete(key) {
  20123. var result = this.has(key) && delete this.__data__[key];
  20124. this.size -= result ? 1 : 0;
  20125. return result;
  20126. }
  20127. /**
  20128. * Gets the hash value for `key`.
  20129. *
  20130. * @private
  20131. * @name get
  20132. * @memberOf Hash
  20133. * @param {string} key The key of the value to get.
  20134. * @returns {*} Returns the entry value.
  20135. */
  20136. function hashGet(key) {
  20137. var data = this.__data__;
  20138. if (nativeCreate) {
  20139. var result = data[key];
  20140. return result === HASH_UNDEFINED ? undefined : result;
  20141. }
  20142. return hasOwnProperty.call(data, key) ? data[key] : undefined;
  20143. }
  20144. /**
  20145. * Checks if a hash value for `key` exists.
  20146. *
  20147. * @private
  20148. * @name has
  20149. * @memberOf Hash
  20150. * @param {string} key The key of the entry to check.
  20151. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  20152. */
  20153. function hashHas(key) {
  20154. var data = this.__data__;
  20155. return nativeCreate ? (data[key] !== undefined) : hasOwnProperty.call(data, key);
  20156. }
  20157. /**
  20158. * Sets the hash `key` to `value`.
  20159. *
  20160. * @private
  20161. * @name set
  20162. * @memberOf Hash
  20163. * @param {string} key The key of the value to set.
  20164. * @param {*} value The value to set.
  20165. * @returns {Object} Returns the hash instance.
  20166. */
  20167. function hashSet(key, value) {
  20168. var data = this.__data__;
  20169. this.size += this.has(key) ? 0 : 1;
  20170. data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;
  20171. return this;
  20172. }
  20173. // Add methods to `Hash`.
  20174. Hash.prototype.clear = hashClear;
  20175. Hash.prototype['delete'] = hashDelete;
  20176. Hash.prototype.get = hashGet;
  20177. Hash.prototype.has = hashHas;
  20178. Hash.prototype.set = hashSet;
  20179. /*------------------------------------------------------------------------*/
  20180. /**
  20181. * Creates an list cache object.
  20182. *
  20183. * @private
  20184. * @constructor
  20185. * @param {Array} [entries] The key-value pairs to cache.
  20186. */
  20187. function ListCache(entries) {
  20188. var index = -1,
  20189. length = entries == null ? 0 : entries.length;
  20190. this.clear();
  20191. while (++index < length) {
  20192. var entry = entries[index];
  20193. this.set(entry[0], entry[1]);
  20194. }
  20195. }
  20196. /**
  20197. * Removes all key-value entries from the list cache.
  20198. *
  20199. * @private
  20200. * @name clear
  20201. * @memberOf ListCache
  20202. */
  20203. function listCacheClear() {
  20204. this.__data__ = [];
  20205. this.size = 0;
  20206. }
  20207. /**
  20208. * Removes `key` and its value from the list cache.
  20209. *
  20210. * @private
  20211. * @name delete
  20212. * @memberOf ListCache
  20213. * @param {string} key The key of the value to remove.
  20214. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  20215. */
  20216. function listCacheDelete(key) {
  20217. var data = this.__data__,
  20218. index = assocIndexOf(data, key);
  20219. if (index < 0) {
  20220. return false;
  20221. }
  20222. var lastIndex = data.length - 1;
  20223. if (index == lastIndex) {
  20224. data.pop();
  20225. } else {
  20226. splice.call(data, index, 1);
  20227. }
  20228. --this.size;
  20229. return true;
  20230. }
  20231. /**
  20232. * Gets the list cache value for `key`.
  20233. *
  20234. * @private
  20235. * @name get
  20236. * @memberOf ListCache
  20237. * @param {string} key The key of the value to get.
  20238. * @returns {*} Returns the entry value.
  20239. */
  20240. function listCacheGet(key) {
  20241. var data = this.__data__,
  20242. index = assocIndexOf(data, key);
  20243. return index < 0 ? undefined : data[index][1];
  20244. }
  20245. /**
  20246. * Checks if a list cache value for `key` exists.
  20247. *
  20248. * @private
  20249. * @name has
  20250. * @memberOf ListCache
  20251. * @param {string} key The key of the entry to check.
  20252. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  20253. */
  20254. function listCacheHas(key) {
  20255. return assocIndexOf(this.__data__, key) > -1;
  20256. }
  20257. /**
  20258. * Sets the list cache `key` to `value`.
  20259. *
  20260. * @private
  20261. * @name set
  20262. * @memberOf ListCache
  20263. * @param {string} key The key of the value to set.
  20264. * @param {*} value The value to set.
  20265. * @returns {Object} Returns the list cache instance.
  20266. */
  20267. function listCacheSet(key, value) {
  20268. var data = this.__data__,
  20269. index = assocIndexOf(data, key);
  20270. if (index < 0) {
  20271. ++this.size;
  20272. data.push([key, value]);
  20273. } else {
  20274. data[index][1] = value;
  20275. }
  20276. return this;
  20277. }
  20278. // Add methods to `ListCache`.
  20279. ListCache.prototype.clear = listCacheClear;
  20280. ListCache.prototype['delete'] = listCacheDelete;
  20281. ListCache.prototype.get = listCacheGet;
  20282. ListCache.prototype.has = listCacheHas;
  20283. ListCache.prototype.set = listCacheSet;
  20284. /*------------------------------------------------------------------------*/
  20285. /**
  20286. * Creates a map cache object to store key-value pairs.
  20287. *
  20288. * @private
  20289. * @constructor
  20290. * @param {Array} [entries] The key-value pairs to cache.
  20291. */
  20292. function MapCache(entries) {
  20293. var index = -1,
  20294. length = entries == null ? 0 : entries.length;
  20295. this.clear();
  20296. while (++index < length) {
  20297. var entry = entries[index];
  20298. this.set(entry[0], entry[1]);
  20299. }
  20300. }
  20301. /**
  20302. * Removes all key-value entries from the map.
  20303. *
  20304. * @private
  20305. * @name clear
  20306. * @memberOf MapCache
  20307. */
  20308. function mapCacheClear() {
  20309. this.size = 0;
  20310. this.__data__ = {
  20311. 'hash': new Hash,
  20312. 'map': new (Map || ListCache),
  20313. 'string': new Hash
  20314. };
  20315. }
  20316. /**
  20317. * Removes `key` and its value from the map.
  20318. *
  20319. * @private
  20320. * @name delete
  20321. * @memberOf MapCache
  20322. * @param {string} key The key of the value to remove.
  20323. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  20324. */
  20325. function mapCacheDelete(key) {
  20326. var result = getMapData(this, key)['delete'](key);
  20327. this.size -= result ? 1 : 0;
  20328. return result;
  20329. }
  20330. /**
  20331. * Gets the map value for `key`.
  20332. *
  20333. * @private
  20334. * @name get
  20335. * @memberOf MapCache
  20336. * @param {string} key The key of the value to get.
  20337. * @returns {*} Returns the entry value.
  20338. */
  20339. function mapCacheGet(key) {
  20340. return getMapData(this, key).get(key);
  20341. }
  20342. /**
  20343. * Checks if a map value for `key` exists.
  20344. *
  20345. * @private
  20346. * @name has
  20347. * @memberOf MapCache
  20348. * @param {string} key The key of the entry to check.
  20349. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  20350. */
  20351. function mapCacheHas(key) {
  20352. return getMapData(this, key).has(key);
  20353. }
  20354. /**
  20355. * Sets the map `key` to `value`.
  20356. *
  20357. * @private
  20358. * @name set
  20359. * @memberOf MapCache
  20360. * @param {string} key The key of the value to set.
  20361. * @param {*} value The value to set.
  20362. * @returns {Object} Returns the map cache instance.
  20363. */
  20364. function mapCacheSet(key, value) {
  20365. var data = getMapData(this, key),
  20366. size = data.size;
  20367. data.set(key, value);
  20368. this.size += data.size == size ? 0 : 1;
  20369. return this;
  20370. }
  20371. // Add methods to `MapCache`.
  20372. MapCache.prototype.clear = mapCacheClear;
  20373. MapCache.prototype['delete'] = mapCacheDelete;
  20374. MapCache.prototype.get = mapCacheGet;
  20375. MapCache.prototype.has = mapCacheHas;
  20376. MapCache.prototype.set = mapCacheSet;
  20377. /*------------------------------------------------------------------------*/
  20378. /**
  20379. *
  20380. * Creates an array cache object to store unique values.
  20381. *
  20382. * @private
  20383. * @constructor
  20384. * @param {Array} [values] The values to cache.
  20385. */
  20386. function SetCache(values) {
  20387. var index = -1,
  20388. length = values == null ? 0 : values.length;
  20389. this.__data__ = new MapCache;
  20390. while (++index < length) {
  20391. this.add(values[index]);
  20392. }
  20393. }
  20394. /**
  20395. * Adds `value` to the array cache.
  20396. *
  20397. * @private
  20398. * @name add
  20399. * @memberOf SetCache
  20400. * @alias push
  20401. * @param {*} value The value to cache.
  20402. * @returns {Object} Returns the cache instance.
  20403. */
  20404. function setCacheAdd(value) {
  20405. this.__data__.set(value, HASH_UNDEFINED);
  20406. return this;
  20407. }
  20408. /**
  20409. * Checks if `value` is in the array cache.
  20410. *
  20411. * @private
  20412. * @name has
  20413. * @memberOf SetCache
  20414. * @param {*} value The value to search for.
  20415. * @returns {number} Returns `true` if `value` is found, else `false`.
  20416. */
  20417. function setCacheHas(value) {
  20418. return this.__data__.has(value);
  20419. }
  20420. // Add methods to `SetCache`.
  20421. SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
  20422. SetCache.prototype.has = setCacheHas;
  20423. /*------------------------------------------------------------------------*/
  20424. /**
  20425. * Creates a stack cache object to store key-value pairs.
  20426. *
  20427. * @private
  20428. * @constructor
  20429. * @param {Array} [entries] The key-value pairs to cache.
  20430. */
  20431. function Stack(entries) {
  20432. var data = this.__data__ = new ListCache(entries);
  20433. this.size = data.size;
  20434. }
  20435. /**
  20436. * Removes all key-value entries from the stack.
  20437. *
  20438. * @private
  20439. * @name clear
  20440. * @memberOf Stack
  20441. */
  20442. function stackClear() {
  20443. this.__data__ = new ListCache;
  20444. this.size = 0;
  20445. }
  20446. /**
  20447. * Removes `key` and its value from the stack.
  20448. *
  20449. * @private
  20450. * @name delete
  20451. * @memberOf Stack
  20452. * @param {string} key The key of the value to remove.
  20453. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  20454. */
  20455. function stackDelete(key) {
  20456. var data = this.__data__,
  20457. result = data['delete'](key);
  20458. this.size = data.size;
  20459. return result;
  20460. }
  20461. /**
  20462. * Gets the stack value for `key`.
  20463. *
  20464. * @private
  20465. * @name get
  20466. * @memberOf Stack
  20467. * @param {string} key The key of the value to get.
  20468. * @returns {*} Returns the entry value.
  20469. */
  20470. function stackGet(key) {
  20471. return this.__data__.get(key);
  20472. }
  20473. /**
  20474. * Checks if a stack value for `key` exists.
  20475. *
  20476. * @private
  20477. * @name has
  20478. * @memberOf Stack
  20479. * @param {string} key The key of the entry to check.
  20480. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  20481. */
  20482. function stackHas(key) {
  20483. return this.__data__.has(key);
  20484. }
  20485. /**
  20486. * Sets the stack `key` to `value`.
  20487. *
  20488. * @private
  20489. * @name set
  20490. * @memberOf Stack
  20491. * @param {string} key The key of the value to set.
  20492. * @param {*} value The value to set.
  20493. * @returns {Object} Returns the stack cache instance.
  20494. */
  20495. function stackSet(key, value) {
  20496. var data = this.__data__;
  20497. if (data instanceof ListCache) {
  20498. var pairs = data.__data__;
  20499. if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {
  20500. pairs.push([key, value]);
  20501. this.size = ++data.size;
  20502. return this;
  20503. }
  20504. data = this.__data__ = new MapCache(pairs);
  20505. }
  20506. data.set(key, value);
  20507. this.size = data.size;
  20508. return this;
  20509. }
  20510. // Add methods to `Stack`.
  20511. Stack.prototype.clear = stackClear;
  20512. Stack.prototype['delete'] = stackDelete;
  20513. Stack.prototype.get = stackGet;
  20514. Stack.prototype.has = stackHas;
  20515. Stack.prototype.set = stackSet;
  20516. /*------------------------------------------------------------------------*/
  20517. /**
  20518. * Creates an array of the enumerable property names of the array-like `value`.
  20519. *
  20520. * @private
  20521. * @param {*} value The value to query.
  20522. * @param {boolean} inherited Specify returning inherited property names.
  20523. * @returns {Array} Returns the array of property names.
  20524. */
  20525. function arrayLikeKeys(value, inherited) {
  20526. var isArr = isArray(value),
  20527. isArg = !isArr && isArguments(value),
  20528. isBuff = !isArr && !isArg && isBuffer(value),
  20529. isType = !isArr && !isArg && !isBuff && isTypedArray(value),
  20530. skipIndexes = isArr || isArg || isBuff || isType,
  20531. result = skipIndexes ? baseTimes(value.length, String) : [],
  20532. length = result.length;
  20533. for (var key in value) {
  20534. if ((inherited || hasOwnProperty.call(value, key)) &&
  20535. !(skipIndexes && (
  20536. // Safari 9 has enumerable `arguments.length` in strict mode.
  20537. key == 'length' ||
  20538. // Node.js 0.10 has enumerable non-index properties on buffers.
  20539. (isBuff && (key == 'offset' || key == 'parent')) ||
  20540. // PhantomJS 2 has enumerable non-index properties on typed arrays.
  20541. (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||
  20542. // Skip index properties.
  20543. isIndex(key, length)
  20544. ))) {
  20545. result.push(key);
  20546. }
  20547. }
  20548. return result;
  20549. }
  20550. /**
  20551. * A specialized version of `_.sample` for arrays.
  20552. *
  20553. * @private
  20554. * @param {Array} array The array to sample.
  20555. * @returns {*} Returns the random element.
  20556. */
  20557. function arraySample(array) {
  20558. var length = array.length;
  20559. return length ? array[baseRandom(0, length - 1)] : undefined;
  20560. }
  20561. /**
  20562. * A specialized version of `_.sampleSize` for arrays.
  20563. *
  20564. * @private
  20565. * @param {Array} array The array to sample.
  20566. * @param {number} n The number of elements to sample.
  20567. * @returns {Array} Returns the random elements.
  20568. */
  20569. function arraySampleSize(array, n) {
  20570. return shuffleSelf(copyArray(array), baseClamp(n, 0, array.length));
  20571. }
  20572. /**
  20573. * A specialized version of `_.shuffle` for arrays.
  20574. *
  20575. * @private
  20576. * @param {Array} array The array to shuffle.
  20577. * @returns {Array} Returns the new shuffled array.
  20578. */
  20579. function arrayShuffle(array) {
  20580. return shuffleSelf(copyArray(array));
  20581. }
  20582. /**
  20583. * This function is like `assignValue` except that it doesn't assign
  20584. * `undefined` values.
  20585. *
  20586. * @private
  20587. * @param {Object} object The object to modify.
  20588. * @param {string} key The key of the property to assign.
  20589. * @param {*} value The value to assign.
  20590. */
  20591. function assignMergeValue(object, key, value) {
  20592. if ((value !== undefined && !eq(object[key], value)) ||
  20593. (value === undefined && !(key in object))) {
  20594. baseAssignValue(object, key, value);
  20595. }
  20596. }
  20597. /**
  20598. * Assigns `value` to `key` of `object` if the existing value is not equivalent
  20599. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  20600. * for equality comparisons.
  20601. *
  20602. * @private
  20603. * @param {Object} object The object to modify.
  20604. * @param {string} key The key of the property to assign.
  20605. * @param {*} value The value to assign.
  20606. */
  20607. function assignValue(object, key, value) {
  20608. var objValue = object[key];
  20609. if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) ||
  20610. (value === undefined && !(key in object))) {
  20611. baseAssignValue(object, key, value);
  20612. }
  20613. }
  20614. /**
  20615. * Gets the index at which the `key` is found in `array` of key-value pairs.
  20616. *
  20617. * @private
  20618. * @param {Array} array The array to inspect.
  20619. * @param {*} key The key to search for.
  20620. * @returns {number} Returns the index of the matched value, else `-1`.
  20621. */
  20622. function assocIndexOf(array, key) {
  20623. var length = array.length;
  20624. while (length--) {
  20625. if (eq(array[length][0], key)) {
  20626. return length;
  20627. }
  20628. }
  20629. return -1;
  20630. }
  20631. /**
  20632. * Aggregates elements of `collection` on `accumulator` with keys transformed
  20633. * by `iteratee` and values set by `setter`.
  20634. *
  20635. * @private
  20636. * @param {Array|Object} collection The collection to iterate over.
  20637. * @param {Function} setter The function to set `accumulator` values.
  20638. * @param {Function} iteratee The iteratee to transform keys.
  20639. * @param {Object} accumulator The initial aggregated object.
  20640. * @returns {Function} Returns `accumulator`.
  20641. */
  20642. function baseAggregator(collection, setter, iteratee, accumulator) {
  20643. baseEach(collection, function(value, key, collection) {
  20644. setter(accumulator, value, iteratee(value), collection);
  20645. });
  20646. return accumulator;
  20647. }
  20648. /**
  20649. * The base implementation of `_.assign` without support for multiple sources
  20650. * or `customizer` functions.
  20651. *
  20652. * @private
  20653. * @param {Object} object The destination object.
  20654. * @param {Object} source The source object.
  20655. * @returns {Object} Returns `object`.
  20656. */
  20657. function baseAssign(object, source) {
  20658. return object && copyObject(source, keys(source), object);
  20659. }
  20660. /**
  20661. * The base implementation of `_.assignIn` without support for multiple sources
  20662. * or `customizer` functions.
  20663. *
  20664. * @private
  20665. * @param {Object} object The destination object.
  20666. * @param {Object} source The source object.
  20667. * @returns {Object} Returns `object`.
  20668. */
  20669. function baseAssignIn(object, source) {
  20670. return object && copyObject(source, keysIn(source), object);
  20671. }
  20672. /**
  20673. * The base implementation of `assignValue` and `assignMergeValue` without
  20674. * value checks.
  20675. *
  20676. * @private
  20677. * @param {Object} object The object to modify.
  20678. * @param {string} key The key of the property to assign.
  20679. * @param {*} value The value to assign.
  20680. */
  20681. function baseAssignValue(object, key, value) {
  20682. if (key == '__proto__' && defineProperty) {
  20683. defineProperty(object, key, {
  20684. 'configurable': true,
  20685. 'enumerable': true,
  20686. 'value': value,
  20687. 'writable': true
  20688. });
  20689. } else {
  20690. object[key] = value;
  20691. }
  20692. }
  20693. /**
  20694. * The base implementation of `_.at` without support for individual paths.
  20695. *
  20696. * @private
  20697. * @param {Object} object The object to iterate over.
  20698. * @param {string[]} paths The property paths to pick.
  20699. * @returns {Array} Returns the picked elements.
  20700. */
  20701. function baseAt(object, paths) {
  20702. var index = -1,
  20703. length = paths.length,
  20704. result = Array(length),
  20705. skip = object == null;
  20706. while (++index < length) {
  20707. result[index] = skip ? undefined : get(object, paths[index]);
  20708. }
  20709. return result;
  20710. }
  20711. /**
  20712. * The base implementation of `_.clamp` which doesn't coerce arguments.
  20713. *
  20714. * @private
  20715. * @param {number} number The number to clamp.
  20716. * @param {number} [lower] The lower bound.
  20717. * @param {number} upper The upper bound.
  20718. * @returns {number} Returns the clamped number.
  20719. */
  20720. function baseClamp(number, lower, upper) {
  20721. if (number === number) {
  20722. if (upper !== undefined) {
  20723. number = number <= upper ? number : upper;
  20724. }
  20725. if (lower !== undefined) {
  20726. number = number >= lower ? number : lower;
  20727. }
  20728. }
  20729. return number;
  20730. }
  20731. /**
  20732. * The base implementation of `_.clone` and `_.cloneDeep` which tracks
  20733. * traversed objects.
  20734. *
  20735. * @private
  20736. * @param {*} value The value to clone.
  20737. * @param {boolean} bitmask The bitmask flags.
  20738. * 1 - Deep clone
  20739. * 2 - Flatten inherited properties
  20740. * 4 - Clone symbols
  20741. * @param {Function} [customizer] The function to customize cloning.
  20742. * @param {string} [key] The key of `value`.
  20743. * @param {Object} [object] The parent object of `value`.
  20744. * @param {Object} [stack] Tracks traversed objects and their clone counterparts.
  20745. * @returns {*} Returns the cloned value.
  20746. */
  20747. function baseClone(value, bitmask, customizer, key, object, stack) {
  20748. var result,
  20749. isDeep = bitmask & CLONE_DEEP_FLAG,
  20750. isFlat = bitmask & CLONE_FLAT_FLAG,
  20751. isFull = bitmask & CLONE_SYMBOLS_FLAG;
  20752. if (customizer) {
  20753. result = object ? customizer(value, key, object, stack) : customizer(value);
  20754. }
  20755. if (result !== undefined) {
  20756. return result;
  20757. }
  20758. if (!isObject(value)) {
  20759. return value;
  20760. }
  20761. var isArr = isArray(value);
  20762. if (isArr) {
  20763. result = initCloneArray(value);
  20764. if (!isDeep) {
  20765. return copyArray(value, result);
  20766. }
  20767. } else {
  20768. var tag = getTag(value),
  20769. isFunc = tag == funcTag || tag == genTag;
  20770. if (isBuffer(value)) {
  20771. return cloneBuffer(value, isDeep);
  20772. }
  20773. if (tag == objectTag || tag == argsTag || (isFunc && !object)) {
  20774. result = (isFlat || isFunc) ? {} : initCloneObject(value);
  20775. if (!isDeep) {
  20776. return isFlat
  20777. ? copySymbolsIn(value, baseAssignIn(result, value))
  20778. : copySymbols(value, baseAssign(result, value));
  20779. }
  20780. } else {
  20781. if (!cloneableTags[tag]) {
  20782. return object ? value : {};
  20783. }
  20784. result = initCloneByTag(value, tag, isDeep);
  20785. }
  20786. }
  20787. // Check for circular references and return its corresponding clone.
  20788. stack || (stack = new Stack);
  20789. var stacked = stack.get(value);
  20790. if (stacked) {
  20791. return stacked;
  20792. }
  20793. stack.set(value, result);
  20794. if (isSet(value)) {
  20795. value.forEach(function(subValue) {
  20796. result.add(baseClone(subValue, bitmask, customizer, subValue, value, stack));
  20797. });
  20798. } else if (isMap(value)) {
  20799. value.forEach(function(subValue, key) {
  20800. result.set(key, baseClone(subValue, bitmask, customizer, key, value, stack));
  20801. });
  20802. }
  20803. var keysFunc = isFull
  20804. ? (isFlat ? getAllKeysIn : getAllKeys)
  20805. : (isFlat ? keysIn : keys);
  20806. var props = isArr ? undefined : keysFunc(value);
  20807. arrayEach(props || value, function(subValue, key) {
  20808. if (props) {
  20809. key = subValue;
  20810. subValue = value[key];
  20811. }
  20812. // Recursively populate clone (susceptible to call stack limits).
  20813. assignValue(result, key, baseClone(subValue, bitmask, customizer, key, value, stack));
  20814. });
  20815. return result;
  20816. }
  20817. /**
  20818. * The base implementation of `_.conforms` which doesn't clone `source`.
  20819. *
  20820. * @private
  20821. * @param {Object} source The object of property predicates to conform to.
  20822. * @returns {Function} Returns the new spec function.
  20823. */
  20824. function baseConforms(source) {
  20825. var props = keys(source);
  20826. return function(object) {
  20827. return baseConformsTo(object, source, props);
  20828. };
  20829. }
  20830. /**
  20831. * The base implementation of `_.conformsTo` which accepts `props` to check.
  20832. *
  20833. * @private
  20834. * @param {Object} object The object to inspect.
  20835. * @param {Object} source The object of property predicates to conform to.
  20836. * @returns {boolean} Returns `true` if `object` conforms, else `false`.
  20837. */
  20838. function baseConformsTo(object, source, props) {
  20839. var length = props.length;
  20840. if (object == null) {
  20841. return !length;
  20842. }
  20843. object = Object(object);
  20844. while (length--) {
  20845. var key = props[length],
  20846. predicate = source[key],
  20847. value = object[key];
  20848. if ((value === undefined && !(key in object)) || !predicate(value)) {
  20849. return false;
  20850. }
  20851. }
  20852. return true;
  20853. }
  20854. /**
  20855. * The base implementation of `_.delay` and `_.defer` which accepts `args`
  20856. * to provide to `func`.
  20857. *
  20858. * @private
  20859. * @param {Function} func The function to delay.
  20860. * @param {number} wait The number of milliseconds to delay invocation.
  20861. * @param {Array} args The arguments to provide to `func`.
  20862. * @returns {number|Object} Returns the timer id or timeout object.
  20863. */
  20864. function baseDelay(func, wait, args) {
  20865. if (typeof func != 'function') {
  20866. throw new TypeError(FUNC_ERROR_TEXT);
  20867. }
  20868. return setTimeout(function() { func.apply(undefined, args); }, wait);
  20869. }
  20870. /**
  20871. * The base implementation of methods like `_.difference` without support
  20872. * for excluding multiple arrays or iteratee shorthands.
  20873. *
  20874. * @private
  20875. * @param {Array} array The array to inspect.
  20876. * @param {Array} values The values to exclude.
  20877. * @param {Function} [iteratee] The iteratee invoked per element.
  20878. * @param {Function} [comparator] The comparator invoked per element.
  20879. * @returns {Array} Returns the new array of filtered values.
  20880. */
  20881. function baseDifference(array, values, iteratee, comparator) {
  20882. var index = -1,
  20883. includes = arrayIncludes,
  20884. isCommon = true,
  20885. length = array.length,
  20886. result = [],
  20887. valuesLength = values.length;
  20888. if (!length) {
  20889. return result;
  20890. }
  20891. if (iteratee) {
  20892. values = arrayMap(values, baseUnary(iteratee));
  20893. }
  20894. if (comparator) {
  20895. includes = arrayIncludesWith;
  20896. isCommon = false;
  20897. }
  20898. else if (values.length >= LARGE_ARRAY_SIZE) {
  20899. includes = cacheHas;
  20900. isCommon = false;
  20901. values = new SetCache(values);
  20902. }
  20903. outer:
  20904. while (++index < length) {
  20905. var value = array[index],
  20906. computed = iteratee == null ? value : iteratee(value);
  20907. value = (comparator || value !== 0) ? value : 0;
  20908. if (isCommon && computed === computed) {
  20909. var valuesIndex = valuesLength;
  20910. while (valuesIndex--) {
  20911. if (values[valuesIndex] === computed) {
  20912. continue outer;
  20913. }
  20914. }
  20915. result.push(value);
  20916. }
  20917. else if (!includes(values, computed, comparator)) {
  20918. result.push(value);
  20919. }
  20920. }
  20921. return result;
  20922. }
  20923. /**
  20924. * The base implementation of `_.forEach` without support for iteratee shorthands.
  20925. *
  20926. * @private
  20927. * @param {Array|Object} collection The collection to iterate over.
  20928. * @param {Function} iteratee The function invoked per iteration.
  20929. * @returns {Array|Object} Returns `collection`.
  20930. */
  20931. var baseEach = createBaseEach(baseForOwn);
  20932. /**
  20933. * The base implementation of `_.forEachRight` without support for iteratee shorthands.
  20934. *
  20935. * @private
  20936. * @param {Array|Object} collection The collection to iterate over.
  20937. * @param {Function} iteratee The function invoked per iteration.
  20938. * @returns {Array|Object} Returns `collection`.
  20939. */
  20940. var baseEachRight = createBaseEach(baseForOwnRight, true);
  20941. /**
  20942. * The base implementation of `_.every` without support for iteratee shorthands.
  20943. *
  20944. * @private
  20945. * @param {Array|Object} collection The collection to iterate over.
  20946. * @param {Function} predicate The function invoked per iteration.
  20947. * @returns {boolean} Returns `true` if all elements pass the predicate check,
  20948. * else `false`
  20949. */
  20950. function baseEvery(collection, predicate) {
  20951. var result = true;
  20952. baseEach(collection, function(value, index, collection) {
  20953. result = !!predicate(value, index, collection);
  20954. return result;
  20955. });
  20956. return result;
  20957. }
  20958. /**
  20959. * The base implementation of methods like `_.max` and `_.min` which accepts a
  20960. * `comparator` to determine the extremum value.
  20961. *
  20962. * @private
  20963. * @param {Array} array The array to iterate over.
  20964. * @param {Function} iteratee The iteratee invoked per iteration.
  20965. * @param {Function} comparator The comparator used to compare values.
  20966. * @returns {*} Returns the extremum value.
  20967. */
  20968. function baseExtremum(array, iteratee, comparator) {
  20969. var index = -1,
  20970. length = array.length;
  20971. while (++index < length) {
  20972. var value = array[index],
  20973. current = iteratee(value);
  20974. if (current != null && (computed === undefined
  20975. ? (current === current && !isSymbol(current))
  20976. : comparator(current, computed)
  20977. )) {
  20978. var computed = current,
  20979. result = value;
  20980. }
  20981. }
  20982. return result;
  20983. }
  20984. /**
  20985. * The base implementation of `_.fill` without an iteratee call guard.
  20986. *
  20987. * @private
  20988. * @param {Array} array The array to fill.
  20989. * @param {*} value The value to fill `array` with.
  20990. * @param {number} [start=0] The start position.
  20991. * @param {number} [end=array.length] The end position.
  20992. * @returns {Array} Returns `array`.
  20993. */
  20994. function baseFill(array, value, start, end) {
  20995. var length = array.length;
  20996. start = toInteger(start);
  20997. if (start < 0) {
  20998. start = -start > length ? 0 : (length + start);
  20999. }
  21000. end = (end === undefined || end > length) ? length : toInteger(end);
  21001. if (end < 0) {
  21002. end += length;
  21003. }
  21004. end = start > end ? 0 : toLength(end);
  21005. while (start < end) {
  21006. array[start++] = value;
  21007. }
  21008. return array;
  21009. }
  21010. /**
  21011. * The base implementation of `_.filter` without support for iteratee shorthands.
  21012. *
  21013. * @private
  21014. * @param {Array|Object} collection The collection to iterate over.
  21015. * @param {Function} predicate The function invoked per iteration.
  21016. * @returns {Array} Returns the new filtered array.
  21017. */
  21018. function baseFilter(collection, predicate) {
  21019. var result = [];
  21020. baseEach(collection, function(value, index, collection) {
  21021. if (predicate(value, index, collection)) {
  21022. result.push(value);
  21023. }
  21024. });
  21025. return result;
  21026. }
  21027. /**
  21028. * The base implementation of `_.flatten` with support for restricting flattening.
  21029. *
  21030. * @private
  21031. * @param {Array} array The array to flatten.
  21032. * @param {number} depth The maximum recursion depth.
  21033. * @param {boolean} [predicate=isFlattenable] The function invoked per iteration.
  21034. * @param {boolean} [isStrict] Restrict to values that pass `predicate` checks.
  21035. * @param {Array} [result=[]] The initial result value.
  21036. * @returns {Array} Returns the new flattened array.
  21037. */
  21038. function baseFlatten(array, depth, predicate, isStrict, result) {
  21039. var index = -1,
  21040. length = array.length;
  21041. predicate || (predicate = isFlattenable);
  21042. result || (result = []);
  21043. while (++index < length) {
  21044. var value = array[index];
  21045. if (depth > 0 && predicate(value)) {
  21046. if (depth > 1) {
  21047. // Recursively flatten arrays (susceptible to call stack limits).
  21048. baseFlatten(value, depth - 1, predicate, isStrict, result);
  21049. } else {
  21050. arrayPush(result, value);
  21051. }
  21052. } else if (!isStrict) {
  21053. result[result.length] = value;
  21054. }
  21055. }
  21056. return result;
  21057. }
  21058. /**
  21059. * The base implementation of `baseForOwn` which iterates over `object`
  21060. * properties returned by `keysFunc` and invokes `iteratee` for each property.
  21061. * Iteratee functions may exit iteration early by explicitly returning `false`.
  21062. *
  21063. * @private
  21064. * @param {Object} object The object to iterate over.
  21065. * @param {Function} iteratee The function invoked per iteration.
  21066. * @param {Function} keysFunc The function to get the keys of `object`.
  21067. * @returns {Object} Returns `object`.
  21068. */
  21069. var baseFor = createBaseFor();
  21070. /**
  21071. * This function is like `baseFor` except that it iterates over properties
  21072. * in the opposite order.
  21073. *
  21074. * @private
  21075. * @param {Object} object The object to iterate over.
  21076. * @param {Function} iteratee The function invoked per iteration.
  21077. * @param {Function} keysFunc The function to get the keys of `object`.
  21078. * @returns {Object} Returns `object`.
  21079. */
  21080. var baseForRight = createBaseFor(true);
  21081. /**
  21082. * The base implementation of `_.forOwn` without support for iteratee shorthands.
  21083. *
  21084. * @private
  21085. * @param {Object} object The object to iterate over.
  21086. * @param {Function} iteratee The function invoked per iteration.
  21087. * @returns {Object} Returns `object`.
  21088. */
  21089. function baseForOwn(object, iteratee) {
  21090. return object && baseFor(object, iteratee, keys);
  21091. }
  21092. /**
  21093. * The base implementation of `_.forOwnRight` without support for iteratee shorthands.
  21094. *
  21095. * @private
  21096. * @param {Object} object The object to iterate over.
  21097. * @param {Function} iteratee The function invoked per iteration.
  21098. * @returns {Object} Returns `object`.
  21099. */
  21100. function baseForOwnRight(object, iteratee) {
  21101. return object && baseForRight(object, iteratee, keys);
  21102. }
  21103. /**
  21104. * The base implementation of `_.functions` which creates an array of
  21105. * `object` function property names filtered from `props`.
  21106. *
  21107. * @private
  21108. * @param {Object} object The object to inspect.
  21109. * @param {Array} props The property names to filter.
  21110. * @returns {Array} Returns the function names.
  21111. */
  21112. function baseFunctions(object, props) {
  21113. return arrayFilter(props, function(key) {
  21114. return isFunction(object[key]);
  21115. });
  21116. }
  21117. /**
  21118. * The base implementation of `_.get` without support for default values.
  21119. *
  21120. * @private
  21121. * @param {Object} object The object to query.
  21122. * @param {Array|string} path The path of the property to get.
  21123. * @returns {*} Returns the resolved value.
  21124. */
  21125. function baseGet(object, path) {
  21126. path = castPath(path, object);
  21127. var index = 0,
  21128. length = path.length;
  21129. while (object != null && index < length) {
  21130. object = object[toKey(path[index++])];
  21131. }
  21132. return (index && index == length) ? object : undefined;
  21133. }
  21134. /**
  21135. * The base implementation of `getAllKeys` and `getAllKeysIn` which uses
  21136. * `keysFunc` and `symbolsFunc` to get the enumerable property names and
  21137. * symbols of `object`.
  21138. *
  21139. * @private
  21140. * @param {Object} object The object to query.
  21141. * @param {Function} keysFunc The function to get the keys of `object`.
  21142. * @param {Function} symbolsFunc The function to get the symbols of `object`.
  21143. * @returns {Array} Returns the array of property names and symbols.
  21144. */
  21145. function baseGetAllKeys(object, keysFunc, symbolsFunc) {
  21146. var result = keysFunc(object);
  21147. return isArray(object) ? result : arrayPush(result, symbolsFunc(object));
  21148. }
  21149. /**
  21150. * The base implementation of `getTag` without fallbacks for buggy environments.
  21151. *
  21152. * @private
  21153. * @param {*} value The value to query.
  21154. * @returns {string} Returns the `toStringTag`.
  21155. */
  21156. function baseGetTag(value) {
  21157. if (value == null) {
  21158. return value === undefined ? undefinedTag : nullTag;
  21159. }
  21160. return (symToStringTag && symToStringTag in Object(value))
  21161. ? getRawTag(value)
  21162. : objectToString(value);
  21163. }
  21164. /**
  21165. * The base implementation of `_.gt` which doesn't coerce arguments.
  21166. *
  21167. * @private
  21168. * @param {*} value The value to compare.
  21169. * @param {*} other The other value to compare.
  21170. * @returns {boolean} Returns `true` if `value` is greater than `other`,
  21171. * else `false`.
  21172. */
  21173. function baseGt(value, other) {
  21174. return value > other;
  21175. }
  21176. /**
  21177. * The base implementation of `_.has` without support for deep paths.
  21178. *
  21179. * @private
  21180. * @param {Object} [object] The object to query.
  21181. * @param {Array|string} key The key to check.
  21182. * @returns {boolean} Returns `true` if `key` exists, else `false`.
  21183. */
  21184. function baseHas(object, key) {
  21185. return object != null && hasOwnProperty.call(object, key);
  21186. }
  21187. /**
  21188. * The base implementation of `_.hasIn` without support for deep paths.
  21189. *
  21190. * @private
  21191. * @param {Object} [object] The object to query.
  21192. * @param {Array|string} key The key to check.
  21193. * @returns {boolean} Returns `true` if `key` exists, else `false`.
  21194. */
  21195. function baseHasIn(object, key) {
  21196. return object != null && key in Object(object);
  21197. }
  21198. /**
  21199. * The base implementation of `_.inRange` which doesn't coerce arguments.
  21200. *
  21201. * @private
  21202. * @param {number} number The number to check.
  21203. * @param {number} start The start of the range.
  21204. * @param {number} end The end of the range.
  21205. * @returns {boolean} Returns `true` if `number` is in the range, else `false`.
  21206. */
  21207. function baseInRange(number, start, end) {
  21208. return number >= nativeMin(start, end) && number < nativeMax(start, end);
  21209. }
  21210. /**
  21211. * The base implementation of methods like `_.intersection`, without support
  21212. * for iteratee shorthands, that accepts an array of arrays to inspect.
  21213. *
  21214. * @private
  21215. * @param {Array} arrays The arrays to inspect.
  21216. * @param {Function} [iteratee] The iteratee invoked per element.
  21217. * @param {Function} [comparator] The comparator invoked per element.
  21218. * @returns {Array} Returns the new array of shared values.
  21219. */
  21220. function baseIntersection(arrays, iteratee, comparator) {
  21221. var includes = comparator ? arrayIncludesWith : arrayIncludes,
  21222. length = arrays[0].length,
  21223. othLength = arrays.length,
  21224. othIndex = othLength,
  21225. caches = Array(othLength),
  21226. maxLength = Infinity,
  21227. result = [];
  21228. while (othIndex--) {
  21229. var array = arrays[othIndex];
  21230. if (othIndex && iteratee) {
  21231. array = arrayMap(array, baseUnary(iteratee));
  21232. }
  21233. maxLength = nativeMin(array.length, maxLength);
  21234. caches[othIndex] = !comparator && (iteratee || (length >= 120 && array.length >= 120))
  21235. ? new SetCache(othIndex && array)
  21236. : undefined;
  21237. }
  21238. array = arrays[0];
  21239. var index = -1,
  21240. seen = caches[0];
  21241. outer:
  21242. while (++index < length && result.length < maxLength) {
  21243. var value = array[index],
  21244. computed = iteratee ? iteratee(value) : value;
  21245. value = (comparator || value !== 0) ? value : 0;
  21246. if (!(seen
  21247. ? cacheHas(seen, computed)
  21248. : includes(result, computed, comparator)
  21249. )) {
  21250. othIndex = othLength;
  21251. while (--othIndex) {
  21252. var cache = caches[othIndex];
  21253. if (!(cache
  21254. ? cacheHas(cache, computed)
  21255. : includes(arrays[othIndex], computed, comparator))
  21256. ) {
  21257. continue outer;
  21258. }
  21259. }
  21260. if (seen) {
  21261. seen.push(computed);
  21262. }
  21263. result.push(value);
  21264. }
  21265. }
  21266. return result;
  21267. }
  21268. /**
  21269. * The base implementation of `_.invert` and `_.invertBy` which inverts
  21270. * `object` with values transformed by `iteratee` and set by `setter`.
  21271. *
  21272. * @private
  21273. * @param {Object} object The object to iterate over.
  21274. * @param {Function} setter The function to set `accumulator` values.
  21275. * @param {Function} iteratee The iteratee to transform values.
  21276. * @param {Object} accumulator The initial inverted object.
  21277. * @returns {Function} Returns `accumulator`.
  21278. */
  21279. function baseInverter(object, setter, iteratee, accumulator) {
  21280. baseForOwn(object, function(value, key, object) {
  21281. setter(accumulator, iteratee(value), key, object);
  21282. });
  21283. return accumulator;
  21284. }
  21285. /**
  21286. * The base implementation of `_.invoke` without support for individual
  21287. * method arguments.
  21288. *
  21289. * @private
  21290. * @param {Object} object The object to query.
  21291. * @param {Array|string} path The path of the method to invoke.
  21292. * @param {Array} args The arguments to invoke the method with.
  21293. * @returns {*} Returns the result of the invoked method.
  21294. */
  21295. function baseInvoke(object, path, args) {
  21296. path = castPath(path, object);
  21297. object = parent(object, path);
  21298. var func = object == null ? object : object[toKey(last(path))];
  21299. return func == null ? undefined : apply(func, object, args);
  21300. }
  21301. /**
  21302. * The base implementation of `_.isArguments`.
  21303. *
  21304. * @private
  21305. * @param {*} value The value to check.
  21306. * @returns {boolean} Returns `true` if `value` is an `arguments` object,
  21307. */
  21308. function baseIsArguments(value) {
  21309. return isObjectLike(value) && baseGetTag(value) == argsTag;
  21310. }
  21311. /**
  21312. * The base implementation of `_.isArrayBuffer` without Node.js optimizations.
  21313. *
  21314. * @private
  21315. * @param {*} value The value to check.
  21316. * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`.
  21317. */
  21318. function baseIsArrayBuffer(value) {
  21319. return isObjectLike(value) && baseGetTag(value) == arrayBufferTag;
  21320. }
  21321. /**
  21322. * The base implementation of `_.isDate` without Node.js optimizations.
  21323. *
  21324. * @private
  21325. * @param {*} value The value to check.
  21326. * @returns {boolean} Returns `true` if `value` is a date object, else `false`.
  21327. */
  21328. function baseIsDate(value) {
  21329. return isObjectLike(value) && baseGetTag(value) == dateTag;
  21330. }
  21331. /**
  21332. * The base implementation of `_.isEqual` which supports partial comparisons
  21333. * and tracks traversed objects.
  21334. *
  21335. * @private
  21336. * @param {*} value The value to compare.
  21337. * @param {*} other The other value to compare.
  21338. * @param {boolean} bitmask The bitmask flags.
  21339. * 1 - Unordered comparison
  21340. * 2 - Partial comparison
  21341. * @param {Function} [customizer] The function to customize comparisons.
  21342. * @param {Object} [stack] Tracks traversed `value` and `other` objects.
  21343. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  21344. */
  21345. function baseIsEqual(value, other, bitmask, customizer, stack) {
  21346. if (value === other) {
  21347. return true;
  21348. }
  21349. if (value == null || other == null || (!isObjectLike(value) && !isObjectLike(other))) {
  21350. return value !== value && other !== other;
  21351. }
  21352. return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);
  21353. }
  21354. /**
  21355. * A specialized version of `baseIsEqual` for arrays and objects which performs
  21356. * deep comparisons and tracks traversed objects enabling objects with circular
  21357. * references to be compared.
  21358. *
  21359. * @private
  21360. * @param {Object} object The object to compare.
  21361. * @param {Object} other The other object to compare.
  21362. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  21363. * @param {Function} customizer The function to customize comparisons.
  21364. * @param {Function} equalFunc The function to determine equivalents of values.
  21365. * @param {Object} [stack] Tracks traversed `object` and `other` objects.
  21366. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  21367. */
  21368. function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
  21369. var objIsArr = isArray(object),
  21370. othIsArr = isArray(other),
  21371. objTag = objIsArr ? arrayTag : getTag(object),
  21372. othTag = othIsArr ? arrayTag : getTag(other);
  21373. objTag = objTag == argsTag ? objectTag : objTag;
  21374. othTag = othTag == argsTag ? objectTag : othTag;
  21375. var objIsObj = objTag == objectTag,
  21376. othIsObj = othTag == objectTag,
  21377. isSameTag = objTag == othTag;
  21378. if (isSameTag && isBuffer(object)) {
  21379. if (!isBuffer(other)) {
  21380. return false;
  21381. }
  21382. objIsArr = true;
  21383. objIsObj = false;
  21384. }
  21385. if (isSameTag && !objIsObj) {
  21386. stack || (stack = new Stack);
  21387. return (objIsArr || isTypedArray(object))
  21388. ? equalArrays(object, other, bitmask, customizer, equalFunc, stack)
  21389. : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);
  21390. }
  21391. if (!(bitmask & COMPARE_PARTIAL_FLAG)) {
  21392. var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),
  21393. othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');
  21394. if (objIsWrapped || othIsWrapped) {
  21395. var objUnwrapped = objIsWrapped ? object.value() : object,
  21396. othUnwrapped = othIsWrapped ? other.value() : other;
  21397. stack || (stack = new Stack);
  21398. return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
  21399. }
  21400. }
  21401. if (!isSameTag) {
  21402. return false;
  21403. }
  21404. stack || (stack = new Stack);
  21405. return equalObjects(object, other, bitmask, customizer, equalFunc, stack);
  21406. }
  21407. /**
  21408. * The base implementation of `_.isMap` without Node.js optimizations.
  21409. *
  21410. * @private
  21411. * @param {*} value The value to check.
  21412. * @returns {boolean} Returns `true` if `value` is a map, else `false`.
  21413. */
  21414. function baseIsMap(value) {
  21415. return isObjectLike(value) && getTag(value) == mapTag;
  21416. }
  21417. /**
  21418. * The base implementation of `_.isMatch` without support for iteratee shorthands.
  21419. *
  21420. * @private
  21421. * @param {Object} object The object to inspect.
  21422. * @param {Object} source The object of property values to match.
  21423. * @param {Array} matchData The property names, values, and compare flags to match.
  21424. * @param {Function} [customizer] The function to customize comparisons.
  21425. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  21426. */
  21427. function baseIsMatch(object, source, matchData, customizer) {
  21428. var index = matchData.length,
  21429. length = index,
  21430. noCustomizer = !customizer;
  21431. if (object == null) {
  21432. return !length;
  21433. }
  21434. object = Object(object);
  21435. while (index--) {
  21436. var data = matchData[index];
  21437. if ((noCustomizer && data[2])
  21438. ? data[1] !== object[data[0]]
  21439. : !(data[0] in object)
  21440. ) {
  21441. return false;
  21442. }
  21443. }
  21444. while (++index < length) {
  21445. data = matchData[index];
  21446. var key = data[0],
  21447. objValue = object[key],
  21448. srcValue = data[1];
  21449. if (noCustomizer && data[2]) {
  21450. if (objValue === undefined && !(key in object)) {
  21451. return false;
  21452. }
  21453. } else {
  21454. var stack = new Stack;
  21455. if (customizer) {
  21456. var result = customizer(objValue, srcValue, key, object, source, stack);
  21457. }
  21458. if (!(result === undefined
  21459. ? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG, customizer, stack)
  21460. : result
  21461. )) {
  21462. return false;
  21463. }
  21464. }
  21465. }
  21466. return true;
  21467. }
  21468. /**
  21469. * The base implementation of `_.isNative` without bad shim checks.
  21470. *
  21471. * @private
  21472. * @param {*} value The value to check.
  21473. * @returns {boolean} Returns `true` if `value` is a native function,
  21474. * else `false`.
  21475. */
  21476. function baseIsNative(value) {
  21477. if (!isObject(value) || isMasked(value)) {
  21478. return false;
  21479. }
  21480. var pattern = isFunction(value) ? reIsNative : reIsHostCtor;
  21481. return pattern.test(toSource(value));
  21482. }
  21483. /**
  21484. * The base implementation of `_.isRegExp` without Node.js optimizations.
  21485. *
  21486. * @private
  21487. * @param {*} value The value to check.
  21488. * @returns {boolean} Returns `true` if `value` is a regexp, else `false`.
  21489. */
  21490. function baseIsRegExp(value) {
  21491. return isObjectLike(value) && baseGetTag(value) == regexpTag;
  21492. }
  21493. /**
  21494. * The base implementation of `_.isSet` without Node.js optimizations.
  21495. *
  21496. * @private
  21497. * @param {*} value The value to check.
  21498. * @returns {boolean} Returns `true` if `value` is a set, else `false`.
  21499. */
  21500. function baseIsSet(value) {
  21501. return isObjectLike(value) && getTag(value) == setTag;
  21502. }
  21503. /**
  21504. * The base implementation of `_.isTypedArray` without Node.js optimizations.
  21505. *
  21506. * @private
  21507. * @param {*} value The value to check.
  21508. * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
  21509. */
  21510. function baseIsTypedArray(value) {
  21511. return isObjectLike(value) &&
  21512. isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
  21513. }
  21514. /**
  21515. * The base implementation of `_.iteratee`.
  21516. *
  21517. * @private
  21518. * @param {*} [value=_.identity] The value to convert to an iteratee.
  21519. * @returns {Function} Returns the iteratee.
  21520. */
  21521. function baseIteratee(value) {
  21522. // Don't store the `typeof` result in a variable to avoid a JIT bug in Safari 9.
  21523. // See https://bugs.webkit.org/show_bug.cgi?id=156034 for more details.
  21524. if (typeof value == 'function') {
  21525. return value;
  21526. }
  21527. if (value == null) {
  21528. return identity;
  21529. }
  21530. if (typeof value == 'object') {
  21531. return isArray(value)
  21532. ? baseMatchesProperty(value[0], value[1])
  21533. : baseMatches(value);
  21534. }
  21535. return property(value);
  21536. }
  21537. /**
  21538. * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
  21539. *
  21540. * @private
  21541. * @param {Object} object The object to query.
  21542. * @returns {Array} Returns the array of property names.
  21543. */
  21544. function baseKeys(object) {
  21545. if (!isPrototype(object)) {
  21546. return nativeKeys(object);
  21547. }
  21548. var result = [];
  21549. for (var key in Object(object)) {
  21550. if (hasOwnProperty.call(object, key) && key != 'constructor') {
  21551. result.push(key);
  21552. }
  21553. }
  21554. return result;
  21555. }
  21556. /**
  21557. * The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense.
  21558. *
  21559. * @private
  21560. * @param {Object} object The object to query.
  21561. * @returns {Array} Returns the array of property names.
  21562. */
  21563. function baseKeysIn(object) {
  21564. if (!isObject(object)) {
  21565. return nativeKeysIn(object);
  21566. }
  21567. var isProto = isPrototype(object),
  21568. result = [];
  21569. for (var key in object) {
  21570. if (!(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) {
  21571. result.push(key);
  21572. }
  21573. }
  21574. return result;
  21575. }
  21576. /**
  21577. * The base implementation of `_.lt` which doesn't coerce arguments.
  21578. *
  21579. * @private
  21580. * @param {*} value The value to compare.
  21581. * @param {*} other The other value to compare.
  21582. * @returns {boolean} Returns `true` if `value` is less than `other`,
  21583. * else `false`.
  21584. */
  21585. function baseLt(value, other) {
  21586. return value < other;
  21587. }
  21588. /**
  21589. * The base implementation of `_.map` without support for iteratee shorthands.
  21590. *
  21591. * @private
  21592. * @param {Array|Object} collection The collection to iterate over.
  21593. * @param {Function} iteratee The function invoked per iteration.
  21594. * @returns {Array} Returns the new mapped array.
  21595. */
  21596. function baseMap(collection, iteratee) {
  21597. var index = -1,
  21598. result = isArrayLike(collection) ? Array(collection.length) : [];
  21599. baseEach(collection, function(value, key, collection) {
  21600. result[++index] = iteratee(value, key, collection);
  21601. });
  21602. return result;
  21603. }
  21604. /**
  21605. * The base implementation of `_.matches` which doesn't clone `source`.
  21606. *
  21607. * @private
  21608. * @param {Object} source The object of property values to match.
  21609. * @returns {Function} Returns the new spec function.
  21610. */
  21611. function baseMatches(source) {
  21612. var matchData = getMatchData(source);
  21613. if (matchData.length == 1 && matchData[0][2]) {
  21614. return matchesStrictComparable(matchData[0][0], matchData[0][1]);
  21615. }
  21616. return function(object) {
  21617. return object === source || baseIsMatch(object, source, matchData);
  21618. };
  21619. }
  21620. /**
  21621. * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`.
  21622. *
  21623. * @private
  21624. * @param {string} path The path of the property to get.
  21625. * @param {*} srcValue The value to match.
  21626. * @returns {Function} Returns the new spec function.
  21627. */
  21628. function baseMatchesProperty(path, srcValue) {
  21629. if (isKey(path) && isStrictComparable(srcValue)) {
  21630. return matchesStrictComparable(toKey(path), srcValue);
  21631. }
  21632. return function(object) {
  21633. var objValue = get(object, path);
  21634. return (objValue === undefined && objValue === srcValue)
  21635. ? hasIn(object, path)
  21636. : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG);
  21637. };
  21638. }
  21639. /**
  21640. * The base implementation of `_.merge` without support for multiple sources.
  21641. *
  21642. * @private
  21643. * @param {Object} object The destination object.
  21644. * @param {Object} source The source object.
  21645. * @param {number} srcIndex The index of `source`.
  21646. * @param {Function} [customizer] The function to customize merged values.
  21647. * @param {Object} [stack] Tracks traversed source values and their merged
  21648. * counterparts.
  21649. */
  21650. function baseMerge(object, source, srcIndex, customizer, stack) {
  21651. if (object === source) {
  21652. return;
  21653. }
  21654. baseFor(source, function(srcValue, key) {
  21655. stack || (stack = new Stack);
  21656. if (isObject(srcValue)) {
  21657. baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack);
  21658. }
  21659. else {
  21660. var newValue = customizer
  21661. ? customizer(safeGet(object, key), srcValue, (key + ''), object, source, stack)
  21662. : undefined;
  21663. if (newValue === undefined) {
  21664. newValue = srcValue;
  21665. }
  21666. assignMergeValue(object, key, newValue);
  21667. }
  21668. }, keysIn);
  21669. }
  21670. /**
  21671. * A specialized version of `baseMerge` for arrays and objects which performs
  21672. * deep merges and tracks traversed objects enabling objects with circular
  21673. * references to be merged.
  21674. *
  21675. * @private
  21676. * @param {Object} object The destination object.
  21677. * @param {Object} source The source object.
  21678. * @param {string} key The key of the value to merge.
  21679. * @param {number} srcIndex The index of `source`.
  21680. * @param {Function} mergeFunc The function to merge values.
  21681. * @param {Function} [customizer] The function to customize assigned values.
  21682. * @param {Object} [stack] Tracks traversed source values and their merged
  21683. * counterparts.
  21684. */
  21685. function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) {
  21686. var objValue = safeGet(object, key),
  21687. srcValue = safeGet(source, key),
  21688. stacked = stack.get(srcValue);
  21689. if (stacked) {
  21690. assignMergeValue(object, key, stacked);
  21691. return;
  21692. }
  21693. var newValue = customizer
  21694. ? customizer(objValue, srcValue, (key + ''), object, source, stack)
  21695. : undefined;
  21696. var isCommon = newValue === undefined;
  21697. if (isCommon) {
  21698. var isArr = isArray(srcValue),
  21699. isBuff = !isArr && isBuffer(srcValue),
  21700. isTyped = !isArr && !isBuff && isTypedArray(srcValue);
  21701. newValue = srcValue;
  21702. if (isArr || isBuff || isTyped) {
  21703. if (isArray(objValue)) {
  21704. newValue = objValue;
  21705. }
  21706. else if (isArrayLikeObject(objValue)) {
  21707. newValue = copyArray(objValue);
  21708. }
  21709. else if (isBuff) {
  21710. isCommon = false;
  21711. newValue = cloneBuffer(srcValue, true);
  21712. }
  21713. else if (isTyped) {
  21714. isCommon = false;
  21715. newValue = cloneTypedArray(srcValue, true);
  21716. }
  21717. else {
  21718. newValue = [];
  21719. }
  21720. }
  21721. else if (isPlainObject(srcValue) || isArguments(srcValue)) {
  21722. newValue = objValue;
  21723. if (isArguments(objValue)) {
  21724. newValue = toPlainObject(objValue);
  21725. }
  21726. else if (!isObject(objValue) || isFunction(objValue)) {
  21727. newValue = initCloneObject(srcValue);
  21728. }
  21729. }
  21730. else {
  21731. isCommon = false;
  21732. }
  21733. }
  21734. if (isCommon) {
  21735. // Recursively merge objects and arrays (susceptible to call stack limits).
  21736. stack.set(srcValue, newValue);
  21737. mergeFunc(newValue, srcValue, srcIndex, customizer, stack);
  21738. stack['delete'](srcValue);
  21739. }
  21740. assignMergeValue(object, key, newValue);
  21741. }
  21742. /**
  21743. * The base implementation of `_.nth` which doesn't coerce arguments.
  21744. *
  21745. * @private
  21746. * @param {Array} array The array to query.
  21747. * @param {number} n The index of the element to return.
  21748. * @returns {*} Returns the nth element of `array`.
  21749. */
  21750. function baseNth(array, n) {
  21751. var length = array.length;
  21752. if (!length) {
  21753. return;
  21754. }
  21755. n += n < 0 ? length : 0;
  21756. return isIndex(n, length) ? array[n] : undefined;
  21757. }
  21758. /**
  21759. * The base implementation of `_.orderBy` without param guards.
  21760. *
  21761. * @private
  21762. * @param {Array|Object} collection The collection to iterate over.
  21763. * @param {Function[]|Object[]|string[]} iteratees The iteratees to sort by.
  21764. * @param {string[]} orders The sort orders of `iteratees`.
  21765. * @returns {Array} Returns the new sorted array.
  21766. */
  21767. function baseOrderBy(collection, iteratees, orders) {
  21768. var index = -1;
  21769. iteratees = arrayMap(iteratees.length ? iteratees : [identity], baseUnary(getIteratee()));
  21770. var result = baseMap(collection, function(value, key, collection) {
  21771. var criteria = arrayMap(iteratees, function(iteratee) {
  21772. return iteratee(value);
  21773. });
  21774. return { 'criteria': criteria, 'index': ++index, 'value': value };
  21775. });
  21776. return baseSortBy(result, function(object, other) {
  21777. return compareMultiple(object, other, orders);
  21778. });
  21779. }
  21780. /**
  21781. * The base implementation of `_.pick` without support for individual
  21782. * property identifiers.
  21783. *
  21784. * @private
  21785. * @param {Object} object The source object.
  21786. * @param {string[]} paths The property paths to pick.
  21787. * @returns {Object} Returns the new object.
  21788. */
  21789. function basePick(object, paths) {
  21790. return basePickBy(object, paths, function(value, path) {
  21791. return hasIn(object, path);
  21792. });
  21793. }
  21794. /**
  21795. * The base implementation of `_.pickBy` without support for iteratee shorthands.
  21796. *
  21797. * @private
  21798. * @param {Object} object The source object.
  21799. * @param {string[]} paths The property paths to pick.
  21800. * @param {Function} predicate The function invoked per property.
  21801. * @returns {Object} Returns the new object.
  21802. */
  21803. function basePickBy(object, paths, predicate) {
  21804. var index = -1,
  21805. length = paths.length,
  21806. result = {};
  21807. while (++index < length) {
  21808. var path = paths[index],
  21809. value = baseGet(object, path);
  21810. if (predicate(value, path)) {
  21811. baseSet(result, castPath(path, object), value);
  21812. }
  21813. }
  21814. return result;
  21815. }
  21816. /**
  21817. * A specialized version of `baseProperty` which supports deep paths.
  21818. *
  21819. * @private
  21820. * @param {Array|string} path The path of the property to get.
  21821. * @returns {Function} Returns the new accessor function.
  21822. */
  21823. function basePropertyDeep(path) {
  21824. return function(object) {
  21825. return baseGet(object, path);
  21826. };
  21827. }
  21828. /**
  21829. * The base implementation of `_.pullAllBy` without support for iteratee
  21830. * shorthands.
  21831. *
  21832. * @private
  21833. * @param {Array} array The array to modify.
  21834. * @param {Array} values The values to remove.
  21835. * @param {Function} [iteratee] The iteratee invoked per element.
  21836. * @param {Function} [comparator] The comparator invoked per element.
  21837. * @returns {Array} Returns `array`.
  21838. */
  21839. function basePullAll(array, values, iteratee, comparator) {
  21840. var indexOf = comparator ? baseIndexOfWith : baseIndexOf,
  21841. index = -1,
  21842. length = values.length,
  21843. seen = array;
  21844. if (array === values) {
  21845. values = copyArray(values);
  21846. }
  21847. if (iteratee) {
  21848. seen = arrayMap(array, baseUnary(iteratee));
  21849. }
  21850. while (++index < length) {
  21851. var fromIndex = 0,
  21852. value = values[index],
  21853. computed = iteratee ? iteratee(value) : value;
  21854. while ((fromIndex = indexOf(seen, computed, fromIndex, comparator)) > -1) {
  21855. if (seen !== array) {
  21856. splice.call(seen, fromIndex, 1);
  21857. }
  21858. splice.call(array, fromIndex, 1);
  21859. }
  21860. }
  21861. return array;
  21862. }
  21863. /**
  21864. * The base implementation of `_.pullAt` without support for individual
  21865. * indexes or capturing the removed elements.
  21866. *
  21867. * @private
  21868. * @param {Array} array The array to modify.
  21869. * @param {number[]} indexes The indexes of elements to remove.
  21870. * @returns {Array} Returns `array`.
  21871. */
  21872. function basePullAt(array, indexes) {
  21873. var length = array ? indexes.length : 0,
  21874. lastIndex = length - 1;
  21875. while (length--) {
  21876. var index = indexes[length];
  21877. if (length == lastIndex || index !== previous) {
  21878. var previous = index;
  21879. if (isIndex(index)) {
  21880. splice.call(array, index, 1);
  21881. } else {
  21882. baseUnset(array, index);
  21883. }
  21884. }
  21885. }
  21886. return array;
  21887. }
  21888. /**
  21889. * The base implementation of `_.random` without support for returning
  21890. * floating-point numbers.
  21891. *
  21892. * @private
  21893. * @param {number} lower The lower bound.
  21894. * @param {number} upper The upper bound.
  21895. * @returns {number} Returns the random number.
  21896. */
  21897. function baseRandom(lower, upper) {
  21898. return lower + nativeFloor(nativeRandom() * (upper - lower + 1));
  21899. }
  21900. /**
  21901. * The base implementation of `_.range` and `_.rangeRight` which doesn't
  21902. * coerce arguments.
  21903. *
  21904. * @private
  21905. * @param {number} start The start of the range.
  21906. * @param {number} end The end of the range.
  21907. * @param {number} step The value to increment or decrement by.
  21908. * @param {boolean} [fromRight] Specify iterating from right to left.
  21909. * @returns {Array} Returns the range of numbers.
  21910. */
  21911. function baseRange(start, end, step, fromRight) {
  21912. var index = -1,
  21913. length = nativeMax(nativeCeil((end - start) / (step || 1)), 0),
  21914. result = Array(length);
  21915. while (length--) {
  21916. result[fromRight ? length : ++index] = start;
  21917. start += step;
  21918. }
  21919. return result;
  21920. }
  21921. /**
  21922. * The base implementation of `_.repeat` which doesn't coerce arguments.
  21923. *
  21924. * @private
  21925. * @param {string} string The string to repeat.
  21926. * @param {number} n The number of times to repeat the string.
  21927. * @returns {string} Returns the repeated string.
  21928. */
  21929. function baseRepeat(string, n) {
  21930. var result = '';
  21931. if (!string || n < 1 || n > MAX_SAFE_INTEGER) {
  21932. return result;
  21933. }
  21934. // Leverage the exponentiation by squaring algorithm for a faster repeat.
  21935. // See https://en.wikipedia.org/wiki/Exponentiation_by_squaring for more details.
  21936. do {
  21937. if (n % 2) {
  21938. result += string;
  21939. }
  21940. n = nativeFloor(n / 2);
  21941. if (n) {
  21942. string += string;
  21943. }
  21944. } while (n);
  21945. return result;
  21946. }
  21947. /**
  21948. * The base implementation of `_.rest` which doesn't validate or coerce arguments.
  21949. *
  21950. * @private
  21951. * @param {Function} func The function to apply a rest parameter to.
  21952. * @param {number} [start=func.length-1] The start position of the rest parameter.
  21953. * @returns {Function} Returns the new function.
  21954. */
  21955. function baseRest(func, start) {
  21956. return setToString(overRest(func, start, identity), func + '');
  21957. }
  21958. /**
  21959. * The base implementation of `_.sample`.
  21960. *
  21961. * @private
  21962. * @param {Array|Object} collection The collection to sample.
  21963. * @returns {*} Returns the random element.
  21964. */
  21965. function baseSample(collection) {
  21966. return arraySample(values(collection));
  21967. }
  21968. /**
  21969. * The base implementation of `_.sampleSize` without param guards.
  21970. *
  21971. * @private
  21972. * @param {Array|Object} collection The collection to sample.
  21973. * @param {number} n The number of elements to sample.
  21974. * @returns {Array} Returns the random elements.
  21975. */
  21976. function baseSampleSize(collection, n) {
  21977. var array = values(collection);
  21978. return shuffleSelf(array, baseClamp(n, 0, array.length));
  21979. }
  21980. /**
  21981. * The base implementation of `_.set`.
  21982. *
  21983. * @private
  21984. * @param {Object} object The object to modify.
  21985. * @param {Array|string} path The path of the property to set.
  21986. * @param {*} value The value to set.
  21987. * @param {Function} [customizer] The function to customize path creation.
  21988. * @returns {Object} Returns `object`.
  21989. */
  21990. function baseSet(object, path, value, customizer) {
  21991. if (!isObject(object)) {
  21992. return object;
  21993. }
  21994. path = castPath(path, object);
  21995. var index = -1,
  21996. length = path.length,
  21997. lastIndex = length - 1,
  21998. nested = object;
  21999. while (nested != null && ++index < length) {
  22000. var key = toKey(path[index]),
  22001. newValue = value;
  22002. if (index != lastIndex) {
  22003. var objValue = nested[key];
  22004. newValue = customizer ? customizer(objValue, key, nested) : undefined;
  22005. if (newValue === undefined) {
  22006. newValue = isObject(objValue)
  22007. ? objValue
  22008. : (isIndex(path[index + 1]) ? [] : {});
  22009. }
  22010. }
  22011. assignValue(nested, key, newValue);
  22012. nested = nested[key];
  22013. }
  22014. return object;
  22015. }
  22016. /**
  22017. * The base implementation of `setData` without support for hot loop shorting.
  22018. *
  22019. * @private
  22020. * @param {Function} func The function to associate metadata with.
  22021. * @param {*} data The metadata.
  22022. * @returns {Function} Returns `func`.
  22023. */
  22024. var baseSetData = !metaMap ? identity : function(func, data) {
  22025. metaMap.set(func, data);
  22026. return func;
  22027. };
  22028. /**
  22029. * The base implementation of `setToString` without support for hot loop shorting.
  22030. *
  22031. * @private
  22032. * @param {Function} func The function to modify.
  22033. * @param {Function} string The `toString` result.
  22034. * @returns {Function} Returns `func`.
  22035. */
  22036. var baseSetToString = !defineProperty ? identity : function(func, string) {
  22037. return defineProperty(func, 'toString', {
  22038. 'configurable': true,
  22039. 'enumerable': false,
  22040. 'value': constant(string),
  22041. 'writable': true
  22042. });
  22043. };
  22044. /**
  22045. * The base implementation of `_.shuffle`.
  22046. *
  22047. * @private
  22048. * @param {Array|Object} collection The collection to shuffle.
  22049. * @returns {Array} Returns the new shuffled array.
  22050. */
  22051. function baseShuffle(collection) {
  22052. return shuffleSelf(values(collection));
  22053. }
  22054. /**
  22055. * The base implementation of `_.slice` without an iteratee call guard.
  22056. *
  22057. * @private
  22058. * @param {Array} array The array to slice.
  22059. * @param {number} [start=0] The start position.
  22060. * @param {number} [end=array.length] The end position.
  22061. * @returns {Array} Returns the slice of `array`.
  22062. */
  22063. function baseSlice(array, start, end) {
  22064. var index = -1,
  22065. length = array.length;
  22066. if (start < 0) {
  22067. start = -start > length ? 0 : (length + start);
  22068. }
  22069. end = end > length ? length : end;
  22070. if (end < 0) {
  22071. end += length;
  22072. }
  22073. length = start > end ? 0 : ((end - start) >>> 0);
  22074. start >>>= 0;
  22075. var result = Array(length);
  22076. while (++index < length) {
  22077. result[index] = array[index + start];
  22078. }
  22079. return result;
  22080. }
  22081. /**
  22082. * The base implementation of `_.some` without support for iteratee shorthands.
  22083. *
  22084. * @private
  22085. * @param {Array|Object} collection The collection to iterate over.
  22086. * @param {Function} predicate The function invoked per iteration.
  22087. * @returns {boolean} Returns `true` if any element passes the predicate check,
  22088. * else `false`.
  22089. */
  22090. function baseSome(collection, predicate) {
  22091. var result;
  22092. baseEach(collection, function(value, index, collection) {
  22093. result = predicate(value, index, collection);
  22094. return !result;
  22095. });
  22096. return !!result;
  22097. }
  22098. /**
  22099. * The base implementation of `_.sortedIndex` and `_.sortedLastIndex` which
  22100. * performs a binary search of `array` to determine the index at which `value`
  22101. * should be inserted into `array` in order to maintain its sort order.
  22102. *
  22103. * @private
  22104. * @param {Array} array The sorted array to inspect.
  22105. * @param {*} value The value to evaluate.
  22106. * @param {boolean} [retHighest] Specify returning the highest qualified index.
  22107. * @returns {number} Returns the index at which `value` should be inserted
  22108. * into `array`.
  22109. */
  22110. function baseSortedIndex(array, value, retHighest) {
  22111. var low = 0,
  22112. high = array == null ? low : array.length;
  22113. if (typeof value == 'number' && value === value && high <= HALF_MAX_ARRAY_LENGTH) {
  22114. while (low < high) {
  22115. var mid = (low + high) >>> 1,
  22116. computed = array[mid];
  22117. if (computed !== null && !isSymbol(computed) &&
  22118. (retHighest ? (computed <= value) : (computed < value))) {
  22119. low = mid + 1;
  22120. } else {
  22121. high = mid;
  22122. }
  22123. }
  22124. return high;
  22125. }
  22126. return baseSortedIndexBy(array, value, identity, retHighest);
  22127. }
  22128. /**
  22129. * The base implementation of `_.sortedIndexBy` and `_.sortedLastIndexBy`
  22130. * which invokes `iteratee` for `value` and each element of `array` to compute
  22131. * their sort ranking. The iteratee is invoked with one argument; (value).
  22132. *
  22133. * @private
  22134. * @param {Array} array The sorted array to inspect.
  22135. * @param {*} value The value to evaluate.
  22136. * @param {Function} iteratee The iteratee invoked per element.
  22137. * @param {boolean} [retHighest] Specify returning the highest qualified index.
  22138. * @returns {number} Returns the index at which `value` should be inserted
  22139. * into `array`.
  22140. */
  22141. function baseSortedIndexBy(array, value, iteratee, retHighest) {
  22142. value = iteratee(value);
  22143. var low = 0,
  22144. high = array == null ? 0 : array.length,
  22145. valIsNaN = value !== value,
  22146. valIsNull = value === null,
  22147. valIsSymbol = isSymbol(value),
  22148. valIsUndefined = value === undefined;
  22149. while (low < high) {
  22150. var mid = nativeFloor((low + high) / 2),
  22151. computed = iteratee(array[mid]),
  22152. othIsDefined = computed !== undefined,
  22153. othIsNull = computed === null,
  22154. othIsReflexive = computed === computed,
  22155. othIsSymbol = isSymbol(computed);
  22156. if (valIsNaN) {
  22157. var setLow = retHighest || othIsReflexive;
  22158. } else if (valIsUndefined) {
  22159. setLow = othIsReflexive && (retHighest || othIsDefined);
  22160. } else if (valIsNull) {
  22161. setLow = othIsReflexive && othIsDefined && (retHighest || !othIsNull);
  22162. } else if (valIsSymbol) {
  22163. setLow = othIsReflexive && othIsDefined && !othIsNull && (retHighest || !othIsSymbol);
  22164. } else if (othIsNull || othIsSymbol) {
  22165. setLow = false;
  22166. } else {
  22167. setLow = retHighest ? (computed <= value) : (computed < value);
  22168. }
  22169. if (setLow) {
  22170. low = mid + 1;
  22171. } else {
  22172. high = mid;
  22173. }
  22174. }
  22175. return nativeMin(high, MAX_ARRAY_INDEX);
  22176. }
  22177. /**
  22178. * The base implementation of `_.sortedUniq` and `_.sortedUniqBy` without
  22179. * support for iteratee shorthands.
  22180. *
  22181. * @private
  22182. * @param {Array} array The array to inspect.
  22183. * @param {Function} [iteratee] The iteratee invoked per element.
  22184. * @returns {Array} Returns the new duplicate free array.
  22185. */
  22186. function baseSortedUniq(array, iteratee) {
  22187. var index = -1,
  22188. length = array.length,
  22189. resIndex = 0,
  22190. result = [];
  22191. while (++index < length) {
  22192. var value = array[index],
  22193. computed = iteratee ? iteratee(value) : value;
  22194. if (!index || !eq(computed, seen)) {
  22195. var seen = computed;
  22196. result[resIndex++] = value === 0 ? 0 : value;
  22197. }
  22198. }
  22199. return result;
  22200. }
  22201. /**
  22202. * The base implementation of `_.toNumber` which doesn't ensure correct
  22203. * conversions of binary, hexadecimal, or octal string values.
  22204. *
  22205. * @private
  22206. * @param {*} value The value to process.
  22207. * @returns {number} Returns the number.
  22208. */
  22209. function baseToNumber(value) {
  22210. if (typeof value == 'number') {
  22211. return value;
  22212. }
  22213. if (isSymbol(value)) {
  22214. return NAN;
  22215. }
  22216. return +value;
  22217. }
  22218. /**
  22219. * The base implementation of `_.toString` which doesn't convert nullish
  22220. * values to empty strings.
  22221. *
  22222. * @private
  22223. * @param {*} value The value to process.
  22224. * @returns {string} Returns the string.
  22225. */
  22226. function baseToString(value) {
  22227. // Exit early for strings to avoid a performance hit in some environments.
  22228. if (typeof value == 'string') {
  22229. return value;
  22230. }
  22231. if (isArray(value)) {
  22232. // Recursively convert values (susceptible to call stack limits).
  22233. return arrayMap(value, baseToString) + '';
  22234. }
  22235. if (isSymbol(value)) {
  22236. return symbolToString ? symbolToString.call(value) : '';
  22237. }
  22238. var result = (value + '');
  22239. return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
  22240. }
  22241. /**
  22242. * The base implementation of `_.uniqBy` without support for iteratee shorthands.
  22243. *
  22244. * @private
  22245. * @param {Array} array The array to inspect.
  22246. * @param {Function} [iteratee] The iteratee invoked per element.
  22247. * @param {Function} [comparator] The comparator invoked per element.
  22248. * @returns {Array} Returns the new duplicate free array.
  22249. */
  22250. function baseUniq(array, iteratee, comparator) {
  22251. var index = -1,
  22252. includes = arrayIncludes,
  22253. length = array.length,
  22254. isCommon = true,
  22255. result = [],
  22256. seen = result;
  22257. if (comparator) {
  22258. isCommon = false;
  22259. includes = arrayIncludesWith;
  22260. }
  22261. else if (length >= LARGE_ARRAY_SIZE) {
  22262. var set = iteratee ? null : createSet(array);
  22263. if (set) {
  22264. return setToArray(set);
  22265. }
  22266. isCommon = false;
  22267. includes = cacheHas;
  22268. seen = new SetCache;
  22269. }
  22270. else {
  22271. seen = iteratee ? [] : result;
  22272. }
  22273. outer:
  22274. while (++index < length) {
  22275. var value = array[index],
  22276. computed = iteratee ? iteratee(value) : value;
  22277. value = (comparator || value !== 0) ? value : 0;
  22278. if (isCommon && computed === computed) {
  22279. var seenIndex = seen.length;
  22280. while (seenIndex--) {
  22281. if (seen[seenIndex] === computed) {
  22282. continue outer;
  22283. }
  22284. }
  22285. if (iteratee) {
  22286. seen.push(computed);
  22287. }
  22288. result.push(value);
  22289. }
  22290. else if (!includes(seen, computed, comparator)) {
  22291. if (seen !== result) {
  22292. seen.push(computed);
  22293. }
  22294. result.push(value);
  22295. }
  22296. }
  22297. return result;
  22298. }
  22299. /**
  22300. * The base implementation of `_.unset`.
  22301. *
  22302. * @private
  22303. * @param {Object} object The object to modify.
  22304. * @param {Array|string} path The property path to unset.
  22305. * @returns {boolean} Returns `true` if the property is deleted, else `false`.
  22306. */
  22307. function baseUnset(object, path) {
  22308. path = castPath(path, object);
  22309. object = parent(object, path);
  22310. return object == null || delete object[toKey(last(path))];
  22311. }
  22312. /**
  22313. * The base implementation of `_.update`.
  22314. *
  22315. * @private
  22316. * @param {Object} object The object to modify.
  22317. * @param {Array|string} path The path of the property to update.
  22318. * @param {Function} updater The function to produce the updated value.
  22319. * @param {Function} [customizer] The function to customize path creation.
  22320. * @returns {Object} Returns `object`.
  22321. */
  22322. function baseUpdate(object, path, updater, customizer) {
  22323. return baseSet(object, path, updater(baseGet(object, path)), customizer);
  22324. }
  22325. /**
  22326. * The base implementation of methods like `_.dropWhile` and `_.takeWhile`
  22327. * without support for iteratee shorthands.
  22328. *
  22329. * @private
  22330. * @param {Array} array The array to query.
  22331. * @param {Function} predicate The function invoked per iteration.
  22332. * @param {boolean} [isDrop] Specify dropping elements instead of taking them.
  22333. * @param {boolean} [fromRight] Specify iterating from right to left.
  22334. * @returns {Array} Returns the slice of `array`.
  22335. */
  22336. function baseWhile(array, predicate, isDrop, fromRight) {
  22337. var length = array.length,
  22338. index = fromRight ? length : -1;
  22339. while ((fromRight ? index-- : ++index < length) &&
  22340. predicate(array[index], index, array)) {}
  22341. return isDrop
  22342. ? baseSlice(array, (fromRight ? 0 : index), (fromRight ? index + 1 : length))
  22343. : baseSlice(array, (fromRight ? index + 1 : 0), (fromRight ? length : index));
  22344. }
  22345. /**
  22346. * The base implementation of `wrapperValue` which returns the result of
  22347. * performing a sequence of actions on the unwrapped `value`, where each
  22348. * successive action is supplied the return value of the previous.
  22349. *
  22350. * @private
  22351. * @param {*} value The unwrapped value.
  22352. * @param {Array} actions Actions to perform to resolve the unwrapped value.
  22353. * @returns {*} Returns the resolved value.
  22354. */
  22355. function baseWrapperValue(value, actions) {
  22356. var result = value;
  22357. if (result instanceof LazyWrapper) {
  22358. result = result.value();
  22359. }
  22360. return arrayReduce(actions, function(result, action) {
  22361. return action.func.apply(action.thisArg, arrayPush([result], action.args));
  22362. }, result);
  22363. }
  22364. /**
  22365. * The base implementation of methods like `_.xor`, without support for
  22366. * iteratee shorthands, that accepts an array of arrays to inspect.
  22367. *
  22368. * @private
  22369. * @param {Array} arrays The arrays to inspect.
  22370. * @param {Function} [iteratee] The iteratee invoked per element.
  22371. * @param {Function} [comparator] The comparator invoked per element.
  22372. * @returns {Array} Returns the new array of values.
  22373. */
  22374. function baseXor(arrays, iteratee, comparator) {
  22375. var length = arrays.length;
  22376. if (length < 2) {
  22377. return length ? baseUniq(arrays[0]) : [];
  22378. }
  22379. var index = -1,
  22380. result = Array(length);
  22381. while (++index < length) {
  22382. var array = arrays[index],
  22383. othIndex = -1;
  22384. while (++othIndex < length) {
  22385. if (othIndex != index) {
  22386. result[index] = baseDifference(result[index] || array, arrays[othIndex], iteratee, comparator);
  22387. }
  22388. }
  22389. }
  22390. return baseUniq(baseFlatten(result, 1), iteratee, comparator);
  22391. }
  22392. /**
  22393. * This base implementation of `_.zipObject` which assigns values using `assignFunc`.
  22394. *
  22395. * @private
  22396. * @param {Array} props The property identifiers.
  22397. * @param {Array} values The property values.
  22398. * @param {Function} assignFunc The function to assign values.
  22399. * @returns {Object} Returns the new object.
  22400. */
  22401. function baseZipObject(props, values, assignFunc) {
  22402. var index = -1,
  22403. length = props.length,
  22404. valsLength = values.length,
  22405. result = {};
  22406. while (++index < length) {
  22407. var value = index < valsLength ? values[index] : undefined;
  22408. assignFunc(result, props[index], value);
  22409. }
  22410. return result;
  22411. }
  22412. /**
  22413. * Casts `value` to an empty array if it's not an array like object.
  22414. *
  22415. * @private
  22416. * @param {*} value The value to inspect.
  22417. * @returns {Array|Object} Returns the cast array-like object.
  22418. */
  22419. function castArrayLikeObject(value) {
  22420. return isArrayLikeObject(value) ? value : [];
  22421. }
  22422. /**
  22423. * Casts `value` to `identity` if it's not a function.
  22424. *
  22425. * @private
  22426. * @param {*} value The value to inspect.
  22427. * @returns {Function} Returns cast function.
  22428. */
  22429. function castFunction(value) {
  22430. return typeof value == 'function' ? value : identity;
  22431. }
  22432. /**
  22433. * Casts `value` to a path array if it's not one.
  22434. *
  22435. * @private
  22436. * @param {*} value The value to inspect.
  22437. * @param {Object} [object] The object to query keys on.
  22438. * @returns {Array} Returns the cast property path array.
  22439. */
  22440. function castPath(value, object) {
  22441. if (isArray(value)) {
  22442. return value;
  22443. }
  22444. return isKey(value, object) ? [value] : stringToPath(toString(value));
  22445. }
  22446. /**
  22447. * A `baseRest` alias which can be replaced with `identity` by module
  22448. * replacement plugins.
  22449. *
  22450. * @private
  22451. * @type {Function}
  22452. * @param {Function} func The function to apply a rest parameter to.
  22453. * @returns {Function} Returns the new function.
  22454. */
  22455. var castRest = baseRest;
  22456. /**
  22457. * Casts `array` to a slice if it's needed.
  22458. *
  22459. * @private
  22460. * @param {Array} array The array to inspect.
  22461. * @param {number} start The start position.
  22462. * @param {number} [end=array.length] The end position.
  22463. * @returns {Array} Returns the cast slice.
  22464. */
  22465. function castSlice(array, start, end) {
  22466. var length = array.length;
  22467. end = end === undefined ? length : end;
  22468. return (!start && end >= length) ? array : baseSlice(array, start, end);
  22469. }
  22470. /**
  22471. * A simple wrapper around the global [`clearTimeout`](https://mdn.io/clearTimeout).
  22472. *
  22473. * @private
  22474. * @param {number|Object} id The timer id or timeout object of the timer to clear.
  22475. */
  22476. var clearTimeout = ctxClearTimeout || function(id) {
  22477. return root.clearTimeout(id);
  22478. };
  22479. /**
  22480. * Creates a clone of `buffer`.
  22481. *
  22482. * @private
  22483. * @param {Buffer} buffer The buffer to clone.
  22484. * @param {boolean} [isDeep] Specify a deep clone.
  22485. * @returns {Buffer} Returns the cloned buffer.
  22486. */
  22487. function cloneBuffer(buffer, isDeep) {
  22488. if (isDeep) {
  22489. return buffer.slice();
  22490. }
  22491. var length = buffer.length,
  22492. result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);
  22493. buffer.copy(result);
  22494. return result;
  22495. }
  22496. /**
  22497. * Creates a clone of `arrayBuffer`.
  22498. *
  22499. * @private
  22500. * @param {ArrayBuffer} arrayBuffer The array buffer to clone.
  22501. * @returns {ArrayBuffer} Returns the cloned array buffer.
  22502. */
  22503. function cloneArrayBuffer(arrayBuffer) {
  22504. var result = new arrayBuffer.constructor(arrayBuffer.byteLength);
  22505. new Uint8Array(result).set(new Uint8Array(arrayBuffer));
  22506. return result;
  22507. }
  22508. /**
  22509. * Creates a clone of `dataView`.
  22510. *
  22511. * @private
  22512. * @param {Object} dataView The data view to clone.
  22513. * @param {boolean} [isDeep] Specify a deep clone.
  22514. * @returns {Object} Returns the cloned data view.
  22515. */
  22516. function cloneDataView(dataView, isDeep) {
  22517. var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer;
  22518. return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);
  22519. }
  22520. /**
  22521. * Creates a clone of `regexp`.
  22522. *
  22523. * @private
  22524. * @param {Object} regexp The regexp to clone.
  22525. * @returns {Object} Returns the cloned regexp.
  22526. */
  22527. function cloneRegExp(regexp) {
  22528. var result = new regexp.constructor(regexp.source, reFlags.exec(regexp));
  22529. result.lastIndex = regexp.lastIndex;
  22530. return result;
  22531. }
  22532. /**
  22533. * Creates a clone of the `symbol` object.
  22534. *
  22535. * @private
  22536. * @param {Object} symbol The symbol object to clone.
  22537. * @returns {Object} Returns the cloned symbol object.
  22538. */
  22539. function cloneSymbol(symbol) {
  22540. return symbolValueOf ? Object(symbolValueOf.call(symbol)) : {};
  22541. }
  22542. /**
  22543. * Creates a clone of `typedArray`.
  22544. *
  22545. * @private
  22546. * @param {Object} typedArray The typed array to clone.
  22547. * @param {boolean} [isDeep] Specify a deep clone.
  22548. * @returns {Object} Returns the cloned typed array.
  22549. */
  22550. function cloneTypedArray(typedArray, isDeep) {
  22551. var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;
  22552. return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
  22553. }
  22554. /**
  22555. * Compares values to sort them in ascending order.
  22556. *
  22557. * @private
  22558. * @param {*} value The value to compare.
  22559. * @param {*} other The other value to compare.
  22560. * @returns {number} Returns the sort order indicator for `value`.
  22561. */
  22562. function compareAscending(value, other) {
  22563. if (value !== other) {
  22564. var valIsDefined = value !== undefined,
  22565. valIsNull = value === null,
  22566. valIsReflexive = value === value,
  22567. valIsSymbol = isSymbol(value);
  22568. var othIsDefined = other !== undefined,
  22569. othIsNull = other === null,
  22570. othIsReflexive = other === other,
  22571. othIsSymbol = isSymbol(other);
  22572. if ((!othIsNull && !othIsSymbol && !valIsSymbol && value > other) ||
  22573. (valIsSymbol && othIsDefined && othIsReflexive && !othIsNull && !othIsSymbol) ||
  22574. (valIsNull && othIsDefined && othIsReflexive) ||
  22575. (!valIsDefined && othIsReflexive) ||
  22576. !valIsReflexive) {
  22577. return 1;
  22578. }
  22579. if ((!valIsNull && !valIsSymbol && !othIsSymbol && value < other) ||
  22580. (othIsSymbol && valIsDefined && valIsReflexive && !valIsNull && !valIsSymbol) ||
  22581. (othIsNull && valIsDefined && valIsReflexive) ||
  22582. (!othIsDefined && valIsReflexive) ||
  22583. !othIsReflexive) {
  22584. return -1;
  22585. }
  22586. }
  22587. return 0;
  22588. }
  22589. /**
  22590. * Used by `_.orderBy` to compare multiple properties of a value to another
  22591. * and stable sort them.
  22592. *
  22593. * If `orders` is unspecified, all values are sorted in ascending order. Otherwise,
  22594. * specify an order of "desc" for descending or "asc" for ascending sort order
  22595. * of corresponding values.
  22596. *
  22597. * @private
  22598. * @param {Object} object The object to compare.
  22599. * @param {Object} other The other object to compare.
  22600. * @param {boolean[]|string[]} orders The order to sort by for each property.
  22601. * @returns {number} Returns the sort order indicator for `object`.
  22602. */
  22603. function compareMultiple(object, other, orders) {
  22604. var index = -1,
  22605. objCriteria = object.criteria,
  22606. othCriteria = other.criteria,
  22607. length = objCriteria.length,
  22608. ordersLength = orders.length;
  22609. while (++index < length) {
  22610. var result = compareAscending(objCriteria[index], othCriteria[index]);
  22611. if (result) {
  22612. if (index >= ordersLength) {
  22613. return result;
  22614. }
  22615. var order = orders[index];
  22616. return result * (order == 'desc' ? -1 : 1);
  22617. }
  22618. }
  22619. // Fixes an `Array#sort` bug in the JS engine embedded in Adobe applications
  22620. // that causes it, under certain circumstances, to provide the same value for
  22621. // `object` and `other`. See https://github.com/jashkenas/underscore/pull/1247
  22622. // for more details.
  22623. //
  22624. // This also ensures a stable sort in V8 and other engines.
  22625. // See https://bugs.chromium.org/p/v8/issues/detail?id=90 for more details.
  22626. return object.index - other.index;
  22627. }
  22628. /**
  22629. * Creates an array that is the composition of partially applied arguments,
  22630. * placeholders, and provided arguments into a single array of arguments.
  22631. *
  22632. * @private
  22633. * @param {Array} args The provided arguments.
  22634. * @param {Array} partials The arguments to prepend to those provided.
  22635. * @param {Array} holders The `partials` placeholder indexes.
  22636. * @params {boolean} [isCurried] Specify composing for a curried function.
  22637. * @returns {Array} Returns the new array of composed arguments.
  22638. */
  22639. function composeArgs(args, partials, holders, isCurried) {
  22640. var argsIndex = -1,
  22641. argsLength = args.length,
  22642. holdersLength = holders.length,
  22643. leftIndex = -1,
  22644. leftLength = partials.length,
  22645. rangeLength = nativeMax(argsLength - holdersLength, 0),
  22646. result = Array(leftLength + rangeLength),
  22647. isUncurried = !isCurried;
  22648. while (++leftIndex < leftLength) {
  22649. result[leftIndex] = partials[leftIndex];
  22650. }
  22651. while (++argsIndex < holdersLength) {
  22652. if (isUncurried || argsIndex < argsLength) {
  22653. result[holders[argsIndex]] = args[argsIndex];
  22654. }
  22655. }
  22656. while (rangeLength--) {
  22657. result[leftIndex++] = args[argsIndex++];
  22658. }
  22659. return result;
  22660. }
  22661. /**
  22662. * This function is like `composeArgs` except that the arguments composition
  22663. * is tailored for `_.partialRight`.
  22664. *
  22665. * @private
  22666. * @param {Array} args The provided arguments.
  22667. * @param {Array} partials The arguments to append to those provided.
  22668. * @param {Array} holders The `partials` placeholder indexes.
  22669. * @params {boolean} [isCurried] Specify composing for a curried function.
  22670. * @returns {Array} Returns the new array of composed arguments.
  22671. */
  22672. function composeArgsRight(args, partials, holders, isCurried) {
  22673. var argsIndex = -1,
  22674. argsLength = args.length,
  22675. holdersIndex = -1,
  22676. holdersLength = holders.length,
  22677. rightIndex = -1,
  22678. rightLength = partials.length,
  22679. rangeLength = nativeMax(argsLength - holdersLength, 0),
  22680. result = Array(rangeLength + rightLength),
  22681. isUncurried = !isCurried;
  22682. while (++argsIndex < rangeLength) {
  22683. result[argsIndex] = args[argsIndex];
  22684. }
  22685. var offset = argsIndex;
  22686. while (++rightIndex < rightLength) {
  22687. result[offset + rightIndex] = partials[rightIndex];
  22688. }
  22689. while (++holdersIndex < holdersLength) {
  22690. if (isUncurried || argsIndex < argsLength) {
  22691. result[offset + holders[holdersIndex]] = args[argsIndex++];
  22692. }
  22693. }
  22694. return result;
  22695. }
  22696. /**
  22697. * Copies the values of `source` to `array`.
  22698. *
  22699. * @private
  22700. * @param {Array} source The array to copy values from.
  22701. * @param {Array} [array=[]] The array to copy values to.
  22702. * @returns {Array} Returns `array`.
  22703. */
  22704. function copyArray(source, array) {
  22705. var index = -1,
  22706. length = source.length;
  22707. array || (array = Array(length));
  22708. while (++index < length) {
  22709. array[index] = source[index];
  22710. }
  22711. return array;
  22712. }
  22713. /**
  22714. * Copies properties of `source` to `object`.
  22715. *
  22716. * @private
  22717. * @param {Object} source The object to copy properties from.
  22718. * @param {Array} props The property identifiers to copy.
  22719. * @param {Object} [object={}] The object to copy properties to.
  22720. * @param {Function} [customizer] The function to customize copied values.
  22721. * @returns {Object} Returns `object`.
  22722. */
  22723. function copyObject(source, props, object, customizer) {
  22724. var isNew = !object;
  22725. object || (object = {});
  22726. var index = -1,
  22727. length = props.length;
  22728. while (++index < length) {
  22729. var key = props[index];
  22730. var newValue = customizer
  22731. ? customizer(object[key], source[key], key, object, source)
  22732. : undefined;
  22733. if (newValue === undefined) {
  22734. newValue = source[key];
  22735. }
  22736. if (isNew) {
  22737. baseAssignValue(object, key, newValue);
  22738. } else {
  22739. assignValue(object, key, newValue);
  22740. }
  22741. }
  22742. return object;
  22743. }
  22744. /**
  22745. * Copies own symbols of `source` to `object`.
  22746. *
  22747. * @private
  22748. * @param {Object} source The object to copy symbols from.
  22749. * @param {Object} [object={}] The object to copy symbols to.
  22750. * @returns {Object} Returns `object`.
  22751. */
  22752. function copySymbols(source, object) {
  22753. return copyObject(source, getSymbols(source), object);
  22754. }
  22755. /**
  22756. * Copies own and inherited symbols of `source` to `object`.
  22757. *
  22758. * @private
  22759. * @param {Object} source The object to copy symbols from.
  22760. * @param {Object} [object={}] The object to copy symbols to.
  22761. * @returns {Object} Returns `object`.
  22762. */
  22763. function copySymbolsIn(source, object) {
  22764. return copyObject(source, getSymbolsIn(source), object);
  22765. }
  22766. /**
  22767. * Creates a function like `_.groupBy`.
  22768. *
  22769. * @private
  22770. * @param {Function} setter The function to set accumulator values.
  22771. * @param {Function} [initializer] The accumulator object initializer.
  22772. * @returns {Function} Returns the new aggregator function.
  22773. */
  22774. function createAggregator(setter, initializer) {
  22775. return function(collection, iteratee) {
  22776. var func = isArray(collection) ? arrayAggregator : baseAggregator,
  22777. accumulator = initializer ? initializer() : {};
  22778. return func(collection, setter, getIteratee(iteratee, 2), accumulator);
  22779. };
  22780. }
  22781. /**
  22782. * Creates a function like `_.assign`.
  22783. *
  22784. * @private
  22785. * @param {Function} assigner The function to assign values.
  22786. * @returns {Function} Returns the new assigner function.
  22787. */
  22788. function createAssigner(assigner) {
  22789. return baseRest(function(object, sources) {
  22790. var index = -1,
  22791. length = sources.length,
  22792. customizer = length > 1 ? sources[length - 1] : undefined,
  22793. guard = length > 2 ? sources[2] : undefined;
  22794. customizer = (assigner.length > 3 && typeof customizer == 'function')
  22795. ? (length--, customizer)
  22796. : undefined;
  22797. if (guard && isIterateeCall(sources[0], sources[1], guard)) {
  22798. customizer = length < 3 ? undefined : customizer;
  22799. length = 1;
  22800. }
  22801. object = Object(object);
  22802. while (++index < length) {
  22803. var source = sources[index];
  22804. if (source) {
  22805. assigner(object, source, index, customizer);
  22806. }
  22807. }
  22808. return object;
  22809. });
  22810. }
  22811. /**
  22812. * Creates a `baseEach` or `baseEachRight` function.
  22813. *
  22814. * @private
  22815. * @param {Function} eachFunc The function to iterate over a collection.
  22816. * @param {boolean} [fromRight] Specify iterating from right to left.
  22817. * @returns {Function} Returns the new base function.
  22818. */
  22819. function createBaseEach(eachFunc, fromRight) {
  22820. return function(collection, iteratee) {
  22821. if (collection == null) {
  22822. return collection;
  22823. }
  22824. if (!isArrayLike(collection)) {
  22825. return eachFunc(collection, iteratee);
  22826. }
  22827. var length = collection.length,
  22828. index = fromRight ? length : -1,
  22829. iterable = Object(collection);
  22830. while ((fromRight ? index-- : ++index < length)) {
  22831. if (iteratee(iterable[index], index, iterable) === false) {
  22832. break;
  22833. }
  22834. }
  22835. return collection;
  22836. };
  22837. }
  22838. /**
  22839. * Creates a base function for methods like `_.forIn` and `_.forOwn`.
  22840. *
  22841. * @private
  22842. * @param {boolean} [fromRight] Specify iterating from right to left.
  22843. * @returns {Function} Returns the new base function.
  22844. */
  22845. function createBaseFor(fromRight) {
  22846. return function(object, iteratee, keysFunc) {
  22847. var index = -1,
  22848. iterable = Object(object),
  22849. props = keysFunc(object),
  22850. length = props.length;
  22851. while (length--) {
  22852. var key = props[fromRight ? length : ++index];
  22853. if (iteratee(iterable[key], key, iterable) === false) {
  22854. break;
  22855. }
  22856. }
  22857. return object;
  22858. };
  22859. }
  22860. /**
  22861. * Creates a function that wraps `func` to invoke it with the optional `this`
  22862. * binding of `thisArg`.
  22863. *
  22864. * @private
  22865. * @param {Function} func The function to wrap.
  22866. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  22867. * @param {*} [thisArg] The `this` binding of `func`.
  22868. * @returns {Function} Returns the new wrapped function.
  22869. */
  22870. function createBind(func, bitmask, thisArg) {
  22871. var isBind = bitmask & WRAP_BIND_FLAG,
  22872. Ctor = createCtor(func);
  22873. function wrapper() {
  22874. var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
  22875. return fn.apply(isBind ? thisArg : this, arguments);
  22876. }
  22877. return wrapper;
  22878. }
  22879. /**
  22880. * Creates a function like `_.lowerFirst`.
  22881. *
  22882. * @private
  22883. * @param {string} methodName The name of the `String` case method to use.
  22884. * @returns {Function} Returns the new case function.
  22885. */
  22886. function createCaseFirst(methodName) {
  22887. return function(string) {
  22888. string = toString(string);
  22889. var strSymbols = hasUnicode(string)
  22890. ? stringToArray(string)
  22891. : undefined;
  22892. var chr = strSymbols
  22893. ? strSymbols[0]
  22894. : string.charAt(0);
  22895. var trailing = strSymbols
  22896. ? castSlice(strSymbols, 1).join('')
  22897. : string.slice(1);
  22898. return chr[methodName]() + trailing;
  22899. };
  22900. }
  22901. /**
  22902. * Creates a function like `_.camelCase`.
  22903. *
  22904. * @private
  22905. * @param {Function} callback The function to combine each word.
  22906. * @returns {Function} Returns the new compounder function.
  22907. */
  22908. function createCompounder(callback) {
  22909. return function(string) {
  22910. return arrayReduce(words(deburr(string).replace(reApos, '')), callback, '');
  22911. };
  22912. }
  22913. /**
  22914. * Creates a function that produces an instance of `Ctor` regardless of
  22915. * whether it was invoked as part of a `new` expression or by `call` or `apply`.
  22916. *
  22917. * @private
  22918. * @param {Function} Ctor The constructor to wrap.
  22919. * @returns {Function} Returns the new wrapped function.
  22920. */
  22921. function createCtor(Ctor) {
  22922. return function() {
  22923. // Use a `switch` statement to work with class constructors. See
  22924. // http://ecma-international.org/ecma-262/7.0/#sec-ecmascript-function-objects-call-thisargument-argumentslist
  22925. // for more details.
  22926. var args = arguments;
  22927. switch (args.length) {
  22928. case 0: return new Ctor;
  22929. case 1: return new Ctor(args[0]);
  22930. case 2: return new Ctor(args[0], args[1]);
  22931. case 3: return new Ctor(args[0], args[1], args[2]);
  22932. case 4: return new Ctor(args[0], args[1], args[2], args[3]);
  22933. case 5: return new Ctor(args[0], args[1], args[2], args[3], args[4]);
  22934. case 6: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5]);
  22935. case 7: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5], args[6]);
  22936. }
  22937. var thisBinding = baseCreate(Ctor.prototype),
  22938. result = Ctor.apply(thisBinding, args);
  22939. // Mimic the constructor's `return` behavior.
  22940. // See https://es5.github.io/#x13.2.2 for more details.
  22941. return isObject(result) ? result : thisBinding;
  22942. };
  22943. }
  22944. /**
  22945. * Creates a function that wraps `func` to enable currying.
  22946. *
  22947. * @private
  22948. * @param {Function} func The function to wrap.
  22949. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  22950. * @param {number} arity The arity of `func`.
  22951. * @returns {Function} Returns the new wrapped function.
  22952. */
  22953. function createCurry(func, bitmask, arity) {
  22954. var Ctor = createCtor(func);
  22955. function wrapper() {
  22956. var length = arguments.length,
  22957. args = Array(length),
  22958. index = length,
  22959. placeholder = getHolder(wrapper);
  22960. while (index--) {
  22961. args[index] = arguments[index];
  22962. }
  22963. var holders = (length < 3 && args[0] !== placeholder && args[length - 1] !== placeholder)
  22964. ? []
  22965. : replaceHolders(args, placeholder);
  22966. length -= holders.length;
  22967. if (length < arity) {
  22968. return createRecurry(
  22969. func, bitmask, createHybrid, wrapper.placeholder, undefined,
  22970. args, holders, undefined, undefined, arity - length);
  22971. }
  22972. var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
  22973. return apply(fn, this, args);
  22974. }
  22975. return wrapper;
  22976. }
  22977. /**
  22978. * Creates a `_.find` or `_.findLast` function.
  22979. *
  22980. * @private
  22981. * @param {Function} findIndexFunc The function to find the collection index.
  22982. * @returns {Function} Returns the new find function.
  22983. */
  22984. function createFind(findIndexFunc) {
  22985. return function(collection, predicate, fromIndex) {
  22986. var iterable = Object(collection);
  22987. if (!isArrayLike(collection)) {
  22988. var iteratee = getIteratee(predicate, 3);
  22989. collection = keys(collection);
  22990. predicate = function(key) { return iteratee(iterable[key], key, iterable); };
  22991. }
  22992. var index = findIndexFunc(collection, predicate, fromIndex);
  22993. return index > -1 ? iterable[iteratee ? collection[index] : index] : undefined;
  22994. };
  22995. }
  22996. /**
  22997. * Creates a `_.flow` or `_.flowRight` function.
  22998. *
  22999. * @private
  23000. * @param {boolean} [fromRight] Specify iterating from right to left.
  23001. * @returns {Function} Returns the new flow function.
  23002. */
  23003. function createFlow(fromRight) {
  23004. return flatRest(function(funcs) {
  23005. var length = funcs.length,
  23006. index = length,
  23007. prereq = LodashWrapper.prototype.thru;
  23008. if (fromRight) {
  23009. funcs.reverse();
  23010. }
  23011. while (index--) {
  23012. var func = funcs[index];
  23013. if (typeof func != 'function') {
  23014. throw new TypeError(FUNC_ERROR_TEXT);
  23015. }
  23016. if (prereq && !wrapper && getFuncName(func) == 'wrapper') {
  23017. var wrapper = new LodashWrapper([], true);
  23018. }
  23019. }
  23020. index = wrapper ? index : length;
  23021. while (++index < length) {
  23022. func = funcs[index];
  23023. var funcName = getFuncName(func),
  23024. data = funcName == 'wrapper' ? getData(func) : undefined;
  23025. if (data && isLaziable(data[0]) &&
  23026. data[1] == (WRAP_ARY_FLAG | WRAP_CURRY_FLAG | WRAP_PARTIAL_FLAG | WRAP_REARG_FLAG) &&
  23027. !data[4].length && data[9] == 1
  23028. ) {
  23029. wrapper = wrapper[getFuncName(data[0])].apply(wrapper, data[3]);
  23030. } else {
  23031. wrapper = (func.length == 1 && isLaziable(func))
  23032. ? wrapper[funcName]()
  23033. : wrapper.thru(func);
  23034. }
  23035. }
  23036. return function() {
  23037. var args = arguments,
  23038. value = args[0];
  23039. if (wrapper && args.length == 1 && isArray(value)) {
  23040. return wrapper.plant(value).value();
  23041. }
  23042. var index = 0,
  23043. result = length ? funcs[index].apply(this, args) : value;
  23044. while (++index < length) {
  23045. result = funcs[index].call(this, result);
  23046. }
  23047. return result;
  23048. };
  23049. });
  23050. }
  23051. /**
  23052. * Creates a function that wraps `func` to invoke it with optional `this`
  23053. * binding of `thisArg`, partial application, and currying.
  23054. *
  23055. * @private
  23056. * @param {Function|string} func The function or method name to wrap.
  23057. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  23058. * @param {*} [thisArg] The `this` binding of `func`.
  23059. * @param {Array} [partials] The arguments to prepend to those provided to
  23060. * the new function.
  23061. * @param {Array} [holders] The `partials` placeholder indexes.
  23062. * @param {Array} [partialsRight] The arguments to append to those provided
  23063. * to the new function.
  23064. * @param {Array} [holdersRight] The `partialsRight` placeholder indexes.
  23065. * @param {Array} [argPos] The argument positions of the new function.
  23066. * @param {number} [ary] The arity cap of `func`.
  23067. * @param {number} [arity] The arity of `func`.
  23068. * @returns {Function} Returns the new wrapped function.
  23069. */
  23070. function createHybrid(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity) {
  23071. var isAry = bitmask & WRAP_ARY_FLAG,
  23072. isBind = bitmask & WRAP_BIND_FLAG,
  23073. isBindKey = bitmask & WRAP_BIND_KEY_FLAG,
  23074. isCurried = bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG),
  23075. isFlip = bitmask & WRAP_FLIP_FLAG,
  23076. Ctor = isBindKey ? undefined : createCtor(func);
  23077. function wrapper() {
  23078. var length = arguments.length,
  23079. args = Array(length),
  23080. index = length;
  23081. while (index--) {
  23082. args[index] = arguments[index];
  23083. }
  23084. if (isCurried) {
  23085. var placeholder = getHolder(wrapper),
  23086. holdersCount = countHolders(args, placeholder);
  23087. }
  23088. if (partials) {
  23089. args = composeArgs(args, partials, holders, isCurried);
  23090. }
  23091. if (partialsRight) {
  23092. args = composeArgsRight(args, partialsRight, holdersRight, isCurried);
  23093. }
  23094. length -= holdersCount;
  23095. if (isCurried && length < arity) {
  23096. var newHolders = replaceHolders(args, placeholder);
  23097. return createRecurry(
  23098. func, bitmask, createHybrid, wrapper.placeholder, thisArg,
  23099. args, newHolders, argPos, ary, arity - length
  23100. );
  23101. }
  23102. var thisBinding = isBind ? thisArg : this,
  23103. fn = isBindKey ? thisBinding[func] : func;
  23104. length = args.length;
  23105. if (argPos) {
  23106. args = reorder(args, argPos);
  23107. } else if (isFlip && length > 1) {
  23108. args.reverse();
  23109. }
  23110. if (isAry && ary < length) {
  23111. args.length = ary;
  23112. }
  23113. if (this && this !== root && this instanceof wrapper) {
  23114. fn = Ctor || createCtor(fn);
  23115. }
  23116. return fn.apply(thisBinding, args);
  23117. }
  23118. return wrapper;
  23119. }
  23120. /**
  23121. * Creates a function like `_.invertBy`.
  23122. *
  23123. * @private
  23124. * @param {Function} setter The function to set accumulator values.
  23125. * @param {Function} toIteratee The function to resolve iteratees.
  23126. * @returns {Function} Returns the new inverter function.
  23127. */
  23128. function createInverter(setter, toIteratee) {
  23129. return function(object, iteratee) {
  23130. return baseInverter(object, setter, toIteratee(iteratee), {});
  23131. };
  23132. }
  23133. /**
  23134. * Creates a function that performs a mathematical operation on two values.
  23135. *
  23136. * @private
  23137. * @param {Function} operator The function to perform the operation.
  23138. * @param {number} [defaultValue] The value used for `undefined` arguments.
  23139. * @returns {Function} Returns the new mathematical operation function.
  23140. */
  23141. function createMathOperation(operator, defaultValue) {
  23142. return function(value, other) {
  23143. var result;
  23144. if (value === undefined && other === undefined) {
  23145. return defaultValue;
  23146. }
  23147. if (value !== undefined) {
  23148. result = value;
  23149. }
  23150. if (other !== undefined) {
  23151. if (result === undefined) {
  23152. return other;
  23153. }
  23154. if (typeof value == 'string' || typeof other == 'string') {
  23155. value = baseToString(value);
  23156. other = baseToString(other);
  23157. } else {
  23158. value = baseToNumber(value);
  23159. other = baseToNumber(other);
  23160. }
  23161. result = operator(value, other);
  23162. }
  23163. return result;
  23164. };
  23165. }
  23166. /**
  23167. * Creates a function like `_.over`.
  23168. *
  23169. * @private
  23170. * @param {Function} arrayFunc The function to iterate over iteratees.
  23171. * @returns {Function} Returns the new over function.
  23172. */
  23173. function createOver(arrayFunc) {
  23174. return flatRest(function(iteratees) {
  23175. iteratees = arrayMap(iteratees, baseUnary(getIteratee()));
  23176. return baseRest(function(args) {
  23177. var thisArg = this;
  23178. return arrayFunc(iteratees, function(iteratee) {
  23179. return apply(iteratee, thisArg, args);
  23180. });
  23181. });
  23182. });
  23183. }
  23184. /**
  23185. * Creates the padding for `string` based on `length`. The `chars` string
  23186. * is truncated if the number of characters exceeds `length`.
  23187. *
  23188. * @private
  23189. * @param {number} length The padding length.
  23190. * @param {string} [chars=' '] The string used as padding.
  23191. * @returns {string} Returns the padding for `string`.
  23192. */
  23193. function createPadding(length, chars) {
  23194. chars = chars === undefined ? ' ' : baseToString(chars);
  23195. var charsLength = chars.length;
  23196. if (charsLength < 2) {
  23197. return charsLength ? baseRepeat(chars, length) : chars;
  23198. }
  23199. var result = baseRepeat(chars, nativeCeil(length / stringSize(chars)));
  23200. return hasUnicode(chars)
  23201. ? castSlice(stringToArray(result), 0, length).join('')
  23202. : result.slice(0, length);
  23203. }
  23204. /**
  23205. * Creates a function that wraps `func` to invoke it with the `this` binding
  23206. * of `thisArg` and `partials` prepended to the arguments it receives.
  23207. *
  23208. * @private
  23209. * @param {Function} func The function to wrap.
  23210. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  23211. * @param {*} thisArg The `this` binding of `func`.
  23212. * @param {Array} partials The arguments to prepend to those provided to
  23213. * the new function.
  23214. * @returns {Function} Returns the new wrapped function.
  23215. */
  23216. function createPartial(func, bitmask, thisArg, partials) {
  23217. var isBind = bitmask & WRAP_BIND_FLAG,
  23218. Ctor = createCtor(func);
  23219. function wrapper() {
  23220. var argsIndex = -1,
  23221. argsLength = arguments.length,
  23222. leftIndex = -1,
  23223. leftLength = partials.length,
  23224. args = Array(leftLength + argsLength),
  23225. fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
  23226. while (++leftIndex < leftLength) {
  23227. args[leftIndex] = partials[leftIndex];
  23228. }
  23229. while (argsLength--) {
  23230. args[leftIndex++] = arguments[++argsIndex];
  23231. }
  23232. return apply(fn, isBind ? thisArg : this, args);
  23233. }
  23234. return wrapper;
  23235. }
  23236. /**
  23237. * Creates a `_.range` or `_.rangeRight` function.
  23238. *
  23239. * @private
  23240. * @param {boolean} [fromRight] Specify iterating from right to left.
  23241. * @returns {Function} Returns the new range function.
  23242. */
  23243. function createRange(fromRight) {
  23244. return function(start, end, step) {
  23245. if (step && typeof step != 'number' && isIterateeCall(start, end, step)) {
  23246. end = step = undefined;
  23247. }
  23248. // Ensure the sign of `-0` is preserved.
  23249. start = toFinite(start);
  23250. if (end === undefined) {
  23251. end = start;
  23252. start = 0;
  23253. } else {
  23254. end = toFinite(end);
  23255. }
  23256. step = step === undefined ? (start < end ? 1 : -1) : toFinite(step);
  23257. return baseRange(start, end, step, fromRight);
  23258. };
  23259. }
  23260. /**
  23261. * Creates a function that performs a relational operation on two values.
  23262. *
  23263. * @private
  23264. * @param {Function} operator The function to perform the operation.
  23265. * @returns {Function} Returns the new relational operation function.
  23266. */
  23267. function createRelationalOperation(operator) {
  23268. return function(value, other) {
  23269. if (!(typeof value == 'string' && typeof other == 'string')) {
  23270. value = toNumber(value);
  23271. other = toNumber(other);
  23272. }
  23273. return operator(value, other);
  23274. };
  23275. }
  23276. /**
  23277. * Creates a function that wraps `func` to continue currying.
  23278. *
  23279. * @private
  23280. * @param {Function} func The function to wrap.
  23281. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  23282. * @param {Function} wrapFunc The function to create the `func` wrapper.
  23283. * @param {*} placeholder The placeholder value.
  23284. * @param {*} [thisArg] The `this` binding of `func`.
  23285. * @param {Array} [partials] The arguments to prepend to those provided to
  23286. * the new function.
  23287. * @param {Array} [holders] The `partials` placeholder indexes.
  23288. * @param {Array} [argPos] The argument positions of the new function.
  23289. * @param {number} [ary] The arity cap of `func`.
  23290. * @param {number} [arity] The arity of `func`.
  23291. * @returns {Function} Returns the new wrapped function.
  23292. */
  23293. function createRecurry(func, bitmask, wrapFunc, placeholder, thisArg, partials, holders, argPos, ary, arity) {
  23294. var isCurry = bitmask & WRAP_CURRY_FLAG,
  23295. newHolders = isCurry ? holders : undefined,
  23296. newHoldersRight = isCurry ? undefined : holders,
  23297. newPartials = isCurry ? partials : undefined,
  23298. newPartialsRight = isCurry ? undefined : partials;
  23299. bitmask |= (isCurry ? WRAP_PARTIAL_FLAG : WRAP_PARTIAL_RIGHT_FLAG);
  23300. bitmask &= ~(isCurry ? WRAP_PARTIAL_RIGHT_FLAG : WRAP_PARTIAL_FLAG);
  23301. if (!(bitmask & WRAP_CURRY_BOUND_FLAG)) {
  23302. bitmask &= ~(WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG);
  23303. }
  23304. var newData = [
  23305. func, bitmask, thisArg, newPartials, newHolders, newPartialsRight,
  23306. newHoldersRight, argPos, ary, arity
  23307. ];
  23308. var result = wrapFunc.apply(undefined, newData);
  23309. if (isLaziable(func)) {
  23310. setData(result, newData);
  23311. }
  23312. result.placeholder = placeholder;
  23313. return setWrapToString(result, func, bitmask);
  23314. }
  23315. /**
  23316. * Creates a function like `_.round`.
  23317. *
  23318. * @private
  23319. * @param {string} methodName The name of the `Math` method to use when rounding.
  23320. * @returns {Function} Returns the new round function.
  23321. */
  23322. function createRound(methodName) {
  23323. var func = Math[methodName];
  23324. return function(number, precision) {
  23325. number = toNumber(number);
  23326. precision = precision == null ? 0 : nativeMin(toInteger(precision), 292);
  23327. if (precision && nativeIsFinite(number)) {
  23328. // Shift with exponential notation to avoid floating-point issues.
  23329. // See [MDN](https://mdn.io/round#Examples) for more details.
  23330. var pair = (toString(number) + 'e').split('e'),
  23331. value = func(pair[0] + 'e' + (+pair[1] + precision));
  23332. pair = (toString(value) + 'e').split('e');
  23333. return +(pair[0] + 'e' + (+pair[1] - precision));
  23334. }
  23335. return func(number);
  23336. };
  23337. }
  23338. /**
  23339. * Creates a set object of `values`.
  23340. *
  23341. * @private
  23342. * @param {Array} values The values to add to the set.
  23343. * @returns {Object} Returns the new set.
  23344. */
  23345. var createSet = !(Set && (1 / setToArray(new Set([,-0]))[1]) == INFINITY) ? noop : function(values) {
  23346. return new Set(values);
  23347. };
  23348. /**
  23349. * Creates a `_.toPairs` or `_.toPairsIn` function.
  23350. *
  23351. * @private
  23352. * @param {Function} keysFunc The function to get the keys of a given object.
  23353. * @returns {Function} Returns the new pairs function.
  23354. */
  23355. function createToPairs(keysFunc) {
  23356. return function(object) {
  23357. var tag = getTag(object);
  23358. if (tag == mapTag) {
  23359. return mapToArray(object);
  23360. }
  23361. if (tag == setTag) {
  23362. return setToPairs(object);
  23363. }
  23364. return baseToPairs(object, keysFunc(object));
  23365. };
  23366. }
  23367. /**
  23368. * Creates a function that either curries or invokes `func` with optional
  23369. * `this` binding and partially applied arguments.
  23370. *
  23371. * @private
  23372. * @param {Function|string} func The function or method name to wrap.
  23373. * @param {number} bitmask The bitmask flags.
  23374. * 1 - `_.bind`
  23375. * 2 - `_.bindKey`
  23376. * 4 - `_.curry` or `_.curryRight` of a bound function
  23377. * 8 - `_.curry`
  23378. * 16 - `_.curryRight`
  23379. * 32 - `_.partial`
  23380. * 64 - `_.partialRight`
  23381. * 128 - `_.rearg`
  23382. * 256 - `_.ary`
  23383. * 512 - `_.flip`
  23384. * @param {*} [thisArg] The `this` binding of `func`.
  23385. * @param {Array} [partials] The arguments to be partially applied.
  23386. * @param {Array} [holders] The `partials` placeholder indexes.
  23387. * @param {Array} [argPos] The argument positions of the new function.
  23388. * @param {number} [ary] The arity cap of `func`.
  23389. * @param {number} [arity] The arity of `func`.
  23390. * @returns {Function} Returns the new wrapped function.
  23391. */
  23392. function createWrap(func, bitmask, thisArg, partials, holders, argPos, ary, arity) {
  23393. var isBindKey = bitmask & WRAP_BIND_KEY_FLAG;
  23394. if (!isBindKey && typeof func != 'function') {
  23395. throw new TypeError(FUNC_ERROR_TEXT);
  23396. }
  23397. var length = partials ? partials.length : 0;
  23398. if (!length) {
  23399. bitmask &= ~(WRAP_PARTIAL_FLAG | WRAP_PARTIAL_RIGHT_FLAG);
  23400. partials = holders = undefined;
  23401. }
  23402. ary = ary === undefined ? ary : nativeMax(toInteger(ary), 0);
  23403. arity = arity === undefined ? arity : toInteger(arity);
  23404. length -= holders ? holders.length : 0;
  23405. if (bitmask & WRAP_PARTIAL_RIGHT_FLAG) {
  23406. var partialsRight = partials,
  23407. holdersRight = holders;
  23408. partials = holders = undefined;
  23409. }
  23410. var data = isBindKey ? undefined : getData(func);
  23411. var newData = [
  23412. func, bitmask, thisArg, partials, holders, partialsRight, holdersRight,
  23413. argPos, ary, arity
  23414. ];
  23415. if (data) {
  23416. mergeData(newData, data);
  23417. }
  23418. func = newData[0];
  23419. bitmask = newData[1];
  23420. thisArg = newData[2];
  23421. partials = newData[3];
  23422. holders = newData[4];
  23423. arity = newData[9] = newData[9] === undefined
  23424. ? (isBindKey ? 0 : func.length)
  23425. : nativeMax(newData[9] - length, 0);
  23426. if (!arity && bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG)) {
  23427. bitmask &= ~(WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG);
  23428. }
  23429. if (!bitmask || bitmask == WRAP_BIND_FLAG) {
  23430. var result = createBind(func, bitmask, thisArg);
  23431. } else if (bitmask == WRAP_CURRY_FLAG || bitmask == WRAP_CURRY_RIGHT_FLAG) {
  23432. result = createCurry(func, bitmask, arity);
  23433. } else if ((bitmask == WRAP_PARTIAL_FLAG || bitmask == (WRAP_BIND_FLAG | WRAP_PARTIAL_FLAG)) && !holders.length) {
  23434. result = createPartial(func, bitmask, thisArg, partials);
  23435. } else {
  23436. result = createHybrid.apply(undefined, newData);
  23437. }
  23438. var setter = data ? baseSetData : setData;
  23439. return setWrapToString(setter(result, newData), func, bitmask);
  23440. }
  23441. /**
  23442. * Used by `_.defaults` to customize its `_.assignIn` use to assign properties
  23443. * of source objects to the destination object for all destination properties
  23444. * that resolve to `undefined`.
  23445. *
  23446. * @private
  23447. * @param {*} objValue The destination value.
  23448. * @param {*} srcValue The source value.
  23449. * @param {string} key The key of the property to assign.
  23450. * @param {Object} object The parent object of `objValue`.
  23451. * @returns {*} Returns the value to assign.
  23452. */
  23453. function customDefaultsAssignIn(objValue, srcValue, key, object) {
  23454. if (objValue === undefined ||
  23455. (eq(objValue, objectProto[key]) && !hasOwnProperty.call(object, key))) {
  23456. return srcValue;
  23457. }
  23458. return objValue;
  23459. }
  23460. /**
  23461. * Used by `_.defaultsDeep` to customize its `_.merge` use to merge source
  23462. * objects into destination objects that are passed thru.
  23463. *
  23464. * @private
  23465. * @param {*} objValue The destination value.
  23466. * @param {*} srcValue The source value.
  23467. * @param {string} key The key of the property to merge.
  23468. * @param {Object} object The parent object of `objValue`.
  23469. * @param {Object} source The parent object of `srcValue`.
  23470. * @param {Object} [stack] Tracks traversed source values and their merged
  23471. * counterparts.
  23472. * @returns {*} Returns the value to assign.
  23473. */
  23474. function customDefaultsMerge(objValue, srcValue, key, object, source, stack) {
  23475. if (isObject(objValue) && isObject(srcValue)) {
  23476. // Recursively merge objects and arrays (susceptible to call stack limits).
  23477. stack.set(srcValue, objValue);
  23478. baseMerge(objValue, srcValue, undefined, customDefaultsMerge, stack);
  23479. stack['delete'](srcValue);
  23480. }
  23481. return objValue;
  23482. }
  23483. /**
  23484. * Used by `_.omit` to customize its `_.cloneDeep` use to only clone plain
  23485. * objects.
  23486. *
  23487. * @private
  23488. * @param {*} value The value to inspect.
  23489. * @param {string} key The key of the property to inspect.
  23490. * @returns {*} Returns the uncloned value or `undefined` to defer cloning to `_.cloneDeep`.
  23491. */
  23492. function customOmitClone(value) {
  23493. return isPlainObject(value) ? undefined : value;
  23494. }
  23495. /**
  23496. * A specialized version of `baseIsEqualDeep` for arrays with support for
  23497. * partial deep comparisons.
  23498. *
  23499. * @private
  23500. * @param {Array} array The array to compare.
  23501. * @param {Array} other The other array to compare.
  23502. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  23503. * @param {Function} customizer The function to customize comparisons.
  23504. * @param {Function} equalFunc The function to determine equivalents of values.
  23505. * @param {Object} stack Tracks traversed `array` and `other` objects.
  23506. * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.
  23507. */
  23508. function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
  23509. var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
  23510. arrLength = array.length,
  23511. othLength = other.length;
  23512. if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
  23513. return false;
  23514. }
  23515. // Assume cyclic values are equal.
  23516. var stacked = stack.get(array);
  23517. if (stacked && stack.get(other)) {
  23518. return stacked == other;
  23519. }
  23520. var index = -1,
  23521. result = true,
  23522. seen = (bitmask & COMPARE_UNORDERED_FLAG) ? new SetCache : undefined;
  23523. stack.set(array, other);
  23524. stack.set(other, array);
  23525. // Ignore non-index properties.
  23526. while (++index < arrLength) {
  23527. var arrValue = array[index],
  23528. othValue = other[index];
  23529. if (customizer) {
  23530. var compared = isPartial
  23531. ? customizer(othValue, arrValue, index, other, array, stack)
  23532. : customizer(arrValue, othValue, index, array, other, stack);
  23533. }
  23534. if (compared !== undefined) {
  23535. if (compared) {
  23536. continue;
  23537. }
  23538. result = false;
  23539. break;
  23540. }
  23541. // Recursively compare arrays (susceptible to call stack limits).
  23542. if (seen) {
  23543. if (!arraySome(other, function(othValue, othIndex) {
  23544. if (!cacheHas(seen, othIndex) &&
  23545. (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
  23546. return seen.push(othIndex);
  23547. }
  23548. })) {
  23549. result = false;
  23550. break;
  23551. }
  23552. } else if (!(
  23553. arrValue === othValue ||
  23554. equalFunc(arrValue, othValue, bitmask, customizer, stack)
  23555. )) {
  23556. result = false;
  23557. break;
  23558. }
  23559. }
  23560. stack['delete'](array);
  23561. stack['delete'](other);
  23562. return result;
  23563. }
  23564. /**
  23565. * A specialized version of `baseIsEqualDeep` for comparing objects of
  23566. * the same `toStringTag`.
  23567. *
  23568. * **Note:** This function only supports comparing values with tags of
  23569. * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
  23570. *
  23571. * @private
  23572. * @param {Object} object The object to compare.
  23573. * @param {Object} other The other object to compare.
  23574. * @param {string} tag The `toStringTag` of the objects to compare.
  23575. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  23576. * @param {Function} customizer The function to customize comparisons.
  23577. * @param {Function} equalFunc The function to determine equivalents of values.
  23578. * @param {Object} stack Tracks traversed `object` and `other` objects.
  23579. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  23580. */
  23581. function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
  23582. switch (tag) {
  23583. case dataViewTag:
  23584. if ((object.byteLength != other.byteLength) ||
  23585. (object.byteOffset != other.byteOffset)) {
  23586. return false;
  23587. }
  23588. object = object.buffer;
  23589. other = other.buffer;
  23590. case arrayBufferTag:
  23591. if ((object.byteLength != other.byteLength) ||
  23592. !equalFunc(new Uint8Array(object), new Uint8Array(other))) {
  23593. return false;
  23594. }
  23595. return true;
  23596. case boolTag:
  23597. case dateTag:
  23598. case numberTag:
  23599. // Coerce booleans to `1` or `0` and dates to milliseconds.
  23600. // Invalid dates are coerced to `NaN`.
  23601. return eq(+object, +other);
  23602. case errorTag:
  23603. return object.name == other.name && object.message == other.message;
  23604. case regexpTag:
  23605. case stringTag:
  23606. // Coerce regexes to strings and treat strings, primitives and objects,
  23607. // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring
  23608. // for more details.
  23609. return object == (other + '');
  23610. case mapTag:
  23611. var convert = mapToArray;
  23612. case setTag:
  23613. var isPartial = bitmask & COMPARE_PARTIAL_FLAG;
  23614. convert || (convert = setToArray);
  23615. if (object.size != other.size && !isPartial) {
  23616. return false;
  23617. }
  23618. // Assume cyclic values are equal.
  23619. var stacked = stack.get(object);
  23620. if (stacked) {
  23621. return stacked == other;
  23622. }
  23623. bitmask |= COMPARE_UNORDERED_FLAG;
  23624. // Recursively compare objects (susceptible to call stack limits).
  23625. stack.set(object, other);
  23626. var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack);
  23627. stack['delete'](object);
  23628. return result;
  23629. case symbolTag:
  23630. if (symbolValueOf) {
  23631. return symbolValueOf.call(object) == symbolValueOf.call(other);
  23632. }
  23633. }
  23634. return false;
  23635. }
  23636. /**
  23637. * A specialized version of `baseIsEqualDeep` for objects with support for
  23638. * partial deep comparisons.
  23639. *
  23640. * @private
  23641. * @param {Object} object The object to compare.
  23642. * @param {Object} other The other object to compare.
  23643. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  23644. * @param {Function} customizer The function to customize comparisons.
  23645. * @param {Function} equalFunc The function to determine equivalents of values.
  23646. * @param {Object} stack Tracks traversed `object` and `other` objects.
  23647. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  23648. */
  23649. function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
  23650. var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
  23651. objProps = getAllKeys(object),
  23652. objLength = objProps.length,
  23653. othProps = getAllKeys(other),
  23654. othLength = othProps.length;
  23655. if (objLength != othLength && !isPartial) {
  23656. return false;
  23657. }
  23658. var index = objLength;
  23659. while (index--) {
  23660. var key = objProps[index];
  23661. if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) {
  23662. return false;
  23663. }
  23664. }
  23665. // Assume cyclic values are equal.
  23666. var stacked = stack.get(object);
  23667. if (stacked && stack.get(other)) {
  23668. return stacked == other;
  23669. }
  23670. var result = true;
  23671. stack.set(object, other);
  23672. stack.set(other, object);
  23673. var skipCtor = isPartial;
  23674. while (++index < objLength) {
  23675. key = objProps[index];
  23676. var objValue = object[key],
  23677. othValue = other[key];
  23678. if (customizer) {
  23679. var compared = isPartial
  23680. ? customizer(othValue, objValue, key, other, object, stack)
  23681. : customizer(objValue, othValue, key, object, other, stack);
  23682. }
  23683. // Recursively compare objects (susceptible to call stack limits).
  23684. if (!(compared === undefined
  23685. ? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack))
  23686. : compared
  23687. )) {
  23688. result = false;
  23689. break;
  23690. }
  23691. skipCtor || (skipCtor = key == 'constructor');
  23692. }
  23693. if (result && !skipCtor) {
  23694. var objCtor = object.constructor,
  23695. othCtor = other.constructor;
  23696. // Non `Object` object instances with different constructors are not equal.
  23697. if (objCtor != othCtor &&
  23698. ('constructor' in object && 'constructor' in other) &&
  23699. !(typeof objCtor == 'function' && objCtor instanceof objCtor &&
  23700. typeof othCtor == 'function' && othCtor instanceof othCtor)) {
  23701. result = false;
  23702. }
  23703. }
  23704. stack['delete'](object);
  23705. stack['delete'](other);
  23706. return result;
  23707. }
  23708. /**
  23709. * A specialized version of `baseRest` which flattens the rest array.
  23710. *
  23711. * @private
  23712. * @param {Function} func The function to apply a rest parameter to.
  23713. * @returns {Function} Returns the new function.
  23714. */
  23715. function flatRest(func) {
  23716. return setToString(overRest(func, undefined, flatten), func + '');
  23717. }
  23718. /**
  23719. * Creates an array of own enumerable property names and symbols of `object`.
  23720. *
  23721. * @private
  23722. * @param {Object} object The object to query.
  23723. * @returns {Array} Returns the array of property names and symbols.
  23724. */
  23725. function getAllKeys(object) {
  23726. return baseGetAllKeys(object, keys, getSymbols);
  23727. }
  23728. /**
  23729. * Creates an array of own and inherited enumerable property names and
  23730. * symbols of `object`.
  23731. *
  23732. * @private
  23733. * @param {Object} object The object to query.
  23734. * @returns {Array} Returns the array of property names and symbols.
  23735. */
  23736. function getAllKeysIn(object) {
  23737. return baseGetAllKeys(object, keysIn, getSymbolsIn);
  23738. }
  23739. /**
  23740. * Gets metadata for `func`.
  23741. *
  23742. * @private
  23743. * @param {Function} func The function to query.
  23744. * @returns {*} Returns the metadata for `func`.
  23745. */
  23746. var getData = !metaMap ? noop : function(func) {
  23747. return metaMap.get(func);
  23748. };
  23749. /**
  23750. * Gets the name of `func`.
  23751. *
  23752. * @private
  23753. * @param {Function} func The function to query.
  23754. * @returns {string} Returns the function name.
  23755. */
  23756. function getFuncName(func) {
  23757. var result = (func.name + ''),
  23758. array = realNames[result],
  23759. length = hasOwnProperty.call(realNames, result) ? array.length : 0;
  23760. while (length--) {
  23761. var data = array[length],
  23762. otherFunc = data.func;
  23763. if (otherFunc == null || otherFunc == func) {
  23764. return data.name;
  23765. }
  23766. }
  23767. return result;
  23768. }
  23769. /**
  23770. * Gets the argument placeholder value for `func`.
  23771. *
  23772. * @private
  23773. * @param {Function} func The function to inspect.
  23774. * @returns {*} Returns the placeholder value.
  23775. */
  23776. function getHolder(func) {
  23777. var object = hasOwnProperty.call(lodash, 'placeholder') ? lodash : func;
  23778. return object.placeholder;
  23779. }
  23780. /**
  23781. * Gets the appropriate "iteratee" function. If `_.iteratee` is customized,
  23782. * this function returns the custom method, otherwise it returns `baseIteratee`.
  23783. * If arguments are provided, the chosen function is invoked with them and
  23784. * its result is returned.
  23785. *
  23786. * @private
  23787. * @param {*} [value] The value to convert to an iteratee.
  23788. * @param {number} [arity] The arity of the created iteratee.
  23789. * @returns {Function} Returns the chosen function or its result.
  23790. */
  23791. function getIteratee() {
  23792. var result = lodash.iteratee || iteratee;
  23793. result = result === iteratee ? baseIteratee : result;
  23794. return arguments.length ? result(arguments[0], arguments[1]) : result;
  23795. }
  23796. /**
  23797. * Gets the data for `map`.
  23798. *
  23799. * @private
  23800. * @param {Object} map The map to query.
  23801. * @param {string} key The reference key.
  23802. * @returns {*} Returns the map data.
  23803. */
  23804. function getMapData(map, key) {
  23805. var data = map.__data__;
  23806. return isKeyable(key)
  23807. ? data[typeof key == 'string' ? 'string' : 'hash']
  23808. : data.map;
  23809. }
  23810. /**
  23811. * Gets the property names, values, and compare flags of `object`.
  23812. *
  23813. * @private
  23814. * @param {Object} object The object to query.
  23815. * @returns {Array} Returns the match data of `object`.
  23816. */
  23817. function getMatchData(object) {
  23818. var result = keys(object),
  23819. length = result.length;
  23820. while (length--) {
  23821. var key = result[length],
  23822. value = object[key];
  23823. result[length] = [key, value, isStrictComparable(value)];
  23824. }
  23825. return result;
  23826. }
  23827. /**
  23828. * Gets the native function at `key` of `object`.
  23829. *
  23830. * @private
  23831. * @param {Object} object The object to query.
  23832. * @param {string} key The key of the method to get.
  23833. * @returns {*} Returns the function if it's native, else `undefined`.
  23834. */
  23835. function getNative(object, key) {
  23836. var value = getValue(object, key);
  23837. return baseIsNative(value) ? value : undefined;
  23838. }
  23839. /**
  23840. * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
  23841. *
  23842. * @private
  23843. * @param {*} value The value to query.
  23844. * @returns {string} Returns the raw `toStringTag`.
  23845. */
  23846. function getRawTag(value) {
  23847. var isOwn = hasOwnProperty.call(value, symToStringTag),
  23848. tag = value[symToStringTag];
  23849. try {
  23850. value[symToStringTag] = undefined;
  23851. var unmasked = true;
  23852. } catch (e) {}
  23853. var result = nativeObjectToString.call(value);
  23854. if (unmasked) {
  23855. if (isOwn) {
  23856. value[symToStringTag] = tag;
  23857. } else {
  23858. delete value[symToStringTag];
  23859. }
  23860. }
  23861. return result;
  23862. }
  23863. /**
  23864. * Creates an array of the own enumerable symbols of `object`.
  23865. *
  23866. * @private
  23867. * @param {Object} object The object to query.
  23868. * @returns {Array} Returns the array of symbols.
  23869. */
  23870. var getSymbols = !nativeGetSymbols ? stubArray : function(object) {
  23871. if (object == null) {
  23872. return [];
  23873. }
  23874. object = Object(object);
  23875. return arrayFilter(nativeGetSymbols(object), function(symbol) {
  23876. return propertyIsEnumerable.call(object, symbol);
  23877. });
  23878. };
  23879. /**
  23880. * Creates an array of the own and inherited enumerable symbols of `object`.
  23881. *
  23882. * @private
  23883. * @param {Object} object The object to query.
  23884. * @returns {Array} Returns the array of symbols.
  23885. */
  23886. var getSymbolsIn = !nativeGetSymbols ? stubArray : function(object) {
  23887. var result = [];
  23888. while (object) {
  23889. arrayPush(result, getSymbols(object));
  23890. object = getPrototype(object);
  23891. }
  23892. return result;
  23893. };
  23894. /**
  23895. * Gets the `toStringTag` of `value`.
  23896. *
  23897. * @private
  23898. * @param {*} value The value to query.
  23899. * @returns {string} Returns the `toStringTag`.
  23900. */
  23901. var getTag = baseGetTag;
  23902. // Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6.
  23903. if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||
  23904. (Map && getTag(new Map) != mapTag) ||
  23905. (Promise && getTag(Promise.resolve()) != promiseTag) ||
  23906. (Set && getTag(new Set) != setTag) ||
  23907. (WeakMap && getTag(new WeakMap) != weakMapTag)) {
  23908. getTag = function(value) {
  23909. var result = baseGetTag(value),
  23910. Ctor = result == objectTag ? value.constructor : undefined,
  23911. ctorString = Ctor ? toSource(Ctor) : '';
  23912. if (ctorString) {
  23913. switch (ctorString) {
  23914. case dataViewCtorString: return dataViewTag;
  23915. case mapCtorString: return mapTag;
  23916. case promiseCtorString: return promiseTag;
  23917. case setCtorString: return setTag;
  23918. case weakMapCtorString: return weakMapTag;
  23919. }
  23920. }
  23921. return result;
  23922. };
  23923. }
  23924. /**
  23925. * Gets the view, applying any `transforms` to the `start` and `end` positions.
  23926. *
  23927. * @private
  23928. * @param {number} start The start of the view.
  23929. * @param {number} end The end of the view.
  23930. * @param {Array} transforms The transformations to apply to the view.
  23931. * @returns {Object} Returns an object containing the `start` and `end`
  23932. * positions of the view.
  23933. */
  23934. function getView(start, end, transforms) {
  23935. var index = -1,
  23936. length = transforms.length;
  23937. while (++index < length) {
  23938. var data = transforms[index],
  23939. size = data.size;
  23940. switch (data.type) {
  23941. case 'drop': start += size; break;
  23942. case 'dropRight': end -= size; break;
  23943. case 'take': end = nativeMin(end, start + size); break;
  23944. case 'takeRight': start = nativeMax(start, end - size); break;
  23945. }
  23946. }
  23947. return { 'start': start, 'end': end };
  23948. }
  23949. /**
  23950. * Extracts wrapper details from the `source` body comment.
  23951. *
  23952. * @private
  23953. * @param {string} source The source to inspect.
  23954. * @returns {Array} Returns the wrapper details.
  23955. */
  23956. function getWrapDetails(source) {
  23957. var match = source.match(reWrapDetails);
  23958. return match ? match[1].split(reSplitDetails) : [];
  23959. }
  23960. /**
  23961. * Checks if `path` exists on `object`.
  23962. *
  23963. * @private
  23964. * @param {Object} object The object to query.
  23965. * @param {Array|string} path The path to check.
  23966. * @param {Function} hasFunc The function to check properties.
  23967. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  23968. */
  23969. function hasPath(object, path, hasFunc) {
  23970. path = castPath(path, object);
  23971. var index = -1,
  23972. length = path.length,
  23973. result = false;
  23974. while (++index < length) {
  23975. var key = toKey(path[index]);
  23976. if (!(result = object != null && hasFunc(object, key))) {
  23977. break;
  23978. }
  23979. object = object[key];
  23980. }
  23981. if (result || ++index != length) {
  23982. return result;
  23983. }
  23984. length = object == null ? 0 : object.length;
  23985. return !!length && isLength(length) && isIndex(key, length) &&
  23986. (isArray(object) || isArguments(object));
  23987. }
  23988. /**
  23989. * Initializes an array clone.
  23990. *
  23991. * @private
  23992. * @param {Array} array The array to clone.
  23993. * @returns {Array} Returns the initialized clone.
  23994. */
  23995. function initCloneArray(array) {
  23996. var length = array.length,
  23997. result = new array.constructor(length);
  23998. // Add properties assigned by `RegExp#exec`.
  23999. if (length && typeof array[0] == 'string' && hasOwnProperty.call(array, 'index')) {
  24000. result.index = array.index;
  24001. result.input = array.input;
  24002. }
  24003. return result;
  24004. }
  24005. /**
  24006. * Initializes an object clone.
  24007. *
  24008. * @private
  24009. * @param {Object} object The object to clone.
  24010. * @returns {Object} Returns the initialized clone.
  24011. */
  24012. function initCloneObject(object) {
  24013. return (typeof object.constructor == 'function' && !isPrototype(object))
  24014. ? baseCreate(getPrototype(object))
  24015. : {};
  24016. }
  24017. /**
  24018. * Initializes an object clone based on its `toStringTag`.
  24019. *
  24020. * **Note:** This function only supports cloning values with tags of
  24021. * `Boolean`, `Date`, `Error`, `Map`, `Number`, `RegExp`, `Set`, or `String`.
  24022. *
  24023. * @private
  24024. * @param {Object} object The object to clone.
  24025. * @param {string} tag The `toStringTag` of the object to clone.
  24026. * @param {boolean} [isDeep] Specify a deep clone.
  24027. * @returns {Object} Returns the initialized clone.
  24028. */
  24029. function initCloneByTag(object, tag, isDeep) {
  24030. var Ctor = object.constructor;
  24031. switch (tag) {
  24032. case arrayBufferTag:
  24033. return cloneArrayBuffer(object);
  24034. case boolTag:
  24035. case dateTag:
  24036. return new Ctor(+object);
  24037. case dataViewTag:
  24038. return cloneDataView(object, isDeep);
  24039. case float32Tag: case float64Tag:
  24040. case int8Tag: case int16Tag: case int32Tag:
  24041. case uint8Tag: case uint8ClampedTag: case uint16Tag: case uint32Tag:
  24042. return cloneTypedArray(object, isDeep);
  24043. case mapTag:
  24044. return new Ctor;
  24045. case numberTag:
  24046. case stringTag:
  24047. return new Ctor(object);
  24048. case regexpTag:
  24049. return cloneRegExp(object);
  24050. case setTag:
  24051. return new Ctor;
  24052. case symbolTag:
  24053. return cloneSymbol(object);
  24054. }
  24055. }
  24056. /**
  24057. * Inserts wrapper `details` in a comment at the top of the `source` body.
  24058. *
  24059. * @private
  24060. * @param {string} source The source to modify.
  24061. * @returns {Array} details The details to insert.
  24062. * @returns {string} Returns the modified source.
  24063. */
  24064. function insertWrapDetails(source, details) {
  24065. var length = details.length;
  24066. if (!length) {
  24067. return source;
  24068. }
  24069. var lastIndex = length - 1;
  24070. details[lastIndex] = (length > 1 ? '& ' : '') + details[lastIndex];
  24071. details = details.join(length > 2 ? ', ' : ' ');
  24072. return source.replace(reWrapComment, '{\n/* [wrapped with ' + details + '] */\n');
  24073. }
  24074. /**
  24075. * Checks if `value` is a flattenable `arguments` object or array.
  24076. *
  24077. * @private
  24078. * @param {*} value The value to check.
  24079. * @returns {boolean} Returns `true` if `value` is flattenable, else `false`.
  24080. */
  24081. function isFlattenable(value) {
  24082. return isArray(value) || isArguments(value) ||
  24083. !!(spreadableSymbol && value && value[spreadableSymbol]);
  24084. }
  24085. /**
  24086. * Checks if `value` is a valid array-like index.
  24087. *
  24088. * @private
  24089. * @param {*} value The value to check.
  24090. * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
  24091. * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
  24092. */
  24093. function isIndex(value, length) {
  24094. var type = typeof value;
  24095. length = length == null ? MAX_SAFE_INTEGER : length;
  24096. return !!length &&
  24097. (type == 'number' ||
  24098. (type != 'symbol' && reIsUint.test(value))) &&
  24099. (value > -1 && value % 1 == 0 && value < length);
  24100. }
  24101. /**
  24102. * Checks if the given arguments are from an iteratee call.
  24103. *
  24104. * @private
  24105. * @param {*} value The potential iteratee value argument.
  24106. * @param {*} index The potential iteratee index or key argument.
  24107. * @param {*} object The potential iteratee object argument.
  24108. * @returns {boolean} Returns `true` if the arguments are from an iteratee call,
  24109. * else `false`.
  24110. */
  24111. function isIterateeCall(value, index, object) {
  24112. if (!isObject(object)) {
  24113. return false;
  24114. }
  24115. var type = typeof index;
  24116. if (type == 'number'
  24117. ? (isArrayLike(object) && isIndex(index, object.length))
  24118. : (type == 'string' && index in object)
  24119. ) {
  24120. return eq(object[index], value);
  24121. }
  24122. return false;
  24123. }
  24124. /**
  24125. * Checks if `value` is a property name and not a property path.
  24126. *
  24127. * @private
  24128. * @param {*} value The value to check.
  24129. * @param {Object} [object] The object to query keys on.
  24130. * @returns {boolean} Returns `true` if `value` is a property name, else `false`.
  24131. */
  24132. function isKey(value, object) {
  24133. if (isArray(value)) {
  24134. return false;
  24135. }
  24136. var type = typeof value;
  24137. if (type == 'number' || type == 'symbol' || type == 'boolean' ||
  24138. value == null || isSymbol(value)) {
  24139. return true;
  24140. }
  24141. return reIsPlainProp.test(value) || !reIsDeepProp.test(value) ||
  24142. (object != null && value in Object(object));
  24143. }
  24144. /**
  24145. * Checks if `value` is suitable for use as unique object key.
  24146. *
  24147. * @private
  24148. * @param {*} value The value to check.
  24149. * @returns {boolean} Returns `true` if `value` is suitable, else `false`.
  24150. */
  24151. function isKeyable(value) {
  24152. var type = typeof value;
  24153. return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
  24154. ? (value !== '__proto__')
  24155. : (value === null);
  24156. }
  24157. /**
  24158. * Checks if `func` has a lazy counterpart.
  24159. *
  24160. * @private
  24161. * @param {Function} func The function to check.
  24162. * @returns {boolean} Returns `true` if `func` has a lazy counterpart,
  24163. * else `false`.
  24164. */
  24165. function isLaziable(func) {
  24166. var funcName = getFuncName(func),
  24167. other = lodash[funcName];
  24168. if (typeof other != 'function' || !(funcName in LazyWrapper.prototype)) {
  24169. return false;
  24170. }
  24171. if (func === other) {
  24172. return true;
  24173. }
  24174. var data = getData(other);
  24175. return !!data && func === data[0];
  24176. }
  24177. /**
  24178. * Checks if `func` has its source masked.
  24179. *
  24180. * @private
  24181. * @param {Function} func The function to check.
  24182. * @returns {boolean} Returns `true` if `func` is masked, else `false`.
  24183. */
  24184. function isMasked(func) {
  24185. return !!maskSrcKey && (maskSrcKey in func);
  24186. }
  24187. /**
  24188. * Checks if `func` is capable of being masked.
  24189. *
  24190. * @private
  24191. * @param {*} value The value to check.
  24192. * @returns {boolean} Returns `true` if `func` is maskable, else `false`.
  24193. */
  24194. var isMaskable = coreJsData ? isFunction : stubFalse;
  24195. /**
  24196. * Checks if `value` is likely a prototype object.
  24197. *
  24198. * @private
  24199. * @param {*} value The value to check.
  24200. * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
  24201. */
  24202. function isPrototype(value) {
  24203. var Ctor = value && value.constructor,
  24204. proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;
  24205. return value === proto;
  24206. }
  24207. /**
  24208. * Checks if `value` is suitable for strict equality comparisons, i.e. `===`.
  24209. *
  24210. * @private
  24211. * @param {*} value The value to check.
  24212. * @returns {boolean} Returns `true` if `value` if suitable for strict
  24213. * equality comparisons, else `false`.
  24214. */
  24215. function isStrictComparable(value) {
  24216. return value === value && !isObject(value);
  24217. }
  24218. /**
  24219. * A specialized version of `matchesProperty` for source values suitable
  24220. * for strict equality comparisons, i.e. `===`.
  24221. *
  24222. * @private
  24223. * @param {string} key The key of the property to get.
  24224. * @param {*} srcValue The value to match.
  24225. * @returns {Function} Returns the new spec function.
  24226. */
  24227. function matchesStrictComparable(key, srcValue) {
  24228. return function(object) {
  24229. if (object == null) {
  24230. return false;
  24231. }
  24232. return object[key] === srcValue &&
  24233. (srcValue !== undefined || (key in Object(object)));
  24234. };
  24235. }
  24236. /**
  24237. * A specialized version of `_.memoize` which clears the memoized function's
  24238. * cache when it exceeds `MAX_MEMOIZE_SIZE`.
  24239. *
  24240. * @private
  24241. * @param {Function} func The function to have its output memoized.
  24242. * @returns {Function} Returns the new memoized function.
  24243. */
  24244. function memoizeCapped(func) {
  24245. var result = memoize(func, function(key) {
  24246. if (cache.size === MAX_MEMOIZE_SIZE) {
  24247. cache.clear();
  24248. }
  24249. return key;
  24250. });
  24251. var cache = result.cache;
  24252. return result;
  24253. }
  24254. /**
  24255. * Merges the function metadata of `source` into `data`.
  24256. *
  24257. * Merging metadata reduces the number of wrappers used to invoke a function.
  24258. * This is possible because methods like `_.bind`, `_.curry`, and `_.partial`
  24259. * may be applied regardless of execution order. Methods like `_.ary` and
  24260. * `_.rearg` modify function arguments, making the order in which they are
  24261. * executed important, preventing the merging of metadata. However, we make
  24262. * an exception for a safe combined case where curried functions have `_.ary`
  24263. * and or `_.rearg` applied.
  24264. *
  24265. * @private
  24266. * @param {Array} data The destination metadata.
  24267. * @param {Array} source The source metadata.
  24268. * @returns {Array} Returns `data`.
  24269. */
  24270. function mergeData(data, source) {
  24271. var bitmask = data[1],
  24272. srcBitmask = source[1],
  24273. newBitmask = bitmask | srcBitmask,
  24274. isCommon = newBitmask < (WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG | WRAP_ARY_FLAG);
  24275. var isCombo =
  24276. ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_CURRY_FLAG)) ||
  24277. ((srcBitmask == WRAP_ARY_FLAG) && (bitmask == WRAP_REARG_FLAG) && (data[7].length <= source[8])) ||
  24278. ((srcBitmask == (WRAP_ARY_FLAG | WRAP_REARG_FLAG)) && (source[7].length <= source[8]) && (bitmask == WRAP_CURRY_FLAG));
  24279. // Exit early if metadata can't be merged.
  24280. if (!(isCommon || isCombo)) {
  24281. return data;
  24282. }
  24283. // Use source `thisArg` if available.
  24284. if (srcBitmask & WRAP_BIND_FLAG) {
  24285. data[2] = source[2];
  24286. // Set when currying a bound function.
  24287. newBitmask |= bitmask & WRAP_BIND_FLAG ? 0 : WRAP_CURRY_BOUND_FLAG;
  24288. }
  24289. // Compose partial arguments.
  24290. var value = source[3];
  24291. if (value) {
  24292. var partials = data[3];
  24293. data[3] = partials ? composeArgs(partials, value, source[4]) : value;
  24294. data[4] = partials ? replaceHolders(data[3], PLACEHOLDER) : source[4];
  24295. }
  24296. // Compose partial right arguments.
  24297. value = source[5];
  24298. if (value) {
  24299. partials = data[5];
  24300. data[5] = partials ? composeArgsRight(partials, value, source[6]) : value;
  24301. data[6] = partials ? replaceHolders(data[5], PLACEHOLDER) : source[6];
  24302. }
  24303. // Use source `argPos` if available.
  24304. value = source[7];
  24305. if (value) {
  24306. data[7] = value;
  24307. }
  24308. // Use source `ary` if it's smaller.
  24309. if (srcBitmask & WRAP_ARY_FLAG) {
  24310. data[8] = data[8] == null ? source[8] : nativeMin(data[8], source[8]);
  24311. }
  24312. // Use source `arity` if one is not provided.
  24313. if (data[9] == null) {
  24314. data[9] = source[9];
  24315. }
  24316. // Use source `func` and merge bitmasks.
  24317. data[0] = source[0];
  24318. data[1] = newBitmask;
  24319. return data;
  24320. }
  24321. /**
  24322. * This function is like
  24323. * [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
  24324. * except that it includes inherited enumerable properties.
  24325. *
  24326. * @private
  24327. * @param {Object} object The object to query.
  24328. * @returns {Array} Returns the array of property names.
  24329. */
  24330. function nativeKeysIn(object) {
  24331. var result = [];
  24332. if (object != null) {
  24333. for (var key in Object(object)) {
  24334. result.push(key);
  24335. }
  24336. }
  24337. return result;
  24338. }
  24339. /**
  24340. * Converts `value` to a string using `Object.prototype.toString`.
  24341. *
  24342. * @private
  24343. * @param {*} value The value to convert.
  24344. * @returns {string} Returns the converted string.
  24345. */
  24346. function objectToString(value) {
  24347. return nativeObjectToString.call(value);
  24348. }
  24349. /**
  24350. * A specialized version of `baseRest` which transforms the rest array.
  24351. *
  24352. * @private
  24353. * @param {Function} func The function to apply a rest parameter to.
  24354. * @param {number} [start=func.length-1] The start position of the rest parameter.
  24355. * @param {Function} transform The rest array transform.
  24356. * @returns {Function} Returns the new function.
  24357. */
  24358. function overRest(func, start, transform) {
  24359. start = nativeMax(start === undefined ? (func.length - 1) : start, 0);
  24360. return function() {
  24361. var args = arguments,
  24362. index = -1,
  24363. length = nativeMax(args.length - start, 0),
  24364. array = Array(length);
  24365. while (++index < length) {
  24366. array[index] = args[start + index];
  24367. }
  24368. index = -1;
  24369. var otherArgs = Array(start + 1);
  24370. while (++index < start) {
  24371. otherArgs[index] = args[index];
  24372. }
  24373. otherArgs[start] = transform(array);
  24374. return apply(func, this, otherArgs);
  24375. };
  24376. }
  24377. /**
  24378. * Gets the parent value at `path` of `object`.
  24379. *
  24380. * @private
  24381. * @param {Object} object The object to query.
  24382. * @param {Array} path The path to get the parent value of.
  24383. * @returns {*} Returns the parent value.
  24384. */
  24385. function parent(object, path) {
  24386. return path.length < 2 ? object : baseGet(object, baseSlice(path, 0, -1));
  24387. }
  24388. /**
  24389. * Reorder `array` according to the specified indexes where the element at
  24390. * the first index is assigned as the first element, the element at
  24391. * the second index is assigned as the second element, and so on.
  24392. *
  24393. * @private
  24394. * @param {Array} array The array to reorder.
  24395. * @param {Array} indexes The arranged array indexes.
  24396. * @returns {Array} Returns `array`.
  24397. */
  24398. function reorder(array, indexes) {
  24399. var arrLength = array.length,
  24400. length = nativeMin(indexes.length, arrLength),
  24401. oldArray = copyArray(array);
  24402. while (length--) {
  24403. var index = indexes[length];
  24404. array[length] = isIndex(index, arrLength) ? oldArray[index] : undefined;
  24405. }
  24406. return array;
  24407. }
  24408. /**
  24409. * Gets the value at `key`, unless `key` is "__proto__" or "constructor".
  24410. *
  24411. * @private
  24412. * @param {Object} object The object to query.
  24413. * @param {string} key The key of the property to get.
  24414. * @returns {*} Returns the property value.
  24415. */
  24416. function safeGet(object, key) {
  24417. if (key === 'constructor' && typeof object[key] === 'function') {
  24418. return;
  24419. }
  24420. if (key == '__proto__') {
  24421. return;
  24422. }
  24423. return object[key];
  24424. }
  24425. /**
  24426. * Sets metadata for `func`.
  24427. *
  24428. * **Note:** If this function becomes hot, i.e. is invoked a lot in a short
  24429. * period of time, it will trip its breaker and transition to an identity
  24430. * function to avoid garbage collection pauses in V8. See
  24431. * [V8 issue 2070](https://bugs.chromium.org/p/v8/issues/detail?id=2070)
  24432. * for more details.
  24433. *
  24434. * @private
  24435. * @param {Function} func The function to associate metadata with.
  24436. * @param {*} data The metadata.
  24437. * @returns {Function} Returns `func`.
  24438. */
  24439. var setData = shortOut(baseSetData);
  24440. /**
  24441. * A simple wrapper around the global [`setTimeout`](https://mdn.io/setTimeout).
  24442. *
  24443. * @private
  24444. * @param {Function} func The function to delay.
  24445. * @param {number} wait The number of milliseconds to delay invocation.
  24446. * @returns {number|Object} Returns the timer id or timeout object.
  24447. */
  24448. var setTimeout = ctxSetTimeout || function(func, wait) {
  24449. return root.setTimeout(func, wait);
  24450. };
  24451. /**
  24452. * Sets the `toString` method of `func` to return `string`.
  24453. *
  24454. * @private
  24455. * @param {Function} func The function to modify.
  24456. * @param {Function} string The `toString` result.
  24457. * @returns {Function} Returns `func`.
  24458. */
  24459. var setToString = shortOut(baseSetToString);
  24460. /**
  24461. * Sets the `toString` method of `wrapper` to mimic the source of `reference`
  24462. * with wrapper details in a comment at the top of the source body.
  24463. *
  24464. * @private
  24465. * @param {Function} wrapper The function to modify.
  24466. * @param {Function} reference The reference function.
  24467. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  24468. * @returns {Function} Returns `wrapper`.
  24469. */
  24470. function setWrapToString(wrapper, reference, bitmask) {
  24471. var source = (reference + '');
  24472. return setToString(wrapper, insertWrapDetails(source, updateWrapDetails(getWrapDetails(source), bitmask)));
  24473. }
  24474. /**
  24475. * Creates a function that'll short out and invoke `identity` instead
  24476. * of `func` when it's called `HOT_COUNT` or more times in `HOT_SPAN`
  24477. * milliseconds.
  24478. *
  24479. * @private
  24480. * @param {Function} func The function to restrict.
  24481. * @returns {Function} Returns the new shortable function.
  24482. */
  24483. function shortOut(func) {
  24484. var count = 0,
  24485. lastCalled = 0;
  24486. return function() {
  24487. var stamp = nativeNow(),
  24488. remaining = HOT_SPAN - (stamp - lastCalled);
  24489. lastCalled = stamp;
  24490. if (remaining > 0) {
  24491. if (++count >= HOT_COUNT) {
  24492. return arguments[0];
  24493. }
  24494. } else {
  24495. count = 0;
  24496. }
  24497. return func.apply(undefined, arguments);
  24498. };
  24499. }
  24500. /**
  24501. * A specialized version of `_.shuffle` which mutates and sets the size of `array`.
  24502. *
  24503. * @private
  24504. * @param {Array} array The array to shuffle.
  24505. * @param {number} [size=array.length] The size of `array`.
  24506. * @returns {Array} Returns `array`.
  24507. */
  24508. function shuffleSelf(array, size) {
  24509. var index = -1,
  24510. length = array.length,
  24511. lastIndex = length - 1;
  24512. size = size === undefined ? length : size;
  24513. while (++index < size) {
  24514. var rand = baseRandom(index, lastIndex),
  24515. value = array[rand];
  24516. array[rand] = array[index];
  24517. array[index] = value;
  24518. }
  24519. array.length = size;
  24520. return array;
  24521. }
  24522. /**
  24523. * Converts `string` to a property path array.
  24524. *
  24525. * @private
  24526. * @param {string} string The string to convert.
  24527. * @returns {Array} Returns the property path array.
  24528. */
  24529. var stringToPath = memoizeCapped(function(string) {
  24530. var result = [];
  24531. if (string.charCodeAt(0) === 46 /* . */) {
  24532. result.push('');
  24533. }
  24534. string.replace(rePropName, function(match, number, quote, subString) {
  24535. result.push(quote ? subString.replace(reEscapeChar, '$1') : (number || match));
  24536. });
  24537. return result;
  24538. });
  24539. /**
  24540. * Converts `value` to a string key if it's not a string or symbol.
  24541. *
  24542. * @private
  24543. * @param {*} value The value to inspect.
  24544. * @returns {string|symbol} Returns the key.
  24545. */
  24546. function toKey(value) {
  24547. if (typeof value == 'string' || isSymbol(value)) {
  24548. return value;
  24549. }
  24550. var result = (value + '');
  24551. return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
  24552. }
  24553. /**
  24554. * Converts `func` to its source code.
  24555. *
  24556. * @private
  24557. * @param {Function} func The function to convert.
  24558. * @returns {string} Returns the source code.
  24559. */
  24560. function toSource(func) {
  24561. if (func != null) {
  24562. try {
  24563. return funcToString.call(func);
  24564. } catch (e) {}
  24565. try {
  24566. return (func + '');
  24567. } catch (e) {}
  24568. }
  24569. return '';
  24570. }
  24571. /**
  24572. * Updates wrapper `details` based on `bitmask` flags.
  24573. *
  24574. * @private
  24575. * @returns {Array} details The details to modify.
  24576. * @param {number} bitmask The bitmask flags. See `createWrap` for more details.
  24577. * @returns {Array} Returns `details`.
  24578. */
  24579. function updateWrapDetails(details, bitmask) {
  24580. arrayEach(wrapFlags, function(pair) {
  24581. var value = '_.' + pair[0];
  24582. if ((bitmask & pair[1]) && !arrayIncludes(details, value)) {
  24583. details.push(value);
  24584. }
  24585. });
  24586. return details.sort();
  24587. }
  24588. /**
  24589. * Creates a clone of `wrapper`.
  24590. *
  24591. * @private
  24592. * @param {Object} wrapper The wrapper to clone.
  24593. * @returns {Object} Returns the cloned wrapper.
  24594. */
  24595. function wrapperClone(wrapper) {
  24596. if (wrapper instanceof LazyWrapper) {
  24597. return wrapper.clone();
  24598. }
  24599. var result = new LodashWrapper(wrapper.__wrapped__, wrapper.__chain__);
  24600. result.__actions__ = copyArray(wrapper.__actions__);
  24601. result.__index__ = wrapper.__index__;
  24602. result.__values__ = wrapper.__values__;
  24603. return result;
  24604. }
  24605. /*------------------------------------------------------------------------*/
  24606. /**
  24607. * Creates an array of elements split into groups the length of `size`.
  24608. * If `array` can't be split evenly, the final chunk will be the remaining
  24609. * elements.
  24610. *
  24611. * @static
  24612. * @memberOf _
  24613. * @since 3.0.0
  24614. * @category Array
  24615. * @param {Array} array The array to process.
  24616. * @param {number} [size=1] The length of each chunk
  24617. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  24618. * @returns {Array} Returns the new array of chunks.
  24619. * @example
  24620. *
  24621. * _.chunk(['a', 'b', 'c', 'd'], 2);
  24622. * // => [['a', 'b'], ['c', 'd']]
  24623. *
  24624. * _.chunk(['a', 'b', 'c', 'd'], 3);
  24625. * // => [['a', 'b', 'c'], ['d']]
  24626. */
  24627. function chunk(array, size, guard) {
  24628. if ((guard ? isIterateeCall(array, size, guard) : size === undefined)) {
  24629. size = 1;
  24630. } else {
  24631. size = nativeMax(toInteger(size), 0);
  24632. }
  24633. var length = array == null ? 0 : array.length;
  24634. if (!length || size < 1) {
  24635. return [];
  24636. }
  24637. var index = 0,
  24638. resIndex = 0,
  24639. result = Array(nativeCeil(length / size));
  24640. while (index < length) {
  24641. result[resIndex++] = baseSlice(array, index, (index += size));
  24642. }
  24643. return result;
  24644. }
  24645. /**
  24646. * Creates an array with all falsey values removed. The values `false`, `null`,
  24647. * `0`, `""`, `undefined`, and `NaN` are falsey.
  24648. *
  24649. * @static
  24650. * @memberOf _
  24651. * @since 0.1.0
  24652. * @category Array
  24653. * @param {Array} array The array to compact.
  24654. * @returns {Array} Returns the new array of filtered values.
  24655. * @example
  24656. *
  24657. * _.compact([0, 1, false, 2, '', 3]);
  24658. * // => [1, 2, 3]
  24659. */
  24660. function compact(array) {
  24661. var index = -1,
  24662. length = array == null ? 0 : array.length,
  24663. resIndex = 0,
  24664. result = [];
  24665. while (++index < length) {
  24666. var value = array[index];
  24667. if (value) {
  24668. result[resIndex++] = value;
  24669. }
  24670. }
  24671. return result;
  24672. }
  24673. /**
  24674. * Creates a new array concatenating `array` with any additional arrays
  24675. * and/or values.
  24676. *
  24677. * @static
  24678. * @memberOf _
  24679. * @since 4.0.0
  24680. * @category Array
  24681. * @param {Array} array The array to concatenate.
  24682. * @param {...*} [values] The values to concatenate.
  24683. * @returns {Array} Returns the new concatenated array.
  24684. * @example
  24685. *
  24686. * var array = [1];
  24687. * var other = _.concat(array, 2, [3], [[4]]);
  24688. *
  24689. * console.log(other);
  24690. * // => [1, 2, 3, [4]]
  24691. *
  24692. * console.log(array);
  24693. * // => [1]
  24694. */
  24695. function concat() {
  24696. var length = arguments.length;
  24697. if (!length) {
  24698. return [];
  24699. }
  24700. var args = Array(length - 1),
  24701. array = arguments[0],
  24702. index = length;
  24703. while (index--) {
  24704. args[index - 1] = arguments[index];
  24705. }
  24706. return arrayPush(isArray(array) ? copyArray(array) : [array], baseFlatten(args, 1));
  24707. }
  24708. /**
  24709. * Creates an array of `array` values not included in the other given arrays
  24710. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  24711. * for equality comparisons. The order and references of result values are
  24712. * determined by the first array.
  24713. *
  24714. * **Note:** Unlike `_.pullAll`, this method returns a new array.
  24715. *
  24716. * @static
  24717. * @memberOf _
  24718. * @since 0.1.0
  24719. * @category Array
  24720. * @param {Array} array The array to inspect.
  24721. * @param {...Array} [values] The values to exclude.
  24722. * @returns {Array} Returns the new array of filtered values.
  24723. * @see _.without, _.xor
  24724. * @example
  24725. *
  24726. * _.difference([2, 1], [2, 3]);
  24727. * // => [1]
  24728. */
  24729. var difference = baseRest(function(array, values) {
  24730. return isArrayLikeObject(array)
  24731. ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true))
  24732. : [];
  24733. });
  24734. /**
  24735. * This method is like `_.difference` except that it accepts `iteratee` which
  24736. * is invoked for each element of `array` and `values` to generate the criterion
  24737. * by which they're compared. The order and references of result values are
  24738. * determined by the first array. The iteratee is invoked with one argument:
  24739. * (value).
  24740. *
  24741. * **Note:** Unlike `_.pullAllBy`, this method returns a new array.
  24742. *
  24743. * @static
  24744. * @memberOf _
  24745. * @since 4.0.0
  24746. * @category Array
  24747. * @param {Array} array The array to inspect.
  24748. * @param {...Array} [values] The values to exclude.
  24749. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  24750. * @returns {Array} Returns the new array of filtered values.
  24751. * @example
  24752. *
  24753. * _.differenceBy([2.1, 1.2], [2.3, 3.4], Math.floor);
  24754. * // => [1.2]
  24755. *
  24756. * // The `_.property` iteratee shorthand.
  24757. * _.differenceBy([{ 'x': 2 }, { 'x': 1 }], [{ 'x': 1 }], 'x');
  24758. * // => [{ 'x': 2 }]
  24759. */
  24760. var differenceBy = baseRest(function(array, values) {
  24761. var iteratee = last(values);
  24762. if (isArrayLikeObject(iteratee)) {
  24763. iteratee = undefined;
  24764. }
  24765. return isArrayLikeObject(array)
  24766. ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), getIteratee(iteratee, 2))
  24767. : [];
  24768. });
  24769. /**
  24770. * This method is like `_.difference` except that it accepts `comparator`
  24771. * which is invoked to compare elements of `array` to `values`. The order and
  24772. * references of result values are determined by the first array. The comparator
  24773. * is invoked with two arguments: (arrVal, othVal).
  24774. *
  24775. * **Note:** Unlike `_.pullAllWith`, this method returns a new array.
  24776. *
  24777. * @static
  24778. * @memberOf _
  24779. * @since 4.0.0
  24780. * @category Array
  24781. * @param {Array} array The array to inspect.
  24782. * @param {...Array} [values] The values to exclude.
  24783. * @param {Function} [comparator] The comparator invoked per element.
  24784. * @returns {Array} Returns the new array of filtered values.
  24785. * @example
  24786. *
  24787. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  24788. *
  24789. * _.differenceWith(objects, [{ 'x': 1, 'y': 2 }], _.isEqual);
  24790. * // => [{ 'x': 2, 'y': 1 }]
  24791. */
  24792. var differenceWith = baseRest(function(array, values) {
  24793. var comparator = last(values);
  24794. if (isArrayLikeObject(comparator)) {
  24795. comparator = undefined;
  24796. }
  24797. return isArrayLikeObject(array)
  24798. ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), undefined, comparator)
  24799. : [];
  24800. });
  24801. /**
  24802. * Creates a slice of `array` with `n` elements dropped from the beginning.
  24803. *
  24804. * @static
  24805. * @memberOf _
  24806. * @since 0.5.0
  24807. * @category Array
  24808. * @param {Array} array The array to query.
  24809. * @param {number} [n=1] The number of elements to drop.
  24810. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  24811. * @returns {Array} Returns the slice of `array`.
  24812. * @example
  24813. *
  24814. * _.drop([1, 2, 3]);
  24815. * // => [2, 3]
  24816. *
  24817. * _.drop([1, 2, 3], 2);
  24818. * // => [3]
  24819. *
  24820. * _.drop([1, 2, 3], 5);
  24821. * // => []
  24822. *
  24823. * _.drop([1, 2, 3], 0);
  24824. * // => [1, 2, 3]
  24825. */
  24826. function drop(array, n, guard) {
  24827. var length = array == null ? 0 : array.length;
  24828. if (!length) {
  24829. return [];
  24830. }
  24831. n = (guard || n === undefined) ? 1 : toInteger(n);
  24832. return baseSlice(array, n < 0 ? 0 : n, length);
  24833. }
  24834. /**
  24835. * Creates a slice of `array` with `n` elements dropped from the end.
  24836. *
  24837. * @static
  24838. * @memberOf _
  24839. * @since 3.0.0
  24840. * @category Array
  24841. * @param {Array} array The array to query.
  24842. * @param {number} [n=1] The number of elements to drop.
  24843. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  24844. * @returns {Array} Returns the slice of `array`.
  24845. * @example
  24846. *
  24847. * _.dropRight([1, 2, 3]);
  24848. * // => [1, 2]
  24849. *
  24850. * _.dropRight([1, 2, 3], 2);
  24851. * // => [1]
  24852. *
  24853. * _.dropRight([1, 2, 3], 5);
  24854. * // => []
  24855. *
  24856. * _.dropRight([1, 2, 3], 0);
  24857. * // => [1, 2, 3]
  24858. */
  24859. function dropRight(array, n, guard) {
  24860. var length = array == null ? 0 : array.length;
  24861. if (!length) {
  24862. return [];
  24863. }
  24864. n = (guard || n === undefined) ? 1 : toInteger(n);
  24865. n = length - n;
  24866. return baseSlice(array, 0, n < 0 ? 0 : n);
  24867. }
  24868. /**
  24869. * Creates a slice of `array` excluding elements dropped from the end.
  24870. * Elements are dropped until `predicate` returns falsey. The predicate is
  24871. * invoked with three arguments: (value, index, array).
  24872. *
  24873. * @static
  24874. * @memberOf _
  24875. * @since 3.0.0
  24876. * @category Array
  24877. * @param {Array} array The array to query.
  24878. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  24879. * @returns {Array} Returns the slice of `array`.
  24880. * @example
  24881. *
  24882. * var users = [
  24883. * { 'user': 'barney', 'active': true },
  24884. * { 'user': 'fred', 'active': false },
  24885. * { 'user': 'pebbles', 'active': false }
  24886. * ];
  24887. *
  24888. * _.dropRightWhile(users, function(o) { return !o.active; });
  24889. * // => objects for ['barney']
  24890. *
  24891. * // The `_.matches` iteratee shorthand.
  24892. * _.dropRightWhile(users, { 'user': 'pebbles', 'active': false });
  24893. * // => objects for ['barney', 'fred']
  24894. *
  24895. * // The `_.matchesProperty` iteratee shorthand.
  24896. * _.dropRightWhile(users, ['active', false]);
  24897. * // => objects for ['barney']
  24898. *
  24899. * // The `_.property` iteratee shorthand.
  24900. * _.dropRightWhile(users, 'active');
  24901. * // => objects for ['barney', 'fred', 'pebbles']
  24902. */
  24903. function dropRightWhile(array, predicate) {
  24904. return (array && array.length)
  24905. ? baseWhile(array, getIteratee(predicate, 3), true, true)
  24906. : [];
  24907. }
  24908. /**
  24909. * Creates a slice of `array` excluding elements dropped from the beginning.
  24910. * Elements are dropped until `predicate` returns falsey. The predicate is
  24911. * invoked with three arguments: (value, index, array).
  24912. *
  24913. * @static
  24914. * @memberOf _
  24915. * @since 3.0.0
  24916. * @category Array
  24917. * @param {Array} array The array to query.
  24918. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  24919. * @returns {Array} Returns the slice of `array`.
  24920. * @example
  24921. *
  24922. * var users = [
  24923. * { 'user': 'barney', 'active': false },
  24924. * { 'user': 'fred', 'active': false },
  24925. * { 'user': 'pebbles', 'active': true }
  24926. * ];
  24927. *
  24928. * _.dropWhile(users, function(o) { return !o.active; });
  24929. * // => objects for ['pebbles']
  24930. *
  24931. * // The `_.matches` iteratee shorthand.
  24932. * _.dropWhile(users, { 'user': 'barney', 'active': false });
  24933. * // => objects for ['fred', 'pebbles']
  24934. *
  24935. * // The `_.matchesProperty` iteratee shorthand.
  24936. * _.dropWhile(users, ['active', false]);
  24937. * // => objects for ['pebbles']
  24938. *
  24939. * // The `_.property` iteratee shorthand.
  24940. * _.dropWhile(users, 'active');
  24941. * // => objects for ['barney', 'fred', 'pebbles']
  24942. */
  24943. function dropWhile(array, predicate) {
  24944. return (array && array.length)
  24945. ? baseWhile(array, getIteratee(predicate, 3), true)
  24946. : [];
  24947. }
  24948. /**
  24949. * Fills elements of `array` with `value` from `start` up to, but not
  24950. * including, `end`.
  24951. *
  24952. * **Note:** This method mutates `array`.
  24953. *
  24954. * @static
  24955. * @memberOf _
  24956. * @since 3.2.0
  24957. * @category Array
  24958. * @param {Array} array The array to fill.
  24959. * @param {*} value The value to fill `array` with.
  24960. * @param {number} [start=0] The start position.
  24961. * @param {number} [end=array.length] The end position.
  24962. * @returns {Array} Returns `array`.
  24963. * @example
  24964. *
  24965. * var array = [1, 2, 3];
  24966. *
  24967. * _.fill(array, 'a');
  24968. * console.log(array);
  24969. * // => ['a', 'a', 'a']
  24970. *
  24971. * _.fill(Array(3), 2);
  24972. * // => [2, 2, 2]
  24973. *
  24974. * _.fill([4, 6, 8, 10], '*', 1, 3);
  24975. * // => [4, '*', '*', 10]
  24976. */
  24977. function fill(array, value, start, end) {
  24978. var length = array == null ? 0 : array.length;
  24979. if (!length) {
  24980. return [];
  24981. }
  24982. if (start && typeof start != 'number' && isIterateeCall(array, value, start)) {
  24983. start = 0;
  24984. end = length;
  24985. }
  24986. return baseFill(array, value, start, end);
  24987. }
  24988. /**
  24989. * This method is like `_.find` except that it returns the index of the first
  24990. * element `predicate` returns truthy for instead of the element itself.
  24991. *
  24992. * @static
  24993. * @memberOf _
  24994. * @since 1.1.0
  24995. * @category Array
  24996. * @param {Array} array The array to inspect.
  24997. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  24998. * @param {number} [fromIndex=0] The index to search from.
  24999. * @returns {number} Returns the index of the found element, else `-1`.
  25000. * @example
  25001. *
  25002. * var users = [
  25003. * { 'user': 'barney', 'active': false },
  25004. * { 'user': 'fred', 'active': false },
  25005. * { 'user': 'pebbles', 'active': true }
  25006. * ];
  25007. *
  25008. * _.findIndex(users, function(o) { return o.user == 'barney'; });
  25009. * // => 0
  25010. *
  25011. * // The `_.matches` iteratee shorthand.
  25012. * _.findIndex(users, { 'user': 'fred', 'active': false });
  25013. * // => 1
  25014. *
  25015. * // The `_.matchesProperty` iteratee shorthand.
  25016. * _.findIndex(users, ['active', false]);
  25017. * // => 0
  25018. *
  25019. * // The `_.property` iteratee shorthand.
  25020. * _.findIndex(users, 'active');
  25021. * // => 2
  25022. */
  25023. function findIndex(array, predicate, fromIndex) {
  25024. var length = array == null ? 0 : array.length;
  25025. if (!length) {
  25026. return -1;
  25027. }
  25028. var index = fromIndex == null ? 0 : toInteger(fromIndex);
  25029. if (index < 0) {
  25030. index = nativeMax(length + index, 0);
  25031. }
  25032. return baseFindIndex(array, getIteratee(predicate, 3), index);
  25033. }
  25034. /**
  25035. * This method is like `_.findIndex` except that it iterates over elements
  25036. * of `collection` from right to left.
  25037. *
  25038. * @static
  25039. * @memberOf _
  25040. * @since 2.0.0
  25041. * @category Array
  25042. * @param {Array} array The array to inspect.
  25043. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  25044. * @param {number} [fromIndex=array.length-1] The index to search from.
  25045. * @returns {number} Returns the index of the found element, else `-1`.
  25046. * @example
  25047. *
  25048. * var users = [
  25049. * { 'user': 'barney', 'active': true },
  25050. * { 'user': 'fred', 'active': false },
  25051. * { 'user': 'pebbles', 'active': false }
  25052. * ];
  25053. *
  25054. * _.findLastIndex(users, function(o) { return o.user == 'pebbles'; });
  25055. * // => 2
  25056. *
  25057. * // The `_.matches` iteratee shorthand.
  25058. * _.findLastIndex(users, { 'user': 'barney', 'active': true });
  25059. * // => 0
  25060. *
  25061. * // The `_.matchesProperty` iteratee shorthand.
  25062. * _.findLastIndex(users, ['active', false]);
  25063. * // => 2
  25064. *
  25065. * // The `_.property` iteratee shorthand.
  25066. * _.findLastIndex(users, 'active');
  25067. * // => 0
  25068. */
  25069. function findLastIndex(array, predicate, fromIndex) {
  25070. var length = array == null ? 0 : array.length;
  25071. if (!length) {
  25072. return -1;
  25073. }
  25074. var index = length - 1;
  25075. if (fromIndex !== undefined) {
  25076. index = toInteger(fromIndex);
  25077. index = fromIndex < 0
  25078. ? nativeMax(length + index, 0)
  25079. : nativeMin(index, length - 1);
  25080. }
  25081. return baseFindIndex(array, getIteratee(predicate, 3), index, true);
  25082. }
  25083. /**
  25084. * Flattens `array` a single level deep.
  25085. *
  25086. * @static
  25087. * @memberOf _
  25088. * @since 0.1.0
  25089. * @category Array
  25090. * @param {Array} array The array to flatten.
  25091. * @returns {Array} Returns the new flattened array.
  25092. * @example
  25093. *
  25094. * _.flatten([1, [2, [3, [4]], 5]]);
  25095. * // => [1, 2, [3, [4]], 5]
  25096. */
  25097. function flatten(array) {
  25098. var length = array == null ? 0 : array.length;
  25099. return length ? baseFlatten(array, 1) : [];
  25100. }
  25101. /**
  25102. * Recursively flattens `array`.
  25103. *
  25104. * @static
  25105. * @memberOf _
  25106. * @since 3.0.0
  25107. * @category Array
  25108. * @param {Array} array The array to flatten.
  25109. * @returns {Array} Returns the new flattened array.
  25110. * @example
  25111. *
  25112. * _.flattenDeep([1, [2, [3, [4]], 5]]);
  25113. * // => [1, 2, 3, 4, 5]
  25114. */
  25115. function flattenDeep(array) {
  25116. var length = array == null ? 0 : array.length;
  25117. return length ? baseFlatten(array, INFINITY) : [];
  25118. }
  25119. /**
  25120. * Recursively flatten `array` up to `depth` times.
  25121. *
  25122. * @static
  25123. * @memberOf _
  25124. * @since 4.4.0
  25125. * @category Array
  25126. * @param {Array} array The array to flatten.
  25127. * @param {number} [depth=1] The maximum recursion depth.
  25128. * @returns {Array} Returns the new flattened array.
  25129. * @example
  25130. *
  25131. * var array = [1, [2, [3, [4]], 5]];
  25132. *
  25133. * _.flattenDepth(array, 1);
  25134. * // => [1, 2, [3, [4]], 5]
  25135. *
  25136. * _.flattenDepth(array, 2);
  25137. * // => [1, 2, 3, [4], 5]
  25138. */
  25139. function flattenDepth(array, depth) {
  25140. var length = array == null ? 0 : array.length;
  25141. if (!length) {
  25142. return [];
  25143. }
  25144. depth = depth === undefined ? 1 : toInteger(depth);
  25145. return baseFlatten(array, depth);
  25146. }
  25147. /**
  25148. * The inverse of `_.toPairs`; this method returns an object composed
  25149. * from key-value `pairs`.
  25150. *
  25151. * @static
  25152. * @memberOf _
  25153. * @since 4.0.0
  25154. * @category Array
  25155. * @param {Array} pairs The key-value pairs.
  25156. * @returns {Object} Returns the new object.
  25157. * @example
  25158. *
  25159. * _.fromPairs([['a', 1], ['b', 2]]);
  25160. * // => { 'a': 1, 'b': 2 }
  25161. */
  25162. function fromPairs(pairs) {
  25163. var index = -1,
  25164. length = pairs == null ? 0 : pairs.length,
  25165. result = {};
  25166. while (++index < length) {
  25167. var pair = pairs[index];
  25168. result[pair[0]] = pair[1];
  25169. }
  25170. return result;
  25171. }
  25172. /**
  25173. * Gets the first element of `array`.
  25174. *
  25175. * @static
  25176. * @memberOf _
  25177. * @since 0.1.0
  25178. * @alias first
  25179. * @category Array
  25180. * @param {Array} array The array to query.
  25181. * @returns {*} Returns the first element of `array`.
  25182. * @example
  25183. *
  25184. * _.head([1, 2, 3]);
  25185. * // => 1
  25186. *
  25187. * _.head([]);
  25188. * // => undefined
  25189. */
  25190. function head(array) {
  25191. return (array && array.length) ? array[0] : undefined;
  25192. }
  25193. /**
  25194. * Gets the index at which the first occurrence of `value` is found in `array`
  25195. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  25196. * for equality comparisons. If `fromIndex` is negative, it's used as the
  25197. * offset from the end of `array`.
  25198. *
  25199. * @static
  25200. * @memberOf _
  25201. * @since 0.1.0
  25202. * @category Array
  25203. * @param {Array} array The array to inspect.
  25204. * @param {*} value The value to search for.
  25205. * @param {number} [fromIndex=0] The index to search from.
  25206. * @returns {number} Returns the index of the matched value, else `-1`.
  25207. * @example
  25208. *
  25209. * _.indexOf([1, 2, 1, 2], 2);
  25210. * // => 1
  25211. *
  25212. * // Search from the `fromIndex`.
  25213. * _.indexOf([1, 2, 1, 2], 2, 2);
  25214. * // => 3
  25215. */
  25216. function indexOf(array, value, fromIndex) {
  25217. var length = array == null ? 0 : array.length;
  25218. if (!length) {
  25219. return -1;
  25220. }
  25221. var index = fromIndex == null ? 0 : toInteger(fromIndex);
  25222. if (index < 0) {
  25223. index = nativeMax(length + index, 0);
  25224. }
  25225. return baseIndexOf(array, value, index);
  25226. }
  25227. /**
  25228. * Gets all but the last element of `array`.
  25229. *
  25230. * @static
  25231. * @memberOf _
  25232. * @since 0.1.0
  25233. * @category Array
  25234. * @param {Array} array The array to query.
  25235. * @returns {Array} Returns the slice of `array`.
  25236. * @example
  25237. *
  25238. * _.initial([1, 2, 3]);
  25239. * // => [1, 2]
  25240. */
  25241. function initial(array) {
  25242. var length = array == null ? 0 : array.length;
  25243. return length ? baseSlice(array, 0, -1) : [];
  25244. }
  25245. /**
  25246. * Creates an array of unique values that are included in all given arrays
  25247. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  25248. * for equality comparisons. The order and references of result values are
  25249. * determined by the first array.
  25250. *
  25251. * @static
  25252. * @memberOf _
  25253. * @since 0.1.0
  25254. * @category Array
  25255. * @param {...Array} [arrays] The arrays to inspect.
  25256. * @returns {Array} Returns the new array of intersecting values.
  25257. * @example
  25258. *
  25259. * _.intersection([2, 1], [2, 3]);
  25260. * // => [2]
  25261. */
  25262. var intersection = baseRest(function(arrays) {
  25263. var mapped = arrayMap(arrays, castArrayLikeObject);
  25264. return (mapped.length && mapped[0] === arrays[0])
  25265. ? baseIntersection(mapped)
  25266. : [];
  25267. });
  25268. /**
  25269. * This method is like `_.intersection` except that it accepts `iteratee`
  25270. * which is invoked for each element of each `arrays` to generate the criterion
  25271. * by which they're compared. The order and references of result values are
  25272. * determined by the first array. The iteratee is invoked with one argument:
  25273. * (value).
  25274. *
  25275. * @static
  25276. * @memberOf _
  25277. * @since 4.0.0
  25278. * @category Array
  25279. * @param {...Array} [arrays] The arrays to inspect.
  25280. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  25281. * @returns {Array} Returns the new array of intersecting values.
  25282. * @example
  25283. *
  25284. * _.intersectionBy([2.1, 1.2], [2.3, 3.4], Math.floor);
  25285. * // => [2.1]
  25286. *
  25287. * // The `_.property` iteratee shorthand.
  25288. * _.intersectionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
  25289. * // => [{ 'x': 1 }]
  25290. */
  25291. var intersectionBy = baseRest(function(arrays) {
  25292. var iteratee = last(arrays),
  25293. mapped = arrayMap(arrays, castArrayLikeObject);
  25294. if (iteratee === last(mapped)) {
  25295. iteratee = undefined;
  25296. } else {
  25297. mapped.pop();
  25298. }
  25299. return (mapped.length && mapped[0] === arrays[0])
  25300. ? baseIntersection(mapped, getIteratee(iteratee, 2))
  25301. : [];
  25302. });
  25303. /**
  25304. * This method is like `_.intersection` except that it accepts `comparator`
  25305. * which is invoked to compare elements of `arrays`. The order and references
  25306. * of result values are determined by the first array. The comparator is
  25307. * invoked with two arguments: (arrVal, othVal).
  25308. *
  25309. * @static
  25310. * @memberOf _
  25311. * @since 4.0.0
  25312. * @category Array
  25313. * @param {...Array} [arrays] The arrays to inspect.
  25314. * @param {Function} [comparator] The comparator invoked per element.
  25315. * @returns {Array} Returns the new array of intersecting values.
  25316. * @example
  25317. *
  25318. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  25319. * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
  25320. *
  25321. * _.intersectionWith(objects, others, _.isEqual);
  25322. * // => [{ 'x': 1, 'y': 2 }]
  25323. */
  25324. var intersectionWith = baseRest(function(arrays) {
  25325. var comparator = last(arrays),
  25326. mapped = arrayMap(arrays, castArrayLikeObject);
  25327. comparator = typeof comparator == 'function' ? comparator : undefined;
  25328. if (comparator) {
  25329. mapped.pop();
  25330. }
  25331. return (mapped.length && mapped[0] === arrays[0])
  25332. ? baseIntersection(mapped, undefined, comparator)
  25333. : [];
  25334. });
  25335. /**
  25336. * Converts all elements in `array` into a string separated by `separator`.
  25337. *
  25338. * @static
  25339. * @memberOf _
  25340. * @since 4.0.0
  25341. * @category Array
  25342. * @param {Array} array The array to convert.
  25343. * @param {string} [separator=','] The element separator.
  25344. * @returns {string} Returns the joined string.
  25345. * @example
  25346. *
  25347. * _.join(['a', 'b', 'c'], '~');
  25348. * // => 'a~b~c'
  25349. */
  25350. function join(array, separator) {
  25351. return array == null ? '' : nativeJoin.call(array, separator);
  25352. }
  25353. /**
  25354. * Gets the last element of `array`.
  25355. *
  25356. * @static
  25357. * @memberOf _
  25358. * @since 0.1.0
  25359. * @category Array
  25360. * @param {Array} array The array to query.
  25361. * @returns {*} Returns the last element of `array`.
  25362. * @example
  25363. *
  25364. * _.last([1, 2, 3]);
  25365. * // => 3
  25366. */
  25367. function last(array) {
  25368. var length = array == null ? 0 : array.length;
  25369. return length ? array[length - 1] : undefined;
  25370. }
  25371. /**
  25372. * This method is like `_.indexOf` except that it iterates over elements of
  25373. * `array` from right to left.
  25374. *
  25375. * @static
  25376. * @memberOf _
  25377. * @since 0.1.0
  25378. * @category Array
  25379. * @param {Array} array The array to inspect.
  25380. * @param {*} value The value to search for.
  25381. * @param {number} [fromIndex=array.length-1] The index to search from.
  25382. * @returns {number} Returns the index of the matched value, else `-1`.
  25383. * @example
  25384. *
  25385. * _.lastIndexOf([1, 2, 1, 2], 2);
  25386. * // => 3
  25387. *
  25388. * // Search from the `fromIndex`.
  25389. * _.lastIndexOf([1, 2, 1, 2], 2, 2);
  25390. * // => 1
  25391. */
  25392. function lastIndexOf(array, value, fromIndex) {
  25393. var length = array == null ? 0 : array.length;
  25394. if (!length) {
  25395. return -1;
  25396. }
  25397. var index = length;
  25398. if (fromIndex !== undefined) {
  25399. index = toInteger(fromIndex);
  25400. index = index < 0 ? nativeMax(length + index, 0) : nativeMin(index, length - 1);
  25401. }
  25402. return value === value
  25403. ? strictLastIndexOf(array, value, index)
  25404. : baseFindIndex(array, baseIsNaN, index, true);
  25405. }
  25406. /**
  25407. * Gets the element at index `n` of `array`. If `n` is negative, the nth
  25408. * element from the end is returned.
  25409. *
  25410. * @static
  25411. * @memberOf _
  25412. * @since 4.11.0
  25413. * @category Array
  25414. * @param {Array} array The array to query.
  25415. * @param {number} [n=0] The index of the element to return.
  25416. * @returns {*} Returns the nth element of `array`.
  25417. * @example
  25418. *
  25419. * var array = ['a', 'b', 'c', 'd'];
  25420. *
  25421. * _.nth(array, 1);
  25422. * // => 'b'
  25423. *
  25424. * _.nth(array, -2);
  25425. * // => 'c';
  25426. */
  25427. function nth(array, n) {
  25428. return (array && array.length) ? baseNth(array, toInteger(n)) : undefined;
  25429. }
  25430. /**
  25431. * Removes all given values from `array` using
  25432. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  25433. * for equality comparisons.
  25434. *
  25435. * **Note:** Unlike `_.without`, this method mutates `array`. Use `_.remove`
  25436. * to remove elements from an array by predicate.
  25437. *
  25438. * @static
  25439. * @memberOf _
  25440. * @since 2.0.0
  25441. * @category Array
  25442. * @param {Array} array The array to modify.
  25443. * @param {...*} [values] The values to remove.
  25444. * @returns {Array} Returns `array`.
  25445. * @example
  25446. *
  25447. * var array = ['a', 'b', 'c', 'a', 'b', 'c'];
  25448. *
  25449. * _.pull(array, 'a', 'c');
  25450. * console.log(array);
  25451. * // => ['b', 'b']
  25452. */
  25453. var pull = baseRest(pullAll);
  25454. /**
  25455. * This method is like `_.pull` except that it accepts an array of values to remove.
  25456. *
  25457. * **Note:** Unlike `_.difference`, this method mutates `array`.
  25458. *
  25459. * @static
  25460. * @memberOf _
  25461. * @since 4.0.0
  25462. * @category Array
  25463. * @param {Array} array The array to modify.
  25464. * @param {Array} values The values to remove.
  25465. * @returns {Array} Returns `array`.
  25466. * @example
  25467. *
  25468. * var array = ['a', 'b', 'c', 'a', 'b', 'c'];
  25469. *
  25470. * _.pullAll(array, ['a', 'c']);
  25471. * console.log(array);
  25472. * // => ['b', 'b']
  25473. */
  25474. function pullAll(array, values) {
  25475. return (array && array.length && values && values.length)
  25476. ? basePullAll(array, values)
  25477. : array;
  25478. }
  25479. /**
  25480. * This method is like `_.pullAll` except that it accepts `iteratee` which is
  25481. * invoked for each element of `array` and `values` to generate the criterion
  25482. * by which they're compared. The iteratee is invoked with one argument: (value).
  25483. *
  25484. * **Note:** Unlike `_.differenceBy`, this method mutates `array`.
  25485. *
  25486. * @static
  25487. * @memberOf _
  25488. * @since 4.0.0
  25489. * @category Array
  25490. * @param {Array} array The array to modify.
  25491. * @param {Array} values The values to remove.
  25492. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  25493. * @returns {Array} Returns `array`.
  25494. * @example
  25495. *
  25496. * var array = [{ 'x': 1 }, { 'x': 2 }, { 'x': 3 }, { 'x': 1 }];
  25497. *
  25498. * _.pullAllBy(array, [{ 'x': 1 }, { 'x': 3 }], 'x');
  25499. * console.log(array);
  25500. * // => [{ 'x': 2 }]
  25501. */
  25502. function pullAllBy(array, values, iteratee) {
  25503. return (array && array.length && values && values.length)
  25504. ? basePullAll(array, values, getIteratee(iteratee, 2))
  25505. : array;
  25506. }
  25507. /**
  25508. * This method is like `_.pullAll` except that it accepts `comparator` which
  25509. * is invoked to compare elements of `array` to `values`. The comparator is
  25510. * invoked with two arguments: (arrVal, othVal).
  25511. *
  25512. * **Note:** Unlike `_.differenceWith`, this method mutates `array`.
  25513. *
  25514. * @static
  25515. * @memberOf _
  25516. * @since 4.6.0
  25517. * @category Array
  25518. * @param {Array} array The array to modify.
  25519. * @param {Array} values The values to remove.
  25520. * @param {Function} [comparator] The comparator invoked per element.
  25521. * @returns {Array} Returns `array`.
  25522. * @example
  25523. *
  25524. * var array = [{ 'x': 1, 'y': 2 }, { 'x': 3, 'y': 4 }, { 'x': 5, 'y': 6 }];
  25525. *
  25526. * _.pullAllWith(array, [{ 'x': 3, 'y': 4 }], _.isEqual);
  25527. * console.log(array);
  25528. * // => [{ 'x': 1, 'y': 2 }, { 'x': 5, 'y': 6 }]
  25529. */
  25530. function pullAllWith(array, values, comparator) {
  25531. return (array && array.length && values && values.length)
  25532. ? basePullAll(array, values, undefined, comparator)
  25533. : array;
  25534. }
  25535. /**
  25536. * Removes elements from `array` corresponding to `indexes` and returns an
  25537. * array of removed elements.
  25538. *
  25539. * **Note:** Unlike `_.at`, this method mutates `array`.
  25540. *
  25541. * @static
  25542. * @memberOf _
  25543. * @since 3.0.0
  25544. * @category Array
  25545. * @param {Array} array The array to modify.
  25546. * @param {...(number|number[])} [indexes] The indexes of elements to remove.
  25547. * @returns {Array} Returns the new array of removed elements.
  25548. * @example
  25549. *
  25550. * var array = ['a', 'b', 'c', 'd'];
  25551. * var pulled = _.pullAt(array, [1, 3]);
  25552. *
  25553. * console.log(array);
  25554. * // => ['a', 'c']
  25555. *
  25556. * console.log(pulled);
  25557. * // => ['b', 'd']
  25558. */
  25559. var pullAt = flatRest(function(array, indexes) {
  25560. var length = array == null ? 0 : array.length,
  25561. result = baseAt(array, indexes);
  25562. basePullAt(array, arrayMap(indexes, function(index) {
  25563. return isIndex(index, length) ? +index : index;
  25564. }).sort(compareAscending));
  25565. return result;
  25566. });
  25567. /**
  25568. * Removes all elements from `array` that `predicate` returns truthy for
  25569. * and returns an array of the removed elements. The predicate is invoked
  25570. * with three arguments: (value, index, array).
  25571. *
  25572. * **Note:** Unlike `_.filter`, this method mutates `array`. Use `_.pull`
  25573. * to pull elements from an array by value.
  25574. *
  25575. * @static
  25576. * @memberOf _
  25577. * @since 2.0.0
  25578. * @category Array
  25579. * @param {Array} array The array to modify.
  25580. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  25581. * @returns {Array} Returns the new array of removed elements.
  25582. * @example
  25583. *
  25584. * var array = [1, 2, 3, 4];
  25585. * var evens = _.remove(array, function(n) {
  25586. * return n % 2 == 0;
  25587. * });
  25588. *
  25589. * console.log(array);
  25590. * // => [1, 3]
  25591. *
  25592. * console.log(evens);
  25593. * // => [2, 4]
  25594. */
  25595. function remove(array, predicate) {
  25596. var result = [];
  25597. if (!(array && array.length)) {
  25598. return result;
  25599. }
  25600. var index = -1,
  25601. indexes = [],
  25602. length = array.length;
  25603. predicate = getIteratee(predicate, 3);
  25604. while (++index < length) {
  25605. var value = array[index];
  25606. if (predicate(value, index, array)) {
  25607. result.push(value);
  25608. indexes.push(index);
  25609. }
  25610. }
  25611. basePullAt(array, indexes);
  25612. return result;
  25613. }
  25614. /**
  25615. * Reverses `array` so that the first element becomes the last, the second
  25616. * element becomes the second to last, and so on.
  25617. *
  25618. * **Note:** This method mutates `array` and is based on
  25619. * [`Array#reverse`](https://mdn.io/Array/reverse).
  25620. *
  25621. * @static
  25622. * @memberOf _
  25623. * @since 4.0.0
  25624. * @category Array
  25625. * @param {Array} array The array to modify.
  25626. * @returns {Array} Returns `array`.
  25627. * @example
  25628. *
  25629. * var array = [1, 2, 3];
  25630. *
  25631. * _.reverse(array);
  25632. * // => [3, 2, 1]
  25633. *
  25634. * console.log(array);
  25635. * // => [3, 2, 1]
  25636. */
  25637. function reverse(array) {
  25638. return array == null ? array : nativeReverse.call(array);
  25639. }
  25640. /**
  25641. * Creates a slice of `array` from `start` up to, but not including, `end`.
  25642. *
  25643. * **Note:** This method is used instead of
  25644. * [`Array#slice`](https://mdn.io/Array/slice) to ensure dense arrays are
  25645. * returned.
  25646. *
  25647. * @static
  25648. * @memberOf _
  25649. * @since 3.0.0
  25650. * @category Array
  25651. * @param {Array} array The array to slice.
  25652. * @param {number} [start=0] The start position.
  25653. * @param {number} [end=array.length] The end position.
  25654. * @returns {Array} Returns the slice of `array`.
  25655. */
  25656. function slice(array, start, end) {
  25657. var length = array == null ? 0 : array.length;
  25658. if (!length) {
  25659. return [];
  25660. }
  25661. if (end && typeof end != 'number' && isIterateeCall(array, start, end)) {
  25662. start = 0;
  25663. end = length;
  25664. }
  25665. else {
  25666. start = start == null ? 0 : toInteger(start);
  25667. end = end === undefined ? length : toInteger(end);
  25668. }
  25669. return baseSlice(array, start, end);
  25670. }
  25671. /**
  25672. * Uses a binary search to determine the lowest index at which `value`
  25673. * should be inserted into `array` in order to maintain its sort order.
  25674. *
  25675. * @static
  25676. * @memberOf _
  25677. * @since 0.1.0
  25678. * @category Array
  25679. * @param {Array} array The sorted array to inspect.
  25680. * @param {*} value The value to evaluate.
  25681. * @returns {number} Returns the index at which `value` should be inserted
  25682. * into `array`.
  25683. * @example
  25684. *
  25685. * _.sortedIndex([30, 50], 40);
  25686. * // => 1
  25687. */
  25688. function sortedIndex(array, value) {
  25689. return baseSortedIndex(array, value);
  25690. }
  25691. /**
  25692. * This method is like `_.sortedIndex` except that it accepts `iteratee`
  25693. * which is invoked for `value` and each element of `array` to compute their
  25694. * sort ranking. The iteratee is invoked with one argument: (value).
  25695. *
  25696. * @static
  25697. * @memberOf _
  25698. * @since 4.0.0
  25699. * @category Array
  25700. * @param {Array} array The sorted array to inspect.
  25701. * @param {*} value The value to evaluate.
  25702. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  25703. * @returns {number} Returns the index at which `value` should be inserted
  25704. * into `array`.
  25705. * @example
  25706. *
  25707. * var objects = [{ 'x': 4 }, { 'x': 5 }];
  25708. *
  25709. * _.sortedIndexBy(objects, { 'x': 4 }, function(o) { return o.x; });
  25710. * // => 0
  25711. *
  25712. * // The `_.property` iteratee shorthand.
  25713. * _.sortedIndexBy(objects, { 'x': 4 }, 'x');
  25714. * // => 0
  25715. */
  25716. function sortedIndexBy(array, value, iteratee) {
  25717. return baseSortedIndexBy(array, value, getIteratee(iteratee, 2));
  25718. }
  25719. /**
  25720. * This method is like `_.indexOf` except that it performs a binary
  25721. * search on a sorted `array`.
  25722. *
  25723. * @static
  25724. * @memberOf _
  25725. * @since 4.0.0
  25726. * @category Array
  25727. * @param {Array} array The array to inspect.
  25728. * @param {*} value The value to search for.
  25729. * @returns {number} Returns the index of the matched value, else `-1`.
  25730. * @example
  25731. *
  25732. * _.sortedIndexOf([4, 5, 5, 5, 6], 5);
  25733. * // => 1
  25734. */
  25735. function sortedIndexOf(array, value) {
  25736. var length = array == null ? 0 : array.length;
  25737. if (length) {
  25738. var index = baseSortedIndex(array, value);
  25739. if (index < length && eq(array[index], value)) {
  25740. return index;
  25741. }
  25742. }
  25743. return -1;
  25744. }
  25745. /**
  25746. * This method is like `_.sortedIndex` except that it returns the highest
  25747. * index at which `value` should be inserted into `array` in order to
  25748. * maintain its sort order.
  25749. *
  25750. * @static
  25751. * @memberOf _
  25752. * @since 3.0.0
  25753. * @category Array
  25754. * @param {Array} array The sorted array to inspect.
  25755. * @param {*} value The value to evaluate.
  25756. * @returns {number} Returns the index at which `value` should be inserted
  25757. * into `array`.
  25758. * @example
  25759. *
  25760. * _.sortedLastIndex([4, 5, 5, 5, 6], 5);
  25761. * // => 4
  25762. */
  25763. function sortedLastIndex(array, value) {
  25764. return baseSortedIndex(array, value, true);
  25765. }
  25766. /**
  25767. * This method is like `_.sortedLastIndex` except that it accepts `iteratee`
  25768. * which is invoked for `value` and each element of `array` to compute their
  25769. * sort ranking. The iteratee is invoked with one argument: (value).
  25770. *
  25771. * @static
  25772. * @memberOf _
  25773. * @since 4.0.0
  25774. * @category Array
  25775. * @param {Array} array The sorted array to inspect.
  25776. * @param {*} value The value to evaluate.
  25777. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  25778. * @returns {number} Returns the index at which `value` should be inserted
  25779. * into `array`.
  25780. * @example
  25781. *
  25782. * var objects = [{ 'x': 4 }, { 'x': 5 }];
  25783. *
  25784. * _.sortedLastIndexBy(objects, { 'x': 4 }, function(o) { return o.x; });
  25785. * // => 1
  25786. *
  25787. * // The `_.property` iteratee shorthand.
  25788. * _.sortedLastIndexBy(objects, { 'x': 4 }, 'x');
  25789. * // => 1
  25790. */
  25791. function sortedLastIndexBy(array, value, iteratee) {
  25792. return baseSortedIndexBy(array, value, getIteratee(iteratee, 2), true);
  25793. }
  25794. /**
  25795. * This method is like `_.lastIndexOf` except that it performs a binary
  25796. * search on a sorted `array`.
  25797. *
  25798. * @static
  25799. * @memberOf _
  25800. * @since 4.0.0
  25801. * @category Array
  25802. * @param {Array} array The array to inspect.
  25803. * @param {*} value The value to search for.
  25804. * @returns {number} Returns the index of the matched value, else `-1`.
  25805. * @example
  25806. *
  25807. * _.sortedLastIndexOf([4, 5, 5, 5, 6], 5);
  25808. * // => 3
  25809. */
  25810. function sortedLastIndexOf(array, value) {
  25811. var length = array == null ? 0 : array.length;
  25812. if (length) {
  25813. var index = baseSortedIndex(array, value, true) - 1;
  25814. if (eq(array[index], value)) {
  25815. return index;
  25816. }
  25817. }
  25818. return -1;
  25819. }
  25820. /**
  25821. * This method is like `_.uniq` except that it's designed and optimized
  25822. * for sorted arrays.
  25823. *
  25824. * @static
  25825. * @memberOf _
  25826. * @since 4.0.0
  25827. * @category Array
  25828. * @param {Array} array The array to inspect.
  25829. * @returns {Array} Returns the new duplicate free array.
  25830. * @example
  25831. *
  25832. * _.sortedUniq([1, 1, 2]);
  25833. * // => [1, 2]
  25834. */
  25835. function sortedUniq(array) {
  25836. return (array && array.length)
  25837. ? baseSortedUniq(array)
  25838. : [];
  25839. }
  25840. /**
  25841. * This method is like `_.uniqBy` except that it's designed and optimized
  25842. * for sorted arrays.
  25843. *
  25844. * @static
  25845. * @memberOf _
  25846. * @since 4.0.0
  25847. * @category Array
  25848. * @param {Array} array The array to inspect.
  25849. * @param {Function} [iteratee] The iteratee invoked per element.
  25850. * @returns {Array} Returns the new duplicate free array.
  25851. * @example
  25852. *
  25853. * _.sortedUniqBy([1.1, 1.2, 2.3, 2.4], Math.floor);
  25854. * // => [1.1, 2.3]
  25855. */
  25856. function sortedUniqBy(array, iteratee) {
  25857. return (array && array.length)
  25858. ? baseSortedUniq(array, getIteratee(iteratee, 2))
  25859. : [];
  25860. }
  25861. /**
  25862. * Gets all but the first element of `array`.
  25863. *
  25864. * @static
  25865. * @memberOf _
  25866. * @since 4.0.0
  25867. * @category Array
  25868. * @param {Array} array The array to query.
  25869. * @returns {Array} Returns the slice of `array`.
  25870. * @example
  25871. *
  25872. * _.tail([1, 2, 3]);
  25873. * // => [2, 3]
  25874. */
  25875. function tail(array) {
  25876. var length = array == null ? 0 : array.length;
  25877. return length ? baseSlice(array, 1, length) : [];
  25878. }
  25879. /**
  25880. * Creates a slice of `array` with `n` elements taken from the beginning.
  25881. *
  25882. * @static
  25883. * @memberOf _
  25884. * @since 0.1.0
  25885. * @category Array
  25886. * @param {Array} array The array to query.
  25887. * @param {number} [n=1] The number of elements to take.
  25888. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  25889. * @returns {Array} Returns the slice of `array`.
  25890. * @example
  25891. *
  25892. * _.take([1, 2, 3]);
  25893. * // => [1]
  25894. *
  25895. * _.take([1, 2, 3], 2);
  25896. * // => [1, 2]
  25897. *
  25898. * _.take([1, 2, 3], 5);
  25899. * // => [1, 2, 3]
  25900. *
  25901. * _.take([1, 2, 3], 0);
  25902. * // => []
  25903. */
  25904. function take(array, n, guard) {
  25905. if (!(array && array.length)) {
  25906. return [];
  25907. }
  25908. n = (guard || n === undefined) ? 1 : toInteger(n);
  25909. return baseSlice(array, 0, n < 0 ? 0 : n);
  25910. }
  25911. /**
  25912. * Creates a slice of `array` with `n` elements taken from the end.
  25913. *
  25914. * @static
  25915. * @memberOf _
  25916. * @since 3.0.0
  25917. * @category Array
  25918. * @param {Array} array The array to query.
  25919. * @param {number} [n=1] The number of elements to take.
  25920. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  25921. * @returns {Array} Returns the slice of `array`.
  25922. * @example
  25923. *
  25924. * _.takeRight([1, 2, 3]);
  25925. * // => [3]
  25926. *
  25927. * _.takeRight([1, 2, 3], 2);
  25928. * // => [2, 3]
  25929. *
  25930. * _.takeRight([1, 2, 3], 5);
  25931. * // => [1, 2, 3]
  25932. *
  25933. * _.takeRight([1, 2, 3], 0);
  25934. * // => []
  25935. */
  25936. function takeRight(array, n, guard) {
  25937. var length = array == null ? 0 : array.length;
  25938. if (!length) {
  25939. return [];
  25940. }
  25941. n = (guard || n === undefined) ? 1 : toInteger(n);
  25942. n = length - n;
  25943. return baseSlice(array, n < 0 ? 0 : n, length);
  25944. }
  25945. /**
  25946. * Creates a slice of `array` with elements taken from the end. Elements are
  25947. * taken until `predicate` returns falsey. The predicate is invoked with
  25948. * three arguments: (value, index, array).
  25949. *
  25950. * @static
  25951. * @memberOf _
  25952. * @since 3.0.0
  25953. * @category Array
  25954. * @param {Array} array The array to query.
  25955. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  25956. * @returns {Array} Returns the slice of `array`.
  25957. * @example
  25958. *
  25959. * var users = [
  25960. * { 'user': 'barney', 'active': true },
  25961. * { 'user': 'fred', 'active': false },
  25962. * { 'user': 'pebbles', 'active': false }
  25963. * ];
  25964. *
  25965. * _.takeRightWhile(users, function(o) { return !o.active; });
  25966. * // => objects for ['fred', 'pebbles']
  25967. *
  25968. * // The `_.matches` iteratee shorthand.
  25969. * _.takeRightWhile(users, { 'user': 'pebbles', 'active': false });
  25970. * // => objects for ['pebbles']
  25971. *
  25972. * // The `_.matchesProperty` iteratee shorthand.
  25973. * _.takeRightWhile(users, ['active', false]);
  25974. * // => objects for ['fred', 'pebbles']
  25975. *
  25976. * // The `_.property` iteratee shorthand.
  25977. * _.takeRightWhile(users, 'active');
  25978. * // => []
  25979. */
  25980. function takeRightWhile(array, predicate) {
  25981. return (array && array.length)
  25982. ? baseWhile(array, getIteratee(predicate, 3), false, true)
  25983. : [];
  25984. }
  25985. /**
  25986. * Creates a slice of `array` with elements taken from the beginning. Elements
  25987. * are taken until `predicate` returns falsey. The predicate is invoked with
  25988. * three arguments: (value, index, array).
  25989. *
  25990. * @static
  25991. * @memberOf _
  25992. * @since 3.0.0
  25993. * @category Array
  25994. * @param {Array} array The array to query.
  25995. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  25996. * @returns {Array} Returns the slice of `array`.
  25997. * @example
  25998. *
  25999. * var users = [
  26000. * { 'user': 'barney', 'active': false },
  26001. * { 'user': 'fred', 'active': false },
  26002. * { 'user': 'pebbles', 'active': true }
  26003. * ];
  26004. *
  26005. * _.takeWhile(users, function(o) { return !o.active; });
  26006. * // => objects for ['barney', 'fred']
  26007. *
  26008. * // The `_.matches` iteratee shorthand.
  26009. * _.takeWhile(users, { 'user': 'barney', 'active': false });
  26010. * // => objects for ['barney']
  26011. *
  26012. * // The `_.matchesProperty` iteratee shorthand.
  26013. * _.takeWhile(users, ['active', false]);
  26014. * // => objects for ['barney', 'fred']
  26015. *
  26016. * // The `_.property` iteratee shorthand.
  26017. * _.takeWhile(users, 'active');
  26018. * // => []
  26019. */
  26020. function takeWhile(array, predicate) {
  26021. return (array && array.length)
  26022. ? baseWhile(array, getIteratee(predicate, 3))
  26023. : [];
  26024. }
  26025. /**
  26026. * Creates an array of unique values, in order, from all given arrays using
  26027. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  26028. * for equality comparisons.
  26029. *
  26030. * @static
  26031. * @memberOf _
  26032. * @since 0.1.0
  26033. * @category Array
  26034. * @param {...Array} [arrays] The arrays to inspect.
  26035. * @returns {Array} Returns the new array of combined values.
  26036. * @example
  26037. *
  26038. * _.union([2], [1, 2]);
  26039. * // => [2, 1]
  26040. */
  26041. var union = baseRest(function(arrays) {
  26042. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true));
  26043. });
  26044. /**
  26045. * This method is like `_.union` except that it accepts `iteratee` which is
  26046. * invoked for each element of each `arrays` to generate the criterion by
  26047. * which uniqueness is computed. Result values are chosen from the first
  26048. * array in which the value occurs. The iteratee is invoked with one argument:
  26049. * (value).
  26050. *
  26051. * @static
  26052. * @memberOf _
  26053. * @since 4.0.0
  26054. * @category Array
  26055. * @param {...Array} [arrays] The arrays to inspect.
  26056. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  26057. * @returns {Array} Returns the new array of combined values.
  26058. * @example
  26059. *
  26060. * _.unionBy([2.1], [1.2, 2.3], Math.floor);
  26061. * // => [2.1, 1.2]
  26062. *
  26063. * // The `_.property` iteratee shorthand.
  26064. * _.unionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
  26065. * // => [{ 'x': 1 }, { 'x': 2 }]
  26066. */
  26067. var unionBy = baseRest(function(arrays) {
  26068. var iteratee = last(arrays);
  26069. if (isArrayLikeObject(iteratee)) {
  26070. iteratee = undefined;
  26071. }
  26072. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), getIteratee(iteratee, 2));
  26073. });
  26074. /**
  26075. * This method is like `_.union` except that it accepts `comparator` which
  26076. * is invoked to compare elements of `arrays`. Result values are chosen from
  26077. * the first array in which the value occurs. The comparator is invoked
  26078. * with two arguments: (arrVal, othVal).
  26079. *
  26080. * @static
  26081. * @memberOf _
  26082. * @since 4.0.0
  26083. * @category Array
  26084. * @param {...Array} [arrays] The arrays to inspect.
  26085. * @param {Function} [comparator] The comparator invoked per element.
  26086. * @returns {Array} Returns the new array of combined values.
  26087. * @example
  26088. *
  26089. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  26090. * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
  26091. *
  26092. * _.unionWith(objects, others, _.isEqual);
  26093. * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]
  26094. */
  26095. var unionWith = baseRest(function(arrays) {
  26096. var comparator = last(arrays);
  26097. comparator = typeof comparator == 'function' ? comparator : undefined;
  26098. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), undefined, comparator);
  26099. });
  26100. /**
  26101. * Creates a duplicate-free version of an array, using
  26102. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  26103. * for equality comparisons, in which only the first occurrence of each element
  26104. * is kept. The order of result values is determined by the order they occur
  26105. * in the array.
  26106. *
  26107. * @static
  26108. * @memberOf _
  26109. * @since 0.1.0
  26110. * @category Array
  26111. * @param {Array} array The array to inspect.
  26112. * @returns {Array} Returns the new duplicate free array.
  26113. * @example
  26114. *
  26115. * _.uniq([2, 1, 2]);
  26116. * // => [2, 1]
  26117. */
  26118. function uniq(array) {
  26119. return (array && array.length) ? baseUniq(array) : [];
  26120. }
  26121. /**
  26122. * This method is like `_.uniq` except that it accepts `iteratee` which is
  26123. * invoked for each element in `array` to generate the criterion by which
  26124. * uniqueness is computed. The order of result values is determined by the
  26125. * order they occur in the array. The iteratee is invoked with one argument:
  26126. * (value).
  26127. *
  26128. * @static
  26129. * @memberOf _
  26130. * @since 4.0.0
  26131. * @category Array
  26132. * @param {Array} array The array to inspect.
  26133. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  26134. * @returns {Array} Returns the new duplicate free array.
  26135. * @example
  26136. *
  26137. * _.uniqBy([2.1, 1.2, 2.3], Math.floor);
  26138. * // => [2.1, 1.2]
  26139. *
  26140. * // The `_.property` iteratee shorthand.
  26141. * _.uniqBy([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x');
  26142. * // => [{ 'x': 1 }, { 'x': 2 }]
  26143. */
  26144. function uniqBy(array, iteratee) {
  26145. return (array && array.length) ? baseUniq(array, getIteratee(iteratee, 2)) : [];
  26146. }
  26147. /**
  26148. * This method is like `_.uniq` except that it accepts `comparator` which
  26149. * is invoked to compare elements of `array`. The order of result values is
  26150. * determined by the order they occur in the array.The comparator is invoked
  26151. * with two arguments: (arrVal, othVal).
  26152. *
  26153. * @static
  26154. * @memberOf _
  26155. * @since 4.0.0
  26156. * @category Array
  26157. * @param {Array} array The array to inspect.
  26158. * @param {Function} [comparator] The comparator invoked per element.
  26159. * @returns {Array} Returns the new duplicate free array.
  26160. * @example
  26161. *
  26162. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 2 }];
  26163. *
  26164. * _.uniqWith(objects, _.isEqual);
  26165. * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]
  26166. */
  26167. function uniqWith(array, comparator) {
  26168. comparator = typeof comparator == 'function' ? comparator : undefined;
  26169. return (array && array.length) ? baseUniq(array, undefined, comparator) : [];
  26170. }
  26171. /**
  26172. * This method is like `_.zip` except that it accepts an array of grouped
  26173. * elements and creates an array regrouping the elements to their pre-zip
  26174. * configuration.
  26175. *
  26176. * @static
  26177. * @memberOf _
  26178. * @since 1.2.0
  26179. * @category Array
  26180. * @param {Array} array The array of grouped elements to process.
  26181. * @returns {Array} Returns the new array of regrouped elements.
  26182. * @example
  26183. *
  26184. * var zipped = _.zip(['a', 'b'], [1, 2], [true, false]);
  26185. * // => [['a', 1, true], ['b', 2, false]]
  26186. *
  26187. * _.unzip(zipped);
  26188. * // => [['a', 'b'], [1, 2], [true, false]]
  26189. */
  26190. function unzip(array) {
  26191. if (!(array && array.length)) {
  26192. return [];
  26193. }
  26194. var length = 0;
  26195. array = arrayFilter(array, function(group) {
  26196. if (isArrayLikeObject(group)) {
  26197. length = nativeMax(group.length, length);
  26198. return true;
  26199. }
  26200. });
  26201. return baseTimes(length, function(index) {
  26202. return arrayMap(array, baseProperty(index));
  26203. });
  26204. }
  26205. /**
  26206. * This method is like `_.unzip` except that it accepts `iteratee` to specify
  26207. * how regrouped values should be combined. The iteratee is invoked with the
  26208. * elements of each group: (...group).
  26209. *
  26210. * @static
  26211. * @memberOf _
  26212. * @since 3.8.0
  26213. * @category Array
  26214. * @param {Array} array The array of grouped elements to process.
  26215. * @param {Function} [iteratee=_.identity] The function to combine
  26216. * regrouped values.
  26217. * @returns {Array} Returns the new array of regrouped elements.
  26218. * @example
  26219. *
  26220. * var zipped = _.zip([1, 2], [10, 20], [100, 200]);
  26221. * // => [[1, 10, 100], [2, 20, 200]]
  26222. *
  26223. * _.unzipWith(zipped, _.add);
  26224. * // => [3, 30, 300]
  26225. */
  26226. function unzipWith(array, iteratee) {
  26227. if (!(array && array.length)) {
  26228. return [];
  26229. }
  26230. var result = unzip(array);
  26231. if (iteratee == null) {
  26232. return result;
  26233. }
  26234. return arrayMap(result, function(group) {
  26235. return apply(iteratee, undefined, group);
  26236. });
  26237. }
  26238. /**
  26239. * Creates an array excluding all given values using
  26240. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  26241. * for equality comparisons.
  26242. *
  26243. * **Note:** Unlike `_.pull`, this method returns a new array.
  26244. *
  26245. * @static
  26246. * @memberOf _
  26247. * @since 0.1.0
  26248. * @category Array
  26249. * @param {Array} array The array to inspect.
  26250. * @param {...*} [values] The values to exclude.
  26251. * @returns {Array} Returns the new array of filtered values.
  26252. * @see _.difference, _.xor
  26253. * @example
  26254. *
  26255. * _.without([2, 1, 2, 3], 1, 2);
  26256. * // => [3]
  26257. */
  26258. var without = baseRest(function(array, values) {
  26259. return isArrayLikeObject(array)
  26260. ? baseDifference(array, values)
  26261. : [];
  26262. });
  26263. /**
  26264. * Creates an array of unique values that is the
  26265. * [symmetric difference](https://en.wikipedia.org/wiki/Symmetric_difference)
  26266. * of the given arrays. The order of result values is determined by the order
  26267. * they occur in the arrays.
  26268. *
  26269. * @static
  26270. * @memberOf _
  26271. * @since 2.4.0
  26272. * @category Array
  26273. * @param {...Array} [arrays] The arrays to inspect.
  26274. * @returns {Array} Returns the new array of filtered values.
  26275. * @see _.difference, _.without
  26276. * @example
  26277. *
  26278. * _.xor([2, 1], [2, 3]);
  26279. * // => [1, 3]
  26280. */
  26281. var xor = baseRest(function(arrays) {
  26282. return baseXor(arrayFilter(arrays, isArrayLikeObject));
  26283. });
  26284. /**
  26285. * This method is like `_.xor` except that it accepts `iteratee` which is
  26286. * invoked for each element of each `arrays` to generate the criterion by
  26287. * which by which they're compared. The order of result values is determined
  26288. * by the order they occur in the arrays. The iteratee is invoked with one
  26289. * argument: (value).
  26290. *
  26291. * @static
  26292. * @memberOf _
  26293. * @since 4.0.0
  26294. * @category Array
  26295. * @param {...Array} [arrays] The arrays to inspect.
  26296. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  26297. * @returns {Array} Returns the new array of filtered values.
  26298. * @example
  26299. *
  26300. * _.xorBy([2.1, 1.2], [2.3, 3.4], Math.floor);
  26301. * // => [1.2, 3.4]
  26302. *
  26303. * // The `_.property` iteratee shorthand.
  26304. * _.xorBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
  26305. * // => [{ 'x': 2 }]
  26306. */
  26307. var xorBy = baseRest(function(arrays) {
  26308. var iteratee = last(arrays);
  26309. if (isArrayLikeObject(iteratee)) {
  26310. iteratee = undefined;
  26311. }
  26312. return baseXor(arrayFilter(arrays, isArrayLikeObject), getIteratee(iteratee, 2));
  26313. });
  26314. /**
  26315. * This method is like `_.xor` except that it accepts `comparator` which is
  26316. * invoked to compare elements of `arrays`. The order of result values is
  26317. * determined by the order they occur in the arrays. The comparator is invoked
  26318. * with two arguments: (arrVal, othVal).
  26319. *
  26320. * @static
  26321. * @memberOf _
  26322. * @since 4.0.0
  26323. * @category Array
  26324. * @param {...Array} [arrays] The arrays to inspect.
  26325. * @param {Function} [comparator] The comparator invoked per element.
  26326. * @returns {Array} Returns the new array of filtered values.
  26327. * @example
  26328. *
  26329. * var objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }];
  26330. * var others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }];
  26331. *
  26332. * _.xorWith(objects, others, _.isEqual);
  26333. * // => [{ 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]
  26334. */
  26335. var xorWith = baseRest(function(arrays) {
  26336. var comparator = last(arrays);
  26337. comparator = typeof comparator == 'function' ? comparator : undefined;
  26338. return baseXor(arrayFilter(arrays, isArrayLikeObject), undefined, comparator);
  26339. });
  26340. /**
  26341. * Creates an array of grouped elements, the first of which contains the
  26342. * first elements of the given arrays, the second of which contains the
  26343. * second elements of the given arrays, and so on.
  26344. *
  26345. * @static
  26346. * @memberOf _
  26347. * @since 0.1.0
  26348. * @category Array
  26349. * @param {...Array} [arrays] The arrays to process.
  26350. * @returns {Array} Returns the new array of grouped elements.
  26351. * @example
  26352. *
  26353. * _.zip(['a', 'b'], [1, 2], [true, false]);
  26354. * // => [['a', 1, true], ['b', 2, false]]
  26355. */
  26356. var zip = baseRest(unzip);
  26357. /**
  26358. * This method is like `_.fromPairs` except that it accepts two arrays,
  26359. * one of property identifiers and one of corresponding values.
  26360. *
  26361. * @static
  26362. * @memberOf _
  26363. * @since 0.4.0
  26364. * @category Array
  26365. * @param {Array} [props=[]] The property identifiers.
  26366. * @param {Array} [values=[]] The property values.
  26367. * @returns {Object} Returns the new object.
  26368. * @example
  26369. *
  26370. * _.zipObject(['a', 'b'], [1, 2]);
  26371. * // => { 'a': 1, 'b': 2 }
  26372. */
  26373. function zipObject(props, values) {
  26374. return baseZipObject(props || [], values || [], assignValue);
  26375. }
  26376. /**
  26377. * This method is like `_.zipObject` except that it supports property paths.
  26378. *
  26379. * @static
  26380. * @memberOf _
  26381. * @since 4.1.0
  26382. * @category Array
  26383. * @param {Array} [props=[]] The property identifiers.
  26384. * @param {Array} [values=[]] The property values.
  26385. * @returns {Object} Returns the new object.
  26386. * @example
  26387. *
  26388. * _.zipObjectDeep(['a.b[0].c', 'a.b[1].d'], [1, 2]);
  26389. * // => { 'a': { 'b': [{ 'c': 1 }, { 'd': 2 }] } }
  26390. */
  26391. function zipObjectDeep(props, values) {
  26392. return baseZipObject(props || [], values || [], baseSet);
  26393. }
  26394. /**
  26395. * This method is like `_.zip` except that it accepts `iteratee` to specify
  26396. * how grouped values should be combined. The iteratee is invoked with the
  26397. * elements of each group: (...group).
  26398. *
  26399. * @static
  26400. * @memberOf _
  26401. * @since 3.8.0
  26402. * @category Array
  26403. * @param {...Array} [arrays] The arrays to process.
  26404. * @param {Function} [iteratee=_.identity] The function to combine
  26405. * grouped values.
  26406. * @returns {Array} Returns the new array of grouped elements.
  26407. * @example
  26408. *
  26409. * _.zipWith([1, 2], [10, 20], [100, 200], function(a, b, c) {
  26410. * return a + b + c;
  26411. * });
  26412. * // => [111, 222]
  26413. */
  26414. var zipWith = baseRest(function(arrays) {
  26415. var length = arrays.length,
  26416. iteratee = length > 1 ? arrays[length - 1] : undefined;
  26417. iteratee = typeof iteratee == 'function' ? (arrays.pop(), iteratee) : undefined;
  26418. return unzipWith(arrays, iteratee);
  26419. });
  26420. /*------------------------------------------------------------------------*/
  26421. /**
  26422. * Creates a `lodash` wrapper instance that wraps `value` with explicit method
  26423. * chain sequences enabled. The result of such sequences must be unwrapped
  26424. * with `_#value`.
  26425. *
  26426. * @static
  26427. * @memberOf _
  26428. * @since 1.3.0
  26429. * @category Seq
  26430. * @param {*} value The value to wrap.
  26431. * @returns {Object} Returns the new `lodash` wrapper instance.
  26432. * @example
  26433. *
  26434. * var users = [
  26435. * { 'user': 'barney', 'age': 36 },
  26436. * { 'user': 'fred', 'age': 40 },
  26437. * { 'user': 'pebbles', 'age': 1 }
  26438. * ];
  26439. *
  26440. * var youngest = _
  26441. * .chain(users)
  26442. * .sortBy('age')
  26443. * .map(function(o) {
  26444. * return o.user + ' is ' + o.age;
  26445. * })
  26446. * .head()
  26447. * .value();
  26448. * // => 'pebbles is 1'
  26449. */
  26450. function chain(value) {
  26451. var result = lodash(value);
  26452. result.__chain__ = true;
  26453. return result;
  26454. }
  26455. /**
  26456. * This method invokes `interceptor` and returns `value`. The interceptor
  26457. * is invoked with one argument; (value). The purpose of this method is to
  26458. * "tap into" a method chain sequence in order to modify intermediate results.
  26459. *
  26460. * @static
  26461. * @memberOf _
  26462. * @since 0.1.0
  26463. * @category Seq
  26464. * @param {*} value The value to provide to `interceptor`.
  26465. * @param {Function} interceptor The function to invoke.
  26466. * @returns {*} Returns `value`.
  26467. * @example
  26468. *
  26469. * _([1, 2, 3])
  26470. * .tap(function(array) {
  26471. * // Mutate input array.
  26472. * array.pop();
  26473. * })
  26474. * .reverse()
  26475. * .value();
  26476. * // => [2, 1]
  26477. */
  26478. function tap(value, interceptor) {
  26479. interceptor(value);
  26480. return value;
  26481. }
  26482. /**
  26483. * This method is like `_.tap` except that it returns the result of `interceptor`.
  26484. * The purpose of this method is to "pass thru" values replacing intermediate
  26485. * results in a method chain sequence.
  26486. *
  26487. * @static
  26488. * @memberOf _
  26489. * @since 3.0.0
  26490. * @category Seq
  26491. * @param {*} value The value to provide to `interceptor`.
  26492. * @param {Function} interceptor The function to invoke.
  26493. * @returns {*} Returns the result of `interceptor`.
  26494. * @example
  26495. *
  26496. * _(' abc ')
  26497. * .chain()
  26498. * .trim()
  26499. * .thru(function(value) {
  26500. * return [value];
  26501. * })
  26502. * .value();
  26503. * // => ['abc']
  26504. */
  26505. function thru(value, interceptor) {
  26506. return interceptor(value);
  26507. }
  26508. /**
  26509. * This method is the wrapper version of `_.at`.
  26510. *
  26511. * @name at
  26512. * @memberOf _
  26513. * @since 1.0.0
  26514. * @category Seq
  26515. * @param {...(string|string[])} [paths] The property paths to pick.
  26516. * @returns {Object} Returns the new `lodash` wrapper instance.
  26517. * @example
  26518. *
  26519. * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] };
  26520. *
  26521. * _(object).at(['a[0].b.c', 'a[1]']).value();
  26522. * // => [3, 4]
  26523. */
  26524. var wrapperAt = flatRest(function(paths) {
  26525. var length = paths.length,
  26526. start = length ? paths[0] : 0,
  26527. value = this.__wrapped__,
  26528. interceptor = function(object) { return baseAt(object, paths); };
  26529. if (length > 1 || this.__actions__.length ||
  26530. !(value instanceof LazyWrapper) || !isIndex(start)) {
  26531. return this.thru(interceptor);
  26532. }
  26533. value = value.slice(start, +start + (length ? 1 : 0));
  26534. value.__actions__.push({
  26535. 'func': thru,
  26536. 'args': [interceptor],
  26537. 'thisArg': undefined
  26538. });
  26539. return new LodashWrapper(value, this.__chain__).thru(function(array) {
  26540. if (length && !array.length) {
  26541. array.push(undefined);
  26542. }
  26543. return array;
  26544. });
  26545. });
  26546. /**
  26547. * Creates a `lodash` wrapper instance with explicit method chain sequences enabled.
  26548. *
  26549. * @name chain
  26550. * @memberOf _
  26551. * @since 0.1.0
  26552. * @category Seq
  26553. * @returns {Object} Returns the new `lodash` wrapper instance.
  26554. * @example
  26555. *
  26556. * var users = [
  26557. * { 'user': 'barney', 'age': 36 },
  26558. * { 'user': 'fred', 'age': 40 }
  26559. * ];
  26560. *
  26561. * // A sequence without explicit chaining.
  26562. * _(users).head();
  26563. * // => { 'user': 'barney', 'age': 36 }
  26564. *
  26565. * // A sequence with explicit chaining.
  26566. * _(users)
  26567. * .chain()
  26568. * .head()
  26569. * .pick('user')
  26570. * .value();
  26571. * // => { 'user': 'barney' }
  26572. */
  26573. function wrapperChain() {
  26574. return chain(this);
  26575. }
  26576. /**
  26577. * Executes the chain sequence and returns the wrapped result.
  26578. *
  26579. * @name commit
  26580. * @memberOf _
  26581. * @since 3.2.0
  26582. * @category Seq
  26583. * @returns {Object} Returns the new `lodash` wrapper instance.
  26584. * @example
  26585. *
  26586. * var array = [1, 2];
  26587. * var wrapped = _(array).push(3);
  26588. *
  26589. * console.log(array);
  26590. * // => [1, 2]
  26591. *
  26592. * wrapped = wrapped.commit();
  26593. * console.log(array);
  26594. * // => [1, 2, 3]
  26595. *
  26596. * wrapped.last();
  26597. * // => 3
  26598. *
  26599. * console.log(array);
  26600. * // => [1, 2, 3]
  26601. */
  26602. function wrapperCommit() {
  26603. return new LodashWrapper(this.value(), this.__chain__);
  26604. }
  26605. /**
  26606. * Gets the next value on a wrapped object following the
  26607. * [iterator protocol](https://mdn.io/iteration_protocols#iterator).
  26608. *
  26609. * @name next
  26610. * @memberOf _
  26611. * @since 4.0.0
  26612. * @category Seq
  26613. * @returns {Object} Returns the next iterator value.
  26614. * @example
  26615. *
  26616. * var wrapped = _([1, 2]);
  26617. *
  26618. * wrapped.next();
  26619. * // => { 'done': false, 'value': 1 }
  26620. *
  26621. * wrapped.next();
  26622. * // => { 'done': false, 'value': 2 }
  26623. *
  26624. * wrapped.next();
  26625. * // => { 'done': true, 'value': undefined }
  26626. */
  26627. function wrapperNext() {
  26628. if (this.__values__ === undefined) {
  26629. this.__values__ = toArray(this.value());
  26630. }
  26631. var done = this.__index__ >= this.__values__.length,
  26632. value = done ? undefined : this.__values__[this.__index__++];
  26633. return { 'done': done, 'value': value };
  26634. }
  26635. /**
  26636. * Enables the wrapper to be iterable.
  26637. *
  26638. * @name Symbol.iterator
  26639. * @memberOf _
  26640. * @since 4.0.0
  26641. * @category Seq
  26642. * @returns {Object} Returns the wrapper object.
  26643. * @example
  26644. *
  26645. * var wrapped = _([1, 2]);
  26646. *
  26647. * wrapped[Symbol.iterator]() === wrapped;
  26648. * // => true
  26649. *
  26650. * Array.from(wrapped);
  26651. * // => [1, 2]
  26652. */
  26653. function wrapperToIterator() {
  26654. return this;
  26655. }
  26656. /**
  26657. * Creates a clone of the chain sequence planting `value` as the wrapped value.
  26658. *
  26659. * @name plant
  26660. * @memberOf _
  26661. * @since 3.2.0
  26662. * @category Seq
  26663. * @param {*} value The value to plant.
  26664. * @returns {Object} Returns the new `lodash` wrapper instance.
  26665. * @example
  26666. *
  26667. * function square(n) {
  26668. * return n * n;
  26669. * }
  26670. *
  26671. * var wrapped = _([1, 2]).map(square);
  26672. * var other = wrapped.plant([3, 4]);
  26673. *
  26674. * other.value();
  26675. * // => [9, 16]
  26676. *
  26677. * wrapped.value();
  26678. * // => [1, 4]
  26679. */
  26680. function wrapperPlant(value) {
  26681. var result,
  26682. parent = this;
  26683. while (parent instanceof baseLodash) {
  26684. var clone = wrapperClone(parent);
  26685. clone.__index__ = 0;
  26686. clone.__values__ = undefined;
  26687. if (result) {
  26688. previous.__wrapped__ = clone;
  26689. } else {
  26690. result = clone;
  26691. }
  26692. var previous = clone;
  26693. parent = parent.__wrapped__;
  26694. }
  26695. previous.__wrapped__ = value;
  26696. return result;
  26697. }
  26698. /**
  26699. * This method is the wrapper version of `_.reverse`.
  26700. *
  26701. * **Note:** This method mutates the wrapped array.
  26702. *
  26703. * @name reverse
  26704. * @memberOf _
  26705. * @since 0.1.0
  26706. * @category Seq
  26707. * @returns {Object} Returns the new `lodash` wrapper instance.
  26708. * @example
  26709. *
  26710. * var array = [1, 2, 3];
  26711. *
  26712. * _(array).reverse().value()
  26713. * // => [3, 2, 1]
  26714. *
  26715. * console.log(array);
  26716. * // => [3, 2, 1]
  26717. */
  26718. function wrapperReverse() {
  26719. var value = this.__wrapped__;
  26720. if (value instanceof LazyWrapper) {
  26721. var wrapped = value;
  26722. if (this.__actions__.length) {
  26723. wrapped = new LazyWrapper(this);
  26724. }
  26725. wrapped = wrapped.reverse();
  26726. wrapped.__actions__.push({
  26727. 'func': thru,
  26728. 'args': [reverse],
  26729. 'thisArg': undefined
  26730. });
  26731. return new LodashWrapper(wrapped, this.__chain__);
  26732. }
  26733. return this.thru(reverse);
  26734. }
  26735. /**
  26736. * Executes the chain sequence to resolve the unwrapped value.
  26737. *
  26738. * @name value
  26739. * @memberOf _
  26740. * @since 0.1.0
  26741. * @alias toJSON, valueOf
  26742. * @category Seq
  26743. * @returns {*} Returns the resolved unwrapped value.
  26744. * @example
  26745. *
  26746. * _([1, 2, 3]).value();
  26747. * // => [1, 2, 3]
  26748. */
  26749. function wrapperValue() {
  26750. return baseWrapperValue(this.__wrapped__, this.__actions__);
  26751. }
  26752. /*------------------------------------------------------------------------*/
  26753. /**
  26754. * Creates an object composed of keys generated from the results of running
  26755. * each element of `collection` thru `iteratee`. The corresponding value of
  26756. * each key is the number of times the key was returned by `iteratee`. The
  26757. * iteratee is invoked with one argument: (value).
  26758. *
  26759. * @static
  26760. * @memberOf _
  26761. * @since 0.5.0
  26762. * @category Collection
  26763. * @param {Array|Object} collection The collection to iterate over.
  26764. * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
  26765. * @returns {Object} Returns the composed aggregate object.
  26766. * @example
  26767. *
  26768. * _.countBy([6.1, 4.2, 6.3], Math.floor);
  26769. * // => { '4': 1, '6': 2 }
  26770. *
  26771. * // The `_.property` iteratee shorthand.
  26772. * _.countBy(['one', 'two', 'three'], 'length');
  26773. * // => { '3': 2, '5': 1 }
  26774. */
  26775. var countBy = createAggregator(function(result, value, key) {
  26776. if (hasOwnProperty.call(result, key)) {
  26777. ++result[key];
  26778. } else {
  26779. baseAssignValue(result, key, 1);
  26780. }
  26781. });
  26782. /**
  26783. * Checks if `predicate` returns truthy for **all** elements of `collection`.
  26784. * Iteration is stopped once `predicate` returns falsey. The predicate is
  26785. * invoked with three arguments: (value, index|key, collection).
  26786. *
  26787. * **Note:** This method returns `true` for
  26788. * [empty collections](https://en.wikipedia.org/wiki/Empty_set) because
  26789. * [everything is true](https://en.wikipedia.org/wiki/Vacuous_truth) of
  26790. * elements of empty collections.
  26791. *
  26792. * @static
  26793. * @memberOf _
  26794. * @since 0.1.0
  26795. * @category Collection
  26796. * @param {Array|Object} collection The collection to iterate over.
  26797. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  26798. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  26799. * @returns {boolean} Returns `true` if all elements pass the predicate check,
  26800. * else `false`.
  26801. * @example
  26802. *
  26803. * _.every([true, 1, null, 'yes'], Boolean);
  26804. * // => false
  26805. *
  26806. * var users = [
  26807. * { 'user': 'barney', 'age': 36, 'active': false },
  26808. * { 'user': 'fred', 'age': 40, 'active': false }
  26809. * ];
  26810. *
  26811. * // The `_.matches` iteratee shorthand.
  26812. * _.every(users, { 'user': 'barney', 'active': false });
  26813. * // => false
  26814. *
  26815. * // The `_.matchesProperty` iteratee shorthand.
  26816. * _.every(users, ['active', false]);
  26817. * // => true
  26818. *
  26819. * // The `_.property` iteratee shorthand.
  26820. * _.every(users, 'active');
  26821. * // => false
  26822. */
  26823. function every(collection, predicate, guard) {
  26824. var func = isArray(collection) ? arrayEvery : baseEvery;
  26825. if (guard && isIterateeCall(collection, predicate, guard)) {
  26826. predicate = undefined;
  26827. }
  26828. return func(collection, getIteratee(predicate, 3));
  26829. }
  26830. /**
  26831. * Iterates over elements of `collection`, returning an array of all elements
  26832. * `predicate` returns truthy for. The predicate is invoked with three
  26833. * arguments: (value, index|key, collection).
  26834. *
  26835. * **Note:** Unlike `_.remove`, this method returns a new array.
  26836. *
  26837. * @static
  26838. * @memberOf _
  26839. * @since 0.1.0
  26840. * @category Collection
  26841. * @param {Array|Object} collection The collection to iterate over.
  26842. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  26843. * @returns {Array} Returns the new filtered array.
  26844. * @see _.reject
  26845. * @example
  26846. *
  26847. * var users = [
  26848. * { 'user': 'barney', 'age': 36, 'active': true },
  26849. * { 'user': 'fred', 'age': 40, 'active': false }
  26850. * ];
  26851. *
  26852. * _.filter(users, function(o) { return !o.active; });
  26853. * // => objects for ['fred']
  26854. *
  26855. * // The `_.matches` iteratee shorthand.
  26856. * _.filter(users, { 'age': 36, 'active': true });
  26857. * // => objects for ['barney']
  26858. *
  26859. * // The `_.matchesProperty` iteratee shorthand.
  26860. * _.filter(users, ['active', false]);
  26861. * // => objects for ['fred']
  26862. *
  26863. * // The `_.property` iteratee shorthand.
  26864. * _.filter(users, 'active');
  26865. * // => objects for ['barney']
  26866. */
  26867. function filter(collection, predicate) {
  26868. var func = isArray(collection) ? arrayFilter : baseFilter;
  26869. return func(collection, getIteratee(predicate, 3));
  26870. }
  26871. /**
  26872. * Iterates over elements of `collection`, returning the first element
  26873. * `predicate` returns truthy for. The predicate is invoked with three
  26874. * arguments: (value, index|key, collection).
  26875. *
  26876. * @static
  26877. * @memberOf _
  26878. * @since 0.1.0
  26879. * @category Collection
  26880. * @param {Array|Object} collection The collection to inspect.
  26881. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  26882. * @param {number} [fromIndex=0] The index to search from.
  26883. * @returns {*} Returns the matched element, else `undefined`.
  26884. * @example
  26885. *
  26886. * var users = [
  26887. * { 'user': 'barney', 'age': 36, 'active': true },
  26888. * { 'user': 'fred', 'age': 40, 'active': false },
  26889. * { 'user': 'pebbles', 'age': 1, 'active': true }
  26890. * ];
  26891. *
  26892. * _.find(users, function(o) { return o.age < 40; });
  26893. * // => object for 'barney'
  26894. *
  26895. * // The `_.matches` iteratee shorthand.
  26896. * _.find(users, { 'age': 1, 'active': true });
  26897. * // => object for 'pebbles'
  26898. *
  26899. * // The `_.matchesProperty` iteratee shorthand.
  26900. * _.find(users, ['active', false]);
  26901. * // => object for 'fred'
  26902. *
  26903. * // The `_.property` iteratee shorthand.
  26904. * _.find(users, 'active');
  26905. * // => object for 'barney'
  26906. */
  26907. var find = createFind(findIndex);
  26908. /**
  26909. * This method is like `_.find` except that it iterates over elements of
  26910. * `collection` from right to left.
  26911. *
  26912. * @static
  26913. * @memberOf _
  26914. * @since 2.0.0
  26915. * @category Collection
  26916. * @param {Array|Object} collection The collection to inspect.
  26917. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  26918. * @param {number} [fromIndex=collection.length-1] The index to search from.
  26919. * @returns {*} Returns the matched element, else `undefined`.
  26920. * @example
  26921. *
  26922. * _.findLast([1, 2, 3, 4], function(n) {
  26923. * return n % 2 == 1;
  26924. * });
  26925. * // => 3
  26926. */
  26927. var findLast = createFind(findLastIndex);
  26928. /**
  26929. * Creates a flattened array of values by running each element in `collection`
  26930. * thru `iteratee` and flattening the mapped results. The iteratee is invoked
  26931. * with three arguments: (value, index|key, collection).
  26932. *
  26933. * @static
  26934. * @memberOf _
  26935. * @since 4.0.0
  26936. * @category Collection
  26937. * @param {Array|Object} collection The collection to iterate over.
  26938. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  26939. * @returns {Array} Returns the new flattened array.
  26940. * @example
  26941. *
  26942. * function duplicate(n) {
  26943. * return [n, n];
  26944. * }
  26945. *
  26946. * _.flatMap([1, 2], duplicate);
  26947. * // => [1, 1, 2, 2]
  26948. */
  26949. function flatMap(collection, iteratee) {
  26950. return baseFlatten(map(collection, iteratee), 1);
  26951. }
  26952. /**
  26953. * This method is like `_.flatMap` except that it recursively flattens the
  26954. * mapped results.
  26955. *
  26956. * @static
  26957. * @memberOf _
  26958. * @since 4.7.0
  26959. * @category Collection
  26960. * @param {Array|Object} collection The collection to iterate over.
  26961. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  26962. * @returns {Array} Returns the new flattened array.
  26963. * @example
  26964. *
  26965. * function duplicate(n) {
  26966. * return [[[n, n]]];
  26967. * }
  26968. *
  26969. * _.flatMapDeep([1, 2], duplicate);
  26970. * // => [1, 1, 2, 2]
  26971. */
  26972. function flatMapDeep(collection, iteratee) {
  26973. return baseFlatten(map(collection, iteratee), INFINITY);
  26974. }
  26975. /**
  26976. * This method is like `_.flatMap` except that it recursively flattens the
  26977. * mapped results up to `depth` times.
  26978. *
  26979. * @static
  26980. * @memberOf _
  26981. * @since 4.7.0
  26982. * @category Collection
  26983. * @param {Array|Object} collection The collection to iterate over.
  26984. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  26985. * @param {number} [depth=1] The maximum recursion depth.
  26986. * @returns {Array} Returns the new flattened array.
  26987. * @example
  26988. *
  26989. * function duplicate(n) {
  26990. * return [[[n, n]]];
  26991. * }
  26992. *
  26993. * _.flatMapDepth([1, 2], duplicate, 2);
  26994. * // => [[1, 1], [2, 2]]
  26995. */
  26996. function flatMapDepth(collection, iteratee, depth) {
  26997. depth = depth === undefined ? 1 : toInteger(depth);
  26998. return baseFlatten(map(collection, iteratee), depth);
  26999. }
  27000. /**
  27001. * Iterates over elements of `collection` and invokes `iteratee` for each element.
  27002. * The iteratee is invoked with three arguments: (value, index|key, collection).
  27003. * Iteratee functions may exit iteration early by explicitly returning `false`.
  27004. *
  27005. * **Note:** As with other "Collections" methods, objects with a "length"
  27006. * property are iterated like arrays. To avoid this behavior use `_.forIn`
  27007. * or `_.forOwn` for object iteration.
  27008. *
  27009. * @static
  27010. * @memberOf _
  27011. * @since 0.1.0
  27012. * @alias each
  27013. * @category Collection
  27014. * @param {Array|Object} collection The collection to iterate over.
  27015. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  27016. * @returns {Array|Object} Returns `collection`.
  27017. * @see _.forEachRight
  27018. * @example
  27019. *
  27020. * _.forEach([1, 2], function(value) {
  27021. * console.log(value);
  27022. * });
  27023. * // => Logs `1` then `2`.
  27024. *
  27025. * _.forEach({ 'a': 1, 'b': 2 }, function(value, key) {
  27026. * console.log(key);
  27027. * });
  27028. * // => Logs 'a' then 'b' (iteration order is not guaranteed).
  27029. */
  27030. function forEach(collection, iteratee) {
  27031. var func = isArray(collection) ? arrayEach : baseEach;
  27032. return func(collection, getIteratee(iteratee, 3));
  27033. }
  27034. /**
  27035. * This method is like `_.forEach` except that it iterates over elements of
  27036. * `collection` from right to left.
  27037. *
  27038. * @static
  27039. * @memberOf _
  27040. * @since 2.0.0
  27041. * @alias eachRight
  27042. * @category Collection
  27043. * @param {Array|Object} collection The collection to iterate over.
  27044. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  27045. * @returns {Array|Object} Returns `collection`.
  27046. * @see _.forEach
  27047. * @example
  27048. *
  27049. * _.forEachRight([1, 2], function(value) {
  27050. * console.log(value);
  27051. * });
  27052. * // => Logs `2` then `1`.
  27053. */
  27054. function forEachRight(collection, iteratee) {
  27055. var func = isArray(collection) ? arrayEachRight : baseEachRight;
  27056. return func(collection, getIteratee(iteratee, 3));
  27057. }
  27058. /**
  27059. * Creates an object composed of keys generated from the results of running
  27060. * each element of `collection` thru `iteratee`. The order of grouped values
  27061. * is determined by the order they occur in `collection`. The corresponding
  27062. * value of each key is an array of elements responsible for generating the
  27063. * key. The iteratee is invoked with one argument: (value).
  27064. *
  27065. * @static
  27066. * @memberOf _
  27067. * @since 0.1.0
  27068. * @category Collection
  27069. * @param {Array|Object} collection The collection to iterate over.
  27070. * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
  27071. * @returns {Object} Returns the composed aggregate object.
  27072. * @example
  27073. *
  27074. * _.groupBy([6.1, 4.2, 6.3], Math.floor);
  27075. * // => { '4': [4.2], '6': [6.1, 6.3] }
  27076. *
  27077. * // The `_.property` iteratee shorthand.
  27078. * _.groupBy(['one', 'two', 'three'], 'length');
  27079. * // => { '3': ['one', 'two'], '5': ['three'] }
  27080. */
  27081. var groupBy = createAggregator(function(result, value, key) {
  27082. if (hasOwnProperty.call(result, key)) {
  27083. result[key].push(value);
  27084. } else {
  27085. baseAssignValue(result, key, [value]);
  27086. }
  27087. });
  27088. /**
  27089. * Checks if `value` is in `collection`. If `collection` is a string, it's
  27090. * checked for a substring of `value`, otherwise
  27091. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  27092. * is used for equality comparisons. If `fromIndex` is negative, it's used as
  27093. * the offset from the end of `collection`.
  27094. *
  27095. * @static
  27096. * @memberOf _
  27097. * @since 0.1.0
  27098. * @category Collection
  27099. * @param {Array|Object|string} collection The collection to inspect.
  27100. * @param {*} value The value to search for.
  27101. * @param {number} [fromIndex=0] The index to search from.
  27102. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`.
  27103. * @returns {boolean} Returns `true` if `value` is found, else `false`.
  27104. * @example
  27105. *
  27106. * _.includes([1, 2, 3], 1);
  27107. * // => true
  27108. *
  27109. * _.includes([1, 2, 3], 1, 2);
  27110. * // => false
  27111. *
  27112. * _.includes({ 'a': 1, 'b': 2 }, 1);
  27113. * // => true
  27114. *
  27115. * _.includes('abcd', 'bc');
  27116. * // => true
  27117. */
  27118. function includes(collection, value, fromIndex, guard) {
  27119. collection = isArrayLike(collection) ? collection : values(collection);
  27120. fromIndex = (fromIndex && !guard) ? toInteger(fromIndex) : 0;
  27121. var length = collection.length;
  27122. if (fromIndex < 0) {
  27123. fromIndex = nativeMax(length + fromIndex, 0);
  27124. }
  27125. return isString(collection)
  27126. ? (fromIndex <= length && collection.indexOf(value, fromIndex) > -1)
  27127. : (!!length && baseIndexOf(collection, value, fromIndex) > -1);
  27128. }
  27129. /**
  27130. * Invokes the method at `path` of each element in `collection`, returning
  27131. * an array of the results of each invoked method. Any additional arguments
  27132. * are provided to each invoked method. If `path` is a function, it's invoked
  27133. * for, and `this` bound to, each element in `collection`.
  27134. *
  27135. * @static
  27136. * @memberOf _
  27137. * @since 4.0.0
  27138. * @category Collection
  27139. * @param {Array|Object} collection The collection to iterate over.
  27140. * @param {Array|Function|string} path The path of the method to invoke or
  27141. * the function invoked per iteration.
  27142. * @param {...*} [args] The arguments to invoke each method with.
  27143. * @returns {Array} Returns the array of results.
  27144. * @example
  27145. *
  27146. * _.invokeMap([[5, 1, 7], [3, 2, 1]], 'sort');
  27147. * // => [[1, 5, 7], [1, 2, 3]]
  27148. *
  27149. * _.invokeMap([123, 456], String.prototype.split, '');
  27150. * // => [['1', '2', '3'], ['4', '5', '6']]
  27151. */
  27152. var invokeMap = baseRest(function(collection, path, args) {
  27153. var index = -1,
  27154. isFunc = typeof path == 'function',
  27155. result = isArrayLike(collection) ? Array(collection.length) : [];
  27156. baseEach(collection, function(value) {
  27157. result[++index] = isFunc ? apply(path, value, args) : baseInvoke(value, path, args);
  27158. });
  27159. return result;
  27160. });
  27161. /**
  27162. * Creates an object composed of keys generated from the results of running
  27163. * each element of `collection` thru `iteratee`. The corresponding value of
  27164. * each key is the last element responsible for generating the key. The
  27165. * iteratee is invoked with one argument: (value).
  27166. *
  27167. * @static
  27168. * @memberOf _
  27169. * @since 4.0.0
  27170. * @category Collection
  27171. * @param {Array|Object} collection The collection to iterate over.
  27172. * @param {Function} [iteratee=_.identity] The iteratee to transform keys.
  27173. * @returns {Object} Returns the composed aggregate object.
  27174. * @example
  27175. *
  27176. * var array = [
  27177. * { 'dir': 'left', 'code': 97 },
  27178. * { 'dir': 'right', 'code': 100 }
  27179. * ];
  27180. *
  27181. * _.keyBy(array, function(o) {
  27182. * return String.fromCharCode(o.code);
  27183. * });
  27184. * // => { 'a': { 'dir': 'left', 'code': 97 }, 'd': { 'dir': 'right', 'code': 100 } }
  27185. *
  27186. * _.keyBy(array, 'dir');
  27187. * // => { 'left': { 'dir': 'left', 'code': 97 }, 'right': { 'dir': 'right', 'code': 100 } }
  27188. */
  27189. var keyBy = createAggregator(function(result, value, key) {
  27190. baseAssignValue(result, key, value);
  27191. });
  27192. /**
  27193. * Creates an array of values by running each element in `collection` thru
  27194. * `iteratee`. The iteratee is invoked with three arguments:
  27195. * (value, index|key, collection).
  27196. *
  27197. * Many lodash methods are guarded to work as iteratees for methods like
  27198. * `_.every`, `_.filter`, `_.map`, `_.mapValues`, `_.reject`, and `_.some`.
  27199. *
  27200. * The guarded methods are:
  27201. * `ary`, `chunk`, `curry`, `curryRight`, `drop`, `dropRight`, `every`,
  27202. * `fill`, `invert`, `parseInt`, `random`, `range`, `rangeRight`, `repeat`,
  27203. * `sampleSize`, `slice`, `some`, `sortBy`, `split`, `take`, `takeRight`,
  27204. * `template`, `trim`, `trimEnd`, `trimStart`, and `words`
  27205. *
  27206. * @static
  27207. * @memberOf _
  27208. * @since 0.1.0
  27209. * @category Collection
  27210. * @param {Array|Object} collection The collection to iterate over.
  27211. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  27212. * @returns {Array} Returns the new mapped array.
  27213. * @example
  27214. *
  27215. * function square(n) {
  27216. * return n * n;
  27217. * }
  27218. *
  27219. * _.map([4, 8], square);
  27220. * // => [16, 64]
  27221. *
  27222. * _.map({ 'a': 4, 'b': 8 }, square);
  27223. * // => [16, 64] (iteration order is not guaranteed)
  27224. *
  27225. * var users = [
  27226. * { 'user': 'barney' },
  27227. * { 'user': 'fred' }
  27228. * ];
  27229. *
  27230. * // The `_.property` iteratee shorthand.
  27231. * _.map(users, 'user');
  27232. * // => ['barney', 'fred']
  27233. */
  27234. function map(collection, iteratee) {
  27235. var func = isArray(collection) ? arrayMap : baseMap;
  27236. return func(collection, getIteratee(iteratee, 3));
  27237. }
  27238. /**
  27239. * This method is like `_.sortBy` except that it allows specifying the sort
  27240. * orders of the iteratees to sort by. If `orders` is unspecified, all values
  27241. * are sorted in ascending order. Otherwise, specify an order of "desc" for
  27242. * descending or "asc" for ascending sort order of corresponding values.
  27243. *
  27244. * @static
  27245. * @memberOf _
  27246. * @since 4.0.0
  27247. * @category Collection
  27248. * @param {Array|Object} collection The collection to iterate over.
  27249. * @param {Array[]|Function[]|Object[]|string[]} [iteratees=[_.identity]]
  27250. * The iteratees to sort by.
  27251. * @param {string[]} [orders] The sort orders of `iteratees`.
  27252. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`.
  27253. * @returns {Array} Returns the new sorted array.
  27254. * @example
  27255. *
  27256. * var users = [
  27257. * { 'user': 'fred', 'age': 48 },
  27258. * { 'user': 'barney', 'age': 34 },
  27259. * { 'user': 'fred', 'age': 40 },
  27260. * { 'user': 'barney', 'age': 36 }
  27261. * ];
  27262. *
  27263. * // Sort by `user` in ascending order and by `age` in descending order.
  27264. * _.orderBy(users, ['user', 'age'], ['asc', 'desc']);
  27265. * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]]
  27266. */
  27267. function orderBy(collection, iteratees, orders, guard) {
  27268. if (collection == null) {
  27269. return [];
  27270. }
  27271. if (!isArray(iteratees)) {
  27272. iteratees = iteratees == null ? [] : [iteratees];
  27273. }
  27274. orders = guard ? undefined : orders;
  27275. if (!isArray(orders)) {
  27276. orders = orders == null ? [] : [orders];
  27277. }
  27278. return baseOrderBy(collection, iteratees, orders);
  27279. }
  27280. /**
  27281. * Creates an array of elements split into two groups, the first of which
  27282. * contains elements `predicate` returns truthy for, the second of which
  27283. * contains elements `predicate` returns falsey for. The predicate is
  27284. * invoked with one argument: (value).
  27285. *
  27286. * @static
  27287. * @memberOf _
  27288. * @since 3.0.0
  27289. * @category Collection
  27290. * @param {Array|Object} collection The collection to iterate over.
  27291. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  27292. * @returns {Array} Returns the array of grouped elements.
  27293. * @example
  27294. *
  27295. * var users = [
  27296. * { 'user': 'barney', 'age': 36, 'active': false },
  27297. * { 'user': 'fred', 'age': 40, 'active': true },
  27298. * { 'user': 'pebbles', 'age': 1, 'active': false }
  27299. * ];
  27300. *
  27301. * _.partition(users, function(o) { return o.active; });
  27302. * // => objects for [['fred'], ['barney', 'pebbles']]
  27303. *
  27304. * // The `_.matches` iteratee shorthand.
  27305. * _.partition(users, { 'age': 1, 'active': false });
  27306. * // => objects for [['pebbles'], ['barney', 'fred']]
  27307. *
  27308. * // The `_.matchesProperty` iteratee shorthand.
  27309. * _.partition(users, ['active', false]);
  27310. * // => objects for [['barney', 'pebbles'], ['fred']]
  27311. *
  27312. * // The `_.property` iteratee shorthand.
  27313. * _.partition(users, 'active');
  27314. * // => objects for [['fred'], ['barney', 'pebbles']]
  27315. */
  27316. var partition = createAggregator(function(result, value, key) {
  27317. result[key ? 0 : 1].push(value);
  27318. }, function() { return [[], []]; });
  27319. /**
  27320. * Reduces `collection` to a value which is the accumulated result of running
  27321. * each element in `collection` thru `iteratee`, where each successive
  27322. * invocation is supplied the return value of the previous. If `accumulator`
  27323. * is not given, the first element of `collection` is used as the initial
  27324. * value. The iteratee is invoked with four arguments:
  27325. * (accumulator, value, index|key, collection).
  27326. *
  27327. * Many lodash methods are guarded to work as iteratees for methods like
  27328. * `_.reduce`, `_.reduceRight`, and `_.transform`.
  27329. *
  27330. * The guarded methods are:
  27331. * `assign`, `defaults`, `defaultsDeep`, `includes`, `merge`, `orderBy`,
  27332. * and `sortBy`
  27333. *
  27334. * @static
  27335. * @memberOf _
  27336. * @since 0.1.0
  27337. * @category Collection
  27338. * @param {Array|Object} collection The collection to iterate over.
  27339. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  27340. * @param {*} [accumulator] The initial value.
  27341. * @returns {*} Returns the accumulated value.
  27342. * @see _.reduceRight
  27343. * @example
  27344. *
  27345. * _.reduce([1, 2], function(sum, n) {
  27346. * return sum + n;
  27347. * }, 0);
  27348. * // => 3
  27349. *
  27350. * _.reduce({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {
  27351. * (result[value] || (result[value] = [])).push(key);
  27352. * return result;
  27353. * }, {});
  27354. * // => { '1': ['a', 'c'], '2': ['b'] } (iteration order is not guaranteed)
  27355. */
  27356. function reduce(collection, iteratee, accumulator) {
  27357. var func = isArray(collection) ? arrayReduce : baseReduce,
  27358. initAccum = arguments.length < 3;
  27359. return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEach);
  27360. }
  27361. /**
  27362. * This method is like `_.reduce` except that it iterates over elements of
  27363. * `collection` from right to left.
  27364. *
  27365. * @static
  27366. * @memberOf _
  27367. * @since 0.1.0
  27368. * @category Collection
  27369. * @param {Array|Object} collection The collection to iterate over.
  27370. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  27371. * @param {*} [accumulator] The initial value.
  27372. * @returns {*} Returns the accumulated value.
  27373. * @see _.reduce
  27374. * @example
  27375. *
  27376. * var array = [[0, 1], [2, 3], [4, 5]];
  27377. *
  27378. * _.reduceRight(array, function(flattened, other) {
  27379. * return flattened.concat(other);
  27380. * }, []);
  27381. * // => [4, 5, 2, 3, 0, 1]
  27382. */
  27383. function reduceRight(collection, iteratee, accumulator) {
  27384. var func = isArray(collection) ? arrayReduceRight : baseReduce,
  27385. initAccum = arguments.length < 3;
  27386. return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEachRight);
  27387. }
  27388. /**
  27389. * The opposite of `_.filter`; this method returns the elements of `collection`
  27390. * that `predicate` does **not** return truthy for.
  27391. *
  27392. * @static
  27393. * @memberOf _
  27394. * @since 0.1.0
  27395. * @category Collection
  27396. * @param {Array|Object} collection The collection to iterate over.
  27397. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  27398. * @returns {Array} Returns the new filtered array.
  27399. * @see _.filter
  27400. * @example
  27401. *
  27402. * var users = [
  27403. * { 'user': 'barney', 'age': 36, 'active': false },
  27404. * { 'user': 'fred', 'age': 40, 'active': true }
  27405. * ];
  27406. *
  27407. * _.reject(users, function(o) { return !o.active; });
  27408. * // => objects for ['fred']
  27409. *
  27410. * // The `_.matches` iteratee shorthand.
  27411. * _.reject(users, { 'age': 40, 'active': true });
  27412. * // => objects for ['barney']
  27413. *
  27414. * // The `_.matchesProperty` iteratee shorthand.
  27415. * _.reject(users, ['active', false]);
  27416. * // => objects for ['fred']
  27417. *
  27418. * // The `_.property` iteratee shorthand.
  27419. * _.reject(users, 'active');
  27420. * // => objects for ['barney']
  27421. */
  27422. function reject(collection, predicate) {
  27423. var func = isArray(collection) ? arrayFilter : baseFilter;
  27424. return func(collection, negate(getIteratee(predicate, 3)));
  27425. }
  27426. /**
  27427. * Gets a random element from `collection`.
  27428. *
  27429. * @static
  27430. * @memberOf _
  27431. * @since 2.0.0
  27432. * @category Collection
  27433. * @param {Array|Object} collection The collection to sample.
  27434. * @returns {*} Returns the random element.
  27435. * @example
  27436. *
  27437. * _.sample([1, 2, 3, 4]);
  27438. * // => 2
  27439. */
  27440. function sample(collection) {
  27441. var func = isArray(collection) ? arraySample : baseSample;
  27442. return func(collection);
  27443. }
  27444. /**
  27445. * Gets `n` random elements at unique keys from `collection` up to the
  27446. * size of `collection`.
  27447. *
  27448. * @static
  27449. * @memberOf _
  27450. * @since 4.0.0
  27451. * @category Collection
  27452. * @param {Array|Object} collection The collection to sample.
  27453. * @param {number} [n=1] The number of elements to sample.
  27454. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  27455. * @returns {Array} Returns the random elements.
  27456. * @example
  27457. *
  27458. * _.sampleSize([1, 2, 3], 2);
  27459. * // => [3, 1]
  27460. *
  27461. * _.sampleSize([1, 2, 3], 4);
  27462. * // => [2, 3, 1]
  27463. */
  27464. function sampleSize(collection, n, guard) {
  27465. if ((guard ? isIterateeCall(collection, n, guard) : n === undefined)) {
  27466. n = 1;
  27467. } else {
  27468. n = toInteger(n);
  27469. }
  27470. var func = isArray(collection) ? arraySampleSize : baseSampleSize;
  27471. return func(collection, n);
  27472. }
  27473. /**
  27474. * Creates an array of shuffled values, using a version of the
  27475. * [Fisher-Yates shuffle](https://en.wikipedia.org/wiki/Fisher-Yates_shuffle).
  27476. *
  27477. * @static
  27478. * @memberOf _
  27479. * @since 0.1.0
  27480. * @category Collection
  27481. * @param {Array|Object} collection The collection to shuffle.
  27482. * @returns {Array} Returns the new shuffled array.
  27483. * @example
  27484. *
  27485. * _.shuffle([1, 2, 3, 4]);
  27486. * // => [4, 1, 3, 2]
  27487. */
  27488. function shuffle(collection) {
  27489. var func = isArray(collection) ? arrayShuffle : baseShuffle;
  27490. return func(collection);
  27491. }
  27492. /**
  27493. * Gets the size of `collection` by returning its length for array-like
  27494. * values or the number of own enumerable string keyed properties for objects.
  27495. *
  27496. * @static
  27497. * @memberOf _
  27498. * @since 0.1.0
  27499. * @category Collection
  27500. * @param {Array|Object|string} collection The collection to inspect.
  27501. * @returns {number} Returns the collection size.
  27502. * @example
  27503. *
  27504. * _.size([1, 2, 3]);
  27505. * // => 3
  27506. *
  27507. * _.size({ 'a': 1, 'b': 2 });
  27508. * // => 2
  27509. *
  27510. * _.size('pebbles');
  27511. * // => 7
  27512. */
  27513. function size(collection) {
  27514. if (collection == null) {
  27515. return 0;
  27516. }
  27517. if (isArrayLike(collection)) {
  27518. return isString(collection) ? stringSize(collection) : collection.length;
  27519. }
  27520. var tag = getTag(collection);
  27521. if (tag == mapTag || tag == setTag) {
  27522. return collection.size;
  27523. }
  27524. return baseKeys(collection).length;
  27525. }
  27526. /**
  27527. * Checks if `predicate` returns truthy for **any** element of `collection`.
  27528. * Iteration is stopped once `predicate` returns truthy. The predicate is
  27529. * invoked with three arguments: (value, index|key, collection).
  27530. *
  27531. * @static
  27532. * @memberOf _
  27533. * @since 0.1.0
  27534. * @category Collection
  27535. * @param {Array|Object} collection The collection to iterate over.
  27536. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  27537. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  27538. * @returns {boolean} Returns `true` if any element passes the predicate check,
  27539. * else `false`.
  27540. * @example
  27541. *
  27542. * _.some([null, 0, 'yes', false], Boolean);
  27543. * // => true
  27544. *
  27545. * var users = [
  27546. * { 'user': 'barney', 'active': true },
  27547. * { 'user': 'fred', 'active': false }
  27548. * ];
  27549. *
  27550. * // The `_.matches` iteratee shorthand.
  27551. * _.some(users, { 'user': 'barney', 'active': false });
  27552. * // => false
  27553. *
  27554. * // The `_.matchesProperty` iteratee shorthand.
  27555. * _.some(users, ['active', false]);
  27556. * // => true
  27557. *
  27558. * // The `_.property` iteratee shorthand.
  27559. * _.some(users, 'active');
  27560. * // => true
  27561. */
  27562. function some(collection, predicate, guard) {
  27563. var func = isArray(collection) ? arraySome : baseSome;
  27564. if (guard && isIterateeCall(collection, predicate, guard)) {
  27565. predicate = undefined;
  27566. }
  27567. return func(collection, getIteratee(predicate, 3));
  27568. }
  27569. /**
  27570. * Creates an array of elements, sorted in ascending order by the results of
  27571. * running each element in a collection thru each iteratee. This method
  27572. * performs a stable sort, that is, it preserves the original sort order of
  27573. * equal elements. The iteratees are invoked with one argument: (value).
  27574. *
  27575. * @static
  27576. * @memberOf _
  27577. * @since 0.1.0
  27578. * @category Collection
  27579. * @param {Array|Object} collection The collection to iterate over.
  27580. * @param {...(Function|Function[])} [iteratees=[_.identity]]
  27581. * The iteratees to sort by.
  27582. * @returns {Array} Returns the new sorted array.
  27583. * @example
  27584. *
  27585. * var users = [
  27586. * { 'user': 'fred', 'age': 48 },
  27587. * { 'user': 'barney', 'age': 36 },
  27588. * { 'user': 'fred', 'age': 40 },
  27589. * { 'user': 'barney', 'age': 34 }
  27590. * ];
  27591. *
  27592. * _.sortBy(users, [function(o) { return o.user; }]);
  27593. * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]]
  27594. *
  27595. * _.sortBy(users, ['user', 'age']);
  27596. * // => objects for [['barney', 34], ['barney', 36], ['fred', 40], ['fred', 48]]
  27597. */
  27598. var sortBy = baseRest(function(collection, iteratees) {
  27599. if (collection == null) {
  27600. return [];
  27601. }
  27602. var length = iteratees.length;
  27603. if (length > 1 && isIterateeCall(collection, iteratees[0], iteratees[1])) {
  27604. iteratees = [];
  27605. } else if (length > 2 && isIterateeCall(iteratees[0], iteratees[1], iteratees[2])) {
  27606. iteratees = [iteratees[0]];
  27607. }
  27608. return baseOrderBy(collection, baseFlatten(iteratees, 1), []);
  27609. });
  27610. /*------------------------------------------------------------------------*/
  27611. /**
  27612. * Gets the timestamp of the number of milliseconds that have elapsed since
  27613. * the Unix epoch (1 January 1970 00:00:00 UTC).
  27614. *
  27615. * @static
  27616. * @memberOf _
  27617. * @since 2.4.0
  27618. * @category Date
  27619. * @returns {number} Returns the timestamp.
  27620. * @example
  27621. *
  27622. * _.defer(function(stamp) {
  27623. * console.log(_.now() - stamp);
  27624. * }, _.now());
  27625. * // => Logs the number of milliseconds it took for the deferred invocation.
  27626. */
  27627. var now = ctxNow || function() {
  27628. return root.Date.now();
  27629. };
  27630. /*------------------------------------------------------------------------*/
  27631. /**
  27632. * The opposite of `_.before`; this method creates a function that invokes
  27633. * `func` once it's called `n` or more times.
  27634. *
  27635. * @static
  27636. * @memberOf _
  27637. * @since 0.1.0
  27638. * @category Function
  27639. * @param {number} n The number of calls before `func` is invoked.
  27640. * @param {Function} func The function to restrict.
  27641. * @returns {Function} Returns the new restricted function.
  27642. * @example
  27643. *
  27644. * var saves = ['profile', 'settings'];
  27645. *
  27646. * var done = _.after(saves.length, function() {
  27647. * console.log('done saving!');
  27648. * });
  27649. *
  27650. * _.forEach(saves, function(type) {
  27651. * asyncSave({ 'type': type, 'complete': done });
  27652. * });
  27653. * // => Logs 'done saving!' after the two async saves have completed.
  27654. */
  27655. function after(n, func) {
  27656. if (typeof func != 'function') {
  27657. throw new TypeError(FUNC_ERROR_TEXT);
  27658. }
  27659. n = toInteger(n);
  27660. return function() {
  27661. if (--n < 1) {
  27662. return func.apply(this, arguments);
  27663. }
  27664. };
  27665. }
  27666. /**
  27667. * Creates a function that invokes `func`, with up to `n` arguments,
  27668. * ignoring any additional arguments.
  27669. *
  27670. * @static
  27671. * @memberOf _
  27672. * @since 3.0.0
  27673. * @category Function
  27674. * @param {Function} func The function to cap arguments for.
  27675. * @param {number} [n=func.length] The arity cap.
  27676. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  27677. * @returns {Function} Returns the new capped function.
  27678. * @example
  27679. *
  27680. * _.map(['6', '8', '10'], _.ary(parseInt, 1));
  27681. * // => [6, 8, 10]
  27682. */
  27683. function ary(func, n, guard) {
  27684. n = guard ? undefined : n;
  27685. n = (func && n == null) ? func.length : n;
  27686. return createWrap(func, WRAP_ARY_FLAG, undefined, undefined, undefined, undefined, n);
  27687. }
  27688. /**
  27689. * Creates a function that invokes `func`, with the `this` binding and arguments
  27690. * of the created function, while it's called less than `n` times. Subsequent
  27691. * calls to the created function return the result of the last `func` invocation.
  27692. *
  27693. * @static
  27694. * @memberOf _
  27695. * @since 3.0.0
  27696. * @category Function
  27697. * @param {number} n The number of calls at which `func` is no longer invoked.
  27698. * @param {Function} func The function to restrict.
  27699. * @returns {Function} Returns the new restricted function.
  27700. * @example
  27701. *
  27702. * jQuery(element).on('click', _.before(5, addContactToList));
  27703. * // => Allows adding up to 4 contacts to the list.
  27704. */
  27705. function before(n, func) {
  27706. var result;
  27707. if (typeof func != 'function') {
  27708. throw new TypeError(FUNC_ERROR_TEXT);
  27709. }
  27710. n = toInteger(n);
  27711. return function() {
  27712. if (--n > 0) {
  27713. result = func.apply(this, arguments);
  27714. }
  27715. if (n <= 1) {
  27716. func = undefined;
  27717. }
  27718. return result;
  27719. };
  27720. }
  27721. /**
  27722. * Creates a function that invokes `func` with the `this` binding of `thisArg`
  27723. * and `partials` prepended to the arguments it receives.
  27724. *
  27725. * The `_.bind.placeholder` value, which defaults to `_` in monolithic builds,
  27726. * may be used as a placeholder for partially applied arguments.
  27727. *
  27728. * **Note:** Unlike native `Function#bind`, this method doesn't set the "length"
  27729. * property of bound functions.
  27730. *
  27731. * @static
  27732. * @memberOf _
  27733. * @since 0.1.0
  27734. * @category Function
  27735. * @param {Function} func The function to bind.
  27736. * @param {*} thisArg The `this` binding of `func`.
  27737. * @param {...*} [partials] The arguments to be partially applied.
  27738. * @returns {Function} Returns the new bound function.
  27739. * @example
  27740. *
  27741. * function greet(greeting, punctuation) {
  27742. * return greeting + ' ' + this.user + punctuation;
  27743. * }
  27744. *
  27745. * var object = { 'user': 'fred' };
  27746. *
  27747. * var bound = _.bind(greet, object, 'hi');
  27748. * bound('!');
  27749. * // => 'hi fred!'
  27750. *
  27751. * // Bound with placeholders.
  27752. * var bound = _.bind(greet, object, _, '!');
  27753. * bound('hi');
  27754. * // => 'hi fred!'
  27755. */
  27756. var bind = baseRest(function(func, thisArg, partials) {
  27757. var bitmask = WRAP_BIND_FLAG;
  27758. if (partials.length) {
  27759. var holders = replaceHolders(partials, getHolder(bind));
  27760. bitmask |= WRAP_PARTIAL_FLAG;
  27761. }
  27762. return createWrap(func, bitmask, thisArg, partials, holders);
  27763. });
  27764. /**
  27765. * Creates a function that invokes the method at `object[key]` with `partials`
  27766. * prepended to the arguments it receives.
  27767. *
  27768. * This method differs from `_.bind` by allowing bound functions to reference
  27769. * methods that may be redefined or don't yet exist. See
  27770. * [Peter Michaux's article](http://peter.michaux.ca/articles/lazy-function-definition-pattern)
  27771. * for more details.
  27772. *
  27773. * The `_.bindKey.placeholder` value, which defaults to `_` in monolithic
  27774. * builds, may be used as a placeholder for partially applied arguments.
  27775. *
  27776. * @static
  27777. * @memberOf _
  27778. * @since 0.10.0
  27779. * @category Function
  27780. * @param {Object} object The object to invoke the method on.
  27781. * @param {string} key The key of the method.
  27782. * @param {...*} [partials] The arguments to be partially applied.
  27783. * @returns {Function} Returns the new bound function.
  27784. * @example
  27785. *
  27786. * var object = {
  27787. * 'user': 'fred',
  27788. * 'greet': function(greeting, punctuation) {
  27789. * return greeting + ' ' + this.user + punctuation;
  27790. * }
  27791. * };
  27792. *
  27793. * var bound = _.bindKey(object, 'greet', 'hi');
  27794. * bound('!');
  27795. * // => 'hi fred!'
  27796. *
  27797. * object.greet = function(greeting, punctuation) {
  27798. * return greeting + 'ya ' + this.user + punctuation;
  27799. * };
  27800. *
  27801. * bound('!');
  27802. * // => 'hiya fred!'
  27803. *
  27804. * // Bound with placeholders.
  27805. * var bound = _.bindKey(object, 'greet', _, '!');
  27806. * bound('hi');
  27807. * // => 'hiya fred!'
  27808. */
  27809. var bindKey = baseRest(function(object, key, partials) {
  27810. var bitmask = WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG;
  27811. if (partials.length) {
  27812. var holders = replaceHolders(partials, getHolder(bindKey));
  27813. bitmask |= WRAP_PARTIAL_FLAG;
  27814. }
  27815. return createWrap(key, bitmask, object, partials, holders);
  27816. });
  27817. /**
  27818. * Creates a function that accepts arguments of `func` and either invokes
  27819. * `func` returning its result, if at least `arity` number of arguments have
  27820. * been provided, or returns a function that accepts the remaining `func`
  27821. * arguments, and so on. The arity of `func` may be specified if `func.length`
  27822. * is not sufficient.
  27823. *
  27824. * The `_.curry.placeholder` value, which defaults to `_` in monolithic builds,
  27825. * may be used as a placeholder for provided arguments.
  27826. *
  27827. * **Note:** This method doesn't set the "length" property of curried functions.
  27828. *
  27829. * @static
  27830. * @memberOf _
  27831. * @since 2.0.0
  27832. * @category Function
  27833. * @param {Function} func The function to curry.
  27834. * @param {number} [arity=func.length] The arity of `func`.
  27835. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  27836. * @returns {Function} Returns the new curried function.
  27837. * @example
  27838. *
  27839. * var abc = function(a, b, c) {
  27840. * return [a, b, c];
  27841. * };
  27842. *
  27843. * var curried = _.curry(abc);
  27844. *
  27845. * curried(1)(2)(3);
  27846. * // => [1, 2, 3]
  27847. *
  27848. * curried(1, 2)(3);
  27849. * // => [1, 2, 3]
  27850. *
  27851. * curried(1, 2, 3);
  27852. * // => [1, 2, 3]
  27853. *
  27854. * // Curried with placeholders.
  27855. * curried(1)(_, 3)(2);
  27856. * // => [1, 2, 3]
  27857. */
  27858. function curry(func, arity, guard) {
  27859. arity = guard ? undefined : arity;
  27860. var result = createWrap(func, WRAP_CURRY_FLAG, undefined, undefined, undefined, undefined, undefined, arity);
  27861. result.placeholder = curry.placeholder;
  27862. return result;
  27863. }
  27864. /**
  27865. * This method is like `_.curry` except that arguments are applied to `func`
  27866. * in the manner of `_.partialRight` instead of `_.partial`.
  27867. *
  27868. * The `_.curryRight.placeholder` value, which defaults to `_` in monolithic
  27869. * builds, may be used as a placeholder for provided arguments.
  27870. *
  27871. * **Note:** This method doesn't set the "length" property of curried functions.
  27872. *
  27873. * @static
  27874. * @memberOf _
  27875. * @since 3.0.0
  27876. * @category Function
  27877. * @param {Function} func The function to curry.
  27878. * @param {number} [arity=func.length] The arity of `func`.
  27879. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  27880. * @returns {Function} Returns the new curried function.
  27881. * @example
  27882. *
  27883. * var abc = function(a, b, c) {
  27884. * return [a, b, c];
  27885. * };
  27886. *
  27887. * var curried = _.curryRight(abc);
  27888. *
  27889. * curried(3)(2)(1);
  27890. * // => [1, 2, 3]
  27891. *
  27892. * curried(2, 3)(1);
  27893. * // => [1, 2, 3]
  27894. *
  27895. * curried(1, 2, 3);
  27896. * // => [1, 2, 3]
  27897. *
  27898. * // Curried with placeholders.
  27899. * curried(3)(1, _)(2);
  27900. * // => [1, 2, 3]
  27901. */
  27902. function curryRight(func, arity, guard) {
  27903. arity = guard ? undefined : arity;
  27904. var result = createWrap(func, WRAP_CURRY_RIGHT_FLAG, undefined, undefined, undefined, undefined, undefined, arity);
  27905. result.placeholder = curryRight.placeholder;
  27906. return result;
  27907. }
  27908. /**
  27909. * Creates a debounced function that delays invoking `func` until after `wait`
  27910. * milliseconds have elapsed since the last time the debounced function was
  27911. * invoked. The debounced function comes with a `cancel` method to cancel
  27912. * delayed `func` invocations and a `flush` method to immediately invoke them.
  27913. * Provide `options` to indicate whether `func` should be invoked on the
  27914. * leading and/or trailing edge of the `wait` timeout. The `func` is invoked
  27915. * with the last arguments provided to the debounced function. Subsequent
  27916. * calls to the debounced function return the result of the last `func`
  27917. * invocation.
  27918. *
  27919. * **Note:** If `leading` and `trailing` options are `true`, `func` is
  27920. * invoked on the trailing edge of the timeout only if the debounced function
  27921. * is invoked more than once during the `wait` timeout.
  27922. *
  27923. * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
  27924. * until to the next tick, similar to `setTimeout` with a timeout of `0`.
  27925. *
  27926. * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
  27927. * for details over the differences between `_.debounce` and `_.throttle`.
  27928. *
  27929. * @static
  27930. * @memberOf _
  27931. * @since 0.1.0
  27932. * @category Function
  27933. * @param {Function} func The function to debounce.
  27934. * @param {number} [wait=0] The number of milliseconds to delay.
  27935. * @param {Object} [options={}] The options object.
  27936. * @param {boolean} [options.leading=false]
  27937. * Specify invoking on the leading edge of the timeout.
  27938. * @param {number} [options.maxWait]
  27939. * The maximum time `func` is allowed to be delayed before it's invoked.
  27940. * @param {boolean} [options.trailing=true]
  27941. * Specify invoking on the trailing edge of the timeout.
  27942. * @returns {Function} Returns the new debounced function.
  27943. * @example
  27944. *
  27945. * // Avoid costly calculations while the window size is in flux.
  27946. * jQuery(window).on('resize', _.debounce(calculateLayout, 150));
  27947. *
  27948. * // Invoke `sendMail` when clicked, debouncing subsequent calls.
  27949. * jQuery(element).on('click', _.debounce(sendMail, 300, {
  27950. * 'leading': true,
  27951. * 'trailing': false
  27952. * }));
  27953. *
  27954. * // Ensure `batchLog` is invoked once after 1 second of debounced calls.
  27955. * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });
  27956. * var source = new EventSource('/stream');
  27957. * jQuery(source).on('message', debounced);
  27958. *
  27959. * // Cancel the trailing debounced invocation.
  27960. * jQuery(window).on('popstate', debounced.cancel);
  27961. */
  27962. function debounce(func, wait, options) {
  27963. var lastArgs,
  27964. lastThis,
  27965. maxWait,
  27966. result,
  27967. timerId,
  27968. lastCallTime,
  27969. lastInvokeTime = 0,
  27970. leading = false,
  27971. maxing = false,
  27972. trailing = true;
  27973. if (typeof func != 'function') {
  27974. throw new TypeError(FUNC_ERROR_TEXT);
  27975. }
  27976. wait = toNumber(wait) || 0;
  27977. if (isObject(options)) {
  27978. leading = !!options.leading;
  27979. maxing = 'maxWait' in options;
  27980. maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
  27981. trailing = 'trailing' in options ? !!options.trailing : trailing;
  27982. }
  27983. function invokeFunc(time) {
  27984. var args = lastArgs,
  27985. thisArg = lastThis;
  27986. lastArgs = lastThis = undefined;
  27987. lastInvokeTime = time;
  27988. result = func.apply(thisArg, args);
  27989. return result;
  27990. }
  27991. function leadingEdge(time) {
  27992. // Reset any `maxWait` timer.
  27993. lastInvokeTime = time;
  27994. // Start the timer for the trailing edge.
  27995. timerId = setTimeout(timerExpired, wait);
  27996. // Invoke the leading edge.
  27997. return leading ? invokeFunc(time) : result;
  27998. }
  27999. function remainingWait(time) {
  28000. var timeSinceLastCall = time - lastCallTime,
  28001. timeSinceLastInvoke = time - lastInvokeTime,
  28002. timeWaiting = wait - timeSinceLastCall;
  28003. return maxing
  28004. ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke)
  28005. : timeWaiting;
  28006. }
  28007. function shouldInvoke(time) {
  28008. var timeSinceLastCall = time - lastCallTime,
  28009. timeSinceLastInvoke = time - lastInvokeTime;
  28010. // Either this is the first call, activity has stopped and we're at the
  28011. // trailing edge, the system time has gone backwards and we're treating
  28012. // it as the trailing edge, or we've hit the `maxWait` limit.
  28013. return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||
  28014. (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));
  28015. }
  28016. function timerExpired() {
  28017. var time = now();
  28018. if (shouldInvoke(time)) {
  28019. return trailingEdge(time);
  28020. }
  28021. // Restart the timer.
  28022. timerId = setTimeout(timerExpired, remainingWait(time));
  28023. }
  28024. function trailingEdge(time) {
  28025. timerId = undefined;
  28026. // Only invoke if we have `lastArgs` which means `func` has been
  28027. // debounced at least once.
  28028. if (trailing && lastArgs) {
  28029. return invokeFunc(time);
  28030. }
  28031. lastArgs = lastThis = undefined;
  28032. return result;
  28033. }
  28034. function cancel() {
  28035. if (timerId !== undefined) {
  28036. clearTimeout(timerId);
  28037. }
  28038. lastInvokeTime = 0;
  28039. lastArgs = lastCallTime = lastThis = timerId = undefined;
  28040. }
  28041. function flush() {
  28042. return timerId === undefined ? result : trailingEdge(now());
  28043. }
  28044. function debounced() {
  28045. var time = now(),
  28046. isInvoking = shouldInvoke(time);
  28047. lastArgs = arguments;
  28048. lastThis = this;
  28049. lastCallTime = time;
  28050. if (isInvoking) {
  28051. if (timerId === undefined) {
  28052. return leadingEdge(lastCallTime);
  28053. }
  28054. if (maxing) {
  28055. // Handle invocations in a tight loop.
  28056. clearTimeout(timerId);
  28057. timerId = setTimeout(timerExpired, wait);
  28058. return invokeFunc(lastCallTime);
  28059. }
  28060. }
  28061. if (timerId === undefined) {
  28062. timerId = setTimeout(timerExpired, wait);
  28063. }
  28064. return result;
  28065. }
  28066. debounced.cancel = cancel;
  28067. debounced.flush = flush;
  28068. return debounced;
  28069. }
  28070. /**
  28071. * Defers invoking the `func` until the current call stack has cleared. Any
  28072. * additional arguments are provided to `func` when it's invoked.
  28073. *
  28074. * @static
  28075. * @memberOf _
  28076. * @since 0.1.0
  28077. * @category Function
  28078. * @param {Function} func The function to defer.
  28079. * @param {...*} [args] The arguments to invoke `func` with.
  28080. * @returns {number} Returns the timer id.
  28081. * @example
  28082. *
  28083. * _.defer(function(text) {
  28084. * console.log(text);
  28085. * }, 'deferred');
  28086. * // => Logs 'deferred' after one millisecond.
  28087. */
  28088. var defer = baseRest(function(func, args) {
  28089. return baseDelay(func, 1, args);
  28090. });
  28091. /**
  28092. * Invokes `func` after `wait` milliseconds. Any additional arguments are
  28093. * provided to `func` when it's invoked.
  28094. *
  28095. * @static
  28096. * @memberOf _
  28097. * @since 0.1.0
  28098. * @category Function
  28099. * @param {Function} func The function to delay.
  28100. * @param {number} wait The number of milliseconds to delay invocation.
  28101. * @param {...*} [args] The arguments to invoke `func` with.
  28102. * @returns {number} Returns the timer id.
  28103. * @example
  28104. *
  28105. * _.delay(function(text) {
  28106. * console.log(text);
  28107. * }, 1000, 'later');
  28108. * // => Logs 'later' after one second.
  28109. */
  28110. var delay = baseRest(function(func, wait, args) {
  28111. return baseDelay(func, toNumber(wait) || 0, args);
  28112. });
  28113. /**
  28114. * Creates a function that invokes `func` with arguments reversed.
  28115. *
  28116. * @static
  28117. * @memberOf _
  28118. * @since 4.0.0
  28119. * @category Function
  28120. * @param {Function} func The function to flip arguments for.
  28121. * @returns {Function} Returns the new flipped function.
  28122. * @example
  28123. *
  28124. * var flipped = _.flip(function() {
  28125. * return _.toArray(arguments);
  28126. * });
  28127. *
  28128. * flipped('a', 'b', 'c', 'd');
  28129. * // => ['d', 'c', 'b', 'a']
  28130. */
  28131. function flip(func) {
  28132. return createWrap(func, WRAP_FLIP_FLAG);
  28133. }
  28134. /**
  28135. * Creates a function that memoizes the result of `func`. If `resolver` is
  28136. * provided, it determines the cache key for storing the result based on the
  28137. * arguments provided to the memoized function. By default, the first argument
  28138. * provided to the memoized function is used as the map cache key. The `func`
  28139. * is invoked with the `this` binding of the memoized function.
  28140. *
  28141. * **Note:** The cache is exposed as the `cache` property on the memoized
  28142. * function. Its creation may be customized by replacing the `_.memoize.Cache`
  28143. * constructor with one whose instances implement the
  28144. * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)
  28145. * method interface of `clear`, `delete`, `get`, `has`, and `set`.
  28146. *
  28147. * @static
  28148. * @memberOf _
  28149. * @since 0.1.0
  28150. * @category Function
  28151. * @param {Function} func The function to have its output memoized.
  28152. * @param {Function} [resolver] The function to resolve the cache key.
  28153. * @returns {Function} Returns the new memoized function.
  28154. * @example
  28155. *
  28156. * var object = { 'a': 1, 'b': 2 };
  28157. * var other = { 'c': 3, 'd': 4 };
  28158. *
  28159. * var values = _.memoize(_.values);
  28160. * values(object);
  28161. * // => [1, 2]
  28162. *
  28163. * values(other);
  28164. * // => [3, 4]
  28165. *
  28166. * object.a = 2;
  28167. * values(object);
  28168. * // => [1, 2]
  28169. *
  28170. * // Modify the result cache.
  28171. * values.cache.set(object, ['a', 'b']);
  28172. * values(object);
  28173. * // => ['a', 'b']
  28174. *
  28175. * // Replace `_.memoize.Cache`.
  28176. * _.memoize.Cache = WeakMap;
  28177. */
  28178. function memoize(func, resolver) {
  28179. if (typeof func != 'function' || (resolver != null && typeof resolver != 'function')) {
  28180. throw new TypeError(FUNC_ERROR_TEXT);
  28181. }
  28182. var memoized = function() {
  28183. var args = arguments,
  28184. key = resolver ? resolver.apply(this, args) : args[0],
  28185. cache = memoized.cache;
  28186. if (cache.has(key)) {
  28187. return cache.get(key);
  28188. }
  28189. var result = func.apply(this, args);
  28190. memoized.cache = cache.set(key, result) || cache;
  28191. return result;
  28192. };
  28193. memoized.cache = new (memoize.Cache || MapCache);
  28194. return memoized;
  28195. }
  28196. // Expose `MapCache`.
  28197. memoize.Cache = MapCache;
  28198. /**
  28199. * Creates a function that negates the result of the predicate `func`. The
  28200. * `func` predicate is invoked with the `this` binding and arguments of the
  28201. * created function.
  28202. *
  28203. * @static
  28204. * @memberOf _
  28205. * @since 3.0.0
  28206. * @category Function
  28207. * @param {Function} predicate The predicate to negate.
  28208. * @returns {Function} Returns the new negated function.
  28209. * @example
  28210. *
  28211. * function isEven(n) {
  28212. * return n % 2 == 0;
  28213. * }
  28214. *
  28215. * _.filter([1, 2, 3, 4, 5, 6], _.negate(isEven));
  28216. * // => [1, 3, 5]
  28217. */
  28218. function negate(predicate) {
  28219. if (typeof predicate != 'function') {
  28220. throw new TypeError(FUNC_ERROR_TEXT);
  28221. }
  28222. return function() {
  28223. var args = arguments;
  28224. switch (args.length) {
  28225. case 0: return !predicate.call(this);
  28226. case 1: return !predicate.call(this, args[0]);
  28227. case 2: return !predicate.call(this, args[0], args[1]);
  28228. case 3: return !predicate.call(this, args[0], args[1], args[2]);
  28229. }
  28230. return !predicate.apply(this, args);
  28231. };
  28232. }
  28233. /**
  28234. * Creates a function that is restricted to invoking `func` once. Repeat calls
  28235. * to the function return the value of the first invocation. The `func` is
  28236. * invoked with the `this` binding and arguments of the created function.
  28237. *
  28238. * @static
  28239. * @memberOf _
  28240. * @since 0.1.0
  28241. * @category Function
  28242. * @param {Function} func The function to restrict.
  28243. * @returns {Function} Returns the new restricted function.
  28244. * @example
  28245. *
  28246. * var initialize = _.once(createApplication);
  28247. * initialize();
  28248. * initialize();
  28249. * // => `createApplication` is invoked once
  28250. */
  28251. function once(func) {
  28252. return before(2, func);
  28253. }
  28254. /**
  28255. * Creates a function that invokes `func` with its arguments transformed.
  28256. *
  28257. * @static
  28258. * @since 4.0.0
  28259. * @memberOf _
  28260. * @category Function
  28261. * @param {Function} func The function to wrap.
  28262. * @param {...(Function|Function[])} [transforms=[_.identity]]
  28263. * The argument transforms.
  28264. * @returns {Function} Returns the new function.
  28265. * @example
  28266. *
  28267. * function doubled(n) {
  28268. * return n * 2;
  28269. * }
  28270. *
  28271. * function square(n) {
  28272. * return n * n;
  28273. * }
  28274. *
  28275. * var func = _.overArgs(function(x, y) {
  28276. * return [x, y];
  28277. * }, [square, doubled]);
  28278. *
  28279. * func(9, 3);
  28280. * // => [81, 6]
  28281. *
  28282. * func(10, 5);
  28283. * // => [100, 10]
  28284. */
  28285. var overArgs = castRest(function(func, transforms) {
  28286. transforms = (transforms.length == 1 && isArray(transforms[0]))
  28287. ? arrayMap(transforms[0], baseUnary(getIteratee()))
  28288. : arrayMap(baseFlatten(transforms, 1), baseUnary(getIteratee()));
  28289. var funcsLength = transforms.length;
  28290. return baseRest(function(args) {
  28291. var index = -1,
  28292. length = nativeMin(args.length, funcsLength);
  28293. while (++index < length) {
  28294. args[index] = transforms[index].call(this, args[index]);
  28295. }
  28296. return apply(func, this, args);
  28297. });
  28298. });
  28299. /**
  28300. * Creates a function that invokes `func` with `partials` prepended to the
  28301. * arguments it receives. This method is like `_.bind` except it does **not**
  28302. * alter the `this` binding.
  28303. *
  28304. * The `_.partial.placeholder` value, which defaults to `_` in monolithic
  28305. * builds, may be used as a placeholder for partially applied arguments.
  28306. *
  28307. * **Note:** This method doesn't set the "length" property of partially
  28308. * applied functions.
  28309. *
  28310. * @static
  28311. * @memberOf _
  28312. * @since 0.2.0
  28313. * @category Function
  28314. * @param {Function} func The function to partially apply arguments to.
  28315. * @param {...*} [partials] The arguments to be partially applied.
  28316. * @returns {Function} Returns the new partially applied function.
  28317. * @example
  28318. *
  28319. * function greet(greeting, name) {
  28320. * return greeting + ' ' + name;
  28321. * }
  28322. *
  28323. * var sayHelloTo = _.partial(greet, 'hello');
  28324. * sayHelloTo('fred');
  28325. * // => 'hello fred'
  28326. *
  28327. * // Partially applied with placeholders.
  28328. * var greetFred = _.partial(greet, _, 'fred');
  28329. * greetFred('hi');
  28330. * // => 'hi fred'
  28331. */
  28332. var partial = baseRest(function(func, partials) {
  28333. var holders = replaceHolders(partials, getHolder(partial));
  28334. return createWrap(func, WRAP_PARTIAL_FLAG, undefined, partials, holders);
  28335. });
  28336. /**
  28337. * This method is like `_.partial` except that partially applied arguments
  28338. * are appended to the arguments it receives.
  28339. *
  28340. * The `_.partialRight.placeholder` value, which defaults to `_` in monolithic
  28341. * builds, may be used as a placeholder for partially applied arguments.
  28342. *
  28343. * **Note:** This method doesn't set the "length" property of partially
  28344. * applied functions.
  28345. *
  28346. * @static
  28347. * @memberOf _
  28348. * @since 1.0.0
  28349. * @category Function
  28350. * @param {Function} func The function to partially apply arguments to.
  28351. * @param {...*} [partials] The arguments to be partially applied.
  28352. * @returns {Function} Returns the new partially applied function.
  28353. * @example
  28354. *
  28355. * function greet(greeting, name) {
  28356. * return greeting + ' ' + name;
  28357. * }
  28358. *
  28359. * var greetFred = _.partialRight(greet, 'fred');
  28360. * greetFred('hi');
  28361. * // => 'hi fred'
  28362. *
  28363. * // Partially applied with placeholders.
  28364. * var sayHelloTo = _.partialRight(greet, 'hello', _);
  28365. * sayHelloTo('fred');
  28366. * // => 'hello fred'
  28367. */
  28368. var partialRight = baseRest(function(func, partials) {
  28369. var holders = replaceHolders(partials, getHolder(partialRight));
  28370. return createWrap(func, WRAP_PARTIAL_RIGHT_FLAG, undefined, partials, holders);
  28371. });
  28372. /**
  28373. * Creates a function that invokes `func` with arguments arranged according
  28374. * to the specified `indexes` where the argument value at the first index is
  28375. * provided as the first argument, the argument value at the second index is
  28376. * provided as the second argument, and so on.
  28377. *
  28378. * @static
  28379. * @memberOf _
  28380. * @since 3.0.0
  28381. * @category Function
  28382. * @param {Function} func The function to rearrange arguments for.
  28383. * @param {...(number|number[])} indexes The arranged argument indexes.
  28384. * @returns {Function} Returns the new function.
  28385. * @example
  28386. *
  28387. * var rearged = _.rearg(function(a, b, c) {
  28388. * return [a, b, c];
  28389. * }, [2, 0, 1]);
  28390. *
  28391. * rearged('b', 'c', 'a')
  28392. * // => ['a', 'b', 'c']
  28393. */
  28394. var rearg = flatRest(function(func, indexes) {
  28395. return createWrap(func, WRAP_REARG_FLAG, undefined, undefined, undefined, indexes);
  28396. });
  28397. /**
  28398. * Creates a function that invokes `func` with the `this` binding of the
  28399. * created function and arguments from `start` and beyond provided as
  28400. * an array.
  28401. *
  28402. * **Note:** This method is based on the
  28403. * [rest parameter](https://mdn.io/rest_parameters).
  28404. *
  28405. * @static
  28406. * @memberOf _
  28407. * @since 4.0.0
  28408. * @category Function
  28409. * @param {Function} func The function to apply a rest parameter to.
  28410. * @param {number} [start=func.length-1] The start position of the rest parameter.
  28411. * @returns {Function} Returns the new function.
  28412. * @example
  28413. *
  28414. * var say = _.rest(function(what, names) {
  28415. * return what + ' ' + _.initial(names).join(', ') +
  28416. * (_.size(names) > 1 ? ', & ' : '') + _.last(names);
  28417. * });
  28418. *
  28419. * say('hello', 'fred', 'barney', 'pebbles');
  28420. * // => 'hello fred, barney, & pebbles'
  28421. */
  28422. function rest(func, start) {
  28423. if (typeof func != 'function') {
  28424. throw new TypeError(FUNC_ERROR_TEXT);
  28425. }
  28426. start = start === undefined ? start : toInteger(start);
  28427. return baseRest(func, start);
  28428. }
  28429. /**
  28430. * Creates a function that invokes `func` with the `this` binding of the
  28431. * create function and an array of arguments much like
  28432. * [`Function#apply`](http://www.ecma-international.org/ecma-262/7.0/#sec-function.prototype.apply).
  28433. *
  28434. * **Note:** This method is based on the
  28435. * [spread operator](https://mdn.io/spread_operator).
  28436. *
  28437. * @static
  28438. * @memberOf _
  28439. * @since 3.2.0
  28440. * @category Function
  28441. * @param {Function} func The function to spread arguments over.
  28442. * @param {number} [start=0] The start position of the spread.
  28443. * @returns {Function} Returns the new function.
  28444. * @example
  28445. *
  28446. * var say = _.spread(function(who, what) {
  28447. * return who + ' says ' + what;
  28448. * });
  28449. *
  28450. * say(['fred', 'hello']);
  28451. * // => 'fred says hello'
  28452. *
  28453. * var numbers = Promise.all([
  28454. * Promise.resolve(40),
  28455. * Promise.resolve(36)
  28456. * ]);
  28457. *
  28458. * numbers.then(_.spread(function(x, y) {
  28459. * return x + y;
  28460. * }));
  28461. * // => a Promise of 76
  28462. */
  28463. function spread(func, start) {
  28464. if (typeof func != 'function') {
  28465. throw new TypeError(FUNC_ERROR_TEXT);
  28466. }
  28467. start = start == null ? 0 : nativeMax(toInteger(start), 0);
  28468. return baseRest(function(args) {
  28469. var array = args[start],
  28470. otherArgs = castSlice(args, 0, start);
  28471. if (array) {
  28472. arrayPush(otherArgs, array);
  28473. }
  28474. return apply(func, this, otherArgs);
  28475. });
  28476. }
  28477. /**
  28478. * Creates a throttled function that only invokes `func` at most once per
  28479. * every `wait` milliseconds. The throttled function comes with a `cancel`
  28480. * method to cancel delayed `func` invocations and a `flush` method to
  28481. * immediately invoke them. Provide `options` to indicate whether `func`
  28482. * should be invoked on the leading and/or trailing edge of the `wait`
  28483. * timeout. The `func` is invoked with the last arguments provided to the
  28484. * throttled function. Subsequent calls to the throttled function return the
  28485. * result of the last `func` invocation.
  28486. *
  28487. * **Note:** If `leading` and `trailing` options are `true`, `func` is
  28488. * invoked on the trailing edge of the timeout only if the throttled function
  28489. * is invoked more than once during the `wait` timeout.
  28490. *
  28491. * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
  28492. * until to the next tick, similar to `setTimeout` with a timeout of `0`.
  28493. *
  28494. * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
  28495. * for details over the differences between `_.throttle` and `_.debounce`.
  28496. *
  28497. * @static
  28498. * @memberOf _
  28499. * @since 0.1.0
  28500. * @category Function
  28501. * @param {Function} func The function to throttle.
  28502. * @param {number} [wait=0] The number of milliseconds to throttle invocations to.
  28503. * @param {Object} [options={}] The options object.
  28504. * @param {boolean} [options.leading=true]
  28505. * Specify invoking on the leading edge of the timeout.
  28506. * @param {boolean} [options.trailing=true]
  28507. * Specify invoking on the trailing edge of the timeout.
  28508. * @returns {Function} Returns the new throttled function.
  28509. * @example
  28510. *
  28511. * // Avoid excessively updating the position while scrolling.
  28512. * jQuery(window).on('scroll', _.throttle(updatePosition, 100));
  28513. *
  28514. * // Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes.
  28515. * var throttled = _.throttle(renewToken, 300000, { 'trailing': false });
  28516. * jQuery(element).on('click', throttled);
  28517. *
  28518. * // Cancel the trailing throttled invocation.
  28519. * jQuery(window).on('popstate', throttled.cancel);
  28520. */
  28521. function throttle(func, wait, options) {
  28522. var leading = true,
  28523. trailing = true;
  28524. if (typeof func != 'function') {
  28525. throw new TypeError(FUNC_ERROR_TEXT);
  28526. }
  28527. if (isObject(options)) {
  28528. leading = 'leading' in options ? !!options.leading : leading;
  28529. trailing = 'trailing' in options ? !!options.trailing : trailing;
  28530. }
  28531. return debounce(func, wait, {
  28532. 'leading': leading,
  28533. 'maxWait': wait,
  28534. 'trailing': trailing
  28535. });
  28536. }
  28537. /**
  28538. * Creates a function that accepts up to one argument, ignoring any
  28539. * additional arguments.
  28540. *
  28541. * @static
  28542. * @memberOf _
  28543. * @since 4.0.0
  28544. * @category Function
  28545. * @param {Function} func The function to cap arguments for.
  28546. * @returns {Function} Returns the new capped function.
  28547. * @example
  28548. *
  28549. * _.map(['6', '8', '10'], _.unary(parseInt));
  28550. * // => [6, 8, 10]
  28551. */
  28552. function unary(func) {
  28553. return ary(func, 1);
  28554. }
  28555. /**
  28556. * Creates a function that provides `value` to `wrapper` as its first
  28557. * argument. Any additional arguments provided to the function are appended
  28558. * to those provided to the `wrapper`. The wrapper is invoked with the `this`
  28559. * binding of the created function.
  28560. *
  28561. * @static
  28562. * @memberOf _
  28563. * @since 0.1.0
  28564. * @category Function
  28565. * @param {*} value The value to wrap.
  28566. * @param {Function} [wrapper=identity] The wrapper function.
  28567. * @returns {Function} Returns the new function.
  28568. * @example
  28569. *
  28570. * var p = _.wrap(_.escape, function(func, text) {
  28571. * return '<p>' + func(text) + '</p>';
  28572. * });
  28573. *
  28574. * p('fred, barney, & pebbles');
  28575. * // => '<p>fred, barney, &amp; pebbles</p>'
  28576. */
  28577. function wrap(value, wrapper) {
  28578. return partial(castFunction(wrapper), value);
  28579. }
  28580. /*------------------------------------------------------------------------*/
  28581. /**
  28582. * Casts `value` as an array if it's not one.
  28583. *
  28584. * @static
  28585. * @memberOf _
  28586. * @since 4.4.0
  28587. * @category Lang
  28588. * @param {*} value The value to inspect.
  28589. * @returns {Array} Returns the cast array.
  28590. * @example
  28591. *
  28592. * _.castArray(1);
  28593. * // => [1]
  28594. *
  28595. * _.castArray({ 'a': 1 });
  28596. * // => [{ 'a': 1 }]
  28597. *
  28598. * _.castArray('abc');
  28599. * // => ['abc']
  28600. *
  28601. * _.castArray(null);
  28602. * // => [null]
  28603. *
  28604. * _.castArray(undefined);
  28605. * // => [undefined]
  28606. *
  28607. * _.castArray();
  28608. * // => []
  28609. *
  28610. * var array = [1, 2, 3];
  28611. * console.log(_.castArray(array) === array);
  28612. * // => true
  28613. */
  28614. function castArray() {
  28615. if (!arguments.length) {
  28616. return [];
  28617. }
  28618. var value = arguments[0];
  28619. return isArray(value) ? value : [value];
  28620. }
  28621. /**
  28622. * Creates a shallow clone of `value`.
  28623. *
  28624. * **Note:** This method is loosely based on the
  28625. * [structured clone algorithm](https://mdn.io/Structured_clone_algorithm)
  28626. * and supports cloning arrays, array buffers, booleans, date objects, maps,
  28627. * numbers, `Object` objects, regexes, sets, strings, symbols, and typed
  28628. * arrays. The own enumerable properties of `arguments` objects are cloned
  28629. * as plain objects. An empty object is returned for uncloneable values such
  28630. * as error objects, functions, DOM nodes, and WeakMaps.
  28631. *
  28632. * @static
  28633. * @memberOf _
  28634. * @since 0.1.0
  28635. * @category Lang
  28636. * @param {*} value The value to clone.
  28637. * @returns {*} Returns the cloned value.
  28638. * @see _.cloneDeep
  28639. * @example
  28640. *
  28641. * var objects = [{ 'a': 1 }, { 'b': 2 }];
  28642. *
  28643. * var shallow = _.clone(objects);
  28644. * console.log(shallow[0] === objects[0]);
  28645. * // => true
  28646. */
  28647. function clone(value) {
  28648. return baseClone(value, CLONE_SYMBOLS_FLAG);
  28649. }
  28650. /**
  28651. * This method is like `_.clone` except that it accepts `customizer` which
  28652. * is invoked to produce the cloned value. If `customizer` returns `undefined`,
  28653. * cloning is handled by the method instead. The `customizer` is invoked with
  28654. * up to four arguments; (value [, index|key, object, stack]).
  28655. *
  28656. * @static
  28657. * @memberOf _
  28658. * @since 4.0.0
  28659. * @category Lang
  28660. * @param {*} value The value to clone.
  28661. * @param {Function} [customizer] The function to customize cloning.
  28662. * @returns {*} Returns the cloned value.
  28663. * @see _.cloneDeepWith
  28664. * @example
  28665. *
  28666. * function customizer(value) {
  28667. * if (_.isElement(value)) {
  28668. * return value.cloneNode(false);
  28669. * }
  28670. * }
  28671. *
  28672. * var el = _.cloneWith(document.body, customizer);
  28673. *
  28674. * console.log(el === document.body);
  28675. * // => false
  28676. * console.log(el.nodeName);
  28677. * // => 'BODY'
  28678. * console.log(el.childNodes.length);
  28679. * // => 0
  28680. */
  28681. function cloneWith(value, customizer) {
  28682. customizer = typeof customizer == 'function' ? customizer : undefined;
  28683. return baseClone(value, CLONE_SYMBOLS_FLAG, customizer);
  28684. }
  28685. /**
  28686. * This method is like `_.clone` except that it recursively clones `value`.
  28687. *
  28688. * @static
  28689. * @memberOf _
  28690. * @since 1.0.0
  28691. * @category Lang
  28692. * @param {*} value The value to recursively clone.
  28693. * @returns {*} Returns the deep cloned value.
  28694. * @see _.clone
  28695. * @example
  28696. *
  28697. * var objects = [{ 'a': 1 }, { 'b': 2 }];
  28698. *
  28699. * var deep = _.cloneDeep(objects);
  28700. * console.log(deep[0] === objects[0]);
  28701. * // => false
  28702. */
  28703. function cloneDeep(value) {
  28704. return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG);
  28705. }
  28706. /**
  28707. * This method is like `_.cloneWith` except that it recursively clones `value`.
  28708. *
  28709. * @static
  28710. * @memberOf _
  28711. * @since 4.0.0
  28712. * @category Lang
  28713. * @param {*} value The value to recursively clone.
  28714. * @param {Function} [customizer] The function to customize cloning.
  28715. * @returns {*} Returns the deep cloned value.
  28716. * @see _.cloneWith
  28717. * @example
  28718. *
  28719. * function customizer(value) {
  28720. * if (_.isElement(value)) {
  28721. * return value.cloneNode(true);
  28722. * }
  28723. * }
  28724. *
  28725. * var el = _.cloneDeepWith(document.body, customizer);
  28726. *
  28727. * console.log(el === document.body);
  28728. * // => false
  28729. * console.log(el.nodeName);
  28730. * // => 'BODY'
  28731. * console.log(el.childNodes.length);
  28732. * // => 20
  28733. */
  28734. function cloneDeepWith(value, customizer) {
  28735. customizer = typeof customizer == 'function' ? customizer : undefined;
  28736. return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG, customizer);
  28737. }
  28738. /**
  28739. * Checks if `object` conforms to `source` by invoking the predicate
  28740. * properties of `source` with the corresponding property values of `object`.
  28741. *
  28742. * **Note:** This method is equivalent to `_.conforms` when `source` is
  28743. * partially applied.
  28744. *
  28745. * @static
  28746. * @memberOf _
  28747. * @since 4.14.0
  28748. * @category Lang
  28749. * @param {Object} object The object to inspect.
  28750. * @param {Object} source The object of property predicates to conform to.
  28751. * @returns {boolean} Returns `true` if `object` conforms, else `false`.
  28752. * @example
  28753. *
  28754. * var object = { 'a': 1, 'b': 2 };
  28755. *
  28756. * _.conformsTo(object, { 'b': function(n) { return n > 1; } });
  28757. * // => true
  28758. *
  28759. * _.conformsTo(object, { 'b': function(n) { return n > 2; } });
  28760. * // => false
  28761. */
  28762. function conformsTo(object, source) {
  28763. return source == null || baseConformsTo(object, source, keys(source));
  28764. }
  28765. /**
  28766. * Performs a
  28767. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  28768. * comparison between two values to determine if they are equivalent.
  28769. *
  28770. * @static
  28771. * @memberOf _
  28772. * @since 4.0.0
  28773. * @category Lang
  28774. * @param {*} value The value to compare.
  28775. * @param {*} other The other value to compare.
  28776. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  28777. * @example
  28778. *
  28779. * var object = { 'a': 1 };
  28780. * var other = { 'a': 1 };
  28781. *
  28782. * _.eq(object, object);
  28783. * // => true
  28784. *
  28785. * _.eq(object, other);
  28786. * // => false
  28787. *
  28788. * _.eq('a', 'a');
  28789. * // => true
  28790. *
  28791. * _.eq('a', Object('a'));
  28792. * // => false
  28793. *
  28794. * _.eq(NaN, NaN);
  28795. * // => true
  28796. */
  28797. function eq(value, other) {
  28798. return value === other || (value !== value && other !== other);
  28799. }
  28800. /**
  28801. * Checks if `value` is greater than `other`.
  28802. *
  28803. * @static
  28804. * @memberOf _
  28805. * @since 3.9.0
  28806. * @category Lang
  28807. * @param {*} value The value to compare.
  28808. * @param {*} other The other value to compare.
  28809. * @returns {boolean} Returns `true` if `value` is greater than `other`,
  28810. * else `false`.
  28811. * @see _.lt
  28812. * @example
  28813. *
  28814. * _.gt(3, 1);
  28815. * // => true
  28816. *
  28817. * _.gt(3, 3);
  28818. * // => false
  28819. *
  28820. * _.gt(1, 3);
  28821. * // => false
  28822. */
  28823. var gt = createRelationalOperation(baseGt);
  28824. /**
  28825. * Checks if `value` is greater than or equal to `other`.
  28826. *
  28827. * @static
  28828. * @memberOf _
  28829. * @since 3.9.0
  28830. * @category Lang
  28831. * @param {*} value The value to compare.
  28832. * @param {*} other The other value to compare.
  28833. * @returns {boolean} Returns `true` if `value` is greater than or equal to
  28834. * `other`, else `false`.
  28835. * @see _.lte
  28836. * @example
  28837. *
  28838. * _.gte(3, 1);
  28839. * // => true
  28840. *
  28841. * _.gte(3, 3);
  28842. * // => true
  28843. *
  28844. * _.gte(1, 3);
  28845. * // => false
  28846. */
  28847. var gte = createRelationalOperation(function(value, other) {
  28848. return value >= other;
  28849. });
  28850. /**
  28851. * Checks if `value` is likely an `arguments` object.
  28852. *
  28853. * @static
  28854. * @memberOf _
  28855. * @since 0.1.0
  28856. * @category Lang
  28857. * @param {*} value The value to check.
  28858. * @returns {boolean} Returns `true` if `value` is an `arguments` object,
  28859. * else `false`.
  28860. * @example
  28861. *
  28862. * _.isArguments(function() { return arguments; }());
  28863. * // => true
  28864. *
  28865. * _.isArguments([1, 2, 3]);
  28866. * // => false
  28867. */
  28868. var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {
  28869. return isObjectLike(value) && hasOwnProperty.call(value, 'callee') &&
  28870. !propertyIsEnumerable.call(value, 'callee');
  28871. };
  28872. /**
  28873. * Checks if `value` is classified as an `Array` object.
  28874. *
  28875. * @static
  28876. * @memberOf _
  28877. * @since 0.1.0
  28878. * @category Lang
  28879. * @param {*} value The value to check.
  28880. * @returns {boolean} Returns `true` if `value` is an array, else `false`.
  28881. * @example
  28882. *
  28883. * _.isArray([1, 2, 3]);
  28884. * // => true
  28885. *
  28886. * _.isArray(document.body.children);
  28887. * // => false
  28888. *
  28889. * _.isArray('abc');
  28890. * // => false
  28891. *
  28892. * _.isArray(_.noop);
  28893. * // => false
  28894. */
  28895. var isArray = Array.isArray;
  28896. /**
  28897. * Checks if `value` is classified as an `ArrayBuffer` object.
  28898. *
  28899. * @static
  28900. * @memberOf _
  28901. * @since 4.3.0
  28902. * @category Lang
  28903. * @param {*} value The value to check.
  28904. * @returns {boolean} Returns `true` if `value` is an array buffer, else `false`.
  28905. * @example
  28906. *
  28907. * _.isArrayBuffer(new ArrayBuffer(2));
  28908. * // => true
  28909. *
  28910. * _.isArrayBuffer(new Array(2));
  28911. * // => false
  28912. */
  28913. var isArrayBuffer = nodeIsArrayBuffer ? baseUnary(nodeIsArrayBuffer) : baseIsArrayBuffer;
  28914. /**
  28915. * Checks if `value` is array-like. A value is considered array-like if it's
  28916. * not a function and has a `value.length` that's an integer greater than or
  28917. * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
  28918. *
  28919. * @static
  28920. * @memberOf _
  28921. * @since 4.0.0
  28922. * @category Lang
  28923. * @param {*} value The value to check.
  28924. * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
  28925. * @example
  28926. *
  28927. * _.isArrayLike([1, 2, 3]);
  28928. * // => true
  28929. *
  28930. * _.isArrayLike(document.body.children);
  28931. * // => true
  28932. *
  28933. * _.isArrayLike('abc');
  28934. * // => true
  28935. *
  28936. * _.isArrayLike(_.noop);
  28937. * // => false
  28938. */
  28939. function isArrayLike(value) {
  28940. return value != null && isLength(value.length) && !isFunction(value);
  28941. }
  28942. /**
  28943. * This method is like `_.isArrayLike` except that it also checks if `value`
  28944. * is an object.
  28945. *
  28946. * @static
  28947. * @memberOf _
  28948. * @since 4.0.0
  28949. * @category Lang
  28950. * @param {*} value The value to check.
  28951. * @returns {boolean} Returns `true` if `value` is an array-like object,
  28952. * else `false`.
  28953. * @example
  28954. *
  28955. * _.isArrayLikeObject([1, 2, 3]);
  28956. * // => true
  28957. *
  28958. * _.isArrayLikeObject(document.body.children);
  28959. * // => true
  28960. *
  28961. * _.isArrayLikeObject('abc');
  28962. * // => false
  28963. *
  28964. * _.isArrayLikeObject(_.noop);
  28965. * // => false
  28966. */
  28967. function isArrayLikeObject(value) {
  28968. return isObjectLike(value) && isArrayLike(value);
  28969. }
  28970. /**
  28971. * Checks if `value` is classified as a boolean primitive or object.
  28972. *
  28973. * @static
  28974. * @memberOf _
  28975. * @since 0.1.0
  28976. * @category Lang
  28977. * @param {*} value The value to check.
  28978. * @returns {boolean} Returns `true` if `value` is a boolean, else `false`.
  28979. * @example
  28980. *
  28981. * _.isBoolean(false);
  28982. * // => true
  28983. *
  28984. * _.isBoolean(null);
  28985. * // => false
  28986. */
  28987. function isBoolean(value) {
  28988. return value === true || value === false ||
  28989. (isObjectLike(value) && baseGetTag(value) == boolTag);
  28990. }
  28991. /**
  28992. * Checks if `value` is a buffer.
  28993. *
  28994. * @static
  28995. * @memberOf _
  28996. * @since 4.3.0
  28997. * @category Lang
  28998. * @param {*} value The value to check.
  28999. * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.
  29000. * @example
  29001. *
  29002. * _.isBuffer(new Buffer(2));
  29003. * // => true
  29004. *
  29005. * _.isBuffer(new Uint8Array(2));
  29006. * // => false
  29007. */
  29008. var isBuffer = nativeIsBuffer || stubFalse;
  29009. /**
  29010. * Checks if `value` is classified as a `Date` object.
  29011. *
  29012. * @static
  29013. * @memberOf _
  29014. * @since 0.1.0
  29015. * @category Lang
  29016. * @param {*} value The value to check.
  29017. * @returns {boolean} Returns `true` if `value` is a date object, else `false`.
  29018. * @example
  29019. *
  29020. * _.isDate(new Date);
  29021. * // => true
  29022. *
  29023. * _.isDate('Mon April 23 2012');
  29024. * // => false
  29025. */
  29026. var isDate = nodeIsDate ? baseUnary(nodeIsDate) : baseIsDate;
  29027. /**
  29028. * Checks if `value` is likely a DOM element.
  29029. *
  29030. * @static
  29031. * @memberOf _
  29032. * @since 0.1.0
  29033. * @category Lang
  29034. * @param {*} value The value to check.
  29035. * @returns {boolean} Returns `true` if `value` is a DOM element, else `false`.
  29036. * @example
  29037. *
  29038. * _.isElement(document.body);
  29039. * // => true
  29040. *
  29041. * _.isElement('<body>');
  29042. * // => false
  29043. */
  29044. function isElement(value) {
  29045. return isObjectLike(value) && value.nodeType === 1 && !isPlainObject(value);
  29046. }
  29047. /**
  29048. * Checks if `value` is an empty object, collection, map, or set.
  29049. *
  29050. * Objects are considered empty if they have no own enumerable string keyed
  29051. * properties.
  29052. *
  29053. * Array-like values such as `arguments` objects, arrays, buffers, strings, or
  29054. * jQuery-like collections are considered empty if they have a `length` of `0`.
  29055. * Similarly, maps and sets are considered empty if they have a `size` of `0`.
  29056. *
  29057. * @static
  29058. * @memberOf _
  29059. * @since 0.1.0
  29060. * @category Lang
  29061. * @param {*} value The value to check.
  29062. * @returns {boolean} Returns `true` if `value` is empty, else `false`.
  29063. * @example
  29064. *
  29065. * _.isEmpty(null);
  29066. * // => true
  29067. *
  29068. * _.isEmpty(true);
  29069. * // => true
  29070. *
  29071. * _.isEmpty(1);
  29072. * // => true
  29073. *
  29074. * _.isEmpty([1, 2, 3]);
  29075. * // => false
  29076. *
  29077. * _.isEmpty({ 'a': 1 });
  29078. * // => false
  29079. */
  29080. function isEmpty(value) {
  29081. if (value == null) {
  29082. return true;
  29083. }
  29084. if (isArrayLike(value) &&
  29085. (isArray(value) || typeof value == 'string' || typeof value.splice == 'function' ||
  29086. isBuffer(value) || isTypedArray(value) || isArguments(value))) {
  29087. return !value.length;
  29088. }
  29089. var tag = getTag(value);
  29090. if (tag == mapTag || tag == setTag) {
  29091. return !value.size;
  29092. }
  29093. if (isPrototype(value)) {
  29094. return !baseKeys(value).length;
  29095. }
  29096. for (var key in value) {
  29097. if (hasOwnProperty.call(value, key)) {
  29098. return false;
  29099. }
  29100. }
  29101. return true;
  29102. }
  29103. /**
  29104. * Performs a deep comparison between two values to determine if they are
  29105. * equivalent.
  29106. *
  29107. * **Note:** This method supports comparing arrays, array buffers, booleans,
  29108. * date objects, error objects, maps, numbers, `Object` objects, regexes,
  29109. * sets, strings, symbols, and typed arrays. `Object` objects are compared
  29110. * by their own, not inherited, enumerable properties. Functions and DOM
  29111. * nodes are compared by strict equality, i.e. `===`.
  29112. *
  29113. * @static
  29114. * @memberOf _
  29115. * @since 0.1.0
  29116. * @category Lang
  29117. * @param {*} value The value to compare.
  29118. * @param {*} other The other value to compare.
  29119. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  29120. * @example
  29121. *
  29122. * var object = { 'a': 1 };
  29123. * var other = { 'a': 1 };
  29124. *
  29125. * _.isEqual(object, other);
  29126. * // => true
  29127. *
  29128. * object === other;
  29129. * // => false
  29130. */
  29131. function isEqual(value, other) {
  29132. return baseIsEqual(value, other);
  29133. }
  29134. /**
  29135. * This method is like `_.isEqual` except that it accepts `customizer` which
  29136. * is invoked to compare values. If `customizer` returns `undefined`, comparisons
  29137. * are handled by the method instead. The `customizer` is invoked with up to
  29138. * six arguments: (objValue, othValue [, index|key, object, other, stack]).
  29139. *
  29140. * @static
  29141. * @memberOf _
  29142. * @since 4.0.0
  29143. * @category Lang
  29144. * @param {*} value The value to compare.
  29145. * @param {*} other The other value to compare.
  29146. * @param {Function} [customizer] The function to customize comparisons.
  29147. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  29148. * @example
  29149. *
  29150. * function isGreeting(value) {
  29151. * return /^h(?:i|ello)$/.test(value);
  29152. * }
  29153. *
  29154. * function customizer(objValue, othValue) {
  29155. * if (isGreeting(objValue) && isGreeting(othValue)) {
  29156. * return true;
  29157. * }
  29158. * }
  29159. *
  29160. * var array = ['hello', 'goodbye'];
  29161. * var other = ['hi', 'goodbye'];
  29162. *
  29163. * _.isEqualWith(array, other, customizer);
  29164. * // => true
  29165. */
  29166. function isEqualWith(value, other, customizer) {
  29167. customizer = typeof customizer == 'function' ? customizer : undefined;
  29168. var result = customizer ? customizer(value, other) : undefined;
  29169. return result === undefined ? baseIsEqual(value, other, undefined, customizer) : !!result;
  29170. }
  29171. /**
  29172. * Checks if `value` is an `Error`, `EvalError`, `RangeError`, `ReferenceError`,
  29173. * `SyntaxError`, `TypeError`, or `URIError` object.
  29174. *
  29175. * @static
  29176. * @memberOf _
  29177. * @since 3.0.0
  29178. * @category Lang
  29179. * @param {*} value The value to check.
  29180. * @returns {boolean} Returns `true` if `value` is an error object, else `false`.
  29181. * @example
  29182. *
  29183. * _.isError(new Error);
  29184. * // => true
  29185. *
  29186. * _.isError(Error);
  29187. * // => false
  29188. */
  29189. function isError(value) {
  29190. if (!isObjectLike(value)) {
  29191. return false;
  29192. }
  29193. var tag = baseGetTag(value);
  29194. return tag == errorTag || tag == domExcTag ||
  29195. (typeof value.message == 'string' && typeof value.name == 'string' && !isPlainObject(value));
  29196. }
  29197. /**
  29198. * Checks if `value` is a finite primitive number.
  29199. *
  29200. * **Note:** This method is based on
  29201. * [`Number.isFinite`](https://mdn.io/Number/isFinite).
  29202. *
  29203. * @static
  29204. * @memberOf _
  29205. * @since 0.1.0
  29206. * @category Lang
  29207. * @param {*} value The value to check.
  29208. * @returns {boolean} Returns `true` if `value` is a finite number, else `false`.
  29209. * @example
  29210. *
  29211. * _.isFinite(3);
  29212. * // => true
  29213. *
  29214. * _.isFinite(Number.MIN_VALUE);
  29215. * // => true
  29216. *
  29217. * _.isFinite(Infinity);
  29218. * // => false
  29219. *
  29220. * _.isFinite('3');
  29221. * // => false
  29222. */
  29223. function isFinite(value) {
  29224. return typeof value == 'number' && nativeIsFinite(value);
  29225. }
  29226. /**
  29227. * Checks if `value` is classified as a `Function` object.
  29228. *
  29229. * @static
  29230. * @memberOf _
  29231. * @since 0.1.0
  29232. * @category Lang
  29233. * @param {*} value The value to check.
  29234. * @returns {boolean} Returns `true` if `value` is a function, else `false`.
  29235. * @example
  29236. *
  29237. * _.isFunction(_);
  29238. * // => true
  29239. *
  29240. * _.isFunction(/abc/);
  29241. * // => false
  29242. */
  29243. function isFunction(value) {
  29244. if (!isObject(value)) {
  29245. return false;
  29246. }
  29247. // The use of `Object#toString` avoids issues with the `typeof` operator
  29248. // in Safari 9 which returns 'object' for typed arrays and other constructors.
  29249. var tag = baseGetTag(value);
  29250. return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
  29251. }
  29252. /**
  29253. * Checks if `value` is an integer.
  29254. *
  29255. * **Note:** This method is based on
  29256. * [`Number.isInteger`](https://mdn.io/Number/isInteger).
  29257. *
  29258. * @static
  29259. * @memberOf _
  29260. * @since 4.0.0
  29261. * @category Lang
  29262. * @param {*} value The value to check.
  29263. * @returns {boolean} Returns `true` if `value` is an integer, else `false`.
  29264. * @example
  29265. *
  29266. * _.isInteger(3);
  29267. * // => true
  29268. *
  29269. * _.isInteger(Number.MIN_VALUE);
  29270. * // => false
  29271. *
  29272. * _.isInteger(Infinity);
  29273. * // => false
  29274. *
  29275. * _.isInteger('3');
  29276. * // => false
  29277. */
  29278. function isInteger(value) {
  29279. return typeof value == 'number' && value == toInteger(value);
  29280. }
  29281. /**
  29282. * Checks if `value` is a valid array-like length.
  29283. *
  29284. * **Note:** This method is loosely based on
  29285. * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
  29286. *
  29287. * @static
  29288. * @memberOf _
  29289. * @since 4.0.0
  29290. * @category Lang
  29291. * @param {*} value The value to check.
  29292. * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
  29293. * @example
  29294. *
  29295. * _.isLength(3);
  29296. * // => true
  29297. *
  29298. * _.isLength(Number.MIN_VALUE);
  29299. * // => false
  29300. *
  29301. * _.isLength(Infinity);
  29302. * // => false
  29303. *
  29304. * _.isLength('3');
  29305. * // => false
  29306. */
  29307. function isLength(value) {
  29308. return typeof value == 'number' &&
  29309. value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
  29310. }
  29311. /**
  29312. * Checks if `value` is the
  29313. * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
  29314. * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
  29315. *
  29316. * @static
  29317. * @memberOf _
  29318. * @since 0.1.0
  29319. * @category Lang
  29320. * @param {*} value The value to check.
  29321. * @returns {boolean} Returns `true` if `value` is an object, else `false`.
  29322. * @example
  29323. *
  29324. * _.isObject({});
  29325. * // => true
  29326. *
  29327. * _.isObject([1, 2, 3]);
  29328. * // => true
  29329. *
  29330. * _.isObject(_.noop);
  29331. * // => true
  29332. *
  29333. * _.isObject(null);
  29334. * // => false
  29335. */
  29336. function isObject(value) {
  29337. var type = typeof value;
  29338. return value != null && (type == 'object' || type == 'function');
  29339. }
  29340. /**
  29341. * Checks if `value` is object-like. A value is object-like if it's not `null`
  29342. * and has a `typeof` result of "object".
  29343. *
  29344. * @static
  29345. * @memberOf _
  29346. * @since 4.0.0
  29347. * @category Lang
  29348. * @param {*} value The value to check.
  29349. * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
  29350. * @example
  29351. *
  29352. * _.isObjectLike({});
  29353. * // => true
  29354. *
  29355. * _.isObjectLike([1, 2, 3]);
  29356. * // => true
  29357. *
  29358. * _.isObjectLike(_.noop);
  29359. * // => false
  29360. *
  29361. * _.isObjectLike(null);
  29362. * // => false
  29363. */
  29364. function isObjectLike(value) {
  29365. return value != null && typeof value == 'object';
  29366. }
  29367. /**
  29368. * Checks if `value` is classified as a `Map` object.
  29369. *
  29370. * @static
  29371. * @memberOf _
  29372. * @since 4.3.0
  29373. * @category Lang
  29374. * @param {*} value The value to check.
  29375. * @returns {boolean} Returns `true` if `value` is a map, else `false`.
  29376. * @example
  29377. *
  29378. * _.isMap(new Map);
  29379. * // => true
  29380. *
  29381. * _.isMap(new WeakMap);
  29382. * // => false
  29383. */
  29384. var isMap = nodeIsMap ? baseUnary(nodeIsMap) : baseIsMap;
  29385. /**
  29386. * Performs a partial deep comparison between `object` and `source` to
  29387. * determine if `object` contains equivalent property values.
  29388. *
  29389. * **Note:** This method is equivalent to `_.matches` when `source` is
  29390. * partially applied.
  29391. *
  29392. * Partial comparisons will match empty array and empty object `source`
  29393. * values against any array or object value, respectively. See `_.isEqual`
  29394. * for a list of supported value comparisons.
  29395. *
  29396. * @static
  29397. * @memberOf _
  29398. * @since 3.0.0
  29399. * @category Lang
  29400. * @param {Object} object The object to inspect.
  29401. * @param {Object} source The object of property values to match.
  29402. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  29403. * @example
  29404. *
  29405. * var object = { 'a': 1, 'b': 2 };
  29406. *
  29407. * _.isMatch(object, { 'b': 2 });
  29408. * // => true
  29409. *
  29410. * _.isMatch(object, { 'b': 1 });
  29411. * // => false
  29412. */
  29413. function isMatch(object, source) {
  29414. return object === source || baseIsMatch(object, source, getMatchData(source));
  29415. }
  29416. /**
  29417. * This method is like `_.isMatch` except that it accepts `customizer` which
  29418. * is invoked to compare values. If `customizer` returns `undefined`, comparisons
  29419. * are handled by the method instead. The `customizer` is invoked with five
  29420. * arguments: (objValue, srcValue, index|key, object, source).
  29421. *
  29422. * @static
  29423. * @memberOf _
  29424. * @since 4.0.0
  29425. * @category Lang
  29426. * @param {Object} object The object to inspect.
  29427. * @param {Object} source The object of property values to match.
  29428. * @param {Function} [customizer] The function to customize comparisons.
  29429. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  29430. * @example
  29431. *
  29432. * function isGreeting(value) {
  29433. * return /^h(?:i|ello)$/.test(value);
  29434. * }
  29435. *
  29436. * function customizer(objValue, srcValue) {
  29437. * if (isGreeting(objValue) && isGreeting(srcValue)) {
  29438. * return true;
  29439. * }
  29440. * }
  29441. *
  29442. * var object = { 'greeting': 'hello' };
  29443. * var source = { 'greeting': 'hi' };
  29444. *
  29445. * _.isMatchWith(object, source, customizer);
  29446. * // => true
  29447. */
  29448. function isMatchWith(object, source, customizer) {
  29449. customizer = typeof customizer == 'function' ? customizer : undefined;
  29450. return baseIsMatch(object, source, getMatchData(source), customizer);
  29451. }
  29452. /**
  29453. * Checks if `value` is `NaN`.
  29454. *
  29455. * **Note:** This method is based on
  29456. * [`Number.isNaN`](https://mdn.io/Number/isNaN) and is not the same as
  29457. * global [`isNaN`](https://mdn.io/isNaN) which returns `true` for
  29458. * `undefined` and other non-number values.
  29459. *
  29460. * @static
  29461. * @memberOf _
  29462. * @since 0.1.0
  29463. * @category Lang
  29464. * @param {*} value The value to check.
  29465. * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
  29466. * @example
  29467. *
  29468. * _.isNaN(NaN);
  29469. * // => true
  29470. *
  29471. * _.isNaN(new Number(NaN));
  29472. * // => true
  29473. *
  29474. * isNaN(undefined);
  29475. * // => true
  29476. *
  29477. * _.isNaN(undefined);
  29478. * // => false
  29479. */
  29480. function isNaN(value) {
  29481. // An `NaN` primitive is the only value that is not equal to itself.
  29482. // Perform the `toStringTag` check first to avoid errors with some
  29483. // ActiveX objects in IE.
  29484. return isNumber(value) && value != +value;
  29485. }
  29486. /**
  29487. * Checks if `value` is a pristine native function.
  29488. *
  29489. * **Note:** This method can't reliably detect native functions in the presence
  29490. * of the core-js package because core-js circumvents this kind of detection.
  29491. * Despite multiple requests, the core-js maintainer has made it clear: any
  29492. * attempt to fix the detection will be obstructed. As a result, we're left
  29493. * with little choice but to throw an error. Unfortunately, this also affects
  29494. * packages, like [babel-polyfill](https://www.npmjs.com/package/babel-polyfill),
  29495. * which rely on core-js.
  29496. *
  29497. * @static
  29498. * @memberOf _
  29499. * @since 3.0.0
  29500. * @category Lang
  29501. * @param {*} value The value to check.
  29502. * @returns {boolean} Returns `true` if `value` is a native function,
  29503. * else `false`.
  29504. * @example
  29505. *
  29506. * _.isNative(Array.prototype.push);
  29507. * // => true
  29508. *
  29509. * _.isNative(_);
  29510. * // => false
  29511. */
  29512. function isNative(value) {
  29513. if (isMaskable(value)) {
  29514. throw new Error(CORE_ERROR_TEXT);
  29515. }
  29516. return baseIsNative(value);
  29517. }
  29518. /**
  29519. * Checks if `value` is `null`.
  29520. *
  29521. * @static
  29522. * @memberOf _
  29523. * @since 0.1.0
  29524. * @category Lang
  29525. * @param {*} value The value to check.
  29526. * @returns {boolean} Returns `true` if `value` is `null`, else `false`.
  29527. * @example
  29528. *
  29529. * _.isNull(null);
  29530. * // => true
  29531. *
  29532. * _.isNull(void 0);
  29533. * // => false
  29534. */
  29535. function isNull(value) {
  29536. return value === null;
  29537. }
  29538. /**
  29539. * Checks if `value` is `null` or `undefined`.
  29540. *
  29541. * @static
  29542. * @memberOf _
  29543. * @since 4.0.0
  29544. * @category Lang
  29545. * @param {*} value The value to check.
  29546. * @returns {boolean} Returns `true` if `value` is nullish, else `false`.
  29547. * @example
  29548. *
  29549. * _.isNil(null);
  29550. * // => true
  29551. *
  29552. * _.isNil(void 0);
  29553. * // => true
  29554. *
  29555. * _.isNil(NaN);
  29556. * // => false
  29557. */
  29558. function isNil(value) {
  29559. return value == null;
  29560. }
  29561. /**
  29562. * Checks if `value` is classified as a `Number` primitive or object.
  29563. *
  29564. * **Note:** To exclude `Infinity`, `-Infinity`, and `NaN`, which are
  29565. * classified as numbers, use the `_.isFinite` method.
  29566. *
  29567. * @static
  29568. * @memberOf _
  29569. * @since 0.1.0
  29570. * @category Lang
  29571. * @param {*} value The value to check.
  29572. * @returns {boolean} Returns `true` if `value` is a number, else `false`.
  29573. * @example
  29574. *
  29575. * _.isNumber(3);
  29576. * // => true
  29577. *
  29578. * _.isNumber(Number.MIN_VALUE);
  29579. * // => true
  29580. *
  29581. * _.isNumber(Infinity);
  29582. * // => true
  29583. *
  29584. * _.isNumber('3');
  29585. * // => false
  29586. */
  29587. function isNumber(value) {
  29588. return typeof value == 'number' ||
  29589. (isObjectLike(value) && baseGetTag(value) == numberTag);
  29590. }
  29591. /**
  29592. * Checks if `value` is a plain object, that is, an object created by the
  29593. * `Object` constructor or one with a `[[Prototype]]` of `null`.
  29594. *
  29595. * @static
  29596. * @memberOf _
  29597. * @since 0.8.0
  29598. * @category Lang
  29599. * @param {*} value The value to check.
  29600. * @returns {boolean} Returns `true` if `value` is a plain object, else `false`.
  29601. * @example
  29602. *
  29603. * function Foo() {
  29604. * this.a = 1;
  29605. * }
  29606. *
  29607. * _.isPlainObject(new Foo);
  29608. * // => false
  29609. *
  29610. * _.isPlainObject([1, 2, 3]);
  29611. * // => false
  29612. *
  29613. * _.isPlainObject({ 'x': 0, 'y': 0 });
  29614. * // => true
  29615. *
  29616. * _.isPlainObject(Object.create(null));
  29617. * // => true
  29618. */
  29619. function isPlainObject(value) {
  29620. if (!isObjectLike(value) || baseGetTag(value) != objectTag) {
  29621. return false;
  29622. }
  29623. var proto = getPrototype(value);
  29624. if (proto === null) {
  29625. return true;
  29626. }
  29627. var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor;
  29628. return typeof Ctor == 'function' && Ctor instanceof Ctor &&
  29629. funcToString.call(Ctor) == objectCtorString;
  29630. }
  29631. /**
  29632. * Checks if `value` is classified as a `RegExp` object.
  29633. *
  29634. * @static
  29635. * @memberOf _
  29636. * @since 0.1.0
  29637. * @category Lang
  29638. * @param {*} value The value to check.
  29639. * @returns {boolean} Returns `true` if `value` is a regexp, else `false`.
  29640. * @example
  29641. *
  29642. * _.isRegExp(/abc/);
  29643. * // => true
  29644. *
  29645. * _.isRegExp('/abc/');
  29646. * // => false
  29647. */
  29648. var isRegExp = nodeIsRegExp ? baseUnary(nodeIsRegExp) : baseIsRegExp;
  29649. /**
  29650. * Checks if `value` is a safe integer. An integer is safe if it's an IEEE-754
  29651. * double precision number which isn't the result of a rounded unsafe integer.
  29652. *
  29653. * **Note:** This method is based on
  29654. * [`Number.isSafeInteger`](https://mdn.io/Number/isSafeInteger).
  29655. *
  29656. * @static
  29657. * @memberOf _
  29658. * @since 4.0.0
  29659. * @category Lang
  29660. * @param {*} value The value to check.
  29661. * @returns {boolean} Returns `true` if `value` is a safe integer, else `false`.
  29662. * @example
  29663. *
  29664. * _.isSafeInteger(3);
  29665. * // => true
  29666. *
  29667. * _.isSafeInteger(Number.MIN_VALUE);
  29668. * // => false
  29669. *
  29670. * _.isSafeInteger(Infinity);
  29671. * // => false
  29672. *
  29673. * _.isSafeInteger('3');
  29674. * // => false
  29675. */
  29676. function isSafeInteger(value) {
  29677. return isInteger(value) && value >= -MAX_SAFE_INTEGER && value <= MAX_SAFE_INTEGER;
  29678. }
  29679. /**
  29680. * Checks if `value` is classified as a `Set` object.
  29681. *
  29682. * @static
  29683. * @memberOf _
  29684. * @since 4.3.0
  29685. * @category Lang
  29686. * @param {*} value The value to check.
  29687. * @returns {boolean} Returns `true` if `value` is a set, else `false`.
  29688. * @example
  29689. *
  29690. * _.isSet(new Set);
  29691. * // => true
  29692. *
  29693. * _.isSet(new WeakSet);
  29694. * // => false
  29695. */
  29696. var isSet = nodeIsSet ? baseUnary(nodeIsSet) : baseIsSet;
  29697. /**
  29698. * Checks if `value` is classified as a `String` primitive or object.
  29699. *
  29700. * @static
  29701. * @since 0.1.0
  29702. * @memberOf _
  29703. * @category Lang
  29704. * @param {*} value The value to check.
  29705. * @returns {boolean} Returns `true` if `value` is a string, else `false`.
  29706. * @example
  29707. *
  29708. * _.isString('abc');
  29709. * // => true
  29710. *
  29711. * _.isString(1);
  29712. * // => false
  29713. */
  29714. function isString(value) {
  29715. return typeof value == 'string' ||
  29716. (!isArray(value) && isObjectLike(value) && baseGetTag(value) == stringTag);
  29717. }
  29718. /**
  29719. * Checks if `value` is classified as a `Symbol` primitive or object.
  29720. *
  29721. * @static
  29722. * @memberOf _
  29723. * @since 4.0.0
  29724. * @category Lang
  29725. * @param {*} value The value to check.
  29726. * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
  29727. * @example
  29728. *
  29729. * _.isSymbol(Symbol.iterator);
  29730. * // => true
  29731. *
  29732. * _.isSymbol('abc');
  29733. * // => false
  29734. */
  29735. function isSymbol(value) {
  29736. return typeof value == 'symbol' ||
  29737. (isObjectLike(value) && baseGetTag(value) == symbolTag);
  29738. }
  29739. /**
  29740. * Checks if `value` is classified as a typed array.
  29741. *
  29742. * @static
  29743. * @memberOf _
  29744. * @since 3.0.0
  29745. * @category Lang
  29746. * @param {*} value The value to check.
  29747. * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
  29748. * @example
  29749. *
  29750. * _.isTypedArray(new Uint8Array);
  29751. * // => true
  29752. *
  29753. * _.isTypedArray([]);
  29754. * // => false
  29755. */
  29756. var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
  29757. /**
  29758. * Checks if `value` is `undefined`.
  29759. *
  29760. * @static
  29761. * @since 0.1.0
  29762. * @memberOf _
  29763. * @category Lang
  29764. * @param {*} value The value to check.
  29765. * @returns {boolean} Returns `true` if `value` is `undefined`, else `false`.
  29766. * @example
  29767. *
  29768. * _.isUndefined(void 0);
  29769. * // => true
  29770. *
  29771. * _.isUndefined(null);
  29772. * // => false
  29773. */
  29774. function isUndefined(value) {
  29775. return value === undefined;
  29776. }
  29777. /**
  29778. * Checks if `value` is classified as a `WeakMap` object.
  29779. *
  29780. * @static
  29781. * @memberOf _
  29782. * @since 4.3.0
  29783. * @category Lang
  29784. * @param {*} value The value to check.
  29785. * @returns {boolean} Returns `true` if `value` is a weak map, else `false`.
  29786. * @example
  29787. *
  29788. * _.isWeakMap(new WeakMap);
  29789. * // => true
  29790. *
  29791. * _.isWeakMap(new Map);
  29792. * // => false
  29793. */
  29794. function isWeakMap(value) {
  29795. return isObjectLike(value) && getTag(value) == weakMapTag;
  29796. }
  29797. /**
  29798. * Checks if `value` is classified as a `WeakSet` object.
  29799. *
  29800. * @static
  29801. * @memberOf _
  29802. * @since 4.3.0
  29803. * @category Lang
  29804. * @param {*} value The value to check.
  29805. * @returns {boolean} Returns `true` if `value` is a weak set, else `false`.
  29806. * @example
  29807. *
  29808. * _.isWeakSet(new WeakSet);
  29809. * // => true
  29810. *
  29811. * _.isWeakSet(new Set);
  29812. * // => false
  29813. */
  29814. function isWeakSet(value) {
  29815. return isObjectLike(value) && baseGetTag(value) == weakSetTag;
  29816. }
  29817. /**
  29818. * Checks if `value` is less than `other`.
  29819. *
  29820. * @static
  29821. * @memberOf _
  29822. * @since 3.9.0
  29823. * @category Lang
  29824. * @param {*} value The value to compare.
  29825. * @param {*} other The other value to compare.
  29826. * @returns {boolean} Returns `true` if `value` is less than `other`,
  29827. * else `false`.
  29828. * @see _.gt
  29829. * @example
  29830. *
  29831. * _.lt(1, 3);
  29832. * // => true
  29833. *
  29834. * _.lt(3, 3);
  29835. * // => false
  29836. *
  29837. * _.lt(3, 1);
  29838. * // => false
  29839. */
  29840. var lt = createRelationalOperation(baseLt);
  29841. /**
  29842. * Checks if `value` is less than or equal to `other`.
  29843. *
  29844. * @static
  29845. * @memberOf _
  29846. * @since 3.9.0
  29847. * @category Lang
  29848. * @param {*} value The value to compare.
  29849. * @param {*} other The other value to compare.
  29850. * @returns {boolean} Returns `true` if `value` is less than or equal to
  29851. * `other`, else `false`.
  29852. * @see _.gte
  29853. * @example
  29854. *
  29855. * _.lte(1, 3);
  29856. * // => true
  29857. *
  29858. * _.lte(3, 3);
  29859. * // => true
  29860. *
  29861. * _.lte(3, 1);
  29862. * // => false
  29863. */
  29864. var lte = createRelationalOperation(function(value, other) {
  29865. return value <= other;
  29866. });
  29867. /**
  29868. * Converts `value` to an array.
  29869. *
  29870. * @static
  29871. * @since 0.1.0
  29872. * @memberOf _
  29873. * @category Lang
  29874. * @param {*} value The value to convert.
  29875. * @returns {Array} Returns the converted array.
  29876. * @example
  29877. *
  29878. * _.toArray({ 'a': 1, 'b': 2 });
  29879. * // => [1, 2]
  29880. *
  29881. * _.toArray('abc');
  29882. * // => ['a', 'b', 'c']
  29883. *
  29884. * _.toArray(1);
  29885. * // => []
  29886. *
  29887. * _.toArray(null);
  29888. * // => []
  29889. */
  29890. function toArray(value) {
  29891. if (!value) {
  29892. return [];
  29893. }
  29894. if (isArrayLike(value)) {
  29895. return isString(value) ? stringToArray(value) : copyArray(value);
  29896. }
  29897. if (symIterator && value[symIterator]) {
  29898. return iteratorToArray(value[symIterator]());
  29899. }
  29900. var tag = getTag(value),
  29901. func = tag == mapTag ? mapToArray : (tag == setTag ? setToArray : values);
  29902. return func(value);
  29903. }
  29904. /**
  29905. * Converts `value` to a finite number.
  29906. *
  29907. * @static
  29908. * @memberOf _
  29909. * @since 4.12.0
  29910. * @category Lang
  29911. * @param {*} value The value to convert.
  29912. * @returns {number} Returns the converted number.
  29913. * @example
  29914. *
  29915. * _.toFinite(3.2);
  29916. * // => 3.2
  29917. *
  29918. * _.toFinite(Number.MIN_VALUE);
  29919. * // => 5e-324
  29920. *
  29921. * _.toFinite(Infinity);
  29922. * // => 1.7976931348623157e+308
  29923. *
  29924. * _.toFinite('3.2');
  29925. * // => 3.2
  29926. */
  29927. function toFinite(value) {
  29928. if (!value) {
  29929. return value === 0 ? value : 0;
  29930. }
  29931. value = toNumber(value);
  29932. if (value === INFINITY || value === -INFINITY) {
  29933. var sign = (value < 0 ? -1 : 1);
  29934. return sign * MAX_INTEGER;
  29935. }
  29936. return value === value ? value : 0;
  29937. }
  29938. /**
  29939. * Converts `value` to an integer.
  29940. *
  29941. * **Note:** This method is loosely based on
  29942. * [`ToInteger`](http://www.ecma-international.org/ecma-262/7.0/#sec-tointeger).
  29943. *
  29944. * @static
  29945. * @memberOf _
  29946. * @since 4.0.0
  29947. * @category Lang
  29948. * @param {*} value The value to convert.
  29949. * @returns {number} Returns the converted integer.
  29950. * @example
  29951. *
  29952. * _.toInteger(3.2);
  29953. * // => 3
  29954. *
  29955. * _.toInteger(Number.MIN_VALUE);
  29956. * // => 0
  29957. *
  29958. * _.toInteger(Infinity);
  29959. * // => 1.7976931348623157e+308
  29960. *
  29961. * _.toInteger('3.2');
  29962. * // => 3
  29963. */
  29964. function toInteger(value) {
  29965. var result = toFinite(value),
  29966. remainder = result % 1;
  29967. return result === result ? (remainder ? result - remainder : result) : 0;
  29968. }
  29969. /**
  29970. * Converts `value` to an integer suitable for use as the length of an
  29971. * array-like object.
  29972. *
  29973. * **Note:** This method is based on
  29974. * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
  29975. *
  29976. * @static
  29977. * @memberOf _
  29978. * @since 4.0.0
  29979. * @category Lang
  29980. * @param {*} value The value to convert.
  29981. * @returns {number} Returns the converted integer.
  29982. * @example
  29983. *
  29984. * _.toLength(3.2);
  29985. * // => 3
  29986. *
  29987. * _.toLength(Number.MIN_VALUE);
  29988. * // => 0
  29989. *
  29990. * _.toLength(Infinity);
  29991. * // => 4294967295
  29992. *
  29993. * _.toLength('3.2');
  29994. * // => 3
  29995. */
  29996. function toLength(value) {
  29997. return value ? baseClamp(toInteger(value), 0, MAX_ARRAY_LENGTH) : 0;
  29998. }
  29999. /**
  30000. * Converts `value` to a number.
  30001. *
  30002. * @static
  30003. * @memberOf _
  30004. * @since 4.0.0
  30005. * @category Lang
  30006. * @param {*} value The value to process.
  30007. * @returns {number} Returns the number.
  30008. * @example
  30009. *
  30010. * _.toNumber(3.2);
  30011. * // => 3.2
  30012. *
  30013. * _.toNumber(Number.MIN_VALUE);
  30014. * // => 5e-324
  30015. *
  30016. * _.toNumber(Infinity);
  30017. * // => Infinity
  30018. *
  30019. * _.toNumber('3.2');
  30020. * // => 3.2
  30021. */
  30022. function toNumber(value) {
  30023. if (typeof value == 'number') {
  30024. return value;
  30025. }
  30026. if (isSymbol(value)) {
  30027. return NAN;
  30028. }
  30029. if (isObject(value)) {
  30030. var other = typeof value.valueOf == 'function' ? value.valueOf() : value;
  30031. value = isObject(other) ? (other + '') : other;
  30032. }
  30033. if (typeof value != 'string') {
  30034. return value === 0 ? value : +value;
  30035. }
  30036. value = value.replace(reTrim, '');
  30037. var isBinary = reIsBinary.test(value);
  30038. return (isBinary || reIsOctal.test(value))
  30039. ? freeParseInt(value.slice(2), isBinary ? 2 : 8)
  30040. : (reIsBadHex.test(value) ? NAN : +value);
  30041. }
  30042. /**
  30043. * Converts `value` to a plain object flattening inherited enumerable string
  30044. * keyed properties of `value` to own properties of the plain object.
  30045. *
  30046. * @static
  30047. * @memberOf _
  30048. * @since 3.0.0
  30049. * @category Lang
  30050. * @param {*} value The value to convert.
  30051. * @returns {Object} Returns the converted plain object.
  30052. * @example
  30053. *
  30054. * function Foo() {
  30055. * this.b = 2;
  30056. * }
  30057. *
  30058. * Foo.prototype.c = 3;
  30059. *
  30060. * _.assign({ 'a': 1 }, new Foo);
  30061. * // => { 'a': 1, 'b': 2 }
  30062. *
  30063. * _.assign({ 'a': 1 }, _.toPlainObject(new Foo));
  30064. * // => { 'a': 1, 'b': 2, 'c': 3 }
  30065. */
  30066. function toPlainObject(value) {
  30067. return copyObject(value, keysIn(value));
  30068. }
  30069. /**
  30070. * Converts `value` to a safe integer. A safe integer can be compared and
  30071. * represented correctly.
  30072. *
  30073. * @static
  30074. * @memberOf _
  30075. * @since 4.0.0
  30076. * @category Lang
  30077. * @param {*} value The value to convert.
  30078. * @returns {number} Returns the converted integer.
  30079. * @example
  30080. *
  30081. * _.toSafeInteger(3.2);
  30082. * // => 3
  30083. *
  30084. * _.toSafeInteger(Number.MIN_VALUE);
  30085. * // => 0
  30086. *
  30087. * _.toSafeInteger(Infinity);
  30088. * // => 9007199254740991
  30089. *
  30090. * _.toSafeInteger('3.2');
  30091. * // => 3
  30092. */
  30093. function toSafeInteger(value) {
  30094. return value
  30095. ? baseClamp(toInteger(value), -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER)
  30096. : (value === 0 ? value : 0);
  30097. }
  30098. /**
  30099. * Converts `value` to a string. An empty string is returned for `null`
  30100. * and `undefined` values. The sign of `-0` is preserved.
  30101. *
  30102. * @static
  30103. * @memberOf _
  30104. * @since 4.0.0
  30105. * @category Lang
  30106. * @param {*} value The value to convert.
  30107. * @returns {string} Returns the converted string.
  30108. * @example
  30109. *
  30110. * _.toString(null);
  30111. * // => ''
  30112. *
  30113. * _.toString(-0);
  30114. * // => '-0'
  30115. *
  30116. * _.toString([1, 2, 3]);
  30117. * // => '1,2,3'
  30118. */
  30119. function toString(value) {
  30120. return value == null ? '' : baseToString(value);
  30121. }
  30122. /*------------------------------------------------------------------------*/
  30123. /**
  30124. * Assigns own enumerable string keyed properties of source objects to the
  30125. * destination object. Source objects are applied from left to right.
  30126. * Subsequent sources overwrite property assignments of previous sources.
  30127. *
  30128. * **Note:** This method mutates `object` and is loosely based on
  30129. * [`Object.assign`](https://mdn.io/Object/assign).
  30130. *
  30131. * @static
  30132. * @memberOf _
  30133. * @since 0.10.0
  30134. * @category Object
  30135. * @param {Object} object The destination object.
  30136. * @param {...Object} [sources] The source objects.
  30137. * @returns {Object} Returns `object`.
  30138. * @see _.assignIn
  30139. * @example
  30140. *
  30141. * function Foo() {
  30142. * this.a = 1;
  30143. * }
  30144. *
  30145. * function Bar() {
  30146. * this.c = 3;
  30147. * }
  30148. *
  30149. * Foo.prototype.b = 2;
  30150. * Bar.prototype.d = 4;
  30151. *
  30152. * _.assign({ 'a': 0 }, new Foo, new Bar);
  30153. * // => { 'a': 1, 'c': 3 }
  30154. */
  30155. var assign = createAssigner(function(object, source) {
  30156. if (isPrototype(source) || isArrayLike(source)) {
  30157. copyObject(source, keys(source), object);
  30158. return;
  30159. }
  30160. for (var key in source) {
  30161. if (hasOwnProperty.call(source, key)) {
  30162. assignValue(object, key, source[key]);
  30163. }
  30164. }
  30165. });
  30166. /**
  30167. * This method is like `_.assign` except that it iterates over own and
  30168. * inherited source properties.
  30169. *
  30170. * **Note:** This method mutates `object`.
  30171. *
  30172. * @static
  30173. * @memberOf _
  30174. * @since 4.0.0
  30175. * @alias extend
  30176. * @category Object
  30177. * @param {Object} object The destination object.
  30178. * @param {...Object} [sources] The source objects.
  30179. * @returns {Object} Returns `object`.
  30180. * @see _.assign
  30181. * @example
  30182. *
  30183. * function Foo() {
  30184. * this.a = 1;
  30185. * }
  30186. *
  30187. * function Bar() {
  30188. * this.c = 3;
  30189. * }
  30190. *
  30191. * Foo.prototype.b = 2;
  30192. * Bar.prototype.d = 4;
  30193. *
  30194. * _.assignIn({ 'a': 0 }, new Foo, new Bar);
  30195. * // => { 'a': 1, 'b': 2, 'c': 3, 'd': 4 }
  30196. */
  30197. var assignIn = createAssigner(function(object, source) {
  30198. copyObject(source, keysIn(source), object);
  30199. });
  30200. /**
  30201. * This method is like `_.assignIn` except that it accepts `customizer`
  30202. * which is invoked to produce the assigned values. If `customizer` returns
  30203. * `undefined`, assignment is handled by the method instead. The `customizer`
  30204. * is invoked with five arguments: (objValue, srcValue, key, object, source).
  30205. *
  30206. * **Note:** This method mutates `object`.
  30207. *
  30208. * @static
  30209. * @memberOf _
  30210. * @since 4.0.0
  30211. * @alias extendWith
  30212. * @category Object
  30213. * @param {Object} object The destination object.
  30214. * @param {...Object} sources The source objects.
  30215. * @param {Function} [customizer] The function to customize assigned values.
  30216. * @returns {Object} Returns `object`.
  30217. * @see _.assignWith
  30218. * @example
  30219. *
  30220. * function customizer(objValue, srcValue) {
  30221. * return _.isUndefined(objValue) ? srcValue : objValue;
  30222. * }
  30223. *
  30224. * var defaults = _.partialRight(_.assignInWith, customizer);
  30225. *
  30226. * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  30227. * // => { 'a': 1, 'b': 2 }
  30228. */
  30229. var assignInWith = createAssigner(function(object, source, srcIndex, customizer) {
  30230. copyObject(source, keysIn(source), object, customizer);
  30231. });
  30232. /**
  30233. * This method is like `_.assign` except that it accepts `customizer`
  30234. * which is invoked to produce the assigned values. If `customizer` returns
  30235. * `undefined`, assignment is handled by the method instead. The `customizer`
  30236. * is invoked with five arguments: (objValue, srcValue, key, object, source).
  30237. *
  30238. * **Note:** This method mutates `object`.
  30239. *
  30240. * @static
  30241. * @memberOf _
  30242. * @since 4.0.0
  30243. * @category Object
  30244. * @param {Object} object The destination object.
  30245. * @param {...Object} sources The source objects.
  30246. * @param {Function} [customizer] The function to customize assigned values.
  30247. * @returns {Object} Returns `object`.
  30248. * @see _.assignInWith
  30249. * @example
  30250. *
  30251. * function customizer(objValue, srcValue) {
  30252. * return _.isUndefined(objValue) ? srcValue : objValue;
  30253. * }
  30254. *
  30255. * var defaults = _.partialRight(_.assignWith, customizer);
  30256. *
  30257. * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  30258. * // => { 'a': 1, 'b': 2 }
  30259. */
  30260. var assignWith = createAssigner(function(object, source, srcIndex, customizer) {
  30261. copyObject(source, keys(source), object, customizer);
  30262. });
  30263. /**
  30264. * Creates an array of values corresponding to `paths` of `object`.
  30265. *
  30266. * @static
  30267. * @memberOf _
  30268. * @since 1.0.0
  30269. * @category Object
  30270. * @param {Object} object The object to iterate over.
  30271. * @param {...(string|string[])} [paths] The property paths to pick.
  30272. * @returns {Array} Returns the picked values.
  30273. * @example
  30274. *
  30275. * var object = { 'a': [{ 'b': { 'c': 3 } }, 4] };
  30276. *
  30277. * _.at(object, ['a[0].b.c', 'a[1]']);
  30278. * // => [3, 4]
  30279. */
  30280. var at = flatRest(baseAt);
  30281. /**
  30282. * Creates an object that inherits from the `prototype` object. If a
  30283. * `properties` object is given, its own enumerable string keyed properties
  30284. * are assigned to the created object.
  30285. *
  30286. * @static
  30287. * @memberOf _
  30288. * @since 2.3.0
  30289. * @category Object
  30290. * @param {Object} prototype The object to inherit from.
  30291. * @param {Object} [properties] The properties to assign to the object.
  30292. * @returns {Object} Returns the new object.
  30293. * @example
  30294. *
  30295. * function Shape() {
  30296. * this.x = 0;
  30297. * this.y = 0;
  30298. * }
  30299. *
  30300. * function Circle() {
  30301. * Shape.call(this);
  30302. * }
  30303. *
  30304. * Circle.prototype = _.create(Shape.prototype, {
  30305. * 'constructor': Circle
  30306. * });
  30307. *
  30308. * var circle = new Circle;
  30309. * circle instanceof Circle;
  30310. * // => true
  30311. *
  30312. * circle instanceof Shape;
  30313. * // => true
  30314. */
  30315. function create(prototype, properties) {
  30316. var result = baseCreate(prototype);
  30317. return properties == null ? result : baseAssign(result, properties);
  30318. }
  30319. /**
  30320. * Assigns own and inherited enumerable string keyed properties of source
  30321. * objects to the destination object for all destination properties that
  30322. * resolve to `undefined`. Source objects are applied from left to right.
  30323. * Once a property is set, additional values of the same property are ignored.
  30324. *
  30325. * **Note:** This method mutates `object`.
  30326. *
  30327. * @static
  30328. * @since 0.1.0
  30329. * @memberOf _
  30330. * @category Object
  30331. * @param {Object} object The destination object.
  30332. * @param {...Object} [sources] The source objects.
  30333. * @returns {Object} Returns `object`.
  30334. * @see _.defaultsDeep
  30335. * @example
  30336. *
  30337. * _.defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  30338. * // => { 'a': 1, 'b': 2 }
  30339. */
  30340. var defaults = baseRest(function(object, sources) {
  30341. object = Object(object);
  30342. var index = -1;
  30343. var length = sources.length;
  30344. var guard = length > 2 ? sources[2] : undefined;
  30345. if (guard && isIterateeCall(sources[0], sources[1], guard)) {
  30346. length = 1;
  30347. }
  30348. while (++index < length) {
  30349. var source = sources[index];
  30350. var props = keysIn(source);
  30351. var propsIndex = -1;
  30352. var propsLength = props.length;
  30353. while (++propsIndex < propsLength) {
  30354. var key = props[propsIndex];
  30355. var value = object[key];
  30356. if (value === undefined ||
  30357. (eq(value, objectProto[key]) && !hasOwnProperty.call(object, key))) {
  30358. object[key] = source[key];
  30359. }
  30360. }
  30361. }
  30362. return object;
  30363. });
  30364. /**
  30365. * This method is like `_.defaults` except that it recursively assigns
  30366. * default properties.
  30367. *
  30368. * **Note:** This method mutates `object`.
  30369. *
  30370. * @static
  30371. * @memberOf _
  30372. * @since 3.10.0
  30373. * @category Object
  30374. * @param {Object} object The destination object.
  30375. * @param {...Object} [sources] The source objects.
  30376. * @returns {Object} Returns `object`.
  30377. * @see _.defaults
  30378. * @example
  30379. *
  30380. * _.defaultsDeep({ 'a': { 'b': 2 } }, { 'a': { 'b': 1, 'c': 3 } });
  30381. * // => { 'a': { 'b': 2, 'c': 3 } }
  30382. */
  30383. var defaultsDeep = baseRest(function(args) {
  30384. args.push(undefined, customDefaultsMerge);
  30385. return apply(mergeWith, undefined, args);
  30386. });
  30387. /**
  30388. * This method is like `_.find` except that it returns the key of the first
  30389. * element `predicate` returns truthy for instead of the element itself.
  30390. *
  30391. * @static
  30392. * @memberOf _
  30393. * @since 1.1.0
  30394. * @category Object
  30395. * @param {Object} object The object to inspect.
  30396. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  30397. * @returns {string|undefined} Returns the key of the matched element,
  30398. * else `undefined`.
  30399. * @example
  30400. *
  30401. * var users = {
  30402. * 'barney': { 'age': 36, 'active': true },
  30403. * 'fred': { 'age': 40, 'active': false },
  30404. * 'pebbles': { 'age': 1, 'active': true }
  30405. * };
  30406. *
  30407. * _.findKey(users, function(o) { return o.age < 40; });
  30408. * // => 'barney' (iteration order is not guaranteed)
  30409. *
  30410. * // The `_.matches` iteratee shorthand.
  30411. * _.findKey(users, { 'age': 1, 'active': true });
  30412. * // => 'pebbles'
  30413. *
  30414. * // The `_.matchesProperty` iteratee shorthand.
  30415. * _.findKey(users, ['active', false]);
  30416. * // => 'fred'
  30417. *
  30418. * // The `_.property` iteratee shorthand.
  30419. * _.findKey(users, 'active');
  30420. * // => 'barney'
  30421. */
  30422. function findKey(object, predicate) {
  30423. return baseFindKey(object, getIteratee(predicate, 3), baseForOwn);
  30424. }
  30425. /**
  30426. * This method is like `_.findKey` except that it iterates over elements of
  30427. * a collection in the opposite order.
  30428. *
  30429. * @static
  30430. * @memberOf _
  30431. * @since 2.0.0
  30432. * @category Object
  30433. * @param {Object} object The object to inspect.
  30434. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  30435. * @returns {string|undefined} Returns the key of the matched element,
  30436. * else `undefined`.
  30437. * @example
  30438. *
  30439. * var users = {
  30440. * 'barney': { 'age': 36, 'active': true },
  30441. * 'fred': { 'age': 40, 'active': false },
  30442. * 'pebbles': { 'age': 1, 'active': true }
  30443. * };
  30444. *
  30445. * _.findLastKey(users, function(o) { return o.age < 40; });
  30446. * // => returns 'pebbles' assuming `_.findKey` returns 'barney'
  30447. *
  30448. * // The `_.matches` iteratee shorthand.
  30449. * _.findLastKey(users, { 'age': 36, 'active': true });
  30450. * // => 'barney'
  30451. *
  30452. * // The `_.matchesProperty` iteratee shorthand.
  30453. * _.findLastKey(users, ['active', false]);
  30454. * // => 'fred'
  30455. *
  30456. * // The `_.property` iteratee shorthand.
  30457. * _.findLastKey(users, 'active');
  30458. * // => 'pebbles'
  30459. */
  30460. function findLastKey(object, predicate) {
  30461. return baseFindKey(object, getIteratee(predicate, 3), baseForOwnRight);
  30462. }
  30463. /**
  30464. * Iterates over own and inherited enumerable string keyed properties of an
  30465. * object and invokes `iteratee` for each property. The iteratee is invoked
  30466. * with three arguments: (value, key, object). Iteratee functions may exit
  30467. * iteration early by explicitly returning `false`.
  30468. *
  30469. * @static
  30470. * @memberOf _
  30471. * @since 0.3.0
  30472. * @category Object
  30473. * @param {Object} object The object to iterate over.
  30474. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  30475. * @returns {Object} Returns `object`.
  30476. * @see _.forInRight
  30477. * @example
  30478. *
  30479. * function Foo() {
  30480. * this.a = 1;
  30481. * this.b = 2;
  30482. * }
  30483. *
  30484. * Foo.prototype.c = 3;
  30485. *
  30486. * _.forIn(new Foo, function(value, key) {
  30487. * console.log(key);
  30488. * });
  30489. * // => Logs 'a', 'b', then 'c' (iteration order is not guaranteed).
  30490. */
  30491. function forIn(object, iteratee) {
  30492. return object == null
  30493. ? object
  30494. : baseFor(object, getIteratee(iteratee, 3), keysIn);
  30495. }
  30496. /**
  30497. * This method is like `_.forIn` except that it iterates over properties of
  30498. * `object` in the opposite order.
  30499. *
  30500. * @static
  30501. * @memberOf _
  30502. * @since 2.0.0
  30503. * @category Object
  30504. * @param {Object} object The object to iterate over.
  30505. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  30506. * @returns {Object} Returns `object`.
  30507. * @see _.forIn
  30508. * @example
  30509. *
  30510. * function Foo() {
  30511. * this.a = 1;
  30512. * this.b = 2;
  30513. * }
  30514. *
  30515. * Foo.prototype.c = 3;
  30516. *
  30517. * _.forInRight(new Foo, function(value, key) {
  30518. * console.log(key);
  30519. * });
  30520. * // => Logs 'c', 'b', then 'a' assuming `_.forIn` logs 'a', 'b', then 'c'.
  30521. */
  30522. function forInRight(object, iteratee) {
  30523. return object == null
  30524. ? object
  30525. : baseForRight(object, getIteratee(iteratee, 3), keysIn);
  30526. }
  30527. /**
  30528. * Iterates over own enumerable string keyed properties of an object and
  30529. * invokes `iteratee` for each property. The iteratee is invoked with three
  30530. * arguments: (value, key, object). Iteratee functions may exit iteration
  30531. * early by explicitly returning `false`.
  30532. *
  30533. * @static
  30534. * @memberOf _
  30535. * @since 0.3.0
  30536. * @category Object
  30537. * @param {Object} object The object to iterate over.
  30538. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  30539. * @returns {Object} Returns `object`.
  30540. * @see _.forOwnRight
  30541. * @example
  30542. *
  30543. * function Foo() {
  30544. * this.a = 1;
  30545. * this.b = 2;
  30546. * }
  30547. *
  30548. * Foo.prototype.c = 3;
  30549. *
  30550. * _.forOwn(new Foo, function(value, key) {
  30551. * console.log(key);
  30552. * });
  30553. * // => Logs 'a' then 'b' (iteration order is not guaranteed).
  30554. */
  30555. function forOwn(object, iteratee) {
  30556. return object && baseForOwn(object, getIteratee(iteratee, 3));
  30557. }
  30558. /**
  30559. * This method is like `_.forOwn` except that it iterates over properties of
  30560. * `object` in the opposite order.
  30561. *
  30562. * @static
  30563. * @memberOf _
  30564. * @since 2.0.0
  30565. * @category Object
  30566. * @param {Object} object The object to iterate over.
  30567. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  30568. * @returns {Object} Returns `object`.
  30569. * @see _.forOwn
  30570. * @example
  30571. *
  30572. * function Foo() {
  30573. * this.a = 1;
  30574. * this.b = 2;
  30575. * }
  30576. *
  30577. * Foo.prototype.c = 3;
  30578. *
  30579. * _.forOwnRight(new Foo, function(value, key) {
  30580. * console.log(key);
  30581. * });
  30582. * // => Logs 'b' then 'a' assuming `_.forOwn` logs 'a' then 'b'.
  30583. */
  30584. function forOwnRight(object, iteratee) {
  30585. return object && baseForOwnRight(object, getIteratee(iteratee, 3));
  30586. }
  30587. /**
  30588. * Creates an array of function property names from own enumerable properties
  30589. * of `object`.
  30590. *
  30591. * @static
  30592. * @since 0.1.0
  30593. * @memberOf _
  30594. * @category Object
  30595. * @param {Object} object The object to inspect.
  30596. * @returns {Array} Returns the function names.
  30597. * @see _.functionsIn
  30598. * @example
  30599. *
  30600. * function Foo() {
  30601. * this.a = _.constant('a');
  30602. * this.b = _.constant('b');
  30603. * }
  30604. *
  30605. * Foo.prototype.c = _.constant('c');
  30606. *
  30607. * _.functions(new Foo);
  30608. * // => ['a', 'b']
  30609. */
  30610. function functions(object) {
  30611. return object == null ? [] : baseFunctions(object, keys(object));
  30612. }
  30613. /**
  30614. * Creates an array of function property names from own and inherited
  30615. * enumerable properties of `object`.
  30616. *
  30617. * @static
  30618. * @memberOf _
  30619. * @since 4.0.0
  30620. * @category Object
  30621. * @param {Object} object The object to inspect.
  30622. * @returns {Array} Returns the function names.
  30623. * @see _.functions
  30624. * @example
  30625. *
  30626. * function Foo() {
  30627. * this.a = _.constant('a');
  30628. * this.b = _.constant('b');
  30629. * }
  30630. *
  30631. * Foo.prototype.c = _.constant('c');
  30632. *
  30633. * _.functionsIn(new Foo);
  30634. * // => ['a', 'b', 'c']
  30635. */
  30636. function functionsIn(object) {
  30637. return object == null ? [] : baseFunctions(object, keysIn(object));
  30638. }
  30639. /**
  30640. * Gets the value at `path` of `object`. If the resolved value is
  30641. * `undefined`, the `defaultValue` is returned in its place.
  30642. *
  30643. * @static
  30644. * @memberOf _
  30645. * @since 3.7.0
  30646. * @category Object
  30647. * @param {Object} object The object to query.
  30648. * @param {Array|string} path The path of the property to get.
  30649. * @param {*} [defaultValue] The value returned for `undefined` resolved values.
  30650. * @returns {*} Returns the resolved value.
  30651. * @example
  30652. *
  30653. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  30654. *
  30655. * _.get(object, 'a[0].b.c');
  30656. * // => 3
  30657. *
  30658. * _.get(object, ['a', '0', 'b', 'c']);
  30659. * // => 3
  30660. *
  30661. * _.get(object, 'a.b.c', 'default');
  30662. * // => 'default'
  30663. */
  30664. function get(object, path, defaultValue) {
  30665. var result = object == null ? undefined : baseGet(object, path);
  30666. return result === undefined ? defaultValue : result;
  30667. }
  30668. /**
  30669. * Checks if `path` is a direct property of `object`.
  30670. *
  30671. * @static
  30672. * @since 0.1.0
  30673. * @memberOf _
  30674. * @category Object
  30675. * @param {Object} object The object to query.
  30676. * @param {Array|string} path The path to check.
  30677. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  30678. * @example
  30679. *
  30680. * var object = { 'a': { 'b': 2 } };
  30681. * var other = _.create({ 'a': _.create({ 'b': 2 }) });
  30682. *
  30683. * _.has(object, 'a');
  30684. * // => true
  30685. *
  30686. * _.has(object, 'a.b');
  30687. * // => true
  30688. *
  30689. * _.has(object, ['a', 'b']);
  30690. * // => true
  30691. *
  30692. * _.has(other, 'a');
  30693. * // => false
  30694. */
  30695. function has(object, path) {
  30696. return object != null && hasPath(object, path, baseHas);
  30697. }
  30698. /**
  30699. * Checks if `path` is a direct or inherited property of `object`.
  30700. *
  30701. * @static
  30702. * @memberOf _
  30703. * @since 4.0.0
  30704. * @category Object
  30705. * @param {Object} object The object to query.
  30706. * @param {Array|string} path The path to check.
  30707. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  30708. * @example
  30709. *
  30710. * var object = _.create({ 'a': _.create({ 'b': 2 }) });
  30711. *
  30712. * _.hasIn(object, 'a');
  30713. * // => true
  30714. *
  30715. * _.hasIn(object, 'a.b');
  30716. * // => true
  30717. *
  30718. * _.hasIn(object, ['a', 'b']);
  30719. * // => true
  30720. *
  30721. * _.hasIn(object, 'b');
  30722. * // => false
  30723. */
  30724. function hasIn(object, path) {
  30725. return object != null && hasPath(object, path, baseHasIn);
  30726. }
  30727. /**
  30728. * Creates an object composed of the inverted keys and values of `object`.
  30729. * If `object` contains duplicate values, subsequent values overwrite
  30730. * property assignments of previous values.
  30731. *
  30732. * @static
  30733. * @memberOf _
  30734. * @since 0.7.0
  30735. * @category Object
  30736. * @param {Object} object The object to invert.
  30737. * @returns {Object} Returns the new inverted object.
  30738. * @example
  30739. *
  30740. * var object = { 'a': 1, 'b': 2, 'c': 1 };
  30741. *
  30742. * _.invert(object);
  30743. * // => { '1': 'c', '2': 'b' }
  30744. */
  30745. var invert = createInverter(function(result, value, key) {
  30746. if (value != null &&
  30747. typeof value.toString != 'function') {
  30748. value = nativeObjectToString.call(value);
  30749. }
  30750. result[value] = key;
  30751. }, constant(identity));
  30752. /**
  30753. * This method is like `_.invert` except that the inverted object is generated
  30754. * from the results of running each element of `object` thru `iteratee`. The
  30755. * corresponding inverted value of each inverted key is an array of keys
  30756. * responsible for generating the inverted value. The iteratee is invoked
  30757. * with one argument: (value).
  30758. *
  30759. * @static
  30760. * @memberOf _
  30761. * @since 4.1.0
  30762. * @category Object
  30763. * @param {Object} object The object to invert.
  30764. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  30765. * @returns {Object} Returns the new inverted object.
  30766. * @example
  30767. *
  30768. * var object = { 'a': 1, 'b': 2, 'c': 1 };
  30769. *
  30770. * _.invertBy(object);
  30771. * // => { '1': ['a', 'c'], '2': ['b'] }
  30772. *
  30773. * _.invertBy(object, function(value) {
  30774. * return 'group' + value;
  30775. * });
  30776. * // => { 'group1': ['a', 'c'], 'group2': ['b'] }
  30777. */
  30778. var invertBy = createInverter(function(result, value, key) {
  30779. if (value != null &&
  30780. typeof value.toString != 'function') {
  30781. value = nativeObjectToString.call(value);
  30782. }
  30783. if (hasOwnProperty.call(result, value)) {
  30784. result[value].push(key);
  30785. } else {
  30786. result[value] = [key];
  30787. }
  30788. }, getIteratee);
  30789. /**
  30790. * Invokes the method at `path` of `object`.
  30791. *
  30792. * @static
  30793. * @memberOf _
  30794. * @since 4.0.0
  30795. * @category Object
  30796. * @param {Object} object The object to query.
  30797. * @param {Array|string} path The path of the method to invoke.
  30798. * @param {...*} [args] The arguments to invoke the method with.
  30799. * @returns {*} Returns the result of the invoked method.
  30800. * @example
  30801. *
  30802. * var object = { 'a': [{ 'b': { 'c': [1, 2, 3, 4] } }] };
  30803. *
  30804. * _.invoke(object, 'a[0].b.c.slice', 1, 3);
  30805. * // => [2, 3]
  30806. */
  30807. var invoke = baseRest(baseInvoke);
  30808. /**
  30809. * Creates an array of the own enumerable property names of `object`.
  30810. *
  30811. * **Note:** Non-object values are coerced to objects. See the
  30812. * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
  30813. * for more details.
  30814. *
  30815. * @static
  30816. * @since 0.1.0
  30817. * @memberOf _
  30818. * @category Object
  30819. * @param {Object} object The object to query.
  30820. * @returns {Array} Returns the array of property names.
  30821. * @example
  30822. *
  30823. * function Foo() {
  30824. * this.a = 1;
  30825. * this.b = 2;
  30826. * }
  30827. *
  30828. * Foo.prototype.c = 3;
  30829. *
  30830. * _.keys(new Foo);
  30831. * // => ['a', 'b'] (iteration order is not guaranteed)
  30832. *
  30833. * _.keys('hi');
  30834. * // => ['0', '1']
  30835. */
  30836. function keys(object) {
  30837. return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
  30838. }
  30839. /**
  30840. * Creates an array of the own and inherited enumerable property names of `object`.
  30841. *
  30842. * **Note:** Non-object values are coerced to objects.
  30843. *
  30844. * @static
  30845. * @memberOf _
  30846. * @since 3.0.0
  30847. * @category Object
  30848. * @param {Object} object The object to query.
  30849. * @returns {Array} Returns the array of property names.
  30850. * @example
  30851. *
  30852. * function Foo() {
  30853. * this.a = 1;
  30854. * this.b = 2;
  30855. * }
  30856. *
  30857. * Foo.prototype.c = 3;
  30858. *
  30859. * _.keysIn(new Foo);
  30860. * // => ['a', 'b', 'c'] (iteration order is not guaranteed)
  30861. */
  30862. function keysIn(object) {
  30863. return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);
  30864. }
  30865. /**
  30866. * The opposite of `_.mapValues`; this method creates an object with the
  30867. * same values as `object` and keys generated by running each own enumerable
  30868. * string keyed property of `object` thru `iteratee`. The iteratee is invoked
  30869. * with three arguments: (value, key, object).
  30870. *
  30871. * @static
  30872. * @memberOf _
  30873. * @since 3.8.0
  30874. * @category Object
  30875. * @param {Object} object The object to iterate over.
  30876. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  30877. * @returns {Object} Returns the new mapped object.
  30878. * @see _.mapValues
  30879. * @example
  30880. *
  30881. * _.mapKeys({ 'a': 1, 'b': 2 }, function(value, key) {
  30882. * return key + value;
  30883. * });
  30884. * // => { 'a1': 1, 'b2': 2 }
  30885. */
  30886. function mapKeys(object, iteratee) {
  30887. var result = {};
  30888. iteratee = getIteratee(iteratee, 3);
  30889. baseForOwn(object, function(value, key, object) {
  30890. baseAssignValue(result, iteratee(value, key, object), value);
  30891. });
  30892. return result;
  30893. }
  30894. /**
  30895. * Creates an object with the same keys as `object` and values generated
  30896. * by running each own enumerable string keyed property of `object` thru
  30897. * `iteratee`. The iteratee is invoked with three arguments:
  30898. * (value, key, object).
  30899. *
  30900. * @static
  30901. * @memberOf _
  30902. * @since 2.4.0
  30903. * @category Object
  30904. * @param {Object} object The object to iterate over.
  30905. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  30906. * @returns {Object} Returns the new mapped object.
  30907. * @see _.mapKeys
  30908. * @example
  30909. *
  30910. * var users = {
  30911. * 'fred': { 'user': 'fred', 'age': 40 },
  30912. * 'pebbles': { 'user': 'pebbles', 'age': 1 }
  30913. * };
  30914. *
  30915. * _.mapValues(users, function(o) { return o.age; });
  30916. * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)
  30917. *
  30918. * // The `_.property` iteratee shorthand.
  30919. * _.mapValues(users, 'age');
  30920. * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)
  30921. */
  30922. function mapValues(object, iteratee) {
  30923. var result = {};
  30924. iteratee = getIteratee(iteratee, 3);
  30925. baseForOwn(object, function(value, key, object) {
  30926. baseAssignValue(result, key, iteratee(value, key, object));
  30927. });
  30928. return result;
  30929. }
  30930. /**
  30931. * This method is like `_.assign` except that it recursively merges own and
  30932. * inherited enumerable string keyed properties of source objects into the
  30933. * destination object. Source properties that resolve to `undefined` are
  30934. * skipped if a destination value exists. Array and plain object properties
  30935. * are merged recursively. Other objects and value types are overridden by
  30936. * assignment. Source objects are applied from left to right. Subsequent
  30937. * sources overwrite property assignments of previous sources.
  30938. *
  30939. * **Note:** This method mutates `object`.
  30940. *
  30941. * @static
  30942. * @memberOf _
  30943. * @since 0.5.0
  30944. * @category Object
  30945. * @param {Object} object The destination object.
  30946. * @param {...Object} [sources] The source objects.
  30947. * @returns {Object} Returns `object`.
  30948. * @example
  30949. *
  30950. * var object = {
  30951. * 'a': [{ 'b': 2 }, { 'd': 4 }]
  30952. * };
  30953. *
  30954. * var other = {
  30955. * 'a': [{ 'c': 3 }, { 'e': 5 }]
  30956. * };
  30957. *
  30958. * _.merge(object, other);
  30959. * // => { 'a': [{ 'b': 2, 'c': 3 }, { 'd': 4, 'e': 5 }] }
  30960. */
  30961. var merge = createAssigner(function(object, source, srcIndex) {
  30962. baseMerge(object, source, srcIndex);
  30963. });
  30964. /**
  30965. * This method is like `_.merge` except that it accepts `customizer` which
  30966. * is invoked to produce the merged values of the destination and source
  30967. * properties. If `customizer` returns `undefined`, merging is handled by the
  30968. * method instead. The `customizer` is invoked with six arguments:
  30969. * (objValue, srcValue, key, object, source, stack).
  30970. *
  30971. * **Note:** This method mutates `object`.
  30972. *
  30973. * @static
  30974. * @memberOf _
  30975. * @since 4.0.0
  30976. * @category Object
  30977. * @param {Object} object The destination object.
  30978. * @param {...Object} sources The source objects.
  30979. * @param {Function} customizer The function to customize assigned values.
  30980. * @returns {Object} Returns `object`.
  30981. * @example
  30982. *
  30983. * function customizer(objValue, srcValue) {
  30984. * if (_.isArray(objValue)) {
  30985. * return objValue.concat(srcValue);
  30986. * }
  30987. * }
  30988. *
  30989. * var object = { 'a': [1], 'b': [2] };
  30990. * var other = { 'a': [3], 'b': [4] };
  30991. *
  30992. * _.mergeWith(object, other, customizer);
  30993. * // => { 'a': [1, 3], 'b': [2, 4] }
  30994. */
  30995. var mergeWith = createAssigner(function(object, source, srcIndex, customizer) {
  30996. baseMerge(object, source, srcIndex, customizer);
  30997. });
  30998. /**
  30999. * The opposite of `_.pick`; this method creates an object composed of the
  31000. * own and inherited enumerable property paths of `object` that are not omitted.
  31001. *
  31002. * **Note:** This method is considerably slower than `_.pick`.
  31003. *
  31004. * @static
  31005. * @since 0.1.0
  31006. * @memberOf _
  31007. * @category Object
  31008. * @param {Object} object The source object.
  31009. * @param {...(string|string[])} [paths] The property paths to omit.
  31010. * @returns {Object} Returns the new object.
  31011. * @example
  31012. *
  31013. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  31014. *
  31015. * _.omit(object, ['a', 'c']);
  31016. * // => { 'b': '2' }
  31017. */
  31018. var omit = flatRest(function(object, paths) {
  31019. var result = {};
  31020. if (object == null) {
  31021. return result;
  31022. }
  31023. var isDeep = false;
  31024. paths = arrayMap(paths, function(path) {
  31025. path = castPath(path, object);
  31026. isDeep || (isDeep = path.length > 1);
  31027. return path;
  31028. });
  31029. copyObject(object, getAllKeysIn(object), result);
  31030. if (isDeep) {
  31031. result = baseClone(result, CLONE_DEEP_FLAG | CLONE_FLAT_FLAG | CLONE_SYMBOLS_FLAG, customOmitClone);
  31032. }
  31033. var length = paths.length;
  31034. while (length--) {
  31035. baseUnset(result, paths[length]);
  31036. }
  31037. return result;
  31038. });
  31039. /**
  31040. * The opposite of `_.pickBy`; this method creates an object composed of
  31041. * the own and inherited enumerable string keyed properties of `object` that
  31042. * `predicate` doesn't return truthy for. The predicate is invoked with two
  31043. * arguments: (value, key).
  31044. *
  31045. * @static
  31046. * @memberOf _
  31047. * @since 4.0.0
  31048. * @category Object
  31049. * @param {Object} object The source object.
  31050. * @param {Function} [predicate=_.identity] The function invoked per property.
  31051. * @returns {Object} Returns the new object.
  31052. * @example
  31053. *
  31054. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  31055. *
  31056. * _.omitBy(object, _.isNumber);
  31057. * // => { 'b': '2' }
  31058. */
  31059. function omitBy(object, predicate) {
  31060. return pickBy(object, negate(getIteratee(predicate)));
  31061. }
  31062. /**
  31063. * Creates an object composed of the picked `object` properties.
  31064. *
  31065. * @static
  31066. * @since 0.1.0
  31067. * @memberOf _
  31068. * @category Object
  31069. * @param {Object} object The source object.
  31070. * @param {...(string|string[])} [paths] The property paths to pick.
  31071. * @returns {Object} Returns the new object.
  31072. * @example
  31073. *
  31074. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  31075. *
  31076. * _.pick(object, ['a', 'c']);
  31077. * // => { 'a': 1, 'c': 3 }
  31078. */
  31079. var pick = flatRest(function(object, paths) {
  31080. return object == null ? {} : basePick(object, paths);
  31081. });
  31082. /**
  31083. * Creates an object composed of the `object` properties `predicate` returns
  31084. * truthy for. The predicate is invoked with two arguments: (value, key).
  31085. *
  31086. * @static
  31087. * @memberOf _
  31088. * @since 4.0.0
  31089. * @category Object
  31090. * @param {Object} object The source object.
  31091. * @param {Function} [predicate=_.identity] The function invoked per property.
  31092. * @returns {Object} Returns the new object.
  31093. * @example
  31094. *
  31095. * var object = { 'a': 1, 'b': '2', 'c': 3 };
  31096. *
  31097. * _.pickBy(object, _.isNumber);
  31098. * // => { 'a': 1, 'c': 3 }
  31099. */
  31100. function pickBy(object, predicate) {
  31101. if (object == null) {
  31102. return {};
  31103. }
  31104. var props = arrayMap(getAllKeysIn(object), function(prop) {
  31105. return [prop];
  31106. });
  31107. predicate = getIteratee(predicate);
  31108. return basePickBy(object, props, function(value, path) {
  31109. return predicate(value, path[0]);
  31110. });
  31111. }
  31112. /**
  31113. * This method is like `_.get` except that if the resolved value is a
  31114. * function it's invoked with the `this` binding of its parent object and
  31115. * its result is returned.
  31116. *
  31117. * @static
  31118. * @since 0.1.0
  31119. * @memberOf _
  31120. * @category Object
  31121. * @param {Object} object The object to query.
  31122. * @param {Array|string} path The path of the property to resolve.
  31123. * @param {*} [defaultValue] The value returned for `undefined` resolved values.
  31124. * @returns {*} Returns the resolved value.
  31125. * @example
  31126. *
  31127. * var object = { 'a': [{ 'b': { 'c1': 3, 'c2': _.constant(4) } }] };
  31128. *
  31129. * _.result(object, 'a[0].b.c1');
  31130. * // => 3
  31131. *
  31132. * _.result(object, 'a[0].b.c2');
  31133. * // => 4
  31134. *
  31135. * _.result(object, 'a[0].b.c3', 'default');
  31136. * // => 'default'
  31137. *
  31138. * _.result(object, 'a[0].b.c3', _.constant('default'));
  31139. * // => 'default'
  31140. */
  31141. function result(object, path, defaultValue) {
  31142. path = castPath(path, object);
  31143. var index = -1,
  31144. length = path.length;
  31145. // Ensure the loop is entered when path is empty.
  31146. if (!length) {
  31147. length = 1;
  31148. object = undefined;
  31149. }
  31150. while (++index < length) {
  31151. var value = object == null ? undefined : object[toKey(path[index])];
  31152. if (value === undefined) {
  31153. index = length;
  31154. value = defaultValue;
  31155. }
  31156. object = isFunction(value) ? value.call(object) : value;
  31157. }
  31158. return object;
  31159. }
  31160. /**
  31161. * Sets the value at `path` of `object`. If a portion of `path` doesn't exist,
  31162. * it's created. Arrays are created for missing index properties while objects
  31163. * are created for all other missing properties. Use `_.setWith` to customize
  31164. * `path` creation.
  31165. *
  31166. * **Note:** This method mutates `object`.
  31167. *
  31168. * @static
  31169. * @memberOf _
  31170. * @since 3.7.0
  31171. * @category Object
  31172. * @param {Object} object The object to modify.
  31173. * @param {Array|string} path The path of the property to set.
  31174. * @param {*} value The value to set.
  31175. * @returns {Object} Returns `object`.
  31176. * @example
  31177. *
  31178. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  31179. *
  31180. * _.set(object, 'a[0].b.c', 4);
  31181. * console.log(object.a[0].b.c);
  31182. * // => 4
  31183. *
  31184. * _.set(object, ['x', '0', 'y', 'z'], 5);
  31185. * console.log(object.x[0].y.z);
  31186. * // => 5
  31187. */
  31188. function set(object, path, value) {
  31189. return object == null ? object : baseSet(object, path, value);
  31190. }
  31191. /**
  31192. * This method is like `_.set` except that it accepts `customizer` which is
  31193. * invoked to produce the objects of `path`. If `customizer` returns `undefined`
  31194. * path creation is handled by the method instead. The `customizer` is invoked
  31195. * with three arguments: (nsValue, key, nsObject).
  31196. *
  31197. * **Note:** This method mutates `object`.
  31198. *
  31199. * @static
  31200. * @memberOf _
  31201. * @since 4.0.0
  31202. * @category Object
  31203. * @param {Object} object The object to modify.
  31204. * @param {Array|string} path The path of the property to set.
  31205. * @param {*} value The value to set.
  31206. * @param {Function} [customizer] The function to customize assigned values.
  31207. * @returns {Object} Returns `object`.
  31208. * @example
  31209. *
  31210. * var object = {};
  31211. *
  31212. * _.setWith(object, '[0][1]', 'a', Object);
  31213. * // => { '0': { '1': 'a' } }
  31214. */
  31215. function setWith(object, path, value, customizer) {
  31216. customizer = typeof customizer == 'function' ? customizer : undefined;
  31217. return object == null ? object : baseSet(object, path, value, customizer);
  31218. }
  31219. /**
  31220. * Creates an array of own enumerable string keyed-value pairs for `object`
  31221. * which can be consumed by `_.fromPairs`. If `object` is a map or set, its
  31222. * entries are returned.
  31223. *
  31224. * @static
  31225. * @memberOf _
  31226. * @since 4.0.0
  31227. * @alias entries
  31228. * @category Object
  31229. * @param {Object} object The object to query.
  31230. * @returns {Array} Returns the key-value pairs.
  31231. * @example
  31232. *
  31233. * function Foo() {
  31234. * this.a = 1;
  31235. * this.b = 2;
  31236. * }
  31237. *
  31238. * Foo.prototype.c = 3;
  31239. *
  31240. * _.toPairs(new Foo);
  31241. * // => [['a', 1], ['b', 2]] (iteration order is not guaranteed)
  31242. */
  31243. var toPairs = createToPairs(keys);
  31244. /**
  31245. * Creates an array of own and inherited enumerable string keyed-value pairs
  31246. * for `object` which can be consumed by `_.fromPairs`. If `object` is a map
  31247. * or set, its entries are returned.
  31248. *
  31249. * @static
  31250. * @memberOf _
  31251. * @since 4.0.0
  31252. * @alias entriesIn
  31253. * @category Object
  31254. * @param {Object} object The object to query.
  31255. * @returns {Array} Returns the key-value pairs.
  31256. * @example
  31257. *
  31258. * function Foo() {
  31259. * this.a = 1;
  31260. * this.b = 2;
  31261. * }
  31262. *
  31263. * Foo.prototype.c = 3;
  31264. *
  31265. * _.toPairsIn(new Foo);
  31266. * // => [['a', 1], ['b', 2], ['c', 3]] (iteration order is not guaranteed)
  31267. */
  31268. var toPairsIn = createToPairs(keysIn);
  31269. /**
  31270. * An alternative to `_.reduce`; this method transforms `object` to a new
  31271. * `accumulator` object which is the result of running each of its own
  31272. * enumerable string keyed properties thru `iteratee`, with each invocation
  31273. * potentially mutating the `accumulator` object. If `accumulator` is not
  31274. * provided, a new object with the same `[[Prototype]]` will be used. The
  31275. * iteratee is invoked with four arguments: (accumulator, value, key, object).
  31276. * Iteratee functions may exit iteration early by explicitly returning `false`.
  31277. *
  31278. * @static
  31279. * @memberOf _
  31280. * @since 1.3.0
  31281. * @category Object
  31282. * @param {Object} object The object to iterate over.
  31283. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  31284. * @param {*} [accumulator] The custom accumulator value.
  31285. * @returns {*} Returns the accumulated value.
  31286. * @example
  31287. *
  31288. * _.transform([2, 3, 4], function(result, n) {
  31289. * result.push(n *= n);
  31290. * return n % 2 == 0;
  31291. * }, []);
  31292. * // => [4, 9]
  31293. *
  31294. * _.transform({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) {
  31295. * (result[value] || (result[value] = [])).push(key);
  31296. * }, {});
  31297. * // => { '1': ['a', 'c'], '2': ['b'] }
  31298. */
  31299. function transform(object, iteratee, accumulator) {
  31300. var isArr = isArray(object),
  31301. isArrLike = isArr || isBuffer(object) || isTypedArray(object);
  31302. iteratee = getIteratee(iteratee, 4);
  31303. if (accumulator == null) {
  31304. var Ctor = object && object.constructor;
  31305. if (isArrLike) {
  31306. accumulator = isArr ? new Ctor : [];
  31307. }
  31308. else if (isObject(object)) {
  31309. accumulator = isFunction(Ctor) ? baseCreate(getPrototype(object)) : {};
  31310. }
  31311. else {
  31312. accumulator = {};
  31313. }
  31314. }
  31315. (isArrLike ? arrayEach : baseForOwn)(object, function(value, index, object) {
  31316. return iteratee(accumulator, value, index, object);
  31317. });
  31318. return accumulator;
  31319. }
  31320. /**
  31321. * Removes the property at `path` of `object`.
  31322. *
  31323. * **Note:** This method mutates `object`.
  31324. *
  31325. * @static
  31326. * @memberOf _
  31327. * @since 4.0.0
  31328. * @category Object
  31329. * @param {Object} object The object to modify.
  31330. * @param {Array|string} path The path of the property to unset.
  31331. * @returns {boolean} Returns `true` if the property is deleted, else `false`.
  31332. * @example
  31333. *
  31334. * var object = { 'a': [{ 'b': { 'c': 7 } }] };
  31335. * _.unset(object, 'a[0].b.c');
  31336. * // => true
  31337. *
  31338. * console.log(object);
  31339. * // => { 'a': [{ 'b': {} }] };
  31340. *
  31341. * _.unset(object, ['a', '0', 'b', 'c']);
  31342. * // => true
  31343. *
  31344. * console.log(object);
  31345. * // => { 'a': [{ 'b': {} }] };
  31346. */
  31347. function unset(object, path) {
  31348. return object == null ? true : baseUnset(object, path);
  31349. }
  31350. /**
  31351. * This method is like `_.set` except that accepts `updater` to produce the
  31352. * value to set. Use `_.updateWith` to customize `path` creation. The `updater`
  31353. * is invoked with one argument: (value).
  31354. *
  31355. * **Note:** This method mutates `object`.
  31356. *
  31357. * @static
  31358. * @memberOf _
  31359. * @since 4.6.0
  31360. * @category Object
  31361. * @param {Object} object The object to modify.
  31362. * @param {Array|string} path The path of the property to set.
  31363. * @param {Function} updater The function to produce the updated value.
  31364. * @returns {Object} Returns `object`.
  31365. * @example
  31366. *
  31367. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  31368. *
  31369. * _.update(object, 'a[0].b.c', function(n) { return n * n; });
  31370. * console.log(object.a[0].b.c);
  31371. * // => 9
  31372. *
  31373. * _.update(object, 'x[0].y.z', function(n) { return n ? n + 1 : 0; });
  31374. * console.log(object.x[0].y.z);
  31375. * // => 0
  31376. */
  31377. function update(object, path, updater) {
  31378. return object == null ? object : baseUpdate(object, path, castFunction(updater));
  31379. }
  31380. /**
  31381. * This method is like `_.update` except that it accepts `customizer` which is
  31382. * invoked to produce the objects of `path`. If `customizer` returns `undefined`
  31383. * path creation is handled by the method instead. The `customizer` is invoked
  31384. * with three arguments: (nsValue, key, nsObject).
  31385. *
  31386. * **Note:** This method mutates `object`.
  31387. *
  31388. * @static
  31389. * @memberOf _
  31390. * @since 4.6.0
  31391. * @category Object
  31392. * @param {Object} object The object to modify.
  31393. * @param {Array|string} path The path of the property to set.
  31394. * @param {Function} updater The function to produce the updated value.
  31395. * @param {Function} [customizer] The function to customize assigned values.
  31396. * @returns {Object} Returns `object`.
  31397. * @example
  31398. *
  31399. * var object = {};
  31400. *
  31401. * _.updateWith(object, '[0][1]', _.constant('a'), Object);
  31402. * // => { '0': { '1': 'a' } }
  31403. */
  31404. function updateWith(object, path, updater, customizer) {
  31405. customizer = typeof customizer == 'function' ? customizer : undefined;
  31406. return object == null ? object : baseUpdate(object, path, castFunction(updater), customizer);
  31407. }
  31408. /**
  31409. * Creates an array of the own enumerable string keyed property values of `object`.
  31410. *
  31411. * **Note:** Non-object values are coerced to objects.
  31412. *
  31413. * @static
  31414. * @since 0.1.0
  31415. * @memberOf _
  31416. * @category Object
  31417. * @param {Object} object The object to query.
  31418. * @returns {Array} Returns the array of property values.
  31419. * @example
  31420. *
  31421. * function Foo() {
  31422. * this.a = 1;
  31423. * this.b = 2;
  31424. * }
  31425. *
  31426. * Foo.prototype.c = 3;
  31427. *
  31428. * _.values(new Foo);
  31429. * // => [1, 2] (iteration order is not guaranteed)
  31430. *
  31431. * _.values('hi');
  31432. * // => ['h', 'i']
  31433. */
  31434. function values(object) {
  31435. return object == null ? [] : baseValues(object, keys(object));
  31436. }
  31437. /**
  31438. * Creates an array of the own and inherited enumerable string keyed property
  31439. * values of `object`.
  31440. *
  31441. * **Note:** Non-object values are coerced to objects.
  31442. *
  31443. * @static
  31444. * @memberOf _
  31445. * @since 3.0.0
  31446. * @category Object
  31447. * @param {Object} object The object to query.
  31448. * @returns {Array} Returns the array of property values.
  31449. * @example
  31450. *
  31451. * function Foo() {
  31452. * this.a = 1;
  31453. * this.b = 2;
  31454. * }
  31455. *
  31456. * Foo.prototype.c = 3;
  31457. *
  31458. * _.valuesIn(new Foo);
  31459. * // => [1, 2, 3] (iteration order is not guaranteed)
  31460. */
  31461. function valuesIn(object) {
  31462. return object == null ? [] : baseValues(object, keysIn(object));
  31463. }
  31464. /*------------------------------------------------------------------------*/
  31465. /**
  31466. * Clamps `number` within the inclusive `lower` and `upper` bounds.
  31467. *
  31468. * @static
  31469. * @memberOf _
  31470. * @since 4.0.0
  31471. * @category Number
  31472. * @param {number} number The number to clamp.
  31473. * @param {number} [lower] The lower bound.
  31474. * @param {number} upper The upper bound.
  31475. * @returns {number} Returns the clamped number.
  31476. * @example
  31477. *
  31478. * _.clamp(-10, -5, 5);
  31479. * // => -5
  31480. *
  31481. * _.clamp(10, -5, 5);
  31482. * // => 5
  31483. */
  31484. function clamp(number, lower, upper) {
  31485. if (upper === undefined) {
  31486. upper = lower;
  31487. lower = undefined;
  31488. }
  31489. if (upper !== undefined) {
  31490. upper = toNumber(upper);
  31491. upper = upper === upper ? upper : 0;
  31492. }
  31493. if (lower !== undefined) {
  31494. lower = toNumber(lower);
  31495. lower = lower === lower ? lower : 0;
  31496. }
  31497. return baseClamp(toNumber(number), lower, upper);
  31498. }
  31499. /**
  31500. * Checks if `n` is between `start` and up to, but not including, `end`. If
  31501. * `end` is not specified, it's set to `start` with `start` then set to `0`.
  31502. * If `start` is greater than `end` the params are swapped to support
  31503. * negative ranges.
  31504. *
  31505. * @static
  31506. * @memberOf _
  31507. * @since 3.3.0
  31508. * @category Number
  31509. * @param {number} number The number to check.
  31510. * @param {number} [start=0] The start of the range.
  31511. * @param {number} end The end of the range.
  31512. * @returns {boolean} Returns `true` if `number` is in the range, else `false`.
  31513. * @see _.range, _.rangeRight
  31514. * @example
  31515. *
  31516. * _.inRange(3, 2, 4);
  31517. * // => true
  31518. *
  31519. * _.inRange(4, 8);
  31520. * // => true
  31521. *
  31522. * _.inRange(4, 2);
  31523. * // => false
  31524. *
  31525. * _.inRange(2, 2);
  31526. * // => false
  31527. *
  31528. * _.inRange(1.2, 2);
  31529. * // => true
  31530. *
  31531. * _.inRange(5.2, 4);
  31532. * // => false
  31533. *
  31534. * _.inRange(-3, -2, -6);
  31535. * // => true
  31536. */
  31537. function inRange(number, start, end) {
  31538. start = toFinite(start);
  31539. if (end === undefined) {
  31540. end = start;
  31541. start = 0;
  31542. } else {
  31543. end = toFinite(end);
  31544. }
  31545. number = toNumber(number);
  31546. return baseInRange(number, start, end);
  31547. }
  31548. /**
  31549. * Produces a random number between the inclusive `lower` and `upper` bounds.
  31550. * If only one argument is provided a number between `0` and the given number
  31551. * is returned. If `floating` is `true`, or either `lower` or `upper` are
  31552. * floats, a floating-point number is returned instead of an integer.
  31553. *
  31554. * **Note:** JavaScript follows the IEEE-754 standard for resolving
  31555. * floating-point values which can produce unexpected results.
  31556. *
  31557. * @static
  31558. * @memberOf _
  31559. * @since 0.7.0
  31560. * @category Number
  31561. * @param {number} [lower=0] The lower bound.
  31562. * @param {number} [upper=1] The upper bound.
  31563. * @param {boolean} [floating] Specify returning a floating-point number.
  31564. * @returns {number} Returns the random number.
  31565. * @example
  31566. *
  31567. * _.random(0, 5);
  31568. * // => an integer between 0 and 5
  31569. *
  31570. * _.random(5);
  31571. * // => also an integer between 0 and 5
  31572. *
  31573. * _.random(5, true);
  31574. * // => a floating-point number between 0 and 5
  31575. *
  31576. * _.random(1.2, 5.2);
  31577. * // => a floating-point number between 1.2 and 5.2
  31578. */
  31579. function random(lower, upper, floating) {
  31580. if (floating && typeof floating != 'boolean' && isIterateeCall(lower, upper, floating)) {
  31581. upper = floating = undefined;
  31582. }
  31583. if (floating === undefined) {
  31584. if (typeof upper == 'boolean') {
  31585. floating = upper;
  31586. upper = undefined;
  31587. }
  31588. else if (typeof lower == 'boolean') {
  31589. floating = lower;
  31590. lower = undefined;
  31591. }
  31592. }
  31593. if (lower === undefined && upper === undefined) {
  31594. lower = 0;
  31595. upper = 1;
  31596. }
  31597. else {
  31598. lower = toFinite(lower);
  31599. if (upper === undefined) {
  31600. upper = lower;
  31601. lower = 0;
  31602. } else {
  31603. upper = toFinite(upper);
  31604. }
  31605. }
  31606. if (lower > upper) {
  31607. var temp = lower;
  31608. lower = upper;
  31609. upper = temp;
  31610. }
  31611. if (floating || lower % 1 || upper % 1) {
  31612. var rand = nativeRandom();
  31613. return nativeMin(lower + (rand * (upper - lower + freeParseFloat('1e-' + ((rand + '').length - 1)))), upper);
  31614. }
  31615. return baseRandom(lower, upper);
  31616. }
  31617. /*------------------------------------------------------------------------*/
  31618. /**
  31619. * Converts `string` to [camel case](https://en.wikipedia.org/wiki/CamelCase).
  31620. *
  31621. * @static
  31622. * @memberOf _
  31623. * @since 3.0.0
  31624. * @category String
  31625. * @param {string} [string=''] The string to convert.
  31626. * @returns {string} Returns the camel cased string.
  31627. * @example
  31628. *
  31629. * _.camelCase('Foo Bar');
  31630. * // => 'fooBar'
  31631. *
  31632. * _.camelCase('--foo-bar--');
  31633. * // => 'fooBar'
  31634. *
  31635. * _.camelCase('__FOO_BAR__');
  31636. * // => 'fooBar'
  31637. */
  31638. var camelCase = createCompounder(function(result, word, index) {
  31639. word = word.toLowerCase();
  31640. return result + (index ? capitalize(word) : word);
  31641. });
  31642. /**
  31643. * Converts the first character of `string` to upper case and the remaining
  31644. * to lower case.
  31645. *
  31646. * @static
  31647. * @memberOf _
  31648. * @since 3.0.0
  31649. * @category String
  31650. * @param {string} [string=''] The string to capitalize.
  31651. * @returns {string} Returns the capitalized string.
  31652. * @example
  31653. *
  31654. * _.capitalize('FRED');
  31655. * // => 'Fred'
  31656. */
  31657. function capitalize(string) {
  31658. return upperFirst(toString(string).toLowerCase());
  31659. }
  31660. /**
  31661. * Deburrs `string` by converting
  31662. * [Latin-1 Supplement](https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)#Character_table)
  31663. * and [Latin Extended-A](https://en.wikipedia.org/wiki/Latin_Extended-A)
  31664. * letters to basic Latin letters and removing
  31665. * [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks).
  31666. *
  31667. * @static
  31668. * @memberOf _
  31669. * @since 3.0.0
  31670. * @category String
  31671. * @param {string} [string=''] The string to deburr.
  31672. * @returns {string} Returns the deburred string.
  31673. * @example
  31674. *
  31675. * _.deburr('déjà vu');
  31676. * // => 'deja vu'
  31677. */
  31678. function deburr(string) {
  31679. string = toString(string);
  31680. return string && string.replace(reLatin, deburrLetter).replace(reComboMark, '');
  31681. }
  31682. /**
  31683. * Checks if `string` ends with the given target string.
  31684. *
  31685. * @static
  31686. * @memberOf _
  31687. * @since 3.0.0
  31688. * @category String
  31689. * @param {string} [string=''] The string to inspect.
  31690. * @param {string} [target] The string to search for.
  31691. * @param {number} [position=string.length] The position to search up to.
  31692. * @returns {boolean} Returns `true` if `string` ends with `target`,
  31693. * else `false`.
  31694. * @example
  31695. *
  31696. * _.endsWith('abc', 'c');
  31697. * // => true
  31698. *
  31699. * _.endsWith('abc', 'b');
  31700. * // => false
  31701. *
  31702. * _.endsWith('abc', 'b', 2);
  31703. * // => true
  31704. */
  31705. function endsWith(string, target, position) {
  31706. string = toString(string);
  31707. target = baseToString(target);
  31708. var length = string.length;
  31709. position = position === undefined
  31710. ? length
  31711. : baseClamp(toInteger(position), 0, length);
  31712. var end = position;
  31713. position -= target.length;
  31714. return position >= 0 && string.slice(position, end) == target;
  31715. }
  31716. /**
  31717. * Converts the characters "&", "<", ">", '"', and "'" in `string` to their
  31718. * corresponding HTML entities.
  31719. *
  31720. * **Note:** No other characters are escaped. To escape additional
  31721. * characters use a third-party library like [_he_](https://mths.be/he).
  31722. *
  31723. * Though the ">" character is escaped for symmetry, characters like
  31724. * ">" and "/" don't need escaping in HTML and have no special meaning
  31725. * unless they're part of a tag or unquoted attribute value. See
  31726. * [Mathias Bynens's article](https://mathiasbynens.be/notes/ambiguous-ampersands)
  31727. * (under "semi-related fun fact") for more details.
  31728. *
  31729. * When working with HTML you should always
  31730. * [quote attribute values](http://wonko.com/post/html-escaping) to reduce
  31731. * XSS vectors.
  31732. *
  31733. * @static
  31734. * @since 0.1.0
  31735. * @memberOf _
  31736. * @category String
  31737. * @param {string} [string=''] The string to escape.
  31738. * @returns {string} Returns the escaped string.
  31739. * @example
  31740. *
  31741. * _.escape('fred, barney, & pebbles');
  31742. * // => 'fred, barney, &amp; pebbles'
  31743. */
  31744. function escape(string) {
  31745. string = toString(string);
  31746. return (string && reHasUnescapedHtml.test(string))
  31747. ? string.replace(reUnescapedHtml, escapeHtmlChar)
  31748. : string;
  31749. }
  31750. /**
  31751. * Escapes the `RegExp` special characters "^", "$", "\", ".", "*", "+",
  31752. * "?", "(", ")", "[", "]", "{", "}", and "|" in `string`.
  31753. *
  31754. * @static
  31755. * @memberOf _
  31756. * @since 3.0.0
  31757. * @category String
  31758. * @param {string} [string=''] The string to escape.
  31759. * @returns {string} Returns the escaped string.
  31760. * @example
  31761. *
  31762. * _.escapeRegExp('[lodash](https://lodash.com/)');
  31763. * // => '\[lodash\]\(https://lodash\.com/\)'
  31764. */
  31765. function escapeRegExp(string) {
  31766. string = toString(string);
  31767. return (string && reHasRegExpChar.test(string))
  31768. ? string.replace(reRegExpChar, '\\$&')
  31769. : string;
  31770. }
  31771. /**
  31772. * Converts `string` to
  31773. * [kebab case](https://en.wikipedia.org/wiki/Letter_case#Special_case_styles).
  31774. *
  31775. * @static
  31776. * @memberOf _
  31777. * @since 3.0.0
  31778. * @category String
  31779. * @param {string} [string=''] The string to convert.
  31780. * @returns {string} Returns the kebab cased string.
  31781. * @example
  31782. *
  31783. * _.kebabCase('Foo Bar');
  31784. * // => 'foo-bar'
  31785. *
  31786. * _.kebabCase('fooBar');
  31787. * // => 'foo-bar'
  31788. *
  31789. * _.kebabCase('__FOO_BAR__');
  31790. * // => 'foo-bar'
  31791. */
  31792. var kebabCase = createCompounder(function(result, word, index) {
  31793. return result + (index ? '-' : '') + word.toLowerCase();
  31794. });
  31795. /**
  31796. * Converts `string`, as space separated words, to lower case.
  31797. *
  31798. * @static
  31799. * @memberOf _
  31800. * @since 4.0.0
  31801. * @category String
  31802. * @param {string} [string=''] The string to convert.
  31803. * @returns {string} Returns the lower cased string.
  31804. * @example
  31805. *
  31806. * _.lowerCase('--Foo-Bar--');
  31807. * // => 'foo bar'
  31808. *
  31809. * _.lowerCase('fooBar');
  31810. * // => 'foo bar'
  31811. *
  31812. * _.lowerCase('__FOO_BAR__');
  31813. * // => 'foo bar'
  31814. */
  31815. var lowerCase = createCompounder(function(result, word, index) {
  31816. return result + (index ? ' ' : '') + word.toLowerCase();
  31817. });
  31818. /**
  31819. * Converts the first character of `string` to lower case.
  31820. *
  31821. * @static
  31822. * @memberOf _
  31823. * @since 4.0.0
  31824. * @category String
  31825. * @param {string} [string=''] The string to convert.
  31826. * @returns {string} Returns the converted string.
  31827. * @example
  31828. *
  31829. * _.lowerFirst('Fred');
  31830. * // => 'fred'
  31831. *
  31832. * _.lowerFirst('FRED');
  31833. * // => 'fRED'
  31834. */
  31835. var lowerFirst = createCaseFirst('toLowerCase');
  31836. /**
  31837. * Pads `string` on the left and right sides if it's shorter than `length`.
  31838. * Padding characters are truncated if they can't be evenly divided by `length`.
  31839. *
  31840. * @static
  31841. * @memberOf _
  31842. * @since 3.0.0
  31843. * @category String
  31844. * @param {string} [string=''] The string to pad.
  31845. * @param {number} [length=0] The padding length.
  31846. * @param {string} [chars=' '] The string used as padding.
  31847. * @returns {string} Returns the padded string.
  31848. * @example
  31849. *
  31850. * _.pad('abc', 8);
  31851. * // => ' abc '
  31852. *
  31853. * _.pad('abc', 8, '_-');
  31854. * // => '_-abc_-_'
  31855. *
  31856. * _.pad('abc', 3);
  31857. * // => 'abc'
  31858. */
  31859. function pad(string, length, chars) {
  31860. string = toString(string);
  31861. length = toInteger(length);
  31862. var strLength = length ? stringSize(string) : 0;
  31863. if (!length || strLength >= length) {
  31864. return string;
  31865. }
  31866. var mid = (length - strLength) / 2;
  31867. return (
  31868. createPadding(nativeFloor(mid), chars) +
  31869. string +
  31870. createPadding(nativeCeil(mid), chars)
  31871. );
  31872. }
  31873. /**
  31874. * Pads `string` on the right side if it's shorter than `length`. Padding
  31875. * characters are truncated if they exceed `length`.
  31876. *
  31877. * @static
  31878. * @memberOf _
  31879. * @since 4.0.0
  31880. * @category String
  31881. * @param {string} [string=''] The string to pad.
  31882. * @param {number} [length=0] The padding length.
  31883. * @param {string} [chars=' '] The string used as padding.
  31884. * @returns {string} Returns the padded string.
  31885. * @example
  31886. *
  31887. * _.padEnd('abc', 6);
  31888. * // => 'abc '
  31889. *
  31890. * _.padEnd('abc', 6, '_-');
  31891. * // => 'abc_-_'
  31892. *
  31893. * _.padEnd('abc', 3);
  31894. * // => 'abc'
  31895. */
  31896. function padEnd(string, length, chars) {
  31897. string = toString(string);
  31898. length = toInteger(length);
  31899. var strLength = length ? stringSize(string) : 0;
  31900. return (length && strLength < length)
  31901. ? (string + createPadding(length - strLength, chars))
  31902. : string;
  31903. }
  31904. /**
  31905. * Pads `string` on the left side if it's shorter than `length`. Padding
  31906. * characters are truncated if they exceed `length`.
  31907. *
  31908. * @static
  31909. * @memberOf _
  31910. * @since 4.0.0
  31911. * @category String
  31912. * @param {string} [string=''] The string to pad.
  31913. * @param {number} [length=0] The padding length.
  31914. * @param {string} [chars=' '] The string used as padding.
  31915. * @returns {string} Returns the padded string.
  31916. * @example
  31917. *
  31918. * _.padStart('abc', 6);
  31919. * // => ' abc'
  31920. *
  31921. * _.padStart('abc', 6, '_-');
  31922. * // => '_-_abc'
  31923. *
  31924. * _.padStart('abc', 3);
  31925. * // => 'abc'
  31926. */
  31927. function padStart(string, length, chars) {
  31928. string = toString(string);
  31929. length = toInteger(length);
  31930. var strLength = length ? stringSize(string) : 0;
  31931. return (length && strLength < length)
  31932. ? (createPadding(length - strLength, chars) + string)
  31933. : string;
  31934. }
  31935. /**
  31936. * Converts `string` to an integer of the specified radix. If `radix` is
  31937. * `undefined` or `0`, a `radix` of `10` is used unless `value` is a
  31938. * hexadecimal, in which case a `radix` of `16` is used.
  31939. *
  31940. * **Note:** This method aligns with the
  31941. * [ES5 implementation](https://es5.github.io/#x15.1.2.2) of `parseInt`.
  31942. *
  31943. * @static
  31944. * @memberOf _
  31945. * @since 1.1.0
  31946. * @category String
  31947. * @param {string} string The string to convert.
  31948. * @param {number} [radix=10] The radix to interpret `value` by.
  31949. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  31950. * @returns {number} Returns the converted integer.
  31951. * @example
  31952. *
  31953. * _.parseInt('08');
  31954. * // => 8
  31955. *
  31956. * _.map(['6', '08', '10'], _.parseInt);
  31957. * // => [6, 8, 10]
  31958. */
  31959. function parseInt(string, radix, guard) {
  31960. if (guard || radix == null) {
  31961. radix = 0;
  31962. } else if (radix) {
  31963. radix = +radix;
  31964. }
  31965. return nativeParseInt(toString(string).replace(reTrimStart, ''), radix || 0);
  31966. }
  31967. /**
  31968. * Repeats the given string `n` times.
  31969. *
  31970. * @static
  31971. * @memberOf _
  31972. * @since 3.0.0
  31973. * @category String
  31974. * @param {string} [string=''] The string to repeat.
  31975. * @param {number} [n=1] The number of times to repeat the string.
  31976. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  31977. * @returns {string} Returns the repeated string.
  31978. * @example
  31979. *
  31980. * _.repeat('*', 3);
  31981. * // => '***'
  31982. *
  31983. * _.repeat('abc', 2);
  31984. * // => 'abcabc'
  31985. *
  31986. * _.repeat('abc', 0);
  31987. * // => ''
  31988. */
  31989. function repeat(string, n, guard) {
  31990. if ((guard ? isIterateeCall(string, n, guard) : n === undefined)) {
  31991. n = 1;
  31992. } else {
  31993. n = toInteger(n);
  31994. }
  31995. return baseRepeat(toString(string), n);
  31996. }
  31997. /**
  31998. * Replaces matches for `pattern` in `string` with `replacement`.
  31999. *
  32000. * **Note:** This method is based on
  32001. * [`String#replace`](https://mdn.io/String/replace).
  32002. *
  32003. * @static
  32004. * @memberOf _
  32005. * @since 4.0.0
  32006. * @category String
  32007. * @param {string} [string=''] The string to modify.
  32008. * @param {RegExp|string} pattern The pattern to replace.
  32009. * @param {Function|string} replacement The match replacement.
  32010. * @returns {string} Returns the modified string.
  32011. * @example
  32012. *
  32013. * _.replace('Hi Fred', 'Fred', 'Barney');
  32014. * // => 'Hi Barney'
  32015. */
  32016. function replace() {
  32017. var args = arguments,
  32018. string = toString(args[0]);
  32019. return args.length < 3 ? string : string.replace(args[1], args[2]);
  32020. }
  32021. /**
  32022. * Converts `string` to
  32023. * [snake case](https://en.wikipedia.org/wiki/Snake_case).
  32024. *
  32025. * @static
  32026. * @memberOf _
  32027. * @since 3.0.0
  32028. * @category String
  32029. * @param {string} [string=''] The string to convert.
  32030. * @returns {string} Returns the snake cased string.
  32031. * @example
  32032. *
  32033. * _.snakeCase('Foo Bar');
  32034. * // => 'foo_bar'
  32035. *
  32036. * _.snakeCase('fooBar');
  32037. * // => 'foo_bar'
  32038. *
  32039. * _.snakeCase('--FOO-BAR--');
  32040. * // => 'foo_bar'
  32041. */
  32042. var snakeCase = createCompounder(function(result, word, index) {
  32043. return result + (index ? '_' : '') + word.toLowerCase();
  32044. });
  32045. /**
  32046. * Splits `string` by `separator`.
  32047. *
  32048. * **Note:** This method is based on
  32049. * [`String#split`](https://mdn.io/String/split).
  32050. *
  32051. * @static
  32052. * @memberOf _
  32053. * @since 4.0.0
  32054. * @category String
  32055. * @param {string} [string=''] The string to split.
  32056. * @param {RegExp|string} separator The separator pattern to split by.
  32057. * @param {number} [limit] The length to truncate results to.
  32058. * @returns {Array} Returns the string segments.
  32059. * @example
  32060. *
  32061. * _.split('a-b-c', '-', 2);
  32062. * // => ['a', 'b']
  32063. */
  32064. function split(string, separator, limit) {
  32065. if (limit && typeof limit != 'number' && isIterateeCall(string, separator, limit)) {
  32066. separator = limit = undefined;
  32067. }
  32068. limit = limit === undefined ? MAX_ARRAY_LENGTH : limit >>> 0;
  32069. if (!limit) {
  32070. return [];
  32071. }
  32072. string = toString(string);
  32073. if (string && (
  32074. typeof separator == 'string' ||
  32075. (separator != null && !isRegExp(separator))
  32076. )) {
  32077. separator = baseToString(separator);
  32078. if (!separator && hasUnicode(string)) {
  32079. return castSlice(stringToArray(string), 0, limit);
  32080. }
  32081. }
  32082. return string.split(separator, limit);
  32083. }
  32084. /**
  32085. * Converts `string` to
  32086. * [start case](https://en.wikipedia.org/wiki/Letter_case#Stylistic_or_specialised_usage).
  32087. *
  32088. * @static
  32089. * @memberOf _
  32090. * @since 3.1.0
  32091. * @category String
  32092. * @param {string} [string=''] The string to convert.
  32093. * @returns {string} Returns the start cased string.
  32094. * @example
  32095. *
  32096. * _.startCase('--foo-bar--');
  32097. * // => 'Foo Bar'
  32098. *
  32099. * _.startCase('fooBar');
  32100. * // => 'Foo Bar'
  32101. *
  32102. * _.startCase('__FOO_BAR__');
  32103. * // => 'FOO BAR'
  32104. */
  32105. var startCase = createCompounder(function(result, word, index) {
  32106. return result + (index ? ' ' : '') + upperFirst(word);
  32107. });
  32108. /**
  32109. * Checks if `string` starts with the given target string.
  32110. *
  32111. * @static
  32112. * @memberOf _
  32113. * @since 3.0.0
  32114. * @category String
  32115. * @param {string} [string=''] The string to inspect.
  32116. * @param {string} [target] The string to search for.
  32117. * @param {number} [position=0] The position to search from.
  32118. * @returns {boolean} Returns `true` if `string` starts with `target`,
  32119. * else `false`.
  32120. * @example
  32121. *
  32122. * _.startsWith('abc', 'a');
  32123. * // => true
  32124. *
  32125. * _.startsWith('abc', 'b');
  32126. * // => false
  32127. *
  32128. * _.startsWith('abc', 'b', 1);
  32129. * // => true
  32130. */
  32131. function startsWith(string, target, position) {
  32132. string = toString(string);
  32133. position = position == null
  32134. ? 0
  32135. : baseClamp(toInteger(position), 0, string.length);
  32136. target = baseToString(target);
  32137. return string.slice(position, position + target.length) == target;
  32138. }
  32139. /**
  32140. * Creates a compiled template function that can interpolate data properties
  32141. * in "interpolate" delimiters, HTML-escape interpolated data properties in
  32142. * "escape" delimiters, and execute JavaScript in "evaluate" delimiters. Data
  32143. * properties may be accessed as free variables in the template. If a setting
  32144. * object is given, it takes precedence over `_.templateSettings` values.
  32145. *
  32146. * **Note:** In the development build `_.template` utilizes
  32147. * [sourceURLs](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl)
  32148. * for easier debugging.
  32149. *
  32150. * For more information on precompiling templates see
  32151. * [lodash's custom builds documentation](https://lodash.com/custom-builds).
  32152. *
  32153. * For more information on Chrome extension sandboxes see
  32154. * [Chrome's extensions documentation](https://developer.chrome.com/extensions/sandboxingEval).
  32155. *
  32156. * @static
  32157. * @since 0.1.0
  32158. * @memberOf _
  32159. * @category String
  32160. * @param {string} [string=''] The template string.
  32161. * @param {Object} [options={}] The options object.
  32162. * @param {RegExp} [options.escape=_.templateSettings.escape]
  32163. * The HTML "escape" delimiter.
  32164. * @param {RegExp} [options.evaluate=_.templateSettings.evaluate]
  32165. * The "evaluate" delimiter.
  32166. * @param {Object} [options.imports=_.templateSettings.imports]
  32167. * An object to import into the template as free variables.
  32168. * @param {RegExp} [options.interpolate=_.templateSettings.interpolate]
  32169. * The "interpolate" delimiter.
  32170. * @param {string} [options.sourceURL='lodash.templateSources[n]']
  32171. * The sourceURL of the compiled template.
  32172. * @param {string} [options.variable='obj']
  32173. * The data object variable name.
  32174. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  32175. * @returns {Function} Returns the compiled template function.
  32176. * @example
  32177. *
  32178. * // Use the "interpolate" delimiter to create a compiled template.
  32179. * var compiled = _.template('hello <%= user %>!');
  32180. * compiled({ 'user': 'fred' });
  32181. * // => 'hello fred!'
  32182. *
  32183. * // Use the HTML "escape" delimiter to escape data property values.
  32184. * var compiled = _.template('<b><%- value %></b>');
  32185. * compiled({ 'value': '<script>' });
  32186. * // => '<b>&lt;script&gt;</b>'
  32187. *
  32188. * // Use the "evaluate" delimiter to execute JavaScript and generate HTML.
  32189. * var compiled = _.template('<% _.forEach(users, function(user) { %><li><%- user %></li><% }); %>');
  32190. * compiled({ 'users': ['fred', 'barney'] });
  32191. * // => '<li>fred</li><li>barney</li>'
  32192. *
  32193. * // Use the internal `print` function in "evaluate" delimiters.
  32194. * var compiled = _.template('<% print("hello " + user); %>!');
  32195. * compiled({ 'user': 'barney' });
  32196. * // => 'hello barney!'
  32197. *
  32198. * // Use the ES template literal delimiter as an "interpolate" delimiter.
  32199. * // Disable support by replacing the "interpolate" delimiter.
  32200. * var compiled = _.template('hello ${ user }!');
  32201. * compiled({ 'user': 'pebbles' });
  32202. * // => 'hello pebbles!'
  32203. *
  32204. * // Use backslashes to treat delimiters as plain text.
  32205. * var compiled = _.template('<%= "\\<%- value %\\>" %>');
  32206. * compiled({ 'value': 'ignored' });
  32207. * // => '<%- value %>'
  32208. *
  32209. * // Use the `imports` option to import `jQuery` as `jq`.
  32210. * var text = '<% jq.each(users, function(user) { %><li><%- user %></li><% }); %>';
  32211. * var compiled = _.template(text, { 'imports': { 'jq': jQuery } });
  32212. * compiled({ 'users': ['fred', 'barney'] });
  32213. * // => '<li>fred</li><li>barney</li>'
  32214. *
  32215. * // Use the `sourceURL` option to specify a custom sourceURL for the template.
  32216. * var compiled = _.template('hello <%= user %>!', { 'sourceURL': '/basic/greeting.jst' });
  32217. * compiled(data);
  32218. * // => Find the source of "greeting.jst" under the Sources tab or Resources panel of the web inspector.
  32219. *
  32220. * // Use the `variable` option to ensure a with-statement isn't used in the compiled template.
  32221. * var compiled = _.template('hi <%= data.user %>!', { 'variable': 'data' });
  32222. * compiled.source;
  32223. * // => function(data) {
  32224. * // var __t, __p = '';
  32225. * // __p += 'hi ' + ((__t = ( data.user )) == null ? '' : __t) + '!';
  32226. * // return __p;
  32227. * // }
  32228. *
  32229. * // Use custom template delimiters.
  32230. * _.templateSettings.interpolate = /{{([\s\S]+?)}}/g;
  32231. * var compiled = _.template('hello {{ user }}!');
  32232. * compiled({ 'user': 'mustache' });
  32233. * // => 'hello mustache!'
  32234. *
  32235. * // Use the `source` property to inline compiled templates for meaningful
  32236. * // line numbers in error messages and stack traces.
  32237. * fs.writeFileSync(path.join(process.cwd(), 'jst.js'), '\
  32238. * var JST = {\
  32239. * "main": ' + _.template(mainText).source + '\
  32240. * };\
  32241. * ');
  32242. */
  32243. function template(string, options, guard) {
  32244. // Based on John Resig's `tmpl` implementation
  32245. // (http://ejohn.org/blog/javascript-micro-templating/)
  32246. // and Laura Doktorova's doT.js (https://github.com/olado/doT).
  32247. var settings = lodash.templateSettings;
  32248. if (guard && isIterateeCall(string, options, guard)) {
  32249. options = undefined;
  32250. }
  32251. string = toString(string);
  32252. options = assignInWith({}, options, settings, customDefaultsAssignIn);
  32253. var imports = assignInWith({}, options.imports, settings.imports, customDefaultsAssignIn),
  32254. importsKeys = keys(imports),
  32255. importsValues = baseValues(imports, importsKeys);
  32256. var isEscaping,
  32257. isEvaluating,
  32258. index = 0,
  32259. interpolate = options.interpolate || reNoMatch,
  32260. source = "__p += '";
  32261. // Compile the regexp to match each delimiter.
  32262. var reDelimiters = RegExp(
  32263. (options.escape || reNoMatch).source + '|' +
  32264. interpolate.source + '|' +
  32265. (interpolate === reInterpolate ? reEsTemplate : reNoMatch).source + '|' +
  32266. (options.evaluate || reNoMatch).source + '|$'
  32267. , 'g');
  32268. // Use a sourceURL for easier debugging.
  32269. // The sourceURL gets injected into the source that's eval-ed, so be careful
  32270. // with lookup (in case of e.g. prototype pollution), and strip newlines if any.
  32271. // A newline wouldn't be a valid sourceURL anyway, and it'd enable code injection.
  32272. var sourceURL = '//# sourceURL=' +
  32273. (hasOwnProperty.call(options, 'sourceURL')
  32274. ? (options.sourceURL + '').replace(/[\r\n]/g, ' ')
  32275. : ('lodash.templateSources[' + (++templateCounter) + ']')
  32276. ) + '\n';
  32277. string.replace(reDelimiters, function(match, escapeValue, interpolateValue, esTemplateValue, evaluateValue, offset) {
  32278. interpolateValue || (interpolateValue = esTemplateValue);
  32279. // Escape characters that can't be included in string literals.
  32280. source += string.slice(index, offset).replace(reUnescapedString, escapeStringChar);
  32281. // Replace delimiters with snippets.
  32282. if (escapeValue) {
  32283. isEscaping = true;
  32284. source += "' +\n__e(" + escapeValue + ") +\n'";
  32285. }
  32286. if (evaluateValue) {
  32287. isEvaluating = true;
  32288. source += "';\n" + evaluateValue + ";\n__p += '";
  32289. }
  32290. if (interpolateValue) {
  32291. source += "' +\n((__t = (" + interpolateValue + ")) == null ? '' : __t) +\n'";
  32292. }
  32293. index = offset + match.length;
  32294. // The JS engine embedded in Adobe products needs `match` returned in
  32295. // order to produce the correct `offset` value.
  32296. return match;
  32297. });
  32298. source += "';\n";
  32299. // If `variable` is not specified wrap a with-statement around the generated
  32300. // code to add the data object to the top of the scope chain.
  32301. // Like with sourceURL, we take care to not check the option's prototype,
  32302. // as this configuration is a code injection vector.
  32303. var variable = hasOwnProperty.call(options, 'variable') && options.variable;
  32304. if (!variable) {
  32305. source = 'with (obj) {\n' + source + '\n}\n';
  32306. }
  32307. // Cleanup code by stripping empty strings.
  32308. source = (isEvaluating ? source.replace(reEmptyStringLeading, '') : source)
  32309. .replace(reEmptyStringMiddle, '$1')
  32310. .replace(reEmptyStringTrailing, '$1;');
  32311. // Frame code as the function body.
  32312. source = 'function(' + (variable || 'obj') + ') {\n' +
  32313. (variable
  32314. ? ''
  32315. : 'obj || (obj = {});\n'
  32316. ) +
  32317. "var __t, __p = ''" +
  32318. (isEscaping
  32319. ? ', __e = _.escape'
  32320. : ''
  32321. ) +
  32322. (isEvaluating
  32323. ? ', __j = Array.prototype.join;\n' +
  32324. "function print() { __p += __j.call(arguments, '') }\n"
  32325. : ';\n'
  32326. ) +
  32327. source +
  32328. 'return __p\n}';
  32329. var result = attempt(function() {
  32330. return Function(importsKeys, sourceURL + 'return ' + source)
  32331. .apply(undefined, importsValues);
  32332. });
  32333. // Provide the compiled function's source by its `toString` method or
  32334. // the `source` property as a convenience for inlining compiled templates.
  32335. result.source = source;
  32336. if (isError(result)) {
  32337. throw result;
  32338. }
  32339. return result;
  32340. }
  32341. /**
  32342. * Converts `string`, as a whole, to lower case just like
  32343. * [String#toLowerCase](https://mdn.io/toLowerCase).
  32344. *
  32345. * @static
  32346. * @memberOf _
  32347. * @since 4.0.0
  32348. * @category String
  32349. * @param {string} [string=''] The string to convert.
  32350. * @returns {string} Returns the lower cased string.
  32351. * @example
  32352. *
  32353. * _.toLower('--Foo-Bar--');
  32354. * // => '--foo-bar--'
  32355. *
  32356. * _.toLower('fooBar');
  32357. * // => 'foobar'
  32358. *
  32359. * _.toLower('__FOO_BAR__');
  32360. * // => '__foo_bar__'
  32361. */
  32362. function toLower(value) {
  32363. return toString(value).toLowerCase();
  32364. }
  32365. /**
  32366. * Converts `string`, as a whole, to upper case just like
  32367. * [String#toUpperCase](https://mdn.io/toUpperCase).
  32368. *
  32369. * @static
  32370. * @memberOf _
  32371. * @since 4.0.0
  32372. * @category String
  32373. * @param {string} [string=''] The string to convert.
  32374. * @returns {string} Returns the upper cased string.
  32375. * @example
  32376. *
  32377. * _.toUpper('--foo-bar--');
  32378. * // => '--FOO-BAR--'
  32379. *
  32380. * _.toUpper('fooBar');
  32381. * // => 'FOOBAR'
  32382. *
  32383. * _.toUpper('__foo_bar__');
  32384. * // => '__FOO_BAR__'
  32385. */
  32386. function toUpper(value) {
  32387. return toString(value).toUpperCase();
  32388. }
  32389. /**
  32390. * Removes leading and trailing whitespace or specified characters from `string`.
  32391. *
  32392. * @static
  32393. * @memberOf _
  32394. * @since 3.0.0
  32395. * @category String
  32396. * @param {string} [string=''] The string to trim.
  32397. * @param {string} [chars=whitespace] The characters to trim.
  32398. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  32399. * @returns {string} Returns the trimmed string.
  32400. * @example
  32401. *
  32402. * _.trim(' abc ');
  32403. * // => 'abc'
  32404. *
  32405. * _.trim('-_-abc-_-', '_-');
  32406. * // => 'abc'
  32407. *
  32408. * _.map([' foo ', ' bar '], _.trim);
  32409. * // => ['foo', 'bar']
  32410. */
  32411. function trim(string, chars, guard) {
  32412. string = toString(string);
  32413. if (string && (guard || chars === undefined)) {
  32414. return string.replace(reTrim, '');
  32415. }
  32416. if (!string || !(chars = baseToString(chars))) {
  32417. return string;
  32418. }
  32419. var strSymbols = stringToArray(string),
  32420. chrSymbols = stringToArray(chars),
  32421. start = charsStartIndex(strSymbols, chrSymbols),
  32422. end = charsEndIndex(strSymbols, chrSymbols) + 1;
  32423. return castSlice(strSymbols, start, end).join('');
  32424. }
  32425. /**
  32426. * Removes trailing whitespace or specified characters from `string`.
  32427. *
  32428. * @static
  32429. * @memberOf _
  32430. * @since 4.0.0
  32431. * @category String
  32432. * @param {string} [string=''] The string to trim.
  32433. * @param {string} [chars=whitespace] The characters to trim.
  32434. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  32435. * @returns {string} Returns the trimmed string.
  32436. * @example
  32437. *
  32438. * _.trimEnd(' abc ');
  32439. * // => ' abc'
  32440. *
  32441. * _.trimEnd('-_-abc-_-', '_-');
  32442. * // => '-_-abc'
  32443. */
  32444. function trimEnd(string, chars, guard) {
  32445. string = toString(string);
  32446. if (string && (guard || chars === undefined)) {
  32447. return string.replace(reTrimEnd, '');
  32448. }
  32449. if (!string || !(chars = baseToString(chars))) {
  32450. return string;
  32451. }
  32452. var strSymbols = stringToArray(string),
  32453. end = charsEndIndex(strSymbols, stringToArray(chars)) + 1;
  32454. return castSlice(strSymbols, 0, end).join('');
  32455. }
  32456. /**
  32457. * Removes leading whitespace or specified characters from `string`.
  32458. *
  32459. * @static
  32460. * @memberOf _
  32461. * @since 4.0.0
  32462. * @category String
  32463. * @param {string} [string=''] The string to trim.
  32464. * @param {string} [chars=whitespace] The characters to trim.
  32465. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  32466. * @returns {string} Returns the trimmed string.
  32467. * @example
  32468. *
  32469. * _.trimStart(' abc ');
  32470. * // => 'abc '
  32471. *
  32472. * _.trimStart('-_-abc-_-', '_-');
  32473. * // => 'abc-_-'
  32474. */
  32475. function trimStart(string, chars, guard) {
  32476. string = toString(string);
  32477. if (string && (guard || chars === undefined)) {
  32478. return string.replace(reTrimStart, '');
  32479. }
  32480. if (!string || !(chars = baseToString(chars))) {
  32481. return string;
  32482. }
  32483. var strSymbols = stringToArray(string),
  32484. start = charsStartIndex(strSymbols, stringToArray(chars));
  32485. return castSlice(strSymbols, start).join('');
  32486. }
  32487. /**
  32488. * Truncates `string` if it's longer than the given maximum string length.
  32489. * The last characters of the truncated string are replaced with the omission
  32490. * string which defaults to "...".
  32491. *
  32492. * @static
  32493. * @memberOf _
  32494. * @since 4.0.0
  32495. * @category String
  32496. * @param {string} [string=''] The string to truncate.
  32497. * @param {Object} [options={}] The options object.
  32498. * @param {number} [options.length=30] The maximum string length.
  32499. * @param {string} [options.omission='...'] The string to indicate text is omitted.
  32500. * @param {RegExp|string} [options.separator] The separator pattern to truncate to.
  32501. * @returns {string} Returns the truncated string.
  32502. * @example
  32503. *
  32504. * _.truncate('hi-diddly-ho there, neighborino');
  32505. * // => 'hi-diddly-ho there, neighbo...'
  32506. *
  32507. * _.truncate('hi-diddly-ho there, neighborino', {
  32508. * 'length': 24,
  32509. * 'separator': ' '
  32510. * });
  32511. * // => 'hi-diddly-ho there,...'
  32512. *
  32513. * _.truncate('hi-diddly-ho there, neighborino', {
  32514. * 'length': 24,
  32515. * 'separator': /,? +/
  32516. * });
  32517. * // => 'hi-diddly-ho there...'
  32518. *
  32519. * _.truncate('hi-diddly-ho there, neighborino', {
  32520. * 'omission': ' [...]'
  32521. * });
  32522. * // => 'hi-diddly-ho there, neig [...]'
  32523. */
  32524. function truncate(string, options) {
  32525. var length = DEFAULT_TRUNC_LENGTH,
  32526. omission = DEFAULT_TRUNC_OMISSION;
  32527. if (isObject(options)) {
  32528. var separator = 'separator' in options ? options.separator : separator;
  32529. length = 'length' in options ? toInteger(options.length) : length;
  32530. omission = 'omission' in options ? baseToString(options.omission) : omission;
  32531. }
  32532. string = toString(string);
  32533. var strLength = string.length;
  32534. if (hasUnicode(string)) {
  32535. var strSymbols = stringToArray(string);
  32536. strLength = strSymbols.length;
  32537. }
  32538. if (length >= strLength) {
  32539. return string;
  32540. }
  32541. var end = length - stringSize(omission);
  32542. if (end < 1) {
  32543. return omission;
  32544. }
  32545. var result = strSymbols
  32546. ? castSlice(strSymbols, 0, end).join('')
  32547. : string.slice(0, end);
  32548. if (separator === undefined) {
  32549. return result + omission;
  32550. }
  32551. if (strSymbols) {
  32552. end += (result.length - end);
  32553. }
  32554. if (isRegExp(separator)) {
  32555. if (string.slice(end).search(separator)) {
  32556. var match,
  32557. substring = result;
  32558. if (!separator.global) {
  32559. separator = RegExp(separator.source, toString(reFlags.exec(separator)) + 'g');
  32560. }
  32561. separator.lastIndex = 0;
  32562. while ((match = separator.exec(substring))) {
  32563. var newEnd = match.index;
  32564. }
  32565. result = result.slice(0, newEnd === undefined ? end : newEnd);
  32566. }
  32567. } else if (string.indexOf(baseToString(separator), end) != end) {
  32568. var index = result.lastIndexOf(separator);
  32569. if (index > -1) {
  32570. result = result.slice(0, index);
  32571. }
  32572. }
  32573. return result + omission;
  32574. }
  32575. /**
  32576. * The inverse of `_.escape`; this method converts the HTML entities
  32577. * `&amp;`, `&lt;`, `&gt;`, `&quot;`, and `&#39;` in `string` to
  32578. * their corresponding characters.
  32579. *
  32580. * **Note:** No other HTML entities are unescaped. To unescape additional
  32581. * HTML entities use a third-party library like [_he_](https://mths.be/he).
  32582. *
  32583. * @static
  32584. * @memberOf _
  32585. * @since 0.6.0
  32586. * @category String
  32587. * @param {string} [string=''] The string to unescape.
  32588. * @returns {string} Returns the unescaped string.
  32589. * @example
  32590. *
  32591. * _.unescape('fred, barney, &amp; pebbles');
  32592. * // => 'fred, barney, & pebbles'
  32593. */
  32594. function unescape(string) {
  32595. string = toString(string);
  32596. return (string && reHasEscapedHtml.test(string))
  32597. ? string.replace(reEscapedHtml, unescapeHtmlChar)
  32598. : string;
  32599. }
  32600. /**
  32601. * Converts `string`, as space separated words, to upper case.
  32602. *
  32603. * @static
  32604. * @memberOf _
  32605. * @since 4.0.0
  32606. * @category String
  32607. * @param {string} [string=''] The string to convert.
  32608. * @returns {string} Returns the upper cased string.
  32609. * @example
  32610. *
  32611. * _.upperCase('--foo-bar');
  32612. * // => 'FOO BAR'
  32613. *
  32614. * _.upperCase('fooBar');
  32615. * // => 'FOO BAR'
  32616. *
  32617. * _.upperCase('__foo_bar__');
  32618. * // => 'FOO BAR'
  32619. */
  32620. var upperCase = createCompounder(function(result, word, index) {
  32621. return result + (index ? ' ' : '') + word.toUpperCase();
  32622. });
  32623. /**
  32624. * Converts the first character of `string` to upper case.
  32625. *
  32626. * @static
  32627. * @memberOf _
  32628. * @since 4.0.0
  32629. * @category String
  32630. * @param {string} [string=''] The string to convert.
  32631. * @returns {string} Returns the converted string.
  32632. * @example
  32633. *
  32634. * _.upperFirst('fred');
  32635. * // => 'Fred'
  32636. *
  32637. * _.upperFirst('FRED');
  32638. * // => 'FRED'
  32639. */
  32640. var upperFirst = createCaseFirst('toUpperCase');
  32641. /**
  32642. * Splits `string` into an array of its words.
  32643. *
  32644. * @static
  32645. * @memberOf _
  32646. * @since 3.0.0
  32647. * @category String
  32648. * @param {string} [string=''] The string to inspect.
  32649. * @param {RegExp|string} [pattern] The pattern to match words.
  32650. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  32651. * @returns {Array} Returns the words of `string`.
  32652. * @example
  32653. *
  32654. * _.words('fred, barney, & pebbles');
  32655. * // => ['fred', 'barney', 'pebbles']
  32656. *
  32657. * _.words('fred, barney, & pebbles', /[^, ]+/g);
  32658. * // => ['fred', 'barney', '&', 'pebbles']
  32659. */
  32660. function words(string, pattern, guard) {
  32661. string = toString(string);
  32662. pattern = guard ? undefined : pattern;
  32663. if (pattern === undefined) {
  32664. return hasUnicodeWord(string) ? unicodeWords(string) : asciiWords(string);
  32665. }
  32666. return string.match(pattern) || [];
  32667. }
  32668. /*------------------------------------------------------------------------*/
  32669. /**
  32670. * Attempts to invoke `func`, returning either the result or the caught error
  32671. * object. Any additional arguments are provided to `func` when it's invoked.
  32672. *
  32673. * @static
  32674. * @memberOf _
  32675. * @since 3.0.0
  32676. * @category Util
  32677. * @param {Function} func The function to attempt.
  32678. * @param {...*} [args] The arguments to invoke `func` with.
  32679. * @returns {*} Returns the `func` result or error object.
  32680. * @example
  32681. *
  32682. * // Avoid throwing errors for invalid selectors.
  32683. * var elements = _.attempt(function(selector) {
  32684. * return document.querySelectorAll(selector);
  32685. * }, '>_>');
  32686. *
  32687. * if (_.isError(elements)) {
  32688. * elements = [];
  32689. * }
  32690. */
  32691. var attempt = baseRest(function(func, args) {
  32692. try {
  32693. return apply(func, undefined, args);
  32694. } catch (e) {
  32695. return isError(e) ? e : new Error(e);
  32696. }
  32697. });
  32698. /**
  32699. * Binds methods of an object to the object itself, overwriting the existing
  32700. * method.
  32701. *
  32702. * **Note:** This method doesn't set the "length" property of bound functions.
  32703. *
  32704. * @static
  32705. * @since 0.1.0
  32706. * @memberOf _
  32707. * @category Util
  32708. * @param {Object} object The object to bind and assign the bound methods to.
  32709. * @param {...(string|string[])} methodNames The object method names to bind.
  32710. * @returns {Object} Returns `object`.
  32711. * @example
  32712. *
  32713. * var view = {
  32714. * 'label': 'docs',
  32715. * 'click': function() {
  32716. * console.log('clicked ' + this.label);
  32717. * }
  32718. * };
  32719. *
  32720. * _.bindAll(view, ['click']);
  32721. * jQuery(element).on('click', view.click);
  32722. * // => Logs 'clicked docs' when clicked.
  32723. */
  32724. var bindAll = flatRest(function(object, methodNames) {
  32725. arrayEach(methodNames, function(key) {
  32726. key = toKey(key);
  32727. baseAssignValue(object, key, bind(object[key], object));
  32728. });
  32729. return object;
  32730. });
  32731. /**
  32732. * Creates a function that iterates over `pairs` and invokes the corresponding
  32733. * function of the first predicate to return truthy. The predicate-function
  32734. * pairs are invoked with the `this` binding and arguments of the created
  32735. * function.
  32736. *
  32737. * @static
  32738. * @memberOf _
  32739. * @since 4.0.0
  32740. * @category Util
  32741. * @param {Array} pairs The predicate-function pairs.
  32742. * @returns {Function} Returns the new composite function.
  32743. * @example
  32744. *
  32745. * var func = _.cond([
  32746. * [_.matches({ 'a': 1 }), _.constant('matches A')],
  32747. * [_.conforms({ 'b': _.isNumber }), _.constant('matches B')],
  32748. * [_.stubTrue, _.constant('no match')]
  32749. * ]);
  32750. *
  32751. * func({ 'a': 1, 'b': 2 });
  32752. * // => 'matches A'
  32753. *
  32754. * func({ 'a': 0, 'b': 1 });
  32755. * // => 'matches B'
  32756. *
  32757. * func({ 'a': '1', 'b': '2' });
  32758. * // => 'no match'
  32759. */
  32760. function cond(pairs) {
  32761. var length = pairs == null ? 0 : pairs.length,
  32762. toIteratee = getIteratee();
  32763. pairs = !length ? [] : arrayMap(pairs, function(pair) {
  32764. if (typeof pair[1] != 'function') {
  32765. throw new TypeError(FUNC_ERROR_TEXT);
  32766. }
  32767. return [toIteratee(pair[0]), pair[1]];
  32768. });
  32769. return baseRest(function(args) {
  32770. var index = -1;
  32771. while (++index < length) {
  32772. var pair = pairs[index];
  32773. if (apply(pair[0], this, args)) {
  32774. return apply(pair[1], this, args);
  32775. }
  32776. }
  32777. });
  32778. }
  32779. /**
  32780. * Creates a function that invokes the predicate properties of `source` with
  32781. * the corresponding property values of a given object, returning `true` if
  32782. * all predicates return truthy, else `false`.
  32783. *
  32784. * **Note:** The created function is equivalent to `_.conformsTo` with
  32785. * `source` partially applied.
  32786. *
  32787. * @static
  32788. * @memberOf _
  32789. * @since 4.0.0
  32790. * @category Util
  32791. * @param {Object} source The object of property predicates to conform to.
  32792. * @returns {Function} Returns the new spec function.
  32793. * @example
  32794. *
  32795. * var objects = [
  32796. * { 'a': 2, 'b': 1 },
  32797. * { 'a': 1, 'b': 2 }
  32798. * ];
  32799. *
  32800. * _.filter(objects, _.conforms({ 'b': function(n) { return n > 1; } }));
  32801. * // => [{ 'a': 1, 'b': 2 }]
  32802. */
  32803. function conforms(source) {
  32804. return baseConforms(baseClone(source, CLONE_DEEP_FLAG));
  32805. }
  32806. /**
  32807. * Creates a function that returns `value`.
  32808. *
  32809. * @static
  32810. * @memberOf _
  32811. * @since 2.4.0
  32812. * @category Util
  32813. * @param {*} value The value to return from the new function.
  32814. * @returns {Function} Returns the new constant function.
  32815. * @example
  32816. *
  32817. * var objects = _.times(2, _.constant({ 'a': 1 }));
  32818. *
  32819. * console.log(objects);
  32820. * // => [{ 'a': 1 }, { 'a': 1 }]
  32821. *
  32822. * console.log(objects[0] === objects[1]);
  32823. * // => true
  32824. */
  32825. function constant(value) {
  32826. return function() {
  32827. return value;
  32828. };
  32829. }
  32830. /**
  32831. * Checks `value` to determine whether a default value should be returned in
  32832. * its place. The `defaultValue` is returned if `value` is `NaN`, `null`,
  32833. * or `undefined`.
  32834. *
  32835. * @static
  32836. * @memberOf _
  32837. * @since 4.14.0
  32838. * @category Util
  32839. * @param {*} value The value to check.
  32840. * @param {*} defaultValue The default value.
  32841. * @returns {*} Returns the resolved value.
  32842. * @example
  32843. *
  32844. * _.defaultTo(1, 10);
  32845. * // => 1
  32846. *
  32847. * _.defaultTo(undefined, 10);
  32848. * // => 10
  32849. */
  32850. function defaultTo(value, defaultValue) {
  32851. return (value == null || value !== value) ? defaultValue : value;
  32852. }
  32853. /**
  32854. * Creates a function that returns the result of invoking the given functions
  32855. * with the `this` binding of the created function, where each successive
  32856. * invocation is supplied the return value of the previous.
  32857. *
  32858. * @static
  32859. * @memberOf _
  32860. * @since 3.0.0
  32861. * @category Util
  32862. * @param {...(Function|Function[])} [funcs] The functions to invoke.
  32863. * @returns {Function} Returns the new composite function.
  32864. * @see _.flowRight
  32865. * @example
  32866. *
  32867. * function square(n) {
  32868. * return n * n;
  32869. * }
  32870. *
  32871. * var addSquare = _.flow([_.add, square]);
  32872. * addSquare(1, 2);
  32873. * // => 9
  32874. */
  32875. var flow = createFlow();
  32876. /**
  32877. * This method is like `_.flow` except that it creates a function that
  32878. * invokes the given functions from right to left.
  32879. *
  32880. * @static
  32881. * @since 3.0.0
  32882. * @memberOf _
  32883. * @category Util
  32884. * @param {...(Function|Function[])} [funcs] The functions to invoke.
  32885. * @returns {Function} Returns the new composite function.
  32886. * @see _.flow
  32887. * @example
  32888. *
  32889. * function square(n) {
  32890. * return n * n;
  32891. * }
  32892. *
  32893. * var addSquare = _.flowRight([square, _.add]);
  32894. * addSquare(1, 2);
  32895. * // => 9
  32896. */
  32897. var flowRight = createFlow(true);
  32898. /**
  32899. * This method returns the first argument it receives.
  32900. *
  32901. * @static
  32902. * @since 0.1.0
  32903. * @memberOf _
  32904. * @category Util
  32905. * @param {*} value Any value.
  32906. * @returns {*} Returns `value`.
  32907. * @example
  32908. *
  32909. * var object = { 'a': 1 };
  32910. *
  32911. * console.log(_.identity(object) === object);
  32912. * // => true
  32913. */
  32914. function identity(value) {
  32915. return value;
  32916. }
  32917. /**
  32918. * Creates a function that invokes `func` with the arguments of the created
  32919. * function. If `func` is a property name, the created function returns the
  32920. * property value for a given element. If `func` is an array or object, the
  32921. * created function returns `true` for elements that contain the equivalent
  32922. * source properties, otherwise it returns `false`.
  32923. *
  32924. * @static
  32925. * @since 4.0.0
  32926. * @memberOf _
  32927. * @category Util
  32928. * @param {*} [func=_.identity] The value to convert to a callback.
  32929. * @returns {Function} Returns the callback.
  32930. * @example
  32931. *
  32932. * var users = [
  32933. * { 'user': 'barney', 'age': 36, 'active': true },
  32934. * { 'user': 'fred', 'age': 40, 'active': false }
  32935. * ];
  32936. *
  32937. * // The `_.matches` iteratee shorthand.
  32938. * _.filter(users, _.iteratee({ 'user': 'barney', 'active': true }));
  32939. * // => [{ 'user': 'barney', 'age': 36, 'active': true }]
  32940. *
  32941. * // The `_.matchesProperty` iteratee shorthand.
  32942. * _.filter(users, _.iteratee(['user', 'fred']));
  32943. * // => [{ 'user': 'fred', 'age': 40 }]
  32944. *
  32945. * // The `_.property` iteratee shorthand.
  32946. * _.map(users, _.iteratee('user'));
  32947. * // => ['barney', 'fred']
  32948. *
  32949. * // Create custom iteratee shorthands.
  32950. * _.iteratee = _.wrap(_.iteratee, function(iteratee, func) {
  32951. * return !_.isRegExp(func) ? iteratee(func) : function(string) {
  32952. * return func.test(string);
  32953. * };
  32954. * });
  32955. *
  32956. * _.filter(['abc', 'def'], /ef/);
  32957. * // => ['def']
  32958. */
  32959. function iteratee(func) {
  32960. return baseIteratee(typeof func == 'function' ? func : baseClone(func, CLONE_DEEP_FLAG));
  32961. }
  32962. /**
  32963. * Creates a function that performs a partial deep comparison between a given
  32964. * object and `source`, returning `true` if the given object has equivalent
  32965. * property values, else `false`.
  32966. *
  32967. * **Note:** The created function is equivalent to `_.isMatch` with `source`
  32968. * partially applied.
  32969. *
  32970. * Partial comparisons will match empty array and empty object `source`
  32971. * values against any array or object value, respectively. See `_.isEqual`
  32972. * for a list of supported value comparisons.
  32973. *
  32974. * @static
  32975. * @memberOf _
  32976. * @since 3.0.0
  32977. * @category Util
  32978. * @param {Object} source The object of property values to match.
  32979. * @returns {Function} Returns the new spec function.
  32980. * @example
  32981. *
  32982. * var objects = [
  32983. * { 'a': 1, 'b': 2, 'c': 3 },
  32984. * { 'a': 4, 'b': 5, 'c': 6 }
  32985. * ];
  32986. *
  32987. * _.filter(objects, _.matches({ 'a': 4, 'c': 6 }));
  32988. * // => [{ 'a': 4, 'b': 5, 'c': 6 }]
  32989. */
  32990. function matches(source) {
  32991. return baseMatches(baseClone(source, CLONE_DEEP_FLAG));
  32992. }
  32993. /**
  32994. * Creates a function that performs a partial deep comparison between the
  32995. * value at `path` of a given object to `srcValue`, returning `true` if the
  32996. * object value is equivalent, else `false`.
  32997. *
  32998. * **Note:** Partial comparisons will match empty array and empty object
  32999. * `srcValue` values against any array or object value, respectively. See
  33000. * `_.isEqual` for a list of supported value comparisons.
  33001. *
  33002. * @static
  33003. * @memberOf _
  33004. * @since 3.2.0
  33005. * @category Util
  33006. * @param {Array|string} path The path of the property to get.
  33007. * @param {*} srcValue The value to match.
  33008. * @returns {Function} Returns the new spec function.
  33009. * @example
  33010. *
  33011. * var objects = [
  33012. * { 'a': 1, 'b': 2, 'c': 3 },
  33013. * { 'a': 4, 'b': 5, 'c': 6 }
  33014. * ];
  33015. *
  33016. * _.find(objects, _.matchesProperty('a', 4));
  33017. * // => { 'a': 4, 'b': 5, 'c': 6 }
  33018. */
  33019. function matchesProperty(path, srcValue) {
  33020. return baseMatchesProperty(path, baseClone(srcValue, CLONE_DEEP_FLAG));
  33021. }
  33022. /**
  33023. * Creates a function that invokes the method at `path` of a given object.
  33024. * Any additional arguments are provided to the invoked method.
  33025. *
  33026. * @static
  33027. * @memberOf _
  33028. * @since 3.7.0
  33029. * @category Util
  33030. * @param {Array|string} path The path of the method to invoke.
  33031. * @param {...*} [args] The arguments to invoke the method with.
  33032. * @returns {Function} Returns the new invoker function.
  33033. * @example
  33034. *
  33035. * var objects = [
  33036. * { 'a': { 'b': _.constant(2) } },
  33037. * { 'a': { 'b': _.constant(1) } }
  33038. * ];
  33039. *
  33040. * _.map(objects, _.method('a.b'));
  33041. * // => [2, 1]
  33042. *
  33043. * _.map(objects, _.method(['a', 'b']));
  33044. * // => [2, 1]
  33045. */
  33046. var method = baseRest(function(path, args) {
  33047. return function(object) {
  33048. return baseInvoke(object, path, args);
  33049. };
  33050. });
  33051. /**
  33052. * The opposite of `_.method`; this method creates a function that invokes
  33053. * the method at a given path of `object`. Any additional arguments are
  33054. * provided to the invoked method.
  33055. *
  33056. * @static
  33057. * @memberOf _
  33058. * @since 3.7.0
  33059. * @category Util
  33060. * @param {Object} object The object to query.
  33061. * @param {...*} [args] The arguments to invoke the method with.
  33062. * @returns {Function} Returns the new invoker function.
  33063. * @example
  33064. *
  33065. * var array = _.times(3, _.constant),
  33066. * object = { 'a': array, 'b': array, 'c': array };
  33067. *
  33068. * _.map(['a[2]', 'c[0]'], _.methodOf(object));
  33069. * // => [2, 0]
  33070. *
  33071. * _.map([['a', '2'], ['c', '0']], _.methodOf(object));
  33072. * // => [2, 0]
  33073. */
  33074. var methodOf = baseRest(function(object, args) {
  33075. return function(path) {
  33076. return baseInvoke(object, path, args);
  33077. };
  33078. });
  33079. /**
  33080. * Adds all own enumerable string keyed function properties of a source
  33081. * object to the destination object. If `object` is a function, then methods
  33082. * are added to its prototype as well.
  33083. *
  33084. * **Note:** Use `_.runInContext` to create a pristine `lodash` function to
  33085. * avoid conflicts caused by modifying the original.
  33086. *
  33087. * @static
  33088. * @since 0.1.0
  33089. * @memberOf _
  33090. * @category Util
  33091. * @param {Function|Object} [object=lodash] The destination object.
  33092. * @param {Object} source The object of functions to add.
  33093. * @param {Object} [options={}] The options object.
  33094. * @param {boolean} [options.chain=true] Specify whether mixins are chainable.
  33095. * @returns {Function|Object} Returns `object`.
  33096. * @example
  33097. *
  33098. * function vowels(string) {
  33099. * return _.filter(string, function(v) {
  33100. * return /[aeiou]/i.test(v);
  33101. * });
  33102. * }
  33103. *
  33104. * _.mixin({ 'vowels': vowels });
  33105. * _.vowels('fred');
  33106. * // => ['e']
  33107. *
  33108. * _('fred').vowels().value();
  33109. * // => ['e']
  33110. *
  33111. * _.mixin({ 'vowels': vowels }, { 'chain': false });
  33112. * _('fred').vowels();
  33113. * // => ['e']
  33114. */
  33115. function mixin(object, source, options) {
  33116. var props = keys(source),
  33117. methodNames = baseFunctions(source, props);
  33118. if (options == null &&
  33119. !(isObject(source) && (methodNames.length || !props.length))) {
  33120. options = source;
  33121. source = object;
  33122. object = this;
  33123. methodNames = baseFunctions(source, keys(source));
  33124. }
  33125. var chain = !(isObject(options) && 'chain' in options) || !!options.chain,
  33126. isFunc = isFunction(object);
  33127. arrayEach(methodNames, function(methodName) {
  33128. var func = source[methodName];
  33129. object[methodName] = func;
  33130. if (isFunc) {
  33131. object.prototype[methodName] = function() {
  33132. var chainAll = this.__chain__;
  33133. if (chain || chainAll) {
  33134. var result = object(this.__wrapped__),
  33135. actions = result.__actions__ = copyArray(this.__actions__);
  33136. actions.push({ 'func': func, 'args': arguments, 'thisArg': object });
  33137. result.__chain__ = chainAll;
  33138. return result;
  33139. }
  33140. return func.apply(object, arrayPush([this.value()], arguments));
  33141. };
  33142. }
  33143. });
  33144. return object;
  33145. }
  33146. /**
  33147. * Reverts the `_` variable to its previous value and returns a reference to
  33148. * the `lodash` function.
  33149. *
  33150. * @static
  33151. * @since 0.1.0
  33152. * @memberOf _
  33153. * @category Util
  33154. * @returns {Function} Returns the `lodash` function.
  33155. * @example
  33156. *
  33157. * var lodash = _.noConflict();
  33158. */
  33159. function noConflict() {
  33160. if (root._ === this) {
  33161. root._ = oldDash;
  33162. }
  33163. return this;
  33164. }
  33165. /**
  33166. * This method returns `undefined`.
  33167. *
  33168. * @static
  33169. * @memberOf _
  33170. * @since 2.3.0
  33171. * @category Util
  33172. * @example
  33173. *
  33174. * _.times(2, _.noop);
  33175. * // => [undefined, undefined]
  33176. */
  33177. function noop() {
  33178. // No operation performed.
  33179. }
  33180. /**
  33181. * Creates a function that gets the argument at index `n`. If `n` is negative,
  33182. * the nth argument from the end is returned.
  33183. *
  33184. * @static
  33185. * @memberOf _
  33186. * @since 4.0.0
  33187. * @category Util
  33188. * @param {number} [n=0] The index of the argument to return.
  33189. * @returns {Function} Returns the new pass-thru function.
  33190. * @example
  33191. *
  33192. * var func = _.nthArg(1);
  33193. * func('a', 'b', 'c', 'd');
  33194. * // => 'b'
  33195. *
  33196. * var func = _.nthArg(-2);
  33197. * func('a', 'b', 'c', 'd');
  33198. * // => 'c'
  33199. */
  33200. function nthArg(n) {
  33201. n = toInteger(n);
  33202. return baseRest(function(args) {
  33203. return baseNth(args, n);
  33204. });
  33205. }
  33206. /**
  33207. * Creates a function that invokes `iteratees` with the arguments it receives
  33208. * and returns their results.
  33209. *
  33210. * @static
  33211. * @memberOf _
  33212. * @since 4.0.0
  33213. * @category Util
  33214. * @param {...(Function|Function[])} [iteratees=[_.identity]]
  33215. * The iteratees to invoke.
  33216. * @returns {Function} Returns the new function.
  33217. * @example
  33218. *
  33219. * var func = _.over([Math.max, Math.min]);
  33220. *
  33221. * func(1, 2, 3, 4);
  33222. * // => [4, 1]
  33223. */
  33224. var over = createOver(arrayMap);
  33225. /**
  33226. * Creates a function that checks if **all** of the `predicates` return
  33227. * truthy when invoked with the arguments it receives.
  33228. *
  33229. * @static
  33230. * @memberOf _
  33231. * @since 4.0.0
  33232. * @category Util
  33233. * @param {...(Function|Function[])} [predicates=[_.identity]]
  33234. * The predicates to check.
  33235. * @returns {Function} Returns the new function.
  33236. * @example
  33237. *
  33238. * var func = _.overEvery([Boolean, isFinite]);
  33239. *
  33240. * func('1');
  33241. * // => true
  33242. *
  33243. * func(null);
  33244. * // => false
  33245. *
  33246. * func(NaN);
  33247. * // => false
  33248. */
  33249. var overEvery = createOver(arrayEvery);
  33250. /**
  33251. * Creates a function that checks if **any** of the `predicates` return
  33252. * truthy when invoked with the arguments it receives.
  33253. *
  33254. * @static
  33255. * @memberOf _
  33256. * @since 4.0.0
  33257. * @category Util
  33258. * @param {...(Function|Function[])} [predicates=[_.identity]]
  33259. * The predicates to check.
  33260. * @returns {Function} Returns the new function.
  33261. * @example
  33262. *
  33263. * var func = _.overSome([Boolean, isFinite]);
  33264. *
  33265. * func('1');
  33266. * // => true
  33267. *
  33268. * func(null);
  33269. * // => true
  33270. *
  33271. * func(NaN);
  33272. * // => false
  33273. */
  33274. var overSome = createOver(arraySome);
  33275. /**
  33276. * Creates a function that returns the value at `path` of a given object.
  33277. *
  33278. * @static
  33279. * @memberOf _
  33280. * @since 2.4.0
  33281. * @category Util
  33282. * @param {Array|string} path The path of the property to get.
  33283. * @returns {Function} Returns the new accessor function.
  33284. * @example
  33285. *
  33286. * var objects = [
  33287. * { 'a': { 'b': 2 } },
  33288. * { 'a': { 'b': 1 } }
  33289. * ];
  33290. *
  33291. * _.map(objects, _.property('a.b'));
  33292. * // => [2, 1]
  33293. *
  33294. * _.map(_.sortBy(objects, _.property(['a', 'b'])), 'a.b');
  33295. * // => [1, 2]
  33296. */
  33297. function property(path) {
  33298. return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path);
  33299. }
  33300. /**
  33301. * The opposite of `_.property`; this method creates a function that returns
  33302. * the value at a given path of `object`.
  33303. *
  33304. * @static
  33305. * @memberOf _
  33306. * @since 3.0.0
  33307. * @category Util
  33308. * @param {Object} object The object to query.
  33309. * @returns {Function} Returns the new accessor function.
  33310. * @example
  33311. *
  33312. * var array = [0, 1, 2],
  33313. * object = { 'a': array, 'b': array, 'c': array };
  33314. *
  33315. * _.map(['a[2]', 'c[0]'], _.propertyOf(object));
  33316. * // => [2, 0]
  33317. *
  33318. * _.map([['a', '2'], ['c', '0']], _.propertyOf(object));
  33319. * // => [2, 0]
  33320. */
  33321. function propertyOf(object) {
  33322. return function(path) {
  33323. return object == null ? undefined : baseGet(object, path);
  33324. };
  33325. }
  33326. /**
  33327. * Creates an array of numbers (positive and/or negative) progressing from
  33328. * `start` up to, but not including, `end`. A step of `-1` is used if a negative
  33329. * `start` is specified without an `end` or `step`. If `end` is not specified,
  33330. * it's set to `start` with `start` then set to `0`.
  33331. *
  33332. * **Note:** JavaScript follows the IEEE-754 standard for resolving
  33333. * floating-point values which can produce unexpected results.
  33334. *
  33335. * @static
  33336. * @since 0.1.0
  33337. * @memberOf _
  33338. * @category Util
  33339. * @param {number} [start=0] The start of the range.
  33340. * @param {number} end The end of the range.
  33341. * @param {number} [step=1] The value to increment or decrement by.
  33342. * @returns {Array} Returns the range of numbers.
  33343. * @see _.inRange, _.rangeRight
  33344. * @example
  33345. *
  33346. * _.range(4);
  33347. * // => [0, 1, 2, 3]
  33348. *
  33349. * _.range(-4);
  33350. * // => [0, -1, -2, -3]
  33351. *
  33352. * _.range(1, 5);
  33353. * // => [1, 2, 3, 4]
  33354. *
  33355. * _.range(0, 20, 5);
  33356. * // => [0, 5, 10, 15]
  33357. *
  33358. * _.range(0, -4, -1);
  33359. * // => [0, -1, -2, -3]
  33360. *
  33361. * _.range(1, 4, 0);
  33362. * // => [1, 1, 1]
  33363. *
  33364. * _.range(0);
  33365. * // => []
  33366. */
  33367. var range = createRange();
  33368. /**
  33369. * This method is like `_.range` except that it populates values in
  33370. * descending order.
  33371. *
  33372. * @static
  33373. * @memberOf _
  33374. * @since 4.0.0
  33375. * @category Util
  33376. * @param {number} [start=0] The start of the range.
  33377. * @param {number} end The end of the range.
  33378. * @param {number} [step=1] The value to increment or decrement by.
  33379. * @returns {Array} Returns the range of numbers.
  33380. * @see _.inRange, _.range
  33381. * @example
  33382. *
  33383. * _.rangeRight(4);
  33384. * // => [3, 2, 1, 0]
  33385. *
  33386. * _.rangeRight(-4);
  33387. * // => [-3, -2, -1, 0]
  33388. *
  33389. * _.rangeRight(1, 5);
  33390. * // => [4, 3, 2, 1]
  33391. *
  33392. * _.rangeRight(0, 20, 5);
  33393. * // => [15, 10, 5, 0]
  33394. *
  33395. * _.rangeRight(0, -4, -1);
  33396. * // => [-3, -2, -1, 0]
  33397. *
  33398. * _.rangeRight(1, 4, 0);
  33399. * // => [1, 1, 1]
  33400. *
  33401. * _.rangeRight(0);
  33402. * // => []
  33403. */
  33404. var rangeRight = createRange(true);
  33405. /**
  33406. * This method returns a new empty array.
  33407. *
  33408. * @static
  33409. * @memberOf _
  33410. * @since 4.13.0
  33411. * @category Util
  33412. * @returns {Array} Returns the new empty array.
  33413. * @example
  33414. *
  33415. * var arrays = _.times(2, _.stubArray);
  33416. *
  33417. * console.log(arrays);
  33418. * // => [[], []]
  33419. *
  33420. * console.log(arrays[0] === arrays[1]);
  33421. * // => false
  33422. */
  33423. function stubArray() {
  33424. return [];
  33425. }
  33426. /**
  33427. * This method returns `false`.
  33428. *
  33429. * @static
  33430. * @memberOf _
  33431. * @since 4.13.0
  33432. * @category Util
  33433. * @returns {boolean} Returns `false`.
  33434. * @example
  33435. *
  33436. * _.times(2, _.stubFalse);
  33437. * // => [false, false]
  33438. */
  33439. function stubFalse() {
  33440. return false;
  33441. }
  33442. /**
  33443. * This method returns a new empty object.
  33444. *
  33445. * @static
  33446. * @memberOf _
  33447. * @since 4.13.0
  33448. * @category Util
  33449. * @returns {Object} Returns the new empty object.
  33450. * @example
  33451. *
  33452. * var objects = _.times(2, _.stubObject);
  33453. *
  33454. * console.log(objects);
  33455. * // => [{}, {}]
  33456. *
  33457. * console.log(objects[0] === objects[1]);
  33458. * // => false
  33459. */
  33460. function stubObject() {
  33461. return {};
  33462. }
  33463. /**
  33464. * This method returns an empty string.
  33465. *
  33466. * @static
  33467. * @memberOf _
  33468. * @since 4.13.0
  33469. * @category Util
  33470. * @returns {string} Returns the empty string.
  33471. * @example
  33472. *
  33473. * _.times(2, _.stubString);
  33474. * // => ['', '']
  33475. */
  33476. function stubString() {
  33477. return '';
  33478. }
  33479. /**
  33480. * This method returns `true`.
  33481. *
  33482. * @static
  33483. * @memberOf _
  33484. * @since 4.13.0
  33485. * @category Util
  33486. * @returns {boolean} Returns `true`.
  33487. * @example
  33488. *
  33489. * _.times(2, _.stubTrue);
  33490. * // => [true, true]
  33491. */
  33492. function stubTrue() {
  33493. return true;
  33494. }
  33495. /**
  33496. * Invokes the iteratee `n` times, returning an array of the results of
  33497. * each invocation. The iteratee is invoked with one argument; (index).
  33498. *
  33499. * @static
  33500. * @since 0.1.0
  33501. * @memberOf _
  33502. * @category Util
  33503. * @param {number} n The number of times to invoke `iteratee`.
  33504. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  33505. * @returns {Array} Returns the array of results.
  33506. * @example
  33507. *
  33508. * _.times(3, String);
  33509. * // => ['0', '1', '2']
  33510. *
  33511. * _.times(4, _.constant(0));
  33512. * // => [0, 0, 0, 0]
  33513. */
  33514. function times(n, iteratee) {
  33515. n = toInteger(n);
  33516. if (n < 1 || n > MAX_SAFE_INTEGER) {
  33517. return [];
  33518. }
  33519. var index = MAX_ARRAY_LENGTH,
  33520. length = nativeMin(n, MAX_ARRAY_LENGTH);
  33521. iteratee = getIteratee(iteratee);
  33522. n -= MAX_ARRAY_LENGTH;
  33523. var result = baseTimes(length, iteratee);
  33524. while (++index < n) {
  33525. iteratee(index);
  33526. }
  33527. return result;
  33528. }
  33529. /**
  33530. * Converts `value` to a property path array.
  33531. *
  33532. * @static
  33533. * @memberOf _
  33534. * @since 4.0.0
  33535. * @category Util
  33536. * @param {*} value The value to convert.
  33537. * @returns {Array} Returns the new property path array.
  33538. * @example
  33539. *
  33540. * _.toPath('a.b.c');
  33541. * // => ['a', 'b', 'c']
  33542. *
  33543. * _.toPath('a[0].b.c');
  33544. * // => ['a', '0', 'b', 'c']
  33545. */
  33546. function toPath(value) {
  33547. if (isArray(value)) {
  33548. return arrayMap(value, toKey);
  33549. }
  33550. return isSymbol(value) ? [value] : copyArray(stringToPath(toString(value)));
  33551. }
  33552. /**
  33553. * Generates a unique ID. If `prefix` is given, the ID is appended to it.
  33554. *
  33555. * @static
  33556. * @since 0.1.0
  33557. * @memberOf _
  33558. * @category Util
  33559. * @param {string} [prefix=''] The value to prefix the ID with.
  33560. * @returns {string} Returns the unique ID.
  33561. * @example
  33562. *
  33563. * _.uniqueId('contact_');
  33564. * // => 'contact_104'
  33565. *
  33566. * _.uniqueId();
  33567. * // => '105'
  33568. */
  33569. function uniqueId(prefix) {
  33570. var id = ++idCounter;
  33571. return toString(prefix) + id;
  33572. }
  33573. /*------------------------------------------------------------------------*/
  33574. /**
  33575. * Adds two numbers.
  33576. *
  33577. * @static
  33578. * @memberOf _
  33579. * @since 3.4.0
  33580. * @category Math
  33581. * @param {number} augend The first number in an addition.
  33582. * @param {number} addend The second number in an addition.
  33583. * @returns {number} Returns the total.
  33584. * @example
  33585. *
  33586. * _.add(6, 4);
  33587. * // => 10
  33588. */
  33589. var add = createMathOperation(function(augend, addend) {
  33590. return augend + addend;
  33591. }, 0);
  33592. /**
  33593. * Computes `number` rounded up to `precision`.
  33594. *
  33595. * @static
  33596. * @memberOf _
  33597. * @since 3.10.0
  33598. * @category Math
  33599. * @param {number} number The number to round up.
  33600. * @param {number} [precision=0] The precision to round up to.
  33601. * @returns {number} Returns the rounded up number.
  33602. * @example
  33603. *
  33604. * _.ceil(4.006);
  33605. * // => 5
  33606. *
  33607. * _.ceil(6.004, 2);
  33608. * // => 6.01
  33609. *
  33610. * _.ceil(6040, -2);
  33611. * // => 6100
  33612. */
  33613. var ceil = createRound('ceil');
  33614. /**
  33615. * Divide two numbers.
  33616. *
  33617. * @static
  33618. * @memberOf _
  33619. * @since 4.7.0
  33620. * @category Math
  33621. * @param {number} dividend The first number in a division.
  33622. * @param {number} divisor The second number in a division.
  33623. * @returns {number} Returns the quotient.
  33624. * @example
  33625. *
  33626. * _.divide(6, 4);
  33627. * // => 1.5
  33628. */
  33629. var divide = createMathOperation(function(dividend, divisor) {
  33630. return dividend / divisor;
  33631. }, 1);
  33632. /**
  33633. * Computes `number` rounded down to `precision`.
  33634. *
  33635. * @static
  33636. * @memberOf _
  33637. * @since 3.10.0
  33638. * @category Math
  33639. * @param {number} number The number to round down.
  33640. * @param {number} [precision=0] The precision to round down to.
  33641. * @returns {number} Returns the rounded down number.
  33642. * @example
  33643. *
  33644. * _.floor(4.006);
  33645. * // => 4
  33646. *
  33647. * _.floor(0.046, 2);
  33648. * // => 0.04
  33649. *
  33650. * _.floor(4060, -2);
  33651. * // => 4000
  33652. */
  33653. var floor = createRound('floor');
  33654. /**
  33655. * Computes the maximum value of `array`. If `array` is empty or falsey,
  33656. * `undefined` is returned.
  33657. *
  33658. * @static
  33659. * @since 0.1.0
  33660. * @memberOf _
  33661. * @category Math
  33662. * @param {Array} array The array to iterate over.
  33663. * @returns {*} Returns the maximum value.
  33664. * @example
  33665. *
  33666. * _.max([4, 2, 8, 6]);
  33667. * // => 8
  33668. *
  33669. * _.max([]);
  33670. * // => undefined
  33671. */
  33672. function max(array) {
  33673. return (array && array.length)
  33674. ? baseExtremum(array, identity, baseGt)
  33675. : undefined;
  33676. }
  33677. /**
  33678. * This method is like `_.max` except that it accepts `iteratee` which is
  33679. * invoked for each element in `array` to generate the criterion by which
  33680. * the value is ranked. The iteratee is invoked with one argument: (value).
  33681. *
  33682. * @static
  33683. * @memberOf _
  33684. * @since 4.0.0
  33685. * @category Math
  33686. * @param {Array} array The array to iterate over.
  33687. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  33688. * @returns {*} Returns the maximum value.
  33689. * @example
  33690. *
  33691. * var objects = [{ 'n': 1 }, { 'n': 2 }];
  33692. *
  33693. * _.maxBy(objects, function(o) { return o.n; });
  33694. * // => { 'n': 2 }
  33695. *
  33696. * // The `_.property` iteratee shorthand.
  33697. * _.maxBy(objects, 'n');
  33698. * // => { 'n': 2 }
  33699. */
  33700. function maxBy(array, iteratee) {
  33701. return (array && array.length)
  33702. ? baseExtremum(array, getIteratee(iteratee, 2), baseGt)
  33703. : undefined;
  33704. }
  33705. /**
  33706. * Computes the mean of the values in `array`.
  33707. *
  33708. * @static
  33709. * @memberOf _
  33710. * @since 4.0.0
  33711. * @category Math
  33712. * @param {Array} array The array to iterate over.
  33713. * @returns {number} Returns the mean.
  33714. * @example
  33715. *
  33716. * _.mean([4, 2, 8, 6]);
  33717. * // => 5
  33718. */
  33719. function mean(array) {
  33720. return baseMean(array, identity);
  33721. }
  33722. /**
  33723. * This method is like `_.mean` except that it accepts `iteratee` which is
  33724. * invoked for each element in `array` to generate the value to be averaged.
  33725. * The iteratee is invoked with one argument: (value).
  33726. *
  33727. * @static
  33728. * @memberOf _
  33729. * @since 4.7.0
  33730. * @category Math
  33731. * @param {Array} array The array to iterate over.
  33732. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  33733. * @returns {number} Returns the mean.
  33734. * @example
  33735. *
  33736. * var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }];
  33737. *
  33738. * _.meanBy(objects, function(o) { return o.n; });
  33739. * // => 5
  33740. *
  33741. * // The `_.property` iteratee shorthand.
  33742. * _.meanBy(objects, 'n');
  33743. * // => 5
  33744. */
  33745. function meanBy(array, iteratee) {
  33746. return baseMean(array, getIteratee(iteratee, 2));
  33747. }
  33748. /**
  33749. * Computes the minimum value of `array`. If `array` is empty or falsey,
  33750. * `undefined` is returned.
  33751. *
  33752. * @static
  33753. * @since 0.1.0
  33754. * @memberOf _
  33755. * @category Math
  33756. * @param {Array} array The array to iterate over.
  33757. * @returns {*} Returns the minimum value.
  33758. * @example
  33759. *
  33760. * _.min([4, 2, 8, 6]);
  33761. * // => 2
  33762. *
  33763. * _.min([]);
  33764. * // => undefined
  33765. */
  33766. function min(array) {
  33767. return (array && array.length)
  33768. ? baseExtremum(array, identity, baseLt)
  33769. : undefined;
  33770. }
  33771. /**
  33772. * This method is like `_.min` except that it accepts `iteratee` which is
  33773. * invoked for each element in `array` to generate the criterion by which
  33774. * the value is ranked. The iteratee is invoked with one argument: (value).
  33775. *
  33776. * @static
  33777. * @memberOf _
  33778. * @since 4.0.0
  33779. * @category Math
  33780. * @param {Array} array The array to iterate over.
  33781. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  33782. * @returns {*} Returns the minimum value.
  33783. * @example
  33784. *
  33785. * var objects = [{ 'n': 1 }, { 'n': 2 }];
  33786. *
  33787. * _.minBy(objects, function(o) { return o.n; });
  33788. * // => { 'n': 1 }
  33789. *
  33790. * // The `_.property` iteratee shorthand.
  33791. * _.minBy(objects, 'n');
  33792. * // => { 'n': 1 }
  33793. */
  33794. function minBy(array, iteratee) {
  33795. return (array && array.length)
  33796. ? baseExtremum(array, getIteratee(iteratee, 2), baseLt)
  33797. : undefined;
  33798. }
  33799. /**
  33800. * Multiply two numbers.
  33801. *
  33802. * @static
  33803. * @memberOf _
  33804. * @since 4.7.0
  33805. * @category Math
  33806. * @param {number} multiplier The first number in a multiplication.
  33807. * @param {number} multiplicand The second number in a multiplication.
  33808. * @returns {number} Returns the product.
  33809. * @example
  33810. *
  33811. * _.multiply(6, 4);
  33812. * // => 24
  33813. */
  33814. var multiply = createMathOperation(function(multiplier, multiplicand) {
  33815. return multiplier * multiplicand;
  33816. }, 1);
  33817. /**
  33818. * Computes `number` rounded to `precision`.
  33819. *
  33820. * @static
  33821. * @memberOf _
  33822. * @since 3.10.0
  33823. * @category Math
  33824. * @param {number} number The number to round.
  33825. * @param {number} [precision=0] The precision to round to.
  33826. * @returns {number} Returns the rounded number.
  33827. * @example
  33828. *
  33829. * _.round(4.006);
  33830. * // => 4
  33831. *
  33832. * _.round(4.006, 2);
  33833. * // => 4.01
  33834. *
  33835. * _.round(4060, -2);
  33836. * // => 4100
  33837. */
  33838. var round = createRound('round');
  33839. /**
  33840. * Subtract two numbers.
  33841. *
  33842. * @static
  33843. * @memberOf _
  33844. * @since 4.0.0
  33845. * @category Math
  33846. * @param {number} minuend The first number in a subtraction.
  33847. * @param {number} subtrahend The second number in a subtraction.
  33848. * @returns {number} Returns the difference.
  33849. * @example
  33850. *
  33851. * _.subtract(6, 4);
  33852. * // => 2
  33853. */
  33854. var subtract = createMathOperation(function(minuend, subtrahend) {
  33855. return minuend - subtrahend;
  33856. }, 0);
  33857. /**
  33858. * Computes the sum of the values in `array`.
  33859. *
  33860. * @static
  33861. * @memberOf _
  33862. * @since 3.4.0
  33863. * @category Math
  33864. * @param {Array} array The array to iterate over.
  33865. * @returns {number} Returns the sum.
  33866. * @example
  33867. *
  33868. * _.sum([4, 2, 8, 6]);
  33869. * // => 20
  33870. */
  33871. function sum(array) {
  33872. return (array && array.length)
  33873. ? baseSum(array, identity)
  33874. : 0;
  33875. }
  33876. /**
  33877. * This method is like `_.sum` except that it accepts `iteratee` which is
  33878. * invoked for each element in `array` to generate the value to be summed.
  33879. * The iteratee is invoked with one argument: (value).
  33880. *
  33881. * @static
  33882. * @memberOf _
  33883. * @since 4.0.0
  33884. * @category Math
  33885. * @param {Array} array The array to iterate over.
  33886. * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
  33887. * @returns {number} Returns the sum.
  33888. * @example
  33889. *
  33890. * var objects = [{ 'n': 4 }, { 'n': 2 }, { 'n': 8 }, { 'n': 6 }];
  33891. *
  33892. * _.sumBy(objects, function(o) { return o.n; });
  33893. * // => 20
  33894. *
  33895. * // The `_.property` iteratee shorthand.
  33896. * _.sumBy(objects, 'n');
  33897. * // => 20
  33898. */
  33899. function sumBy(array, iteratee) {
  33900. return (array && array.length)
  33901. ? baseSum(array, getIteratee(iteratee, 2))
  33902. : 0;
  33903. }
  33904. /*------------------------------------------------------------------------*/
  33905. // Add methods that return wrapped values in chain sequences.
  33906. lodash.after = after;
  33907. lodash.ary = ary;
  33908. lodash.assign = assign;
  33909. lodash.assignIn = assignIn;
  33910. lodash.assignInWith = assignInWith;
  33911. lodash.assignWith = assignWith;
  33912. lodash.at = at;
  33913. lodash.before = before;
  33914. lodash.bind = bind;
  33915. lodash.bindAll = bindAll;
  33916. lodash.bindKey = bindKey;
  33917. lodash.castArray = castArray;
  33918. lodash.chain = chain;
  33919. lodash.chunk = chunk;
  33920. lodash.compact = compact;
  33921. lodash.concat = concat;
  33922. lodash.cond = cond;
  33923. lodash.conforms = conforms;
  33924. lodash.constant = constant;
  33925. lodash.countBy = countBy;
  33926. lodash.create = create;
  33927. lodash.curry = curry;
  33928. lodash.curryRight = curryRight;
  33929. lodash.debounce = debounce;
  33930. lodash.defaults = defaults;
  33931. lodash.defaultsDeep = defaultsDeep;
  33932. lodash.defer = defer;
  33933. lodash.delay = delay;
  33934. lodash.difference = difference;
  33935. lodash.differenceBy = differenceBy;
  33936. lodash.differenceWith = differenceWith;
  33937. lodash.drop = drop;
  33938. lodash.dropRight = dropRight;
  33939. lodash.dropRightWhile = dropRightWhile;
  33940. lodash.dropWhile = dropWhile;
  33941. lodash.fill = fill;
  33942. lodash.filter = filter;
  33943. lodash.flatMap = flatMap;
  33944. lodash.flatMapDeep = flatMapDeep;
  33945. lodash.flatMapDepth = flatMapDepth;
  33946. lodash.flatten = flatten;
  33947. lodash.flattenDeep = flattenDeep;
  33948. lodash.flattenDepth = flattenDepth;
  33949. lodash.flip = flip;
  33950. lodash.flow = flow;
  33951. lodash.flowRight = flowRight;
  33952. lodash.fromPairs = fromPairs;
  33953. lodash.functions = functions;
  33954. lodash.functionsIn = functionsIn;
  33955. lodash.groupBy = groupBy;
  33956. lodash.initial = initial;
  33957. lodash.intersection = intersection;
  33958. lodash.intersectionBy = intersectionBy;
  33959. lodash.intersectionWith = intersectionWith;
  33960. lodash.invert = invert;
  33961. lodash.invertBy = invertBy;
  33962. lodash.invokeMap = invokeMap;
  33963. lodash.iteratee = iteratee;
  33964. lodash.keyBy = keyBy;
  33965. lodash.keys = keys;
  33966. lodash.keysIn = keysIn;
  33967. lodash.map = map;
  33968. lodash.mapKeys = mapKeys;
  33969. lodash.mapValues = mapValues;
  33970. lodash.matches = matches;
  33971. lodash.matchesProperty = matchesProperty;
  33972. lodash.memoize = memoize;
  33973. lodash.merge = merge;
  33974. lodash.mergeWith = mergeWith;
  33975. lodash.method = method;
  33976. lodash.methodOf = methodOf;
  33977. lodash.mixin = mixin;
  33978. lodash.negate = negate;
  33979. lodash.nthArg = nthArg;
  33980. lodash.omit = omit;
  33981. lodash.omitBy = omitBy;
  33982. lodash.once = once;
  33983. lodash.orderBy = orderBy;
  33984. lodash.over = over;
  33985. lodash.overArgs = overArgs;
  33986. lodash.overEvery = overEvery;
  33987. lodash.overSome = overSome;
  33988. lodash.partial = partial;
  33989. lodash.partialRight = partialRight;
  33990. lodash.partition = partition;
  33991. lodash.pick = pick;
  33992. lodash.pickBy = pickBy;
  33993. lodash.property = property;
  33994. lodash.propertyOf = propertyOf;
  33995. lodash.pull = pull;
  33996. lodash.pullAll = pullAll;
  33997. lodash.pullAllBy = pullAllBy;
  33998. lodash.pullAllWith = pullAllWith;
  33999. lodash.pullAt = pullAt;
  34000. lodash.range = range;
  34001. lodash.rangeRight = rangeRight;
  34002. lodash.rearg = rearg;
  34003. lodash.reject = reject;
  34004. lodash.remove = remove;
  34005. lodash.rest = rest;
  34006. lodash.reverse = reverse;
  34007. lodash.sampleSize = sampleSize;
  34008. lodash.set = set;
  34009. lodash.setWith = setWith;
  34010. lodash.shuffle = shuffle;
  34011. lodash.slice = slice;
  34012. lodash.sortBy = sortBy;
  34013. lodash.sortedUniq = sortedUniq;
  34014. lodash.sortedUniqBy = sortedUniqBy;
  34015. lodash.split = split;
  34016. lodash.spread = spread;
  34017. lodash.tail = tail;
  34018. lodash.take = take;
  34019. lodash.takeRight = takeRight;
  34020. lodash.takeRightWhile = takeRightWhile;
  34021. lodash.takeWhile = takeWhile;
  34022. lodash.tap = tap;
  34023. lodash.throttle = throttle;
  34024. lodash.thru = thru;
  34025. lodash.toArray = toArray;
  34026. lodash.toPairs = toPairs;
  34027. lodash.toPairsIn = toPairsIn;
  34028. lodash.toPath = toPath;
  34029. lodash.toPlainObject = toPlainObject;
  34030. lodash.transform = transform;
  34031. lodash.unary = unary;
  34032. lodash.union = union;
  34033. lodash.unionBy = unionBy;
  34034. lodash.unionWith = unionWith;
  34035. lodash.uniq = uniq;
  34036. lodash.uniqBy = uniqBy;
  34037. lodash.uniqWith = uniqWith;
  34038. lodash.unset = unset;
  34039. lodash.unzip = unzip;
  34040. lodash.unzipWith = unzipWith;
  34041. lodash.update = update;
  34042. lodash.updateWith = updateWith;
  34043. lodash.values = values;
  34044. lodash.valuesIn = valuesIn;
  34045. lodash.without = without;
  34046. lodash.words = words;
  34047. lodash.wrap = wrap;
  34048. lodash.xor = xor;
  34049. lodash.xorBy = xorBy;
  34050. lodash.xorWith = xorWith;
  34051. lodash.zip = zip;
  34052. lodash.zipObject = zipObject;
  34053. lodash.zipObjectDeep = zipObjectDeep;
  34054. lodash.zipWith = zipWith;
  34055. // Add aliases.
  34056. lodash.entries = toPairs;
  34057. lodash.entriesIn = toPairsIn;
  34058. lodash.extend = assignIn;
  34059. lodash.extendWith = assignInWith;
  34060. // Add methods to `lodash.prototype`.
  34061. mixin(lodash, lodash);
  34062. /*------------------------------------------------------------------------*/
  34063. // Add methods that return unwrapped values in chain sequences.
  34064. lodash.add = add;
  34065. lodash.attempt = attempt;
  34066. lodash.camelCase = camelCase;
  34067. lodash.capitalize = capitalize;
  34068. lodash.ceil = ceil;
  34069. lodash.clamp = clamp;
  34070. lodash.clone = clone;
  34071. lodash.cloneDeep = cloneDeep;
  34072. lodash.cloneDeepWith = cloneDeepWith;
  34073. lodash.cloneWith = cloneWith;
  34074. lodash.conformsTo = conformsTo;
  34075. lodash.deburr = deburr;
  34076. lodash.defaultTo = defaultTo;
  34077. lodash.divide = divide;
  34078. lodash.endsWith = endsWith;
  34079. lodash.eq = eq;
  34080. lodash.escape = escape;
  34081. lodash.escapeRegExp = escapeRegExp;
  34082. lodash.every = every;
  34083. lodash.find = find;
  34084. lodash.findIndex = findIndex;
  34085. lodash.findKey = findKey;
  34086. lodash.findLast = findLast;
  34087. lodash.findLastIndex = findLastIndex;
  34088. lodash.findLastKey = findLastKey;
  34089. lodash.floor = floor;
  34090. lodash.forEach = forEach;
  34091. lodash.forEachRight = forEachRight;
  34092. lodash.forIn = forIn;
  34093. lodash.forInRight = forInRight;
  34094. lodash.forOwn = forOwn;
  34095. lodash.forOwnRight = forOwnRight;
  34096. lodash.get = get;
  34097. lodash.gt = gt;
  34098. lodash.gte = gte;
  34099. lodash.has = has;
  34100. lodash.hasIn = hasIn;
  34101. lodash.head = head;
  34102. lodash.identity = identity;
  34103. lodash.includes = includes;
  34104. lodash.indexOf = indexOf;
  34105. lodash.inRange = inRange;
  34106. lodash.invoke = invoke;
  34107. lodash.isArguments = isArguments;
  34108. lodash.isArray = isArray;
  34109. lodash.isArrayBuffer = isArrayBuffer;
  34110. lodash.isArrayLike = isArrayLike;
  34111. lodash.isArrayLikeObject = isArrayLikeObject;
  34112. lodash.isBoolean = isBoolean;
  34113. lodash.isBuffer = isBuffer;
  34114. lodash.isDate = isDate;
  34115. lodash.isElement = isElement;
  34116. lodash.isEmpty = isEmpty;
  34117. lodash.isEqual = isEqual;
  34118. lodash.isEqualWith = isEqualWith;
  34119. lodash.isError = isError;
  34120. lodash.isFinite = isFinite;
  34121. lodash.isFunction = isFunction;
  34122. lodash.isInteger = isInteger;
  34123. lodash.isLength = isLength;
  34124. lodash.isMap = isMap;
  34125. lodash.isMatch = isMatch;
  34126. lodash.isMatchWith = isMatchWith;
  34127. lodash.isNaN = isNaN;
  34128. lodash.isNative = isNative;
  34129. lodash.isNil = isNil;
  34130. lodash.isNull = isNull;
  34131. lodash.isNumber = isNumber;
  34132. lodash.isObject = isObject;
  34133. lodash.isObjectLike = isObjectLike;
  34134. lodash.isPlainObject = isPlainObject;
  34135. lodash.isRegExp = isRegExp;
  34136. lodash.isSafeInteger = isSafeInteger;
  34137. lodash.isSet = isSet;
  34138. lodash.isString = isString;
  34139. lodash.isSymbol = isSymbol;
  34140. lodash.isTypedArray = isTypedArray;
  34141. lodash.isUndefined = isUndefined;
  34142. lodash.isWeakMap = isWeakMap;
  34143. lodash.isWeakSet = isWeakSet;
  34144. lodash.join = join;
  34145. lodash.kebabCase = kebabCase;
  34146. lodash.last = last;
  34147. lodash.lastIndexOf = lastIndexOf;
  34148. lodash.lowerCase = lowerCase;
  34149. lodash.lowerFirst = lowerFirst;
  34150. lodash.lt = lt;
  34151. lodash.lte = lte;
  34152. lodash.max = max;
  34153. lodash.maxBy = maxBy;
  34154. lodash.mean = mean;
  34155. lodash.meanBy = meanBy;
  34156. lodash.min = min;
  34157. lodash.minBy = minBy;
  34158. lodash.stubArray = stubArray;
  34159. lodash.stubFalse = stubFalse;
  34160. lodash.stubObject = stubObject;
  34161. lodash.stubString = stubString;
  34162. lodash.stubTrue = stubTrue;
  34163. lodash.multiply = multiply;
  34164. lodash.nth = nth;
  34165. lodash.noConflict = noConflict;
  34166. lodash.noop = noop;
  34167. lodash.now = now;
  34168. lodash.pad = pad;
  34169. lodash.padEnd = padEnd;
  34170. lodash.padStart = padStart;
  34171. lodash.parseInt = parseInt;
  34172. lodash.random = random;
  34173. lodash.reduce = reduce;
  34174. lodash.reduceRight = reduceRight;
  34175. lodash.repeat = repeat;
  34176. lodash.replace = replace;
  34177. lodash.result = result;
  34178. lodash.round = round;
  34179. lodash.runInContext = runInContext;
  34180. lodash.sample = sample;
  34181. lodash.size = size;
  34182. lodash.snakeCase = snakeCase;
  34183. lodash.some = some;
  34184. lodash.sortedIndex = sortedIndex;
  34185. lodash.sortedIndexBy = sortedIndexBy;
  34186. lodash.sortedIndexOf = sortedIndexOf;
  34187. lodash.sortedLastIndex = sortedLastIndex;
  34188. lodash.sortedLastIndexBy = sortedLastIndexBy;
  34189. lodash.sortedLastIndexOf = sortedLastIndexOf;
  34190. lodash.startCase = startCase;
  34191. lodash.startsWith = startsWith;
  34192. lodash.subtract = subtract;
  34193. lodash.sum = sum;
  34194. lodash.sumBy = sumBy;
  34195. lodash.template = template;
  34196. lodash.times = times;
  34197. lodash.toFinite = toFinite;
  34198. lodash.toInteger = toInteger;
  34199. lodash.toLength = toLength;
  34200. lodash.toLower = toLower;
  34201. lodash.toNumber = toNumber;
  34202. lodash.toSafeInteger = toSafeInteger;
  34203. lodash.toString = toString;
  34204. lodash.toUpper = toUpper;
  34205. lodash.trim = trim;
  34206. lodash.trimEnd = trimEnd;
  34207. lodash.trimStart = trimStart;
  34208. lodash.truncate = truncate;
  34209. lodash.unescape = unescape;
  34210. lodash.uniqueId = uniqueId;
  34211. lodash.upperCase = upperCase;
  34212. lodash.upperFirst = upperFirst;
  34213. // Add aliases.
  34214. lodash.each = forEach;
  34215. lodash.eachRight = forEachRight;
  34216. lodash.first = head;
  34217. mixin(lodash, (function() {
  34218. var source = {};
  34219. baseForOwn(lodash, function(func, methodName) {
  34220. if (!hasOwnProperty.call(lodash.prototype, methodName)) {
  34221. source[methodName] = func;
  34222. }
  34223. });
  34224. return source;
  34225. }()), { 'chain': false });
  34226. /*------------------------------------------------------------------------*/
  34227. /**
  34228. * The semantic version number.
  34229. *
  34230. * @static
  34231. * @memberOf _
  34232. * @type {string}
  34233. */
  34234. lodash.VERSION = VERSION;
  34235. // Assign default placeholders.
  34236. arrayEach(['bind', 'bindKey', 'curry', 'curryRight', 'partial', 'partialRight'], function(methodName) {
  34237. lodash[methodName].placeholder = lodash;
  34238. });
  34239. // Add `LazyWrapper` methods for `_.drop` and `_.take` variants.
  34240. arrayEach(['drop', 'take'], function(methodName, index) {
  34241. LazyWrapper.prototype[methodName] = function(n) {
  34242. n = n === undefined ? 1 : nativeMax(toInteger(n), 0);
  34243. var result = (this.__filtered__ && !index)
  34244. ? new LazyWrapper(this)
  34245. : this.clone();
  34246. if (result.__filtered__) {
  34247. result.__takeCount__ = nativeMin(n, result.__takeCount__);
  34248. } else {
  34249. result.__views__.push({
  34250. 'size': nativeMin(n, MAX_ARRAY_LENGTH),
  34251. 'type': methodName + (result.__dir__ < 0 ? 'Right' : '')
  34252. });
  34253. }
  34254. return result;
  34255. };
  34256. LazyWrapper.prototype[methodName + 'Right'] = function(n) {
  34257. return this.reverse()[methodName](n).reverse();
  34258. };
  34259. });
  34260. // Add `LazyWrapper` methods that accept an `iteratee` value.
  34261. arrayEach(['filter', 'map', 'takeWhile'], function(methodName, index) {
  34262. var type = index + 1,
  34263. isFilter = type == LAZY_FILTER_FLAG || type == LAZY_WHILE_FLAG;
  34264. LazyWrapper.prototype[methodName] = function(iteratee) {
  34265. var result = this.clone();
  34266. result.__iteratees__.push({
  34267. 'iteratee': getIteratee(iteratee, 3),
  34268. 'type': type
  34269. });
  34270. result.__filtered__ = result.__filtered__ || isFilter;
  34271. return result;
  34272. };
  34273. });
  34274. // Add `LazyWrapper` methods for `_.head` and `_.last`.
  34275. arrayEach(['head', 'last'], function(methodName, index) {
  34276. var takeName = 'take' + (index ? 'Right' : '');
  34277. LazyWrapper.prototype[methodName] = function() {
  34278. return this[takeName](1).value()[0];
  34279. };
  34280. });
  34281. // Add `LazyWrapper` methods for `_.initial` and `_.tail`.
  34282. arrayEach(['initial', 'tail'], function(methodName, index) {
  34283. var dropName = 'drop' + (index ? '' : 'Right');
  34284. LazyWrapper.prototype[methodName] = function() {
  34285. return this.__filtered__ ? new LazyWrapper(this) : this[dropName](1);
  34286. };
  34287. });
  34288. LazyWrapper.prototype.compact = function() {
  34289. return this.filter(identity);
  34290. };
  34291. LazyWrapper.prototype.find = function(predicate) {
  34292. return this.filter(predicate).head();
  34293. };
  34294. LazyWrapper.prototype.findLast = function(predicate) {
  34295. return this.reverse().find(predicate);
  34296. };
  34297. LazyWrapper.prototype.invokeMap = baseRest(function(path, args) {
  34298. if (typeof path == 'function') {
  34299. return new LazyWrapper(this);
  34300. }
  34301. return this.map(function(value) {
  34302. return baseInvoke(value, path, args);
  34303. });
  34304. });
  34305. LazyWrapper.prototype.reject = function(predicate) {
  34306. return this.filter(negate(getIteratee(predicate)));
  34307. };
  34308. LazyWrapper.prototype.slice = function(start, end) {
  34309. start = toInteger(start);
  34310. var result = this;
  34311. if (result.__filtered__ && (start > 0 || end < 0)) {
  34312. return new LazyWrapper(result);
  34313. }
  34314. if (start < 0) {
  34315. result = result.takeRight(-start);
  34316. } else if (start) {
  34317. result = result.drop(start);
  34318. }
  34319. if (end !== undefined) {
  34320. end = toInteger(end);
  34321. result = end < 0 ? result.dropRight(-end) : result.take(end - start);
  34322. }
  34323. return result;
  34324. };
  34325. LazyWrapper.prototype.takeRightWhile = function(predicate) {
  34326. return this.reverse().takeWhile(predicate).reverse();
  34327. };
  34328. LazyWrapper.prototype.toArray = function() {
  34329. return this.take(MAX_ARRAY_LENGTH);
  34330. };
  34331. // Add `LazyWrapper` methods to `lodash.prototype`.
  34332. baseForOwn(LazyWrapper.prototype, function(func, methodName) {
  34333. var checkIteratee = /^(?:filter|find|map|reject)|While$/.test(methodName),
  34334. isTaker = /^(?:head|last)$/.test(methodName),
  34335. lodashFunc = lodash[isTaker ? ('take' + (methodName == 'last' ? 'Right' : '')) : methodName],
  34336. retUnwrapped = isTaker || /^find/.test(methodName);
  34337. if (!lodashFunc) {
  34338. return;
  34339. }
  34340. lodash.prototype[methodName] = function() {
  34341. var value = this.__wrapped__,
  34342. args = isTaker ? [1] : arguments,
  34343. isLazy = value instanceof LazyWrapper,
  34344. iteratee = args[0],
  34345. useLazy = isLazy || isArray(value);
  34346. var interceptor = function(value) {
  34347. var result = lodashFunc.apply(lodash, arrayPush([value], args));
  34348. return (isTaker && chainAll) ? result[0] : result;
  34349. };
  34350. if (useLazy && checkIteratee && typeof iteratee == 'function' && iteratee.length != 1) {
  34351. // Avoid lazy use if the iteratee has a "length" value other than `1`.
  34352. isLazy = useLazy = false;
  34353. }
  34354. var chainAll = this.__chain__,
  34355. isHybrid = !!this.__actions__.length,
  34356. isUnwrapped = retUnwrapped && !chainAll,
  34357. onlyLazy = isLazy && !isHybrid;
  34358. if (!retUnwrapped && useLazy) {
  34359. value = onlyLazy ? value : new LazyWrapper(this);
  34360. var result = func.apply(value, args);
  34361. result.__actions__.push({ 'func': thru, 'args': [interceptor], 'thisArg': undefined });
  34362. return new LodashWrapper(result, chainAll);
  34363. }
  34364. if (isUnwrapped && onlyLazy) {
  34365. return func.apply(this, args);
  34366. }
  34367. result = this.thru(interceptor);
  34368. return isUnwrapped ? (isTaker ? result.value()[0] : result.value()) : result;
  34369. };
  34370. });
  34371. // Add `Array` methods to `lodash.prototype`.
  34372. arrayEach(['pop', 'push', 'shift', 'sort', 'splice', 'unshift'], function(methodName) {
  34373. var func = arrayProto[methodName],
  34374. chainName = /^(?:push|sort|unshift)$/.test(methodName) ? 'tap' : 'thru',
  34375. retUnwrapped = /^(?:pop|shift)$/.test(methodName);
  34376. lodash.prototype[methodName] = function() {
  34377. var args = arguments;
  34378. if (retUnwrapped && !this.__chain__) {
  34379. var value = this.value();
  34380. return func.apply(isArray(value) ? value : [], args);
  34381. }
  34382. return this[chainName](function(value) {
  34383. return func.apply(isArray(value) ? value : [], args);
  34384. });
  34385. };
  34386. });
  34387. // Map minified method names to their real names.
  34388. baseForOwn(LazyWrapper.prototype, function(func, methodName) {
  34389. var lodashFunc = lodash[methodName];
  34390. if (lodashFunc) {
  34391. var key = lodashFunc.name + '';
  34392. if (!hasOwnProperty.call(realNames, key)) {
  34393. realNames[key] = [];
  34394. }
  34395. realNames[key].push({ 'name': methodName, 'func': lodashFunc });
  34396. }
  34397. });
  34398. realNames[createHybrid(undefined, WRAP_BIND_KEY_FLAG).name] = [{
  34399. 'name': 'wrapper',
  34400. 'func': undefined
  34401. }];
  34402. // Add methods to `LazyWrapper`.
  34403. LazyWrapper.prototype.clone = lazyClone;
  34404. LazyWrapper.prototype.reverse = lazyReverse;
  34405. LazyWrapper.prototype.value = lazyValue;
  34406. // Add chain sequence methods to the `lodash` wrapper.
  34407. lodash.prototype.at = wrapperAt;
  34408. lodash.prototype.chain = wrapperChain;
  34409. lodash.prototype.commit = wrapperCommit;
  34410. lodash.prototype.next = wrapperNext;
  34411. lodash.prototype.plant = wrapperPlant;
  34412. lodash.prototype.reverse = wrapperReverse;
  34413. lodash.prototype.toJSON = lodash.prototype.valueOf = lodash.prototype.value = wrapperValue;
  34414. // Add lazy aliases.
  34415. lodash.prototype.first = lodash.prototype.head;
  34416. if (symIterator) {
  34417. lodash.prototype[symIterator] = wrapperToIterator;
  34418. }
  34419. return lodash;
  34420. });
  34421. /*--------------------------------------------------------------------------*/
  34422. // Export lodash.
  34423. var _ = runInContext();
  34424. // Some AMD build optimizers, like r.js, check for condition patterns like:
  34425. if (true) {
  34426. // Expose Lodash on the global object to prevent errors when Lodash is
  34427. // loaded by a script tag in the presence of an AMD loader.
  34428. // See http://requirejs.org/docs/errors.html#mismatch for more details.
  34429. // Use `_.noConflict` to remove Lodash from the global object.
  34430. root._ = _;
  34431. // Define as an anonymous module so, through path mapping, it can be
  34432. // referenced as the "underscore" module.
  34433. !(__WEBPACK_AMD_DEFINE_RESULT__ = (function() {
  34434. return _;
  34435. }).call(exports, __webpack_require__, exports, module),
  34436. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  34437. }
  34438. // Check for `exports` after `define` in case a build optimizer adds it.
  34439. else {}
  34440. }.call(this));
  34441. /* 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)))
  34442. /***/ }),
  34443. /***/ "./node_modules/popper.js/dist/esm/popper.js":
  34444. /*!***************************************************!*\
  34445. !*** ./node_modules/popper.js/dist/esm/popper.js ***!
  34446. \***************************************************/
  34447. /*! exports provided: default */
  34448. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  34449. "use strict";
  34450. __webpack_require__.r(__webpack_exports__);
  34451. /* WEBPACK VAR INJECTION */(function(global) {/**!
  34452. * @fileOverview Kickass library to create and place poppers near their reference elements.
  34453. * @version 1.16.1
  34454. * @license
  34455. * Copyright (c) 2016 Federico Zivolo and contributors
  34456. *
  34457. * Permission is hereby granted, free of charge, to any person obtaining a copy
  34458. * of this software and associated documentation files (the "Software"), to deal
  34459. * in the Software without restriction, including without limitation the rights
  34460. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  34461. * copies of the Software, and to permit persons to whom the Software is
  34462. * furnished to do so, subject to the following conditions:
  34463. *
  34464. * The above copyright notice and this permission notice shall be included in all
  34465. * copies or substantial portions of the Software.
  34466. *
  34467. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  34468. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  34469. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  34470. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  34471. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  34472. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  34473. * SOFTWARE.
  34474. */
  34475. var isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined' && typeof navigator !== 'undefined';
  34476. var timeoutDuration = function () {
  34477. var longerTimeoutBrowsers = ['Edge', 'Trident', 'Firefox'];
  34478. for (var i = 0; i < longerTimeoutBrowsers.length; i += 1) {
  34479. if (isBrowser && navigator.userAgent.indexOf(longerTimeoutBrowsers[i]) >= 0) {
  34480. return 1;
  34481. }
  34482. }
  34483. return 0;
  34484. }();
  34485. function microtaskDebounce(fn) {
  34486. var called = false;
  34487. return function () {
  34488. if (called) {
  34489. return;
  34490. }
  34491. called = true;
  34492. window.Promise.resolve().then(function () {
  34493. called = false;
  34494. fn();
  34495. });
  34496. };
  34497. }
  34498. function taskDebounce(fn) {
  34499. var scheduled = false;
  34500. return function () {
  34501. if (!scheduled) {
  34502. scheduled = true;
  34503. setTimeout(function () {
  34504. scheduled = false;
  34505. fn();
  34506. }, timeoutDuration);
  34507. }
  34508. };
  34509. }
  34510. var supportsMicroTasks = isBrowser && window.Promise;
  34511. /**
  34512. * Create a debounced version of a method, that's asynchronously deferred
  34513. * but called in the minimum time possible.
  34514. *
  34515. * @method
  34516. * @memberof Popper.Utils
  34517. * @argument {Function} fn
  34518. * @returns {Function}
  34519. */
  34520. var debounce = supportsMicroTasks ? microtaskDebounce : taskDebounce;
  34521. /**
  34522. * Check if the given variable is a function
  34523. * @method
  34524. * @memberof Popper.Utils
  34525. * @argument {Any} functionToCheck - variable to check
  34526. * @returns {Boolean} answer to: is a function?
  34527. */
  34528. function isFunction(functionToCheck) {
  34529. var getType = {};
  34530. return functionToCheck && getType.toString.call(functionToCheck) === '[object Function]';
  34531. }
  34532. /**
  34533. * Get CSS computed property of the given element
  34534. * @method
  34535. * @memberof Popper.Utils
  34536. * @argument {Eement} element
  34537. * @argument {String} property
  34538. */
  34539. function getStyleComputedProperty(element, property) {
  34540. if (element.nodeType !== 1) {
  34541. return [];
  34542. }
  34543. // NOTE: 1 DOM access here
  34544. var window = element.ownerDocument.defaultView;
  34545. var css = window.getComputedStyle(element, null);
  34546. return property ? css[property] : css;
  34547. }
  34548. /**
  34549. * Returns the parentNode or the host of the element
  34550. * @method
  34551. * @memberof Popper.Utils
  34552. * @argument {Element} element
  34553. * @returns {Element} parent
  34554. */
  34555. function getParentNode(element) {
  34556. if (element.nodeName === 'HTML') {
  34557. return element;
  34558. }
  34559. return element.parentNode || element.host;
  34560. }
  34561. /**
  34562. * Returns the scrolling parent of the given element
  34563. * @method
  34564. * @memberof Popper.Utils
  34565. * @argument {Element} element
  34566. * @returns {Element} scroll parent
  34567. */
  34568. function getScrollParent(element) {
  34569. // Return body, `getScroll` will take care to get the correct `scrollTop` from it
  34570. if (!element) {
  34571. return document.body;
  34572. }
  34573. switch (element.nodeName) {
  34574. case 'HTML':
  34575. case 'BODY':
  34576. return element.ownerDocument.body;
  34577. case '#document':
  34578. return element.body;
  34579. }
  34580. // Firefox want us to check `-x` and `-y` variations as well
  34581. var _getStyleComputedProp = getStyleComputedProperty(element),
  34582. overflow = _getStyleComputedProp.overflow,
  34583. overflowX = _getStyleComputedProp.overflowX,
  34584. overflowY = _getStyleComputedProp.overflowY;
  34585. if (/(auto|scroll|overlay)/.test(overflow + overflowY + overflowX)) {
  34586. return element;
  34587. }
  34588. return getScrollParent(getParentNode(element));
  34589. }
  34590. /**
  34591. * Returns the reference node of the reference object, or the reference object itself.
  34592. * @method
  34593. * @memberof Popper.Utils
  34594. * @param {Element|Object} reference - the reference element (the popper will be relative to this)
  34595. * @returns {Element} parent
  34596. */
  34597. function getReferenceNode(reference) {
  34598. return reference && reference.referenceNode ? reference.referenceNode : reference;
  34599. }
  34600. var isIE11 = isBrowser && !!(window.MSInputMethodContext && document.documentMode);
  34601. var isIE10 = isBrowser && /MSIE 10/.test(navigator.userAgent);
  34602. /**
  34603. * Determines if the browser is Internet Explorer
  34604. * @method
  34605. * @memberof Popper.Utils
  34606. * @param {Number} version to check
  34607. * @returns {Boolean} isIE
  34608. */
  34609. function isIE(version) {
  34610. if (version === 11) {
  34611. return isIE11;
  34612. }
  34613. if (version === 10) {
  34614. return isIE10;
  34615. }
  34616. return isIE11 || isIE10;
  34617. }
  34618. /**
  34619. * Returns the offset parent of the given element
  34620. * @method
  34621. * @memberof Popper.Utils
  34622. * @argument {Element} element
  34623. * @returns {Element} offset parent
  34624. */
  34625. function getOffsetParent(element) {
  34626. if (!element) {
  34627. return document.documentElement;
  34628. }
  34629. var noOffsetParent = isIE(10) ? document.body : null;
  34630. // NOTE: 1 DOM access here
  34631. var offsetParent = element.offsetParent || null;
  34632. // Skip hidden elements which don't have an offsetParent
  34633. while (offsetParent === noOffsetParent && element.nextElementSibling) {
  34634. offsetParent = (element = element.nextElementSibling).offsetParent;
  34635. }
  34636. var nodeName = offsetParent && offsetParent.nodeName;
  34637. if (!nodeName || nodeName === 'BODY' || nodeName === 'HTML') {
  34638. return element ? element.ownerDocument.documentElement : document.documentElement;
  34639. }
  34640. // .offsetParent will return the closest TH, TD or TABLE in case
  34641. // no offsetParent is present, I hate this job...
  34642. if (['TH', 'TD', 'TABLE'].indexOf(offsetParent.nodeName) !== -1 && getStyleComputedProperty(offsetParent, 'position') === 'static') {
  34643. return getOffsetParent(offsetParent);
  34644. }
  34645. return offsetParent;
  34646. }
  34647. function isOffsetContainer(element) {
  34648. var nodeName = element.nodeName;
  34649. if (nodeName === 'BODY') {
  34650. return false;
  34651. }
  34652. return nodeName === 'HTML' || getOffsetParent(element.firstElementChild) === element;
  34653. }
  34654. /**
  34655. * Finds the root node (document, shadowDOM root) of the given element
  34656. * @method
  34657. * @memberof Popper.Utils
  34658. * @argument {Element} node
  34659. * @returns {Element} root node
  34660. */
  34661. function getRoot(node) {
  34662. if (node.parentNode !== null) {
  34663. return getRoot(node.parentNode);
  34664. }
  34665. return node;
  34666. }
  34667. /**
  34668. * Finds the offset parent common to the two provided nodes
  34669. * @method
  34670. * @memberof Popper.Utils
  34671. * @argument {Element} element1
  34672. * @argument {Element} element2
  34673. * @returns {Element} common offset parent
  34674. */
  34675. function findCommonOffsetParent(element1, element2) {
  34676. // This check is needed to avoid errors in case one of the elements isn't defined for any reason
  34677. if (!element1 || !element1.nodeType || !element2 || !element2.nodeType) {
  34678. return document.documentElement;
  34679. }
  34680. // Here we make sure to give as "start" the element that comes first in the DOM
  34681. var order = element1.compareDocumentPosition(element2) & Node.DOCUMENT_POSITION_FOLLOWING;
  34682. var start = order ? element1 : element2;
  34683. var end = order ? element2 : element1;
  34684. // Get common ancestor container
  34685. var range = document.createRange();
  34686. range.setStart(start, 0);
  34687. range.setEnd(end, 0);
  34688. var commonAncestorContainer = range.commonAncestorContainer;
  34689. // Both nodes are inside #document
  34690. if (element1 !== commonAncestorContainer && element2 !== commonAncestorContainer || start.contains(end)) {
  34691. if (isOffsetContainer(commonAncestorContainer)) {
  34692. return commonAncestorContainer;
  34693. }
  34694. return getOffsetParent(commonAncestorContainer);
  34695. }
  34696. // one of the nodes is inside shadowDOM, find which one
  34697. var element1root = getRoot(element1);
  34698. if (element1root.host) {
  34699. return findCommonOffsetParent(element1root.host, element2);
  34700. } else {
  34701. return findCommonOffsetParent(element1, getRoot(element2).host);
  34702. }
  34703. }
  34704. /**
  34705. * Gets the scroll value of the given element in the given side (top and left)
  34706. * @method
  34707. * @memberof Popper.Utils
  34708. * @argument {Element} element
  34709. * @argument {String} side `top` or `left`
  34710. * @returns {number} amount of scrolled pixels
  34711. */
  34712. function getScroll(element) {
  34713. var side = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'top';
  34714. var upperSide = side === 'top' ? 'scrollTop' : 'scrollLeft';
  34715. var nodeName = element.nodeName;
  34716. if (nodeName === 'BODY' || nodeName === 'HTML') {
  34717. var html = element.ownerDocument.documentElement;
  34718. var scrollingElement = element.ownerDocument.scrollingElement || html;
  34719. return scrollingElement[upperSide];
  34720. }
  34721. return element[upperSide];
  34722. }
  34723. /*
  34724. * Sum or subtract the element scroll values (left and top) from a given rect object
  34725. * @method
  34726. * @memberof Popper.Utils
  34727. * @param {Object} rect - Rect object you want to change
  34728. * @param {HTMLElement} element - The element from the function reads the scroll values
  34729. * @param {Boolean} subtract - set to true if you want to subtract the scroll values
  34730. * @return {Object} rect - The modifier rect object
  34731. */
  34732. function includeScroll(rect, element) {
  34733. var subtract = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  34734. var scrollTop = getScroll(element, 'top');
  34735. var scrollLeft = getScroll(element, 'left');
  34736. var modifier = subtract ? -1 : 1;
  34737. rect.top += scrollTop * modifier;
  34738. rect.bottom += scrollTop * modifier;
  34739. rect.left += scrollLeft * modifier;
  34740. rect.right += scrollLeft * modifier;
  34741. return rect;
  34742. }
  34743. /*
  34744. * Helper to detect borders of a given element
  34745. * @method
  34746. * @memberof Popper.Utils
  34747. * @param {CSSStyleDeclaration} styles
  34748. * Result of `getStyleComputedProperty` on the given element
  34749. * @param {String} axis - `x` or `y`
  34750. * @return {number} borders - The borders size of the given axis
  34751. */
  34752. function getBordersSize(styles, axis) {
  34753. var sideA = axis === 'x' ? 'Left' : 'Top';
  34754. var sideB = sideA === 'Left' ? 'Right' : 'Bottom';
  34755. return parseFloat(styles['border' + sideA + 'Width']) + parseFloat(styles['border' + sideB + 'Width']);
  34756. }
  34757. function getSize(axis, body, html, computedStyle) {
  34758. 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);
  34759. }
  34760. function getWindowSizes(document) {
  34761. var body = document.body;
  34762. var html = document.documentElement;
  34763. var computedStyle = isIE(10) && getComputedStyle(html);
  34764. return {
  34765. height: getSize('Height', body, html, computedStyle),
  34766. width: getSize('Width', body, html, computedStyle)
  34767. };
  34768. }
  34769. var classCallCheck = function (instance, Constructor) {
  34770. if (!(instance instanceof Constructor)) {
  34771. throw new TypeError("Cannot call a class as a function");
  34772. }
  34773. };
  34774. var createClass = function () {
  34775. function defineProperties(target, props) {
  34776. for (var i = 0; i < props.length; i++) {
  34777. var descriptor = props[i];
  34778. descriptor.enumerable = descriptor.enumerable || false;
  34779. descriptor.configurable = true;
  34780. if ("value" in descriptor) descriptor.writable = true;
  34781. Object.defineProperty(target, descriptor.key, descriptor);
  34782. }
  34783. }
  34784. return function (Constructor, protoProps, staticProps) {
  34785. if (protoProps) defineProperties(Constructor.prototype, protoProps);
  34786. if (staticProps) defineProperties(Constructor, staticProps);
  34787. return Constructor;
  34788. };
  34789. }();
  34790. var defineProperty = function (obj, key, value) {
  34791. if (key in obj) {
  34792. Object.defineProperty(obj, key, {
  34793. value: value,
  34794. enumerable: true,
  34795. configurable: true,
  34796. writable: true
  34797. });
  34798. } else {
  34799. obj[key] = value;
  34800. }
  34801. return obj;
  34802. };
  34803. var _extends = Object.assign || function (target) {
  34804. for (var i = 1; i < arguments.length; i++) {
  34805. var source = arguments[i];
  34806. for (var key in source) {
  34807. if (Object.prototype.hasOwnProperty.call(source, key)) {
  34808. target[key] = source[key];
  34809. }
  34810. }
  34811. }
  34812. return target;
  34813. };
  34814. /**
  34815. * Given element offsets, generate an output similar to getBoundingClientRect
  34816. * @method
  34817. * @memberof Popper.Utils
  34818. * @argument {Object} offsets
  34819. * @returns {Object} ClientRect like output
  34820. */
  34821. function getClientRect(offsets) {
  34822. return _extends({}, offsets, {
  34823. right: offsets.left + offsets.width,
  34824. bottom: offsets.top + offsets.height
  34825. });
  34826. }
  34827. /**
  34828. * Get bounding client rect of given element
  34829. * @method
  34830. * @memberof Popper.Utils
  34831. * @param {HTMLElement} element
  34832. * @return {Object} client rect
  34833. */
  34834. function getBoundingClientRect(element) {
  34835. var rect = {};
  34836. // IE10 10 FIX: Please, don't ask, the element isn't
  34837. // considered in DOM in some circumstances...
  34838. // This isn't reproducible in IE10 compatibility mode of IE11
  34839. try {
  34840. if (isIE(10)) {
  34841. rect = element.getBoundingClientRect();
  34842. var scrollTop = getScroll(element, 'top');
  34843. var scrollLeft = getScroll(element, 'left');
  34844. rect.top += scrollTop;
  34845. rect.left += scrollLeft;
  34846. rect.bottom += scrollTop;
  34847. rect.right += scrollLeft;
  34848. } else {
  34849. rect = element.getBoundingClientRect();
  34850. }
  34851. } catch (e) {}
  34852. var result = {
  34853. left: rect.left,
  34854. top: rect.top,
  34855. width: rect.right - rect.left,
  34856. height: rect.bottom - rect.top
  34857. };
  34858. // subtract scrollbar size from sizes
  34859. var sizes = element.nodeName === 'HTML' ? getWindowSizes(element.ownerDocument) : {};
  34860. var width = sizes.width || element.clientWidth || result.width;
  34861. var height = sizes.height || element.clientHeight || result.height;
  34862. var horizScrollbar = element.offsetWidth - width;
  34863. var vertScrollbar = element.offsetHeight - height;
  34864. // if an hypothetical scrollbar is detected, we must be sure it's not a `border`
  34865. // we make this check conditional for performance reasons
  34866. if (horizScrollbar || vertScrollbar) {
  34867. var styles = getStyleComputedProperty(element);
  34868. horizScrollbar -= getBordersSize(styles, 'x');
  34869. vertScrollbar -= getBordersSize(styles, 'y');
  34870. result.width -= horizScrollbar;
  34871. result.height -= vertScrollbar;
  34872. }
  34873. return getClientRect(result);
  34874. }
  34875. function getOffsetRectRelativeToArbitraryNode(children, parent) {
  34876. var fixedPosition = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  34877. var isIE10 = isIE(10);
  34878. var isHTML = parent.nodeName === 'HTML';
  34879. var childrenRect = getBoundingClientRect(children);
  34880. var parentRect = getBoundingClientRect(parent);
  34881. var scrollParent = getScrollParent(children);
  34882. var styles = getStyleComputedProperty(parent);
  34883. var borderTopWidth = parseFloat(styles.borderTopWidth);
  34884. var borderLeftWidth = parseFloat(styles.borderLeftWidth);
  34885. // In cases where the parent is fixed, we must ignore negative scroll in offset calc
  34886. if (fixedPosition && isHTML) {
  34887. parentRect.top = Math.max(parentRect.top, 0);
  34888. parentRect.left = Math.max(parentRect.left, 0);
  34889. }
  34890. var offsets = getClientRect({
  34891. top: childrenRect.top - parentRect.top - borderTopWidth,
  34892. left: childrenRect.left - parentRect.left - borderLeftWidth,
  34893. width: childrenRect.width,
  34894. height: childrenRect.height
  34895. });
  34896. offsets.marginTop = 0;
  34897. offsets.marginLeft = 0;
  34898. // Subtract margins of documentElement in case it's being used as parent
  34899. // we do this only on HTML because it's the only element that behaves
  34900. // differently when margins are applied to it. The margins are included in
  34901. // the box of the documentElement, in the other cases not.
  34902. if (!isIE10 && isHTML) {
  34903. var marginTop = parseFloat(styles.marginTop);
  34904. var marginLeft = parseFloat(styles.marginLeft);
  34905. offsets.top -= borderTopWidth - marginTop;
  34906. offsets.bottom -= borderTopWidth - marginTop;
  34907. offsets.left -= borderLeftWidth - marginLeft;
  34908. offsets.right -= borderLeftWidth - marginLeft;
  34909. // Attach marginTop and marginLeft because in some circumstances we may need them
  34910. offsets.marginTop = marginTop;
  34911. offsets.marginLeft = marginLeft;
  34912. }
  34913. if (isIE10 && !fixedPosition ? parent.contains(scrollParent) : parent === scrollParent && scrollParent.nodeName !== 'BODY') {
  34914. offsets = includeScroll(offsets, parent);
  34915. }
  34916. return offsets;
  34917. }
  34918. function getViewportOffsetRectRelativeToArtbitraryNode(element) {
  34919. var excludeScroll = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  34920. var html = element.ownerDocument.documentElement;
  34921. var relativeOffset = getOffsetRectRelativeToArbitraryNode(element, html);
  34922. var width = Math.max(html.clientWidth, window.innerWidth || 0);
  34923. var height = Math.max(html.clientHeight, window.innerHeight || 0);
  34924. var scrollTop = !excludeScroll ? getScroll(html) : 0;
  34925. var scrollLeft = !excludeScroll ? getScroll(html, 'left') : 0;
  34926. var offset = {
  34927. top: scrollTop - relativeOffset.top + relativeOffset.marginTop,
  34928. left: scrollLeft - relativeOffset.left + relativeOffset.marginLeft,
  34929. width: width,
  34930. height: height
  34931. };
  34932. return getClientRect(offset);
  34933. }
  34934. /**
  34935. * Check if the given element is fixed or is inside a fixed parent
  34936. * @method
  34937. * @memberof Popper.Utils
  34938. * @argument {Element} element
  34939. * @argument {Element} customContainer
  34940. * @returns {Boolean} answer to "isFixed?"
  34941. */
  34942. function isFixed(element) {
  34943. var nodeName = element.nodeName;
  34944. if (nodeName === 'BODY' || nodeName === 'HTML') {
  34945. return false;
  34946. }
  34947. if (getStyleComputedProperty(element, 'position') === 'fixed') {
  34948. return true;
  34949. }
  34950. var parentNode = getParentNode(element);
  34951. if (!parentNode) {
  34952. return false;
  34953. }
  34954. return isFixed(parentNode);
  34955. }
  34956. /**
  34957. * Finds the first parent of an element that has a transformed property defined
  34958. * @method
  34959. * @memberof Popper.Utils
  34960. * @argument {Element} element
  34961. * @returns {Element} first transformed parent or documentElement
  34962. */
  34963. function getFixedPositionOffsetParent(element) {
  34964. // This check is needed to avoid errors in case one of the elements isn't defined for any reason
  34965. if (!element || !element.parentElement || isIE()) {
  34966. return document.documentElement;
  34967. }
  34968. var el = element.parentElement;
  34969. while (el && getStyleComputedProperty(el, 'transform') === 'none') {
  34970. el = el.parentElement;
  34971. }
  34972. return el || document.documentElement;
  34973. }
  34974. /**
  34975. * Computed the boundaries limits and return them
  34976. * @method
  34977. * @memberof Popper.Utils
  34978. * @param {HTMLElement} popper
  34979. * @param {HTMLElement} reference
  34980. * @param {number} padding
  34981. * @param {HTMLElement} boundariesElement - Element used to define the boundaries
  34982. * @param {Boolean} fixedPosition - Is in fixed position mode
  34983. * @returns {Object} Coordinates of the boundaries
  34984. */
  34985. function getBoundaries(popper, reference, padding, boundariesElement) {
  34986. var fixedPosition = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
  34987. // NOTE: 1 DOM access here
  34988. var boundaries = { top: 0, left: 0 };
  34989. var offsetParent = fixedPosition ? getFixedPositionOffsetParent(popper) : findCommonOffsetParent(popper, getReferenceNode(reference));
  34990. // Handle viewport case
  34991. if (boundariesElement === 'viewport') {
  34992. boundaries = getViewportOffsetRectRelativeToArtbitraryNode(offsetParent, fixedPosition);
  34993. } else {
  34994. // Handle other cases based on DOM element used as boundaries
  34995. var boundariesNode = void 0;
  34996. if (boundariesElement === 'scrollParent') {
  34997. boundariesNode = getScrollParent(getParentNode(reference));
  34998. if (boundariesNode.nodeName === 'BODY') {
  34999. boundariesNode = popper.ownerDocument.documentElement;
  35000. }
  35001. } else if (boundariesElement === 'window') {
  35002. boundariesNode = popper.ownerDocument.documentElement;
  35003. } else {
  35004. boundariesNode = boundariesElement;
  35005. }
  35006. var offsets = getOffsetRectRelativeToArbitraryNode(boundariesNode, offsetParent, fixedPosition);
  35007. // In case of HTML, we need a different computation
  35008. if (boundariesNode.nodeName === 'HTML' && !isFixed(offsetParent)) {
  35009. var _getWindowSizes = getWindowSizes(popper.ownerDocument),
  35010. height = _getWindowSizes.height,
  35011. width = _getWindowSizes.width;
  35012. boundaries.top += offsets.top - offsets.marginTop;
  35013. boundaries.bottom = height + offsets.top;
  35014. boundaries.left += offsets.left - offsets.marginLeft;
  35015. boundaries.right = width + offsets.left;
  35016. } else {
  35017. // for all the other DOM elements, this one is good
  35018. boundaries = offsets;
  35019. }
  35020. }
  35021. // Add paddings
  35022. padding = padding || 0;
  35023. var isPaddingNumber = typeof padding === 'number';
  35024. boundaries.left += isPaddingNumber ? padding : padding.left || 0;
  35025. boundaries.top += isPaddingNumber ? padding : padding.top || 0;
  35026. boundaries.right -= isPaddingNumber ? padding : padding.right || 0;
  35027. boundaries.bottom -= isPaddingNumber ? padding : padding.bottom || 0;
  35028. return boundaries;
  35029. }
  35030. function getArea(_ref) {
  35031. var width = _ref.width,
  35032. height = _ref.height;
  35033. return width * height;
  35034. }
  35035. /**
  35036. * Utility used to transform the `auto` placement to the placement with more
  35037. * available space.
  35038. * @method
  35039. * @memberof Popper.Utils
  35040. * @argument {Object} data - The data object generated by update method
  35041. * @argument {Object} options - Modifiers configuration and options
  35042. * @returns {Object} The data object, properly modified
  35043. */
  35044. function computeAutoPlacement(placement, refRect, popper, reference, boundariesElement) {
  35045. var padding = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 0;
  35046. if (placement.indexOf('auto') === -1) {
  35047. return placement;
  35048. }
  35049. var boundaries = getBoundaries(popper, reference, padding, boundariesElement);
  35050. var rects = {
  35051. top: {
  35052. width: boundaries.width,
  35053. height: refRect.top - boundaries.top
  35054. },
  35055. right: {
  35056. width: boundaries.right - refRect.right,
  35057. height: boundaries.height
  35058. },
  35059. bottom: {
  35060. width: boundaries.width,
  35061. height: boundaries.bottom - refRect.bottom
  35062. },
  35063. left: {
  35064. width: refRect.left - boundaries.left,
  35065. height: boundaries.height
  35066. }
  35067. };
  35068. var sortedAreas = Object.keys(rects).map(function (key) {
  35069. return _extends({
  35070. key: key
  35071. }, rects[key], {
  35072. area: getArea(rects[key])
  35073. });
  35074. }).sort(function (a, b) {
  35075. return b.area - a.area;
  35076. });
  35077. var filteredAreas = sortedAreas.filter(function (_ref2) {
  35078. var width = _ref2.width,
  35079. height = _ref2.height;
  35080. return width >= popper.clientWidth && height >= popper.clientHeight;
  35081. });
  35082. var computedPlacement = filteredAreas.length > 0 ? filteredAreas[0].key : sortedAreas[0].key;
  35083. var variation = placement.split('-')[1];
  35084. return computedPlacement + (variation ? '-' + variation : '');
  35085. }
  35086. /**
  35087. * Get offsets to the reference element
  35088. * @method
  35089. * @memberof Popper.Utils
  35090. * @param {Object} state
  35091. * @param {Element} popper - the popper element
  35092. * @param {Element} reference - the reference element (the popper will be relative to this)
  35093. * @param {Element} fixedPosition - is in fixed position mode
  35094. * @returns {Object} An object containing the offsets which will be applied to the popper
  35095. */
  35096. function getReferenceOffsets(state, popper, reference) {
  35097. var fixedPosition = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
  35098. var commonOffsetParent = fixedPosition ? getFixedPositionOffsetParent(popper) : findCommonOffsetParent(popper, getReferenceNode(reference));
  35099. return getOffsetRectRelativeToArbitraryNode(reference, commonOffsetParent, fixedPosition);
  35100. }
  35101. /**
  35102. * Get the outer sizes of the given element (offset size + margins)
  35103. * @method
  35104. * @memberof Popper.Utils
  35105. * @argument {Element} element
  35106. * @returns {Object} object containing width and height properties
  35107. */
  35108. function getOuterSizes(element) {
  35109. var window = element.ownerDocument.defaultView;
  35110. var styles = window.getComputedStyle(element);
  35111. var x = parseFloat(styles.marginTop || 0) + parseFloat(styles.marginBottom || 0);
  35112. var y = parseFloat(styles.marginLeft || 0) + parseFloat(styles.marginRight || 0);
  35113. var result = {
  35114. width: element.offsetWidth + y,
  35115. height: element.offsetHeight + x
  35116. };
  35117. return result;
  35118. }
  35119. /**
  35120. * Get the opposite placement of the given one
  35121. * @method
  35122. * @memberof Popper.Utils
  35123. * @argument {String} placement
  35124. * @returns {String} flipped placement
  35125. */
  35126. function getOppositePlacement(placement) {
  35127. var hash = { left: 'right', right: 'left', bottom: 'top', top: 'bottom' };
  35128. return placement.replace(/left|right|bottom|top/g, function (matched) {
  35129. return hash[matched];
  35130. });
  35131. }
  35132. /**
  35133. * Get offsets to the popper
  35134. * @method
  35135. * @memberof Popper.Utils
  35136. * @param {Object} position - CSS position the Popper will get applied
  35137. * @param {HTMLElement} popper - the popper element
  35138. * @param {Object} referenceOffsets - the reference offsets (the popper will be relative to this)
  35139. * @param {String} placement - one of the valid placement options
  35140. * @returns {Object} popperOffsets - An object containing the offsets which will be applied to the popper
  35141. */
  35142. function getPopperOffsets(popper, referenceOffsets, placement) {
  35143. placement = placement.split('-')[0];
  35144. // Get popper node sizes
  35145. var popperRect = getOuterSizes(popper);
  35146. // Add position, width and height to our offsets object
  35147. var popperOffsets = {
  35148. width: popperRect.width,
  35149. height: popperRect.height
  35150. };
  35151. // depending by the popper placement we have to compute its offsets slightly differently
  35152. var isHoriz = ['right', 'left'].indexOf(placement) !== -1;
  35153. var mainSide = isHoriz ? 'top' : 'left';
  35154. var secondarySide = isHoriz ? 'left' : 'top';
  35155. var measurement = isHoriz ? 'height' : 'width';
  35156. var secondaryMeasurement = !isHoriz ? 'height' : 'width';
  35157. popperOffsets[mainSide] = referenceOffsets[mainSide] + referenceOffsets[measurement] / 2 - popperRect[measurement] / 2;
  35158. if (placement === secondarySide) {
  35159. popperOffsets[secondarySide] = referenceOffsets[secondarySide] - popperRect[secondaryMeasurement];
  35160. } else {
  35161. popperOffsets[secondarySide] = referenceOffsets[getOppositePlacement(secondarySide)];
  35162. }
  35163. return popperOffsets;
  35164. }
  35165. /**
  35166. * Mimics the `find` method of Array
  35167. * @method
  35168. * @memberof Popper.Utils
  35169. * @argument {Array} arr
  35170. * @argument prop
  35171. * @argument value
  35172. * @returns index or -1
  35173. */
  35174. function find(arr, check) {
  35175. // use native find if supported
  35176. if (Array.prototype.find) {
  35177. return arr.find(check);
  35178. }
  35179. // use `filter` to obtain the same behavior of `find`
  35180. return arr.filter(check)[0];
  35181. }
  35182. /**
  35183. * Return the index of the matching object
  35184. * @method
  35185. * @memberof Popper.Utils
  35186. * @argument {Array} arr
  35187. * @argument prop
  35188. * @argument value
  35189. * @returns index or -1
  35190. */
  35191. function findIndex(arr, prop, value) {
  35192. // use native findIndex if supported
  35193. if (Array.prototype.findIndex) {
  35194. return arr.findIndex(function (cur) {
  35195. return cur[prop] === value;
  35196. });
  35197. }
  35198. // use `find` + `indexOf` if `findIndex` isn't supported
  35199. var match = find(arr, function (obj) {
  35200. return obj[prop] === value;
  35201. });
  35202. return arr.indexOf(match);
  35203. }
  35204. /**
  35205. * Loop trough the list of modifiers and run them in order,
  35206. * each of them will then edit the data object.
  35207. * @method
  35208. * @memberof Popper.Utils
  35209. * @param {dataObject} data
  35210. * @param {Array} modifiers
  35211. * @param {String} ends - Optional modifier name used as stopper
  35212. * @returns {dataObject}
  35213. */
  35214. function runModifiers(modifiers, data, ends) {
  35215. var modifiersToRun = ends === undefined ? modifiers : modifiers.slice(0, findIndex(modifiers, 'name', ends));
  35216. modifiersToRun.forEach(function (modifier) {
  35217. if (modifier['function']) {
  35218. // eslint-disable-line dot-notation
  35219. console.warn('`modifier.function` is deprecated, use `modifier.fn`!');
  35220. }
  35221. var fn = modifier['function'] || modifier.fn; // eslint-disable-line dot-notation
  35222. if (modifier.enabled && isFunction(fn)) {
  35223. // Add properties to offsets to make them a complete clientRect object
  35224. // we do this before each modifier to make sure the previous one doesn't
  35225. // mess with these values
  35226. data.offsets.popper = getClientRect(data.offsets.popper);
  35227. data.offsets.reference = getClientRect(data.offsets.reference);
  35228. data = fn(data, modifier);
  35229. }
  35230. });
  35231. return data;
  35232. }
  35233. /**
  35234. * Updates the position of the popper, computing the new offsets and applying
  35235. * the new style.<br />
  35236. * Prefer `scheduleUpdate` over `update` because of performance reasons.
  35237. * @method
  35238. * @memberof Popper
  35239. */
  35240. function update() {
  35241. // if popper is destroyed, don't perform any further update
  35242. if (this.state.isDestroyed) {
  35243. return;
  35244. }
  35245. var data = {
  35246. instance: this,
  35247. styles: {},
  35248. arrowStyles: {},
  35249. attributes: {},
  35250. flipped: false,
  35251. offsets: {}
  35252. };
  35253. // compute reference element offsets
  35254. data.offsets.reference = getReferenceOffsets(this.state, this.popper, this.reference, this.options.positionFixed);
  35255. // compute auto placement, store placement inside the data object,
  35256. // modifiers will be able to edit `placement` if needed
  35257. // and refer to originalPlacement to know the original value
  35258. data.placement = computeAutoPlacement(this.options.placement, data.offsets.reference, this.popper, this.reference, this.options.modifiers.flip.boundariesElement, this.options.modifiers.flip.padding);
  35259. // store the computed placement inside `originalPlacement`
  35260. data.originalPlacement = data.placement;
  35261. data.positionFixed = this.options.positionFixed;
  35262. // compute the popper offsets
  35263. data.offsets.popper = getPopperOffsets(this.popper, data.offsets.reference, data.placement);
  35264. data.offsets.popper.position = this.options.positionFixed ? 'fixed' : 'absolute';
  35265. // run the modifiers
  35266. data = runModifiers(this.modifiers, data);
  35267. // the first `update` will call `onCreate` callback
  35268. // the other ones will call `onUpdate` callback
  35269. if (!this.state.isCreated) {
  35270. this.state.isCreated = true;
  35271. this.options.onCreate(data);
  35272. } else {
  35273. this.options.onUpdate(data);
  35274. }
  35275. }
  35276. /**
  35277. * Helper used to know if the given modifier is enabled.
  35278. * @method
  35279. * @memberof Popper.Utils
  35280. * @returns {Boolean}
  35281. */
  35282. function isModifierEnabled(modifiers, modifierName) {
  35283. return modifiers.some(function (_ref) {
  35284. var name = _ref.name,
  35285. enabled = _ref.enabled;
  35286. return enabled && name === modifierName;
  35287. });
  35288. }
  35289. /**
  35290. * Get the prefixed supported property name
  35291. * @method
  35292. * @memberof Popper.Utils
  35293. * @argument {String} property (camelCase)
  35294. * @returns {String} prefixed property (camelCase or PascalCase, depending on the vendor prefix)
  35295. */
  35296. function getSupportedPropertyName(property) {
  35297. var prefixes = [false, 'ms', 'Webkit', 'Moz', 'O'];
  35298. var upperProp = property.charAt(0).toUpperCase() + property.slice(1);
  35299. for (var i = 0; i < prefixes.length; i++) {
  35300. var prefix = prefixes[i];
  35301. var toCheck = prefix ? '' + prefix + upperProp : property;
  35302. if (typeof document.body.style[toCheck] !== 'undefined') {
  35303. return toCheck;
  35304. }
  35305. }
  35306. return null;
  35307. }
  35308. /**
  35309. * Destroys the popper.
  35310. * @method
  35311. * @memberof Popper
  35312. */
  35313. function destroy() {
  35314. this.state.isDestroyed = true;
  35315. // touch DOM only if `applyStyle` modifier is enabled
  35316. if (isModifierEnabled(this.modifiers, 'applyStyle')) {
  35317. this.popper.removeAttribute('x-placement');
  35318. this.popper.style.position = '';
  35319. this.popper.style.top = '';
  35320. this.popper.style.left = '';
  35321. this.popper.style.right = '';
  35322. this.popper.style.bottom = '';
  35323. this.popper.style.willChange = '';
  35324. this.popper.style[getSupportedPropertyName('transform')] = '';
  35325. }
  35326. this.disableEventListeners();
  35327. // remove the popper if user explicitly asked for the deletion on destroy
  35328. // do not use `remove` because IE11 doesn't support it
  35329. if (this.options.removeOnDestroy) {
  35330. this.popper.parentNode.removeChild(this.popper);
  35331. }
  35332. return this;
  35333. }
  35334. /**
  35335. * Get the window associated with the element
  35336. * @argument {Element} element
  35337. * @returns {Window}
  35338. */
  35339. function getWindow(element) {
  35340. var ownerDocument = element.ownerDocument;
  35341. return ownerDocument ? ownerDocument.defaultView : window;
  35342. }
  35343. function attachToScrollParents(scrollParent, event, callback, scrollParents) {
  35344. var isBody = scrollParent.nodeName === 'BODY';
  35345. var target = isBody ? scrollParent.ownerDocument.defaultView : scrollParent;
  35346. target.addEventListener(event, callback, { passive: true });
  35347. if (!isBody) {
  35348. attachToScrollParents(getScrollParent(target.parentNode), event, callback, scrollParents);
  35349. }
  35350. scrollParents.push(target);
  35351. }
  35352. /**
  35353. * Setup needed event listeners used to update the popper position
  35354. * @method
  35355. * @memberof Popper.Utils
  35356. * @private
  35357. */
  35358. function setupEventListeners(reference, options, state, updateBound) {
  35359. // Resize event listener on window
  35360. state.updateBound = updateBound;
  35361. getWindow(reference).addEventListener('resize', state.updateBound, { passive: true });
  35362. // Scroll event listener on scroll parents
  35363. var scrollElement = getScrollParent(reference);
  35364. attachToScrollParents(scrollElement, 'scroll', state.updateBound, state.scrollParents);
  35365. state.scrollElement = scrollElement;
  35366. state.eventsEnabled = true;
  35367. return state;
  35368. }
  35369. /**
  35370. * It will add resize/scroll events and start recalculating
  35371. * position of the popper element when they are triggered.
  35372. * @method
  35373. * @memberof Popper
  35374. */
  35375. function enableEventListeners() {
  35376. if (!this.state.eventsEnabled) {
  35377. this.state = setupEventListeners(this.reference, this.options, this.state, this.scheduleUpdate);
  35378. }
  35379. }
  35380. /**
  35381. * Remove event listeners used to update the popper position
  35382. * @method
  35383. * @memberof Popper.Utils
  35384. * @private
  35385. */
  35386. function removeEventListeners(reference, state) {
  35387. // Remove resize event listener on window
  35388. getWindow(reference).removeEventListener('resize', state.updateBound);
  35389. // Remove scroll event listener on scroll parents
  35390. state.scrollParents.forEach(function (target) {
  35391. target.removeEventListener('scroll', state.updateBound);
  35392. });
  35393. // Reset state
  35394. state.updateBound = null;
  35395. state.scrollParents = [];
  35396. state.scrollElement = null;
  35397. state.eventsEnabled = false;
  35398. return state;
  35399. }
  35400. /**
  35401. * It will remove resize/scroll events and won't recalculate popper position
  35402. * when they are triggered. It also won't trigger `onUpdate` callback anymore,
  35403. * unless you call `update` method manually.
  35404. * @method
  35405. * @memberof Popper
  35406. */
  35407. function disableEventListeners() {
  35408. if (this.state.eventsEnabled) {
  35409. cancelAnimationFrame(this.scheduleUpdate);
  35410. this.state = removeEventListeners(this.reference, this.state);
  35411. }
  35412. }
  35413. /**
  35414. * Tells if a given input is a number
  35415. * @method
  35416. * @memberof Popper.Utils
  35417. * @param {*} input to check
  35418. * @return {Boolean}
  35419. */
  35420. function isNumeric(n) {
  35421. return n !== '' && !isNaN(parseFloat(n)) && isFinite(n);
  35422. }
  35423. /**
  35424. * Set the style to the given popper
  35425. * @method
  35426. * @memberof Popper.Utils
  35427. * @argument {Element} element - Element to apply the style to
  35428. * @argument {Object} styles
  35429. * Object with a list of properties and values which will be applied to the element
  35430. */
  35431. function setStyles(element, styles) {
  35432. Object.keys(styles).forEach(function (prop) {
  35433. var unit = '';
  35434. // add unit if the value is numeric and is one of the following
  35435. if (['width', 'height', 'top', 'right', 'bottom', 'left'].indexOf(prop) !== -1 && isNumeric(styles[prop])) {
  35436. unit = 'px';
  35437. }
  35438. element.style[prop] = styles[prop] + unit;
  35439. });
  35440. }
  35441. /**
  35442. * Set the attributes to the given popper
  35443. * @method
  35444. * @memberof Popper.Utils
  35445. * @argument {Element} element - Element to apply the attributes to
  35446. * @argument {Object} styles
  35447. * Object with a list of properties and values which will be applied to the element
  35448. */
  35449. function setAttributes(element, attributes) {
  35450. Object.keys(attributes).forEach(function (prop) {
  35451. var value = attributes[prop];
  35452. if (value !== false) {
  35453. element.setAttribute(prop, attributes[prop]);
  35454. } else {
  35455. element.removeAttribute(prop);
  35456. }
  35457. });
  35458. }
  35459. /**
  35460. * @function
  35461. * @memberof Modifiers
  35462. * @argument {Object} data - The data object generated by `update` method
  35463. * @argument {Object} data.styles - List of style properties - values to apply to popper element
  35464. * @argument {Object} data.attributes - List of attribute properties - values to apply to popper element
  35465. * @argument {Object} options - Modifiers configuration and options
  35466. * @returns {Object} The same data object
  35467. */
  35468. function applyStyle(data) {
  35469. // any property present in `data.styles` will be applied to the popper,
  35470. // in this way we can make the 3rd party modifiers add custom styles to it
  35471. // Be aware, modifiers could override the properties defined in the previous
  35472. // lines of this modifier!
  35473. setStyles(data.instance.popper, data.styles);
  35474. // any property present in `data.attributes` will be applied to the popper,
  35475. // they will be set as HTML attributes of the element
  35476. setAttributes(data.instance.popper, data.attributes);
  35477. // if arrowElement is defined and arrowStyles has some properties
  35478. if (data.arrowElement && Object.keys(data.arrowStyles).length) {
  35479. setStyles(data.arrowElement, data.arrowStyles);
  35480. }
  35481. return data;
  35482. }
  35483. /**
  35484. * Set the x-placement attribute before everything else because it could be used
  35485. * to add margins to the popper margins needs to be calculated to get the
  35486. * correct popper offsets.
  35487. * @method
  35488. * @memberof Popper.modifiers
  35489. * @param {HTMLElement} reference - The reference element used to position the popper
  35490. * @param {HTMLElement} popper - The HTML element used as popper
  35491. * @param {Object} options - Popper.js options
  35492. */
  35493. function applyStyleOnLoad(reference, popper, options, modifierOptions, state) {
  35494. // compute reference element offsets
  35495. var referenceOffsets = getReferenceOffsets(state, popper, reference, options.positionFixed);
  35496. // compute auto placement, store placement inside the data object,
  35497. // modifiers will be able to edit `placement` if needed
  35498. // and refer to originalPlacement to know the original value
  35499. var placement = computeAutoPlacement(options.placement, referenceOffsets, popper, reference, options.modifiers.flip.boundariesElement, options.modifiers.flip.padding);
  35500. popper.setAttribute('x-placement', placement);
  35501. // Apply `position` to popper before anything else because
  35502. // without the position applied we can't guarantee correct computations
  35503. setStyles(popper, { position: options.positionFixed ? 'fixed' : 'absolute' });
  35504. return options;
  35505. }
  35506. /**
  35507. * @function
  35508. * @memberof Popper.Utils
  35509. * @argument {Object} data - The data object generated by `update` method
  35510. * @argument {Boolean} shouldRound - If the offsets should be rounded at all
  35511. * @returns {Object} The popper's position offsets rounded
  35512. *
  35513. * The tale of pixel-perfect positioning. It's still not 100% perfect, but as
  35514. * good as it can be within reason.
  35515. * Discussion here: https://github.com/FezVrasta/popper.js/pull/715
  35516. *
  35517. * Low DPI screens cause a popper to be blurry if not using full pixels (Safari
  35518. * as well on High DPI screens).
  35519. *
  35520. * Firefox prefers no rounding for positioning and does not have blurriness on
  35521. * high DPI screens.
  35522. *
  35523. * Only horizontal placement and left/right values need to be considered.
  35524. */
  35525. function getRoundedOffsets(data, shouldRound) {
  35526. var _data$offsets = data.offsets,
  35527. popper = _data$offsets.popper,
  35528. reference = _data$offsets.reference;
  35529. var round = Math.round,
  35530. floor = Math.floor;
  35531. var noRound = function noRound(v) {
  35532. return v;
  35533. };
  35534. var referenceWidth = round(reference.width);
  35535. var popperWidth = round(popper.width);
  35536. var isVertical = ['left', 'right'].indexOf(data.placement) !== -1;
  35537. var isVariation = data.placement.indexOf('-') !== -1;
  35538. var sameWidthParity = referenceWidth % 2 === popperWidth % 2;
  35539. var bothOddWidth = referenceWidth % 2 === 1 && popperWidth % 2 === 1;
  35540. var horizontalToInteger = !shouldRound ? noRound : isVertical || isVariation || sameWidthParity ? round : floor;
  35541. var verticalToInteger = !shouldRound ? noRound : round;
  35542. return {
  35543. left: horizontalToInteger(bothOddWidth && !isVariation && shouldRound ? popper.left - 1 : popper.left),
  35544. top: verticalToInteger(popper.top),
  35545. bottom: verticalToInteger(popper.bottom),
  35546. right: horizontalToInteger(popper.right)
  35547. };
  35548. }
  35549. var isFirefox = isBrowser && /Firefox/i.test(navigator.userAgent);
  35550. /**
  35551. * @function
  35552. * @memberof Modifiers
  35553. * @argument {Object} data - The data object generated by `update` method
  35554. * @argument {Object} options - Modifiers configuration and options
  35555. * @returns {Object} The data object, properly modified
  35556. */
  35557. function computeStyle(data, options) {
  35558. var x = options.x,
  35559. y = options.y;
  35560. var popper = data.offsets.popper;
  35561. // Remove this legacy support in Popper.js v2
  35562. var legacyGpuAccelerationOption = find(data.instance.modifiers, function (modifier) {
  35563. return modifier.name === 'applyStyle';
  35564. }).gpuAcceleration;
  35565. if (legacyGpuAccelerationOption !== undefined) {
  35566. console.warn('WARNING: `gpuAcceleration` option moved to `computeStyle` modifier and will not be supported in future versions of Popper.js!');
  35567. }
  35568. var gpuAcceleration = legacyGpuAccelerationOption !== undefined ? legacyGpuAccelerationOption : options.gpuAcceleration;
  35569. var offsetParent = getOffsetParent(data.instance.popper);
  35570. var offsetParentRect = getBoundingClientRect(offsetParent);
  35571. // Styles
  35572. var styles = {
  35573. position: popper.position
  35574. };
  35575. var offsets = getRoundedOffsets(data, window.devicePixelRatio < 2 || !isFirefox);
  35576. var sideA = x === 'bottom' ? 'top' : 'bottom';
  35577. var sideB = y === 'right' ? 'left' : 'right';
  35578. // if gpuAcceleration is set to `true` and transform is supported,
  35579. // we use `translate3d` to apply the position to the popper we
  35580. // automatically use the supported prefixed version if needed
  35581. var prefixedProperty = getSupportedPropertyName('transform');
  35582. // now, let's make a step back and look at this code closely (wtf?)
  35583. // If the content of the popper grows once it's been positioned, it
  35584. // may happen that the popper gets misplaced because of the new content
  35585. // overflowing its reference element
  35586. // To avoid this problem, we provide two options (x and y), which allow
  35587. // the consumer to define the offset origin.
  35588. // If we position a popper on top of a reference element, we can set
  35589. // `x` to `top` to make the popper grow towards its top instead of
  35590. // its bottom.
  35591. var left = void 0,
  35592. top = void 0;
  35593. if (sideA === 'bottom') {
  35594. // when offsetParent is <html> the positioning is relative to the bottom of the screen (excluding the scrollbar)
  35595. // and not the bottom of the html element
  35596. if (offsetParent.nodeName === 'HTML') {
  35597. top = -offsetParent.clientHeight + offsets.bottom;
  35598. } else {
  35599. top = -offsetParentRect.height + offsets.bottom;
  35600. }
  35601. } else {
  35602. top = offsets.top;
  35603. }
  35604. if (sideB === 'right') {
  35605. if (offsetParent.nodeName === 'HTML') {
  35606. left = -offsetParent.clientWidth + offsets.right;
  35607. } else {
  35608. left = -offsetParentRect.width + offsets.right;
  35609. }
  35610. } else {
  35611. left = offsets.left;
  35612. }
  35613. if (gpuAcceleration && prefixedProperty) {
  35614. styles[prefixedProperty] = 'translate3d(' + left + 'px, ' + top + 'px, 0)';
  35615. styles[sideA] = 0;
  35616. styles[sideB] = 0;
  35617. styles.willChange = 'transform';
  35618. } else {
  35619. // othwerise, we use the standard `top`, `left`, `bottom` and `right` properties
  35620. var invertTop = sideA === 'bottom' ? -1 : 1;
  35621. var invertLeft = sideB === 'right' ? -1 : 1;
  35622. styles[sideA] = top * invertTop;
  35623. styles[sideB] = left * invertLeft;
  35624. styles.willChange = sideA + ', ' + sideB;
  35625. }
  35626. // Attributes
  35627. var attributes = {
  35628. 'x-placement': data.placement
  35629. };
  35630. // Update `data` attributes, styles and arrowStyles
  35631. data.attributes = _extends({}, attributes, data.attributes);
  35632. data.styles = _extends({}, styles, data.styles);
  35633. data.arrowStyles = _extends({}, data.offsets.arrow, data.arrowStyles);
  35634. return data;
  35635. }
  35636. /**
  35637. * Helper used to know if the given modifier depends from another one.<br />
  35638. * It checks if the needed modifier is listed and enabled.
  35639. * @method
  35640. * @memberof Popper.Utils
  35641. * @param {Array} modifiers - list of modifiers
  35642. * @param {String} requestingName - name of requesting modifier
  35643. * @param {String} requestedName - name of requested modifier
  35644. * @returns {Boolean}
  35645. */
  35646. function isModifierRequired(modifiers, requestingName, requestedName) {
  35647. var requesting = find(modifiers, function (_ref) {
  35648. var name = _ref.name;
  35649. return name === requestingName;
  35650. });
  35651. var isRequired = !!requesting && modifiers.some(function (modifier) {
  35652. return modifier.name === requestedName && modifier.enabled && modifier.order < requesting.order;
  35653. });
  35654. if (!isRequired) {
  35655. var _requesting = '`' + requestingName + '`';
  35656. var requested = '`' + requestedName + '`';
  35657. console.warn(requested + ' modifier is required by ' + _requesting + ' modifier in order to work, be sure to include it before ' + _requesting + '!');
  35658. }
  35659. return isRequired;
  35660. }
  35661. /**
  35662. * @function
  35663. * @memberof Modifiers
  35664. * @argument {Object} data - The data object generated by update method
  35665. * @argument {Object} options - Modifiers configuration and options
  35666. * @returns {Object} The data object, properly modified
  35667. */
  35668. function arrow(data, options) {
  35669. var _data$offsets$arrow;
  35670. // arrow depends on keepTogether in order to work
  35671. if (!isModifierRequired(data.instance.modifiers, 'arrow', 'keepTogether')) {
  35672. return data;
  35673. }
  35674. var arrowElement = options.element;
  35675. // if arrowElement is a string, suppose it's a CSS selector
  35676. if (typeof arrowElement === 'string') {
  35677. arrowElement = data.instance.popper.querySelector(arrowElement);
  35678. // if arrowElement is not found, don't run the modifier
  35679. if (!arrowElement) {
  35680. return data;
  35681. }
  35682. } else {
  35683. // if the arrowElement isn't a query selector we must check that the
  35684. // provided DOM node is child of its popper node
  35685. if (!data.instance.popper.contains(arrowElement)) {
  35686. console.warn('WARNING: `arrow.element` must be child of its popper element!');
  35687. return data;
  35688. }
  35689. }
  35690. var placement = data.placement.split('-')[0];
  35691. var _data$offsets = data.offsets,
  35692. popper = _data$offsets.popper,
  35693. reference = _data$offsets.reference;
  35694. var isVertical = ['left', 'right'].indexOf(placement) !== -1;
  35695. var len = isVertical ? 'height' : 'width';
  35696. var sideCapitalized = isVertical ? 'Top' : 'Left';
  35697. var side = sideCapitalized.toLowerCase();
  35698. var altSide = isVertical ? 'left' : 'top';
  35699. var opSide = isVertical ? 'bottom' : 'right';
  35700. var arrowElementSize = getOuterSizes(arrowElement)[len];
  35701. //
  35702. // extends keepTogether behavior making sure the popper and its
  35703. // reference have enough pixels in conjunction
  35704. //
  35705. // top/left side
  35706. if (reference[opSide] - arrowElementSize < popper[side]) {
  35707. data.offsets.popper[side] -= popper[side] - (reference[opSide] - arrowElementSize);
  35708. }
  35709. // bottom/right side
  35710. if (reference[side] + arrowElementSize > popper[opSide]) {
  35711. data.offsets.popper[side] += reference[side] + arrowElementSize - popper[opSide];
  35712. }
  35713. data.offsets.popper = getClientRect(data.offsets.popper);
  35714. // compute center of the popper
  35715. var center = reference[side] + reference[len] / 2 - arrowElementSize / 2;
  35716. // Compute the sideValue using the updated popper offsets
  35717. // take popper margin in account because we don't have this info available
  35718. var css = getStyleComputedProperty(data.instance.popper);
  35719. var popperMarginSide = parseFloat(css['margin' + sideCapitalized]);
  35720. var popperBorderSide = parseFloat(css['border' + sideCapitalized + 'Width']);
  35721. var sideValue = center - data.offsets.popper[side] - popperMarginSide - popperBorderSide;
  35722. // prevent arrowElement from being placed not contiguously to its popper
  35723. sideValue = Math.max(Math.min(popper[len] - arrowElementSize, sideValue), 0);
  35724. data.arrowElement = arrowElement;
  35725. data.offsets.arrow = (_data$offsets$arrow = {}, defineProperty(_data$offsets$arrow, side, Math.round(sideValue)), defineProperty(_data$offsets$arrow, altSide, ''), _data$offsets$arrow);
  35726. return data;
  35727. }
  35728. /**
  35729. * Get the opposite placement variation of the given one
  35730. * @method
  35731. * @memberof Popper.Utils
  35732. * @argument {String} placement variation
  35733. * @returns {String} flipped placement variation
  35734. */
  35735. function getOppositeVariation(variation) {
  35736. if (variation === 'end') {
  35737. return 'start';
  35738. } else if (variation === 'start') {
  35739. return 'end';
  35740. }
  35741. return variation;
  35742. }
  35743. /**
  35744. * List of accepted placements to use as values of the `placement` option.<br />
  35745. * Valid placements are:
  35746. * - `auto`
  35747. * - `top`
  35748. * - `right`
  35749. * - `bottom`
  35750. * - `left`
  35751. *
  35752. * Each placement can have a variation from this list:
  35753. * - `-start`
  35754. * - `-end`
  35755. *
  35756. * Variations are interpreted easily if you think of them as the left to right
  35757. * written languages. Horizontally (`top` and `bottom`), `start` is left and `end`
  35758. * is right.<br />
  35759. * Vertically (`left` and `right`), `start` is top and `end` is bottom.
  35760. *
  35761. * Some valid examples are:
  35762. * - `top-end` (on top of reference, right aligned)
  35763. * - `right-start` (on right of reference, top aligned)
  35764. * - `bottom` (on bottom, centered)
  35765. * - `auto-end` (on the side with more space available, alignment depends by placement)
  35766. *
  35767. * @static
  35768. * @type {Array}
  35769. * @enum {String}
  35770. * @readonly
  35771. * @method placements
  35772. * @memberof Popper
  35773. */
  35774. 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'];
  35775. // Get rid of `auto` `auto-start` and `auto-end`
  35776. var validPlacements = placements.slice(3);
  35777. /**
  35778. * Given an initial placement, returns all the subsequent placements
  35779. * clockwise (or counter-clockwise).
  35780. *
  35781. * @method
  35782. * @memberof Popper.Utils
  35783. * @argument {String} placement - A valid placement (it accepts variations)
  35784. * @argument {Boolean} counter - Set to true to walk the placements counterclockwise
  35785. * @returns {Array} placements including their variations
  35786. */
  35787. function clockwise(placement) {
  35788. var counter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  35789. var index = validPlacements.indexOf(placement);
  35790. var arr = validPlacements.slice(index + 1).concat(validPlacements.slice(0, index));
  35791. return counter ? arr.reverse() : arr;
  35792. }
  35793. var BEHAVIORS = {
  35794. FLIP: 'flip',
  35795. CLOCKWISE: 'clockwise',
  35796. COUNTERCLOCKWISE: 'counterclockwise'
  35797. };
  35798. /**
  35799. * @function
  35800. * @memberof Modifiers
  35801. * @argument {Object} data - The data object generated by update method
  35802. * @argument {Object} options - Modifiers configuration and options
  35803. * @returns {Object} The data object, properly modified
  35804. */
  35805. function flip(data, options) {
  35806. // if `inner` modifier is enabled, we can't use the `flip` modifier
  35807. if (isModifierEnabled(data.instance.modifiers, 'inner')) {
  35808. return data;
  35809. }
  35810. if (data.flipped && data.placement === data.originalPlacement) {
  35811. // seems like flip is trying to loop, probably there's not enough space on any of the flippable sides
  35812. return data;
  35813. }
  35814. var boundaries = getBoundaries(data.instance.popper, data.instance.reference, options.padding, options.boundariesElement, data.positionFixed);
  35815. var placement = data.placement.split('-')[0];
  35816. var placementOpposite = getOppositePlacement(placement);
  35817. var variation = data.placement.split('-')[1] || '';
  35818. var flipOrder = [];
  35819. switch (options.behavior) {
  35820. case BEHAVIORS.FLIP:
  35821. flipOrder = [placement, placementOpposite];
  35822. break;
  35823. case BEHAVIORS.CLOCKWISE:
  35824. flipOrder = clockwise(placement);
  35825. break;
  35826. case BEHAVIORS.COUNTERCLOCKWISE:
  35827. flipOrder = clockwise(placement, true);
  35828. break;
  35829. default:
  35830. flipOrder = options.behavior;
  35831. }
  35832. flipOrder.forEach(function (step, index) {
  35833. if (placement !== step || flipOrder.length === index + 1) {
  35834. return data;
  35835. }
  35836. placement = data.placement.split('-')[0];
  35837. placementOpposite = getOppositePlacement(placement);
  35838. var popperOffsets = data.offsets.popper;
  35839. var refOffsets = data.offsets.reference;
  35840. // using floor because the reference offsets may contain decimals we are not going to consider here
  35841. var floor = Math.floor;
  35842. 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);
  35843. var overflowsLeft = floor(popperOffsets.left) < floor(boundaries.left);
  35844. var overflowsRight = floor(popperOffsets.right) > floor(boundaries.right);
  35845. var overflowsTop = floor(popperOffsets.top) < floor(boundaries.top);
  35846. var overflowsBottom = floor(popperOffsets.bottom) > floor(boundaries.bottom);
  35847. var overflowsBoundaries = placement === 'left' && overflowsLeft || placement === 'right' && overflowsRight || placement === 'top' && overflowsTop || placement === 'bottom' && overflowsBottom;
  35848. // flip the variation if required
  35849. var isVertical = ['top', 'bottom'].indexOf(placement) !== -1;
  35850. // flips variation if reference element overflows boundaries
  35851. var flippedVariationByRef = !!options.flipVariations && (isVertical && variation === 'start' && overflowsLeft || isVertical && variation === 'end' && overflowsRight || !isVertical && variation === 'start' && overflowsTop || !isVertical && variation === 'end' && overflowsBottom);
  35852. // flips variation if popper content overflows boundaries
  35853. var flippedVariationByContent = !!options.flipVariationsByContent && (isVertical && variation === 'start' && overflowsRight || isVertical && variation === 'end' && overflowsLeft || !isVertical && variation === 'start' && overflowsBottom || !isVertical && variation === 'end' && overflowsTop);
  35854. var flippedVariation = flippedVariationByRef || flippedVariationByContent;
  35855. if (overlapsRef || overflowsBoundaries || flippedVariation) {
  35856. // this boolean to detect any flip loop
  35857. data.flipped = true;
  35858. if (overlapsRef || overflowsBoundaries) {
  35859. placement = flipOrder[index + 1];
  35860. }
  35861. if (flippedVariation) {
  35862. variation = getOppositeVariation(variation);
  35863. }
  35864. data.placement = placement + (variation ? '-' + variation : '');
  35865. // this object contains `position`, we want to preserve it along with
  35866. // any additional property we may add in the future
  35867. data.offsets.popper = _extends({}, data.offsets.popper, getPopperOffsets(data.instance.popper, data.offsets.reference, data.placement));
  35868. data = runModifiers(data.instance.modifiers, data, 'flip');
  35869. }
  35870. });
  35871. return data;
  35872. }
  35873. /**
  35874. * @function
  35875. * @memberof Modifiers
  35876. * @argument {Object} data - The data object generated by update method
  35877. * @argument {Object} options - Modifiers configuration and options
  35878. * @returns {Object} The data object, properly modified
  35879. */
  35880. function keepTogether(data) {
  35881. var _data$offsets = data.offsets,
  35882. popper = _data$offsets.popper,
  35883. reference = _data$offsets.reference;
  35884. var placement = data.placement.split('-')[0];
  35885. var floor = Math.floor;
  35886. var isVertical = ['top', 'bottom'].indexOf(placement) !== -1;
  35887. var side = isVertical ? 'right' : 'bottom';
  35888. var opSide = isVertical ? 'left' : 'top';
  35889. var measurement = isVertical ? 'width' : 'height';
  35890. if (popper[side] < floor(reference[opSide])) {
  35891. data.offsets.popper[opSide] = floor(reference[opSide]) - popper[measurement];
  35892. }
  35893. if (popper[opSide] > floor(reference[side])) {
  35894. data.offsets.popper[opSide] = floor(reference[side]);
  35895. }
  35896. return data;
  35897. }
  35898. /**
  35899. * Converts a string containing value + unit into a px value number
  35900. * @function
  35901. * @memberof {modifiers~offset}
  35902. * @private
  35903. * @argument {String} str - Value + unit string
  35904. * @argument {String} measurement - `height` or `width`
  35905. * @argument {Object} popperOffsets
  35906. * @argument {Object} referenceOffsets
  35907. * @returns {Number|String}
  35908. * Value in pixels, or original string if no values were extracted
  35909. */
  35910. function toValue(str, measurement, popperOffsets, referenceOffsets) {
  35911. // separate value from unit
  35912. var split = str.match(/((?:\-|\+)?\d*\.?\d*)(.*)/);
  35913. var value = +split[1];
  35914. var unit = split[2];
  35915. // If it's not a number it's an operator, I guess
  35916. if (!value) {
  35917. return str;
  35918. }
  35919. if (unit.indexOf('%') === 0) {
  35920. var element = void 0;
  35921. switch (unit) {
  35922. case '%p':
  35923. element = popperOffsets;
  35924. break;
  35925. case '%':
  35926. case '%r':
  35927. default:
  35928. element = referenceOffsets;
  35929. }
  35930. var rect = getClientRect(element);
  35931. return rect[measurement] / 100 * value;
  35932. } else if (unit === 'vh' || unit === 'vw') {
  35933. // if is a vh or vw, we calculate the size based on the viewport
  35934. var size = void 0;
  35935. if (unit === 'vh') {
  35936. size = Math.max(document.documentElement.clientHeight, window.innerHeight || 0);
  35937. } else {
  35938. size = Math.max(document.documentElement.clientWidth, window.innerWidth || 0);
  35939. }
  35940. return size / 100 * value;
  35941. } else {
  35942. // if is an explicit pixel unit, we get rid of the unit and keep the value
  35943. // if is an implicit unit, it's px, and we return just the value
  35944. return value;
  35945. }
  35946. }
  35947. /**
  35948. * Parse an `offset` string to extrapolate `x` and `y` numeric offsets.
  35949. * @function
  35950. * @memberof {modifiers~offset}
  35951. * @private
  35952. * @argument {String} offset
  35953. * @argument {Object} popperOffsets
  35954. * @argument {Object} referenceOffsets
  35955. * @argument {String} basePlacement
  35956. * @returns {Array} a two cells array with x and y offsets in numbers
  35957. */
  35958. function parseOffset(offset, popperOffsets, referenceOffsets, basePlacement) {
  35959. var offsets = [0, 0];
  35960. // Use height if placement is left or right and index is 0 otherwise use width
  35961. // in this way the first offset will use an axis and the second one
  35962. // will use the other one
  35963. var useHeight = ['right', 'left'].indexOf(basePlacement) !== -1;
  35964. // Split the offset string to obtain a list of values and operands
  35965. // The regex addresses values with the plus or minus sign in front (+10, -20, etc)
  35966. var fragments = offset.split(/(\+|\-)/).map(function (frag) {
  35967. return frag.trim();
  35968. });
  35969. // Detect if the offset string contains a pair of values or a single one
  35970. // they could be separated by comma or space
  35971. var divider = fragments.indexOf(find(fragments, function (frag) {
  35972. return frag.search(/,|\s/) !== -1;
  35973. }));
  35974. if (fragments[divider] && fragments[divider].indexOf(',') === -1) {
  35975. console.warn('Offsets separated by white space(s) are deprecated, use a comma (,) instead.');
  35976. }
  35977. // If divider is found, we divide the list of values and operands to divide
  35978. // them by ofset X and Y.
  35979. var splitRegex = /\s*,\s*|\s+/;
  35980. 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];
  35981. // Convert the values with units to absolute pixels to allow our computations
  35982. ops = ops.map(function (op, index) {
  35983. // Most of the units rely on the orientation of the popper
  35984. var measurement = (index === 1 ? !useHeight : useHeight) ? 'height' : 'width';
  35985. var mergeWithPrevious = false;
  35986. return op
  35987. // This aggregates any `+` or `-` sign that aren't considered operators
  35988. // e.g.: 10 + +5 => [10, +, +5]
  35989. .reduce(function (a, b) {
  35990. if (a[a.length - 1] === '' && ['+', '-'].indexOf(b) !== -1) {
  35991. a[a.length - 1] = b;
  35992. mergeWithPrevious = true;
  35993. return a;
  35994. } else if (mergeWithPrevious) {
  35995. a[a.length - 1] += b;
  35996. mergeWithPrevious = false;
  35997. return a;
  35998. } else {
  35999. return a.concat(b);
  36000. }
  36001. }, [])
  36002. // Here we convert the string values into number values (in px)
  36003. .map(function (str) {
  36004. return toValue(str, measurement, popperOffsets, referenceOffsets);
  36005. });
  36006. });
  36007. // Loop trough the offsets arrays and execute the operations
  36008. ops.forEach(function (op, index) {
  36009. op.forEach(function (frag, index2) {
  36010. if (isNumeric(frag)) {
  36011. offsets[index] += frag * (op[index2 - 1] === '-' ? -1 : 1);
  36012. }
  36013. });
  36014. });
  36015. return offsets;
  36016. }
  36017. /**
  36018. * @function
  36019. * @memberof Modifiers
  36020. * @argument {Object} data - The data object generated by update method
  36021. * @argument {Object} options - Modifiers configuration and options
  36022. * @argument {Number|String} options.offset=0
  36023. * The offset value as described in the modifier description
  36024. * @returns {Object} The data object, properly modified
  36025. */
  36026. function offset(data, _ref) {
  36027. var offset = _ref.offset;
  36028. var placement = data.placement,
  36029. _data$offsets = data.offsets,
  36030. popper = _data$offsets.popper,
  36031. reference = _data$offsets.reference;
  36032. var basePlacement = placement.split('-')[0];
  36033. var offsets = void 0;
  36034. if (isNumeric(+offset)) {
  36035. offsets = [+offset, 0];
  36036. } else {
  36037. offsets = parseOffset(offset, popper, reference, basePlacement);
  36038. }
  36039. if (basePlacement === 'left') {
  36040. popper.top += offsets[0];
  36041. popper.left -= offsets[1];
  36042. } else if (basePlacement === 'right') {
  36043. popper.top += offsets[0];
  36044. popper.left += offsets[1];
  36045. } else if (basePlacement === 'top') {
  36046. popper.left += offsets[0];
  36047. popper.top -= offsets[1];
  36048. } else if (basePlacement === 'bottom') {
  36049. popper.left += offsets[0];
  36050. popper.top += offsets[1];
  36051. }
  36052. data.popper = popper;
  36053. return data;
  36054. }
  36055. /**
  36056. * @function
  36057. * @memberof Modifiers
  36058. * @argument {Object} data - The data object generated by `update` method
  36059. * @argument {Object} options - Modifiers configuration and options
  36060. * @returns {Object} The data object, properly modified
  36061. */
  36062. function preventOverflow(data, options) {
  36063. var boundariesElement = options.boundariesElement || getOffsetParent(data.instance.popper);
  36064. // If offsetParent is the reference element, we really want to
  36065. // go one step up and use the next offsetParent as reference to
  36066. // avoid to make this modifier completely useless and look like broken
  36067. if (data.instance.reference === boundariesElement) {
  36068. boundariesElement = getOffsetParent(boundariesElement);
  36069. }
  36070. // NOTE: DOM access here
  36071. // resets the popper's position so that the document size can be calculated excluding
  36072. // the size of the popper element itself
  36073. var transformProp = getSupportedPropertyName('transform');
  36074. var popperStyles = data.instance.popper.style; // assignment to help minification
  36075. var top = popperStyles.top,
  36076. left = popperStyles.left,
  36077. transform = popperStyles[transformProp];
  36078. popperStyles.top = '';
  36079. popperStyles.left = '';
  36080. popperStyles[transformProp] = '';
  36081. var boundaries = getBoundaries(data.instance.popper, data.instance.reference, options.padding, boundariesElement, data.positionFixed);
  36082. // NOTE: DOM access here
  36083. // restores the original style properties after the offsets have been computed
  36084. popperStyles.top = top;
  36085. popperStyles.left = left;
  36086. popperStyles[transformProp] = transform;
  36087. options.boundaries = boundaries;
  36088. var order = options.priority;
  36089. var popper = data.offsets.popper;
  36090. var check = {
  36091. primary: function primary(placement) {
  36092. var value = popper[placement];
  36093. if (popper[placement] < boundaries[placement] && !options.escapeWithReference) {
  36094. value = Math.max(popper[placement], boundaries[placement]);
  36095. }
  36096. return defineProperty({}, placement, value);
  36097. },
  36098. secondary: function secondary(placement) {
  36099. var mainSide = placement === 'right' ? 'left' : 'top';
  36100. var value = popper[mainSide];
  36101. if (popper[placement] > boundaries[placement] && !options.escapeWithReference) {
  36102. value = Math.min(popper[mainSide], boundaries[placement] - (placement === 'right' ? popper.width : popper.height));
  36103. }
  36104. return defineProperty({}, mainSide, value);
  36105. }
  36106. };
  36107. order.forEach(function (placement) {
  36108. var side = ['left', 'top'].indexOf(placement) !== -1 ? 'primary' : 'secondary';
  36109. popper = _extends({}, popper, check[side](placement));
  36110. });
  36111. data.offsets.popper = popper;
  36112. return data;
  36113. }
  36114. /**
  36115. * @function
  36116. * @memberof Modifiers
  36117. * @argument {Object} data - The data object generated by `update` method
  36118. * @argument {Object} options - Modifiers configuration and options
  36119. * @returns {Object} The data object, properly modified
  36120. */
  36121. function shift(data) {
  36122. var placement = data.placement;
  36123. var basePlacement = placement.split('-')[0];
  36124. var shiftvariation = placement.split('-')[1];
  36125. // if shift shiftvariation is specified, run the modifier
  36126. if (shiftvariation) {
  36127. var _data$offsets = data.offsets,
  36128. reference = _data$offsets.reference,
  36129. popper = _data$offsets.popper;
  36130. var isVertical = ['bottom', 'top'].indexOf(basePlacement) !== -1;
  36131. var side = isVertical ? 'left' : 'top';
  36132. var measurement = isVertical ? 'width' : 'height';
  36133. var shiftOffsets = {
  36134. start: defineProperty({}, side, reference[side]),
  36135. end: defineProperty({}, side, reference[side] + reference[measurement] - popper[measurement])
  36136. };
  36137. data.offsets.popper = _extends({}, popper, shiftOffsets[shiftvariation]);
  36138. }
  36139. return data;
  36140. }
  36141. /**
  36142. * @function
  36143. * @memberof Modifiers
  36144. * @argument {Object} data - The data object generated by update method
  36145. * @argument {Object} options - Modifiers configuration and options
  36146. * @returns {Object} The data object, properly modified
  36147. */
  36148. function hide(data) {
  36149. if (!isModifierRequired(data.instance.modifiers, 'hide', 'preventOverflow')) {
  36150. return data;
  36151. }
  36152. var refRect = data.offsets.reference;
  36153. var bound = find(data.instance.modifiers, function (modifier) {
  36154. return modifier.name === 'preventOverflow';
  36155. }).boundaries;
  36156. if (refRect.bottom < bound.top || refRect.left > bound.right || refRect.top > bound.bottom || refRect.right < bound.left) {
  36157. // Avoid unnecessary DOM access if visibility hasn't changed
  36158. if (data.hide === true) {
  36159. return data;
  36160. }
  36161. data.hide = true;
  36162. data.attributes['x-out-of-boundaries'] = '';
  36163. } else {
  36164. // Avoid unnecessary DOM access if visibility hasn't changed
  36165. if (data.hide === false) {
  36166. return data;
  36167. }
  36168. data.hide = false;
  36169. data.attributes['x-out-of-boundaries'] = false;
  36170. }
  36171. return data;
  36172. }
  36173. /**
  36174. * @function
  36175. * @memberof Modifiers
  36176. * @argument {Object} data - The data object generated by `update` method
  36177. * @argument {Object} options - Modifiers configuration and options
  36178. * @returns {Object} The data object, properly modified
  36179. */
  36180. function inner(data) {
  36181. var placement = data.placement;
  36182. var basePlacement = placement.split('-')[0];
  36183. var _data$offsets = data.offsets,
  36184. popper = _data$offsets.popper,
  36185. reference = _data$offsets.reference;
  36186. var isHoriz = ['left', 'right'].indexOf(basePlacement) !== -1;
  36187. var subtractLength = ['top', 'left'].indexOf(basePlacement) === -1;
  36188. popper[isHoriz ? 'left' : 'top'] = reference[basePlacement] - (subtractLength ? popper[isHoriz ? 'width' : 'height'] : 0);
  36189. data.placement = getOppositePlacement(placement);
  36190. data.offsets.popper = getClientRect(popper);
  36191. return data;
  36192. }
  36193. /**
  36194. * Modifier function, each modifier can have a function of this type assigned
  36195. * to its `fn` property.<br />
  36196. * These functions will be called on each update, this means that you must
  36197. * make sure they are performant enough to avoid performance bottlenecks.
  36198. *
  36199. * @function ModifierFn
  36200. * @argument {dataObject} data - The data object generated by `update` method
  36201. * @argument {Object} options - Modifiers configuration and options
  36202. * @returns {dataObject} The data object, properly modified
  36203. */
  36204. /**
  36205. * Modifiers are plugins used to alter the behavior of your poppers.<br />
  36206. * Popper.js uses a set of 9 modifiers to provide all the basic functionalities
  36207. * needed by the library.
  36208. *
  36209. * Usually you don't want to override the `order`, `fn` and `onLoad` props.
  36210. * All the other properties are configurations that could be tweaked.
  36211. * @namespace modifiers
  36212. */
  36213. var modifiers = {
  36214. /**
  36215. * Modifier used to shift the popper on the start or end of its reference
  36216. * element.<br />
  36217. * It will read the variation of the `placement` property.<br />
  36218. * It can be one either `-end` or `-start`.
  36219. * @memberof modifiers
  36220. * @inner
  36221. */
  36222. shift: {
  36223. /** @prop {number} order=100 - Index used to define the order of execution */
  36224. order: 100,
  36225. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36226. enabled: true,
  36227. /** @prop {ModifierFn} */
  36228. fn: shift
  36229. },
  36230. /**
  36231. * The `offset` modifier can shift your popper on both its axis.
  36232. *
  36233. * It accepts the following units:
  36234. * - `px` or unit-less, interpreted as pixels
  36235. * - `%` or `%r`, percentage relative to the length of the reference element
  36236. * - `%p`, percentage relative to the length of the popper element
  36237. * - `vw`, CSS viewport width unit
  36238. * - `vh`, CSS viewport height unit
  36239. *
  36240. * For length is intended the main axis relative to the placement of the popper.<br />
  36241. * This means that if the placement is `top` or `bottom`, the length will be the
  36242. * `width`. In case of `left` or `right`, it will be the `height`.
  36243. *
  36244. * You can provide a single value (as `Number` or `String`), or a pair of values
  36245. * as `String` divided by a comma or one (or more) white spaces.<br />
  36246. * The latter is a deprecated method because it leads to confusion and will be
  36247. * removed in v2.<br />
  36248. * Additionally, it accepts additions and subtractions between different units.
  36249. * Note that multiplications and divisions aren't supported.
  36250. *
  36251. * Valid examples are:
  36252. * ```
  36253. * 10
  36254. * '10%'
  36255. * '10, 10'
  36256. * '10%, 10'
  36257. * '10 + 10%'
  36258. * '10 - 5vh + 3%'
  36259. * '-10px + 5vh, 5px - 6%'
  36260. * ```
  36261. * > **NB**: If you desire to apply offsets to your poppers in a way that may make them overlap
  36262. * > with their reference element, unfortunately, you will have to disable the `flip` modifier.
  36263. * > You can read more on this at this [issue](https://github.com/FezVrasta/popper.js/issues/373).
  36264. *
  36265. * @memberof modifiers
  36266. * @inner
  36267. */
  36268. offset: {
  36269. /** @prop {number} order=200 - Index used to define the order of execution */
  36270. order: 200,
  36271. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36272. enabled: true,
  36273. /** @prop {ModifierFn} */
  36274. fn: offset,
  36275. /** @prop {Number|String} offset=0
  36276. * The offset value as described in the modifier description
  36277. */
  36278. offset: 0
  36279. },
  36280. /**
  36281. * Modifier used to prevent the popper from being positioned outside the boundary.
  36282. *
  36283. * A scenario exists where the reference itself is not within the boundaries.<br />
  36284. * We can say it has "escaped the boundaries" — or just "escaped".<br />
  36285. * In this case we need to decide whether the popper should either:
  36286. *
  36287. * - detach from the reference and remain "trapped" in the boundaries, or
  36288. * - if it should ignore the boundary and "escape with its reference"
  36289. *
  36290. * When `escapeWithReference` is set to`true` and reference is completely
  36291. * outside its boundaries, the popper will overflow (or completely leave)
  36292. * the boundaries in order to remain attached to the edge of the reference.
  36293. *
  36294. * @memberof modifiers
  36295. * @inner
  36296. */
  36297. preventOverflow: {
  36298. /** @prop {number} order=300 - Index used to define the order of execution */
  36299. order: 300,
  36300. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36301. enabled: true,
  36302. /** @prop {ModifierFn} */
  36303. fn: preventOverflow,
  36304. /**
  36305. * @prop {Array} [priority=['left','right','top','bottom']]
  36306. * Popper will try to prevent overflow following these priorities by default,
  36307. * then, it could overflow on the left and on top of the `boundariesElement`
  36308. */
  36309. priority: ['left', 'right', 'top', 'bottom'],
  36310. /**
  36311. * @prop {number} padding=5
  36312. * Amount of pixel used to define a minimum distance between the boundaries
  36313. * and the popper. This makes sure the popper always has a little padding
  36314. * between the edges of its container
  36315. */
  36316. padding: 5,
  36317. /**
  36318. * @prop {String|HTMLElement} boundariesElement='scrollParent'
  36319. * Boundaries used by the modifier. Can be `scrollParent`, `window`,
  36320. * `viewport` or any DOM element.
  36321. */
  36322. boundariesElement: 'scrollParent'
  36323. },
  36324. /**
  36325. * Modifier used to make sure the reference and its popper stay near each other
  36326. * without leaving any gap between the two. Especially useful when the arrow is
  36327. * enabled and you want to ensure that it points to its reference element.
  36328. * It cares only about the first axis. You can still have poppers with margin
  36329. * between the popper and its reference element.
  36330. * @memberof modifiers
  36331. * @inner
  36332. */
  36333. keepTogether: {
  36334. /** @prop {number} order=400 - Index used to define the order of execution */
  36335. order: 400,
  36336. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36337. enabled: true,
  36338. /** @prop {ModifierFn} */
  36339. fn: keepTogether
  36340. },
  36341. /**
  36342. * This modifier is used to move the `arrowElement` of the popper to make
  36343. * sure it is positioned between the reference element and its popper element.
  36344. * It will read the outer size of the `arrowElement` node to detect how many
  36345. * pixels of conjunction are needed.
  36346. *
  36347. * It has no effect if no `arrowElement` is provided.
  36348. * @memberof modifiers
  36349. * @inner
  36350. */
  36351. arrow: {
  36352. /** @prop {number} order=500 - Index used to define the order of execution */
  36353. order: 500,
  36354. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36355. enabled: true,
  36356. /** @prop {ModifierFn} */
  36357. fn: arrow,
  36358. /** @prop {String|HTMLElement} element='[x-arrow]' - Selector or node used as arrow */
  36359. element: '[x-arrow]'
  36360. },
  36361. /**
  36362. * Modifier used to flip the popper's placement when it starts to overlap its
  36363. * reference element.
  36364. *
  36365. * Requires the `preventOverflow` modifier before it in order to work.
  36366. *
  36367. * **NOTE:** this modifier will interrupt the current update cycle and will
  36368. * restart it if it detects the need to flip the placement.
  36369. * @memberof modifiers
  36370. * @inner
  36371. */
  36372. flip: {
  36373. /** @prop {number} order=600 - Index used to define the order of execution */
  36374. order: 600,
  36375. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36376. enabled: true,
  36377. /** @prop {ModifierFn} */
  36378. fn: flip,
  36379. /**
  36380. * @prop {String|Array} behavior='flip'
  36381. * The behavior used to change the popper's placement. It can be one of
  36382. * `flip`, `clockwise`, `counterclockwise` or an array with a list of valid
  36383. * placements (with optional variations)
  36384. */
  36385. behavior: 'flip',
  36386. /**
  36387. * @prop {number} padding=5
  36388. * The popper will flip if it hits the edges of the `boundariesElement`
  36389. */
  36390. padding: 5,
  36391. /**
  36392. * @prop {String|HTMLElement} boundariesElement='viewport'
  36393. * The element which will define the boundaries of the popper position.
  36394. * The popper will never be placed outside of the defined boundaries
  36395. * (except if `keepTogether` is enabled)
  36396. */
  36397. boundariesElement: 'viewport',
  36398. /**
  36399. * @prop {Boolean} flipVariations=false
  36400. * The popper will switch placement variation between `-start` and `-end` when
  36401. * the reference element overlaps its boundaries.
  36402. *
  36403. * The original placement should have a set variation.
  36404. */
  36405. flipVariations: false,
  36406. /**
  36407. * @prop {Boolean} flipVariationsByContent=false
  36408. * The popper will switch placement variation between `-start` and `-end` when
  36409. * the popper element overlaps its reference boundaries.
  36410. *
  36411. * The original placement should have a set variation.
  36412. */
  36413. flipVariationsByContent: false
  36414. },
  36415. /**
  36416. * Modifier used to make the popper flow toward the inner of the reference element.
  36417. * By default, when this modifier is disabled, the popper will be placed outside
  36418. * the reference element.
  36419. * @memberof modifiers
  36420. * @inner
  36421. */
  36422. inner: {
  36423. /** @prop {number} order=700 - Index used to define the order of execution */
  36424. order: 700,
  36425. /** @prop {Boolean} enabled=false - Whether the modifier is enabled or not */
  36426. enabled: false,
  36427. /** @prop {ModifierFn} */
  36428. fn: inner
  36429. },
  36430. /**
  36431. * Modifier used to hide the popper when its reference element is outside of the
  36432. * popper boundaries. It will set a `x-out-of-boundaries` attribute which can
  36433. * be used to hide with a CSS selector the popper when its reference is
  36434. * out of boundaries.
  36435. *
  36436. * Requires the `preventOverflow` modifier before it in order to work.
  36437. * @memberof modifiers
  36438. * @inner
  36439. */
  36440. hide: {
  36441. /** @prop {number} order=800 - Index used to define the order of execution */
  36442. order: 800,
  36443. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36444. enabled: true,
  36445. /** @prop {ModifierFn} */
  36446. fn: hide
  36447. },
  36448. /**
  36449. * Computes the style that will be applied to the popper element to gets
  36450. * properly positioned.
  36451. *
  36452. * Note that this modifier will not touch the DOM, it just prepares the styles
  36453. * so that `applyStyle` modifier can apply it. This separation is useful
  36454. * in case you need to replace `applyStyle` with a custom implementation.
  36455. *
  36456. * This modifier has `850` as `order` value to maintain backward compatibility
  36457. * with previous versions of Popper.js. Expect the modifiers ordering method
  36458. * to change in future major versions of the library.
  36459. *
  36460. * @memberof modifiers
  36461. * @inner
  36462. */
  36463. computeStyle: {
  36464. /** @prop {number} order=850 - Index used to define the order of execution */
  36465. order: 850,
  36466. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36467. enabled: true,
  36468. /** @prop {ModifierFn} */
  36469. fn: computeStyle,
  36470. /**
  36471. * @prop {Boolean} gpuAcceleration=true
  36472. * If true, it uses the CSS 3D transformation to position the popper.
  36473. * Otherwise, it will use the `top` and `left` properties
  36474. */
  36475. gpuAcceleration: true,
  36476. /**
  36477. * @prop {string} [x='bottom']
  36478. * Where to anchor the X axis (`bottom` or `top`). AKA X offset origin.
  36479. * Change this if your popper should grow in a direction different from `bottom`
  36480. */
  36481. x: 'bottom',
  36482. /**
  36483. * @prop {string} [x='left']
  36484. * Where to anchor the Y axis (`left` or `right`). AKA Y offset origin.
  36485. * Change this if your popper should grow in a direction different from `right`
  36486. */
  36487. y: 'right'
  36488. },
  36489. /**
  36490. * Applies the computed styles to the popper element.
  36491. *
  36492. * All the DOM manipulations are limited to this modifier. This is useful in case
  36493. * you want to integrate Popper.js inside a framework or view library and you
  36494. * want to delegate all the DOM manipulations to it.
  36495. *
  36496. * Note that if you disable this modifier, you must make sure the popper element
  36497. * has its position set to `absolute` before Popper.js can do its work!
  36498. *
  36499. * Just disable this modifier and define your own to achieve the desired effect.
  36500. *
  36501. * @memberof modifiers
  36502. * @inner
  36503. */
  36504. applyStyle: {
  36505. /** @prop {number} order=900 - Index used to define the order of execution */
  36506. order: 900,
  36507. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  36508. enabled: true,
  36509. /** @prop {ModifierFn} */
  36510. fn: applyStyle,
  36511. /** @prop {Function} */
  36512. onLoad: applyStyleOnLoad,
  36513. /**
  36514. * @deprecated since version 1.10.0, the property moved to `computeStyle` modifier
  36515. * @prop {Boolean} gpuAcceleration=true
  36516. * If true, it uses the CSS 3D transformation to position the popper.
  36517. * Otherwise, it will use the `top` and `left` properties
  36518. */
  36519. gpuAcceleration: undefined
  36520. }
  36521. };
  36522. /**
  36523. * The `dataObject` is an object containing all the information used by Popper.js.
  36524. * This object is passed to modifiers and to the `onCreate` and `onUpdate` callbacks.
  36525. * @name dataObject
  36526. * @property {Object} data.instance The Popper.js instance
  36527. * @property {String} data.placement Placement applied to popper
  36528. * @property {String} data.originalPlacement Placement originally defined on init
  36529. * @property {Boolean} data.flipped True if popper has been flipped by flip modifier
  36530. * @property {Boolean} data.hide True if the reference element is out of boundaries, useful to know when to hide the popper
  36531. * @property {HTMLElement} data.arrowElement Node used as arrow by arrow modifier
  36532. * @property {Object} data.styles Any CSS property defined here will be applied to the popper. It expects the JavaScript nomenclature (eg. `marginBottom`)
  36533. * @property {Object} data.arrowStyles Any CSS property defined here will be applied to the popper arrow. It expects the JavaScript nomenclature (eg. `marginBottom`)
  36534. * @property {Object} data.boundaries Offsets of the popper boundaries
  36535. * @property {Object} data.offsets The measurements of popper, reference and arrow elements
  36536. * @property {Object} data.offsets.popper `top`, `left`, `width`, `height` values
  36537. * @property {Object} data.offsets.reference `top`, `left`, `width`, `height` values
  36538. * @property {Object} data.offsets.arrow] `top` and `left` offsets, only one of them will be different from 0
  36539. */
  36540. /**
  36541. * Default options provided to Popper.js constructor.<br />
  36542. * These can be overridden using the `options` argument of Popper.js.<br />
  36543. * To override an option, simply pass an object with the same
  36544. * structure of the `options` object, as the 3rd argument. For example:
  36545. * ```
  36546. * new Popper(ref, pop, {
  36547. * modifiers: {
  36548. * preventOverflow: { enabled: false }
  36549. * }
  36550. * })
  36551. * ```
  36552. * @type {Object}
  36553. * @static
  36554. * @memberof Popper
  36555. */
  36556. var Defaults = {
  36557. /**
  36558. * Popper's placement.
  36559. * @prop {Popper.placements} placement='bottom'
  36560. */
  36561. placement: 'bottom',
  36562. /**
  36563. * Set this to true if you want popper to position it self in 'fixed' mode
  36564. * @prop {Boolean} positionFixed=false
  36565. */
  36566. positionFixed: false,
  36567. /**
  36568. * Whether events (resize, scroll) are initially enabled.
  36569. * @prop {Boolean} eventsEnabled=true
  36570. */
  36571. eventsEnabled: true,
  36572. /**
  36573. * Set to true if you want to automatically remove the popper when
  36574. * you call the `destroy` method.
  36575. * @prop {Boolean} removeOnDestroy=false
  36576. */
  36577. removeOnDestroy: false,
  36578. /**
  36579. * Callback called when the popper is created.<br />
  36580. * By default, it is set to no-op.<br />
  36581. * Access Popper.js instance with `data.instance`.
  36582. * @prop {onCreate}
  36583. */
  36584. onCreate: function onCreate() {},
  36585. /**
  36586. * Callback called when the popper is updated. This callback is not called
  36587. * on the initialization/creation of the popper, but only on subsequent
  36588. * updates.<br />
  36589. * By default, it is set to no-op.<br />
  36590. * Access Popper.js instance with `data.instance`.
  36591. * @prop {onUpdate}
  36592. */
  36593. onUpdate: function onUpdate() {},
  36594. /**
  36595. * List of modifiers used to modify the offsets before they are applied to the popper.
  36596. * They provide most of the functionalities of Popper.js.
  36597. * @prop {modifiers}
  36598. */
  36599. modifiers: modifiers
  36600. };
  36601. /**
  36602. * @callback onCreate
  36603. * @param {dataObject} data
  36604. */
  36605. /**
  36606. * @callback onUpdate
  36607. * @param {dataObject} data
  36608. */
  36609. // Utils
  36610. // Methods
  36611. var Popper = function () {
  36612. /**
  36613. * Creates a new Popper.js instance.
  36614. * @class Popper
  36615. * @param {Element|referenceObject} reference - The reference element used to position the popper
  36616. * @param {Element} popper - The HTML / XML element used as the popper
  36617. * @param {Object} options - Your custom options to override the ones defined in [Defaults](#defaults)
  36618. * @return {Object} instance - The generated Popper.js instance
  36619. */
  36620. function Popper(reference, popper) {
  36621. var _this = this;
  36622. var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  36623. classCallCheck(this, Popper);
  36624. this.scheduleUpdate = function () {
  36625. return requestAnimationFrame(_this.update);
  36626. };
  36627. // make update() debounced, so that it only runs at most once-per-tick
  36628. this.update = debounce(this.update.bind(this));
  36629. // with {} we create a new object with the options inside it
  36630. this.options = _extends({}, Popper.Defaults, options);
  36631. // init state
  36632. this.state = {
  36633. isDestroyed: false,
  36634. isCreated: false,
  36635. scrollParents: []
  36636. };
  36637. // get reference and popper elements (allow jQuery wrappers)
  36638. this.reference = reference && reference.jquery ? reference[0] : reference;
  36639. this.popper = popper && popper.jquery ? popper[0] : popper;
  36640. // Deep merge modifiers options
  36641. this.options.modifiers = {};
  36642. Object.keys(_extends({}, Popper.Defaults.modifiers, options.modifiers)).forEach(function (name) {
  36643. _this.options.modifiers[name] = _extends({}, Popper.Defaults.modifiers[name] || {}, options.modifiers ? options.modifiers[name] : {});
  36644. });
  36645. // Refactoring modifiers' list (Object => Array)
  36646. this.modifiers = Object.keys(this.options.modifiers).map(function (name) {
  36647. return _extends({
  36648. name: name
  36649. }, _this.options.modifiers[name]);
  36650. })
  36651. // sort the modifiers by order
  36652. .sort(function (a, b) {
  36653. return a.order - b.order;
  36654. });
  36655. // modifiers have the ability to execute arbitrary code when Popper.js get inited
  36656. // such code is executed in the same order of its modifier
  36657. // they could add new properties to their options configuration
  36658. // BE AWARE: don't add options to `options.modifiers.name` but to `modifierOptions`!
  36659. this.modifiers.forEach(function (modifierOptions) {
  36660. if (modifierOptions.enabled && isFunction(modifierOptions.onLoad)) {
  36661. modifierOptions.onLoad(_this.reference, _this.popper, _this.options, modifierOptions, _this.state);
  36662. }
  36663. });
  36664. // fire the first update to position the popper in the right place
  36665. this.update();
  36666. var eventsEnabled = this.options.eventsEnabled;
  36667. if (eventsEnabled) {
  36668. // setup event listeners, they will take care of update the position in specific situations
  36669. this.enableEventListeners();
  36670. }
  36671. this.state.eventsEnabled = eventsEnabled;
  36672. }
  36673. // We can't use class properties because they don't get listed in the
  36674. // class prototype and break stuff like Sinon stubs
  36675. createClass(Popper, [{
  36676. key: 'update',
  36677. value: function update$$1() {
  36678. return update.call(this);
  36679. }
  36680. }, {
  36681. key: 'destroy',
  36682. value: function destroy$$1() {
  36683. return destroy.call(this);
  36684. }
  36685. }, {
  36686. key: 'enableEventListeners',
  36687. value: function enableEventListeners$$1() {
  36688. return enableEventListeners.call(this);
  36689. }
  36690. }, {
  36691. key: 'disableEventListeners',
  36692. value: function disableEventListeners$$1() {
  36693. return disableEventListeners.call(this);
  36694. }
  36695. /**
  36696. * Schedules an update. It will run on the next UI update available.
  36697. * @method scheduleUpdate
  36698. * @memberof Popper
  36699. */
  36700. /**
  36701. * Collection of utilities useful when writing custom modifiers.
  36702. * Starting from version 1.7, this method is available only if you
  36703. * include `popper-utils.js` before `popper.js`.
  36704. *
  36705. * **DEPRECATION**: This way to access PopperUtils is deprecated
  36706. * and will be removed in v2! Use the PopperUtils module directly instead.
  36707. * Due to the high instability of the methods contained in Utils, we can't
  36708. * guarantee them to follow semver. Use them at your own risk!
  36709. * @static
  36710. * @private
  36711. * @type {Object}
  36712. * @deprecated since version 1.8
  36713. * @member Utils
  36714. * @memberof Popper
  36715. */
  36716. }]);
  36717. return Popper;
  36718. }();
  36719. /**
  36720. * The `referenceObject` is an object that provides an interface compatible with Popper.js
  36721. * and lets you use it as replacement of a real DOM node.<br />
  36722. * You can use this method to position a popper relatively to a set of coordinates
  36723. * in case you don't have a DOM node to use as reference.
  36724. *
  36725. * ```
  36726. * new Popper(referenceObject, popperNode);
  36727. * ```
  36728. *
  36729. * NB: This feature isn't supported in Internet Explorer 10.
  36730. * @name referenceObject
  36731. * @property {Function} data.getBoundingClientRect
  36732. * A function that returns a set of coordinates compatible with the native `getBoundingClientRect` method.
  36733. * @property {number} data.clientWidth
  36734. * An ES6 getter that will return the width of the virtual reference element.
  36735. * @property {number} data.clientHeight
  36736. * An ES6 getter that will return the height of the virtual reference element.
  36737. */
  36738. Popper.Utils = (typeof window !== 'undefined' ? window : global).PopperUtils;
  36739. Popper.placements = placements;
  36740. Popper.Defaults = Defaults;
  36741. /* harmony default export */ __webpack_exports__["default"] = (Popper);
  36742. //# sourceMappingURL=popper.js.map
  36743. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")))
  36744. /***/ }),
  36745. /***/ "./node_modules/process/browser.js":
  36746. /*!*****************************************!*\
  36747. !*** ./node_modules/process/browser.js ***!
  36748. \*****************************************/
  36749. /*! no static exports found */
  36750. /***/ (function(module, exports) {
  36751. // shim for using process in browser
  36752. var process = module.exports = {};
  36753. // cached from whatever global is present so that test runners that stub it
  36754. // don't break things. But we need to wrap it in a try catch in case it is
  36755. // wrapped in strict mode code which doesn't define any globals. It's inside a
  36756. // function because try/catches deoptimize in certain engines.
  36757. var cachedSetTimeout;
  36758. var cachedClearTimeout;
  36759. function defaultSetTimout() {
  36760. throw new Error('setTimeout has not been defined');
  36761. }
  36762. function defaultClearTimeout () {
  36763. throw new Error('clearTimeout has not been defined');
  36764. }
  36765. (function () {
  36766. try {
  36767. if (typeof setTimeout === 'function') {
  36768. cachedSetTimeout = setTimeout;
  36769. } else {
  36770. cachedSetTimeout = defaultSetTimout;
  36771. }
  36772. } catch (e) {
  36773. cachedSetTimeout = defaultSetTimout;
  36774. }
  36775. try {
  36776. if (typeof clearTimeout === 'function') {
  36777. cachedClearTimeout = clearTimeout;
  36778. } else {
  36779. cachedClearTimeout = defaultClearTimeout;
  36780. }
  36781. } catch (e) {
  36782. cachedClearTimeout = defaultClearTimeout;
  36783. }
  36784. } ())
  36785. function runTimeout(fun) {
  36786. if (cachedSetTimeout === setTimeout) {
  36787. //normal enviroments in sane situations
  36788. return setTimeout(fun, 0);
  36789. }
  36790. // if setTimeout wasn't available but was latter defined
  36791. if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
  36792. cachedSetTimeout = setTimeout;
  36793. return setTimeout(fun, 0);
  36794. }
  36795. try {
  36796. // when when somebody has screwed with setTimeout but no I.E. maddness
  36797. return cachedSetTimeout(fun, 0);
  36798. } catch(e){
  36799. try {
  36800. // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
  36801. return cachedSetTimeout.call(null, fun, 0);
  36802. } catch(e){
  36803. // 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
  36804. return cachedSetTimeout.call(this, fun, 0);
  36805. }
  36806. }
  36807. }
  36808. function runClearTimeout(marker) {
  36809. if (cachedClearTimeout === clearTimeout) {
  36810. //normal enviroments in sane situations
  36811. return clearTimeout(marker);
  36812. }
  36813. // if clearTimeout wasn't available but was latter defined
  36814. if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
  36815. cachedClearTimeout = clearTimeout;
  36816. return clearTimeout(marker);
  36817. }
  36818. try {
  36819. // when when somebody has screwed with setTimeout but no I.E. maddness
  36820. return cachedClearTimeout(marker);
  36821. } catch (e){
  36822. try {
  36823. // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
  36824. return cachedClearTimeout.call(null, marker);
  36825. } catch (e){
  36826. // 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.
  36827. // Some versions of I.E. have different rules for clearTimeout vs setTimeout
  36828. return cachedClearTimeout.call(this, marker);
  36829. }
  36830. }
  36831. }
  36832. var queue = [];
  36833. var draining = false;
  36834. var currentQueue;
  36835. var queueIndex = -1;
  36836. function cleanUpNextTick() {
  36837. if (!draining || !currentQueue) {
  36838. return;
  36839. }
  36840. draining = false;
  36841. if (currentQueue.length) {
  36842. queue = currentQueue.concat(queue);
  36843. } else {
  36844. queueIndex = -1;
  36845. }
  36846. if (queue.length) {
  36847. drainQueue();
  36848. }
  36849. }
  36850. function drainQueue() {
  36851. if (draining) {
  36852. return;
  36853. }
  36854. var timeout = runTimeout(cleanUpNextTick);
  36855. draining = true;
  36856. var len = queue.length;
  36857. while(len) {
  36858. currentQueue = queue;
  36859. queue = [];
  36860. while (++queueIndex < len) {
  36861. if (currentQueue) {
  36862. currentQueue[queueIndex].run();
  36863. }
  36864. }
  36865. queueIndex = -1;
  36866. len = queue.length;
  36867. }
  36868. currentQueue = null;
  36869. draining = false;
  36870. runClearTimeout(timeout);
  36871. }
  36872. process.nextTick = function (fun) {
  36873. var args = new Array(arguments.length - 1);
  36874. if (arguments.length > 1) {
  36875. for (var i = 1; i < arguments.length; i++) {
  36876. args[i - 1] = arguments[i];
  36877. }
  36878. }
  36879. queue.push(new Item(fun, args));
  36880. if (queue.length === 1 && !draining) {
  36881. runTimeout(drainQueue);
  36882. }
  36883. };
  36884. // v8 likes predictible objects
  36885. function Item(fun, array) {
  36886. this.fun = fun;
  36887. this.array = array;
  36888. }
  36889. Item.prototype.run = function () {
  36890. this.fun.apply(null, this.array);
  36891. };
  36892. process.title = 'browser';
  36893. process.browser = true;
  36894. process.env = {};
  36895. process.argv = [];
  36896. process.version = ''; // empty string to avoid regexp issues
  36897. process.versions = {};
  36898. function noop() {}
  36899. process.on = noop;
  36900. process.addListener = noop;
  36901. process.once = noop;
  36902. process.off = noop;
  36903. process.removeListener = noop;
  36904. process.removeAllListeners = noop;
  36905. process.emit = noop;
  36906. process.prependListener = noop;
  36907. process.prependOnceListener = noop;
  36908. process.listeners = function (name) { return [] }
  36909. process.binding = function (name) {
  36910. throw new Error('process.binding is not supported');
  36911. };
  36912. process.cwd = function () { return '/' };
  36913. process.chdir = function (dir) {
  36914. throw new Error('process.chdir is not supported');
  36915. };
  36916. process.umask = function() { return 0; };
  36917. /***/ }),
  36918. /***/ "./node_modules/pusher-js/dist/web/pusher.js":
  36919. /*!***************************************************!*\
  36920. !*** ./node_modules/pusher-js/dist/web/pusher.js ***!
  36921. \***************************************************/
  36922. /*! no static exports found */
  36923. /***/ (function(module, exports, __webpack_require__) {
  36924. /* WEBPACK VAR INJECTION */(function(Buffer) {/*!
  36925. * Pusher JavaScript Library v5.0.3
  36926. * https://pusher.com/
  36927. *
  36928. * Copyright 2017, Pusher
  36929. * Released under the MIT licence.
  36930. */
  36931. (function webpackUniversalModuleDefinition(root, factory) {
  36932. if(true)
  36933. module.exports = factory();
  36934. else {}
  36935. })(window, function() {
  36936. return /******/ (function(modules) { // webpackBootstrap
  36937. /******/ // The module cache
  36938. /******/ var installedModules = {};
  36939. /******/
  36940. /******/ // The require function
  36941. /******/ function __webpack_require__(moduleId) {
  36942. /******/
  36943. /******/ // Check if module is in cache
  36944. /******/ if(installedModules[moduleId]) {
  36945. /******/ return installedModules[moduleId].exports;
  36946. /******/ }
  36947. /******/ // Create a new module (and put it into the cache)
  36948. /******/ var module = installedModules[moduleId] = {
  36949. /******/ i: moduleId,
  36950. /******/ l: false,
  36951. /******/ exports: {}
  36952. /******/ };
  36953. /******/
  36954. /******/ // Execute the module function
  36955. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  36956. /******/
  36957. /******/ // Flag the module as loaded
  36958. /******/ module.l = true;
  36959. /******/
  36960. /******/ // Return the exports of the module
  36961. /******/ return module.exports;
  36962. /******/ }
  36963. /******/
  36964. /******/
  36965. /******/ // expose the modules object (__webpack_modules__)
  36966. /******/ __webpack_require__.m = modules;
  36967. /******/
  36968. /******/ // expose the module cache
  36969. /******/ __webpack_require__.c = installedModules;
  36970. /******/
  36971. /******/ // define getter function for harmony exports
  36972. /******/ __webpack_require__.d = function(exports, name, getter) {
  36973. /******/ if(!__webpack_require__.o(exports, name)) {
  36974. /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
  36975. /******/ }
  36976. /******/ };
  36977. /******/
  36978. /******/ // define __esModule on exports
  36979. /******/ __webpack_require__.r = function(exports) {
  36980. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  36981. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  36982. /******/ }
  36983. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  36984. /******/ };
  36985. /******/
  36986. /******/ // create a fake namespace object
  36987. /******/ // mode & 1: value is a module id, require it
  36988. /******/ // mode & 2: merge all properties of value into the ns
  36989. /******/ // mode & 4: return value when already ns object
  36990. /******/ // mode & 8|1: behave like require
  36991. /******/ __webpack_require__.t = function(value, mode) {
  36992. /******/ if(mode & 1) value = __webpack_require__(value);
  36993. /******/ if(mode & 8) return value;
  36994. /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
  36995. /******/ var ns = Object.create(null);
  36996. /******/ __webpack_require__.r(ns);
  36997. /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
  36998. /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
  36999. /******/ return ns;
  37000. /******/ };
  37001. /******/
  37002. /******/ // getDefaultExport function for compatibility with non-harmony modules
  37003. /******/ __webpack_require__.n = function(module) {
  37004. /******/ var getter = module && module.__esModule ?
  37005. /******/ function getDefault() { return module['default']; } :
  37006. /******/ function getModuleExports() { return module; };
  37007. /******/ __webpack_require__.d(getter, 'a', getter);
  37008. /******/ return getter;
  37009. /******/ };
  37010. /******/
  37011. /******/ // Object.prototype.hasOwnProperty.call
  37012. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  37013. /******/
  37014. /******/ // __webpack_public_path__
  37015. /******/ __webpack_require__.p = "";
  37016. /******/
  37017. /******/
  37018. /******/ // Load entry module and return exports
  37019. /******/ return __webpack_require__(__webpack_require__.s = 2);
  37020. /******/ })
  37021. /************************************************************************/
  37022. /******/ ([
  37023. /* 0 */
  37024. /***/ (function(module, exports, __webpack_require__) {
  37025. (function(nacl) {
  37026. 'use strict';
  37027. // Ported in 2014 by Dmitry Chestnykh and Devi Mandiri.
  37028. // Public domain.
  37029. //
  37030. // Implementation derived from TweetNaCl version 20140427.
  37031. // See for details: http://tweetnacl.cr.yp.to/
  37032. var gf = function(init) {
  37033. var i, r = new Float64Array(16);
  37034. if (init) for (i = 0; i < init.length; i++) r[i] = init[i];
  37035. return r;
  37036. };
  37037. // Pluggable, initialized in high-level API below.
  37038. var randombytes = function(/* x, n */) { throw new Error('no PRNG'); };
  37039. var _0 = new Uint8Array(16);
  37040. var _9 = new Uint8Array(32); _9[0] = 9;
  37041. var gf0 = gf(),
  37042. gf1 = gf([1]),
  37043. _121665 = gf([0xdb41, 1]),
  37044. D = gf([0x78a3, 0x1359, 0x4dca, 0x75eb, 0xd8ab, 0x4141, 0x0a4d, 0x0070, 0xe898, 0x7779, 0x4079, 0x8cc7, 0xfe73, 0x2b6f, 0x6cee, 0x5203]),
  37045. D2 = gf([0xf159, 0x26b2, 0x9b94, 0xebd6, 0xb156, 0x8283, 0x149a, 0x00e0, 0xd130, 0xeef3, 0x80f2, 0x198e, 0xfce7, 0x56df, 0xd9dc, 0x2406]),
  37046. X = gf([0xd51a, 0x8f25, 0x2d60, 0xc956, 0xa7b2, 0x9525, 0xc760, 0x692c, 0xdc5c, 0xfdd6, 0xe231, 0xc0a4, 0x53fe, 0xcd6e, 0x36d3, 0x2169]),
  37047. Y = gf([0x6658, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666]),
  37048. I = gf([0xa0b0, 0x4a0e, 0x1b27, 0xc4ee, 0xe478, 0xad2f, 0x1806, 0x2f43, 0xd7a7, 0x3dfb, 0x0099, 0x2b4d, 0xdf0b, 0x4fc1, 0x2480, 0x2b83]);
  37049. function ts64(x, i, h, l) {
  37050. x[i] = (h >> 24) & 0xff;
  37051. x[i+1] = (h >> 16) & 0xff;
  37052. x[i+2] = (h >> 8) & 0xff;
  37053. x[i+3] = h & 0xff;
  37054. x[i+4] = (l >> 24) & 0xff;
  37055. x[i+5] = (l >> 16) & 0xff;
  37056. x[i+6] = (l >> 8) & 0xff;
  37057. x[i+7] = l & 0xff;
  37058. }
  37059. function vn(x, xi, y, yi, n) {
  37060. var i,d = 0;
  37061. for (i = 0; i < n; i++) d |= x[xi+i]^y[yi+i];
  37062. return (1 & ((d - 1) >>> 8)) - 1;
  37063. }
  37064. function crypto_verify_16(x, xi, y, yi) {
  37065. return vn(x,xi,y,yi,16);
  37066. }
  37067. function crypto_verify_32(x, xi, y, yi) {
  37068. return vn(x,xi,y,yi,32);
  37069. }
  37070. function core_salsa20(o, p, k, c) {
  37071. var j0 = c[ 0] & 0xff | (c[ 1] & 0xff)<<8 | (c[ 2] & 0xff)<<16 | (c[ 3] & 0xff)<<24,
  37072. j1 = k[ 0] & 0xff | (k[ 1] & 0xff)<<8 | (k[ 2] & 0xff)<<16 | (k[ 3] & 0xff)<<24,
  37073. j2 = k[ 4] & 0xff | (k[ 5] & 0xff)<<8 | (k[ 6] & 0xff)<<16 | (k[ 7] & 0xff)<<24,
  37074. j3 = k[ 8] & 0xff | (k[ 9] & 0xff)<<8 | (k[10] & 0xff)<<16 | (k[11] & 0xff)<<24,
  37075. j4 = k[12] & 0xff | (k[13] & 0xff)<<8 | (k[14] & 0xff)<<16 | (k[15] & 0xff)<<24,
  37076. j5 = c[ 4] & 0xff | (c[ 5] & 0xff)<<8 | (c[ 6] & 0xff)<<16 | (c[ 7] & 0xff)<<24,
  37077. j6 = p[ 0] & 0xff | (p[ 1] & 0xff)<<8 | (p[ 2] & 0xff)<<16 | (p[ 3] & 0xff)<<24,
  37078. j7 = p[ 4] & 0xff | (p[ 5] & 0xff)<<8 | (p[ 6] & 0xff)<<16 | (p[ 7] & 0xff)<<24,
  37079. j8 = p[ 8] & 0xff | (p[ 9] & 0xff)<<8 | (p[10] & 0xff)<<16 | (p[11] & 0xff)<<24,
  37080. j9 = p[12] & 0xff | (p[13] & 0xff)<<8 | (p[14] & 0xff)<<16 | (p[15] & 0xff)<<24,
  37081. j10 = c[ 8] & 0xff | (c[ 9] & 0xff)<<8 | (c[10] & 0xff)<<16 | (c[11] & 0xff)<<24,
  37082. j11 = k[16] & 0xff | (k[17] & 0xff)<<8 | (k[18] & 0xff)<<16 | (k[19] & 0xff)<<24,
  37083. j12 = k[20] & 0xff | (k[21] & 0xff)<<8 | (k[22] & 0xff)<<16 | (k[23] & 0xff)<<24,
  37084. j13 = k[24] & 0xff | (k[25] & 0xff)<<8 | (k[26] & 0xff)<<16 | (k[27] & 0xff)<<24,
  37085. j14 = k[28] & 0xff | (k[29] & 0xff)<<8 | (k[30] & 0xff)<<16 | (k[31] & 0xff)<<24,
  37086. j15 = c[12] & 0xff | (c[13] & 0xff)<<8 | (c[14] & 0xff)<<16 | (c[15] & 0xff)<<24;
  37087. var x0 = j0, x1 = j1, x2 = j2, x3 = j3, x4 = j4, x5 = j5, x6 = j6, x7 = j7,
  37088. x8 = j8, x9 = j9, x10 = j10, x11 = j11, x12 = j12, x13 = j13, x14 = j14,
  37089. x15 = j15, u;
  37090. for (var i = 0; i < 20; i += 2) {
  37091. u = x0 + x12 | 0;
  37092. x4 ^= u<<7 | u>>>(32-7);
  37093. u = x4 + x0 | 0;
  37094. x8 ^= u<<9 | u>>>(32-9);
  37095. u = x8 + x4 | 0;
  37096. x12 ^= u<<13 | u>>>(32-13);
  37097. u = x12 + x8 | 0;
  37098. x0 ^= u<<18 | u>>>(32-18);
  37099. u = x5 + x1 | 0;
  37100. x9 ^= u<<7 | u>>>(32-7);
  37101. u = x9 + x5 | 0;
  37102. x13 ^= u<<9 | u>>>(32-9);
  37103. u = x13 + x9 | 0;
  37104. x1 ^= u<<13 | u>>>(32-13);
  37105. u = x1 + x13 | 0;
  37106. x5 ^= u<<18 | u>>>(32-18);
  37107. u = x10 + x6 | 0;
  37108. x14 ^= u<<7 | u>>>(32-7);
  37109. u = x14 + x10 | 0;
  37110. x2 ^= u<<9 | u>>>(32-9);
  37111. u = x2 + x14 | 0;
  37112. x6 ^= u<<13 | u>>>(32-13);
  37113. u = x6 + x2 | 0;
  37114. x10 ^= u<<18 | u>>>(32-18);
  37115. u = x15 + x11 | 0;
  37116. x3 ^= u<<7 | u>>>(32-7);
  37117. u = x3 + x15 | 0;
  37118. x7 ^= u<<9 | u>>>(32-9);
  37119. u = x7 + x3 | 0;
  37120. x11 ^= u<<13 | u>>>(32-13);
  37121. u = x11 + x7 | 0;
  37122. x15 ^= u<<18 | u>>>(32-18);
  37123. u = x0 + x3 | 0;
  37124. x1 ^= u<<7 | u>>>(32-7);
  37125. u = x1 + x0 | 0;
  37126. x2 ^= u<<9 | u>>>(32-9);
  37127. u = x2 + x1 | 0;
  37128. x3 ^= u<<13 | u>>>(32-13);
  37129. u = x3 + x2 | 0;
  37130. x0 ^= u<<18 | u>>>(32-18);
  37131. u = x5 + x4 | 0;
  37132. x6 ^= u<<7 | u>>>(32-7);
  37133. u = x6 + x5 | 0;
  37134. x7 ^= u<<9 | u>>>(32-9);
  37135. u = x7 + x6 | 0;
  37136. x4 ^= u<<13 | u>>>(32-13);
  37137. u = x4 + x7 | 0;
  37138. x5 ^= u<<18 | u>>>(32-18);
  37139. u = x10 + x9 | 0;
  37140. x11 ^= u<<7 | u>>>(32-7);
  37141. u = x11 + x10 | 0;
  37142. x8 ^= u<<9 | u>>>(32-9);
  37143. u = x8 + x11 | 0;
  37144. x9 ^= u<<13 | u>>>(32-13);
  37145. u = x9 + x8 | 0;
  37146. x10 ^= u<<18 | u>>>(32-18);
  37147. u = x15 + x14 | 0;
  37148. x12 ^= u<<7 | u>>>(32-7);
  37149. u = x12 + x15 | 0;
  37150. x13 ^= u<<9 | u>>>(32-9);
  37151. u = x13 + x12 | 0;
  37152. x14 ^= u<<13 | u>>>(32-13);
  37153. u = x14 + x13 | 0;
  37154. x15 ^= u<<18 | u>>>(32-18);
  37155. }
  37156. x0 = x0 + j0 | 0;
  37157. x1 = x1 + j1 | 0;
  37158. x2 = x2 + j2 | 0;
  37159. x3 = x3 + j3 | 0;
  37160. x4 = x4 + j4 | 0;
  37161. x5 = x5 + j5 | 0;
  37162. x6 = x6 + j6 | 0;
  37163. x7 = x7 + j7 | 0;
  37164. x8 = x8 + j8 | 0;
  37165. x9 = x9 + j9 | 0;
  37166. x10 = x10 + j10 | 0;
  37167. x11 = x11 + j11 | 0;
  37168. x12 = x12 + j12 | 0;
  37169. x13 = x13 + j13 | 0;
  37170. x14 = x14 + j14 | 0;
  37171. x15 = x15 + j15 | 0;
  37172. o[ 0] = x0 >>> 0 & 0xff;
  37173. o[ 1] = x0 >>> 8 & 0xff;
  37174. o[ 2] = x0 >>> 16 & 0xff;
  37175. o[ 3] = x0 >>> 24 & 0xff;
  37176. o[ 4] = x1 >>> 0 & 0xff;
  37177. o[ 5] = x1 >>> 8 & 0xff;
  37178. o[ 6] = x1 >>> 16 & 0xff;
  37179. o[ 7] = x1 >>> 24 & 0xff;
  37180. o[ 8] = x2 >>> 0 & 0xff;
  37181. o[ 9] = x2 >>> 8 & 0xff;
  37182. o[10] = x2 >>> 16 & 0xff;
  37183. o[11] = x2 >>> 24 & 0xff;
  37184. o[12] = x3 >>> 0 & 0xff;
  37185. o[13] = x3 >>> 8 & 0xff;
  37186. o[14] = x3 >>> 16 & 0xff;
  37187. o[15] = x3 >>> 24 & 0xff;
  37188. o[16] = x4 >>> 0 & 0xff;
  37189. o[17] = x4 >>> 8 & 0xff;
  37190. o[18] = x4 >>> 16 & 0xff;
  37191. o[19] = x4 >>> 24 & 0xff;
  37192. o[20] = x5 >>> 0 & 0xff;
  37193. o[21] = x5 >>> 8 & 0xff;
  37194. o[22] = x5 >>> 16 & 0xff;
  37195. o[23] = x5 >>> 24 & 0xff;
  37196. o[24] = x6 >>> 0 & 0xff;
  37197. o[25] = x6 >>> 8 & 0xff;
  37198. o[26] = x6 >>> 16 & 0xff;
  37199. o[27] = x6 >>> 24 & 0xff;
  37200. o[28] = x7 >>> 0 & 0xff;
  37201. o[29] = x7 >>> 8 & 0xff;
  37202. o[30] = x7 >>> 16 & 0xff;
  37203. o[31] = x7 >>> 24 & 0xff;
  37204. o[32] = x8 >>> 0 & 0xff;
  37205. o[33] = x8 >>> 8 & 0xff;
  37206. o[34] = x8 >>> 16 & 0xff;
  37207. o[35] = x8 >>> 24 & 0xff;
  37208. o[36] = x9 >>> 0 & 0xff;
  37209. o[37] = x9 >>> 8 & 0xff;
  37210. o[38] = x9 >>> 16 & 0xff;
  37211. o[39] = x9 >>> 24 & 0xff;
  37212. o[40] = x10 >>> 0 & 0xff;
  37213. o[41] = x10 >>> 8 & 0xff;
  37214. o[42] = x10 >>> 16 & 0xff;
  37215. o[43] = x10 >>> 24 & 0xff;
  37216. o[44] = x11 >>> 0 & 0xff;
  37217. o[45] = x11 >>> 8 & 0xff;
  37218. o[46] = x11 >>> 16 & 0xff;
  37219. o[47] = x11 >>> 24 & 0xff;
  37220. o[48] = x12 >>> 0 & 0xff;
  37221. o[49] = x12 >>> 8 & 0xff;
  37222. o[50] = x12 >>> 16 & 0xff;
  37223. o[51] = x12 >>> 24 & 0xff;
  37224. o[52] = x13 >>> 0 & 0xff;
  37225. o[53] = x13 >>> 8 & 0xff;
  37226. o[54] = x13 >>> 16 & 0xff;
  37227. o[55] = x13 >>> 24 & 0xff;
  37228. o[56] = x14 >>> 0 & 0xff;
  37229. o[57] = x14 >>> 8 & 0xff;
  37230. o[58] = x14 >>> 16 & 0xff;
  37231. o[59] = x14 >>> 24 & 0xff;
  37232. o[60] = x15 >>> 0 & 0xff;
  37233. o[61] = x15 >>> 8 & 0xff;
  37234. o[62] = x15 >>> 16 & 0xff;
  37235. o[63] = x15 >>> 24 & 0xff;
  37236. }
  37237. function core_hsalsa20(o,p,k,c) {
  37238. var j0 = c[ 0] & 0xff | (c[ 1] & 0xff)<<8 | (c[ 2] & 0xff)<<16 | (c[ 3] & 0xff)<<24,
  37239. j1 = k[ 0] & 0xff | (k[ 1] & 0xff)<<8 | (k[ 2] & 0xff)<<16 | (k[ 3] & 0xff)<<24,
  37240. j2 = k[ 4] & 0xff | (k[ 5] & 0xff)<<8 | (k[ 6] & 0xff)<<16 | (k[ 7] & 0xff)<<24,
  37241. j3 = k[ 8] & 0xff | (k[ 9] & 0xff)<<8 | (k[10] & 0xff)<<16 | (k[11] & 0xff)<<24,
  37242. j4 = k[12] & 0xff | (k[13] & 0xff)<<8 | (k[14] & 0xff)<<16 | (k[15] & 0xff)<<24,
  37243. j5 = c[ 4] & 0xff | (c[ 5] & 0xff)<<8 | (c[ 6] & 0xff)<<16 | (c[ 7] & 0xff)<<24,
  37244. j6 = p[ 0] & 0xff | (p[ 1] & 0xff)<<8 | (p[ 2] & 0xff)<<16 | (p[ 3] & 0xff)<<24,
  37245. j7 = p[ 4] & 0xff | (p[ 5] & 0xff)<<8 | (p[ 6] & 0xff)<<16 | (p[ 7] & 0xff)<<24,
  37246. j8 = p[ 8] & 0xff | (p[ 9] & 0xff)<<8 | (p[10] & 0xff)<<16 | (p[11] & 0xff)<<24,
  37247. j9 = p[12] & 0xff | (p[13] & 0xff)<<8 | (p[14] & 0xff)<<16 | (p[15] & 0xff)<<24,
  37248. j10 = c[ 8] & 0xff | (c[ 9] & 0xff)<<8 | (c[10] & 0xff)<<16 | (c[11] & 0xff)<<24,
  37249. j11 = k[16] & 0xff | (k[17] & 0xff)<<8 | (k[18] & 0xff)<<16 | (k[19] & 0xff)<<24,
  37250. j12 = k[20] & 0xff | (k[21] & 0xff)<<8 | (k[22] & 0xff)<<16 | (k[23] & 0xff)<<24,
  37251. j13 = k[24] & 0xff | (k[25] & 0xff)<<8 | (k[26] & 0xff)<<16 | (k[27] & 0xff)<<24,
  37252. j14 = k[28] & 0xff | (k[29] & 0xff)<<8 | (k[30] & 0xff)<<16 | (k[31] & 0xff)<<24,
  37253. j15 = c[12] & 0xff | (c[13] & 0xff)<<8 | (c[14] & 0xff)<<16 | (c[15] & 0xff)<<24;
  37254. var x0 = j0, x1 = j1, x2 = j2, x3 = j3, x4 = j4, x5 = j5, x6 = j6, x7 = j7,
  37255. x8 = j8, x9 = j9, x10 = j10, x11 = j11, x12 = j12, x13 = j13, x14 = j14,
  37256. x15 = j15, u;
  37257. for (var i = 0; i < 20; i += 2) {
  37258. u = x0 + x12 | 0;
  37259. x4 ^= u<<7 | u>>>(32-7);
  37260. u = x4 + x0 | 0;
  37261. x8 ^= u<<9 | u>>>(32-9);
  37262. u = x8 + x4 | 0;
  37263. x12 ^= u<<13 | u>>>(32-13);
  37264. u = x12 + x8 | 0;
  37265. x0 ^= u<<18 | u>>>(32-18);
  37266. u = x5 + x1 | 0;
  37267. x9 ^= u<<7 | u>>>(32-7);
  37268. u = x9 + x5 | 0;
  37269. x13 ^= u<<9 | u>>>(32-9);
  37270. u = x13 + x9 | 0;
  37271. x1 ^= u<<13 | u>>>(32-13);
  37272. u = x1 + x13 | 0;
  37273. x5 ^= u<<18 | u>>>(32-18);
  37274. u = x10 + x6 | 0;
  37275. x14 ^= u<<7 | u>>>(32-7);
  37276. u = x14 + x10 | 0;
  37277. x2 ^= u<<9 | u>>>(32-9);
  37278. u = x2 + x14 | 0;
  37279. x6 ^= u<<13 | u>>>(32-13);
  37280. u = x6 + x2 | 0;
  37281. x10 ^= u<<18 | u>>>(32-18);
  37282. u = x15 + x11 | 0;
  37283. x3 ^= u<<7 | u>>>(32-7);
  37284. u = x3 + x15 | 0;
  37285. x7 ^= u<<9 | u>>>(32-9);
  37286. u = x7 + x3 | 0;
  37287. x11 ^= u<<13 | u>>>(32-13);
  37288. u = x11 + x7 | 0;
  37289. x15 ^= u<<18 | u>>>(32-18);
  37290. u = x0 + x3 | 0;
  37291. x1 ^= u<<7 | u>>>(32-7);
  37292. u = x1 + x0 | 0;
  37293. x2 ^= u<<9 | u>>>(32-9);
  37294. u = x2 + x1 | 0;
  37295. x3 ^= u<<13 | u>>>(32-13);
  37296. u = x3 + x2 | 0;
  37297. x0 ^= u<<18 | u>>>(32-18);
  37298. u = x5 + x4 | 0;
  37299. x6 ^= u<<7 | u>>>(32-7);
  37300. u = x6 + x5 | 0;
  37301. x7 ^= u<<9 | u>>>(32-9);
  37302. u = x7 + x6 | 0;
  37303. x4 ^= u<<13 | u>>>(32-13);
  37304. u = x4 + x7 | 0;
  37305. x5 ^= u<<18 | u>>>(32-18);
  37306. u = x10 + x9 | 0;
  37307. x11 ^= u<<7 | u>>>(32-7);
  37308. u = x11 + x10 | 0;
  37309. x8 ^= u<<9 | u>>>(32-9);
  37310. u = x8 + x11 | 0;
  37311. x9 ^= u<<13 | u>>>(32-13);
  37312. u = x9 + x8 | 0;
  37313. x10 ^= u<<18 | u>>>(32-18);
  37314. u = x15 + x14 | 0;
  37315. x12 ^= u<<7 | u>>>(32-7);
  37316. u = x12 + x15 | 0;
  37317. x13 ^= u<<9 | u>>>(32-9);
  37318. u = x13 + x12 | 0;
  37319. x14 ^= u<<13 | u>>>(32-13);
  37320. u = x14 + x13 | 0;
  37321. x15 ^= u<<18 | u>>>(32-18);
  37322. }
  37323. o[ 0] = x0 >>> 0 & 0xff;
  37324. o[ 1] = x0 >>> 8 & 0xff;
  37325. o[ 2] = x0 >>> 16 & 0xff;
  37326. o[ 3] = x0 >>> 24 & 0xff;
  37327. o[ 4] = x5 >>> 0 & 0xff;
  37328. o[ 5] = x5 >>> 8 & 0xff;
  37329. o[ 6] = x5 >>> 16 & 0xff;
  37330. o[ 7] = x5 >>> 24 & 0xff;
  37331. o[ 8] = x10 >>> 0 & 0xff;
  37332. o[ 9] = x10 >>> 8 & 0xff;
  37333. o[10] = x10 >>> 16 & 0xff;
  37334. o[11] = x10 >>> 24 & 0xff;
  37335. o[12] = x15 >>> 0 & 0xff;
  37336. o[13] = x15 >>> 8 & 0xff;
  37337. o[14] = x15 >>> 16 & 0xff;
  37338. o[15] = x15 >>> 24 & 0xff;
  37339. o[16] = x6 >>> 0 & 0xff;
  37340. o[17] = x6 >>> 8 & 0xff;
  37341. o[18] = x6 >>> 16 & 0xff;
  37342. o[19] = x6 >>> 24 & 0xff;
  37343. o[20] = x7 >>> 0 & 0xff;
  37344. o[21] = x7 >>> 8 & 0xff;
  37345. o[22] = x7 >>> 16 & 0xff;
  37346. o[23] = x7 >>> 24 & 0xff;
  37347. o[24] = x8 >>> 0 & 0xff;
  37348. o[25] = x8 >>> 8 & 0xff;
  37349. o[26] = x8 >>> 16 & 0xff;
  37350. o[27] = x8 >>> 24 & 0xff;
  37351. o[28] = x9 >>> 0 & 0xff;
  37352. o[29] = x9 >>> 8 & 0xff;
  37353. o[30] = x9 >>> 16 & 0xff;
  37354. o[31] = x9 >>> 24 & 0xff;
  37355. }
  37356. function crypto_core_salsa20(out,inp,k,c) {
  37357. core_salsa20(out,inp,k,c);
  37358. }
  37359. function crypto_core_hsalsa20(out,inp,k,c) {
  37360. core_hsalsa20(out,inp,k,c);
  37361. }
  37362. var sigma = new Uint8Array([101, 120, 112, 97, 110, 100, 32, 51, 50, 45, 98, 121, 116, 101, 32, 107]);
  37363. // "expand 32-byte k"
  37364. function crypto_stream_salsa20_xor(c,cpos,m,mpos,b,n,k) {
  37365. var z = new Uint8Array(16), x = new Uint8Array(64);
  37366. var u, i;
  37367. for (i = 0; i < 16; i++) z[i] = 0;
  37368. for (i = 0; i < 8; i++) z[i] = n[i];
  37369. while (b >= 64) {
  37370. crypto_core_salsa20(x,z,k,sigma);
  37371. for (i = 0; i < 64; i++) c[cpos+i] = m[mpos+i] ^ x[i];
  37372. u = 1;
  37373. for (i = 8; i < 16; i++) {
  37374. u = u + (z[i] & 0xff) | 0;
  37375. z[i] = u & 0xff;
  37376. u >>>= 8;
  37377. }
  37378. b -= 64;
  37379. cpos += 64;
  37380. mpos += 64;
  37381. }
  37382. if (b > 0) {
  37383. crypto_core_salsa20(x,z,k,sigma);
  37384. for (i = 0; i < b; i++) c[cpos+i] = m[mpos+i] ^ x[i];
  37385. }
  37386. return 0;
  37387. }
  37388. function crypto_stream_salsa20(c,cpos,b,n,k) {
  37389. var z = new Uint8Array(16), x = new Uint8Array(64);
  37390. var u, i;
  37391. for (i = 0; i < 16; i++) z[i] = 0;
  37392. for (i = 0; i < 8; i++) z[i] = n[i];
  37393. while (b >= 64) {
  37394. crypto_core_salsa20(x,z,k,sigma);
  37395. for (i = 0; i < 64; i++) c[cpos+i] = x[i];
  37396. u = 1;
  37397. for (i = 8; i < 16; i++) {
  37398. u = u + (z[i] & 0xff) | 0;
  37399. z[i] = u & 0xff;
  37400. u >>>= 8;
  37401. }
  37402. b -= 64;
  37403. cpos += 64;
  37404. }
  37405. if (b > 0) {
  37406. crypto_core_salsa20(x,z,k,sigma);
  37407. for (i = 0; i < b; i++) c[cpos+i] = x[i];
  37408. }
  37409. return 0;
  37410. }
  37411. function crypto_stream(c,cpos,d,n,k) {
  37412. var s = new Uint8Array(32);
  37413. crypto_core_hsalsa20(s,n,k,sigma);
  37414. var sn = new Uint8Array(8);
  37415. for (var i = 0; i < 8; i++) sn[i] = n[i+16];
  37416. return crypto_stream_salsa20(c,cpos,d,sn,s);
  37417. }
  37418. function crypto_stream_xor(c,cpos,m,mpos,d,n,k) {
  37419. var s = new Uint8Array(32);
  37420. crypto_core_hsalsa20(s,n,k,sigma);
  37421. var sn = new Uint8Array(8);
  37422. for (var i = 0; i < 8; i++) sn[i] = n[i+16];
  37423. return crypto_stream_salsa20_xor(c,cpos,m,mpos,d,sn,s);
  37424. }
  37425. /*
  37426. * Port of Andrew Moon's Poly1305-donna-16. Public domain.
  37427. * https://github.com/floodyberry/poly1305-donna
  37428. */
  37429. var poly1305 = function(key) {
  37430. this.buffer = new Uint8Array(16);
  37431. this.r = new Uint16Array(10);
  37432. this.h = new Uint16Array(10);
  37433. this.pad = new Uint16Array(8);
  37434. this.leftover = 0;
  37435. this.fin = 0;
  37436. var t0, t1, t2, t3, t4, t5, t6, t7;
  37437. t0 = key[ 0] & 0xff | (key[ 1] & 0xff) << 8; this.r[0] = ( t0 ) & 0x1fff;
  37438. t1 = key[ 2] & 0xff | (key[ 3] & 0xff) << 8; this.r[1] = ((t0 >>> 13) | (t1 << 3)) & 0x1fff;
  37439. t2 = key[ 4] & 0xff | (key[ 5] & 0xff) << 8; this.r[2] = ((t1 >>> 10) | (t2 << 6)) & 0x1f03;
  37440. t3 = key[ 6] & 0xff | (key[ 7] & 0xff) << 8; this.r[3] = ((t2 >>> 7) | (t3 << 9)) & 0x1fff;
  37441. t4 = key[ 8] & 0xff | (key[ 9] & 0xff) << 8; this.r[4] = ((t3 >>> 4) | (t4 << 12)) & 0x00ff;
  37442. this.r[5] = ((t4 >>> 1)) & 0x1ffe;
  37443. t5 = key[10] & 0xff | (key[11] & 0xff) << 8; this.r[6] = ((t4 >>> 14) | (t5 << 2)) & 0x1fff;
  37444. t6 = key[12] & 0xff | (key[13] & 0xff) << 8; this.r[7] = ((t5 >>> 11) | (t6 << 5)) & 0x1f81;
  37445. t7 = key[14] & 0xff | (key[15] & 0xff) << 8; this.r[8] = ((t6 >>> 8) | (t7 << 8)) & 0x1fff;
  37446. this.r[9] = ((t7 >>> 5)) & 0x007f;
  37447. this.pad[0] = key[16] & 0xff | (key[17] & 0xff) << 8;
  37448. this.pad[1] = key[18] & 0xff | (key[19] & 0xff) << 8;
  37449. this.pad[2] = key[20] & 0xff | (key[21] & 0xff) << 8;
  37450. this.pad[3] = key[22] & 0xff | (key[23] & 0xff) << 8;
  37451. this.pad[4] = key[24] & 0xff | (key[25] & 0xff) << 8;
  37452. this.pad[5] = key[26] & 0xff | (key[27] & 0xff) << 8;
  37453. this.pad[6] = key[28] & 0xff | (key[29] & 0xff) << 8;
  37454. this.pad[7] = key[30] & 0xff | (key[31] & 0xff) << 8;
  37455. };
  37456. poly1305.prototype.blocks = function(m, mpos, bytes) {
  37457. var hibit = this.fin ? 0 : (1 << 11);
  37458. var t0, t1, t2, t3, t4, t5, t6, t7, c;
  37459. var d0, d1, d2, d3, d4, d5, d6, d7, d8, d9;
  37460. var h0 = this.h[0],
  37461. h1 = this.h[1],
  37462. h2 = this.h[2],
  37463. h3 = this.h[3],
  37464. h4 = this.h[4],
  37465. h5 = this.h[5],
  37466. h6 = this.h[6],
  37467. h7 = this.h[7],
  37468. h8 = this.h[8],
  37469. h9 = this.h[9];
  37470. var r0 = this.r[0],
  37471. r1 = this.r[1],
  37472. r2 = this.r[2],
  37473. r3 = this.r[3],
  37474. r4 = this.r[4],
  37475. r5 = this.r[5],
  37476. r6 = this.r[6],
  37477. r7 = this.r[7],
  37478. r8 = this.r[8],
  37479. r9 = this.r[9];
  37480. while (bytes >= 16) {
  37481. t0 = m[mpos+ 0] & 0xff | (m[mpos+ 1] & 0xff) << 8; h0 += ( t0 ) & 0x1fff;
  37482. t1 = m[mpos+ 2] & 0xff | (m[mpos+ 3] & 0xff) << 8; h1 += ((t0 >>> 13) | (t1 << 3)) & 0x1fff;
  37483. t2 = m[mpos+ 4] & 0xff | (m[mpos+ 5] & 0xff) << 8; h2 += ((t1 >>> 10) | (t2 << 6)) & 0x1fff;
  37484. t3 = m[mpos+ 6] & 0xff | (m[mpos+ 7] & 0xff) << 8; h3 += ((t2 >>> 7) | (t3 << 9)) & 0x1fff;
  37485. t4 = m[mpos+ 8] & 0xff | (m[mpos+ 9] & 0xff) << 8; h4 += ((t3 >>> 4) | (t4 << 12)) & 0x1fff;
  37486. h5 += ((t4 >>> 1)) & 0x1fff;
  37487. t5 = m[mpos+10] & 0xff | (m[mpos+11] & 0xff) << 8; h6 += ((t4 >>> 14) | (t5 << 2)) & 0x1fff;
  37488. t6 = m[mpos+12] & 0xff | (m[mpos+13] & 0xff) << 8; h7 += ((t5 >>> 11) | (t6 << 5)) & 0x1fff;
  37489. t7 = m[mpos+14] & 0xff | (m[mpos+15] & 0xff) << 8; h8 += ((t6 >>> 8) | (t7 << 8)) & 0x1fff;
  37490. h9 += ((t7 >>> 5)) | hibit;
  37491. c = 0;
  37492. d0 = c;
  37493. d0 += h0 * r0;
  37494. d0 += h1 * (5 * r9);
  37495. d0 += h2 * (5 * r8);
  37496. d0 += h3 * (5 * r7);
  37497. d0 += h4 * (5 * r6);
  37498. c = (d0 >>> 13); d0 &= 0x1fff;
  37499. d0 += h5 * (5 * r5);
  37500. d0 += h6 * (5 * r4);
  37501. d0 += h7 * (5 * r3);
  37502. d0 += h8 * (5 * r2);
  37503. d0 += h9 * (5 * r1);
  37504. c += (d0 >>> 13); d0 &= 0x1fff;
  37505. d1 = c;
  37506. d1 += h0 * r1;
  37507. d1 += h1 * r0;
  37508. d1 += h2 * (5 * r9);
  37509. d1 += h3 * (5 * r8);
  37510. d1 += h4 * (5 * r7);
  37511. c = (d1 >>> 13); d1 &= 0x1fff;
  37512. d1 += h5 * (5 * r6);
  37513. d1 += h6 * (5 * r5);
  37514. d1 += h7 * (5 * r4);
  37515. d1 += h8 * (5 * r3);
  37516. d1 += h9 * (5 * r2);
  37517. c += (d1 >>> 13); d1 &= 0x1fff;
  37518. d2 = c;
  37519. d2 += h0 * r2;
  37520. d2 += h1 * r1;
  37521. d2 += h2 * r0;
  37522. d2 += h3 * (5 * r9);
  37523. d2 += h4 * (5 * r8);
  37524. c = (d2 >>> 13); d2 &= 0x1fff;
  37525. d2 += h5 * (5 * r7);
  37526. d2 += h6 * (5 * r6);
  37527. d2 += h7 * (5 * r5);
  37528. d2 += h8 * (5 * r4);
  37529. d2 += h9 * (5 * r3);
  37530. c += (d2 >>> 13); d2 &= 0x1fff;
  37531. d3 = c;
  37532. d3 += h0 * r3;
  37533. d3 += h1 * r2;
  37534. d3 += h2 * r1;
  37535. d3 += h3 * r0;
  37536. d3 += h4 * (5 * r9);
  37537. c = (d3 >>> 13); d3 &= 0x1fff;
  37538. d3 += h5 * (5 * r8);
  37539. d3 += h6 * (5 * r7);
  37540. d3 += h7 * (5 * r6);
  37541. d3 += h8 * (5 * r5);
  37542. d3 += h9 * (5 * r4);
  37543. c += (d3 >>> 13); d3 &= 0x1fff;
  37544. d4 = c;
  37545. d4 += h0 * r4;
  37546. d4 += h1 * r3;
  37547. d4 += h2 * r2;
  37548. d4 += h3 * r1;
  37549. d4 += h4 * r0;
  37550. c = (d4 >>> 13); d4 &= 0x1fff;
  37551. d4 += h5 * (5 * r9);
  37552. d4 += h6 * (5 * r8);
  37553. d4 += h7 * (5 * r7);
  37554. d4 += h8 * (5 * r6);
  37555. d4 += h9 * (5 * r5);
  37556. c += (d4 >>> 13); d4 &= 0x1fff;
  37557. d5 = c;
  37558. d5 += h0 * r5;
  37559. d5 += h1 * r4;
  37560. d5 += h2 * r3;
  37561. d5 += h3 * r2;
  37562. d5 += h4 * r1;
  37563. c = (d5 >>> 13); d5 &= 0x1fff;
  37564. d5 += h5 * r0;
  37565. d5 += h6 * (5 * r9);
  37566. d5 += h7 * (5 * r8);
  37567. d5 += h8 * (5 * r7);
  37568. d5 += h9 * (5 * r6);
  37569. c += (d5 >>> 13); d5 &= 0x1fff;
  37570. d6 = c;
  37571. d6 += h0 * r6;
  37572. d6 += h1 * r5;
  37573. d6 += h2 * r4;
  37574. d6 += h3 * r3;
  37575. d6 += h4 * r2;
  37576. c = (d6 >>> 13); d6 &= 0x1fff;
  37577. d6 += h5 * r1;
  37578. d6 += h6 * r0;
  37579. d6 += h7 * (5 * r9);
  37580. d6 += h8 * (5 * r8);
  37581. d6 += h9 * (5 * r7);
  37582. c += (d6 >>> 13); d6 &= 0x1fff;
  37583. d7 = c;
  37584. d7 += h0 * r7;
  37585. d7 += h1 * r6;
  37586. d7 += h2 * r5;
  37587. d7 += h3 * r4;
  37588. d7 += h4 * r3;
  37589. c = (d7 >>> 13); d7 &= 0x1fff;
  37590. d7 += h5 * r2;
  37591. d7 += h6 * r1;
  37592. d7 += h7 * r0;
  37593. d7 += h8 * (5 * r9);
  37594. d7 += h9 * (5 * r8);
  37595. c += (d7 >>> 13); d7 &= 0x1fff;
  37596. d8 = c;
  37597. d8 += h0 * r8;
  37598. d8 += h1 * r7;
  37599. d8 += h2 * r6;
  37600. d8 += h3 * r5;
  37601. d8 += h4 * r4;
  37602. c = (d8 >>> 13); d8 &= 0x1fff;
  37603. d8 += h5 * r3;
  37604. d8 += h6 * r2;
  37605. d8 += h7 * r1;
  37606. d8 += h8 * r0;
  37607. d8 += h9 * (5 * r9);
  37608. c += (d8 >>> 13); d8 &= 0x1fff;
  37609. d9 = c;
  37610. d9 += h0 * r9;
  37611. d9 += h1 * r8;
  37612. d9 += h2 * r7;
  37613. d9 += h3 * r6;
  37614. d9 += h4 * r5;
  37615. c = (d9 >>> 13); d9 &= 0x1fff;
  37616. d9 += h5 * r4;
  37617. d9 += h6 * r3;
  37618. d9 += h7 * r2;
  37619. d9 += h8 * r1;
  37620. d9 += h9 * r0;
  37621. c += (d9 >>> 13); d9 &= 0x1fff;
  37622. c = (((c << 2) + c)) | 0;
  37623. c = (c + d0) | 0;
  37624. d0 = c & 0x1fff;
  37625. c = (c >>> 13);
  37626. d1 += c;
  37627. h0 = d0;
  37628. h1 = d1;
  37629. h2 = d2;
  37630. h3 = d3;
  37631. h4 = d4;
  37632. h5 = d5;
  37633. h6 = d6;
  37634. h7 = d7;
  37635. h8 = d8;
  37636. h9 = d9;
  37637. mpos += 16;
  37638. bytes -= 16;
  37639. }
  37640. this.h[0] = h0;
  37641. this.h[1] = h1;
  37642. this.h[2] = h2;
  37643. this.h[3] = h3;
  37644. this.h[4] = h4;
  37645. this.h[5] = h5;
  37646. this.h[6] = h6;
  37647. this.h[7] = h7;
  37648. this.h[8] = h8;
  37649. this.h[9] = h9;
  37650. };
  37651. poly1305.prototype.finish = function(mac, macpos) {
  37652. var g = new Uint16Array(10);
  37653. var c, mask, f, i;
  37654. if (this.leftover) {
  37655. i = this.leftover;
  37656. this.buffer[i++] = 1;
  37657. for (; i < 16; i++) this.buffer[i] = 0;
  37658. this.fin = 1;
  37659. this.blocks(this.buffer, 0, 16);
  37660. }
  37661. c = this.h[1] >>> 13;
  37662. this.h[1] &= 0x1fff;
  37663. for (i = 2; i < 10; i++) {
  37664. this.h[i] += c;
  37665. c = this.h[i] >>> 13;
  37666. this.h[i] &= 0x1fff;
  37667. }
  37668. this.h[0] += (c * 5);
  37669. c = this.h[0] >>> 13;
  37670. this.h[0] &= 0x1fff;
  37671. this.h[1] += c;
  37672. c = this.h[1] >>> 13;
  37673. this.h[1] &= 0x1fff;
  37674. this.h[2] += c;
  37675. g[0] = this.h[0] + 5;
  37676. c = g[0] >>> 13;
  37677. g[0] &= 0x1fff;
  37678. for (i = 1; i < 10; i++) {
  37679. g[i] = this.h[i] + c;
  37680. c = g[i] >>> 13;
  37681. g[i] &= 0x1fff;
  37682. }
  37683. g[9] -= (1 << 13);
  37684. mask = (c ^ 1) - 1;
  37685. for (i = 0; i < 10; i++) g[i] &= mask;
  37686. mask = ~mask;
  37687. for (i = 0; i < 10; i++) this.h[i] = (this.h[i] & mask) | g[i];
  37688. this.h[0] = ((this.h[0] ) | (this.h[1] << 13) ) & 0xffff;
  37689. this.h[1] = ((this.h[1] >>> 3) | (this.h[2] << 10) ) & 0xffff;
  37690. this.h[2] = ((this.h[2] >>> 6) | (this.h[3] << 7) ) & 0xffff;
  37691. this.h[3] = ((this.h[3] >>> 9) | (this.h[4] << 4) ) & 0xffff;
  37692. this.h[4] = ((this.h[4] >>> 12) | (this.h[5] << 1) | (this.h[6] << 14)) & 0xffff;
  37693. this.h[5] = ((this.h[6] >>> 2) | (this.h[7] << 11) ) & 0xffff;
  37694. this.h[6] = ((this.h[7] >>> 5) | (this.h[8] << 8) ) & 0xffff;
  37695. this.h[7] = ((this.h[8] >>> 8) | (this.h[9] << 5) ) & 0xffff;
  37696. f = this.h[0] + this.pad[0];
  37697. this.h[0] = f & 0xffff;
  37698. for (i = 1; i < 8; i++) {
  37699. f = (((this.h[i] + this.pad[i]) | 0) + (f >>> 16)) | 0;
  37700. this.h[i] = f & 0xffff;
  37701. }
  37702. mac[macpos+ 0] = (this.h[0] >>> 0) & 0xff;
  37703. mac[macpos+ 1] = (this.h[0] >>> 8) & 0xff;
  37704. mac[macpos+ 2] = (this.h[1] >>> 0) & 0xff;
  37705. mac[macpos+ 3] = (this.h[1] >>> 8) & 0xff;
  37706. mac[macpos+ 4] = (this.h[2] >>> 0) & 0xff;
  37707. mac[macpos+ 5] = (this.h[2] >>> 8) & 0xff;
  37708. mac[macpos+ 6] = (this.h[3] >>> 0) & 0xff;
  37709. mac[macpos+ 7] = (this.h[3] >>> 8) & 0xff;
  37710. mac[macpos+ 8] = (this.h[4] >>> 0) & 0xff;
  37711. mac[macpos+ 9] = (this.h[4] >>> 8) & 0xff;
  37712. mac[macpos+10] = (this.h[5] >>> 0) & 0xff;
  37713. mac[macpos+11] = (this.h[5] >>> 8) & 0xff;
  37714. mac[macpos+12] = (this.h[6] >>> 0) & 0xff;
  37715. mac[macpos+13] = (this.h[6] >>> 8) & 0xff;
  37716. mac[macpos+14] = (this.h[7] >>> 0) & 0xff;
  37717. mac[macpos+15] = (this.h[7] >>> 8) & 0xff;
  37718. };
  37719. poly1305.prototype.update = function(m, mpos, bytes) {
  37720. var i, want;
  37721. if (this.leftover) {
  37722. want = (16 - this.leftover);
  37723. if (want > bytes)
  37724. want = bytes;
  37725. for (i = 0; i < want; i++)
  37726. this.buffer[this.leftover + i] = m[mpos+i];
  37727. bytes -= want;
  37728. mpos += want;
  37729. this.leftover += want;
  37730. if (this.leftover < 16)
  37731. return;
  37732. this.blocks(this.buffer, 0, 16);
  37733. this.leftover = 0;
  37734. }
  37735. if (bytes >= 16) {
  37736. want = bytes - (bytes % 16);
  37737. this.blocks(m, mpos, want);
  37738. mpos += want;
  37739. bytes -= want;
  37740. }
  37741. if (bytes) {
  37742. for (i = 0; i < bytes; i++)
  37743. this.buffer[this.leftover + i] = m[mpos+i];
  37744. this.leftover += bytes;
  37745. }
  37746. };
  37747. function crypto_onetimeauth(out, outpos, m, mpos, n, k) {
  37748. var s = new poly1305(k);
  37749. s.update(m, mpos, n);
  37750. s.finish(out, outpos);
  37751. return 0;
  37752. }
  37753. function crypto_onetimeauth_verify(h, hpos, m, mpos, n, k) {
  37754. var x = new Uint8Array(16);
  37755. crypto_onetimeauth(x,0,m,mpos,n,k);
  37756. return crypto_verify_16(h,hpos,x,0);
  37757. }
  37758. function crypto_secretbox(c,m,d,n,k) {
  37759. var i;
  37760. if (d < 32) return -1;
  37761. crypto_stream_xor(c,0,m,0,d,n,k);
  37762. crypto_onetimeauth(c, 16, c, 32, d - 32, c);
  37763. for (i = 0; i < 16; i++) c[i] = 0;
  37764. return 0;
  37765. }
  37766. function crypto_secretbox_open(m,c,d,n,k) {
  37767. var i;
  37768. var x = new Uint8Array(32);
  37769. if (d < 32) return -1;
  37770. crypto_stream(x,0,32,n,k);
  37771. if (crypto_onetimeauth_verify(c, 16,c, 32,d - 32,x) !== 0) return -1;
  37772. crypto_stream_xor(m,0,c,0,d,n,k);
  37773. for (i = 0; i < 32; i++) m[i] = 0;
  37774. return 0;
  37775. }
  37776. function set25519(r, a) {
  37777. var i;
  37778. for (i = 0; i < 16; i++) r[i] = a[i]|0;
  37779. }
  37780. function car25519(o) {
  37781. var i, v, c = 1;
  37782. for (i = 0; i < 16; i++) {
  37783. v = o[i] + c + 65535;
  37784. c = Math.floor(v / 65536);
  37785. o[i] = v - c * 65536;
  37786. }
  37787. o[0] += c-1 + 37 * (c-1);
  37788. }
  37789. function sel25519(p, q, b) {
  37790. var t, c = ~(b-1);
  37791. for (var i = 0; i < 16; i++) {
  37792. t = c & (p[i] ^ q[i]);
  37793. p[i] ^= t;
  37794. q[i] ^= t;
  37795. }
  37796. }
  37797. function pack25519(o, n) {
  37798. var i, j, b;
  37799. var m = gf(), t = gf();
  37800. for (i = 0; i < 16; i++) t[i] = n[i];
  37801. car25519(t);
  37802. car25519(t);
  37803. car25519(t);
  37804. for (j = 0; j < 2; j++) {
  37805. m[0] = t[0] - 0xffed;
  37806. for (i = 1; i < 15; i++) {
  37807. m[i] = t[i] - 0xffff - ((m[i-1]>>16) & 1);
  37808. m[i-1] &= 0xffff;
  37809. }
  37810. m[15] = t[15] - 0x7fff - ((m[14]>>16) & 1);
  37811. b = (m[15]>>16) & 1;
  37812. m[14] &= 0xffff;
  37813. sel25519(t, m, 1-b);
  37814. }
  37815. for (i = 0; i < 16; i++) {
  37816. o[2*i] = t[i] & 0xff;
  37817. o[2*i+1] = t[i]>>8;
  37818. }
  37819. }
  37820. function neq25519(a, b) {
  37821. var c = new Uint8Array(32), d = new Uint8Array(32);
  37822. pack25519(c, a);
  37823. pack25519(d, b);
  37824. return crypto_verify_32(c, 0, d, 0);
  37825. }
  37826. function par25519(a) {
  37827. var d = new Uint8Array(32);
  37828. pack25519(d, a);
  37829. return d[0] & 1;
  37830. }
  37831. function unpack25519(o, n) {
  37832. var i;
  37833. for (i = 0; i < 16; i++) o[i] = n[2*i] + (n[2*i+1] << 8);
  37834. o[15] &= 0x7fff;
  37835. }
  37836. function A(o, a, b) {
  37837. for (var i = 0; i < 16; i++) o[i] = a[i] + b[i];
  37838. }
  37839. function Z(o, a, b) {
  37840. for (var i = 0; i < 16; i++) o[i] = a[i] - b[i];
  37841. }
  37842. function M(o, a, b) {
  37843. var v, c,
  37844. t0 = 0, t1 = 0, t2 = 0, t3 = 0, t4 = 0, t5 = 0, t6 = 0, t7 = 0,
  37845. t8 = 0, t9 = 0, t10 = 0, t11 = 0, t12 = 0, t13 = 0, t14 = 0, t15 = 0,
  37846. t16 = 0, t17 = 0, t18 = 0, t19 = 0, t20 = 0, t21 = 0, t22 = 0, t23 = 0,
  37847. t24 = 0, t25 = 0, t26 = 0, t27 = 0, t28 = 0, t29 = 0, t30 = 0,
  37848. b0 = b[0],
  37849. b1 = b[1],
  37850. b2 = b[2],
  37851. b3 = b[3],
  37852. b4 = b[4],
  37853. b5 = b[5],
  37854. b6 = b[6],
  37855. b7 = b[7],
  37856. b8 = b[8],
  37857. b9 = b[9],
  37858. b10 = b[10],
  37859. b11 = b[11],
  37860. b12 = b[12],
  37861. b13 = b[13],
  37862. b14 = b[14],
  37863. b15 = b[15];
  37864. v = a[0];
  37865. t0 += v * b0;
  37866. t1 += v * b1;
  37867. t2 += v * b2;
  37868. t3 += v * b3;
  37869. t4 += v * b4;
  37870. t5 += v * b5;
  37871. t6 += v * b6;
  37872. t7 += v * b7;
  37873. t8 += v * b8;
  37874. t9 += v * b9;
  37875. t10 += v * b10;
  37876. t11 += v * b11;
  37877. t12 += v * b12;
  37878. t13 += v * b13;
  37879. t14 += v * b14;
  37880. t15 += v * b15;
  37881. v = a[1];
  37882. t1 += v * b0;
  37883. t2 += v * b1;
  37884. t3 += v * b2;
  37885. t4 += v * b3;
  37886. t5 += v * b4;
  37887. t6 += v * b5;
  37888. t7 += v * b6;
  37889. t8 += v * b7;
  37890. t9 += v * b8;
  37891. t10 += v * b9;
  37892. t11 += v * b10;
  37893. t12 += v * b11;
  37894. t13 += v * b12;
  37895. t14 += v * b13;
  37896. t15 += v * b14;
  37897. t16 += v * b15;
  37898. v = a[2];
  37899. t2 += v * b0;
  37900. t3 += v * b1;
  37901. t4 += v * b2;
  37902. t5 += v * b3;
  37903. t6 += v * b4;
  37904. t7 += v * b5;
  37905. t8 += v * b6;
  37906. t9 += v * b7;
  37907. t10 += v * b8;
  37908. t11 += v * b9;
  37909. t12 += v * b10;
  37910. t13 += v * b11;
  37911. t14 += v * b12;
  37912. t15 += v * b13;
  37913. t16 += v * b14;
  37914. t17 += v * b15;
  37915. v = a[3];
  37916. t3 += v * b0;
  37917. t4 += v * b1;
  37918. t5 += v * b2;
  37919. t6 += v * b3;
  37920. t7 += v * b4;
  37921. t8 += v * b5;
  37922. t9 += v * b6;
  37923. t10 += v * b7;
  37924. t11 += v * b8;
  37925. t12 += v * b9;
  37926. t13 += v * b10;
  37927. t14 += v * b11;
  37928. t15 += v * b12;
  37929. t16 += v * b13;
  37930. t17 += v * b14;
  37931. t18 += v * b15;
  37932. v = a[4];
  37933. t4 += v * b0;
  37934. t5 += v * b1;
  37935. t6 += v * b2;
  37936. t7 += v * b3;
  37937. t8 += v * b4;
  37938. t9 += v * b5;
  37939. t10 += v * b6;
  37940. t11 += v * b7;
  37941. t12 += v * b8;
  37942. t13 += v * b9;
  37943. t14 += v * b10;
  37944. t15 += v * b11;
  37945. t16 += v * b12;
  37946. t17 += v * b13;
  37947. t18 += v * b14;
  37948. t19 += v * b15;
  37949. v = a[5];
  37950. t5 += v * b0;
  37951. t6 += v * b1;
  37952. t7 += v * b2;
  37953. t8 += v * b3;
  37954. t9 += v * b4;
  37955. t10 += v * b5;
  37956. t11 += v * b6;
  37957. t12 += v * b7;
  37958. t13 += v * b8;
  37959. t14 += v * b9;
  37960. t15 += v * b10;
  37961. t16 += v * b11;
  37962. t17 += v * b12;
  37963. t18 += v * b13;
  37964. t19 += v * b14;
  37965. t20 += v * b15;
  37966. v = a[6];
  37967. t6 += v * b0;
  37968. t7 += v * b1;
  37969. t8 += v * b2;
  37970. t9 += v * b3;
  37971. t10 += v * b4;
  37972. t11 += v * b5;
  37973. t12 += v * b6;
  37974. t13 += v * b7;
  37975. t14 += v * b8;
  37976. t15 += v * b9;
  37977. t16 += v * b10;
  37978. t17 += v * b11;
  37979. t18 += v * b12;
  37980. t19 += v * b13;
  37981. t20 += v * b14;
  37982. t21 += v * b15;
  37983. v = a[7];
  37984. t7 += v * b0;
  37985. t8 += v * b1;
  37986. t9 += v * b2;
  37987. t10 += v * b3;
  37988. t11 += v * b4;
  37989. t12 += v * b5;
  37990. t13 += v * b6;
  37991. t14 += v * b7;
  37992. t15 += v * b8;
  37993. t16 += v * b9;
  37994. t17 += v * b10;
  37995. t18 += v * b11;
  37996. t19 += v * b12;
  37997. t20 += v * b13;
  37998. t21 += v * b14;
  37999. t22 += v * b15;
  38000. v = a[8];
  38001. t8 += v * b0;
  38002. t9 += v * b1;
  38003. t10 += v * b2;
  38004. t11 += v * b3;
  38005. t12 += v * b4;
  38006. t13 += v * b5;
  38007. t14 += v * b6;
  38008. t15 += v * b7;
  38009. t16 += v * b8;
  38010. t17 += v * b9;
  38011. t18 += v * b10;
  38012. t19 += v * b11;
  38013. t20 += v * b12;
  38014. t21 += v * b13;
  38015. t22 += v * b14;
  38016. t23 += v * b15;
  38017. v = a[9];
  38018. t9 += v * b0;
  38019. t10 += v * b1;
  38020. t11 += v * b2;
  38021. t12 += v * b3;
  38022. t13 += v * b4;
  38023. t14 += v * b5;
  38024. t15 += v * b6;
  38025. t16 += v * b7;
  38026. t17 += v * b8;
  38027. t18 += v * b9;
  38028. t19 += v * b10;
  38029. t20 += v * b11;
  38030. t21 += v * b12;
  38031. t22 += v * b13;
  38032. t23 += v * b14;
  38033. t24 += v * b15;
  38034. v = a[10];
  38035. t10 += v * b0;
  38036. t11 += v * b1;
  38037. t12 += v * b2;
  38038. t13 += v * b3;
  38039. t14 += v * b4;
  38040. t15 += v * b5;
  38041. t16 += v * b6;
  38042. t17 += v * b7;
  38043. t18 += v * b8;
  38044. t19 += v * b9;
  38045. t20 += v * b10;
  38046. t21 += v * b11;
  38047. t22 += v * b12;
  38048. t23 += v * b13;
  38049. t24 += v * b14;
  38050. t25 += v * b15;
  38051. v = a[11];
  38052. t11 += v * b0;
  38053. t12 += v * b1;
  38054. t13 += v * b2;
  38055. t14 += v * b3;
  38056. t15 += v * b4;
  38057. t16 += v * b5;
  38058. t17 += v * b6;
  38059. t18 += v * b7;
  38060. t19 += v * b8;
  38061. t20 += v * b9;
  38062. t21 += v * b10;
  38063. t22 += v * b11;
  38064. t23 += v * b12;
  38065. t24 += v * b13;
  38066. t25 += v * b14;
  38067. t26 += v * b15;
  38068. v = a[12];
  38069. t12 += v * b0;
  38070. t13 += v * b1;
  38071. t14 += v * b2;
  38072. t15 += v * b3;
  38073. t16 += v * b4;
  38074. t17 += v * b5;
  38075. t18 += v * b6;
  38076. t19 += v * b7;
  38077. t20 += v * b8;
  38078. t21 += v * b9;
  38079. t22 += v * b10;
  38080. t23 += v * b11;
  38081. t24 += v * b12;
  38082. t25 += v * b13;
  38083. t26 += v * b14;
  38084. t27 += v * b15;
  38085. v = a[13];
  38086. t13 += v * b0;
  38087. t14 += v * b1;
  38088. t15 += v * b2;
  38089. t16 += v * b3;
  38090. t17 += v * b4;
  38091. t18 += v * b5;
  38092. t19 += v * b6;
  38093. t20 += v * b7;
  38094. t21 += v * b8;
  38095. t22 += v * b9;
  38096. t23 += v * b10;
  38097. t24 += v * b11;
  38098. t25 += v * b12;
  38099. t26 += v * b13;
  38100. t27 += v * b14;
  38101. t28 += v * b15;
  38102. v = a[14];
  38103. t14 += v * b0;
  38104. t15 += v * b1;
  38105. t16 += v * b2;
  38106. t17 += v * b3;
  38107. t18 += v * b4;
  38108. t19 += v * b5;
  38109. t20 += v * b6;
  38110. t21 += v * b7;
  38111. t22 += v * b8;
  38112. t23 += v * b9;
  38113. t24 += v * b10;
  38114. t25 += v * b11;
  38115. t26 += v * b12;
  38116. t27 += v * b13;
  38117. t28 += v * b14;
  38118. t29 += v * b15;
  38119. v = a[15];
  38120. t15 += v * b0;
  38121. t16 += v * b1;
  38122. t17 += v * b2;
  38123. t18 += v * b3;
  38124. t19 += v * b4;
  38125. t20 += v * b5;
  38126. t21 += v * b6;
  38127. t22 += v * b7;
  38128. t23 += v * b8;
  38129. t24 += v * b9;
  38130. t25 += v * b10;
  38131. t26 += v * b11;
  38132. t27 += v * b12;
  38133. t28 += v * b13;
  38134. t29 += v * b14;
  38135. t30 += v * b15;
  38136. t0 += 38 * t16;
  38137. t1 += 38 * t17;
  38138. t2 += 38 * t18;
  38139. t3 += 38 * t19;
  38140. t4 += 38 * t20;
  38141. t5 += 38 * t21;
  38142. t6 += 38 * t22;
  38143. t7 += 38 * t23;
  38144. t8 += 38 * t24;
  38145. t9 += 38 * t25;
  38146. t10 += 38 * t26;
  38147. t11 += 38 * t27;
  38148. t12 += 38 * t28;
  38149. t13 += 38 * t29;
  38150. t14 += 38 * t30;
  38151. // t15 left as is
  38152. // first car
  38153. c = 1;
  38154. v = t0 + c + 65535; c = Math.floor(v / 65536); t0 = v - c * 65536;
  38155. v = t1 + c + 65535; c = Math.floor(v / 65536); t1 = v - c * 65536;
  38156. v = t2 + c + 65535; c = Math.floor(v / 65536); t2 = v - c * 65536;
  38157. v = t3 + c + 65535; c = Math.floor(v / 65536); t3 = v - c * 65536;
  38158. v = t4 + c + 65535; c = Math.floor(v / 65536); t4 = v - c * 65536;
  38159. v = t5 + c + 65535; c = Math.floor(v / 65536); t5 = v - c * 65536;
  38160. v = t6 + c + 65535; c = Math.floor(v / 65536); t6 = v - c * 65536;
  38161. v = t7 + c + 65535; c = Math.floor(v / 65536); t7 = v - c * 65536;
  38162. v = t8 + c + 65535; c = Math.floor(v / 65536); t8 = v - c * 65536;
  38163. v = t9 + c + 65535; c = Math.floor(v / 65536); t9 = v - c * 65536;
  38164. v = t10 + c + 65535; c = Math.floor(v / 65536); t10 = v - c * 65536;
  38165. v = t11 + c + 65535; c = Math.floor(v / 65536); t11 = v - c * 65536;
  38166. v = t12 + c + 65535; c = Math.floor(v / 65536); t12 = v - c * 65536;
  38167. v = t13 + c + 65535; c = Math.floor(v / 65536); t13 = v - c * 65536;
  38168. v = t14 + c + 65535; c = Math.floor(v / 65536); t14 = v - c * 65536;
  38169. v = t15 + c + 65535; c = Math.floor(v / 65536); t15 = v - c * 65536;
  38170. t0 += c-1 + 37 * (c-1);
  38171. // second car
  38172. c = 1;
  38173. v = t0 + c + 65535; c = Math.floor(v / 65536); t0 = v - c * 65536;
  38174. v = t1 + c + 65535; c = Math.floor(v / 65536); t1 = v - c * 65536;
  38175. v = t2 + c + 65535; c = Math.floor(v / 65536); t2 = v - c * 65536;
  38176. v = t3 + c + 65535; c = Math.floor(v / 65536); t3 = v - c * 65536;
  38177. v = t4 + c + 65535; c = Math.floor(v / 65536); t4 = v - c * 65536;
  38178. v = t5 + c + 65535; c = Math.floor(v / 65536); t5 = v - c * 65536;
  38179. v = t6 + c + 65535; c = Math.floor(v / 65536); t6 = v - c * 65536;
  38180. v = t7 + c + 65535; c = Math.floor(v / 65536); t7 = v - c * 65536;
  38181. v = t8 + c + 65535; c = Math.floor(v / 65536); t8 = v - c * 65536;
  38182. v = t9 + c + 65535; c = Math.floor(v / 65536); t9 = v - c * 65536;
  38183. v = t10 + c + 65535; c = Math.floor(v / 65536); t10 = v - c * 65536;
  38184. v = t11 + c + 65535; c = Math.floor(v / 65536); t11 = v - c * 65536;
  38185. v = t12 + c + 65535; c = Math.floor(v / 65536); t12 = v - c * 65536;
  38186. v = t13 + c + 65535; c = Math.floor(v / 65536); t13 = v - c * 65536;
  38187. v = t14 + c + 65535; c = Math.floor(v / 65536); t14 = v - c * 65536;
  38188. v = t15 + c + 65535; c = Math.floor(v / 65536); t15 = v - c * 65536;
  38189. t0 += c-1 + 37 * (c-1);
  38190. o[ 0] = t0;
  38191. o[ 1] = t1;
  38192. o[ 2] = t2;
  38193. o[ 3] = t3;
  38194. o[ 4] = t4;
  38195. o[ 5] = t5;
  38196. o[ 6] = t6;
  38197. o[ 7] = t7;
  38198. o[ 8] = t8;
  38199. o[ 9] = t9;
  38200. o[10] = t10;
  38201. o[11] = t11;
  38202. o[12] = t12;
  38203. o[13] = t13;
  38204. o[14] = t14;
  38205. o[15] = t15;
  38206. }
  38207. function S(o, a) {
  38208. M(o, a, a);
  38209. }
  38210. function inv25519(o, i) {
  38211. var c = gf();
  38212. var a;
  38213. for (a = 0; a < 16; a++) c[a] = i[a];
  38214. for (a = 253; a >= 0; a--) {
  38215. S(c, c);
  38216. if(a !== 2 && a !== 4) M(c, c, i);
  38217. }
  38218. for (a = 0; a < 16; a++) o[a] = c[a];
  38219. }
  38220. function pow2523(o, i) {
  38221. var c = gf();
  38222. var a;
  38223. for (a = 0; a < 16; a++) c[a] = i[a];
  38224. for (a = 250; a >= 0; a--) {
  38225. S(c, c);
  38226. if(a !== 1) M(c, c, i);
  38227. }
  38228. for (a = 0; a < 16; a++) o[a] = c[a];
  38229. }
  38230. function crypto_scalarmult(q, n, p) {
  38231. var z = new Uint8Array(32);
  38232. var x = new Float64Array(80), r, i;
  38233. var a = gf(), b = gf(), c = gf(),
  38234. d = gf(), e = gf(), f = gf();
  38235. for (i = 0; i < 31; i++) z[i] = n[i];
  38236. z[31]=(n[31]&127)|64;
  38237. z[0]&=248;
  38238. unpack25519(x,p);
  38239. for (i = 0; i < 16; i++) {
  38240. b[i]=x[i];
  38241. d[i]=a[i]=c[i]=0;
  38242. }
  38243. a[0]=d[0]=1;
  38244. for (i=254; i>=0; --i) {
  38245. r=(z[i>>>3]>>>(i&7))&1;
  38246. sel25519(a,b,r);
  38247. sel25519(c,d,r);
  38248. A(e,a,c);
  38249. Z(a,a,c);
  38250. A(c,b,d);
  38251. Z(b,b,d);
  38252. S(d,e);
  38253. S(f,a);
  38254. M(a,c,a);
  38255. M(c,b,e);
  38256. A(e,a,c);
  38257. Z(a,a,c);
  38258. S(b,a);
  38259. Z(c,d,f);
  38260. M(a,c,_121665);
  38261. A(a,a,d);
  38262. M(c,c,a);
  38263. M(a,d,f);
  38264. M(d,b,x);
  38265. S(b,e);
  38266. sel25519(a,b,r);
  38267. sel25519(c,d,r);
  38268. }
  38269. for (i = 0; i < 16; i++) {
  38270. x[i+16]=a[i];
  38271. x[i+32]=c[i];
  38272. x[i+48]=b[i];
  38273. x[i+64]=d[i];
  38274. }
  38275. var x32 = x.subarray(32);
  38276. var x16 = x.subarray(16);
  38277. inv25519(x32,x32);
  38278. M(x16,x16,x32);
  38279. pack25519(q,x16);
  38280. return 0;
  38281. }
  38282. function crypto_scalarmult_base(q, n) {
  38283. return crypto_scalarmult(q, n, _9);
  38284. }
  38285. function crypto_box_keypair(y, x) {
  38286. randombytes(x, 32);
  38287. return crypto_scalarmult_base(y, x);
  38288. }
  38289. function crypto_box_beforenm(k, y, x) {
  38290. var s = new Uint8Array(32);
  38291. crypto_scalarmult(s, x, y);
  38292. return crypto_core_hsalsa20(k, _0, s, sigma);
  38293. }
  38294. var crypto_box_afternm = crypto_secretbox;
  38295. var crypto_box_open_afternm = crypto_secretbox_open;
  38296. function crypto_box(c, m, d, n, y, x) {
  38297. var k = new Uint8Array(32);
  38298. crypto_box_beforenm(k, y, x);
  38299. return crypto_box_afternm(c, m, d, n, k);
  38300. }
  38301. function crypto_box_open(m, c, d, n, y, x) {
  38302. var k = new Uint8Array(32);
  38303. crypto_box_beforenm(k, y, x);
  38304. return crypto_box_open_afternm(m, c, d, n, k);
  38305. }
  38306. var K = [
  38307. 0x428a2f98, 0xd728ae22, 0x71374491, 0x23ef65cd,
  38308. 0xb5c0fbcf, 0xec4d3b2f, 0xe9b5dba5, 0x8189dbbc,
  38309. 0x3956c25b, 0xf348b538, 0x59f111f1, 0xb605d019,
  38310. 0x923f82a4, 0xaf194f9b, 0xab1c5ed5, 0xda6d8118,
  38311. 0xd807aa98, 0xa3030242, 0x12835b01, 0x45706fbe,
  38312. 0x243185be, 0x4ee4b28c, 0x550c7dc3, 0xd5ffb4e2,
  38313. 0x72be5d74, 0xf27b896f, 0x80deb1fe, 0x3b1696b1,
  38314. 0x9bdc06a7, 0x25c71235, 0xc19bf174, 0xcf692694,
  38315. 0xe49b69c1, 0x9ef14ad2, 0xefbe4786, 0x384f25e3,
  38316. 0x0fc19dc6, 0x8b8cd5b5, 0x240ca1cc, 0x77ac9c65,
  38317. 0x2de92c6f, 0x592b0275, 0x4a7484aa, 0x6ea6e483,
  38318. 0x5cb0a9dc, 0xbd41fbd4, 0x76f988da, 0x831153b5,
  38319. 0x983e5152, 0xee66dfab, 0xa831c66d, 0x2db43210,
  38320. 0xb00327c8, 0x98fb213f, 0xbf597fc7, 0xbeef0ee4,
  38321. 0xc6e00bf3, 0x3da88fc2, 0xd5a79147, 0x930aa725,
  38322. 0x06ca6351, 0xe003826f, 0x14292967, 0x0a0e6e70,
  38323. 0x27b70a85, 0x46d22ffc, 0x2e1b2138, 0x5c26c926,
  38324. 0x4d2c6dfc, 0x5ac42aed, 0x53380d13, 0x9d95b3df,
  38325. 0x650a7354, 0x8baf63de, 0x766a0abb, 0x3c77b2a8,
  38326. 0x81c2c92e, 0x47edaee6, 0x92722c85, 0x1482353b,
  38327. 0xa2bfe8a1, 0x4cf10364, 0xa81a664b, 0xbc423001,
  38328. 0xc24b8b70, 0xd0f89791, 0xc76c51a3, 0x0654be30,
  38329. 0xd192e819, 0xd6ef5218, 0xd6990624, 0x5565a910,
  38330. 0xf40e3585, 0x5771202a, 0x106aa070, 0x32bbd1b8,
  38331. 0x19a4c116, 0xb8d2d0c8, 0x1e376c08, 0x5141ab53,
  38332. 0x2748774c, 0xdf8eeb99, 0x34b0bcb5, 0xe19b48a8,
  38333. 0x391c0cb3, 0xc5c95a63, 0x4ed8aa4a, 0xe3418acb,
  38334. 0x5b9cca4f, 0x7763e373, 0x682e6ff3, 0xd6b2b8a3,
  38335. 0x748f82ee, 0x5defb2fc, 0x78a5636f, 0x43172f60,
  38336. 0x84c87814, 0xa1f0ab72, 0x8cc70208, 0x1a6439ec,
  38337. 0x90befffa, 0x23631e28, 0xa4506ceb, 0xde82bde9,
  38338. 0xbef9a3f7, 0xb2c67915, 0xc67178f2, 0xe372532b,
  38339. 0xca273ece, 0xea26619c, 0xd186b8c7, 0x21c0c207,
  38340. 0xeada7dd6, 0xcde0eb1e, 0xf57d4f7f, 0xee6ed178,
  38341. 0x06f067aa, 0x72176fba, 0x0a637dc5, 0xa2c898a6,
  38342. 0x113f9804, 0xbef90dae, 0x1b710b35, 0x131c471b,
  38343. 0x28db77f5, 0x23047d84, 0x32caab7b, 0x40c72493,
  38344. 0x3c9ebe0a, 0x15c9bebc, 0x431d67c4, 0x9c100d4c,
  38345. 0x4cc5d4be, 0xcb3e42b6, 0x597f299c, 0xfc657e2a,
  38346. 0x5fcb6fab, 0x3ad6faec, 0x6c44198c, 0x4a475817
  38347. ];
  38348. function crypto_hashblocks_hl(hh, hl, m, n) {
  38349. var wh = new Int32Array(16), wl = new Int32Array(16),
  38350. bh0, bh1, bh2, bh3, bh4, bh5, bh6, bh7,
  38351. bl0, bl1, bl2, bl3, bl4, bl5, bl6, bl7,
  38352. th, tl, i, j, h, l, a, b, c, d;
  38353. var ah0 = hh[0],
  38354. ah1 = hh[1],
  38355. ah2 = hh[2],
  38356. ah3 = hh[3],
  38357. ah4 = hh[4],
  38358. ah5 = hh[5],
  38359. ah6 = hh[6],
  38360. ah7 = hh[7],
  38361. al0 = hl[0],
  38362. al1 = hl[1],
  38363. al2 = hl[2],
  38364. al3 = hl[3],
  38365. al4 = hl[4],
  38366. al5 = hl[5],
  38367. al6 = hl[6],
  38368. al7 = hl[7];
  38369. var pos = 0;
  38370. while (n >= 128) {
  38371. for (i = 0; i < 16; i++) {
  38372. j = 8 * i + pos;
  38373. wh[i] = (m[j+0] << 24) | (m[j+1] << 16) | (m[j+2] << 8) | m[j+3];
  38374. wl[i] = (m[j+4] << 24) | (m[j+5] << 16) | (m[j+6] << 8) | m[j+7];
  38375. }
  38376. for (i = 0; i < 80; i++) {
  38377. bh0 = ah0;
  38378. bh1 = ah1;
  38379. bh2 = ah2;
  38380. bh3 = ah3;
  38381. bh4 = ah4;
  38382. bh5 = ah5;
  38383. bh6 = ah6;
  38384. bh7 = ah7;
  38385. bl0 = al0;
  38386. bl1 = al1;
  38387. bl2 = al2;
  38388. bl3 = al3;
  38389. bl4 = al4;
  38390. bl5 = al5;
  38391. bl6 = al6;
  38392. bl7 = al7;
  38393. // add
  38394. h = ah7;
  38395. l = al7;
  38396. a = l & 0xffff; b = l >>> 16;
  38397. c = h & 0xffff; d = h >>> 16;
  38398. // Sigma1
  38399. h = ((ah4 >>> 14) | (al4 << (32-14))) ^ ((ah4 >>> 18) | (al4 << (32-18))) ^ ((al4 >>> (41-32)) | (ah4 << (32-(41-32))));
  38400. l = ((al4 >>> 14) | (ah4 << (32-14))) ^ ((al4 >>> 18) | (ah4 << (32-18))) ^ ((ah4 >>> (41-32)) | (al4 << (32-(41-32))));
  38401. a += l & 0xffff; b += l >>> 16;
  38402. c += h & 0xffff; d += h >>> 16;
  38403. // Ch
  38404. h = (ah4 & ah5) ^ (~ah4 & ah6);
  38405. l = (al4 & al5) ^ (~al4 & al6);
  38406. a += l & 0xffff; b += l >>> 16;
  38407. c += h & 0xffff; d += h >>> 16;
  38408. // K
  38409. h = K[i*2];
  38410. l = K[i*2+1];
  38411. a += l & 0xffff; b += l >>> 16;
  38412. c += h & 0xffff; d += h >>> 16;
  38413. // w
  38414. h = wh[i%16];
  38415. l = wl[i%16];
  38416. a += l & 0xffff; b += l >>> 16;
  38417. c += h & 0xffff; d += h >>> 16;
  38418. b += a >>> 16;
  38419. c += b >>> 16;
  38420. d += c >>> 16;
  38421. th = c & 0xffff | d << 16;
  38422. tl = a & 0xffff | b << 16;
  38423. // add
  38424. h = th;
  38425. l = tl;
  38426. a = l & 0xffff; b = l >>> 16;
  38427. c = h & 0xffff; d = h >>> 16;
  38428. // Sigma0
  38429. h = ((ah0 >>> 28) | (al0 << (32-28))) ^ ((al0 >>> (34-32)) | (ah0 << (32-(34-32)))) ^ ((al0 >>> (39-32)) | (ah0 << (32-(39-32))));
  38430. l = ((al0 >>> 28) | (ah0 << (32-28))) ^ ((ah0 >>> (34-32)) | (al0 << (32-(34-32)))) ^ ((ah0 >>> (39-32)) | (al0 << (32-(39-32))));
  38431. a += l & 0xffff; b += l >>> 16;
  38432. c += h & 0xffff; d += h >>> 16;
  38433. // Maj
  38434. h = (ah0 & ah1) ^ (ah0 & ah2) ^ (ah1 & ah2);
  38435. l = (al0 & al1) ^ (al0 & al2) ^ (al1 & al2);
  38436. a += l & 0xffff; b += l >>> 16;
  38437. c += h & 0xffff; d += h >>> 16;
  38438. b += a >>> 16;
  38439. c += b >>> 16;
  38440. d += c >>> 16;
  38441. bh7 = (c & 0xffff) | (d << 16);
  38442. bl7 = (a & 0xffff) | (b << 16);
  38443. // add
  38444. h = bh3;
  38445. l = bl3;
  38446. a = l & 0xffff; b = l >>> 16;
  38447. c = h & 0xffff; d = h >>> 16;
  38448. h = th;
  38449. l = tl;
  38450. a += l & 0xffff; b += l >>> 16;
  38451. c += h & 0xffff; d += h >>> 16;
  38452. b += a >>> 16;
  38453. c += b >>> 16;
  38454. d += c >>> 16;
  38455. bh3 = (c & 0xffff) | (d << 16);
  38456. bl3 = (a & 0xffff) | (b << 16);
  38457. ah1 = bh0;
  38458. ah2 = bh1;
  38459. ah3 = bh2;
  38460. ah4 = bh3;
  38461. ah5 = bh4;
  38462. ah6 = bh5;
  38463. ah7 = bh6;
  38464. ah0 = bh7;
  38465. al1 = bl0;
  38466. al2 = bl1;
  38467. al3 = bl2;
  38468. al4 = bl3;
  38469. al5 = bl4;
  38470. al6 = bl5;
  38471. al7 = bl6;
  38472. al0 = bl7;
  38473. if (i%16 === 15) {
  38474. for (j = 0; j < 16; j++) {
  38475. // add
  38476. h = wh[j];
  38477. l = wl[j];
  38478. a = l & 0xffff; b = l >>> 16;
  38479. c = h & 0xffff; d = h >>> 16;
  38480. h = wh[(j+9)%16];
  38481. l = wl[(j+9)%16];
  38482. a += l & 0xffff; b += l >>> 16;
  38483. c += h & 0xffff; d += h >>> 16;
  38484. // sigma0
  38485. th = wh[(j+1)%16];
  38486. tl = wl[(j+1)%16];
  38487. h = ((th >>> 1) | (tl << (32-1))) ^ ((th >>> 8) | (tl << (32-8))) ^ (th >>> 7);
  38488. l = ((tl >>> 1) | (th << (32-1))) ^ ((tl >>> 8) | (th << (32-8))) ^ ((tl >>> 7) | (th << (32-7)));
  38489. a += l & 0xffff; b += l >>> 16;
  38490. c += h & 0xffff; d += h >>> 16;
  38491. // sigma1
  38492. th = wh[(j+14)%16];
  38493. tl = wl[(j+14)%16];
  38494. h = ((th >>> 19) | (tl << (32-19))) ^ ((tl >>> (61-32)) | (th << (32-(61-32)))) ^ (th >>> 6);
  38495. l = ((tl >>> 19) | (th << (32-19))) ^ ((th >>> (61-32)) | (tl << (32-(61-32)))) ^ ((tl >>> 6) | (th << (32-6)));
  38496. a += l & 0xffff; b += l >>> 16;
  38497. c += h & 0xffff; d += h >>> 16;
  38498. b += a >>> 16;
  38499. c += b >>> 16;
  38500. d += c >>> 16;
  38501. wh[j] = (c & 0xffff) | (d << 16);
  38502. wl[j] = (a & 0xffff) | (b << 16);
  38503. }
  38504. }
  38505. }
  38506. // add
  38507. h = ah0;
  38508. l = al0;
  38509. a = l & 0xffff; b = l >>> 16;
  38510. c = h & 0xffff; d = h >>> 16;
  38511. h = hh[0];
  38512. l = hl[0];
  38513. a += l & 0xffff; b += l >>> 16;
  38514. c += h & 0xffff; d += h >>> 16;
  38515. b += a >>> 16;
  38516. c += b >>> 16;
  38517. d += c >>> 16;
  38518. hh[0] = ah0 = (c & 0xffff) | (d << 16);
  38519. hl[0] = al0 = (a & 0xffff) | (b << 16);
  38520. h = ah1;
  38521. l = al1;
  38522. a = l & 0xffff; b = l >>> 16;
  38523. c = h & 0xffff; d = h >>> 16;
  38524. h = hh[1];
  38525. l = hl[1];
  38526. a += l & 0xffff; b += l >>> 16;
  38527. c += h & 0xffff; d += h >>> 16;
  38528. b += a >>> 16;
  38529. c += b >>> 16;
  38530. d += c >>> 16;
  38531. hh[1] = ah1 = (c & 0xffff) | (d << 16);
  38532. hl[1] = al1 = (a & 0xffff) | (b << 16);
  38533. h = ah2;
  38534. l = al2;
  38535. a = l & 0xffff; b = l >>> 16;
  38536. c = h & 0xffff; d = h >>> 16;
  38537. h = hh[2];
  38538. l = hl[2];
  38539. a += l & 0xffff; b += l >>> 16;
  38540. c += h & 0xffff; d += h >>> 16;
  38541. b += a >>> 16;
  38542. c += b >>> 16;
  38543. d += c >>> 16;
  38544. hh[2] = ah2 = (c & 0xffff) | (d << 16);
  38545. hl[2] = al2 = (a & 0xffff) | (b << 16);
  38546. h = ah3;
  38547. l = al3;
  38548. a = l & 0xffff; b = l >>> 16;
  38549. c = h & 0xffff; d = h >>> 16;
  38550. h = hh[3];
  38551. l = hl[3];
  38552. a += l & 0xffff; b += l >>> 16;
  38553. c += h & 0xffff; d += h >>> 16;
  38554. b += a >>> 16;
  38555. c += b >>> 16;
  38556. d += c >>> 16;
  38557. hh[3] = ah3 = (c & 0xffff) | (d << 16);
  38558. hl[3] = al3 = (a & 0xffff) | (b << 16);
  38559. h = ah4;
  38560. l = al4;
  38561. a = l & 0xffff; b = l >>> 16;
  38562. c = h & 0xffff; d = h >>> 16;
  38563. h = hh[4];
  38564. l = hl[4];
  38565. a += l & 0xffff; b += l >>> 16;
  38566. c += h & 0xffff; d += h >>> 16;
  38567. b += a >>> 16;
  38568. c += b >>> 16;
  38569. d += c >>> 16;
  38570. hh[4] = ah4 = (c & 0xffff) | (d << 16);
  38571. hl[4] = al4 = (a & 0xffff) | (b << 16);
  38572. h = ah5;
  38573. l = al5;
  38574. a = l & 0xffff; b = l >>> 16;
  38575. c = h & 0xffff; d = h >>> 16;
  38576. h = hh[5];
  38577. l = hl[5];
  38578. a += l & 0xffff; b += l >>> 16;
  38579. c += h & 0xffff; d += h >>> 16;
  38580. b += a >>> 16;
  38581. c += b >>> 16;
  38582. d += c >>> 16;
  38583. hh[5] = ah5 = (c & 0xffff) | (d << 16);
  38584. hl[5] = al5 = (a & 0xffff) | (b << 16);
  38585. h = ah6;
  38586. l = al6;
  38587. a = l & 0xffff; b = l >>> 16;
  38588. c = h & 0xffff; d = h >>> 16;
  38589. h = hh[6];
  38590. l = hl[6];
  38591. a += l & 0xffff; b += l >>> 16;
  38592. c += h & 0xffff; d += h >>> 16;
  38593. b += a >>> 16;
  38594. c += b >>> 16;
  38595. d += c >>> 16;
  38596. hh[6] = ah6 = (c & 0xffff) | (d << 16);
  38597. hl[6] = al6 = (a & 0xffff) | (b << 16);
  38598. h = ah7;
  38599. l = al7;
  38600. a = l & 0xffff; b = l >>> 16;
  38601. c = h & 0xffff; d = h >>> 16;
  38602. h = hh[7];
  38603. l = hl[7];
  38604. a += l & 0xffff; b += l >>> 16;
  38605. c += h & 0xffff; d += h >>> 16;
  38606. b += a >>> 16;
  38607. c += b >>> 16;
  38608. d += c >>> 16;
  38609. hh[7] = ah7 = (c & 0xffff) | (d << 16);
  38610. hl[7] = al7 = (a & 0xffff) | (b << 16);
  38611. pos += 128;
  38612. n -= 128;
  38613. }
  38614. return n;
  38615. }
  38616. function crypto_hash(out, m, n) {
  38617. var hh = new Int32Array(8),
  38618. hl = new Int32Array(8),
  38619. x = new Uint8Array(256),
  38620. i, b = n;
  38621. hh[0] = 0x6a09e667;
  38622. hh[1] = 0xbb67ae85;
  38623. hh[2] = 0x3c6ef372;
  38624. hh[3] = 0xa54ff53a;
  38625. hh[4] = 0x510e527f;
  38626. hh[5] = 0x9b05688c;
  38627. hh[6] = 0x1f83d9ab;
  38628. hh[7] = 0x5be0cd19;
  38629. hl[0] = 0xf3bcc908;
  38630. hl[1] = 0x84caa73b;
  38631. hl[2] = 0xfe94f82b;
  38632. hl[3] = 0x5f1d36f1;
  38633. hl[4] = 0xade682d1;
  38634. hl[5] = 0x2b3e6c1f;
  38635. hl[6] = 0xfb41bd6b;
  38636. hl[7] = 0x137e2179;
  38637. crypto_hashblocks_hl(hh, hl, m, n);
  38638. n %= 128;
  38639. for (i = 0; i < n; i++) x[i] = m[b-n+i];
  38640. x[n] = 128;
  38641. n = 256-128*(n<112?1:0);
  38642. x[n-9] = 0;
  38643. ts64(x, n-8, (b / 0x20000000) | 0, b << 3);
  38644. crypto_hashblocks_hl(hh, hl, x, n);
  38645. for (i = 0; i < 8; i++) ts64(out, 8*i, hh[i], hl[i]);
  38646. return 0;
  38647. }
  38648. function add(p, q) {
  38649. var a = gf(), b = gf(), c = gf(),
  38650. d = gf(), e = gf(), f = gf(),
  38651. g = gf(), h = gf(), t = gf();
  38652. Z(a, p[1], p[0]);
  38653. Z(t, q[1], q[0]);
  38654. M(a, a, t);
  38655. A(b, p[0], p[1]);
  38656. A(t, q[0], q[1]);
  38657. M(b, b, t);
  38658. M(c, p[3], q[3]);
  38659. M(c, c, D2);
  38660. M(d, p[2], q[2]);
  38661. A(d, d, d);
  38662. Z(e, b, a);
  38663. Z(f, d, c);
  38664. A(g, d, c);
  38665. A(h, b, a);
  38666. M(p[0], e, f);
  38667. M(p[1], h, g);
  38668. M(p[2], g, f);
  38669. M(p[3], e, h);
  38670. }
  38671. function cswap(p, q, b) {
  38672. var i;
  38673. for (i = 0; i < 4; i++) {
  38674. sel25519(p[i], q[i], b);
  38675. }
  38676. }
  38677. function pack(r, p) {
  38678. var tx = gf(), ty = gf(), zi = gf();
  38679. inv25519(zi, p[2]);
  38680. M(tx, p[0], zi);
  38681. M(ty, p[1], zi);
  38682. pack25519(r, ty);
  38683. r[31] ^= par25519(tx) << 7;
  38684. }
  38685. function scalarmult(p, q, s) {
  38686. var b, i;
  38687. set25519(p[0], gf0);
  38688. set25519(p[1], gf1);
  38689. set25519(p[2], gf1);
  38690. set25519(p[3], gf0);
  38691. for (i = 255; i >= 0; --i) {
  38692. b = (s[(i/8)|0] >> (i&7)) & 1;
  38693. cswap(p, q, b);
  38694. add(q, p);
  38695. add(p, p);
  38696. cswap(p, q, b);
  38697. }
  38698. }
  38699. function scalarbase(p, s) {
  38700. var q = [gf(), gf(), gf(), gf()];
  38701. set25519(q[0], X);
  38702. set25519(q[1], Y);
  38703. set25519(q[2], gf1);
  38704. M(q[3], X, Y);
  38705. scalarmult(p, q, s);
  38706. }
  38707. function crypto_sign_keypair(pk, sk, seeded) {
  38708. var d = new Uint8Array(64);
  38709. var p = [gf(), gf(), gf(), gf()];
  38710. var i;
  38711. if (!seeded) randombytes(sk, 32);
  38712. crypto_hash(d, sk, 32);
  38713. d[0] &= 248;
  38714. d[31] &= 127;
  38715. d[31] |= 64;
  38716. scalarbase(p, d);
  38717. pack(pk, p);
  38718. for (i = 0; i < 32; i++) sk[i+32] = pk[i];
  38719. return 0;
  38720. }
  38721. 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]);
  38722. function modL(r, x) {
  38723. var carry, i, j, k;
  38724. for (i = 63; i >= 32; --i) {
  38725. carry = 0;
  38726. for (j = i - 32, k = i - 12; j < k; ++j) {
  38727. x[j] += carry - 16 * x[i] * L[j - (i - 32)];
  38728. carry = (x[j] + 128) >> 8;
  38729. x[j] -= carry * 256;
  38730. }
  38731. x[j] += carry;
  38732. x[i] = 0;
  38733. }
  38734. carry = 0;
  38735. for (j = 0; j < 32; j++) {
  38736. x[j] += carry - (x[31] >> 4) * L[j];
  38737. carry = x[j] >> 8;
  38738. x[j] &= 255;
  38739. }
  38740. for (j = 0; j < 32; j++) x[j] -= carry * L[j];
  38741. for (i = 0; i < 32; i++) {
  38742. x[i+1] += x[i] >> 8;
  38743. r[i] = x[i] & 255;
  38744. }
  38745. }
  38746. function reduce(r) {
  38747. var x = new Float64Array(64), i;
  38748. for (i = 0; i < 64; i++) x[i] = r[i];
  38749. for (i = 0; i < 64; i++) r[i] = 0;
  38750. modL(r, x);
  38751. }
  38752. // Note: difference from C - smlen returned, not passed as argument.
  38753. function crypto_sign(sm, m, n, sk) {
  38754. var d = new Uint8Array(64), h = new Uint8Array(64), r = new Uint8Array(64);
  38755. var i, j, x = new Float64Array(64);
  38756. var p = [gf(), gf(), gf(), gf()];
  38757. crypto_hash(d, sk, 32);
  38758. d[0] &= 248;
  38759. d[31] &= 127;
  38760. d[31] |= 64;
  38761. var smlen = n + 64;
  38762. for (i = 0; i < n; i++) sm[64 + i] = m[i];
  38763. for (i = 0; i < 32; i++) sm[32 + i] = d[32 + i];
  38764. crypto_hash(r, sm.subarray(32), n+32);
  38765. reduce(r);
  38766. scalarbase(p, r);
  38767. pack(sm, p);
  38768. for (i = 32; i < 64; i++) sm[i] = sk[i];
  38769. crypto_hash(h, sm, n + 64);
  38770. reduce(h);
  38771. for (i = 0; i < 64; i++) x[i] = 0;
  38772. for (i = 0; i < 32; i++) x[i] = r[i];
  38773. for (i = 0; i < 32; i++) {
  38774. for (j = 0; j < 32; j++) {
  38775. x[i+j] += h[i] * d[j];
  38776. }
  38777. }
  38778. modL(sm.subarray(32), x);
  38779. return smlen;
  38780. }
  38781. function unpackneg(r, p) {
  38782. var t = gf(), chk = gf(), num = gf(),
  38783. den = gf(), den2 = gf(), den4 = gf(),
  38784. den6 = gf();
  38785. set25519(r[2], gf1);
  38786. unpack25519(r[1], p);
  38787. S(num, r[1]);
  38788. M(den, num, D);
  38789. Z(num, num, r[2]);
  38790. A(den, r[2], den);
  38791. S(den2, den);
  38792. S(den4, den2);
  38793. M(den6, den4, den2);
  38794. M(t, den6, num);
  38795. M(t, t, den);
  38796. pow2523(t, t);
  38797. M(t, t, num);
  38798. M(t, t, den);
  38799. M(t, t, den);
  38800. M(r[0], t, den);
  38801. S(chk, r[0]);
  38802. M(chk, chk, den);
  38803. if (neq25519(chk, num)) M(r[0], r[0], I);
  38804. S(chk, r[0]);
  38805. M(chk, chk, den);
  38806. if (neq25519(chk, num)) return -1;
  38807. if (par25519(r[0]) === (p[31]>>7)) Z(r[0], gf0, r[0]);
  38808. M(r[3], r[0], r[1]);
  38809. return 0;
  38810. }
  38811. function crypto_sign_open(m, sm, n, pk) {
  38812. var i, mlen;
  38813. var t = new Uint8Array(32), h = new Uint8Array(64);
  38814. var p = [gf(), gf(), gf(), gf()],
  38815. q = [gf(), gf(), gf(), gf()];
  38816. mlen = -1;
  38817. if (n < 64) return -1;
  38818. if (unpackneg(q, pk)) return -1;
  38819. for (i = 0; i < n; i++) m[i] = sm[i];
  38820. for (i = 0; i < 32; i++) m[i+32] = pk[i];
  38821. crypto_hash(h, m, n);
  38822. reduce(h);
  38823. scalarmult(p, q, h);
  38824. scalarbase(q, sm.subarray(32));
  38825. add(p, q);
  38826. pack(t, p);
  38827. n -= 64;
  38828. if (crypto_verify_32(sm, 0, t, 0)) {
  38829. for (i = 0; i < n; i++) m[i] = 0;
  38830. return -1;
  38831. }
  38832. for (i = 0; i < n; i++) m[i] = sm[i + 64];
  38833. mlen = n;
  38834. return mlen;
  38835. }
  38836. var crypto_secretbox_KEYBYTES = 32,
  38837. crypto_secretbox_NONCEBYTES = 24,
  38838. crypto_secretbox_ZEROBYTES = 32,
  38839. crypto_secretbox_BOXZEROBYTES = 16,
  38840. crypto_scalarmult_BYTES = 32,
  38841. crypto_scalarmult_SCALARBYTES = 32,
  38842. crypto_box_PUBLICKEYBYTES = 32,
  38843. crypto_box_SECRETKEYBYTES = 32,
  38844. crypto_box_BEFORENMBYTES = 32,
  38845. crypto_box_NONCEBYTES = crypto_secretbox_NONCEBYTES,
  38846. crypto_box_ZEROBYTES = crypto_secretbox_ZEROBYTES,
  38847. crypto_box_BOXZEROBYTES = crypto_secretbox_BOXZEROBYTES,
  38848. crypto_sign_BYTES = 64,
  38849. crypto_sign_PUBLICKEYBYTES = 32,
  38850. crypto_sign_SECRETKEYBYTES = 64,
  38851. crypto_sign_SEEDBYTES = 32,
  38852. crypto_hash_BYTES = 64;
  38853. nacl.lowlevel = {
  38854. crypto_core_hsalsa20: crypto_core_hsalsa20,
  38855. crypto_stream_xor: crypto_stream_xor,
  38856. crypto_stream: crypto_stream,
  38857. crypto_stream_salsa20_xor: crypto_stream_salsa20_xor,
  38858. crypto_stream_salsa20: crypto_stream_salsa20,
  38859. crypto_onetimeauth: crypto_onetimeauth,
  38860. crypto_onetimeauth_verify: crypto_onetimeauth_verify,
  38861. crypto_verify_16: crypto_verify_16,
  38862. crypto_verify_32: crypto_verify_32,
  38863. crypto_secretbox: crypto_secretbox,
  38864. crypto_secretbox_open: crypto_secretbox_open,
  38865. crypto_scalarmult: crypto_scalarmult,
  38866. crypto_scalarmult_base: crypto_scalarmult_base,
  38867. crypto_box_beforenm: crypto_box_beforenm,
  38868. crypto_box_afternm: crypto_box_afternm,
  38869. crypto_box: crypto_box,
  38870. crypto_box_open: crypto_box_open,
  38871. crypto_box_keypair: crypto_box_keypair,
  38872. crypto_hash: crypto_hash,
  38873. crypto_sign: crypto_sign,
  38874. crypto_sign_keypair: crypto_sign_keypair,
  38875. crypto_sign_open: crypto_sign_open,
  38876. crypto_secretbox_KEYBYTES: crypto_secretbox_KEYBYTES,
  38877. crypto_secretbox_NONCEBYTES: crypto_secretbox_NONCEBYTES,
  38878. crypto_secretbox_ZEROBYTES: crypto_secretbox_ZEROBYTES,
  38879. crypto_secretbox_BOXZEROBYTES: crypto_secretbox_BOXZEROBYTES,
  38880. crypto_scalarmult_BYTES: crypto_scalarmult_BYTES,
  38881. crypto_scalarmult_SCALARBYTES: crypto_scalarmult_SCALARBYTES,
  38882. crypto_box_PUBLICKEYBYTES: crypto_box_PUBLICKEYBYTES,
  38883. crypto_box_SECRETKEYBYTES: crypto_box_SECRETKEYBYTES,
  38884. crypto_box_BEFORENMBYTES: crypto_box_BEFORENMBYTES,
  38885. crypto_box_NONCEBYTES: crypto_box_NONCEBYTES,
  38886. crypto_box_ZEROBYTES: crypto_box_ZEROBYTES,
  38887. crypto_box_BOXZEROBYTES: crypto_box_BOXZEROBYTES,
  38888. crypto_sign_BYTES: crypto_sign_BYTES,
  38889. crypto_sign_PUBLICKEYBYTES: crypto_sign_PUBLICKEYBYTES,
  38890. crypto_sign_SECRETKEYBYTES: crypto_sign_SECRETKEYBYTES,
  38891. crypto_sign_SEEDBYTES: crypto_sign_SEEDBYTES,
  38892. crypto_hash_BYTES: crypto_hash_BYTES
  38893. };
  38894. /* High-level API */
  38895. function checkLengths(k, n) {
  38896. if (k.length !== crypto_secretbox_KEYBYTES) throw new Error('bad key size');
  38897. if (n.length !== crypto_secretbox_NONCEBYTES) throw new Error('bad nonce size');
  38898. }
  38899. function checkBoxLengths(pk, sk) {
  38900. if (pk.length !== crypto_box_PUBLICKEYBYTES) throw new Error('bad public key size');
  38901. if (sk.length !== crypto_box_SECRETKEYBYTES) throw new Error('bad secret key size');
  38902. }
  38903. function checkArrayTypes() {
  38904. for (var i = 0; i < arguments.length; i++) {
  38905. if (!(arguments[i] instanceof Uint8Array))
  38906. throw new TypeError('unexpected type, use Uint8Array');
  38907. }
  38908. }
  38909. function cleanup(arr) {
  38910. for (var i = 0; i < arr.length; i++) arr[i] = 0;
  38911. }
  38912. nacl.randomBytes = function(n) {
  38913. var b = new Uint8Array(n);
  38914. randombytes(b, n);
  38915. return b;
  38916. };
  38917. nacl.secretbox = function(msg, nonce, key) {
  38918. checkArrayTypes(msg, nonce, key);
  38919. checkLengths(key, nonce);
  38920. var m = new Uint8Array(crypto_secretbox_ZEROBYTES + msg.length);
  38921. var c = new Uint8Array(m.length);
  38922. for (var i = 0; i < msg.length; i++) m[i+crypto_secretbox_ZEROBYTES] = msg[i];
  38923. crypto_secretbox(c, m, m.length, nonce, key);
  38924. return c.subarray(crypto_secretbox_BOXZEROBYTES);
  38925. };
  38926. nacl.secretbox.open = function(box, nonce, key) {
  38927. checkArrayTypes(box, nonce, key);
  38928. checkLengths(key, nonce);
  38929. var c = new Uint8Array(crypto_secretbox_BOXZEROBYTES + box.length);
  38930. var m = new Uint8Array(c.length);
  38931. for (var i = 0; i < box.length; i++) c[i+crypto_secretbox_BOXZEROBYTES] = box[i];
  38932. if (c.length < 32) return null;
  38933. if (crypto_secretbox_open(m, c, c.length, nonce, key) !== 0) return null;
  38934. return m.subarray(crypto_secretbox_ZEROBYTES);
  38935. };
  38936. nacl.secretbox.keyLength = crypto_secretbox_KEYBYTES;
  38937. nacl.secretbox.nonceLength = crypto_secretbox_NONCEBYTES;
  38938. nacl.secretbox.overheadLength = crypto_secretbox_BOXZEROBYTES;
  38939. nacl.scalarMult = function(n, p) {
  38940. checkArrayTypes(n, p);
  38941. if (n.length !== crypto_scalarmult_SCALARBYTES) throw new Error('bad n size');
  38942. if (p.length !== crypto_scalarmult_BYTES) throw new Error('bad p size');
  38943. var q = new Uint8Array(crypto_scalarmult_BYTES);
  38944. crypto_scalarmult(q, n, p);
  38945. return q;
  38946. };
  38947. nacl.scalarMult.base = function(n) {
  38948. checkArrayTypes(n);
  38949. if (n.length !== crypto_scalarmult_SCALARBYTES) throw new Error('bad n size');
  38950. var q = new Uint8Array(crypto_scalarmult_BYTES);
  38951. crypto_scalarmult_base(q, n);
  38952. return q;
  38953. };
  38954. nacl.scalarMult.scalarLength = crypto_scalarmult_SCALARBYTES;
  38955. nacl.scalarMult.groupElementLength = crypto_scalarmult_BYTES;
  38956. nacl.box = function(msg, nonce, publicKey, secretKey) {
  38957. var k = nacl.box.before(publicKey, secretKey);
  38958. return nacl.secretbox(msg, nonce, k);
  38959. };
  38960. nacl.box.before = function(publicKey, secretKey) {
  38961. checkArrayTypes(publicKey, secretKey);
  38962. checkBoxLengths(publicKey, secretKey);
  38963. var k = new Uint8Array(crypto_box_BEFORENMBYTES);
  38964. crypto_box_beforenm(k, publicKey, secretKey);
  38965. return k;
  38966. };
  38967. nacl.box.after = nacl.secretbox;
  38968. nacl.box.open = function(msg, nonce, publicKey, secretKey) {
  38969. var k = nacl.box.before(publicKey, secretKey);
  38970. return nacl.secretbox.open(msg, nonce, k);
  38971. };
  38972. nacl.box.open.after = nacl.secretbox.open;
  38973. nacl.box.keyPair = function() {
  38974. var pk = new Uint8Array(crypto_box_PUBLICKEYBYTES);
  38975. var sk = new Uint8Array(crypto_box_SECRETKEYBYTES);
  38976. crypto_box_keypair(pk, sk);
  38977. return {publicKey: pk, secretKey: sk};
  38978. };
  38979. nacl.box.keyPair.fromSecretKey = function(secretKey) {
  38980. checkArrayTypes(secretKey);
  38981. if (secretKey.length !== crypto_box_SECRETKEYBYTES)
  38982. throw new Error('bad secret key size');
  38983. var pk = new Uint8Array(crypto_box_PUBLICKEYBYTES);
  38984. crypto_scalarmult_base(pk, secretKey);
  38985. return {publicKey: pk, secretKey: new Uint8Array(secretKey)};
  38986. };
  38987. nacl.box.publicKeyLength = crypto_box_PUBLICKEYBYTES;
  38988. nacl.box.secretKeyLength = crypto_box_SECRETKEYBYTES;
  38989. nacl.box.sharedKeyLength = crypto_box_BEFORENMBYTES;
  38990. nacl.box.nonceLength = crypto_box_NONCEBYTES;
  38991. nacl.box.overheadLength = nacl.secretbox.overheadLength;
  38992. nacl.sign = function(msg, secretKey) {
  38993. checkArrayTypes(msg, secretKey);
  38994. if (secretKey.length !== crypto_sign_SECRETKEYBYTES)
  38995. throw new Error('bad secret key size');
  38996. var signedMsg = new Uint8Array(crypto_sign_BYTES+msg.length);
  38997. crypto_sign(signedMsg, msg, msg.length, secretKey);
  38998. return signedMsg;
  38999. };
  39000. nacl.sign.open = function(signedMsg, publicKey) {
  39001. checkArrayTypes(signedMsg, publicKey);
  39002. if (publicKey.length !== crypto_sign_PUBLICKEYBYTES)
  39003. throw new Error('bad public key size');
  39004. var tmp = new Uint8Array(signedMsg.length);
  39005. var mlen = crypto_sign_open(tmp, signedMsg, signedMsg.length, publicKey);
  39006. if (mlen < 0) return null;
  39007. var m = new Uint8Array(mlen);
  39008. for (var i = 0; i < m.length; i++) m[i] = tmp[i];
  39009. return m;
  39010. };
  39011. nacl.sign.detached = function(msg, secretKey) {
  39012. var signedMsg = nacl.sign(msg, secretKey);
  39013. var sig = new Uint8Array(crypto_sign_BYTES);
  39014. for (var i = 0; i < sig.length; i++) sig[i] = signedMsg[i];
  39015. return sig;
  39016. };
  39017. nacl.sign.detached.verify = function(msg, sig, publicKey) {
  39018. checkArrayTypes(msg, sig, publicKey);
  39019. if (sig.length !== crypto_sign_BYTES)
  39020. throw new Error('bad signature size');
  39021. if (publicKey.length !== crypto_sign_PUBLICKEYBYTES)
  39022. throw new Error('bad public key size');
  39023. var sm = new Uint8Array(crypto_sign_BYTES + msg.length);
  39024. var m = new Uint8Array(crypto_sign_BYTES + msg.length);
  39025. var i;
  39026. for (i = 0; i < crypto_sign_BYTES; i++) sm[i] = sig[i];
  39027. for (i = 0; i < msg.length; i++) sm[i+crypto_sign_BYTES] = msg[i];
  39028. return (crypto_sign_open(m, sm, sm.length, publicKey) >= 0);
  39029. };
  39030. nacl.sign.keyPair = function() {
  39031. var pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES);
  39032. var sk = new Uint8Array(crypto_sign_SECRETKEYBYTES);
  39033. crypto_sign_keypair(pk, sk);
  39034. return {publicKey: pk, secretKey: sk};
  39035. };
  39036. nacl.sign.keyPair.fromSecretKey = function(secretKey) {
  39037. checkArrayTypes(secretKey);
  39038. if (secretKey.length !== crypto_sign_SECRETKEYBYTES)
  39039. throw new Error('bad secret key size');
  39040. var pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES);
  39041. for (var i = 0; i < pk.length; i++) pk[i] = secretKey[32+i];
  39042. return {publicKey: pk, secretKey: new Uint8Array(secretKey)};
  39043. };
  39044. nacl.sign.keyPair.fromSeed = function(seed) {
  39045. checkArrayTypes(seed);
  39046. if (seed.length !== crypto_sign_SEEDBYTES)
  39047. throw new Error('bad seed size');
  39048. var pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES);
  39049. var sk = new Uint8Array(crypto_sign_SECRETKEYBYTES);
  39050. for (var i = 0; i < 32; i++) sk[i] = seed[i];
  39051. crypto_sign_keypair(pk, sk, true);
  39052. return {publicKey: pk, secretKey: sk};
  39053. };
  39054. nacl.sign.publicKeyLength = crypto_sign_PUBLICKEYBYTES;
  39055. nacl.sign.secretKeyLength = crypto_sign_SECRETKEYBYTES;
  39056. nacl.sign.seedLength = crypto_sign_SEEDBYTES;
  39057. nacl.sign.signatureLength = crypto_sign_BYTES;
  39058. nacl.hash = function(msg) {
  39059. checkArrayTypes(msg);
  39060. var h = new Uint8Array(crypto_hash_BYTES);
  39061. crypto_hash(h, msg, msg.length);
  39062. return h;
  39063. };
  39064. nacl.hash.hashLength = crypto_hash_BYTES;
  39065. nacl.verify = function(x, y) {
  39066. checkArrayTypes(x, y);
  39067. // Zero length arguments are considered not equal.
  39068. if (x.length === 0 || y.length === 0) return false;
  39069. if (x.length !== y.length) return false;
  39070. return (vn(x, 0, y, 0, x.length) === 0) ? true : false;
  39071. };
  39072. nacl.setPRNG = function(fn) {
  39073. randombytes = fn;
  39074. };
  39075. (function() {
  39076. // Initialize PRNG if environment provides CSPRNG.
  39077. // If not, methods calling randombytes will throw.
  39078. var crypto = typeof self !== 'undefined' ? (self.crypto || self.msCrypto) : null;
  39079. if (crypto && crypto.getRandomValues) {
  39080. // Browsers.
  39081. var QUOTA = 65536;
  39082. nacl.setPRNG(function(x, n) {
  39083. var i, v = new Uint8Array(n);
  39084. for (i = 0; i < n; i += QUOTA) {
  39085. crypto.getRandomValues(v.subarray(i, i + Math.min(n - i, QUOTA)));
  39086. }
  39087. for (i = 0; i < n; i++) x[i] = v[i];
  39088. cleanup(v);
  39089. });
  39090. } else if (true) {
  39091. // Node.js.
  39092. crypto = __webpack_require__(3);
  39093. if (crypto && crypto.randomBytes) {
  39094. nacl.setPRNG(function(x, n) {
  39095. var i, v = crypto.randomBytes(n);
  39096. for (i = 0; i < n; i++) x[i] = v[i];
  39097. cleanup(v);
  39098. });
  39099. }
  39100. }
  39101. })();
  39102. })( true && module.exports ? module.exports : (self.nacl = self.nacl || {}));
  39103. /***/ }),
  39104. /* 1 */
  39105. /***/ (function(module, exports, __webpack_require__) {
  39106. // Written in 2014-2016 by Dmitry Chestnykh and Devi Mandiri.
  39107. // Public domain.
  39108. (function(root, f) {
  39109. 'use strict';
  39110. if ( true && module.exports) module.exports = f();
  39111. else if (root.nacl) root.nacl.util = f();
  39112. else {
  39113. root.nacl = {};
  39114. root.nacl.util = f();
  39115. }
  39116. }(this, function() {
  39117. 'use strict';
  39118. var util = {};
  39119. function validateBase64(s) {
  39120. if (!(/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(s))) {
  39121. throw new TypeError('invalid encoding');
  39122. }
  39123. }
  39124. util.decodeUTF8 = function(s) {
  39125. if (typeof s !== 'string') throw new TypeError('expected string');
  39126. var i, d = unescape(encodeURIComponent(s)), b = new Uint8Array(d.length);
  39127. for (i = 0; i < d.length; i++) b[i] = d.charCodeAt(i);
  39128. return b;
  39129. };
  39130. util.encodeUTF8 = function(arr) {
  39131. var i, s = [];
  39132. for (i = 0; i < arr.length; i++) s.push(String.fromCharCode(arr[i]));
  39133. return decodeURIComponent(escape(s.join('')));
  39134. };
  39135. if (typeof atob === 'undefined') {
  39136. // Node.js
  39137. if (typeof Buffer.from !== 'undefined') {
  39138. // Node v6 and later
  39139. util.encodeBase64 = function (arr) { // v6 and later
  39140. return Buffer.from(arr).toString('base64');
  39141. };
  39142. util.decodeBase64 = function (s) {
  39143. validateBase64(s);
  39144. return new Uint8Array(Array.prototype.slice.call(Buffer.from(s, 'base64'), 0));
  39145. };
  39146. } else {
  39147. // Node earlier than v6
  39148. util.encodeBase64 = function (arr) { // v6 and later
  39149. return (new Buffer(arr)).toString('base64');
  39150. };
  39151. util.decodeBase64 = function(s) {
  39152. validateBase64(s);
  39153. return new Uint8Array(Array.prototype.slice.call(new Buffer(s, 'base64'), 0));
  39154. };
  39155. }
  39156. } else {
  39157. // Browsers
  39158. util.encodeBase64 = function(arr) {
  39159. var i, s = [], len = arr.length;
  39160. for (i = 0; i < len; i++) s.push(String.fromCharCode(arr[i]));
  39161. return btoa(s.join(''));
  39162. };
  39163. util.decodeBase64 = function(s) {
  39164. validateBase64(s);
  39165. var i, d = atob(s), b = new Uint8Array(d.length);
  39166. for (i = 0; i < d.length; i++) b[i] = d.charCodeAt(i);
  39167. return b;
  39168. };
  39169. }
  39170. return util;
  39171. }));
  39172. /***/ }),
  39173. /* 2 */
  39174. /***/ (function(module, exports, __webpack_require__) {
  39175. // required so we don't have to do require('pusher').default etc.
  39176. module.exports = __webpack_require__(4).default;
  39177. /***/ }),
  39178. /* 3 */
  39179. /***/ (function(module, exports) {
  39180. /* (ignored) */
  39181. /***/ }),
  39182. /* 4 */
  39183. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  39184. "use strict";
  39185. __webpack_require__.r(__webpack_exports__);
  39186. // CONCATENATED MODULE: ./src/runtimes/web/dom/script_receiver_factory.ts
  39187. var ScriptReceiverFactory = (function () {
  39188. function ScriptReceiverFactory(prefix, name) {
  39189. this.lastId = 0;
  39190. this.prefix = prefix;
  39191. this.name = name;
  39192. }
  39193. ScriptReceiverFactory.prototype.create = function (callback) {
  39194. this.lastId++;
  39195. var number = this.lastId;
  39196. var id = this.prefix + number;
  39197. var name = this.name + "[" + number + "]";
  39198. var called = false;
  39199. var callbackWrapper = function () {
  39200. if (!called) {
  39201. callback.apply(null, arguments);
  39202. called = true;
  39203. }
  39204. };
  39205. this[number] = callbackWrapper;
  39206. return { number: number, id: id, name: name, callback: callbackWrapper };
  39207. };
  39208. ScriptReceiverFactory.prototype.remove = function (receiver) {
  39209. delete this[receiver.number];
  39210. };
  39211. return ScriptReceiverFactory;
  39212. }());
  39213. var ScriptReceivers = new ScriptReceiverFactory("_pusher_script_", "Pusher.ScriptReceivers");
  39214. // CONCATENATED MODULE: ./src/core/defaults.ts
  39215. var Defaults = {
  39216. VERSION: "5.0.3",
  39217. PROTOCOL: 7,
  39218. host: 'ws.pusherapp.com',
  39219. ws_port: 80,
  39220. wss_port: 443,
  39221. ws_path: '',
  39222. sockjs_host: 'sockjs.pusher.com',
  39223. sockjs_http_port: 80,
  39224. sockjs_https_port: 443,
  39225. sockjs_path: '/pusher',
  39226. stats_host: 'stats.pusher.com',
  39227. channel_auth_endpoint: '/pusher/auth',
  39228. channel_auth_transport: 'ajax',
  39229. activity_timeout: 120000,
  39230. pong_timeout: 30000,
  39231. unavailable_timeout: 10000,
  39232. cdn_http: "http://js.pusher.com",
  39233. cdn_https: "https://js.pusher.com",
  39234. dependency_suffix: ""
  39235. };
  39236. /* harmony default export */ var defaults = (Defaults);
  39237. // CONCATENATED MODULE: ./src/runtimes/web/dom/dependency_loader.ts
  39238. var dependency_loader_DependencyLoader = (function () {
  39239. function DependencyLoader(options) {
  39240. this.options = options;
  39241. this.receivers = options.receivers || ScriptReceivers;
  39242. this.loading = {};
  39243. }
  39244. DependencyLoader.prototype.load = function (name, options, callback) {
  39245. var self = this;
  39246. if (self.loading[name] && self.loading[name].length > 0) {
  39247. self.loading[name].push(callback);
  39248. }
  39249. else {
  39250. self.loading[name] = [callback];
  39251. var request = runtime.createScriptRequest(self.getPath(name, options));
  39252. var receiver = self.receivers.create(function (error) {
  39253. self.receivers.remove(receiver);
  39254. if (self.loading[name]) {
  39255. var callbacks = self.loading[name];
  39256. delete self.loading[name];
  39257. var successCallback = function (wasSuccessful) {
  39258. if (!wasSuccessful) {
  39259. request.cleanup();
  39260. }
  39261. };
  39262. for (var i = 0; i < callbacks.length; i++) {
  39263. callbacks[i](error, successCallback);
  39264. }
  39265. }
  39266. });
  39267. request.send(receiver);
  39268. }
  39269. };
  39270. DependencyLoader.prototype.getRoot = function (options) {
  39271. var cdn;
  39272. var protocol = runtime.getDocument().location.protocol;
  39273. if ((options && options.useTLS) || protocol === "https:") {
  39274. cdn = this.options.cdn_https;
  39275. }
  39276. else {
  39277. cdn = this.options.cdn_http;
  39278. }
  39279. return cdn.replace(/\/*$/, "") + "/" + this.options.version;
  39280. };
  39281. DependencyLoader.prototype.getPath = function (name, options) {
  39282. return this.getRoot(options) + '/' + name + this.options.suffix + '.js';
  39283. };
  39284. ;
  39285. return DependencyLoader;
  39286. }());
  39287. /* harmony default export */ var dependency_loader = (dependency_loader_DependencyLoader);
  39288. // CONCATENATED MODULE: ./src/runtimes/web/dom/dependencies.ts
  39289. var DependenciesReceivers = new ScriptReceiverFactory("_pusher_dependencies", "Pusher.DependenciesReceivers");
  39290. var Dependencies = new dependency_loader({
  39291. cdn_http: defaults.cdn_http,
  39292. cdn_https: defaults.cdn_https,
  39293. version: defaults.VERSION,
  39294. suffix: defaults.dependency_suffix,
  39295. receivers: DependenciesReceivers
  39296. });
  39297. // CONCATENATED MODULE: ./src/core/base64.ts
  39298. function encode(s) {
  39299. return btoa(utob(s));
  39300. }
  39301. var fromCharCode = String.fromCharCode;
  39302. var b64chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
  39303. var b64tab = {};
  39304. for (var base64_i = 0, l = b64chars.length; base64_i < l; base64_i++) {
  39305. b64tab[b64chars.charAt(base64_i)] = base64_i;
  39306. }
  39307. var cb_utob = function (c) {
  39308. var cc = c.charCodeAt(0);
  39309. return cc < 0x80
  39310. ? c
  39311. : cc < 0x800
  39312. ? fromCharCode(0xc0 | (cc >>> 6)) + fromCharCode(0x80 | (cc & 0x3f))
  39313. : fromCharCode(0xe0 | ((cc >>> 12) & 0x0f)) +
  39314. fromCharCode(0x80 | ((cc >>> 6) & 0x3f)) +
  39315. fromCharCode(0x80 | (cc & 0x3f));
  39316. };
  39317. var utob = function (u) {
  39318. return u.replace(/[^\x00-\x7F]/g, cb_utob);
  39319. };
  39320. var cb_encode = function (ccc) {
  39321. var padlen = [0, 2, 1][ccc.length % 3];
  39322. var ord = (ccc.charCodeAt(0) << 16) |
  39323. ((ccc.length > 1 ? ccc.charCodeAt(1) : 0) << 8) |
  39324. (ccc.length > 2 ? ccc.charCodeAt(2) : 0);
  39325. var chars = [
  39326. b64chars.charAt(ord >>> 18),
  39327. b64chars.charAt((ord >>> 12) & 63),
  39328. padlen >= 2 ? '=' : b64chars.charAt((ord >>> 6) & 63),
  39329. padlen >= 1 ? '=' : b64chars.charAt(ord & 63)
  39330. ];
  39331. return chars.join('');
  39332. };
  39333. var btoa = window.btoa ||
  39334. function (b) {
  39335. return b.replace(/[\s\S]{1,3}/g, cb_encode);
  39336. };
  39337. // CONCATENATED MODULE: ./src/core/utils/timers/abstract_timer.ts
  39338. var Timer = (function () {
  39339. function Timer(set, clear, delay, callback) {
  39340. var _this = this;
  39341. this.clear = clear;
  39342. this.timer = set(function () {
  39343. if (_this.timer) {
  39344. _this.timer = callback(_this.timer);
  39345. }
  39346. }, delay);
  39347. }
  39348. Timer.prototype.isRunning = function () {
  39349. return this.timer !== null;
  39350. };
  39351. Timer.prototype.ensureAborted = function () {
  39352. if (this.timer) {
  39353. this.clear(this.timer);
  39354. this.timer = null;
  39355. }
  39356. };
  39357. return Timer;
  39358. }());
  39359. /* harmony default export */ var abstract_timer = (Timer);
  39360. // CONCATENATED MODULE: ./src/core/utils/timers/index.ts
  39361. var __extends = (undefined && undefined.__extends) || (function () {
  39362. var extendStatics = function (d, b) {
  39363. extendStatics = Object.setPrototypeOf ||
  39364. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  39365. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  39366. return extendStatics(d, b);
  39367. };
  39368. return function (d, b) {
  39369. extendStatics(d, b);
  39370. function __() { this.constructor = d; }
  39371. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  39372. };
  39373. })();
  39374. function timers_clearTimeout(timer) {
  39375. window.clearTimeout(timer);
  39376. }
  39377. function timers_clearInterval(timer) {
  39378. window.clearInterval(timer);
  39379. }
  39380. var OneOffTimer = (function (_super) {
  39381. __extends(OneOffTimer, _super);
  39382. function OneOffTimer(delay, callback) {
  39383. return _super.call(this, setTimeout, timers_clearTimeout, delay, function (timer) {
  39384. callback();
  39385. return null;
  39386. }) || this;
  39387. }
  39388. return OneOffTimer;
  39389. }(abstract_timer));
  39390. var PeriodicTimer = (function (_super) {
  39391. __extends(PeriodicTimer, _super);
  39392. function PeriodicTimer(delay, callback) {
  39393. return _super.call(this, setInterval, timers_clearInterval, delay, function (timer) {
  39394. callback();
  39395. return timer;
  39396. }) || this;
  39397. }
  39398. return PeriodicTimer;
  39399. }(abstract_timer));
  39400. // CONCATENATED MODULE: ./src/core/util.ts
  39401. var Util = {
  39402. now: function () {
  39403. if (Date.now) {
  39404. return Date.now();
  39405. }
  39406. else {
  39407. return new Date().valueOf();
  39408. }
  39409. },
  39410. defer: function (callback) {
  39411. return new OneOffTimer(0, callback);
  39412. },
  39413. method: function (name) {
  39414. var args = [];
  39415. for (var _i = 1; _i < arguments.length; _i++) {
  39416. args[_i - 1] = arguments[_i];
  39417. }
  39418. var boundArguments = Array.prototype.slice.call(arguments, 1);
  39419. return function (object) {
  39420. return object[name].apply(object, boundArguments.concat(arguments));
  39421. };
  39422. }
  39423. };
  39424. /* harmony default export */ var util = (Util);
  39425. // CONCATENATED MODULE: ./src/core/utils/collections.ts
  39426. function extend(target) {
  39427. var sources = [];
  39428. for (var _i = 1; _i < arguments.length; _i++) {
  39429. sources[_i - 1] = arguments[_i];
  39430. }
  39431. for (var i = 0; i < sources.length; i++) {
  39432. var extensions = sources[i];
  39433. for (var property in extensions) {
  39434. if (extensions[property] && extensions[property].constructor &&
  39435. extensions[property].constructor === Object) {
  39436. target[property] = extend(target[property] || {}, extensions[property]);
  39437. }
  39438. else {
  39439. target[property] = extensions[property];
  39440. }
  39441. }
  39442. }
  39443. return target;
  39444. }
  39445. function stringify() {
  39446. var m = ["Pusher"];
  39447. for (var i = 0; i < arguments.length; i++) {
  39448. if (typeof arguments[i] === "string") {
  39449. m.push(arguments[i]);
  39450. }
  39451. else {
  39452. m.push(safeJSONStringify(arguments[i]));
  39453. }
  39454. }
  39455. return m.join(" : ");
  39456. }
  39457. function arrayIndexOf(array, item) {
  39458. var nativeIndexOf = Array.prototype.indexOf;
  39459. if (array === null) {
  39460. return -1;
  39461. }
  39462. if (nativeIndexOf && array.indexOf === nativeIndexOf) {
  39463. return array.indexOf(item);
  39464. }
  39465. for (var i = 0, l = array.length; i < l; i++) {
  39466. if (array[i] === item) {
  39467. return i;
  39468. }
  39469. }
  39470. return -1;
  39471. }
  39472. function objectApply(object, f) {
  39473. for (var key in object) {
  39474. if (Object.prototype.hasOwnProperty.call(object, key)) {
  39475. f(object[key], key, object);
  39476. }
  39477. }
  39478. }
  39479. function keys(object) {
  39480. var keys = [];
  39481. objectApply(object, function (_, key) {
  39482. keys.push(key);
  39483. });
  39484. return keys;
  39485. }
  39486. function values(object) {
  39487. var values = [];
  39488. objectApply(object, function (value) {
  39489. values.push(value);
  39490. });
  39491. return values;
  39492. }
  39493. function apply(array, f, context) {
  39494. for (var i = 0; i < array.length; i++) {
  39495. f.call(context || window, array[i], i, array);
  39496. }
  39497. }
  39498. function map(array, f) {
  39499. var result = [];
  39500. for (var i = 0; i < array.length; i++) {
  39501. result.push(f(array[i], i, array, result));
  39502. }
  39503. return result;
  39504. }
  39505. function mapObject(object, f) {
  39506. var result = {};
  39507. objectApply(object, function (value, key) {
  39508. result[key] = f(value);
  39509. });
  39510. return result;
  39511. }
  39512. function filter(array, test) {
  39513. test = test || function (value) { return !!value; };
  39514. var result = [];
  39515. for (var i = 0; i < array.length; i++) {
  39516. if (test(array[i], i, array, result)) {
  39517. result.push(array[i]);
  39518. }
  39519. }
  39520. return result;
  39521. }
  39522. function filterObject(object, test) {
  39523. var result = {};
  39524. objectApply(object, function (value, key) {
  39525. if ((test && test(value, key, object, result)) || Boolean(value)) {
  39526. result[key] = value;
  39527. }
  39528. });
  39529. return result;
  39530. }
  39531. function flatten(object) {
  39532. var result = [];
  39533. objectApply(object, function (value, key) {
  39534. result.push([key, value]);
  39535. });
  39536. return result;
  39537. }
  39538. function any(array, test) {
  39539. for (var i = 0; i < array.length; i++) {
  39540. if (test(array[i], i, array)) {
  39541. return true;
  39542. }
  39543. }
  39544. return false;
  39545. }
  39546. function collections_all(array, test) {
  39547. for (var i = 0; i < array.length; i++) {
  39548. if (!test(array[i], i, array)) {
  39549. return false;
  39550. }
  39551. }
  39552. return true;
  39553. }
  39554. function encodeParamsObject(data) {
  39555. return mapObject(data, function (value) {
  39556. if (typeof value === "object") {
  39557. value = safeJSONStringify(value);
  39558. }
  39559. return encodeURIComponent(encode(value.toString()));
  39560. });
  39561. }
  39562. function buildQueryString(data) {
  39563. var params = filterObject(data, function (value) {
  39564. return value !== undefined;
  39565. });
  39566. var query = map(flatten(encodeParamsObject(params)), util.method("join", "=")).join("&");
  39567. return query;
  39568. }
  39569. function decycleObject(object) {
  39570. var objects = [], paths = [];
  39571. return (function derez(value, path) {
  39572. var i, name, nu;
  39573. switch (typeof value) {
  39574. case 'object':
  39575. if (!value) {
  39576. return null;
  39577. }
  39578. for (i = 0; i < objects.length; i += 1) {
  39579. if (objects[i] === value) {
  39580. return { $ref: paths[i] };
  39581. }
  39582. }
  39583. objects.push(value);
  39584. paths.push(path);
  39585. if (Object.prototype.toString.apply(value) === '[object Array]') {
  39586. nu = [];
  39587. for (i = 0; i < value.length; i += 1) {
  39588. nu[i] = derez(value[i], path + '[' + i + ']');
  39589. }
  39590. }
  39591. else {
  39592. nu = {};
  39593. for (name in value) {
  39594. if (Object.prototype.hasOwnProperty.call(value, name)) {
  39595. nu[name] = derez(value[name], path + '[' + JSON.stringify(name) + ']');
  39596. }
  39597. }
  39598. }
  39599. return nu;
  39600. case 'number':
  39601. case 'string':
  39602. case 'boolean':
  39603. return value;
  39604. }
  39605. }(object, '$'));
  39606. }
  39607. function safeJSONStringify(source) {
  39608. try {
  39609. return JSON.stringify(source);
  39610. }
  39611. catch (e) {
  39612. return JSON.stringify(decycleObject(source));
  39613. }
  39614. }
  39615. // CONCATENATED MODULE: ./src/core/logger.ts
  39616. var logger_Logger = (function () {
  39617. function Logger() {
  39618. this.globalLog = function (message) {
  39619. if (window.console && window.console.log) {
  39620. window.console.log(message);
  39621. }
  39622. };
  39623. }
  39624. Logger.prototype.debug = function () {
  39625. var args = [];
  39626. for (var _i = 0; _i < arguments.length; _i++) {
  39627. args[_i] = arguments[_i];
  39628. }
  39629. this.log(this.globalLog, args);
  39630. };
  39631. Logger.prototype.warn = function () {
  39632. var args = [];
  39633. for (var _i = 0; _i < arguments.length; _i++) {
  39634. args[_i] = arguments[_i];
  39635. }
  39636. this.log(this.globalLogWarn, args);
  39637. };
  39638. Logger.prototype.error = function () {
  39639. var args = [];
  39640. for (var _i = 0; _i < arguments.length; _i++) {
  39641. args[_i] = arguments[_i];
  39642. }
  39643. this.log(this.globalLogError, args);
  39644. };
  39645. Logger.prototype.globalLogWarn = function (message) {
  39646. if (window.console && window.console.warn) {
  39647. window.console.warn(message);
  39648. }
  39649. else {
  39650. this.globalLog(message);
  39651. }
  39652. };
  39653. Logger.prototype.globalLogError = function (message) {
  39654. if (window.console && window.console.error) {
  39655. window.console.error(message);
  39656. }
  39657. else {
  39658. this.globalLogWarn(message);
  39659. }
  39660. };
  39661. Logger.prototype.log = function (defaultLoggingFunction) {
  39662. var args = [];
  39663. for (var _i = 1; _i < arguments.length; _i++) {
  39664. args[_i - 1] = arguments[_i];
  39665. }
  39666. var message = stringify.apply(this, arguments);
  39667. if (core_pusher.log) {
  39668. core_pusher.log(message);
  39669. }
  39670. else if (core_pusher.logToConsole) {
  39671. var log = defaultLoggingFunction.bind(this);
  39672. log(message);
  39673. }
  39674. };
  39675. return Logger;
  39676. }());
  39677. /* harmony default export */ var logger = (new logger_Logger());
  39678. // CONCATENATED MODULE: ./src/core/utils/url_store.ts
  39679. var urlStore = {
  39680. baseUrl: "https://pusher.com",
  39681. urls: {
  39682. authenticationEndpoint: {
  39683. path: "/docs/authenticating_users",
  39684. },
  39685. javascriptQuickStart: {
  39686. path: "/docs/javascript_quick_start"
  39687. },
  39688. triggeringClientEvents: {
  39689. path: "/docs/client_api_guide/client_events#trigger-events"
  39690. }
  39691. }
  39692. };
  39693. var buildLogSuffix = function (key) {
  39694. var urlPrefix = "See:";
  39695. var urlObj = urlStore.urls[key];
  39696. if (!urlObj)
  39697. return "";
  39698. var url;
  39699. if (urlObj.fullUrl) {
  39700. url = urlObj.fullUrl;
  39701. }
  39702. else if (urlObj.path) {
  39703. url = urlStore.baseUrl + urlObj.path;
  39704. }
  39705. if (!url)
  39706. return "";
  39707. return urlPrefix + " " + url;
  39708. };
  39709. /* harmony default export */ var url_store = ({ buildLogSuffix: buildLogSuffix });
  39710. // CONCATENATED MODULE: ./src/runtimes/isomorphic/auth/xhr_auth.ts
  39711. var ajax = function (context, socketId, callback) {
  39712. var self = this, xhr;
  39713. xhr = runtime.createXHR();
  39714. xhr.open("POST", self.options.authEndpoint, true);
  39715. xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
  39716. for (var headerName in this.authOptions.headers) {
  39717. xhr.setRequestHeader(headerName, this.authOptions.headers[headerName]);
  39718. }
  39719. xhr.onreadystatechange = function () {
  39720. if (xhr.readyState === 4) {
  39721. if (xhr.status === 200) {
  39722. var data, parsed = false;
  39723. try {
  39724. data = JSON.parse(xhr.responseText);
  39725. parsed = true;
  39726. }
  39727. catch (e) {
  39728. callback(true, 'JSON returned from auth endpoint was invalid, yet status code was 200. Data was: ' + xhr.responseText);
  39729. }
  39730. if (parsed) {
  39731. callback(false, data);
  39732. }
  39733. }
  39734. else {
  39735. var suffix = url_store.buildLogSuffix("authenticationEndpoint");
  39736. logger.error('Unable to retrieve auth string from auth endpoint - ' +
  39737. ("received status " + xhr.status + " from " + self.options.authEndpoint + ". ") +
  39738. ("Clients must be authenticated to join private or presence channels. " + suffix));
  39739. callback(true, xhr.status);
  39740. }
  39741. }
  39742. };
  39743. xhr.send(this.composeQuery(socketId));
  39744. return xhr;
  39745. };
  39746. /* harmony default export */ var xhr_auth = (ajax);
  39747. // CONCATENATED MODULE: ./src/runtimes/web/auth/jsonp_auth.ts
  39748. var jsonp = function (context, socketId, callback) {
  39749. if (this.authOptions.headers !== undefined) {
  39750. logger.warn('To send headers with the auth request, you must use AJAX, rather than JSONP.');
  39751. }
  39752. var callbackName = context.nextAuthCallbackID.toString();
  39753. context.nextAuthCallbackID++;
  39754. var document = context.getDocument();
  39755. var script = document.createElement("script");
  39756. context.auth_callbacks[callbackName] = function (data) {
  39757. callback(false, data);
  39758. };
  39759. var callback_name = "Pusher.auth_callbacks['" + callbackName + "']";
  39760. script.src = this.options.authEndpoint +
  39761. '?callback=' +
  39762. encodeURIComponent(callback_name) +
  39763. '&' +
  39764. this.composeQuery(socketId);
  39765. var head = document.getElementsByTagName("head")[0] || document.documentElement;
  39766. head.insertBefore(script, head.firstChild);
  39767. };
  39768. /* harmony default export */ var jsonp_auth = (jsonp);
  39769. // CONCATENATED MODULE: ./src/runtimes/web/dom/script_request.ts
  39770. var ScriptRequest = (function () {
  39771. function ScriptRequest(src) {
  39772. this.src = src;
  39773. }
  39774. ScriptRequest.prototype.send = function (receiver) {
  39775. var self = this;
  39776. var errorString = "Error loading " + self.src;
  39777. self.script = document.createElement("script");
  39778. self.script.id = receiver.id;
  39779. self.script.src = self.src;
  39780. self.script.type = "text/javascript";
  39781. self.script.charset = "UTF-8";
  39782. if (self.script.addEventListener) {
  39783. self.script.onerror = function () {
  39784. receiver.callback(errorString);
  39785. };
  39786. self.script.onload = function () {
  39787. receiver.callback(null);
  39788. };
  39789. }
  39790. else {
  39791. self.script.onreadystatechange = function () {
  39792. if (self.script.readyState === 'loaded' ||
  39793. self.script.readyState === 'complete') {
  39794. receiver.callback(null);
  39795. }
  39796. };
  39797. }
  39798. if (self.script.async === undefined && document.attachEvent &&
  39799. /opera/i.test(navigator.userAgent)) {
  39800. self.errorScript = document.createElement("script");
  39801. self.errorScript.id = receiver.id + "_error";
  39802. self.errorScript.text = receiver.name + "('" + errorString + "');";
  39803. self.script.async = self.errorScript.async = false;
  39804. }
  39805. else {
  39806. self.script.async = true;
  39807. }
  39808. var head = document.getElementsByTagName('head')[0];
  39809. head.insertBefore(self.script, head.firstChild);
  39810. if (self.errorScript) {
  39811. head.insertBefore(self.errorScript, self.script.nextSibling);
  39812. }
  39813. };
  39814. ScriptRequest.prototype.cleanup = function () {
  39815. if (this.script) {
  39816. this.script.onload = this.script.onerror = null;
  39817. this.script.onreadystatechange = null;
  39818. }
  39819. if (this.script && this.script.parentNode) {
  39820. this.script.parentNode.removeChild(this.script);
  39821. }
  39822. if (this.errorScript && this.errorScript.parentNode) {
  39823. this.errorScript.parentNode.removeChild(this.errorScript);
  39824. }
  39825. this.script = null;
  39826. this.errorScript = null;
  39827. };
  39828. return ScriptRequest;
  39829. }());
  39830. /* harmony default export */ var script_request = (ScriptRequest);
  39831. // CONCATENATED MODULE: ./src/runtimes/web/dom/jsonp_request.ts
  39832. var jsonp_request_JSONPRequest = (function () {
  39833. function JSONPRequest(url, data) {
  39834. this.url = url;
  39835. this.data = data;
  39836. }
  39837. JSONPRequest.prototype.send = function (receiver) {
  39838. if (this.request) {
  39839. return;
  39840. }
  39841. var query = buildQueryString(this.data);
  39842. var url = this.url + "/" + receiver.number + "?" + query;
  39843. this.request = runtime.createScriptRequest(url);
  39844. this.request.send(receiver);
  39845. };
  39846. JSONPRequest.prototype.cleanup = function () {
  39847. if (this.request) {
  39848. this.request.cleanup();
  39849. }
  39850. };
  39851. return JSONPRequest;
  39852. }());
  39853. /* harmony default export */ var jsonp_request = (jsonp_request_JSONPRequest);
  39854. // CONCATENATED MODULE: ./src/runtimes/web/timeline/jsonp_timeline.ts
  39855. var getAgent = function (sender, useTLS) {
  39856. return function (data, callback) {
  39857. var scheme = "http" + (useTLS ? "s" : "") + "://";
  39858. var url = scheme + (sender.host || sender.options.host) + sender.options.path;
  39859. var request = runtime.createJSONPRequest(url, data);
  39860. var receiver = runtime.ScriptReceivers.create(function (error, result) {
  39861. ScriptReceivers.remove(receiver);
  39862. request.cleanup();
  39863. if (result && result.host) {
  39864. sender.host = result.host;
  39865. }
  39866. if (callback) {
  39867. callback(error, result);
  39868. }
  39869. });
  39870. request.send(receiver);
  39871. };
  39872. };
  39873. var jsonp_timeline_jsonp = {
  39874. name: 'jsonp',
  39875. getAgent: getAgent
  39876. };
  39877. /* harmony default export */ var jsonp_timeline = (jsonp_timeline_jsonp);
  39878. // CONCATENATED MODULE: ./src/core/transports/url_schemes.ts
  39879. function getGenericURL(baseScheme, params, path) {
  39880. var scheme = baseScheme + (params.useTLS ? "s" : "");
  39881. var host = params.useTLS ? params.hostTLS : params.hostNonTLS;
  39882. return scheme + "://" + host + path;
  39883. }
  39884. function getGenericPath(key, queryString) {
  39885. var path = "/app/" + key;
  39886. var query = "?protocol=" + defaults.PROTOCOL +
  39887. "&client=js" +
  39888. "&version=" + defaults.VERSION +
  39889. (queryString ? ("&" + queryString) : "");
  39890. return path + query;
  39891. }
  39892. var ws = {
  39893. getInitial: function (key, params) {
  39894. var path = (params.httpPath || "") + getGenericPath(key, "flash=false");
  39895. return getGenericURL("ws", params, path);
  39896. }
  39897. };
  39898. var http = {
  39899. getInitial: function (key, params) {
  39900. var path = (params.httpPath || "/pusher") + getGenericPath(key);
  39901. return getGenericURL("http", params, path);
  39902. }
  39903. };
  39904. var sockjs = {
  39905. getInitial: function (key, params) {
  39906. return getGenericURL("http", params, params.httpPath || "/pusher");
  39907. },
  39908. getPath: function (key, params) {
  39909. return getGenericPath(key);
  39910. }
  39911. };
  39912. // CONCATENATED MODULE: ./src/core/events/callback_registry.ts
  39913. var callback_registry_CallbackRegistry = (function () {
  39914. function CallbackRegistry() {
  39915. this._callbacks = {};
  39916. }
  39917. CallbackRegistry.prototype.get = function (name) {
  39918. return this._callbacks[prefix(name)];
  39919. };
  39920. CallbackRegistry.prototype.add = function (name, callback, context) {
  39921. var prefixedEventName = prefix(name);
  39922. this._callbacks[prefixedEventName] = this._callbacks[prefixedEventName] || [];
  39923. this._callbacks[prefixedEventName].push({
  39924. fn: callback,
  39925. context: context
  39926. });
  39927. };
  39928. CallbackRegistry.prototype.remove = function (name, callback, context) {
  39929. if (!name && !callback && !context) {
  39930. this._callbacks = {};
  39931. return;
  39932. }
  39933. var names = name ? [prefix(name)] : keys(this._callbacks);
  39934. if (callback || context) {
  39935. this.removeCallback(names, callback, context);
  39936. }
  39937. else {
  39938. this.removeAllCallbacks(names);
  39939. }
  39940. };
  39941. CallbackRegistry.prototype.removeCallback = function (names, callback, context) {
  39942. apply(names, function (name) {
  39943. this._callbacks[name] = filter(this._callbacks[name] || [], function (binding) {
  39944. return (callback && callback !== binding.fn) ||
  39945. (context && context !== binding.context);
  39946. });
  39947. if (this._callbacks[name].length === 0) {
  39948. delete this._callbacks[name];
  39949. }
  39950. }, this);
  39951. };
  39952. CallbackRegistry.prototype.removeAllCallbacks = function (names) {
  39953. apply(names, function (name) {
  39954. delete this._callbacks[name];
  39955. }, this);
  39956. };
  39957. return CallbackRegistry;
  39958. }());
  39959. /* harmony default export */ var callback_registry = (callback_registry_CallbackRegistry);
  39960. function prefix(name) {
  39961. return "_" + name;
  39962. }
  39963. // CONCATENATED MODULE: ./src/core/events/dispatcher.ts
  39964. var dispatcher_Dispatcher = (function () {
  39965. function Dispatcher(failThrough) {
  39966. this.callbacks = new callback_registry();
  39967. this.global_callbacks = [];
  39968. this.failThrough = failThrough;
  39969. }
  39970. Dispatcher.prototype.bind = function (eventName, callback, context) {
  39971. this.callbacks.add(eventName, callback, context);
  39972. return this;
  39973. };
  39974. Dispatcher.prototype.bind_global = function (callback) {
  39975. this.global_callbacks.push(callback);
  39976. return this;
  39977. };
  39978. Dispatcher.prototype.unbind = function (eventName, callback, context) {
  39979. this.callbacks.remove(eventName, callback, context);
  39980. return this;
  39981. };
  39982. Dispatcher.prototype.unbind_global = function (callback) {
  39983. if (!callback) {
  39984. this.global_callbacks = [];
  39985. return this;
  39986. }
  39987. this.global_callbacks = filter(this.global_callbacks || [], function (c) { return c !== callback; });
  39988. return this;
  39989. };
  39990. Dispatcher.prototype.unbind_all = function () {
  39991. this.unbind();
  39992. this.unbind_global();
  39993. return this;
  39994. };
  39995. Dispatcher.prototype.emit = function (eventName, data, metadata) {
  39996. for (var i = 0; i < this.global_callbacks.length; i++) {
  39997. this.global_callbacks[i](eventName, data);
  39998. }
  39999. var callbacks = this.callbacks.get(eventName);
  40000. var args = [];
  40001. if (metadata) {
  40002. args.push(data, metadata);
  40003. }
  40004. else if (data) {
  40005. args.push(data);
  40006. }
  40007. if (callbacks && callbacks.length > 0) {
  40008. for (var i = 0; i < callbacks.length; i++) {
  40009. callbacks[i].fn.apply(callbacks[i].context || window, args);
  40010. }
  40011. }
  40012. else if (this.failThrough) {
  40013. this.failThrough(eventName, data);
  40014. }
  40015. return this;
  40016. };
  40017. return Dispatcher;
  40018. }());
  40019. /* harmony default export */ var dispatcher = (dispatcher_Dispatcher);
  40020. // CONCATENATED MODULE: ./src/core/transports/transport_connection.ts
  40021. var transport_connection_extends = (undefined && undefined.__extends) || (function () {
  40022. var extendStatics = function (d, b) {
  40023. extendStatics = Object.setPrototypeOf ||
  40024. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40025. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40026. return extendStatics(d, b);
  40027. };
  40028. return function (d, b) {
  40029. extendStatics(d, b);
  40030. function __() { this.constructor = d; }
  40031. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40032. };
  40033. })();
  40034. var transport_connection_TransportConnection = (function (_super) {
  40035. transport_connection_extends(TransportConnection, _super);
  40036. function TransportConnection(hooks, name, priority, key, options) {
  40037. var _this = _super.call(this) || this;
  40038. _this.initialize = runtime.transportConnectionInitializer;
  40039. _this.hooks = hooks;
  40040. _this.name = name;
  40041. _this.priority = priority;
  40042. _this.key = key;
  40043. _this.options = options;
  40044. _this.state = "new";
  40045. _this.timeline = options.timeline;
  40046. _this.activityTimeout = options.activityTimeout;
  40047. _this.id = _this.timeline.generateUniqueID();
  40048. return _this;
  40049. }
  40050. TransportConnection.prototype.handlesActivityChecks = function () {
  40051. return Boolean(this.hooks.handlesActivityChecks);
  40052. };
  40053. TransportConnection.prototype.supportsPing = function () {
  40054. return Boolean(this.hooks.supportsPing);
  40055. };
  40056. TransportConnection.prototype.connect = function () {
  40057. var _this = this;
  40058. if (this.socket || this.state !== "initialized") {
  40059. return false;
  40060. }
  40061. var url = this.hooks.urls.getInitial(this.key, this.options);
  40062. try {
  40063. this.socket = this.hooks.getSocket(url, this.options);
  40064. }
  40065. catch (e) {
  40066. util.defer(function () {
  40067. _this.onError(e);
  40068. _this.changeState("closed");
  40069. });
  40070. return false;
  40071. }
  40072. this.bindListeners();
  40073. logger.debug("Connecting", { transport: this.name, url: url });
  40074. this.changeState("connecting");
  40075. return true;
  40076. };
  40077. TransportConnection.prototype.close = function () {
  40078. if (this.socket) {
  40079. this.socket.close();
  40080. return true;
  40081. }
  40082. else {
  40083. return false;
  40084. }
  40085. };
  40086. TransportConnection.prototype.send = function (data) {
  40087. var _this = this;
  40088. if (this.state === "open") {
  40089. util.defer(function () {
  40090. if (_this.socket) {
  40091. _this.socket.send(data);
  40092. }
  40093. });
  40094. return true;
  40095. }
  40096. else {
  40097. return false;
  40098. }
  40099. };
  40100. TransportConnection.prototype.ping = function () {
  40101. if (this.state === "open" && this.supportsPing()) {
  40102. this.socket.ping();
  40103. }
  40104. };
  40105. TransportConnection.prototype.onOpen = function () {
  40106. if (this.hooks.beforeOpen) {
  40107. this.hooks.beforeOpen(this.socket, this.hooks.urls.getPath(this.key, this.options));
  40108. }
  40109. this.changeState("open");
  40110. this.socket.onopen = undefined;
  40111. };
  40112. TransportConnection.prototype.onError = function (error) {
  40113. this.emit("error", { type: 'WebSocketError', error: error });
  40114. this.timeline.error(this.buildTimelineMessage({ error: error.toString() }));
  40115. };
  40116. TransportConnection.prototype.onClose = function (closeEvent) {
  40117. if (closeEvent) {
  40118. this.changeState("closed", {
  40119. code: closeEvent.code,
  40120. reason: closeEvent.reason,
  40121. wasClean: closeEvent.wasClean
  40122. });
  40123. }
  40124. else {
  40125. this.changeState("closed");
  40126. }
  40127. this.unbindListeners();
  40128. this.socket = undefined;
  40129. };
  40130. TransportConnection.prototype.onMessage = function (message) {
  40131. this.emit("message", message);
  40132. };
  40133. TransportConnection.prototype.onActivity = function () {
  40134. this.emit("activity");
  40135. };
  40136. TransportConnection.prototype.bindListeners = function () {
  40137. var _this = this;
  40138. this.socket.onopen = function () {
  40139. _this.onOpen();
  40140. };
  40141. this.socket.onerror = function (error) {
  40142. _this.onError(error);
  40143. };
  40144. this.socket.onclose = function (closeEvent) {
  40145. _this.onClose(closeEvent);
  40146. };
  40147. this.socket.onmessage = function (message) {
  40148. _this.onMessage(message);
  40149. };
  40150. if (this.supportsPing()) {
  40151. this.socket.onactivity = function () { _this.onActivity(); };
  40152. }
  40153. };
  40154. TransportConnection.prototype.unbindListeners = function () {
  40155. if (this.socket) {
  40156. this.socket.onopen = undefined;
  40157. this.socket.onerror = undefined;
  40158. this.socket.onclose = undefined;
  40159. this.socket.onmessage = undefined;
  40160. if (this.supportsPing()) {
  40161. this.socket.onactivity = undefined;
  40162. }
  40163. }
  40164. };
  40165. TransportConnection.prototype.changeState = function (state, params) {
  40166. this.state = state;
  40167. this.timeline.info(this.buildTimelineMessage({
  40168. state: state,
  40169. params: params
  40170. }));
  40171. this.emit(state, params);
  40172. };
  40173. TransportConnection.prototype.buildTimelineMessage = function (message) {
  40174. return extend({ cid: this.id }, message);
  40175. };
  40176. return TransportConnection;
  40177. }(dispatcher));
  40178. /* harmony default export */ var transport_connection = (transport_connection_TransportConnection);
  40179. // CONCATENATED MODULE: ./src/core/transports/transport.ts
  40180. var transport_Transport = (function () {
  40181. function Transport(hooks) {
  40182. this.hooks = hooks;
  40183. }
  40184. Transport.prototype.isSupported = function (environment) {
  40185. return this.hooks.isSupported(environment);
  40186. };
  40187. Transport.prototype.createConnection = function (name, priority, key, options) {
  40188. return new transport_connection(this.hooks, name, priority, key, options);
  40189. };
  40190. return Transport;
  40191. }());
  40192. /* harmony default export */ var transports_transport = (transport_Transport);
  40193. // CONCATENATED MODULE: ./src/runtimes/isomorphic/transports/transports.ts
  40194. var WSTransport = new transports_transport({
  40195. urls: ws,
  40196. handlesActivityChecks: false,
  40197. supportsPing: false,
  40198. isInitialized: function () {
  40199. return Boolean(runtime.getWebSocketAPI());
  40200. },
  40201. isSupported: function () {
  40202. return Boolean(runtime.getWebSocketAPI());
  40203. },
  40204. getSocket: function (url) {
  40205. return runtime.createWebSocket(url);
  40206. }
  40207. });
  40208. var httpConfiguration = {
  40209. urls: http,
  40210. handlesActivityChecks: false,
  40211. supportsPing: true,
  40212. isInitialized: function () {
  40213. return true;
  40214. }
  40215. };
  40216. var streamingConfiguration = extend({ getSocket: function (url) {
  40217. return runtime.HTTPFactory.createStreamingSocket(url);
  40218. }
  40219. }, httpConfiguration);
  40220. var pollingConfiguration = extend({ getSocket: function (url) {
  40221. return runtime.HTTPFactory.createPollingSocket(url);
  40222. }
  40223. }, httpConfiguration);
  40224. var xhrConfiguration = {
  40225. isSupported: function () {
  40226. return runtime.isXHRSupported();
  40227. }
  40228. };
  40229. var XHRStreamingTransport = new transports_transport(extend({}, streamingConfiguration, xhrConfiguration));
  40230. var XHRPollingTransport = new transports_transport(extend({}, pollingConfiguration, xhrConfiguration));
  40231. var Transports = {
  40232. ws: WSTransport,
  40233. xhr_streaming: XHRStreamingTransport,
  40234. xhr_polling: XHRPollingTransport
  40235. };
  40236. /* harmony default export */ var transports = (Transports);
  40237. // CONCATENATED MODULE: ./src/runtimes/web/transports/transports.ts
  40238. var SockJSTransport = new transports_transport({
  40239. file: "sockjs",
  40240. urls: sockjs,
  40241. handlesActivityChecks: true,
  40242. supportsPing: false,
  40243. isSupported: function () {
  40244. return true;
  40245. },
  40246. isInitialized: function () {
  40247. return window.SockJS !== undefined;
  40248. },
  40249. getSocket: function (url, options) {
  40250. return new window.SockJS(url, null, {
  40251. js_path: Dependencies.getPath("sockjs", {
  40252. useTLS: options.useTLS
  40253. }),
  40254. ignore_null_origin: options.ignoreNullOrigin
  40255. });
  40256. },
  40257. beforeOpen: function (socket, path) {
  40258. socket.send(JSON.stringify({
  40259. path: path
  40260. }));
  40261. }
  40262. });
  40263. var xdrConfiguration = {
  40264. isSupported: function (environment) {
  40265. var yes = runtime.isXDRSupported(environment.useTLS);
  40266. return yes;
  40267. }
  40268. };
  40269. var XDRStreamingTransport = new transports_transport(extend({}, streamingConfiguration, xdrConfiguration));
  40270. var XDRPollingTransport = new transports_transport(extend({}, pollingConfiguration, xdrConfiguration));
  40271. transports.xdr_streaming = XDRStreamingTransport;
  40272. transports.xdr_polling = XDRPollingTransport;
  40273. transports.sockjs = SockJSTransport;
  40274. /* harmony default export */ var transports_transports = (transports);
  40275. // CONCATENATED MODULE: ./src/runtimes/web/net_info.ts
  40276. var net_info_extends = (undefined && undefined.__extends) || (function () {
  40277. var extendStatics = function (d, b) {
  40278. extendStatics = Object.setPrototypeOf ||
  40279. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40280. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40281. return extendStatics(d, b);
  40282. };
  40283. return function (d, b) {
  40284. extendStatics(d, b);
  40285. function __() { this.constructor = d; }
  40286. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40287. };
  40288. })();
  40289. var NetInfo = (function (_super) {
  40290. net_info_extends(NetInfo, _super);
  40291. function NetInfo() {
  40292. var _this = _super.call(this) || this;
  40293. var self = _this;
  40294. if (window.addEventListener !== undefined) {
  40295. window.addEventListener("online", function () {
  40296. self.emit('online');
  40297. }, false);
  40298. window.addEventListener("offline", function () {
  40299. self.emit('offline');
  40300. }, false);
  40301. }
  40302. return _this;
  40303. }
  40304. NetInfo.prototype.isOnline = function () {
  40305. if (window.navigator.onLine === undefined) {
  40306. return true;
  40307. }
  40308. else {
  40309. return window.navigator.onLine;
  40310. }
  40311. };
  40312. return NetInfo;
  40313. }(dispatcher));
  40314. var net_info_Network = new NetInfo();
  40315. // CONCATENATED MODULE: ./src/core/transports/assistant_to_the_transport_manager.ts
  40316. var assistant_to_the_transport_manager_AssistantToTheTransportManager = (function () {
  40317. function AssistantToTheTransportManager(manager, transport, options) {
  40318. this.manager = manager;
  40319. this.transport = transport;
  40320. this.minPingDelay = options.minPingDelay;
  40321. this.maxPingDelay = options.maxPingDelay;
  40322. this.pingDelay = undefined;
  40323. }
  40324. AssistantToTheTransportManager.prototype.createConnection = function (name, priority, key, options) {
  40325. var _this = this;
  40326. options = extend({}, options, {
  40327. activityTimeout: this.pingDelay
  40328. });
  40329. var connection = this.transport.createConnection(name, priority, key, options);
  40330. var openTimestamp = null;
  40331. var onOpen = function () {
  40332. connection.unbind("open", onOpen);
  40333. connection.bind("closed", onClosed);
  40334. openTimestamp = util.now();
  40335. };
  40336. var onClosed = function (closeEvent) {
  40337. connection.unbind("closed", onClosed);
  40338. if (closeEvent.code === 1002 || closeEvent.code === 1003) {
  40339. _this.manager.reportDeath();
  40340. }
  40341. else if (!closeEvent.wasClean && openTimestamp) {
  40342. var lifespan = util.now() - openTimestamp;
  40343. if (lifespan < 2 * _this.maxPingDelay) {
  40344. _this.manager.reportDeath();
  40345. _this.pingDelay = Math.max(lifespan / 2, _this.minPingDelay);
  40346. }
  40347. }
  40348. };
  40349. connection.bind("open", onOpen);
  40350. return connection;
  40351. };
  40352. AssistantToTheTransportManager.prototype.isSupported = function (environment) {
  40353. return this.manager.isAlive() && this.transport.isSupported(environment);
  40354. };
  40355. return AssistantToTheTransportManager;
  40356. }());
  40357. /* harmony default export */ var assistant_to_the_transport_manager = (assistant_to_the_transport_manager_AssistantToTheTransportManager);
  40358. // CONCATENATED MODULE: ./src/core/connection/protocol/protocol.ts
  40359. var Protocol = {
  40360. decodeMessage: function (messageEvent) {
  40361. try {
  40362. var messageData = JSON.parse(messageEvent.data);
  40363. var pusherEventData = messageData.data;
  40364. if (typeof pusherEventData === 'string') {
  40365. try {
  40366. pusherEventData = JSON.parse(messageData.data);
  40367. }
  40368. catch (e) { }
  40369. }
  40370. var pusherEvent = {
  40371. event: messageData.event,
  40372. channel: messageData.channel,
  40373. data: pusherEventData,
  40374. };
  40375. if (messageData.user_id) {
  40376. pusherEvent.user_id = messageData.user_id;
  40377. }
  40378. return pusherEvent;
  40379. }
  40380. catch (e) {
  40381. throw { type: 'MessageParseError', error: e, data: messageEvent.data };
  40382. }
  40383. },
  40384. encodeMessage: function (event) {
  40385. return JSON.stringify(event);
  40386. },
  40387. processHandshake: function (messageEvent) {
  40388. var message = Protocol.decodeMessage(messageEvent);
  40389. if (message.event === "pusher:connection_established") {
  40390. if (!message.data.activity_timeout) {
  40391. throw "No activity timeout specified in handshake";
  40392. }
  40393. return {
  40394. action: "connected",
  40395. id: message.data.socket_id,
  40396. activityTimeout: message.data.activity_timeout * 1000
  40397. };
  40398. }
  40399. else if (message.event === "pusher:error") {
  40400. return {
  40401. action: this.getCloseAction(message.data),
  40402. error: this.getCloseError(message.data)
  40403. };
  40404. }
  40405. else {
  40406. throw "Invalid handshake";
  40407. }
  40408. },
  40409. getCloseAction: function (closeEvent) {
  40410. if (closeEvent.code < 4000) {
  40411. if (closeEvent.code >= 1002 && closeEvent.code <= 1004) {
  40412. return "backoff";
  40413. }
  40414. else {
  40415. return null;
  40416. }
  40417. }
  40418. else if (closeEvent.code === 4000) {
  40419. return "tls_only";
  40420. }
  40421. else if (closeEvent.code < 4100) {
  40422. return "refused";
  40423. }
  40424. else if (closeEvent.code < 4200) {
  40425. return "backoff";
  40426. }
  40427. else if (closeEvent.code < 4300) {
  40428. return "retry";
  40429. }
  40430. else {
  40431. return "refused";
  40432. }
  40433. },
  40434. getCloseError: function (closeEvent) {
  40435. if (closeEvent.code !== 1000 && closeEvent.code !== 1001) {
  40436. return {
  40437. type: 'PusherError',
  40438. data: {
  40439. code: closeEvent.code,
  40440. message: closeEvent.reason || closeEvent.message
  40441. }
  40442. };
  40443. }
  40444. else {
  40445. return null;
  40446. }
  40447. }
  40448. };
  40449. /* harmony default export */ var protocol_protocol = (Protocol);
  40450. // CONCATENATED MODULE: ./src/core/connection/connection.ts
  40451. var connection_extends = (undefined && undefined.__extends) || (function () {
  40452. var extendStatics = function (d, b) {
  40453. extendStatics = Object.setPrototypeOf ||
  40454. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40455. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40456. return extendStatics(d, b);
  40457. };
  40458. return function (d, b) {
  40459. extendStatics(d, b);
  40460. function __() { this.constructor = d; }
  40461. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40462. };
  40463. })();
  40464. var connection_Connection = (function (_super) {
  40465. connection_extends(Connection, _super);
  40466. function Connection(id, transport) {
  40467. var _this = _super.call(this) || this;
  40468. _this.id = id;
  40469. _this.transport = transport;
  40470. _this.activityTimeout = transport.activityTimeout;
  40471. _this.bindListeners();
  40472. return _this;
  40473. }
  40474. Connection.prototype.handlesActivityChecks = function () {
  40475. return this.transport.handlesActivityChecks();
  40476. };
  40477. Connection.prototype.send = function (data) {
  40478. return this.transport.send(data);
  40479. };
  40480. Connection.prototype.send_event = function (name, data, channel) {
  40481. var event = { event: name, data: data };
  40482. if (channel) {
  40483. event.channel = channel;
  40484. }
  40485. logger.debug('Event sent', event);
  40486. return this.send(protocol_protocol.encodeMessage(event));
  40487. };
  40488. Connection.prototype.ping = function () {
  40489. if (this.transport.supportsPing()) {
  40490. this.transport.ping();
  40491. }
  40492. else {
  40493. this.send_event('pusher:ping', {});
  40494. }
  40495. };
  40496. Connection.prototype.close = function () {
  40497. this.transport.close();
  40498. };
  40499. Connection.prototype.bindListeners = function () {
  40500. var _this = this;
  40501. var listeners = {
  40502. message: function (messageEvent) {
  40503. var pusherEvent;
  40504. try {
  40505. pusherEvent = protocol_protocol.decodeMessage(messageEvent);
  40506. }
  40507. catch (e) {
  40508. _this.emit('error', {
  40509. type: 'MessageParseError',
  40510. error: e,
  40511. data: messageEvent.data
  40512. });
  40513. }
  40514. if (pusherEvent !== undefined) {
  40515. logger.debug('Event recd', pusherEvent);
  40516. switch (pusherEvent.event) {
  40517. case 'pusher:error':
  40518. _this.emit('error', { type: 'PusherError', data: pusherEvent.data });
  40519. break;
  40520. case 'pusher:ping':
  40521. _this.emit("ping");
  40522. break;
  40523. case 'pusher:pong':
  40524. _this.emit("pong");
  40525. break;
  40526. }
  40527. _this.emit('message', pusherEvent);
  40528. }
  40529. },
  40530. activity: function () {
  40531. _this.emit("activity");
  40532. },
  40533. error: function (error) {
  40534. _this.emit("error", { type: "WebSocketError", error: error });
  40535. },
  40536. closed: function (closeEvent) {
  40537. unbindListeners();
  40538. if (closeEvent && closeEvent.code) {
  40539. _this.handleCloseEvent(closeEvent);
  40540. }
  40541. _this.transport = null;
  40542. _this.emit("closed");
  40543. }
  40544. };
  40545. var unbindListeners = function () {
  40546. objectApply(listeners, function (listener, event) {
  40547. _this.transport.unbind(event, listener);
  40548. });
  40549. };
  40550. objectApply(listeners, function (listener, event) {
  40551. _this.transport.bind(event, listener);
  40552. });
  40553. };
  40554. Connection.prototype.handleCloseEvent = function (closeEvent) {
  40555. var action = protocol_protocol.getCloseAction(closeEvent);
  40556. var error = protocol_protocol.getCloseError(closeEvent);
  40557. if (error) {
  40558. this.emit('error', error);
  40559. }
  40560. if (action) {
  40561. this.emit(action, { action: action, error: error });
  40562. }
  40563. };
  40564. return Connection;
  40565. }(dispatcher));
  40566. /* harmony default export */ var connection_connection = (connection_Connection);
  40567. // CONCATENATED MODULE: ./src/core/connection/handshake/index.ts
  40568. var handshake_Handshake = (function () {
  40569. function Handshake(transport, callback) {
  40570. this.transport = transport;
  40571. this.callback = callback;
  40572. this.bindListeners();
  40573. }
  40574. Handshake.prototype.close = function () {
  40575. this.unbindListeners();
  40576. this.transport.close();
  40577. };
  40578. Handshake.prototype.bindListeners = function () {
  40579. var _this = this;
  40580. this.onMessage = function (m) {
  40581. _this.unbindListeners();
  40582. var result;
  40583. try {
  40584. result = protocol_protocol.processHandshake(m);
  40585. }
  40586. catch (e) {
  40587. _this.finish("error", { error: e });
  40588. _this.transport.close();
  40589. return;
  40590. }
  40591. if (result.action === "connected") {
  40592. _this.finish("connected", {
  40593. connection: new connection_connection(result.id, _this.transport),
  40594. activityTimeout: result.activityTimeout
  40595. });
  40596. }
  40597. else {
  40598. _this.finish(result.action, { error: result.error });
  40599. _this.transport.close();
  40600. }
  40601. };
  40602. this.onClosed = function (closeEvent) {
  40603. _this.unbindListeners();
  40604. var action = protocol_protocol.getCloseAction(closeEvent) || "backoff";
  40605. var error = protocol_protocol.getCloseError(closeEvent);
  40606. _this.finish(action, { error: error });
  40607. };
  40608. this.transport.bind("message", this.onMessage);
  40609. this.transport.bind("closed", this.onClosed);
  40610. };
  40611. Handshake.prototype.unbindListeners = function () {
  40612. this.transport.unbind("message", this.onMessage);
  40613. this.transport.unbind("closed", this.onClosed);
  40614. };
  40615. Handshake.prototype.finish = function (action, params) {
  40616. this.callback(extend({ transport: this.transport, action: action }, params));
  40617. };
  40618. return Handshake;
  40619. }());
  40620. /* harmony default export */ var connection_handshake = (handshake_Handshake);
  40621. // CONCATENATED MODULE: ./src/core/auth/pusher_authorizer.ts
  40622. var pusher_authorizer_PusherAuthorizer = (function () {
  40623. function PusherAuthorizer(channel, options) {
  40624. this.channel = channel;
  40625. var authTransport = options.authTransport;
  40626. if (typeof runtime.getAuthorizers()[authTransport] === "undefined") {
  40627. throw "'" + authTransport + "' is not a recognized auth transport";
  40628. }
  40629. this.type = authTransport;
  40630. this.options = options;
  40631. this.authOptions = (options || {}).auth || {};
  40632. }
  40633. PusherAuthorizer.prototype.composeQuery = function (socketId) {
  40634. var query = 'socket_id=' + encodeURIComponent(socketId) +
  40635. '&channel_name=' + encodeURIComponent(this.channel.name);
  40636. for (var i in this.authOptions.params) {
  40637. query += "&" + encodeURIComponent(i) + "=" + encodeURIComponent(this.authOptions.params[i]);
  40638. }
  40639. return query;
  40640. };
  40641. PusherAuthorizer.prototype.authorize = function (socketId, callback) {
  40642. PusherAuthorizer.authorizers = PusherAuthorizer.authorizers || runtime.getAuthorizers();
  40643. return PusherAuthorizer.authorizers[this.type].call(this, runtime, socketId, callback);
  40644. };
  40645. return PusherAuthorizer;
  40646. }());
  40647. /* harmony default export */ var pusher_authorizer = (pusher_authorizer_PusherAuthorizer);
  40648. // CONCATENATED MODULE: ./src/core/timeline/timeline_sender.ts
  40649. var timeline_sender_TimelineSender = (function () {
  40650. function TimelineSender(timeline, options) {
  40651. this.timeline = timeline;
  40652. this.options = options || {};
  40653. }
  40654. TimelineSender.prototype.send = function (useTLS, callback) {
  40655. if (this.timeline.isEmpty()) {
  40656. return;
  40657. }
  40658. this.timeline.send(runtime.TimelineTransport.getAgent(this, useTLS), callback);
  40659. };
  40660. return TimelineSender;
  40661. }());
  40662. /* harmony default export */ var timeline_sender = (timeline_sender_TimelineSender);
  40663. // CONCATENATED MODULE: ./src/core/errors.ts
  40664. var errors_extends = (undefined && undefined.__extends) || (function () {
  40665. var extendStatics = function (d, b) {
  40666. extendStatics = Object.setPrototypeOf ||
  40667. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40668. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40669. return extendStatics(d, b);
  40670. };
  40671. return function (d, b) {
  40672. extendStatics(d, b);
  40673. function __() { this.constructor = d; }
  40674. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40675. };
  40676. })();
  40677. var BadEventName = (function (_super) {
  40678. errors_extends(BadEventName, _super);
  40679. function BadEventName(msg) {
  40680. var _newTarget = this.constructor;
  40681. var _this = _super.call(this, msg) || this;
  40682. Object.setPrototypeOf(_this, _newTarget.prototype);
  40683. return _this;
  40684. }
  40685. return BadEventName;
  40686. }(Error));
  40687. var RequestTimedOut = (function (_super) {
  40688. errors_extends(RequestTimedOut, _super);
  40689. function RequestTimedOut(msg) {
  40690. var _newTarget = this.constructor;
  40691. var _this = _super.call(this, msg) || this;
  40692. Object.setPrototypeOf(_this, _newTarget.prototype);
  40693. return _this;
  40694. }
  40695. return RequestTimedOut;
  40696. }(Error));
  40697. var TransportPriorityTooLow = (function (_super) {
  40698. errors_extends(TransportPriorityTooLow, _super);
  40699. function TransportPriorityTooLow(msg) {
  40700. var _newTarget = this.constructor;
  40701. var _this = _super.call(this, msg) || this;
  40702. Object.setPrototypeOf(_this, _newTarget.prototype);
  40703. return _this;
  40704. }
  40705. return TransportPriorityTooLow;
  40706. }(Error));
  40707. var TransportClosed = (function (_super) {
  40708. errors_extends(TransportClosed, _super);
  40709. function TransportClosed(msg) {
  40710. var _newTarget = this.constructor;
  40711. var _this = _super.call(this, msg) || this;
  40712. Object.setPrototypeOf(_this, _newTarget.prototype);
  40713. return _this;
  40714. }
  40715. return TransportClosed;
  40716. }(Error));
  40717. var UnsupportedFeature = (function (_super) {
  40718. errors_extends(UnsupportedFeature, _super);
  40719. function UnsupportedFeature(msg) {
  40720. var _newTarget = this.constructor;
  40721. var _this = _super.call(this, msg) || this;
  40722. Object.setPrototypeOf(_this, _newTarget.prototype);
  40723. return _this;
  40724. }
  40725. return UnsupportedFeature;
  40726. }(Error));
  40727. var UnsupportedTransport = (function (_super) {
  40728. errors_extends(UnsupportedTransport, _super);
  40729. function UnsupportedTransport(msg) {
  40730. var _newTarget = this.constructor;
  40731. var _this = _super.call(this, msg) || this;
  40732. Object.setPrototypeOf(_this, _newTarget.prototype);
  40733. return _this;
  40734. }
  40735. return UnsupportedTransport;
  40736. }(Error));
  40737. var UnsupportedStrategy = (function (_super) {
  40738. errors_extends(UnsupportedStrategy, _super);
  40739. function UnsupportedStrategy(msg) {
  40740. var _newTarget = this.constructor;
  40741. var _this = _super.call(this, msg) || this;
  40742. Object.setPrototypeOf(_this, _newTarget.prototype);
  40743. return _this;
  40744. }
  40745. return UnsupportedStrategy;
  40746. }(Error));
  40747. // CONCATENATED MODULE: ./src/core/channels/channel.ts
  40748. var channel_extends = (undefined && undefined.__extends) || (function () {
  40749. var extendStatics = function (d, b) {
  40750. extendStatics = Object.setPrototypeOf ||
  40751. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40752. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40753. return extendStatics(d, b);
  40754. };
  40755. return function (d, b) {
  40756. extendStatics(d, b);
  40757. function __() { this.constructor = d; }
  40758. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40759. };
  40760. })();
  40761. var channel_Channel = (function (_super) {
  40762. channel_extends(Channel, _super);
  40763. function Channel(name, pusher) {
  40764. var _this = _super.call(this, function (event, data) {
  40765. logger.debug('No callbacks on ' + name + ' for ' + event);
  40766. }) || this;
  40767. _this.name = name;
  40768. _this.pusher = pusher;
  40769. _this.subscribed = false;
  40770. _this.subscriptionPending = false;
  40771. _this.subscriptionCancelled = false;
  40772. return _this;
  40773. }
  40774. Channel.prototype.authorize = function (socketId, callback) {
  40775. return callback(false, {});
  40776. };
  40777. Channel.prototype.trigger = function (event, data) {
  40778. if (event.indexOf("client-") !== 0) {
  40779. throw new BadEventName("Event '" + event + "' does not start with 'client-'");
  40780. }
  40781. if (!this.subscribed) {
  40782. var suffix = url_store.buildLogSuffix("triggeringClientEvents");
  40783. logger.warn("Client event triggered before channel 'subscription_succeeded' event . " + suffix);
  40784. }
  40785. return this.pusher.send_event(event, data, this.name);
  40786. };
  40787. Channel.prototype.disconnect = function () {
  40788. this.subscribed = false;
  40789. this.subscriptionPending = false;
  40790. };
  40791. Channel.prototype.handleEvent = function (event) {
  40792. var eventName = event.event;
  40793. var data = event.data;
  40794. if (eventName === "pusher_internal:subscription_succeeded") {
  40795. this.handleSubscriptionSucceededEvent(event);
  40796. }
  40797. else if (eventName.indexOf("pusher_internal:") !== 0) {
  40798. var metadata = {};
  40799. this.emit(eventName, data, metadata);
  40800. }
  40801. };
  40802. Channel.prototype.handleSubscriptionSucceededEvent = function (event) {
  40803. this.subscriptionPending = false;
  40804. this.subscribed = true;
  40805. if (this.subscriptionCancelled) {
  40806. this.pusher.unsubscribe(this.name);
  40807. }
  40808. else {
  40809. this.emit("pusher:subscription_succeeded", event.data);
  40810. }
  40811. };
  40812. Channel.prototype.subscribe = function () {
  40813. var _this = this;
  40814. if (this.subscribed) {
  40815. return;
  40816. }
  40817. this.subscriptionPending = true;
  40818. this.subscriptionCancelled = false;
  40819. this.authorize(this.pusher.connection.socket_id, function (error, data) {
  40820. if (error) {
  40821. logger.error(data);
  40822. _this.emit('pusher:subscription_error', data);
  40823. }
  40824. else {
  40825. _this.pusher.send_event('pusher:subscribe', {
  40826. auth: data.auth,
  40827. channel_data: data.channel_data,
  40828. channel: _this.name
  40829. });
  40830. }
  40831. });
  40832. };
  40833. Channel.prototype.unsubscribe = function () {
  40834. this.subscribed = false;
  40835. this.pusher.send_event('pusher:unsubscribe', {
  40836. channel: this.name
  40837. });
  40838. };
  40839. Channel.prototype.cancelSubscription = function () {
  40840. this.subscriptionCancelled = true;
  40841. };
  40842. Channel.prototype.reinstateSubscription = function () {
  40843. this.subscriptionCancelled = false;
  40844. };
  40845. return Channel;
  40846. }(dispatcher));
  40847. /* harmony default export */ var channels_channel = (channel_Channel);
  40848. // CONCATENATED MODULE: ./src/core/channels/private_channel.ts
  40849. var private_channel_extends = (undefined && undefined.__extends) || (function () {
  40850. var extendStatics = function (d, b) {
  40851. extendStatics = Object.setPrototypeOf ||
  40852. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40853. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40854. return extendStatics(d, b);
  40855. };
  40856. return function (d, b) {
  40857. extendStatics(d, b);
  40858. function __() { this.constructor = d; }
  40859. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40860. };
  40861. })();
  40862. var private_channel_PrivateChannel = (function (_super) {
  40863. private_channel_extends(PrivateChannel, _super);
  40864. function PrivateChannel() {
  40865. return _super !== null && _super.apply(this, arguments) || this;
  40866. }
  40867. PrivateChannel.prototype.authorize = function (socketId, callback) {
  40868. var authorizer = factory.createAuthorizer(this, this.pusher.config);
  40869. return authorizer.authorize(socketId, callback);
  40870. };
  40871. return PrivateChannel;
  40872. }(channels_channel));
  40873. /* harmony default export */ var private_channel = (private_channel_PrivateChannel);
  40874. // CONCATENATED MODULE: ./src/core/channels/members.ts
  40875. var members_Members = (function () {
  40876. function Members() {
  40877. this.reset();
  40878. }
  40879. Members.prototype.get = function (id) {
  40880. if (Object.prototype.hasOwnProperty.call(this.members, id)) {
  40881. return {
  40882. id: id,
  40883. info: this.members[id]
  40884. };
  40885. }
  40886. else {
  40887. return null;
  40888. }
  40889. };
  40890. Members.prototype.each = function (callback) {
  40891. var _this = this;
  40892. objectApply(this.members, function (member, id) {
  40893. callback(_this.get(id));
  40894. });
  40895. };
  40896. Members.prototype.setMyID = function (id) {
  40897. this.myID = id;
  40898. };
  40899. Members.prototype.onSubscription = function (subscriptionData) {
  40900. this.members = subscriptionData.presence.hash;
  40901. this.count = subscriptionData.presence.count;
  40902. this.me = this.get(this.myID);
  40903. };
  40904. Members.prototype.addMember = function (memberData) {
  40905. if (this.get(memberData.user_id) === null) {
  40906. this.count++;
  40907. }
  40908. this.members[memberData.user_id] = memberData.user_info;
  40909. return this.get(memberData.user_id);
  40910. };
  40911. Members.prototype.removeMember = function (memberData) {
  40912. var member = this.get(memberData.user_id);
  40913. if (member) {
  40914. delete this.members[memberData.user_id];
  40915. this.count--;
  40916. }
  40917. return member;
  40918. };
  40919. Members.prototype.reset = function () {
  40920. this.members = {};
  40921. this.count = 0;
  40922. this.myID = null;
  40923. this.me = null;
  40924. };
  40925. return Members;
  40926. }());
  40927. /* harmony default export */ var members = (members_Members);
  40928. // CONCATENATED MODULE: ./src/core/channels/presence_channel.ts
  40929. var presence_channel_extends = (undefined && undefined.__extends) || (function () {
  40930. var extendStatics = function (d, b) {
  40931. extendStatics = Object.setPrototypeOf ||
  40932. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  40933. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  40934. return extendStatics(d, b);
  40935. };
  40936. return function (d, b) {
  40937. extendStatics(d, b);
  40938. function __() { this.constructor = d; }
  40939. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  40940. };
  40941. })();
  40942. var presence_channel_PresenceChannel = (function (_super) {
  40943. presence_channel_extends(PresenceChannel, _super);
  40944. function PresenceChannel(name, pusher) {
  40945. var _this = _super.call(this, name, pusher) || this;
  40946. _this.members = new members();
  40947. return _this;
  40948. }
  40949. PresenceChannel.prototype.authorize = function (socketId, callback) {
  40950. var _this = this;
  40951. _super.prototype.authorize.call(this, socketId, function (error, authData) {
  40952. if (!error) {
  40953. if (authData.channel_data === undefined) {
  40954. var suffix = url_store.buildLogSuffix("authenticationEndpoint");
  40955. logger.error("Invalid auth response for channel '" + _this.name + "'," +
  40956. ("expected 'channel_data' field. " + suffix));
  40957. callback("Invalid auth response");
  40958. return;
  40959. }
  40960. var channelData = JSON.parse(authData.channel_data);
  40961. _this.members.setMyID(channelData.user_id);
  40962. }
  40963. callback(error, authData);
  40964. });
  40965. };
  40966. PresenceChannel.prototype.handleEvent = function (event) {
  40967. var eventName = event.event;
  40968. if (eventName.indexOf("pusher_internal:") === 0) {
  40969. this.handleInternalEvent(event);
  40970. }
  40971. else {
  40972. var data = event.data;
  40973. var metadata = {};
  40974. if (event.user_id) {
  40975. metadata.user_id = event.user_id;
  40976. }
  40977. this.emit(eventName, data, metadata);
  40978. }
  40979. };
  40980. PresenceChannel.prototype.handleInternalEvent = function (event) {
  40981. var eventName = event.event;
  40982. var data = event.data;
  40983. switch (eventName) {
  40984. case "pusher_internal:subscription_succeeded":
  40985. this.handleSubscriptionSucceededEvent(event);
  40986. break;
  40987. case "pusher_internal:member_added":
  40988. var addedMember = this.members.addMember(data);
  40989. this.emit('pusher:member_added', addedMember);
  40990. break;
  40991. case "pusher_internal:member_removed":
  40992. var removedMember = this.members.removeMember(data);
  40993. if (removedMember) {
  40994. this.emit('pusher:member_removed', removedMember);
  40995. }
  40996. break;
  40997. }
  40998. };
  40999. PresenceChannel.prototype.handleSubscriptionSucceededEvent = function (event) {
  41000. this.subscriptionPending = false;
  41001. this.subscribed = true;
  41002. if (this.subscriptionCancelled) {
  41003. this.pusher.unsubscribe(this.name);
  41004. }
  41005. else {
  41006. this.members.onSubscription(event.data);
  41007. this.emit("pusher:subscription_succeeded", this.members);
  41008. }
  41009. };
  41010. PresenceChannel.prototype.disconnect = function () {
  41011. this.members.reset();
  41012. _super.prototype.disconnect.call(this);
  41013. };
  41014. return PresenceChannel;
  41015. }(private_channel));
  41016. /* harmony default export */ var presence_channel = (presence_channel_PresenceChannel);
  41017. // EXTERNAL MODULE: ./node_modules/tweetnacl/nacl-fast.js
  41018. var nacl_fast = __webpack_require__(0);
  41019. // EXTERNAL MODULE: ./node_modules/tweetnacl-util/nacl-util.js
  41020. var nacl_util = __webpack_require__(1);
  41021. // CONCATENATED MODULE: ./src/core/channels/encrypted_channel.ts
  41022. var encrypted_channel_extends = (undefined && undefined.__extends) || (function () {
  41023. var extendStatics = function (d, b) {
  41024. extendStatics = Object.setPrototypeOf ||
  41025. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  41026. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  41027. return extendStatics(d, b);
  41028. };
  41029. return function (d, b) {
  41030. extendStatics(d, b);
  41031. function __() { this.constructor = d; }
  41032. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  41033. };
  41034. })();
  41035. var encrypted_channel_EncryptedChannel = (function (_super) {
  41036. encrypted_channel_extends(EncryptedChannel, _super);
  41037. function EncryptedChannel() {
  41038. var _this = _super !== null && _super.apply(this, arguments) || this;
  41039. _this.key = null;
  41040. return _this;
  41041. }
  41042. EncryptedChannel.prototype.authorize = function (socketId, callback) {
  41043. var _this = this;
  41044. _super.prototype.authorize.call(this, socketId, function (error, authData) {
  41045. if (error) {
  41046. callback(true, authData);
  41047. return;
  41048. }
  41049. var sharedSecret = authData["shared_secret"];
  41050. if (!sharedSecret) {
  41051. var errorMsg = "No shared_secret key in auth payload for encrypted channel: " + _this.name;
  41052. callback(true, errorMsg);
  41053. return;
  41054. }
  41055. _this.key = Object(nacl_util["decodeBase64"])(sharedSecret);
  41056. delete authData["shared_secret"];
  41057. callback(false, authData);
  41058. });
  41059. };
  41060. EncryptedChannel.prototype.trigger = function (event, data) {
  41061. throw new UnsupportedFeature('Client events are not currently supported for encrypted channels');
  41062. };
  41063. EncryptedChannel.prototype.handleEvent = function (event) {
  41064. var eventName = event.event;
  41065. var data = event.data;
  41066. if (eventName.indexOf("pusher_internal:") === 0 || eventName.indexOf("pusher:") === 0) {
  41067. _super.prototype.handleEvent.call(this, event);
  41068. return;
  41069. }
  41070. this.handleEncryptedEvent(eventName, data);
  41071. };
  41072. EncryptedChannel.prototype.handleEncryptedEvent = function (event, data) {
  41073. var _this = this;
  41074. if (!this.key) {
  41075. logger.debug('Received encrypted event before key has been retrieved from the authEndpoint');
  41076. return;
  41077. }
  41078. if (!data.ciphertext || !data.nonce) {
  41079. logger.error('Unexpected format for encrypted event, expected object with `ciphertext` and `nonce` fields, got: ' + data);
  41080. return;
  41081. }
  41082. var cipherText = Object(nacl_util["decodeBase64"])(data.ciphertext);
  41083. if (cipherText.length < nacl_fast["secretbox"].overheadLength) {
  41084. logger.error("Expected encrypted event ciphertext length to be " + nacl_fast["secretbox"].overheadLength + ", got: " + cipherText.length);
  41085. return;
  41086. }
  41087. var nonce = Object(nacl_util["decodeBase64"])(data.nonce);
  41088. if (nonce.length < nacl_fast["secretbox"].nonceLength) {
  41089. logger.error("Expected encrypted event nonce length to be " + nacl_fast["secretbox"].nonceLength + ", got: " + nonce.length);
  41090. return;
  41091. }
  41092. var bytes = nacl_fast["secretbox"].open(cipherText, nonce, this.key);
  41093. if (bytes === null) {
  41094. logger.debug('Failed to decrypt an event, probably because it was encrypted with a different key. Fetching a new key from the authEndpoint...');
  41095. this.authorize(this.pusher.connection.socket_id, function (error, authData) {
  41096. if (error) {
  41097. logger.error("Failed to make a request to the authEndpoint: " + authData + ". Unable to fetch new key, so dropping encrypted event");
  41098. return;
  41099. }
  41100. bytes = nacl_fast["secretbox"].open(cipherText, nonce, _this.key);
  41101. if (bytes === null) {
  41102. logger.error("Failed to decrypt event with new key. Dropping encrypted event");
  41103. return;
  41104. }
  41105. _this.emitJSON(event, Object(nacl_util["encodeUTF8"])(bytes));
  41106. return;
  41107. });
  41108. return;
  41109. }
  41110. this.emitJSON(event, Object(nacl_util["encodeUTF8"])(bytes));
  41111. };
  41112. EncryptedChannel.prototype.emitJSON = function (eventName, data) {
  41113. try {
  41114. this.emit(eventName, JSON.parse(data));
  41115. }
  41116. catch (e) {
  41117. this.emit(eventName, data);
  41118. }
  41119. return this;
  41120. };
  41121. return EncryptedChannel;
  41122. }(private_channel));
  41123. /* harmony default export */ var encrypted_channel = (encrypted_channel_EncryptedChannel);
  41124. // CONCATENATED MODULE: ./src/core/connection/connection_manager.ts
  41125. var connection_manager_extends = (undefined && undefined.__extends) || (function () {
  41126. var extendStatics = function (d, b) {
  41127. extendStatics = Object.setPrototypeOf ||
  41128. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  41129. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  41130. return extendStatics(d, b);
  41131. };
  41132. return function (d, b) {
  41133. extendStatics(d, b);
  41134. function __() { this.constructor = d; }
  41135. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  41136. };
  41137. })();
  41138. var connection_manager_ConnectionManager = (function (_super) {
  41139. connection_manager_extends(ConnectionManager, _super);
  41140. function ConnectionManager(key, options) {
  41141. var _this = _super.call(this) || this;
  41142. _this.key = key;
  41143. _this.options = options || {};
  41144. _this.state = "initialized";
  41145. _this.connection = null;
  41146. _this.usingTLS = !!options.useTLS;
  41147. _this.timeline = _this.options.timeline;
  41148. _this.errorCallbacks = _this.buildErrorCallbacks();
  41149. _this.connectionCallbacks = _this.buildConnectionCallbacks(_this.errorCallbacks);
  41150. _this.handshakeCallbacks = _this.buildHandshakeCallbacks(_this.errorCallbacks);
  41151. var Network = runtime.getNetwork();
  41152. Network.bind("online", function () {
  41153. _this.timeline.info({ netinfo: "online" });
  41154. if (_this.state === "connecting" || _this.state === "unavailable") {
  41155. _this.retryIn(0);
  41156. }
  41157. });
  41158. Network.bind("offline", function () {
  41159. _this.timeline.info({ netinfo: "offline" });
  41160. if (_this.connection) {
  41161. _this.sendActivityCheck();
  41162. }
  41163. });
  41164. _this.updateStrategy();
  41165. return _this;
  41166. }
  41167. ConnectionManager.prototype.connect = function () {
  41168. if (this.connection || this.runner) {
  41169. return;
  41170. }
  41171. if (!this.strategy.isSupported()) {
  41172. this.updateState("failed");
  41173. return;
  41174. }
  41175. this.updateState("connecting");
  41176. this.startConnecting();
  41177. this.setUnavailableTimer();
  41178. };
  41179. ;
  41180. ConnectionManager.prototype.send = function (data) {
  41181. if (this.connection) {
  41182. return this.connection.send(data);
  41183. }
  41184. else {
  41185. return false;
  41186. }
  41187. };
  41188. ;
  41189. ConnectionManager.prototype.send_event = function (name, data, channel) {
  41190. if (this.connection) {
  41191. return this.connection.send_event(name, data, channel);
  41192. }
  41193. else {
  41194. return false;
  41195. }
  41196. };
  41197. ;
  41198. ConnectionManager.prototype.disconnect = function () {
  41199. this.disconnectInternally();
  41200. this.updateState("disconnected");
  41201. };
  41202. ;
  41203. ConnectionManager.prototype.isUsingTLS = function () {
  41204. return this.usingTLS;
  41205. };
  41206. ;
  41207. ConnectionManager.prototype.startConnecting = function () {
  41208. var _this = this;
  41209. var callback = function (error, handshake) {
  41210. if (error) {
  41211. _this.runner = _this.strategy.connect(0, callback);
  41212. }
  41213. else {
  41214. if (handshake.action === "error") {
  41215. _this.emit("error", { type: "HandshakeError", error: handshake.error });
  41216. _this.timeline.error({ handshakeError: handshake.error });
  41217. }
  41218. else {
  41219. _this.abortConnecting();
  41220. _this.handshakeCallbacks[handshake.action](handshake);
  41221. }
  41222. }
  41223. };
  41224. this.runner = this.strategy.connect(0, callback);
  41225. };
  41226. ;
  41227. ConnectionManager.prototype.abortConnecting = function () {
  41228. if (this.runner) {
  41229. this.runner.abort();
  41230. this.runner = null;
  41231. }
  41232. };
  41233. ;
  41234. ConnectionManager.prototype.disconnectInternally = function () {
  41235. this.abortConnecting();
  41236. this.clearRetryTimer();
  41237. this.clearUnavailableTimer();
  41238. if (this.connection) {
  41239. var connection = this.abandonConnection();
  41240. connection.close();
  41241. }
  41242. };
  41243. ;
  41244. ConnectionManager.prototype.updateStrategy = function () {
  41245. this.strategy = this.options.getStrategy({
  41246. key: this.key,
  41247. timeline: this.timeline,
  41248. useTLS: this.usingTLS
  41249. });
  41250. };
  41251. ;
  41252. ConnectionManager.prototype.retryIn = function (delay) {
  41253. var _this = this;
  41254. this.timeline.info({ action: "retry", delay: delay });
  41255. if (delay > 0) {
  41256. this.emit("connecting_in", Math.round(delay / 1000));
  41257. }
  41258. this.retryTimer = new OneOffTimer(delay || 0, function () {
  41259. _this.disconnectInternally();
  41260. _this.connect();
  41261. });
  41262. };
  41263. ;
  41264. ConnectionManager.prototype.clearRetryTimer = function () {
  41265. if (this.retryTimer) {
  41266. this.retryTimer.ensureAborted();
  41267. this.retryTimer = null;
  41268. }
  41269. };
  41270. ;
  41271. ConnectionManager.prototype.setUnavailableTimer = function () {
  41272. var _this = this;
  41273. this.unavailableTimer = new OneOffTimer(this.options.unavailableTimeout, function () {
  41274. _this.updateState("unavailable");
  41275. });
  41276. };
  41277. ;
  41278. ConnectionManager.prototype.clearUnavailableTimer = function () {
  41279. if (this.unavailableTimer) {
  41280. this.unavailableTimer.ensureAborted();
  41281. }
  41282. };
  41283. ;
  41284. ConnectionManager.prototype.sendActivityCheck = function () {
  41285. var _this = this;
  41286. this.stopActivityCheck();
  41287. this.connection.ping();
  41288. this.activityTimer = new OneOffTimer(this.options.pongTimeout, function () {
  41289. _this.timeline.error({ pong_timed_out: _this.options.pongTimeout });
  41290. _this.retryIn(0);
  41291. });
  41292. };
  41293. ;
  41294. ConnectionManager.prototype.resetActivityCheck = function () {
  41295. var _this = this;
  41296. this.stopActivityCheck();
  41297. if (this.connection && !this.connection.handlesActivityChecks()) {
  41298. this.activityTimer = new OneOffTimer(this.activityTimeout, function () {
  41299. _this.sendActivityCheck();
  41300. });
  41301. }
  41302. };
  41303. ;
  41304. ConnectionManager.prototype.stopActivityCheck = function () {
  41305. if (this.activityTimer) {
  41306. this.activityTimer.ensureAborted();
  41307. }
  41308. };
  41309. ;
  41310. ConnectionManager.prototype.buildConnectionCallbacks = function (errorCallbacks) {
  41311. var _this = this;
  41312. return extend({}, errorCallbacks, {
  41313. message: function (message) {
  41314. _this.resetActivityCheck();
  41315. _this.emit('message', message);
  41316. },
  41317. ping: function () {
  41318. _this.send_event('pusher:pong', {});
  41319. },
  41320. activity: function () {
  41321. _this.resetActivityCheck();
  41322. },
  41323. error: function (error) {
  41324. _this.emit("error", { type: "WebSocketError", error: error });
  41325. },
  41326. closed: function () {
  41327. _this.abandonConnection();
  41328. if (_this.shouldRetry()) {
  41329. _this.retryIn(1000);
  41330. }
  41331. }
  41332. });
  41333. };
  41334. ;
  41335. ConnectionManager.prototype.buildHandshakeCallbacks = function (errorCallbacks) {
  41336. var _this = this;
  41337. return extend({}, errorCallbacks, {
  41338. connected: function (handshake) {
  41339. _this.activityTimeout = Math.min(_this.options.activityTimeout, handshake.activityTimeout, handshake.connection.activityTimeout || Infinity);
  41340. _this.clearUnavailableTimer();
  41341. _this.setConnection(handshake.connection);
  41342. _this.socket_id = _this.connection.id;
  41343. _this.updateState("connected", { socket_id: _this.socket_id });
  41344. }
  41345. });
  41346. };
  41347. ;
  41348. ConnectionManager.prototype.buildErrorCallbacks = function () {
  41349. var _this = this;
  41350. var withErrorEmitted = function (callback) {
  41351. return function (result) {
  41352. if (result.error) {
  41353. _this.emit("error", { type: "WebSocketError", error: result.error });
  41354. }
  41355. callback(result);
  41356. };
  41357. };
  41358. return {
  41359. tls_only: withErrorEmitted(function () {
  41360. _this.usingTLS = true;
  41361. _this.updateStrategy();
  41362. _this.retryIn(0);
  41363. }),
  41364. refused: withErrorEmitted(function () {
  41365. _this.disconnect();
  41366. }),
  41367. backoff: withErrorEmitted(function () {
  41368. _this.retryIn(1000);
  41369. }),
  41370. retry: withErrorEmitted(function () {
  41371. _this.retryIn(0);
  41372. })
  41373. };
  41374. };
  41375. ;
  41376. ConnectionManager.prototype.setConnection = function (connection) {
  41377. this.connection = connection;
  41378. for (var event in this.connectionCallbacks) {
  41379. this.connection.bind(event, this.connectionCallbacks[event]);
  41380. }
  41381. this.resetActivityCheck();
  41382. };
  41383. ;
  41384. ConnectionManager.prototype.abandonConnection = function () {
  41385. if (!this.connection) {
  41386. return;
  41387. }
  41388. this.stopActivityCheck();
  41389. for (var event in this.connectionCallbacks) {
  41390. this.connection.unbind(event, this.connectionCallbacks[event]);
  41391. }
  41392. var connection = this.connection;
  41393. this.connection = null;
  41394. return connection;
  41395. };
  41396. ConnectionManager.prototype.updateState = function (newState, data) {
  41397. var previousState = this.state;
  41398. this.state = newState;
  41399. if (previousState !== newState) {
  41400. var newStateDescription = newState;
  41401. if (newStateDescription === "connected") {
  41402. newStateDescription += " with new socket ID " + data.socket_id;
  41403. }
  41404. logger.debug('State changed', previousState + ' -> ' + newStateDescription);
  41405. this.timeline.info({ state: newState, params: data });
  41406. this.emit('state_change', { previous: previousState, current: newState });
  41407. this.emit(newState, data);
  41408. }
  41409. };
  41410. ConnectionManager.prototype.shouldRetry = function () {
  41411. return this.state === "connecting" || this.state === "connected";
  41412. };
  41413. return ConnectionManager;
  41414. }(dispatcher));
  41415. /* harmony default export */ var connection_manager = (connection_manager_ConnectionManager);
  41416. // CONCATENATED MODULE: ./src/core/channels/channels.ts
  41417. var channels_Channels = (function () {
  41418. function Channels() {
  41419. this.channels = {};
  41420. }
  41421. Channels.prototype.add = function (name, pusher) {
  41422. if (!this.channels[name]) {
  41423. this.channels[name] = createChannel(name, pusher);
  41424. }
  41425. return this.channels[name];
  41426. };
  41427. Channels.prototype.all = function () {
  41428. return values(this.channels);
  41429. };
  41430. Channels.prototype.find = function (name) {
  41431. return this.channels[name];
  41432. };
  41433. Channels.prototype.remove = function (name) {
  41434. var channel = this.channels[name];
  41435. delete this.channels[name];
  41436. return channel;
  41437. };
  41438. Channels.prototype.disconnect = function () {
  41439. objectApply(this.channels, function (channel) {
  41440. channel.disconnect();
  41441. });
  41442. };
  41443. return Channels;
  41444. }());
  41445. /* harmony default export */ var channels = (channels_Channels);
  41446. function createChannel(name, pusher) {
  41447. if (name.indexOf('private-encrypted-') === 0) {
  41448. if (false) { var errorMsg; }
  41449. return factory.createEncryptedChannel(name, pusher);
  41450. }
  41451. else if (name.indexOf('private-') === 0) {
  41452. return factory.createPrivateChannel(name, pusher);
  41453. }
  41454. else if (name.indexOf('presence-') === 0) {
  41455. return factory.createPresenceChannel(name, pusher);
  41456. }
  41457. else {
  41458. return factory.createChannel(name, pusher);
  41459. }
  41460. }
  41461. // CONCATENATED MODULE: ./src/core/utils/factory.ts
  41462. var Factory = {
  41463. createChannels: function () {
  41464. return new channels();
  41465. },
  41466. createConnectionManager: function (key, options) {
  41467. return new connection_manager(key, options);
  41468. },
  41469. createChannel: function (name, pusher) {
  41470. return new channels_channel(name, pusher);
  41471. },
  41472. createPrivateChannel: function (name, pusher) {
  41473. return new private_channel(name, pusher);
  41474. },
  41475. createPresenceChannel: function (name, pusher) {
  41476. return new presence_channel(name, pusher);
  41477. },
  41478. createEncryptedChannel: function (name, pusher) {
  41479. return new encrypted_channel(name, pusher);
  41480. },
  41481. createTimelineSender: function (timeline, options) {
  41482. return new timeline_sender(timeline, options);
  41483. },
  41484. createAuthorizer: function (channel, options) {
  41485. if (options.authorizer) {
  41486. return options.authorizer(channel, options);
  41487. }
  41488. return new pusher_authorizer(channel, options);
  41489. },
  41490. createHandshake: function (transport, callback) {
  41491. return new connection_handshake(transport, callback);
  41492. },
  41493. createAssistantToTheTransportManager: function (manager, transport, options) {
  41494. return new assistant_to_the_transport_manager(manager, transport, options);
  41495. }
  41496. };
  41497. /* harmony default export */ var factory = (Factory);
  41498. // CONCATENATED MODULE: ./src/core/transports/transport_manager.ts
  41499. var transport_manager_TransportManager = (function () {
  41500. function TransportManager(options) {
  41501. this.options = options || {};
  41502. this.livesLeft = this.options.lives || Infinity;
  41503. }
  41504. TransportManager.prototype.getAssistant = function (transport) {
  41505. return factory.createAssistantToTheTransportManager(this, transport, {
  41506. minPingDelay: this.options.minPingDelay,
  41507. maxPingDelay: this.options.maxPingDelay
  41508. });
  41509. };
  41510. TransportManager.prototype.isAlive = function () {
  41511. return this.livesLeft > 0;
  41512. };
  41513. TransportManager.prototype.reportDeath = function () {
  41514. this.livesLeft -= 1;
  41515. };
  41516. return TransportManager;
  41517. }());
  41518. /* harmony default export */ var transport_manager = (transport_manager_TransportManager);
  41519. // CONCATENATED MODULE: ./src/core/strategies/sequential_strategy.ts
  41520. var sequential_strategy_SequentialStrategy = (function () {
  41521. function SequentialStrategy(strategies, options) {
  41522. this.strategies = strategies;
  41523. this.loop = Boolean(options.loop);
  41524. this.failFast = Boolean(options.failFast);
  41525. this.timeout = options.timeout;
  41526. this.timeoutLimit = options.timeoutLimit;
  41527. }
  41528. SequentialStrategy.prototype.isSupported = function () {
  41529. return any(this.strategies, util.method("isSupported"));
  41530. };
  41531. SequentialStrategy.prototype.connect = function (minPriority, callback) {
  41532. var _this = this;
  41533. var strategies = this.strategies;
  41534. var current = 0;
  41535. var timeout = this.timeout;
  41536. var runner = null;
  41537. var tryNextStrategy = function (error, handshake) {
  41538. if (handshake) {
  41539. callback(null, handshake);
  41540. }
  41541. else {
  41542. current = current + 1;
  41543. if (_this.loop) {
  41544. current = current % strategies.length;
  41545. }
  41546. if (current < strategies.length) {
  41547. if (timeout) {
  41548. timeout = timeout * 2;
  41549. if (_this.timeoutLimit) {
  41550. timeout = Math.min(timeout, _this.timeoutLimit);
  41551. }
  41552. }
  41553. runner = _this.tryStrategy(strategies[current], minPriority, { timeout: timeout, failFast: _this.failFast }, tryNextStrategy);
  41554. }
  41555. else {
  41556. callback(true);
  41557. }
  41558. }
  41559. };
  41560. runner = this.tryStrategy(strategies[current], minPriority, { timeout: timeout, failFast: this.failFast }, tryNextStrategy);
  41561. return {
  41562. abort: function () {
  41563. runner.abort();
  41564. },
  41565. forceMinPriority: function (p) {
  41566. minPriority = p;
  41567. if (runner) {
  41568. runner.forceMinPriority(p);
  41569. }
  41570. }
  41571. };
  41572. };
  41573. SequentialStrategy.prototype.tryStrategy = function (strategy, minPriority, options, callback) {
  41574. var timer = null;
  41575. var runner = null;
  41576. if (options.timeout > 0) {
  41577. timer = new OneOffTimer(options.timeout, function () {
  41578. runner.abort();
  41579. callback(true);
  41580. });
  41581. }
  41582. runner = strategy.connect(minPriority, function (error, handshake) {
  41583. if (error && timer && timer.isRunning() && !options.failFast) {
  41584. return;
  41585. }
  41586. if (timer) {
  41587. timer.ensureAborted();
  41588. }
  41589. callback(error, handshake);
  41590. });
  41591. return {
  41592. abort: function () {
  41593. if (timer) {
  41594. timer.ensureAborted();
  41595. }
  41596. runner.abort();
  41597. },
  41598. forceMinPriority: function (p) {
  41599. runner.forceMinPriority(p);
  41600. }
  41601. };
  41602. };
  41603. return SequentialStrategy;
  41604. }());
  41605. /* harmony default export */ var sequential_strategy = (sequential_strategy_SequentialStrategy);
  41606. // CONCATENATED MODULE: ./src/core/strategies/best_connected_ever_strategy.ts
  41607. var best_connected_ever_strategy_BestConnectedEverStrategy = (function () {
  41608. function BestConnectedEverStrategy(strategies) {
  41609. this.strategies = strategies;
  41610. }
  41611. BestConnectedEverStrategy.prototype.isSupported = function () {
  41612. return any(this.strategies, util.method("isSupported"));
  41613. };
  41614. BestConnectedEverStrategy.prototype.connect = function (minPriority, callback) {
  41615. return connect(this.strategies, minPriority, function (i, runners) {
  41616. return function (error, handshake) {
  41617. runners[i].error = error;
  41618. if (error) {
  41619. if (allRunnersFailed(runners)) {
  41620. callback(true);
  41621. }
  41622. return;
  41623. }
  41624. apply(runners, function (runner) {
  41625. runner.forceMinPriority(handshake.transport.priority);
  41626. });
  41627. callback(null, handshake);
  41628. };
  41629. });
  41630. };
  41631. return BestConnectedEverStrategy;
  41632. }());
  41633. /* harmony default export */ var best_connected_ever_strategy = (best_connected_ever_strategy_BestConnectedEverStrategy);
  41634. function connect(strategies, minPriority, callbackBuilder) {
  41635. var runners = map(strategies, function (strategy, i, _, rs) {
  41636. return strategy.connect(minPriority, callbackBuilder(i, rs));
  41637. });
  41638. return {
  41639. abort: function () {
  41640. apply(runners, abortRunner);
  41641. },
  41642. forceMinPriority: function (p) {
  41643. apply(runners, function (runner) {
  41644. runner.forceMinPriority(p);
  41645. });
  41646. }
  41647. };
  41648. }
  41649. function allRunnersFailed(runners) {
  41650. return collections_all(runners, function (runner) {
  41651. return Boolean(runner.error);
  41652. });
  41653. }
  41654. function abortRunner(runner) {
  41655. if (!runner.error && !runner.aborted) {
  41656. runner.abort();
  41657. runner.aborted = true;
  41658. }
  41659. }
  41660. // CONCATENATED MODULE: ./src/core/strategies/cached_strategy.ts
  41661. var cached_strategy_CachedStrategy = (function () {
  41662. function CachedStrategy(strategy, transports, options) {
  41663. this.strategy = strategy;
  41664. this.transports = transports;
  41665. this.ttl = options.ttl || 1800 * 1000;
  41666. this.usingTLS = options.useTLS;
  41667. this.timeline = options.timeline;
  41668. }
  41669. CachedStrategy.prototype.isSupported = function () {
  41670. return this.strategy.isSupported();
  41671. };
  41672. CachedStrategy.prototype.connect = function (minPriority, callback) {
  41673. var usingTLS = this.usingTLS;
  41674. var info = fetchTransportCache(usingTLS);
  41675. var strategies = [this.strategy];
  41676. if (info && info.timestamp + this.ttl >= util.now()) {
  41677. var transport = this.transports[info.transport];
  41678. if (transport) {
  41679. this.timeline.info({
  41680. cached: true,
  41681. transport: info.transport,
  41682. latency: info.latency
  41683. });
  41684. strategies.push(new sequential_strategy([transport], {
  41685. timeout: info.latency * 2 + 1000,
  41686. failFast: true
  41687. }));
  41688. }
  41689. }
  41690. var startTimestamp = util.now();
  41691. var runner = strategies.pop().connect(minPriority, function cb(error, handshake) {
  41692. if (error) {
  41693. flushTransportCache(usingTLS);
  41694. if (strategies.length > 0) {
  41695. startTimestamp = util.now();
  41696. runner = strategies.pop().connect(minPriority, cb);
  41697. }
  41698. else {
  41699. callback(error);
  41700. }
  41701. }
  41702. else {
  41703. storeTransportCache(usingTLS, handshake.transport.name, util.now() - startTimestamp);
  41704. callback(null, handshake);
  41705. }
  41706. });
  41707. return {
  41708. abort: function () {
  41709. runner.abort();
  41710. },
  41711. forceMinPriority: function (p) {
  41712. minPriority = p;
  41713. if (runner) {
  41714. runner.forceMinPriority(p);
  41715. }
  41716. }
  41717. };
  41718. };
  41719. return CachedStrategy;
  41720. }());
  41721. /* harmony default export */ var cached_strategy = (cached_strategy_CachedStrategy);
  41722. function getTransportCacheKey(usingTLS) {
  41723. return "pusherTransport" + (usingTLS ? "TLS" : "NonTLS");
  41724. }
  41725. function fetchTransportCache(usingTLS) {
  41726. var storage = runtime.getLocalStorage();
  41727. if (storage) {
  41728. try {
  41729. var serializedCache = storage[getTransportCacheKey(usingTLS)];
  41730. if (serializedCache) {
  41731. return JSON.parse(serializedCache);
  41732. }
  41733. }
  41734. catch (e) {
  41735. flushTransportCache(usingTLS);
  41736. }
  41737. }
  41738. return null;
  41739. }
  41740. function storeTransportCache(usingTLS, transport, latency) {
  41741. var storage = runtime.getLocalStorage();
  41742. if (storage) {
  41743. try {
  41744. storage[getTransportCacheKey(usingTLS)] = safeJSONStringify({
  41745. timestamp: util.now(),
  41746. transport: transport,
  41747. latency: latency
  41748. });
  41749. }
  41750. catch (e) {
  41751. }
  41752. }
  41753. }
  41754. function flushTransportCache(usingTLS) {
  41755. var storage = runtime.getLocalStorage();
  41756. if (storage) {
  41757. try {
  41758. delete storage[getTransportCacheKey(usingTLS)];
  41759. }
  41760. catch (e) {
  41761. }
  41762. }
  41763. }
  41764. // CONCATENATED MODULE: ./src/core/strategies/delayed_strategy.ts
  41765. var delayed_strategy_DelayedStrategy = (function () {
  41766. function DelayedStrategy(strategy, _a) {
  41767. var number = _a.delay;
  41768. this.strategy = strategy;
  41769. this.options = { delay: number };
  41770. }
  41771. DelayedStrategy.prototype.isSupported = function () {
  41772. return this.strategy.isSupported();
  41773. };
  41774. DelayedStrategy.prototype.connect = function (minPriority, callback) {
  41775. var strategy = this.strategy;
  41776. var runner;
  41777. var timer = new OneOffTimer(this.options.delay, function () {
  41778. runner = strategy.connect(minPriority, callback);
  41779. });
  41780. return {
  41781. abort: function () {
  41782. timer.ensureAborted();
  41783. if (runner) {
  41784. runner.abort();
  41785. }
  41786. },
  41787. forceMinPriority: function (p) {
  41788. minPriority = p;
  41789. if (runner) {
  41790. runner.forceMinPriority(p);
  41791. }
  41792. }
  41793. };
  41794. };
  41795. return DelayedStrategy;
  41796. }());
  41797. /* harmony default export */ var delayed_strategy = (delayed_strategy_DelayedStrategy);
  41798. // CONCATENATED MODULE: ./src/core/strategies/if_strategy.ts
  41799. var IfStrategy = (function () {
  41800. function IfStrategy(test, trueBranch, falseBranch) {
  41801. this.test = test;
  41802. this.trueBranch = trueBranch;
  41803. this.falseBranch = falseBranch;
  41804. }
  41805. IfStrategy.prototype.isSupported = function () {
  41806. var branch = this.test() ? this.trueBranch : this.falseBranch;
  41807. return branch.isSupported();
  41808. };
  41809. IfStrategy.prototype.connect = function (minPriority, callback) {
  41810. var branch = this.test() ? this.trueBranch : this.falseBranch;
  41811. return branch.connect(minPriority, callback);
  41812. };
  41813. return IfStrategy;
  41814. }());
  41815. /* harmony default export */ var if_strategy = (IfStrategy);
  41816. // CONCATENATED MODULE: ./src/core/strategies/first_connected_strategy.ts
  41817. var FirstConnectedStrategy = (function () {
  41818. function FirstConnectedStrategy(strategy) {
  41819. this.strategy = strategy;
  41820. }
  41821. FirstConnectedStrategy.prototype.isSupported = function () {
  41822. return this.strategy.isSupported();
  41823. };
  41824. FirstConnectedStrategy.prototype.connect = function (minPriority, callback) {
  41825. var runner = this.strategy.connect(minPriority, function (error, handshake) {
  41826. if (handshake) {
  41827. runner.abort();
  41828. }
  41829. callback(error, handshake);
  41830. });
  41831. return runner;
  41832. };
  41833. return FirstConnectedStrategy;
  41834. }());
  41835. /* harmony default export */ var first_connected_strategy = (FirstConnectedStrategy);
  41836. // CONCATENATED MODULE: ./src/runtimes/web/default_strategy.ts
  41837. function testSupportsStrategy(strategy) {
  41838. return function () {
  41839. return strategy.isSupported();
  41840. };
  41841. }
  41842. var getDefaultStrategy = function (config, defineTransport) {
  41843. var definedTransports = {};
  41844. function defineTransportStrategy(name, type, priority, options, manager) {
  41845. var transport = defineTransport(config, name, type, priority, options, manager);
  41846. definedTransports[name] = transport;
  41847. return transport;
  41848. }
  41849. var ws_options = {
  41850. hostNonTLS: config.wsHost + ":" + config.wsPort,
  41851. hostTLS: config.wsHost + ":" + config.wssPort,
  41852. httpPath: config.wsPath
  41853. };
  41854. var wss_options = extend({}, ws_options, {
  41855. useTLS: true
  41856. });
  41857. var sockjs_options = {
  41858. hostNonTLS: config.httpHost + ":" + config.httpPort,
  41859. hostTLS: config.httpHost + ":" + config.httpsPort,
  41860. httpPath: config.httpPath
  41861. };
  41862. var timeouts = {
  41863. loop: true,
  41864. timeout: 15000,
  41865. timeoutLimit: 60000
  41866. };
  41867. var ws_manager = new transport_manager({
  41868. lives: 2,
  41869. minPingDelay: 10000,
  41870. maxPingDelay: config.activity_timeout
  41871. });
  41872. var streaming_manager = new transport_manager({
  41873. lives: 2,
  41874. minPingDelay: 10000,
  41875. maxPingDelay: config.activity_timeout
  41876. });
  41877. var ws_transport = defineTransportStrategy("ws", "ws", 3, ws_options, ws_manager);
  41878. var wss_transport = defineTransportStrategy("wss", "ws", 3, wss_options, ws_manager);
  41879. var sockjs_transport = defineTransportStrategy("sockjs", "sockjs", 1, sockjs_options);
  41880. var xhr_streaming_transport = defineTransportStrategy("xhr_streaming", "xhr_streaming", 1, sockjs_options, streaming_manager);
  41881. var xdr_streaming_transport = defineTransportStrategy("xdr_streaming", "xdr_streaming", 1, sockjs_options, streaming_manager);
  41882. var xhr_polling_transport = defineTransportStrategy("xhr_polling", "xhr_polling", 1, sockjs_options);
  41883. var xdr_polling_transport = defineTransportStrategy("xdr_polling", "xdr_polling", 1, sockjs_options);
  41884. var ws_loop = new sequential_strategy([ws_transport], timeouts);
  41885. var wss_loop = new sequential_strategy([wss_transport], timeouts);
  41886. var sockjs_loop = new sequential_strategy([sockjs_transport], timeouts);
  41887. var streaming_loop = new sequential_strategy([new if_strategy(testSupportsStrategy(xhr_streaming_transport), xhr_streaming_transport, xdr_streaming_transport)], timeouts);
  41888. var polling_loop = new sequential_strategy([new if_strategy(testSupportsStrategy(xhr_polling_transport), xhr_polling_transport, xdr_polling_transport)], timeouts);
  41889. 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);
  41890. var http_fallback_loop = new if_strategy(testSupportsStrategy(http_loop), http_loop, sockjs_loop);
  41891. var wsStrategy;
  41892. if (config.useTLS) {
  41893. wsStrategy = new best_connected_ever_strategy([ws_loop, new delayed_strategy(http_fallback_loop, { delay: 2000 })]);
  41894. }
  41895. else {
  41896. wsStrategy = new best_connected_ever_strategy([
  41897. ws_loop,
  41898. new delayed_strategy(wss_loop, { delay: 2000 }),
  41899. new delayed_strategy(http_fallback_loop, { delay: 5000 })
  41900. ]);
  41901. }
  41902. return new cached_strategy(new first_connected_strategy(new if_strategy(testSupportsStrategy(ws_transport), wsStrategy, http_fallback_loop)), definedTransports, {
  41903. ttl: 1800000,
  41904. timeline: config.timeline,
  41905. useTLS: config.useTLS
  41906. });
  41907. };
  41908. /* harmony default export */ var default_strategy = (getDefaultStrategy);
  41909. // CONCATENATED MODULE: ./src/runtimes/web/transports/transport_connection_initializer.ts
  41910. /* harmony default export */ var transport_connection_initializer = (function () {
  41911. var self = this;
  41912. self.timeline.info(self.buildTimelineMessage({
  41913. transport: self.name + (self.options.useTLS ? "s" : "")
  41914. }));
  41915. if (self.hooks.isInitialized()) {
  41916. self.changeState("initialized");
  41917. }
  41918. else if (self.hooks.file) {
  41919. self.changeState("initializing");
  41920. Dependencies.load(self.hooks.file, { useTLS: self.options.useTLS }, function (error, callback) {
  41921. if (self.hooks.isInitialized()) {
  41922. self.changeState("initialized");
  41923. callback(true);
  41924. }
  41925. else {
  41926. if (error) {
  41927. self.onError(error);
  41928. }
  41929. self.onClose();
  41930. callback(false);
  41931. }
  41932. });
  41933. }
  41934. else {
  41935. self.onClose();
  41936. }
  41937. });
  41938. // CONCATENATED MODULE: ./src/runtimes/web/http/http_xdomain_request.ts
  41939. var http_xdomain_request_hooks = {
  41940. getRequest: function (socket) {
  41941. var xdr = new window.XDomainRequest();
  41942. xdr.ontimeout = function () {
  41943. socket.emit("error", new RequestTimedOut());
  41944. socket.close();
  41945. };
  41946. xdr.onerror = function (e) {
  41947. socket.emit("error", e);
  41948. socket.close();
  41949. };
  41950. xdr.onprogress = function () {
  41951. if (xdr.responseText && xdr.responseText.length > 0) {
  41952. socket.onChunk(200, xdr.responseText);
  41953. }
  41954. };
  41955. xdr.onload = function () {
  41956. if (xdr.responseText && xdr.responseText.length > 0) {
  41957. socket.onChunk(200, xdr.responseText);
  41958. }
  41959. socket.emit("finished", 200);
  41960. socket.close();
  41961. };
  41962. return xdr;
  41963. },
  41964. abortRequest: function (xdr) {
  41965. xdr.ontimeout = xdr.onerror = xdr.onprogress = xdr.onload = null;
  41966. xdr.abort();
  41967. }
  41968. };
  41969. /* harmony default export */ var http_xdomain_request = (http_xdomain_request_hooks);
  41970. // CONCATENATED MODULE: ./src/core/http/http_request.ts
  41971. var http_request_extends = (undefined && undefined.__extends) || (function () {
  41972. var extendStatics = function (d, b) {
  41973. extendStatics = Object.setPrototypeOf ||
  41974. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  41975. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  41976. return extendStatics(d, b);
  41977. };
  41978. return function (d, b) {
  41979. extendStatics(d, b);
  41980. function __() { this.constructor = d; }
  41981. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  41982. };
  41983. })();
  41984. var MAX_BUFFER_LENGTH = 256 * 1024;
  41985. var http_request_HTTPRequest = (function (_super) {
  41986. http_request_extends(HTTPRequest, _super);
  41987. function HTTPRequest(hooks, method, url) {
  41988. var _this = _super.call(this) || this;
  41989. _this.hooks = hooks;
  41990. _this.method = method;
  41991. _this.url = url;
  41992. return _this;
  41993. }
  41994. HTTPRequest.prototype.start = function (payload) {
  41995. var _this = this;
  41996. this.position = 0;
  41997. this.xhr = this.hooks.getRequest(this);
  41998. this.unloader = function () {
  41999. _this.close();
  42000. };
  42001. runtime.addUnloadListener(this.unloader);
  42002. this.xhr.open(this.method, this.url, true);
  42003. if (this.xhr.setRequestHeader) {
  42004. this.xhr.setRequestHeader("Content-Type", "application/json");
  42005. }
  42006. this.xhr.send(payload);
  42007. };
  42008. HTTPRequest.prototype.close = function () {
  42009. if (this.unloader) {
  42010. runtime.removeUnloadListener(this.unloader);
  42011. this.unloader = null;
  42012. }
  42013. if (this.xhr) {
  42014. this.hooks.abortRequest(this.xhr);
  42015. this.xhr = null;
  42016. }
  42017. };
  42018. HTTPRequest.prototype.onChunk = function (status, data) {
  42019. while (true) {
  42020. var chunk = this.advanceBuffer(data);
  42021. if (chunk) {
  42022. this.emit("chunk", { status: status, data: chunk });
  42023. }
  42024. else {
  42025. break;
  42026. }
  42027. }
  42028. if (this.isBufferTooLong(data)) {
  42029. this.emit("buffer_too_long");
  42030. }
  42031. };
  42032. HTTPRequest.prototype.advanceBuffer = function (buffer) {
  42033. var unreadData = buffer.slice(this.position);
  42034. var endOfLinePosition = unreadData.indexOf("\n");
  42035. if (endOfLinePosition !== -1) {
  42036. this.position += endOfLinePosition + 1;
  42037. return unreadData.slice(0, endOfLinePosition);
  42038. }
  42039. else {
  42040. return null;
  42041. }
  42042. };
  42043. HTTPRequest.prototype.isBufferTooLong = function (buffer) {
  42044. return this.position === buffer.length && buffer.length > MAX_BUFFER_LENGTH;
  42045. };
  42046. return HTTPRequest;
  42047. }(dispatcher));
  42048. /* harmony default export */ var http_request = (http_request_HTTPRequest);
  42049. // CONCATENATED MODULE: ./src/core/http/state.ts
  42050. var State;
  42051. (function (State) {
  42052. State[State["CONNECTING"] = 0] = "CONNECTING";
  42053. State[State["OPEN"] = 1] = "OPEN";
  42054. State[State["CLOSED"] = 3] = "CLOSED";
  42055. })(State || (State = {}));
  42056. /* harmony default export */ var state = (State);
  42057. // CONCATENATED MODULE: ./src/core/http/http_socket.ts
  42058. var autoIncrement = 1;
  42059. var http_socket_HTTPSocket = (function () {
  42060. function HTTPSocket(hooks, url) {
  42061. this.hooks = hooks;
  42062. this.session = randomNumber(1000) + "/" + randomString(8);
  42063. this.location = getLocation(url);
  42064. this.readyState = state.CONNECTING;
  42065. this.openStream();
  42066. }
  42067. HTTPSocket.prototype.send = function (payload) {
  42068. return this.sendRaw(JSON.stringify([payload]));
  42069. };
  42070. HTTPSocket.prototype.ping = function () {
  42071. this.hooks.sendHeartbeat(this);
  42072. };
  42073. HTTPSocket.prototype.close = function (code, reason) {
  42074. this.onClose(code, reason, true);
  42075. };
  42076. HTTPSocket.prototype.sendRaw = function (payload) {
  42077. if (this.readyState === state.OPEN) {
  42078. try {
  42079. runtime.createSocketRequest("POST", getUniqueURL(getSendURL(this.location, this.session))).start(payload);
  42080. return true;
  42081. }
  42082. catch (e) {
  42083. return false;
  42084. }
  42085. }
  42086. else {
  42087. return false;
  42088. }
  42089. };
  42090. HTTPSocket.prototype.reconnect = function () {
  42091. this.closeStream();
  42092. this.openStream();
  42093. };
  42094. ;
  42095. HTTPSocket.prototype.onClose = function (code, reason, wasClean) {
  42096. this.closeStream();
  42097. this.readyState = state.CLOSED;
  42098. if (this.onclose) {
  42099. this.onclose({
  42100. code: code,
  42101. reason: reason,
  42102. wasClean: wasClean
  42103. });
  42104. }
  42105. };
  42106. HTTPSocket.prototype.onChunk = function (chunk) {
  42107. if (chunk.status !== 200) {
  42108. return;
  42109. }
  42110. if (this.readyState === state.OPEN) {
  42111. this.onActivity();
  42112. }
  42113. var payload;
  42114. var type = chunk.data.slice(0, 1);
  42115. switch (type) {
  42116. case 'o':
  42117. payload = JSON.parse(chunk.data.slice(1) || '{}');
  42118. this.onOpen(payload);
  42119. break;
  42120. case 'a':
  42121. payload = JSON.parse(chunk.data.slice(1) || '[]');
  42122. for (var i = 0; i < payload.length; i++) {
  42123. this.onEvent(payload[i]);
  42124. }
  42125. break;
  42126. case 'm':
  42127. payload = JSON.parse(chunk.data.slice(1) || 'null');
  42128. this.onEvent(payload);
  42129. break;
  42130. case 'h':
  42131. this.hooks.onHeartbeat(this);
  42132. break;
  42133. case 'c':
  42134. payload = JSON.parse(chunk.data.slice(1) || '[]');
  42135. this.onClose(payload[0], payload[1], true);
  42136. break;
  42137. }
  42138. };
  42139. HTTPSocket.prototype.onOpen = function (options) {
  42140. if (this.readyState === state.CONNECTING) {
  42141. if (options && options.hostname) {
  42142. this.location.base = replaceHost(this.location.base, options.hostname);
  42143. }
  42144. this.readyState = state.OPEN;
  42145. if (this.onopen) {
  42146. this.onopen();
  42147. }
  42148. }
  42149. else {
  42150. this.onClose(1006, "Server lost session", true);
  42151. }
  42152. };
  42153. HTTPSocket.prototype.onEvent = function (event) {
  42154. if (this.readyState === state.OPEN && this.onmessage) {
  42155. this.onmessage({ data: event });
  42156. }
  42157. };
  42158. HTTPSocket.prototype.onActivity = function () {
  42159. if (this.onactivity) {
  42160. this.onactivity();
  42161. }
  42162. };
  42163. HTTPSocket.prototype.onError = function (error) {
  42164. if (this.onerror) {
  42165. this.onerror(error);
  42166. }
  42167. };
  42168. HTTPSocket.prototype.openStream = function () {
  42169. var _this = this;
  42170. this.stream = runtime.createSocketRequest("POST", getUniqueURL(this.hooks.getReceiveURL(this.location, this.session)));
  42171. this.stream.bind("chunk", function (chunk) {
  42172. _this.onChunk(chunk);
  42173. });
  42174. this.stream.bind("finished", function (status) {
  42175. _this.hooks.onFinished(_this, status);
  42176. });
  42177. this.stream.bind("buffer_too_long", function () {
  42178. _this.reconnect();
  42179. });
  42180. try {
  42181. this.stream.start();
  42182. }
  42183. catch (error) {
  42184. util.defer(function () {
  42185. _this.onError(error);
  42186. _this.onClose(1006, "Could not start streaming", false);
  42187. });
  42188. }
  42189. };
  42190. HTTPSocket.prototype.closeStream = function () {
  42191. if (this.stream) {
  42192. this.stream.unbind_all();
  42193. this.stream.close();
  42194. this.stream = null;
  42195. }
  42196. };
  42197. return HTTPSocket;
  42198. }());
  42199. function getLocation(url) {
  42200. var parts = /([^\?]*)\/*(\??.*)/.exec(url);
  42201. return {
  42202. base: parts[1],
  42203. queryString: parts[2]
  42204. };
  42205. }
  42206. function getSendURL(url, session) {
  42207. return url.base + "/" + session + "/xhr_send";
  42208. }
  42209. function getUniqueURL(url) {
  42210. var separator = (url.indexOf('?') === -1) ? "?" : "&";
  42211. return url + separator + "t=" + (+new Date()) + "&n=" + autoIncrement++;
  42212. }
  42213. function replaceHost(url, hostname) {
  42214. var urlParts = /(https?:\/\/)([^\/:]+)((\/|:)?.*)/.exec(url);
  42215. return urlParts[1] + hostname + urlParts[3];
  42216. }
  42217. function randomNumber(max) {
  42218. return Math.floor(Math.random() * max);
  42219. }
  42220. function randomString(length) {
  42221. var result = [];
  42222. for (var i = 0; i < length; i++) {
  42223. result.push(randomNumber(32).toString(32));
  42224. }
  42225. return result.join('');
  42226. }
  42227. /* harmony default export */ var http_socket = (http_socket_HTTPSocket);
  42228. // CONCATENATED MODULE: ./src/core/http/http_streaming_socket.ts
  42229. var http_streaming_socket_hooks = {
  42230. getReceiveURL: function (url, session) {
  42231. return url.base + "/" + session + "/xhr_streaming" + url.queryString;
  42232. },
  42233. onHeartbeat: function (socket) {
  42234. socket.sendRaw("[]");
  42235. },
  42236. sendHeartbeat: function (socket) {
  42237. socket.sendRaw("[]");
  42238. },
  42239. onFinished: function (socket, status) {
  42240. socket.onClose(1006, "Connection interrupted (" + status + ")", false);
  42241. }
  42242. };
  42243. /* harmony default export */ var http_streaming_socket = (http_streaming_socket_hooks);
  42244. // CONCATENATED MODULE: ./src/core/http/http_polling_socket.ts
  42245. var http_polling_socket_hooks = {
  42246. getReceiveURL: function (url, session) {
  42247. return url.base + "/" + session + "/xhr" + url.queryString;
  42248. },
  42249. onHeartbeat: function () {
  42250. },
  42251. sendHeartbeat: function (socket) {
  42252. socket.sendRaw("[]");
  42253. },
  42254. onFinished: function (socket, status) {
  42255. if (status === 200) {
  42256. socket.reconnect();
  42257. }
  42258. else {
  42259. socket.onClose(1006, "Connection interrupted (" + status + ")", false);
  42260. }
  42261. }
  42262. };
  42263. /* harmony default export */ var http_polling_socket = (http_polling_socket_hooks);
  42264. // CONCATENATED MODULE: ./src/runtimes/isomorphic/http/http_xhr_request.ts
  42265. var http_xhr_request_hooks = {
  42266. getRequest: function (socket) {
  42267. var Constructor = runtime.getXHRAPI();
  42268. var xhr = new Constructor();
  42269. xhr.onreadystatechange = xhr.onprogress = function () {
  42270. switch (xhr.readyState) {
  42271. case 3:
  42272. if (xhr.responseText && xhr.responseText.length > 0) {
  42273. socket.onChunk(xhr.status, xhr.responseText);
  42274. }
  42275. break;
  42276. case 4:
  42277. if (xhr.responseText && xhr.responseText.length > 0) {
  42278. socket.onChunk(xhr.status, xhr.responseText);
  42279. }
  42280. socket.emit("finished", xhr.status);
  42281. socket.close();
  42282. break;
  42283. }
  42284. };
  42285. return xhr;
  42286. },
  42287. abortRequest: function (xhr) {
  42288. xhr.onreadystatechange = null;
  42289. xhr.abort();
  42290. }
  42291. };
  42292. /* harmony default export */ var http_xhr_request = (http_xhr_request_hooks);
  42293. // CONCATENATED MODULE: ./src/runtimes/isomorphic/http/http.ts
  42294. var HTTP = {
  42295. createStreamingSocket: function (url) {
  42296. return this.createSocket(http_streaming_socket, url);
  42297. },
  42298. createPollingSocket: function (url) {
  42299. return this.createSocket(http_polling_socket, url);
  42300. },
  42301. createSocket: function (hooks, url) {
  42302. return new http_socket(hooks, url);
  42303. },
  42304. createXHR: function (method, url) {
  42305. return this.createRequest(http_xhr_request, method, url);
  42306. },
  42307. createRequest: function (hooks, method, url) {
  42308. return new http_request(hooks, method, url);
  42309. }
  42310. };
  42311. /* harmony default export */ var http_http = (HTTP);
  42312. // CONCATENATED MODULE: ./src/runtimes/web/http/http.ts
  42313. http_http.createXDR = function (method, url) {
  42314. return this.createRequest(http_xdomain_request, method, url);
  42315. };
  42316. /* harmony default export */ var web_http_http = (http_http);
  42317. // CONCATENATED MODULE: ./src/runtimes/web/runtime.ts
  42318. var Runtime = {
  42319. nextAuthCallbackID: 1,
  42320. auth_callbacks: {},
  42321. ScriptReceivers: ScriptReceivers,
  42322. DependenciesReceivers: DependenciesReceivers,
  42323. getDefaultStrategy: default_strategy,
  42324. Transports: transports_transports,
  42325. transportConnectionInitializer: transport_connection_initializer,
  42326. HTTPFactory: web_http_http,
  42327. TimelineTransport: jsonp_timeline,
  42328. getXHRAPI: function () {
  42329. return window.XMLHttpRequest;
  42330. },
  42331. getWebSocketAPI: function () {
  42332. return window.WebSocket || window.MozWebSocket;
  42333. },
  42334. setup: function (PusherClass) {
  42335. var _this = this;
  42336. window.Pusher = PusherClass;
  42337. var initializeOnDocumentBody = function () {
  42338. _this.onDocumentBody(PusherClass.ready);
  42339. };
  42340. if (!window.JSON) {
  42341. Dependencies.load("json2", {}, initializeOnDocumentBody);
  42342. }
  42343. else {
  42344. initializeOnDocumentBody();
  42345. }
  42346. },
  42347. getDocument: function () {
  42348. return document;
  42349. },
  42350. getProtocol: function () {
  42351. return this.getDocument().location.protocol;
  42352. },
  42353. getAuthorizers: function () {
  42354. return { ajax: xhr_auth, jsonp: jsonp_auth };
  42355. },
  42356. onDocumentBody: function (callback) {
  42357. var _this = this;
  42358. if (document.body) {
  42359. callback();
  42360. }
  42361. else {
  42362. setTimeout(function () {
  42363. _this.onDocumentBody(callback);
  42364. }, 0);
  42365. }
  42366. },
  42367. createJSONPRequest: function (url, data) {
  42368. return new jsonp_request(url, data);
  42369. },
  42370. createScriptRequest: function (src) {
  42371. return new script_request(src);
  42372. },
  42373. getLocalStorage: function () {
  42374. try {
  42375. return window.localStorage;
  42376. }
  42377. catch (e) {
  42378. return undefined;
  42379. }
  42380. },
  42381. createXHR: function () {
  42382. if (this.getXHRAPI()) {
  42383. return this.createXMLHttpRequest();
  42384. }
  42385. else {
  42386. return this.createMicrosoftXHR();
  42387. }
  42388. },
  42389. createXMLHttpRequest: function () {
  42390. var Constructor = this.getXHRAPI();
  42391. return new Constructor();
  42392. },
  42393. createMicrosoftXHR: function () {
  42394. return new ActiveXObject("Microsoft.XMLHTTP");
  42395. },
  42396. getNetwork: function () {
  42397. return net_info_Network;
  42398. },
  42399. createWebSocket: function (url) {
  42400. var Constructor = this.getWebSocketAPI();
  42401. return new Constructor(url);
  42402. },
  42403. createSocketRequest: function (method, url) {
  42404. if (this.isXHRSupported()) {
  42405. return this.HTTPFactory.createXHR(method, url);
  42406. }
  42407. else if (this.isXDRSupported(url.indexOf("https:") === 0)) {
  42408. return this.HTTPFactory.createXDR(method, url);
  42409. }
  42410. else {
  42411. throw "Cross-origin HTTP requests are not supported";
  42412. }
  42413. },
  42414. isXHRSupported: function () {
  42415. var Constructor = this.getXHRAPI();
  42416. return Boolean(Constructor) && (new Constructor()).withCredentials !== undefined;
  42417. },
  42418. isXDRSupported: function (useTLS) {
  42419. var protocol = useTLS ? "https:" : "http:";
  42420. var documentProtocol = this.getProtocol();
  42421. return Boolean((window['XDomainRequest'])) && documentProtocol === protocol;
  42422. },
  42423. addUnloadListener: function (listener) {
  42424. if (window.addEventListener !== undefined) {
  42425. window.addEventListener("unload", listener, false);
  42426. }
  42427. else if (window.attachEvent !== undefined) {
  42428. window.attachEvent("onunload", listener);
  42429. }
  42430. },
  42431. removeUnloadListener: function (listener) {
  42432. if (window.addEventListener !== undefined) {
  42433. window.removeEventListener("unload", listener, false);
  42434. }
  42435. else if (window.detachEvent !== undefined) {
  42436. window.detachEvent("onunload", listener);
  42437. }
  42438. }
  42439. };
  42440. /* harmony default export */ var runtime = (Runtime);
  42441. // CONCATENATED MODULE: ./src/core/timeline/level.ts
  42442. var TimelineLevel;
  42443. (function (TimelineLevel) {
  42444. TimelineLevel[TimelineLevel["ERROR"] = 3] = "ERROR";
  42445. TimelineLevel[TimelineLevel["INFO"] = 6] = "INFO";
  42446. TimelineLevel[TimelineLevel["DEBUG"] = 7] = "DEBUG";
  42447. })(TimelineLevel || (TimelineLevel = {}));
  42448. /* harmony default export */ var timeline_level = (TimelineLevel);
  42449. // CONCATENATED MODULE: ./src/core/timeline/timeline.ts
  42450. var timeline_Timeline = (function () {
  42451. function Timeline(key, session, options) {
  42452. this.key = key;
  42453. this.session = session;
  42454. this.events = [];
  42455. this.options = options || {};
  42456. this.sent = 0;
  42457. this.uniqueID = 0;
  42458. }
  42459. Timeline.prototype.log = function (level, event) {
  42460. if (level <= this.options.level) {
  42461. this.events.push(extend({}, event, { timestamp: util.now() }));
  42462. if (this.options.limit && this.events.length > this.options.limit) {
  42463. this.events.shift();
  42464. }
  42465. }
  42466. };
  42467. Timeline.prototype.error = function (event) {
  42468. this.log(timeline_level.ERROR, event);
  42469. };
  42470. Timeline.prototype.info = function (event) {
  42471. this.log(timeline_level.INFO, event);
  42472. };
  42473. Timeline.prototype.debug = function (event) {
  42474. this.log(timeline_level.DEBUG, event);
  42475. };
  42476. Timeline.prototype.isEmpty = function () {
  42477. return this.events.length === 0;
  42478. };
  42479. Timeline.prototype.send = function (sendfn, callback) {
  42480. var _this = this;
  42481. var data = extend({
  42482. session: this.session,
  42483. bundle: this.sent + 1,
  42484. key: this.key,
  42485. lib: "js",
  42486. version: this.options.version,
  42487. cluster: this.options.cluster,
  42488. features: this.options.features,
  42489. timeline: this.events
  42490. }, this.options.params);
  42491. this.events = [];
  42492. sendfn(data, function (error, result) {
  42493. if (!error) {
  42494. _this.sent++;
  42495. }
  42496. if (callback) {
  42497. callback(error, result);
  42498. }
  42499. });
  42500. return true;
  42501. };
  42502. Timeline.prototype.generateUniqueID = function () {
  42503. this.uniqueID++;
  42504. return this.uniqueID;
  42505. };
  42506. return Timeline;
  42507. }());
  42508. /* harmony default export */ var timeline_timeline = (timeline_Timeline);
  42509. // CONCATENATED MODULE: ./src/core/strategies/transport_strategy.ts
  42510. var transport_strategy_TransportStrategy = (function () {
  42511. function TransportStrategy(name, priority, transport, options) {
  42512. this.name = name;
  42513. this.priority = priority;
  42514. this.transport = transport;
  42515. this.options = options || {};
  42516. }
  42517. TransportStrategy.prototype.isSupported = function () {
  42518. return this.transport.isSupported({
  42519. useTLS: this.options.useTLS
  42520. });
  42521. };
  42522. TransportStrategy.prototype.connect = function (minPriority, callback) {
  42523. var _this = this;
  42524. if (!this.isSupported()) {
  42525. return failAttempt(new UnsupportedStrategy(), callback);
  42526. }
  42527. else if (this.priority < minPriority) {
  42528. return failAttempt(new TransportPriorityTooLow(), callback);
  42529. }
  42530. var connected = false;
  42531. var transport = this.transport.createConnection(this.name, this.priority, this.options.key, this.options);
  42532. var handshake = null;
  42533. var onInitialized = function () {
  42534. transport.unbind("initialized", onInitialized);
  42535. transport.connect();
  42536. };
  42537. var onOpen = function () {
  42538. handshake = factory.createHandshake(transport, function (result) {
  42539. connected = true;
  42540. unbindListeners();
  42541. callback(null, result);
  42542. });
  42543. };
  42544. var onError = function (error) {
  42545. unbindListeners();
  42546. callback(error);
  42547. };
  42548. var onClosed = function () {
  42549. unbindListeners();
  42550. var serializedTransport;
  42551. serializedTransport = safeJSONStringify(transport);
  42552. callback(new TransportClosed(serializedTransport));
  42553. };
  42554. var unbindListeners = function () {
  42555. transport.unbind("initialized", onInitialized);
  42556. transport.unbind("open", onOpen);
  42557. transport.unbind("error", onError);
  42558. transport.unbind("closed", onClosed);
  42559. };
  42560. transport.bind("initialized", onInitialized);
  42561. transport.bind("open", onOpen);
  42562. transport.bind("error", onError);
  42563. transport.bind("closed", onClosed);
  42564. transport.initialize();
  42565. return {
  42566. abort: function () {
  42567. if (connected) {
  42568. return;
  42569. }
  42570. unbindListeners();
  42571. if (handshake) {
  42572. handshake.close();
  42573. }
  42574. else {
  42575. transport.close();
  42576. }
  42577. },
  42578. forceMinPriority: function (p) {
  42579. if (connected) {
  42580. return;
  42581. }
  42582. if (_this.priority < p) {
  42583. if (handshake) {
  42584. handshake.close();
  42585. }
  42586. else {
  42587. transport.close();
  42588. }
  42589. }
  42590. }
  42591. };
  42592. };
  42593. return TransportStrategy;
  42594. }());
  42595. /* harmony default export */ var transport_strategy = (transport_strategy_TransportStrategy);
  42596. function failAttempt(error, callback) {
  42597. util.defer(function () {
  42598. callback(error);
  42599. });
  42600. return {
  42601. abort: function () { },
  42602. forceMinPriority: function () { }
  42603. };
  42604. }
  42605. // CONCATENATED MODULE: ./src/core/strategies/strategy_builder.ts
  42606. var strategy_builder_Transports = runtime.Transports;
  42607. var strategy_builder_defineTransport = function (config, name, type, priority, options, manager) {
  42608. var transportClass = strategy_builder_Transports[type];
  42609. if (!transportClass) {
  42610. throw new UnsupportedTransport(type);
  42611. }
  42612. var enabled = (!config.enabledTransports ||
  42613. arrayIndexOf(config.enabledTransports, name) !== -1) &&
  42614. (!config.disabledTransports ||
  42615. arrayIndexOf(config.disabledTransports, name) === -1);
  42616. var transport;
  42617. if (enabled) {
  42618. transport = new transport_strategy(name, priority, manager ? manager.getAssistant(transportClass) : transportClass, extend({
  42619. key: config.key,
  42620. useTLS: config.useTLS,
  42621. timeline: config.timeline,
  42622. ignoreNullOrigin: config.ignoreNullOrigin
  42623. }, options));
  42624. }
  42625. else {
  42626. transport = strategy_builder_UnsupportedStrategy;
  42627. }
  42628. return transport;
  42629. };
  42630. var strategy_builder_UnsupportedStrategy = {
  42631. isSupported: function () {
  42632. return false;
  42633. },
  42634. connect: function (_, callback) {
  42635. var deferred = util.defer(function () {
  42636. callback(new UnsupportedStrategy());
  42637. });
  42638. return {
  42639. abort: function () {
  42640. deferred.ensureAborted();
  42641. },
  42642. forceMinPriority: function () { }
  42643. };
  42644. }
  42645. };
  42646. // CONCATENATED MODULE: ./src/core/config.ts
  42647. var getGlobalConfig = function () {
  42648. return {
  42649. wsHost: defaults.host,
  42650. wsPort: defaults.ws_port,
  42651. wssPort: defaults.wss_port,
  42652. wsPath: defaults.ws_path,
  42653. httpHost: defaults.sockjs_host,
  42654. httpPort: defaults.sockjs_http_port,
  42655. httpsPort: defaults.sockjs_https_port,
  42656. httpPath: defaults.sockjs_path,
  42657. statsHost: defaults.stats_host,
  42658. authEndpoint: defaults.channel_auth_endpoint,
  42659. authTransport: defaults.channel_auth_transport,
  42660. activity_timeout: defaults.activity_timeout,
  42661. pong_timeout: defaults.pong_timeout,
  42662. unavailable_timeout: defaults.unavailable_timeout
  42663. };
  42664. };
  42665. var getClusterConfig = function (clusterName) {
  42666. return {
  42667. wsHost: 'ws-' + clusterName + '.pusher.com',
  42668. httpHost: 'sockjs-' + clusterName + '.pusher.com'
  42669. };
  42670. };
  42671. // CONCATENATED MODULE: ./src/core/pusher.ts
  42672. var pusher_Pusher = (function () {
  42673. function Pusher(app_key, options) {
  42674. var _this = this;
  42675. checkAppKey(app_key);
  42676. options = options || {};
  42677. if (!options.cluster && !(options.wsHost || options.httpHost)) {
  42678. var suffix = url_store.buildLogSuffix('javascriptQuickStart');
  42679. logger.warn("You should always specify a cluster when connecting. " + suffix);
  42680. }
  42681. this.key = app_key;
  42682. this.config = extend(getGlobalConfig(), options.cluster ? getClusterConfig(options.cluster) : {}, options);
  42683. this.channels = factory.createChannels();
  42684. this.global_emitter = new dispatcher();
  42685. this.sessionID = Math.floor(Math.random() * 1000000000);
  42686. this.timeline = new timeline_timeline(this.key, this.sessionID, {
  42687. cluster: this.config.cluster,
  42688. features: Pusher.getClientFeatures(),
  42689. params: this.config.timelineParams || {},
  42690. limit: 50,
  42691. level: timeline_level.INFO,
  42692. version: defaults.VERSION
  42693. });
  42694. if (!this.config.disableStats) {
  42695. this.timelineSender = factory.createTimelineSender(this.timeline, {
  42696. host: this.config.statsHost,
  42697. path: '/timeline/v2/' + runtime.TimelineTransport.name
  42698. });
  42699. }
  42700. var getStrategy = function (options) {
  42701. var config = extend({}, _this.config, options);
  42702. return runtime.getDefaultStrategy(config, strategy_builder_defineTransport);
  42703. };
  42704. this.connection = factory.createConnectionManager(this.key, extend({
  42705. getStrategy: getStrategy,
  42706. timeline: this.timeline,
  42707. activityTimeout: this.config.activity_timeout,
  42708. pongTimeout: this.config.pong_timeout,
  42709. unavailableTimeout: this.config.unavailable_timeout
  42710. }, this.config, { useTLS: this.shouldUseTLS() }));
  42711. this.connection.bind('connected', function () {
  42712. _this.subscribeAll();
  42713. if (_this.timelineSender) {
  42714. _this.timelineSender.send(_this.connection.isUsingTLS());
  42715. }
  42716. });
  42717. this.connection.bind('message', function (event) {
  42718. var eventName = event.event;
  42719. var internal = eventName.indexOf('pusher_internal:') === 0;
  42720. if (event.channel) {
  42721. var channel = _this.channel(event.channel);
  42722. if (channel) {
  42723. channel.handleEvent(event);
  42724. }
  42725. }
  42726. if (!internal) {
  42727. _this.global_emitter.emit(event.event, event.data);
  42728. }
  42729. });
  42730. this.connection.bind('connecting', function () {
  42731. _this.channels.disconnect();
  42732. });
  42733. this.connection.bind('disconnected', function () {
  42734. _this.channels.disconnect();
  42735. });
  42736. this.connection.bind('error', function (err) {
  42737. logger.warn(err);
  42738. });
  42739. Pusher.instances.push(this);
  42740. this.timeline.info({ instances: Pusher.instances.length });
  42741. if (Pusher.isReady) {
  42742. this.connect();
  42743. }
  42744. }
  42745. Pusher.ready = function () {
  42746. Pusher.isReady = true;
  42747. for (var i = 0, l = Pusher.instances.length; i < l; i++) {
  42748. Pusher.instances[i].connect();
  42749. }
  42750. };
  42751. Pusher.getClientFeatures = function () {
  42752. return keys(filterObject({ ws: runtime.Transports.ws }, function (t) {
  42753. return t.isSupported({});
  42754. }));
  42755. };
  42756. Pusher.prototype.channel = function (name) {
  42757. return this.channels.find(name);
  42758. };
  42759. Pusher.prototype.allChannels = function () {
  42760. return this.channels.all();
  42761. };
  42762. Pusher.prototype.connect = function () {
  42763. this.connection.connect();
  42764. if (this.timelineSender) {
  42765. if (!this.timelineSenderTimer) {
  42766. var usingTLS = this.connection.isUsingTLS();
  42767. var timelineSender = this.timelineSender;
  42768. this.timelineSenderTimer = new PeriodicTimer(60000, function () {
  42769. timelineSender.send(usingTLS);
  42770. });
  42771. }
  42772. }
  42773. };
  42774. Pusher.prototype.disconnect = function () {
  42775. this.connection.disconnect();
  42776. if (this.timelineSenderTimer) {
  42777. this.timelineSenderTimer.ensureAborted();
  42778. this.timelineSenderTimer = null;
  42779. }
  42780. };
  42781. Pusher.prototype.bind = function (event_name, callback, context) {
  42782. this.global_emitter.bind(event_name, callback, context);
  42783. return this;
  42784. };
  42785. Pusher.prototype.unbind = function (event_name, callback, context) {
  42786. this.global_emitter.unbind(event_name, callback, context);
  42787. return this;
  42788. };
  42789. Pusher.prototype.bind_global = function (callback) {
  42790. this.global_emitter.bind_global(callback);
  42791. return this;
  42792. };
  42793. Pusher.prototype.unbind_global = function (callback) {
  42794. this.global_emitter.unbind_global(callback);
  42795. return this;
  42796. };
  42797. Pusher.prototype.unbind_all = function (callback) {
  42798. this.global_emitter.unbind_all();
  42799. return this;
  42800. };
  42801. Pusher.prototype.subscribeAll = function () {
  42802. var channelName;
  42803. for (channelName in this.channels.channels) {
  42804. if (this.channels.channels.hasOwnProperty(channelName)) {
  42805. this.subscribe(channelName);
  42806. }
  42807. }
  42808. };
  42809. Pusher.prototype.subscribe = function (channel_name) {
  42810. var channel = this.channels.add(channel_name, this);
  42811. if (channel.subscriptionPending && channel.subscriptionCancelled) {
  42812. channel.reinstateSubscription();
  42813. }
  42814. else if (!channel.subscriptionPending &&
  42815. this.connection.state === 'connected') {
  42816. channel.subscribe();
  42817. }
  42818. return channel;
  42819. };
  42820. Pusher.prototype.unsubscribe = function (channel_name) {
  42821. var channel = this.channels.find(channel_name);
  42822. if (channel && channel.subscriptionPending) {
  42823. channel.cancelSubscription();
  42824. }
  42825. else {
  42826. channel = this.channels.remove(channel_name);
  42827. if (channel && this.connection.state === 'connected') {
  42828. channel.unsubscribe();
  42829. }
  42830. }
  42831. };
  42832. Pusher.prototype.send_event = function (event_name, data, channel) {
  42833. return this.connection.send_event(event_name, data, channel);
  42834. };
  42835. Pusher.prototype.shouldUseTLS = function () {
  42836. if (runtime.getProtocol() === 'https:') {
  42837. return true;
  42838. }
  42839. else if (this.config.forceTLS === true) {
  42840. return true;
  42841. }
  42842. else {
  42843. return Boolean(this.config.encrypted);
  42844. }
  42845. };
  42846. Pusher.instances = [];
  42847. Pusher.isReady = false;
  42848. Pusher.logToConsole = false;
  42849. Pusher.Runtime = runtime;
  42850. Pusher.ScriptReceivers = runtime.ScriptReceivers;
  42851. Pusher.DependenciesReceivers = runtime.DependenciesReceivers;
  42852. Pusher.auth_callbacks = runtime.auth_callbacks;
  42853. return Pusher;
  42854. }());
  42855. /* harmony default export */ var core_pusher = __webpack_exports__["default"] = (pusher_Pusher);
  42856. function checkAppKey(key) {
  42857. if (key === null || key === undefined) {
  42858. throw 'You must pass your app key when you instantiate Pusher.';
  42859. }
  42860. }
  42861. runtime.setup(pusher_Pusher);
  42862. /***/ })
  42863. /******/ ]);
  42864. });
  42865. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../buffer/index.js */ "./node_modules/buffer/index.js").Buffer))
  42866. /***/ }),
  42867. /***/ "./node_modules/setimmediate/setImmediate.js":
  42868. /*!***************************************************!*\
  42869. !*** ./node_modules/setimmediate/setImmediate.js ***!
  42870. \***************************************************/
  42871. /*! no static exports found */
  42872. /***/ (function(module, exports, __webpack_require__) {
  42873. /* WEBPACK VAR INJECTION */(function(global, process) {(function (global, undefined) {
  42874. "use strict";
  42875. if (global.setImmediate) {
  42876. return;
  42877. }
  42878. var nextHandle = 1; // Spec says greater than zero
  42879. var tasksByHandle = {};
  42880. var currentlyRunningATask = false;
  42881. var doc = global.document;
  42882. var registerImmediate;
  42883. function setImmediate(callback) {
  42884. // Callback can either be a function or a string
  42885. if (typeof callback !== "function") {
  42886. callback = new Function("" + callback);
  42887. }
  42888. // Copy function arguments
  42889. var args = new Array(arguments.length - 1);
  42890. for (var i = 0; i < args.length; i++) {
  42891. args[i] = arguments[i + 1];
  42892. }
  42893. // Store and register the task
  42894. var task = { callback: callback, args: args };
  42895. tasksByHandle[nextHandle] = task;
  42896. registerImmediate(nextHandle);
  42897. return nextHandle++;
  42898. }
  42899. function clearImmediate(handle) {
  42900. delete tasksByHandle[handle];
  42901. }
  42902. function run(task) {
  42903. var callback = task.callback;
  42904. var args = task.args;
  42905. switch (args.length) {
  42906. case 0:
  42907. callback();
  42908. break;
  42909. case 1:
  42910. callback(args[0]);
  42911. break;
  42912. case 2:
  42913. callback(args[0], args[1]);
  42914. break;
  42915. case 3:
  42916. callback(args[0], args[1], args[2]);
  42917. break;
  42918. default:
  42919. callback.apply(undefined, args);
  42920. break;
  42921. }
  42922. }
  42923. function runIfPresent(handle) {
  42924. // From the spec: "Wait until any invocations of this algorithm started before this one have completed."
  42925. // So if we're currently running a task, we'll need to delay this invocation.
  42926. if (currentlyRunningATask) {
  42927. // Delay by doing a setTimeout. setImmediate was tried instead, but in Firefox 7 it generated a
  42928. // "too much recursion" error.
  42929. setTimeout(runIfPresent, 0, handle);
  42930. } else {
  42931. var task = tasksByHandle[handle];
  42932. if (task) {
  42933. currentlyRunningATask = true;
  42934. try {
  42935. run(task);
  42936. } finally {
  42937. clearImmediate(handle);
  42938. currentlyRunningATask = false;
  42939. }
  42940. }
  42941. }
  42942. }
  42943. function installNextTickImplementation() {
  42944. registerImmediate = function(handle) {
  42945. process.nextTick(function () { runIfPresent(handle); });
  42946. };
  42947. }
  42948. function canUsePostMessage() {
  42949. // The test against `importScripts` prevents this implementation from being installed inside a web worker,
  42950. // where `global.postMessage` means something completely different and can't be used for this purpose.
  42951. if (global.postMessage && !global.importScripts) {
  42952. var postMessageIsAsynchronous = true;
  42953. var oldOnMessage = global.onmessage;
  42954. global.onmessage = function() {
  42955. postMessageIsAsynchronous = false;
  42956. };
  42957. global.postMessage("", "*");
  42958. global.onmessage = oldOnMessage;
  42959. return postMessageIsAsynchronous;
  42960. }
  42961. }
  42962. function installPostMessageImplementation() {
  42963. // Installs an event handler on `global` for the `message` event: see
  42964. // * https://developer.mozilla.org/en/DOM/window.postMessage
  42965. // * http://www.whatwg.org/specs/web-apps/current-work/multipage/comms.html#crossDocumentMessages
  42966. var messagePrefix = "setImmediate$" + Math.random() + "$";
  42967. var onGlobalMessage = function(event) {
  42968. if (event.source === global &&
  42969. typeof event.data === "string" &&
  42970. event.data.indexOf(messagePrefix) === 0) {
  42971. runIfPresent(+event.data.slice(messagePrefix.length));
  42972. }
  42973. };
  42974. if (global.addEventListener) {
  42975. global.addEventListener("message", onGlobalMessage, false);
  42976. } else {
  42977. global.attachEvent("onmessage", onGlobalMessage);
  42978. }
  42979. registerImmediate = function(handle) {
  42980. global.postMessage(messagePrefix + handle, "*");
  42981. };
  42982. }
  42983. function installMessageChannelImplementation() {
  42984. var channel = new MessageChannel();
  42985. channel.port1.onmessage = function(event) {
  42986. var handle = event.data;
  42987. runIfPresent(handle);
  42988. };
  42989. registerImmediate = function(handle) {
  42990. channel.port2.postMessage(handle);
  42991. };
  42992. }
  42993. function installReadyStateChangeImplementation() {
  42994. var html = doc.documentElement;
  42995. registerImmediate = function(handle) {
  42996. // Create a <script> element; its readystatechange event will be fired asynchronously once it is inserted
  42997. // into the document. Do so, thus queuing up the task. Remember to clean up once it's been called.
  42998. var script = doc.createElement("script");
  42999. script.onreadystatechange = function () {
  43000. runIfPresent(handle);
  43001. script.onreadystatechange = null;
  43002. html.removeChild(script);
  43003. script = null;
  43004. };
  43005. html.appendChild(script);
  43006. };
  43007. }
  43008. function installSetTimeoutImplementation() {
  43009. registerImmediate = function(handle) {
  43010. setTimeout(runIfPresent, 0, handle);
  43011. };
  43012. }
  43013. // If supported, we should attach to the prototype of global, since that is where setTimeout et al. live.
  43014. var attachTo = Object.getPrototypeOf && Object.getPrototypeOf(global);
  43015. attachTo = attachTo && attachTo.setTimeout ? attachTo : global;
  43016. // Don't get fooled by e.g. browserify environments.
  43017. if ({}.toString.call(global.process) === "[object process]") {
  43018. // For Node.js before 0.9
  43019. installNextTickImplementation();
  43020. } else if (canUsePostMessage()) {
  43021. // For non-IE10 modern browsers
  43022. installPostMessageImplementation();
  43023. } else if (global.MessageChannel) {
  43024. // For web workers, where supported
  43025. installMessageChannelImplementation();
  43026. } else if (doc && "onreadystatechange" in doc.createElement("script")) {
  43027. // For IE 6–8
  43028. installReadyStateChangeImplementation();
  43029. } else {
  43030. // For older browsers
  43031. installSetTimeoutImplementation();
  43032. }
  43033. attachTo.setImmediate = setImmediate;
  43034. attachTo.clearImmediate = clearImmediate;
  43035. }(typeof self === "undefined" ? typeof global === "undefined" ? this : global : self));
  43036. /* 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")))
  43037. /***/ }),
  43038. /***/ "./node_modules/timers-browserify/main.js":
  43039. /*!************************************************!*\
  43040. !*** ./node_modules/timers-browserify/main.js ***!
  43041. \************************************************/
  43042. /*! no static exports found */
  43043. /***/ (function(module, exports, __webpack_require__) {
  43044. /* WEBPACK VAR INJECTION */(function(global) {var scope = (typeof global !== "undefined" && global) ||
  43045. (typeof self !== "undefined" && self) ||
  43046. window;
  43047. var apply = Function.prototype.apply;
  43048. // DOM APIs, for completeness
  43049. exports.setTimeout = function() {
  43050. return new Timeout(apply.call(setTimeout, scope, arguments), clearTimeout);
  43051. };
  43052. exports.setInterval = function() {
  43053. return new Timeout(apply.call(setInterval, scope, arguments), clearInterval);
  43054. };
  43055. exports.clearTimeout =
  43056. exports.clearInterval = function(timeout) {
  43057. if (timeout) {
  43058. timeout.close();
  43059. }
  43060. };
  43061. function Timeout(id, clearFn) {
  43062. this._id = id;
  43063. this._clearFn = clearFn;
  43064. }
  43065. Timeout.prototype.unref = Timeout.prototype.ref = function() {};
  43066. Timeout.prototype.close = function() {
  43067. this._clearFn.call(scope, this._id);
  43068. };
  43069. // Does not start the time, just sets up the members needed.
  43070. exports.enroll = function(item, msecs) {
  43071. clearTimeout(item._idleTimeoutId);
  43072. item._idleTimeout = msecs;
  43073. };
  43074. exports.unenroll = function(item) {
  43075. clearTimeout(item._idleTimeoutId);
  43076. item._idleTimeout = -1;
  43077. };
  43078. exports._unrefActive = exports.active = function(item) {
  43079. clearTimeout(item._idleTimeoutId);
  43080. var msecs = item._idleTimeout;
  43081. if (msecs >= 0) {
  43082. item._idleTimeoutId = setTimeout(function onTimeout() {
  43083. if (item._onTimeout)
  43084. item._onTimeout();
  43085. }, msecs);
  43086. }
  43087. };
  43088. // setimmediate attaches itself to the global object
  43089. __webpack_require__(/*! setimmediate */ "./node_modules/setimmediate/setImmediate.js");
  43090. // On some exotic environments, it's not clear which object `setimmediate` was
  43091. // able to install onto. Search each possibility in the same order as the
  43092. // `setimmediate` library.
  43093. exports.setImmediate = (typeof self !== "undefined" && self.setImmediate) ||
  43094. (typeof global !== "undefined" && global.setImmediate) ||
  43095. (this && this.setImmediate);
  43096. exports.clearImmediate = (typeof self !== "undefined" && self.clearImmediate) ||
  43097. (typeof global !== "undefined" && global.clearImmediate) ||
  43098. (this && this.clearImmediate);
  43099. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")))
  43100. /***/ }),
  43101. /***/ "./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&":
  43102. /*!*******************************************************************************************************************************************************************************************************************!*\
  43103. !*** ./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& ***!
  43104. \*******************************************************************************************************************************************************************************************************************/
  43105. /*! exports provided: render, staticRenderFns */
  43106. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43107. "use strict";
  43108. __webpack_require__.r(__webpack_exports__);
  43109. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  43110. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  43111. var render = function() {
  43112. var _vm = this
  43113. var _h = _vm.$createElement
  43114. var _c = _vm._self._c || _h
  43115. return _vm._m(0)
  43116. }
  43117. var staticRenderFns = [
  43118. function() {
  43119. var _vm = this
  43120. var _h = _vm.$createElement
  43121. var _c = _vm._self._c || _h
  43122. return _c("div", { staticClass: "container" }, [
  43123. _c("div", { staticClass: "row justify-content-center" }, [
  43124. _c("div", { staticClass: "col-md-8" }, [
  43125. _c("div", { staticClass: "card" }, [
  43126. _c("div", { staticClass: "card-header" }, [
  43127. _vm._v("Example Component")
  43128. ]),
  43129. _vm._v(" "),
  43130. _c("div", { staticClass: "card-body" }, [
  43131. _vm._v(
  43132. "\n I'm an example component.\n "
  43133. )
  43134. ])
  43135. ])
  43136. ])
  43137. ])
  43138. ])
  43139. }
  43140. ]
  43141. render._withStripped = true
  43142. /***/ }),
  43143. /***/ "./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&":
  43144. /*!************************************************************************************************************************************************************************************************************!*\
  43145. !*** ./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& ***!
  43146. \************************************************************************************************************************************************************************************************************/
  43147. /*! exports provided: render, staticRenderFns */
  43148. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43149. "use strict";
  43150. __webpack_require__.r(__webpack_exports__);
  43151. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  43152. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  43153. var render = function() {
  43154. var _vm = this
  43155. var _h = _vm.$createElement
  43156. var _c = _vm._self._c || _h
  43157. return _c(
  43158. "div",
  43159. [
  43160. _c(
  43161. "modal",
  43162. {
  43163. attrs: {
  43164. id: "asseteditModal",
  43165. tabindex: "-1",
  43166. role: "dialog",
  43167. "aria-labelledby": "asseteditModalLabel"
  43168. }
  43169. },
  43170. [
  43171. _c(
  43172. "h5",
  43173. {
  43174. staticClass: "modal-title",
  43175. attrs: { slot: "header", id: "asseteditModalLabel" },
  43176. slot: "header"
  43177. },
  43178. [_vm._v("\n Edit Work Order Information\n ")]
  43179. ),
  43180. _vm._v(" "),
  43181. _c("div", { attrs: { slot: "body" }, slot: "body" }, [
  43182. _c("div", { staticClass: "form-group" }, [
  43183. _c("label", { attrs: { for: "manufacturer" } }, [
  43184. _vm._v("Manufacturer")
  43185. ]),
  43186. _vm._v(" "),
  43187. _c("input", {
  43188. directives: [
  43189. {
  43190. name: "model",
  43191. rawName: "v-model.lazy",
  43192. value: _vm.data.pcmanu,
  43193. expression: "data.pcmanu",
  43194. modifiers: { lazy: true }
  43195. }
  43196. ],
  43197. staticClass: "form-control",
  43198. attrs: {
  43199. type: "text",
  43200. name: "manufacturer",
  43201. id: "manufacturer"
  43202. },
  43203. domProps: { value: _vm.data.pcmanu },
  43204. on: {
  43205. change: function($event) {
  43206. return _vm.$set(_vm.data, "pcmanu", $event.target.value)
  43207. }
  43208. }
  43209. })
  43210. ]),
  43211. _vm._v(" "),
  43212. _c("div", { staticClass: "form-group" }, [
  43213. _c("label", { attrs: { for: "make" } }, [_vm._v("Make")]),
  43214. _vm._v(" "),
  43215. _c("input", {
  43216. directives: [
  43217. {
  43218. name: "model",
  43219. rawName: "v-model.lazy",
  43220. value: _vm.data.pcmake,
  43221. expression: "data.pcmake",
  43222. modifiers: { lazy: true }
  43223. }
  43224. ],
  43225. staticClass: "form-control",
  43226. attrs: { type: "text", name: "make", id: "make" },
  43227. domProps: { value: _vm.data.pcmake },
  43228. on: {
  43229. change: function($event) {
  43230. return _vm.$set(_vm.data, "pcmake", $event.target.value)
  43231. }
  43232. }
  43233. })
  43234. ]),
  43235. _vm._v(" "),
  43236. _c("div", { staticClass: "form-group" }, [
  43237. _c("label", { attrs: { for: "nickname" } }, [_vm._v("Nickname")]),
  43238. _vm._v(" "),
  43239. _c("input", {
  43240. directives: [
  43241. {
  43242. name: "model",
  43243. rawName: "v-model.lazy",
  43244. value: _vm.data.pcnickname,
  43245. expression: "data.pcnickname",
  43246. modifiers: { lazy: true }
  43247. }
  43248. ],
  43249. staticClass: "form-control",
  43250. attrs: { type: "text", name: "nickname", id: "nickname" },
  43251. domProps: { value: _vm.data.pcnickname },
  43252. on: {
  43253. change: function($event) {
  43254. return _vm.$set(_vm.data, "pcnickname", $event.target.value)
  43255. }
  43256. }
  43257. })
  43258. ]),
  43259. _vm._v(" "),
  43260. _c("div", { staticClass: "form-group" }, [
  43261. _c("label", { attrs: { for: "os" } }, [_vm._v("OS")]),
  43262. _vm._v(" "),
  43263. _c("input", {
  43264. directives: [
  43265. {
  43266. name: "model",
  43267. rawName: "v-model.lazy",
  43268. value: _vm.pcextra[2],
  43269. expression: "pcextra[2]",
  43270. modifiers: { lazy: true }
  43271. }
  43272. ],
  43273. staticClass: "form-control",
  43274. attrs: { type: "text", name: "os", id: "os" },
  43275. domProps: { value: _vm.pcextra[2] },
  43276. on: {
  43277. change: function($event) {
  43278. return _vm.$set(_vm.pcextra, 2, $event.target.value)
  43279. }
  43280. }
  43281. })
  43282. ]),
  43283. _vm._v(" "),
  43284. _c("div", { staticClass: "form-group" }, [
  43285. _c("label", { attrs: { for: "serial" } }, [
  43286. _vm._v("Serial Number")
  43287. ]),
  43288. _vm._v(" "),
  43289. _c("input", {
  43290. directives: [
  43291. {
  43292. name: "model",
  43293. rawName: "v-model.lazy",
  43294. value: _vm.pcextra[104],
  43295. expression: "pcextra[104]",
  43296. modifiers: { lazy: true }
  43297. }
  43298. ],
  43299. staticClass: "form-control",
  43300. attrs: { type: "text", id: "serial", name: "serial" },
  43301. domProps: { value: _vm.pcextra[104] },
  43302. on: {
  43303. change: function($event) {
  43304. return _vm.$set(_vm.pcextra, 104, $event.target.value)
  43305. }
  43306. }
  43307. })
  43308. ]),
  43309. _vm._v(" "),
  43310. _c("div", { staticClass: "form-group" }, [
  43311. _c("label", { attrs: { for: "cpu" } }, [_vm._v("CPU")]),
  43312. _vm._v(" "),
  43313. _c("input", {
  43314. directives: [
  43315. {
  43316. name: "model",
  43317. rawName: "v-model.lazy",
  43318. value: _vm.pcextra[101],
  43319. expression: "pcextra[101]",
  43320. modifiers: { lazy: true }
  43321. }
  43322. ],
  43323. staticClass: "form-control",
  43324. attrs: { type: "text", id: "cpu", name: "cpu" },
  43325. domProps: { value: _vm.pcextra[101] },
  43326. on: {
  43327. change: function($event) {
  43328. return _vm.$set(_vm.pcextra, 101, $event.target.value)
  43329. }
  43330. }
  43331. })
  43332. ]),
  43333. _vm._v(" "),
  43334. _c("div", { staticClass: "form-group" }, [
  43335. _c("label", { attrs: { for: "ram" } }, [_vm._v("RAM")]),
  43336. _vm._v(" "),
  43337. _c("input", {
  43338. directives: [
  43339. {
  43340. name: "model",
  43341. rawName: "v-model.lazy",
  43342. value: _vm.pcextra[100],
  43343. expression: "pcextra[100]",
  43344. modifiers: { lazy: true }
  43345. }
  43346. ],
  43347. staticClass: "form-control",
  43348. attrs: { type: "text", name: "ram", id: "ram" },
  43349. domProps: { value: _vm.pcextra[100] },
  43350. on: {
  43351. change: function($event) {
  43352. return _vm.$set(_vm.pcextra, 100, $event.target.value)
  43353. }
  43354. }
  43355. })
  43356. ]),
  43357. _vm._v(" "),
  43358. _c("div", { staticClass: "form-group" }, [
  43359. _c("label", { attrs: { for: "graphics" } }, [_vm._v("Graphics")]),
  43360. _vm._v(" "),
  43361. _c("input", {
  43362. directives: [
  43363. {
  43364. name: "model",
  43365. rawName: "v-model.lazy",
  43366. value: _vm.pcextra[4],
  43367. expression: "pcextra[4]",
  43368. modifiers: { lazy: true }
  43369. }
  43370. ],
  43371. staticClass: "form-control",
  43372. attrs: { type: "text", name: "graphics", id: "grapics" },
  43373. domProps: { value: _vm.pcextra[4] },
  43374. on: {
  43375. change: function($event) {
  43376. return _vm.$set(_vm.pcextra, 4, $event.target.value)
  43377. }
  43378. }
  43379. })
  43380. ])
  43381. ]),
  43382. _vm._v(" "),
  43383. _c("div", { attrs: { slot: "footer" }, slot: "footer" }, [
  43384. _c(
  43385. "button",
  43386. {
  43387. staticClass: "btn btn-secondary",
  43388. attrs: { type: "button", "data-dismiss": "modal" }
  43389. },
  43390. [_vm._v("Close")]
  43391. ),
  43392. _vm._v(" "),
  43393. _c(
  43394. "button",
  43395. {
  43396. staticClass: "btn btn-primary",
  43397. attrs: { type: "button" },
  43398. on: {
  43399. click: function($event) {
  43400. return _vm.updateAsset()
  43401. }
  43402. }
  43403. },
  43404. [_vm._v("Save")]
  43405. )
  43406. ])
  43407. ]
  43408. ),
  43409. _vm._v(" "),
  43410. _c("h4", { staticClass: "text-center" }, [
  43411. _vm._v(
  43412. _vm._s(this.data.pcmanu) + " " + _vm._s(this.data.pcmake) + " - "
  43413. ),
  43414. _c("small", { staticClass: "text-muted" }, [
  43415. _vm._v(_vm._s(this.data.pcnickname))
  43416. ])
  43417. ]),
  43418. _vm._v(" "),
  43419. _c("p", [_vm._v("OS: " + _vm._s(this.pcextra[2]))]),
  43420. _vm._v(" "),
  43421. _c("p", [_vm._v("S/N: " + _vm._s(this.pcextra[104]))]),
  43422. _vm._v(" "),
  43423. _c("p", [_vm._v("CPU: " + _vm._s(this.pcextra[101]))]),
  43424. _vm._v(" "),
  43425. _c("p", [_vm._v("RAM: " + _vm._s(this.pcextra[100]))]),
  43426. _vm._v(" "),
  43427. _c("p", [_vm._v("Graphics: " + _vm._s(this.pcextra[4]))]),
  43428. _vm._v(" "),
  43429. _c(
  43430. "button",
  43431. {
  43432. staticClass: "btn btn-primary",
  43433. attrs: {
  43434. type: "button",
  43435. "data-toggle": "modal",
  43436. "data-target": "#asseteditModal"
  43437. }
  43438. },
  43439. [_vm._v("Edit")]
  43440. )
  43441. ],
  43442. 1
  43443. )
  43444. }
  43445. var staticRenderFns = []
  43446. render._withStripped = true
  43447. /***/ }),
  43448. /***/ "./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&":
  43449. /*!*******************************************************************************************************************************************************************************************************************************!*\
  43450. !*** ./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& ***!
  43451. \*******************************************************************************************************************************************************************************************************************************/
  43452. /*! exports provided: render, staticRenderFns */
  43453. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43454. "use strict";
  43455. __webpack_require__.r(__webpack_exports__);
  43456. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  43457. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  43458. var render = function() {
  43459. var _vm = this
  43460. var _h = _vm.$createElement
  43461. var _c = _vm._self._c || _h
  43462. return _c("div", { staticClass: "dropdown", class: { open: _vm.open } }, [
  43463. _c("div", { staticClass: "input-group" }, [
  43464. _c("input", {
  43465. directives: [
  43466. {
  43467. name: "model",
  43468. rawName: "v-model",
  43469. value: _vm.searchText,
  43470. expression: "searchText"
  43471. }
  43472. ],
  43473. staticClass: "form-control",
  43474. attrs: { type: "text" },
  43475. domProps: { value: _vm.searchText },
  43476. on: {
  43477. input: [
  43478. function($event) {
  43479. if ($event.target.composing) {
  43480. return
  43481. }
  43482. _vm.searchText = $event.target.value
  43483. },
  43484. _vm.searchChanged
  43485. ]
  43486. }
  43487. }),
  43488. _vm._v(" "),
  43489. _c("div", { staticClass: "form-group-append" }, [
  43490. _c(
  43491. "a",
  43492. {
  43493. staticClass: "toggle input-group-text bg-primary text-light",
  43494. on: {
  43495. mousedown: function($event) {
  43496. $event.preventDefault()
  43497. },
  43498. click: function($event) {
  43499. return _vm.setOpen(!_vm.open)
  43500. }
  43501. }
  43502. },
  43503. [
  43504. _c("span", { staticClass: "arrow-up" }, [_vm._v("▲")]),
  43505. _vm._v(" "),
  43506. _c("span", { staticClass: "arrow-down" }, [_vm._v("▼")])
  43507. ]
  43508. )
  43509. ])
  43510. ]),
  43511. _vm._v(" "),
  43512. _c(
  43513. "ul",
  43514. { staticClass: "suggestion-list list-unstyled" },
  43515. _vm._l(_vm.matches, function(suggestion, index) {
  43516. return _c(
  43517. "li",
  43518. {
  43519. key: index,
  43520. on: {
  43521. mousedown: function($event) {
  43522. $event.preventDefault()
  43523. },
  43524. click: function($event) {
  43525. return _vm.suggestionSelected(suggestion)
  43526. }
  43527. }
  43528. },
  43529. [_vm._v("\n " + _vm._s(suggestion[1]) + "\n ")]
  43530. )
  43531. }),
  43532. 0
  43533. )
  43534. ])
  43535. }
  43536. var staticRenderFns = []
  43537. render._withStripped = true
  43538. /***/ }),
  43539. /***/ "./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&":
  43540. /*!************************************************************************************************************************************************************************************************************************!*\
  43541. !*** ./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& ***!
  43542. \************************************************************************************************************************************************************************************************************************/
  43543. /*! exports provided: render, staticRenderFns */
  43544. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43545. "use strict";
  43546. __webpack_require__.r(__webpack_exports__);
  43547. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  43548. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  43549. var render = function() {
  43550. var _vm = this
  43551. var _h = _vm.$createElement
  43552. var _c = _vm._self._c || _h
  43553. return _c(
  43554. "modal",
  43555. {
  43556. attrs: {
  43557. id: _vm.id,
  43558. tabindex: "-1",
  43559. role: "dialog",
  43560. "aria-labelledby": _vm.id + "Label"
  43561. }
  43562. },
  43563. [
  43564. _c(
  43565. "h5",
  43566. {
  43567. staticClass: "modal-title",
  43568. attrs: { slot: "header", id: _vm.id + "Label" },
  43569. slot: "header"
  43570. },
  43571. [_vm._v("\n Edit Credential\n ")]
  43572. ),
  43573. _vm._v(" "),
  43574. _c("div", { attrs: { slot: "body" }, slot: "body" }, [
  43575. _c(
  43576. "div",
  43577. { staticClass: "form" },
  43578. [
  43579. _c("autocomplete-custom-dropdown", {
  43580. attrs: {
  43581. options: _vm.descriptions,
  43582. value: _vm.creddesc,
  43583. "allow-custom": true
  43584. },
  43585. model: {
  43586. value: _vm.creddesc,
  43587. callback: function($$v) {
  43588. _vm.creddesc = $$v
  43589. },
  43590. expression: "creddesc"
  43591. }
  43592. })
  43593. ],
  43594. 1
  43595. ),
  43596. _vm._v(" "),
  43597. _c("div", { staticClass: "form-group" }, [
  43598. _c("label", { attrs: { for: "newusername" } }, [_vm._v("Username")]),
  43599. _vm._v(" "),
  43600. _c("input", {
  43601. directives: [
  43602. {
  43603. name: "model",
  43604. rawName: "v-model",
  43605. value: _vm.data.creduser,
  43606. expression: "data.creduser"
  43607. }
  43608. ],
  43609. staticClass: "form-control credential",
  43610. attrs: {
  43611. type: "text",
  43612. name: "newusername" + _vm.data.credid,
  43613. id: "newusername" + _vm.data.credid
  43614. },
  43615. domProps: { value: _vm.data.creduser },
  43616. on: {
  43617. input: function($event) {
  43618. if ($event.target.composing) {
  43619. return
  43620. }
  43621. _vm.$set(_vm.data, "creduser", $event.target.value)
  43622. }
  43623. }
  43624. })
  43625. ]),
  43626. _vm._v(" "),
  43627. _c("div", { staticClass: "form-group" }, [
  43628. _c("label", { attrs: { for: "newpassword" } }, [_vm._v("Password")]),
  43629. _vm._v(" "),
  43630. _c("input", {
  43631. directives: [
  43632. {
  43633. name: "model",
  43634. rawName: "v-model",
  43635. value: _vm.data.credpass,
  43636. expression: "data.credpass"
  43637. }
  43638. ],
  43639. staticClass: "form-control credential",
  43640. attrs: {
  43641. type: "text",
  43642. name: "newpassword" + _vm.data.credid,
  43643. id: "newpassword" + _vm.data.credid
  43644. },
  43645. domProps: { value: _vm.data.credpass },
  43646. on: {
  43647. input: function($event) {
  43648. if ($event.target.composing) {
  43649. return
  43650. }
  43651. _vm.$set(_vm.data, "credpass", $event.target.value)
  43652. }
  43653. }
  43654. }),
  43655. _vm._v(" "),
  43656. _c(
  43657. "button",
  43658. {
  43659. staticClass: "btn btn-secondary",
  43660. attrs: { type: "button" },
  43661. on: {
  43662. click: function($event) {
  43663. return _vm.getRandomPassword(_vm.data.credid)
  43664. }
  43665. }
  43666. },
  43667. [_vm._v("Generate Random")]
  43668. )
  43669. ]),
  43670. _vm._v(" "),
  43671. _c("div", { staticClass: "form-group" })
  43672. ]),
  43673. _vm._v(" "),
  43674. _c("div", { attrs: { slot: "footer" }, slot: "footer" }, [
  43675. _c(
  43676. "button",
  43677. {
  43678. staticClass: "btn btn-secondary",
  43679. attrs: { type: "button", "data-dismiss": "modal" }
  43680. },
  43681. [_vm._v("Close")]
  43682. ),
  43683. _vm._v(" "),
  43684. _c(
  43685. "button",
  43686. {
  43687. staticClass: "btn btn-primary",
  43688. attrs: { type: "button" },
  43689. on: {
  43690. click: function($event) {
  43691. return _vm.updateCredential()
  43692. }
  43693. }
  43694. },
  43695. [_vm._v("Save")]
  43696. )
  43697. ])
  43698. ]
  43699. )
  43700. }
  43701. var staticRenderFns = []
  43702. render._withStripped = true
  43703. /***/ }),
  43704. /***/ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/credential-list.vue?vue&type=template&id=06d8fa4e&":
  43705. /*!******************************************************************************************************************************************************************************************************************!*\
  43706. !*** ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/credential-list.vue?vue&type=template&id=06d8fa4e& ***!
  43707. \******************************************************************************************************************************************************************************************************************/
  43708. /*! exports provided: render, staticRenderFns */
  43709. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43710. "use strict";
  43711. __webpack_require__.r(__webpack_exports__);
  43712. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  43713. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  43714. var render = function() {
  43715. var _vm = this
  43716. var _h = _vm.$createElement
  43717. var _c = _vm._self._c || _h
  43718. return _c(
  43719. "div",
  43720. [
  43721. _c("credential-form-modal", {
  43722. attrs: {
  43723. "modal-id": "newCredentialModal",
  43724. descriptions: _vm.creddescList,
  43725. create: true,
  43726. pcid: _vm.pcid
  43727. }
  43728. }),
  43729. _vm._v(" "),
  43730. _c(
  43731. "button",
  43732. {
  43733. staticClass: "btn btn-primary",
  43734. attrs: {
  43735. type: "button",
  43736. "data-toggle": "modal",
  43737. "data-target": "#newCredentialModal"
  43738. }
  43739. },
  43740. [_vm._v("New Credential")]
  43741. ),
  43742. _vm._v(" "),
  43743. _vm._l(_vm.credentials, function(credential) {
  43744. return _c(
  43745. "div",
  43746. { key: credential.credid },
  43747. [
  43748. _c("credential", {
  43749. attrs: { credential: credential, descriptions: _vm.creddescList }
  43750. })
  43751. ],
  43752. 1
  43753. )
  43754. })
  43755. ],
  43756. 2
  43757. )
  43758. }
  43759. var staticRenderFns = []
  43760. render._withStripped = true
  43761. /***/ }),
  43762. /***/ "./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&":
  43763. /*!*************************************************************************************************************************************************************************************************************!*\
  43764. !*** ./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& ***!
  43765. \*************************************************************************************************************************************************************************************************************/
  43766. /*! exports provided: render, staticRenderFns */
  43767. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43768. "use strict";
  43769. __webpack_require__.r(__webpack_exports__);
  43770. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  43771. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  43772. var render = function() {
  43773. var _vm = this
  43774. var _h = _vm.$createElement
  43775. var _c = _vm._self._c || _h
  43776. return _c(
  43777. "div",
  43778. { staticClass: "bg-lightgray m-1 p-2 border rounded container-fluid" },
  43779. [
  43780. _c("credential-form-modal", {
  43781. attrs: {
  43782. descriptions: _vm.creddescList,
  43783. "modal-id": "credential" + this.data.credid + "editModal",
  43784. populateWith: this.data
  43785. }
  43786. }),
  43787. _vm._v(" "),
  43788. _c(
  43789. "modal",
  43790. {
  43791. attrs: {
  43792. id: "credential" + this.data.credid + "deleteModal",
  43793. tabindex: "-1"
  43794. }
  43795. },
  43796. [
  43797. _c(
  43798. "h5",
  43799. {
  43800. staticClass: "modal-title",
  43801. attrs: {
  43802. slot: "header",
  43803. id: "credential" + this.data.credid + "deleteModalLabel"
  43804. },
  43805. slot: "header"
  43806. },
  43807. [_vm._v("\r\n Delete Credential\r\n ")]
  43808. ),
  43809. _vm._v(" "),
  43810. _c("div", { attrs: { slot: "body" }, slot: "body" }, [
  43811. _vm._v("\r\n Are you sure?\r\n ")
  43812. ]),
  43813. _vm._v(" "),
  43814. _c("div", { attrs: { slot: "footer" }, slot: "footer" }, [
  43815. _c(
  43816. "button",
  43817. {
  43818. staticClass: "btn btn-secondary",
  43819. attrs: { type: "button", "data-dismiss": "modal" }
  43820. },
  43821. [_vm._v("Cancel")]
  43822. ),
  43823. _vm._v(" "),
  43824. _c(
  43825. "button",
  43826. {
  43827. staticClass: "btn btn-danger",
  43828. attrs: { type: "button" },
  43829. on: {
  43830. click: function($event) {
  43831. return _vm.deleteCredential()
  43832. }
  43833. }
  43834. },
  43835. [_vm._v("Confirm")]
  43836. )
  43837. ])
  43838. ]
  43839. ),
  43840. _vm._v(" "),
  43841. _c("div", { staticClass: "row no-gutters" }, [
  43842. _c("div", { staticClass: "h5 col-3 text-left" }, [
  43843. _vm._v(_vm._s(this.data.creddesc))
  43844. ]),
  43845. _vm._v(" "),
  43846. _c("div", { staticClass: "col-9 text-right" }, [
  43847. _vm._v(_vm._s(this.data.creddate))
  43848. ])
  43849. ]),
  43850. _vm._v(" "),
  43851. _c("div", { staticClass: "row" }, [
  43852. _c("div", { staticClass: "col-lg-9" }, [
  43853. _c("div", [
  43854. _vm._m(0),
  43855. _vm._v(" "),
  43856. _c("input", {
  43857. staticClass: "border-0 credential",
  43858. attrs: {
  43859. type: "text",
  43860. id: "username" + this.data.credid,
  43861. readonly: ""
  43862. },
  43863. domProps: { value: this.data.creduser }
  43864. }),
  43865. _vm._v(" "),
  43866. _c(
  43867. "button",
  43868. {
  43869. staticClass: "btn-clip btn btn-sm btn-primary rounded-pill",
  43870. attrs: {
  43871. id: "btn-username" + this.data.credid,
  43872. "data-clipboard-target": "#username" + this.data.credid
  43873. }
  43874. },
  43875. [_c("i", { staticClass: "far fa-clone" })]
  43876. )
  43877. ]),
  43878. _vm._v(" "),
  43879. _c("div", [
  43880. _vm._m(1),
  43881. _vm._v(" "),
  43882. _c("input", {
  43883. staticClass: "border-0 credential",
  43884. attrs: {
  43885. type: "text",
  43886. id: "password" + this.data.credid,
  43887. readonly: ""
  43888. },
  43889. domProps: { value: this.data.credpass }
  43890. }),
  43891. _vm._v(" "),
  43892. _c(
  43893. "button",
  43894. {
  43895. staticClass: "btn-clip btn btn-sm btn-primary rounded-pill",
  43896. attrs: {
  43897. id: "btn-password" + this.data.credid,
  43898. "data-clipboard-target": "#password" + this.data.credid
  43899. }
  43900. },
  43901. [_c("i", { staticClass: "far fa-clone" })]
  43902. )
  43903. ])
  43904. ]),
  43905. _vm._v(" "),
  43906. _c(
  43907. "div",
  43908. {
  43909. staticClass: "btn-group col-lg-2 align-self-end w-25 w-lg-auto",
  43910. attrs: { role: "group", "aria-label": "Edit and Delete" }
  43911. },
  43912. [
  43913. _c(
  43914. "button",
  43915. {
  43916. staticClass: "btn btn-sm btn-secondary p-lg-1",
  43917. attrs: {
  43918. type: "button",
  43919. "data-toggle": "modal",
  43920. "data-target": "#credential" + this.data.credid + "editModal"
  43921. }
  43922. },
  43923. [_c("i", { staticClass: "fas fa-fw fa-edit" })]
  43924. ),
  43925. _vm._v(" "),
  43926. _c(
  43927. "button",
  43928. {
  43929. staticClass: "btn btn-sm btn-danger p-lg-1",
  43930. attrs: {
  43931. type: "button",
  43932. "data-toggle": "modal",
  43933. "data-target":
  43934. "#credential" + this.data.credid + "deleteModal"
  43935. }
  43936. },
  43937. [_c("i", { staticClass: "fas fa-fw fa-trash-alt" })]
  43938. )
  43939. ]
  43940. )
  43941. ])
  43942. ],
  43943. 1
  43944. )
  43945. }
  43946. var staticRenderFns = [
  43947. function() {
  43948. var _vm = this
  43949. var _h = _vm.$createElement
  43950. var _c = _vm._self._c || _h
  43951. return _c("label", { attrs: { for: "username" } }, [
  43952. _c("i", { staticClass: "fas fa-fw fa-user" })
  43953. ])
  43954. },
  43955. function() {
  43956. var _vm = this
  43957. var _h = _vm.$createElement
  43958. var _c = _vm._self._c || _h
  43959. return _c("label", { attrs: { for: "password" } }, [
  43960. _c("i", { staticClass: "fas fa-fw fa-key" })
  43961. ])
  43962. }
  43963. ]
  43964. render._withStripped = true
  43965. /***/ }),
  43966. /***/ "./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&":
  43967. /*!************************************************************************************************************************************************************************************************************!*\
  43968. !*** ./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& ***!
  43969. \************************************************************************************************************************************************************************************************************/
  43970. /*! exports provided: render, staticRenderFns */
  43971. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  43972. "use strict";
  43973. __webpack_require__.r(__webpack_exports__);
  43974. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  43975. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  43976. var render = function() {
  43977. var _vm = this
  43978. var _h = _vm.$createElement
  43979. var _c = _vm._self._c || _h
  43980. return _c(
  43981. "ul",
  43982. { staticClass: "list-unstyled" },
  43983. _vm._l(_vm.errorList, function(error) {
  43984. return _c("li", { key: error, staticClass: "text-danger" }, [
  43985. _vm._v(" " + _vm._s(error) + " ")
  43986. ])
  43987. }),
  43988. 0
  43989. )
  43990. }
  43991. var staticRenderFns = []
  43992. render._withStripped = true
  43993. /***/ }),
  43994. /***/ "./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&":
  43995. /*!********************************************************************************************************************************************************************************************************!*\
  43996. !*** ./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& ***!
  43997. \********************************************************************************************************************************************************************************************************/
  43998. /*! exports provided: render, staticRenderFns */
  43999. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  44000. "use strict";
  44001. __webpack_require__.r(__webpack_exports__);
  44002. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  44003. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  44004. var render = function() {
  44005. var _vm = this
  44006. var _h = _vm.$createElement
  44007. var _c = _vm._self._c || _h
  44008. return _c("div", { staticClass: "modal fade" }, [
  44009. _c(
  44010. "div",
  44011. { staticClass: "modal-dialog modal-lg", attrs: { role: "document" } },
  44012. [
  44013. _c("div", { staticClass: "modal-content" }, [
  44014. _c(
  44015. "div",
  44016. { staticClass: "modal-header" },
  44017. [_vm._m(0), _vm._v(" "), _vm._t("header")],
  44018. 2
  44019. ),
  44020. _vm._v(" "),
  44021. _c("div", { staticClass: "modal-body" }, [_vm._t("body")], 2),
  44022. _vm._v(" "),
  44023. _c("div", { staticClass: "modal-footer" }, [_vm._t("footer")], 2)
  44024. ])
  44025. ]
  44026. )
  44027. ])
  44028. }
  44029. var staticRenderFns = [
  44030. function() {
  44031. var _vm = this
  44032. var _h = _vm.$createElement
  44033. var _c = _vm._self._c || _h
  44034. return _c(
  44035. "button",
  44036. {
  44037. staticClass: "close",
  44038. attrs: {
  44039. type: "button",
  44040. "data-dismiss": "modal",
  44041. "aria-label": "Close"
  44042. }
  44043. },
  44044. [_c("span", { attrs: { "aria-hidden": "true" } }, [_vm._v("×")])]
  44045. )
  44046. }
  44047. ]
  44048. render._withStripped = true
  44049. /***/ }),
  44050. /***/ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/note-form-modal.vue?vue&type=template&id=0435c624&":
  44051. /*!******************************************************************************************************************************************************************************************************************!*\
  44052. !*** ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./resources/js/components/note-form-modal.vue?vue&type=template&id=0435c624& ***!
  44053. \******************************************************************************************************************************************************************************************************************/
  44054. /*! exports provided: render, staticRenderFns */
  44055. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  44056. "use strict";
  44057. __webpack_require__.r(__webpack_exports__);
  44058. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  44059. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  44060. var render = function() {
  44061. var _vm = this
  44062. var _h = _vm.$createElement
  44063. var _c = _vm._self._c || _h
  44064. return _c(
  44065. "modal",
  44066. {
  44067. attrs: {
  44068. id: _vm.modalId,
  44069. tabindex: "-1",
  44070. role: "dialog",
  44071. "aria-labelledby": _vm.modalId + "Label"
  44072. }
  44073. },
  44074. [
  44075. _c(
  44076. "h5",
  44077. {
  44078. staticClass: "modal-title",
  44079. attrs: { slot: "header", id: _vm.modalId + "Label" },
  44080. slot: "header"
  44081. },
  44082. [_vm._v("\n Edit Note\n ")]
  44083. ),
  44084. _vm._v(" "),
  44085. _c("div", { attrs: { slot: "body" }, slot: "body" }, [
  44086. _c("div", { staticClass: "form-group" }, [
  44087. _c("label", { attrs: { for: "content" } }, [_vm._v("Content")]),
  44088. _vm._v(" "),
  44089. _c("textarea", {
  44090. directives: [
  44091. {
  44092. name: "model",
  44093. rawName: "v-model",
  44094. value: _vm.note.thenote,
  44095. expression: "note.thenote"
  44096. }
  44097. ],
  44098. staticClass: "form-control",
  44099. attrs: {
  44100. name: "content" + _vm.note.noteid,
  44101. id: "content" + _vm.note.noteid
  44102. },
  44103. domProps: { value: _vm.note.thenote },
  44104. on: {
  44105. input: function($event) {
  44106. if ($event.target.composing) {
  44107. return
  44108. }
  44109. _vm.$set(_vm.note, "thenote", $event.target.value)
  44110. }
  44111. }
  44112. })
  44113. ])
  44114. ]),
  44115. _vm._v(" "),
  44116. _c("div", { attrs: { slot: "footer" }, slot: "footer" }, [
  44117. _c(
  44118. "button",
  44119. {
  44120. staticClass: "btn btn-secondary",
  44121. attrs: { type: "button", "data-dismiss": "modal" }
  44122. },
  44123. [_vm._v("Close")]
  44124. ),
  44125. _vm._v(" "),
  44126. _c(
  44127. "button",
  44128. {
  44129. staticClass: "btn btn-primary",
  44130. attrs: { type: "button" },
  44131. on: {
  44132. click: function($event) {
  44133. return _vm.updateNote(_vm.note)
  44134. }
  44135. }
  44136. },
  44137. [_vm._v("Save")]
  44138. )
  44139. ])
  44140. ]
  44141. )
  44142. }
  44143. var staticRenderFns = []
  44144. render._withStripped = true
  44145. /***/ }),
  44146. /***/ "./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&":
  44147. /*!********************************************************************************************************************************************************************************************************!*\
  44148. !*** ./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& ***!
  44149. \********************************************************************************************************************************************************************************************************/
  44150. /*! exports provided: render, staticRenderFns */
  44151. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  44152. "use strict";
  44153. __webpack_require__.r(__webpack_exports__);
  44154. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  44155. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  44156. var render = function() {
  44157. var _vm = this
  44158. var _h = _vm.$createElement
  44159. var _c = _vm._self._c || _h
  44160. return _c(
  44161. "ul",
  44162. { staticClass: "list-unstyled" },
  44163. [
  44164. _c("div", { staticClass: "row" }, [
  44165. _c(
  44166. "div",
  44167. {
  44168. staticClass:
  44169. "col-md-2 d-flex justify-content-center justify-content-md-start"
  44170. },
  44171. [
  44172. _c(
  44173. "button",
  44174. {
  44175. staticClass: "btn btn-primary m-2",
  44176. attrs: {
  44177. type: "button",
  44178. "data-toggle": "collapse",
  44179. "data-target": "#note" + _vm.noteType + "add"
  44180. }
  44181. },
  44182. [
  44183. _c("i", { staticClass: "fas fa-fw fa-plus" }),
  44184. _vm._v(" Add New Note")
  44185. ]
  44186. )
  44187. ]
  44188. ),
  44189. _vm._v(" "),
  44190. _c("div", { staticClass: "col-md-10" }, [
  44191. _c(
  44192. "div",
  44193. {
  44194. staticClass: "collapse",
  44195. attrs: { id: "note" + _vm.noteType + "add" }
  44196. },
  44197. [
  44198. _c(
  44199. "div",
  44200. {
  44201. staticClass:
  44202. "d-flex flex-wrap flex-md-nowrap justify-content-center"
  44203. },
  44204. [
  44205. _c("textarea", {
  44206. directives: [
  44207. {
  44208. name: "model",
  44209. rawName: "v-model",
  44210. value: _vm.newNote.thenote,
  44211. expression: "newNote.thenote"
  44212. }
  44213. ],
  44214. staticClass: "form-control",
  44215. attrs: {
  44216. name: "newnote" + _vm.noteType,
  44217. id: "newnote" + _vm.noteType
  44218. },
  44219. domProps: { value: _vm.newNote.thenote },
  44220. on: {
  44221. input: function($event) {
  44222. if ($event.target.composing) {
  44223. return
  44224. }
  44225. _vm.$set(_vm.newNote, "thenote", $event.target.value)
  44226. }
  44227. }
  44228. }),
  44229. _vm._v(" "),
  44230. _c(
  44231. "button",
  44232. {
  44233. staticClass: "btn btn-secondary m-2",
  44234. attrs: { type: "button" },
  44235. on: {
  44236. click: function($event) {
  44237. return _vm.createNote()
  44238. }
  44239. }
  44240. },
  44241. [_vm._v("Save")]
  44242. )
  44243. ]
  44244. )
  44245. ]
  44246. )
  44247. ])
  44248. ]),
  44249. _vm._v(" "),
  44250. _vm._l(this.notes, function(note, index) {
  44251. return _c(
  44252. "li",
  44253. { key: index, staticClass: "row no-gutters mb-2" },
  44254. [
  44255. _c("note-form-modal", {
  44256. attrs: {
  44257. "modal-id": "note" + note.noteid + "editModal",
  44258. "populate-with": note
  44259. }
  44260. }),
  44261. _vm._v(" "),
  44262. _c("div", { staticClass: "col-md-1 d-flex flex-column mx-md-3" }, [
  44263. _c("div", { staticClass: "text-center p-0 m-0" }, [
  44264. _vm._v(_vm._s(note.noteuser))
  44265. ]),
  44266. _vm._v(" "),
  44267. _c(
  44268. "div",
  44269. { staticClass: "text-muted text-small text-center p-0 m-0" },
  44270. [_vm._v(_vm._s(_vm.getHRDate(note.notetime)))]
  44271. ),
  44272. _vm._v(" "),
  44273. _c(
  44274. "div",
  44275. { staticClass: "btn-group justify-content-center p-0 m-0" },
  44276. [
  44277. _vm.authusername === note.noteuser ||
  44278. _vm.authusername === "admin"
  44279. ? [
  44280. _c(
  44281. "button",
  44282. {
  44283. staticClass: "btn btn-sm btn-primary m-1",
  44284. attrs: {
  44285. "data-toggle": "modal",
  44286. "data-target": "#note" + note.noteid + "editModal"
  44287. }
  44288. },
  44289. [_c("i", { staticClass: "fas fa-fw fa-edit" })]
  44290. ),
  44291. _vm._v(" "),
  44292. _vm._m(0, true),
  44293. _vm._v(" "),
  44294. _vm._m(1, true)
  44295. ]
  44296. : _vm._e()
  44297. ],
  44298. 2
  44299. )
  44300. ]),
  44301. _vm._v(" "),
  44302. _c("div", { staticClass: "col-md-10" }, [
  44303. _c("div", { staticClass: "card m-2" }, [
  44304. _c("div", { staticClass: "card-body p-2" }, [
  44305. _vm._v(
  44306. "\n " +
  44307. _vm._s(note.thenote) +
  44308. "\n "
  44309. )
  44310. ])
  44311. ])
  44312. ])
  44313. ],
  44314. 1
  44315. )
  44316. })
  44317. ],
  44318. 2
  44319. )
  44320. }
  44321. var staticRenderFns = [
  44322. function() {
  44323. var _vm = this
  44324. var _h = _vm.$createElement
  44325. var _c = _vm._self._c || _h
  44326. return _c("button", { staticClass: "btn btn-sm btn-danger m-1" }, [
  44327. _c("i", { staticClass: "fas fa-fw fa-trash-alt" })
  44328. ])
  44329. },
  44330. function() {
  44331. var _vm = this
  44332. var _h = _vm.$createElement
  44333. var _c = _vm._self._c || _h
  44334. return _c("button", { staticClass: "btn btn-sm btn-primary m-1" }, [
  44335. _c("i", { staticClass: "fa fa-fw fa-random" })
  44336. ])
  44337. }
  44338. ]
  44339. render._withStripped = true
  44340. /***/ }),
  44341. /***/ "./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&":
  44342. /*!********************************************************************************************************************************************************************************************************************!*\
  44343. !*** ./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& ***!
  44344. \********************************************************************************************************************************************************************************************************************/
  44345. /*! exports provided: render, staticRenderFns */
  44346. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  44347. "use strict";
  44348. __webpack_require__.r(__webpack_exports__);
  44349. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  44350. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  44351. var render = function() {
  44352. var _vm = this
  44353. var _h = _vm.$createElement
  44354. var _c = _vm._self._c || _h
  44355. return _c(
  44356. "modal",
  44357. {
  44358. attrs: {
  44359. id: _vm.id,
  44360. tabindex: "-1",
  44361. role: "dialog",
  44362. "aria-labelledby": _vm.id + "Label"
  44363. }
  44364. },
  44365. [
  44366. _c(
  44367. "h5",
  44368. {
  44369. staticClass: "modal-title",
  44370. attrs: { slot: "header", id: _vm.id + "Label" },
  44371. slot: "header"
  44372. },
  44373. [_vm._v("\r\n Edit Work Order Information\r\n ")]
  44374. ),
  44375. _vm._v(" "),
  44376. _c("div", { attrs: { slot: "body" }, slot: "body" }, [
  44377. _c(
  44378. "div",
  44379. { staticClass: "form-group" },
  44380. [
  44381. _c("label", { attrs: { for: "probdesc" } }, [
  44382. _vm._v("Problem Description")
  44383. ]),
  44384. _vm._v(" "),
  44385. _c("textarea", {
  44386. directives: [
  44387. {
  44388. name: "model",
  44389. rawName: "v-model",
  44390. value: _vm.data.probdesc,
  44391. expression: "data.probdesc"
  44392. }
  44393. ],
  44394. class: {
  44395. "form-control": true,
  44396. "is-invalid": _vm.errors.probdesc
  44397. },
  44398. attrs: { id: "probdesc", name: "probdesc" },
  44399. domProps: { value: _vm.data.probdesc },
  44400. on: {
  44401. input: function($event) {
  44402. if ($event.target.composing) {
  44403. return
  44404. }
  44405. _vm.$set(_vm.data, "probdesc", $event.target.value)
  44406. }
  44407. }
  44408. }),
  44409. _vm._v(" "),
  44410. _c("errorlist", { attrs: { errors: _vm.errors.probdesc } })
  44411. ],
  44412. 1
  44413. ),
  44414. _vm._v(" "),
  44415. _c(
  44416. "div",
  44417. { staticClass: "form-group" },
  44418. [
  44419. _c("label", { attrs: { for: "suggested" } }, [
  44420. _vm._v("Suggested Solution")
  44421. ]),
  44422. _vm._v(" "),
  44423. _c("textarea", {
  44424. directives: [
  44425. {
  44426. name: "model",
  44427. rawName: "v-model",
  44428. value: _vm.data.suggested,
  44429. expression: "data.suggested"
  44430. }
  44431. ],
  44432. class: {
  44433. "form-control": true,
  44434. "is-invalid": _vm.errors.suggested
  44435. },
  44436. attrs: { id: "suggested", name: "suggested" },
  44437. domProps: { value: _vm.data.suggested },
  44438. on: {
  44439. input: function($event) {
  44440. if ($event.target.composing) {
  44441. return
  44442. }
  44443. _vm.$set(_vm.data, "suggested", $event.target.value)
  44444. }
  44445. }
  44446. }),
  44447. _vm._v(" "),
  44448. _c("errorlist", { attrs: { errors: _vm.errors.suggested } })
  44449. ],
  44450. 1
  44451. ),
  44452. _vm._v(" "),
  44453. _c(
  44454. "div",
  44455. { staticClass: "form-group" },
  44456. [
  44457. _c("label", { attrs: { for: "storelist" } }, [_vm._v("Store")]),
  44458. _vm._v(" "),
  44459. _c("autocomplete-custom-dropdown", {
  44460. attrs: { options: _vm.storeList, value: this.store },
  44461. model: {
  44462. value: _vm.store,
  44463. callback: function($$v) {
  44464. _vm.store = $$v
  44465. },
  44466. expression: "store"
  44467. }
  44468. })
  44469. ],
  44470. 1
  44471. )
  44472. ]),
  44473. _vm._v(" "),
  44474. _c("div", { attrs: { slot: "footer" }, slot: "footer" }, [
  44475. _c(
  44476. "button",
  44477. {
  44478. staticClass: "btn btn-secondary",
  44479. attrs: { type: "button", "data-dismiss": "modal" }
  44480. },
  44481. [_vm._v("Close")]
  44482. ),
  44483. _vm._v(" "),
  44484. _c(
  44485. "button",
  44486. {
  44487. staticClass: "btn btn-primary",
  44488. attrs: { type: "button" },
  44489. on: {
  44490. click: function($event) {
  44491. return _vm.updateWorkOrder()
  44492. }
  44493. }
  44494. },
  44495. [_vm._v("Save")]
  44496. )
  44497. ])
  44498. ]
  44499. )
  44500. }
  44501. var staticRenderFns = []
  44502. render._withStripped = true
  44503. /***/ }),
  44504. /***/ "./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&":
  44505. /*!*********************************************************************************************************************************************************************************************************!*\
  44506. !*** ./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& ***!
  44507. \*********************************************************************************************************************************************************************************************************/
  44508. /*! exports provided: render, staticRenderFns */
  44509. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  44510. "use strict";
  44511. __webpack_require__.r(__webpack_exports__);
  44512. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return render; });
  44513. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return staticRenderFns; });
  44514. var render = function() {
  44515. var _vm = this
  44516. var _h = _vm.$createElement
  44517. var _c = _vm._self._c || _h
  44518. return _c(
  44519. "div",
  44520. [
  44521. _c("woinfo-edit-modal", {
  44522. attrs: {
  44523. "modal-id": "workordereditModal",
  44524. "populate-with": this.data,
  44525. "store-list": this.storeList
  44526. }
  44527. }),
  44528. _vm._v(" "),
  44529. _c("p", [
  44530. _c("i", { staticClass: "fas fa-fw fa-info-circle" }),
  44531. _vm._v(" "),
  44532. _c("span", { domProps: { textContent: _vm._s(this.data.probdesc) } })
  44533. ]),
  44534. _vm._v(" "),
  44535. _c("p", [
  44536. _c("i", { staticClass: "far fa-fw fa-lightbulb" }),
  44537. _vm._v(" "),
  44538. _c("span", { domProps: { textContent: _vm._s(this.data.suggested) } })
  44539. ]),
  44540. _vm._v(" "),
  44541. _c("p", [
  44542. _c("i", { staticClass: "fas fa-fw fa-paste" }),
  44543. _vm._v(" "),
  44544. _c("span", { domProps: { textContent: _vm._s(this.data.woid) } })
  44545. ]),
  44546. _vm._v(" "),
  44547. _c("p", [
  44548. _c("i", { staticClass: "fas fa-fw fa-building" }),
  44549. _vm._v(" "),
  44550. _c("span", [_vm._v(_vm._s(_vm.storeList[_vm.data.storeid]))])
  44551. ]),
  44552. _vm._v(" "),
  44553. _c("p", [
  44554. _c("i", { staticClass: "fas fa-fw fa-sign-in-alt" }),
  44555. _vm._v(" "),
  44556. _c(
  44557. "span",
  44558. {
  44559. staticClass: "dashed-underline",
  44560. attrs: {
  44561. "data-toggle": "tooltip",
  44562. "data-placement": "bottom",
  44563. title: this.getHRDate(this.data.dropdate)
  44564. }
  44565. },
  44566. [
  44567. _vm._v(
  44568. "\n " +
  44569. _vm._s(Math.floor(this.daysSinceToday(this.data.dropdate))) +
  44570. " days ago\n "
  44571. )
  44572. ]
  44573. )
  44574. ]),
  44575. _vm._v(" "),
  44576. _c("p", [
  44577. _c("i", { staticClass: "fas fa-sign-out-alt" }),
  44578. _vm._v(" "),
  44579. !this.isZero(this.data.pickupdate)
  44580. ? _c(
  44581. "span",
  44582. {
  44583. staticClass: "dashed-underline",
  44584. attrs: {
  44585. "data-toggle": "tooltip",
  44586. "data-placement": "bottom",
  44587. title: this.getHRDate(this.data.pickupdate)
  44588. }
  44589. },
  44590. [
  44591. _vm._v(
  44592. "\n " +
  44593. _vm._s(
  44594. Math.floor(this.daysSinceToday(this.data.pickupdate))
  44595. ) +
  44596. " days ago\n "
  44597. )
  44598. ]
  44599. )
  44600. : _vm._e()
  44601. ]),
  44602. _vm._v(" "),
  44603. _c(
  44604. "button",
  44605. {
  44606. staticClass: "btn btn-primary",
  44607. attrs: {
  44608. type: "button",
  44609. "data-toggle": "modal",
  44610. "data-target": "#workordereditModal"
  44611. }
  44612. },
  44613. [_vm._v("Edit")]
  44614. )
  44615. ],
  44616. 1
  44617. )
  44618. }
  44619. var staticRenderFns = []
  44620. render._withStripped = true
  44621. /***/ }),
  44622. /***/ "./node_modules/vue-loader/lib/runtime/componentNormalizer.js":
  44623. /*!********************************************************************!*\
  44624. !*** ./node_modules/vue-loader/lib/runtime/componentNormalizer.js ***!
  44625. \********************************************************************/
  44626. /*! exports provided: default */
  44627. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  44628. "use strict";
  44629. __webpack_require__.r(__webpack_exports__);
  44630. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return normalizeComponent; });
  44631. /* globals __VUE_SSR_CONTEXT__ */
  44632. // IMPORTANT: Do NOT use ES2015 features in this file (except for modules).
  44633. // This module is a runtime utility for cleaner component module output and will
  44634. // be included in the final webpack user bundle.
  44635. function normalizeComponent (
  44636. scriptExports,
  44637. render,
  44638. staticRenderFns,
  44639. functionalTemplate,
  44640. injectStyles,
  44641. scopeId,
  44642. moduleIdentifier, /* server only */
  44643. shadowMode /* vue-cli only */
  44644. ) {
  44645. // Vue.extend constructor export interop
  44646. var options = typeof scriptExports === 'function'
  44647. ? scriptExports.options
  44648. : scriptExports
  44649. // render functions
  44650. if (render) {
  44651. options.render = render
  44652. options.staticRenderFns = staticRenderFns
  44653. options._compiled = true
  44654. }
  44655. // functional template
  44656. if (functionalTemplate) {
  44657. options.functional = true
  44658. }
  44659. // scopedId
  44660. if (scopeId) {
  44661. options._scopeId = 'data-v-' + scopeId
  44662. }
  44663. var hook
  44664. if (moduleIdentifier) { // server build
  44665. hook = function (context) {
  44666. // 2.3 injection
  44667. context =
  44668. context || // cached call
  44669. (this.$vnode && this.$vnode.ssrContext) || // stateful
  44670. (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional
  44671. // 2.2 with runInNewContext: true
  44672. if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
  44673. context = __VUE_SSR_CONTEXT__
  44674. }
  44675. // inject component styles
  44676. if (injectStyles) {
  44677. injectStyles.call(this, context)
  44678. }
  44679. // register component module identifier for async chunk inferrence
  44680. if (context && context._registeredComponents) {
  44681. context._registeredComponents.add(moduleIdentifier)
  44682. }
  44683. }
  44684. // used by ssr in case component is cached and beforeCreate
  44685. // never gets called
  44686. options._ssrRegister = hook
  44687. } else if (injectStyles) {
  44688. hook = shadowMode
  44689. ? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }
  44690. : injectStyles
  44691. }
  44692. if (hook) {
  44693. if (options.functional) {
  44694. // for template-only hot-reload because in that case the render fn doesn't
  44695. // go through the normalizer
  44696. options._injectStyles = hook
  44697. // register for functioal component in vue file
  44698. var originalRender = options.render
  44699. options.render = function renderWithStyleInjection (h, context) {
  44700. hook.call(context)
  44701. return originalRender(h, context)
  44702. }
  44703. } else {
  44704. // inject component registration as beforeCreate hook
  44705. var existing = options.beforeCreate
  44706. options.beforeCreate = existing
  44707. ? [].concat(existing, hook)
  44708. : [hook]
  44709. }
  44710. }
  44711. return {
  44712. exports: scriptExports,
  44713. options: options
  44714. }
  44715. }
  44716. /***/ }),
  44717. /***/ "./node_modules/vue/dist/vue.common.dev.js":
  44718. /*!*************************************************!*\
  44719. !*** ./node_modules/vue/dist/vue.common.dev.js ***!
  44720. \*************************************************/
  44721. /*! no static exports found */
  44722. /***/ (function(module, exports, __webpack_require__) {
  44723. "use strict";
  44724. /* WEBPACK VAR INJECTION */(function(global, setImmediate) {/*!
  44725. * Vue.js v2.6.11
  44726. * (c) 2014-2019 Evan You
  44727. * Released under the MIT License.
  44728. */
  44729. /* */
  44730. var emptyObject = Object.freeze({});
  44731. // These helpers produce better VM code in JS engines due to their
  44732. // explicitness and function inlining.
  44733. function isUndef (v) {
  44734. return v === undefined || v === null
  44735. }
  44736. function isDef (v) {
  44737. return v !== undefined && v !== null
  44738. }
  44739. function isTrue (v) {
  44740. return v === true
  44741. }
  44742. function isFalse (v) {
  44743. return v === false
  44744. }
  44745. /**
  44746. * Check if value is primitive.
  44747. */
  44748. function isPrimitive (value) {
  44749. return (
  44750. typeof value === 'string' ||
  44751. typeof value === 'number' ||
  44752. // $flow-disable-line
  44753. typeof value === 'symbol' ||
  44754. typeof value === 'boolean'
  44755. )
  44756. }
  44757. /**
  44758. * Quick object check - this is primarily used to tell
  44759. * Objects from primitive values when we know the value
  44760. * is a JSON-compliant type.
  44761. */
  44762. function isObject (obj) {
  44763. return obj !== null && typeof obj === 'object'
  44764. }
  44765. /**
  44766. * Get the raw type string of a value, e.g., [object Object].
  44767. */
  44768. var _toString = Object.prototype.toString;
  44769. function toRawType (value) {
  44770. return _toString.call(value).slice(8, -1)
  44771. }
  44772. /**
  44773. * Strict object type check. Only returns true
  44774. * for plain JavaScript objects.
  44775. */
  44776. function isPlainObject (obj) {
  44777. return _toString.call(obj) === '[object Object]'
  44778. }
  44779. function isRegExp (v) {
  44780. return _toString.call(v) === '[object RegExp]'
  44781. }
  44782. /**
  44783. * Check if val is a valid array index.
  44784. */
  44785. function isValidArrayIndex (val) {
  44786. var n = parseFloat(String(val));
  44787. return n >= 0 && Math.floor(n) === n && isFinite(val)
  44788. }
  44789. function isPromise (val) {
  44790. return (
  44791. isDef(val) &&
  44792. typeof val.then === 'function' &&
  44793. typeof val.catch === 'function'
  44794. )
  44795. }
  44796. /**
  44797. * Convert a value to a string that is actually rendered.
  44798. */
  44799. function toString (val) {
  44800. return val == null
  44801. ? ''
  44802. : Array.isArray(val) || (isPlainObject(val) && val.toString === _toString)
  44803. ? JSON.stringify(val, null, 2)
  44804. : String(val)
  44805. }
  44806. /**
  44807. * Convert an input value to a number for persistence.
  44808. * If the conversion fails, return original string.
  44809. */
  44810. function toNumber (val) {
  44811. var n = parseFloat(val);
  44812. return isNaN(n) ? val : n
  44813. }
  44814. /**
  44815. * Make a map and return a function for checking if a key
  44816. * is in that map.
  44817. */
  44818. function makeMap (
  44819. str,
  44820. expectsLowerCase
  44821. ) {
  44822. var map = Object.create(null);
  44823. var list = str.split(',');
  44824. for (var i = 0; i < list.length; i++) {
  44825. map[list[i]] = true;
  44826. }
  44827. return expectsLowerCase
  44828. ? function (val) { return map[val.toLowerCase()]; }
  44829. : function (val) { return map[val]; }
  44830. }
  44831. /**
  44832. * Check if a tag is a built-in tag.
  44833. */
  44834. var isBuiltInTag = makeMap('slot,component', true);
  44835. /**
  44836. * Check if an attribute is a reserved attribute.
  44837. */
  44838. var isReservedAttribute = makeMap('key,ref,slot,slot-scope,is');
  44839. /**
  44840. * Remove an item from an array.
  44841. */
  44842. function remove (arr, item) {
  44843. if (arr.length) {
  44844. var index = arr.indexOf(item);
  44845. if (index > -1) {
  44846. return arr.splice(index, 1)
  44847. }
  44848. }
  44849. }
  44850. /**
  44851. * Check whether an object has the property.
  44852. */
  44853. var hasOwnProperty = Object.prototype.hasOwnProperty;
  44854. function hasOwn (obj, key) {
  44855. return hasOwnProperty.call(obj, key)
  44856. }
  44857. /**
  44858. * Create a cached version of a pure function.
  44859. */
  44860. function cached (fn) {
  44861. var cache = Object.create(null);
  44862. return (function cachedFn (str) {
  44863. var hit = cache[str];
  44864. return hit || (cache[str] = fn(str))
  44865. })
  44866. }
  44867. /**
  44868. * Camelize a hyphen-delimited string.
  44869. */
  44870. var camelizeRE = /-(\w)/g;
  44871. var camelize = cached(function (str) {
  44872. return str.replace(camelizeRE, function (_, c) { return c ? c.toUpperCase() : ''; })
  44873. });
  44874. /**
  44875. * Capitalize a string.
  44876. */
  44877. var capitalize = cached(function (str) {
  44878. return str.charAt(0).toUpperCase() + str.slice(1)
  44879. });
  44880. /**
  44881. * Hyphenate a camelCase string.
  44882. */
  44883. var hyphenateRE = /\B([A-Z])/g;
  44884. var hyphenate = cached(function (str) {
  44885. return str.replace(hyphenateRE, '-$1').toLowerCase()
  44886. });
  44887. /**
  44888. * Simple bind polyfill for environments that do not support it,
  44889. * e.g., PhantomJS 1.x. Technically, we don't need this anymore
  44890. * since native bind is now performant enough in most browsers.
  44891. * But removing it would mean breaking code that was able to run in
  44892. * PhantomJS 1.x, so this must be kept for backward compatibility.
  44893. */
  44894. /* istanbul ignore next */
  44895. function polyfillBind (fn, ctx) {
  44896. function boundFn (a) {
  44897. var l = arguments.length;
  44898. return l
  44899. ? l > 1
  44900. ? fn.apply(ctx, arguments)
  44901. : fn.call(ctx, a)
  44902. : fn.call(ctx)
  44903. }
  44904. boundFn._length = fn.length;
  44905. return boundFn
  44906. }
  44907. function nativeBind (fn, ctx) {
  44908. return fn.bind(ctx)
  44909. }
  44910. var bind = Function.prototype.bind
  44911. ? nativeBind
  44912. : polyfillBind;
  44913. /**
  44914. * Convert an Array-like object to a real Array.
  44915. */
  44916. function toArray (list, start) {
  44917. start = start || 0;
  44918. var i = list.length - start;
  44919. var ret = new Array(i);
  44920. while (i--) {
  44921. ret[i] = list[i + start];
  44922. }
  44923. return ret
  44924. }
  44925. /**
  44926. * Mix properties into target object.
  44927. */
  44928. function extend (to, _from) {
  44929. for (var key in _from) {
  44930. to[key] = _from[key];
  44931. }
  44932. return to
  44933. }
  44934. /**
  44935. * Merge an Array of Objects into a single Object.
  44936. */
  44937. function toObject (arr) {
  44938. var res = {};
  44939. for (var i = 0; i < arr.length; i++) {
  44940. if (arr[i]) {
  44941. extend(res, arr[i]);
  44942. }
  44943. }
  44944. return res
  44945. }
  44946. /* eslint-disable no-unused-vars */
  44947. /**
  44948. * Perform no operation.
  44949. * Stubbing args to make Flow happy without leaving useless transpiled code
  44950. * with ...rest (https://flow.org/blog/2017/05/07/Strict-Function-Call-Arity/).
  44951. */
  44952. function noop (a, b, c) {}
  44953. /**
  44954. * Always return false.
  44955. */
  44956. var no = function (a, b, c) { return false; };
  44957. /* eslint-enable no-unused-vars */
  44958. /**
  44959. * Return the same value.
  44960. */
  44961. var identity = function (_) { return _; };
  44962. /**
  44963. * Generate a string containing static keys from compiler modules.
  44964. */
  44965. function genStaticKeys (modules) {
  44966. return modules.reduce(function (keys, m) {
  44967. return keys.concat(m.staticKeys || [])
  44968. }, []).join(',')
  44969. }
  44970. /**
  44971. * Check if two values are loosely equal - that is,
  44972. * if they are plain objects, do they have the same shape?
  44973. */
  44974. function looseEqual (a, b) {
  44975. if (a === b) { return true }
  44976. var isObjectA = isObject(a);
  44977. var isObjectB = isObject(b);
  44978. if (isObjectA && isObjectB) {
  44979. try {
  44980. var isArrayA = Array.isArray(a);
  44981. var isArrayB = Array.isArray(b);
  44982. if (isArrayA && isArrayB) {
  44983. return a.length === b.length && a.every(function (e, i) {
  44984. return looseEqual(e, b[i])
  44985. })
  44986. } else if (a instanceof Date && b instanceof Date) {
  44987. return a.getTime() === b.getTime()
  44988. } else if (!isArrayA && !isArrayB) {
  44989. var keysA = Object.keys(a);
  44990. var keysB = Object.keys(b);
  44991. return keysA.length === keysB.length && keysA.every(function (key) {
  44992. return looseEqual(a[key], b[key])
  44993. })
  44994. } else {
  44995. /* istanbul ignore next */
  44996. return false
  44997. }
  44998. } catch (e) {
  44999. /* istanbul ignore next */
  45000. return false
  45001. }
  45002. } else if (!isObjectA && !isObjectB) {
  45003. return String(a) === String(b)
  45004. } else {
  45005. return false
  45006. }
  45007. }
  45008. /**
  45009. * Return the first index at which a loosely equal value can be
  45010. * found in the array (if value is a plain object, the array must
  45011. * contain an object of the same shape), or -1 if it is not present.
  45012. */
  45013. function looseIndexOf (arr, val) {
  45014. for (var i = 0; i < arr.length; i++) {
  45015. if (looseEqual(arr[i], val)) { return i }
  45016. }
  45017. return -1
  45018. }
  45019. /**
  45020. * Ensure a function is called only once.
  45021. */
  45022. function once (fn) {
  45023. var called = false;
  45024. return function () {
  45025. if (!called) {
  45026. called = true;
  45027. fn.apply(this, arguments);
  45028. }
  45029. }
  45030. }
  45031. var SSR_ATTR = 'data-server-rendered';
  45032. var ASSET_TYPES = [
  45033. 'component',
  45034. 'directive',
  45035. 'filter'
  45036. ];
  45037. var LIFECYCLE_HOOKS = [
  45038. 'beforeCreate',
  45039. 'created',
  45040. 'beforeMount',
  45041. 'mounted',
  45042. 'beforeUpdate',
  45043. 'updated',
  45044. 'beforeDestroy',
  45045. 'destroyed',
  45046. 'activated',
  45047. 'deactivated',
  45048. 'errorCaptured',
  45049. 'serverPrefetch'
  45050. ];
  45051. /* */
  45052. var config = ({
  45053. /**
  45054. * Option merge strategies (used in core/util/options)
  45055. */
  45056. // $flow-disable-line
  45057. optionMergeStrategies: Object.create(null),
  45058. /**
  45059. * Whether to suppress warnings.
  45060. */
  45061. silent: false,
  45062. /**
  45063. * Show production mode tip message on boot?
  45064. */
  45065. productionTip: "development" !== 'production',
  45066. /**
  45067. * Whether to enable devtools
  45068. */
  45069. devtools: "development" !== 'production',
  45070. /**
  45071. * Whether to record perf
  45072. */
  45073. performance: false,
  45074. /**
  45075. * Error handler for watcher errors
  45076. */
  45077. errorHandler: null,
  45078. /**
  45079. * Warn handler for watcher warns
  45080. */
  45081. warnHandler: null,
  45082. /**
  45083. * Ignore certain custom elements
  45084. */
  45085. ignoredElements: [],
  45086. /**
  45087. * Custom user key aliases for v-on
  45088. */
  45089. // $flow-disable-line
  45090. keyCodes: Object.create(null),
  45091. /**
  45092. * Check if a tag is reserved so that it cannot be registered as a
  45093. * component. This is platform-dependent and may be overwritten.
  45094. */
  45095. isReservedTag: no,
  45096. /**
  45097. * Check if an attribute is reserved so that it cannot be used as a component
  45098. * prop. This is platform-dependent and may be overwritten.
  45099. */
  45100. isReservedAttr: no,
  45101. /**
  45102. * Check if a tag is an unknown element.
  45103. * Platform-dependent.
  45104. */
  45105. isUnknownElement: no,
  45106. /**
  45107. * Get the namespace of an element
  45108. */
  45109. getTagNamespace: noop,
  45110. /**
  45111. * Parse the real tag name for the specific platform.
  45112. */
  45113. parsePlatformTagName: identity,
  45114. /**
  45115. * Check if an attribute must be bound using property, e.g. value
  45116. * Platform-dependent.
  45117. */
  45118. mustUseProp: no,
  45119. /**
  45120. * Perform updates asynchronously. Intended to be used by Vue Test Utils
  45121. * This will significantly reduce performance if set to false.
  45122. */
  45123. async: true,
  45124. /**
  45125. * Exposed for legacy reasons
  45126. */
  45127. _lifecycleHooks: LIFECYCLE_HOOKS
  45128. });
  45129. /* */
  45130. /**
  45131. * unicode letters used for parsing html tags, component names and property paths.
  45132. * using https://www.w3.org/TR/html53/semantics-scripting.html#potentialcustomelementname
  45133. * skipping \u10000-\uEFFFF due to it freezing up PhantomJS
  45134. */
  45135. 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/;
  45136. /**
  45137. * Check if a string starts with $ or _
  45138. */
  45139. function isReserved (str) {
  45140. var c = (str + '').charCodeAt(0);
  45141. return c === 0x24 || c === 0x5F
  45142. }
  45143. /**
  45144. * Define a property.
  45145. */
  45146. function def (obj, key, val, enumerable) {
  45147. Object.defineProperty(obj, key, {
  45148. value: val,
  45149. enumerable: !!enumerable,
  45150. writable: true,
  45151. configurable: true
  45152. });
  45153. }
  45154. /**
  45155. * Parse simple path.
  45156. */
  45157. var bailRE = new RegExp(("[^" + (unicodeRegExp.source) + ".$_\\d]"));
  45158. function parsePath (path) {
  45159. if (bailRE.test(path)) {
  45160. return
  45161. }
  45162. var segments = path.split('.');
  45163. return function (obj) {
  45164. for (var i = 0; i < segments.length; i++) {
  45165. if (!obj) { return }
  45166. obj = obj[segments[i]];
  45167. }
  45168. return obj
  45169. }
  45170. }
  45171. /* */
  45172. // can we use __proto__?
  45173. var hasProto = '__proto__' in {};
  45174. // Browser environment sniffing
  45175. var inBrowser = typeof window !== 'undefined';
  45176. var inWeex = typeof WXEnvironment !== 'undefined' && !!WXEnvironment.platform;
  45177. var weexPlatform = inWeex && WXEnvironment.platform.toLowerCase();
  45178. var UA = inBrowser && window.navigator.userAgent.toLowerCase();
  45179. var isIE = UA && /msie|trident/.test(UA);
  45180. var isIE9 = UA && UA.indexOf('msie 9.0') > 0;
  45181. var isEdge = UA && UA.indexOf('edge/') > 0;
  45182. var isAndroid = (UA && UA.indexOf('android') > 0) || (weexPlatform === 'android');
  45183. var isIOS = (UA && /iphone|ipad|ipod|ios/.test(UA)) || (weexPlatform === 'ios');
  45184. var isChrome = UA && /chrome\/\d+/.test(UA) && !isEdge;
  45185. var isPhantomJS = UA && /phantomjs/.test(UA);
  45186. var isFF = UA && UA.match(/firefox\/(\d+)/);
  45187. // Firefox has a "watch" function on Object.prototype...
  45188. var nativeWatch = ({}).watch;
  45189. var supportsPassive = false;
  45190. if (inBrowser) {
  45191. try {
  45192. var opts = {};
  45193. Object.defineProperty(opts, 'passive', ({
  45194. get: function get () {
  45195. /* istanbul ignore next */
  45196. supportsPassive = true;
  45197. }
  45198. })); // https://github.com/facebook/flow/issues/285
  45199. window.addEventListener('test-passive', null, opts);
  45200. } catch (e) {}
  45201. }
  45202. // this needs to be lazy-evaled because vue may be required before
  45203. // vue-server-renderer can set VUE_ENV
  45204. var _isServer;
  45205. var isServerRendering = function () {
  45206. if (_isServer === undefined) {
  45207. /* istanbul ignore if */
  45208. if (!inBrowser && !inWeex && typeof global !== 'undefined') {
  45209. // detect presence of vue-server-renderer and avoid
  45210. // Webpack shimming the process
  45211. _isServer = global['process'] && global['process'].env.VUE_ENV === 'server';
  45212. } else {
  45213. _isServer = false;
  45214. }
  45215. }
  45216. return _isServer
  45217. };
  45218. // detect devtools
  45219. var devtools = inBrowser && window.__VUE_DEVTOOLS_GLOBAL_HOOK__;
  45220. /* istanbul ignore next */
  45221. function isNative (Ctor) {
  45222. return typeof Ctor === 'function' && /native code/.test(Ctor.toString())
  45223. }
  45224. var hasSymbol =
  45225. typeof Symbol !== 'undefined' && isNative(Symbol) &&
  45226. typeof Reflect !== 'undefined' && isNative(Reflect.ownKeys);
  45227. var _Set;
  45228. /* istanbul ignore if */ // $flow-disable-line
  45229. if (typeof Set !== 'undefined' && isNative(Set)) {
  45230. // use native Set when available.
  45231. _Set = Set;
  45232. } else {
  45233. // a non-standard Set polyfill that only works with primitive keys.
  45234. _Set = /*@__PURE__*/(function () {
  45235. function Set () {
  45236. this.set = Object.create(null);
  45237. }
  45238. Set.prototype.has = function has (key) {
  45239. return this.set[key] === true
  45240. };
  45241. Set.prototype.add = function add (key) {
  45242. this.set[key] = true;
  45243. };
  45244. Set.prototype.clear = function clear () {
  45245. this.set = Object.create(null);
  45246. };
  45247. return Set;
  45248. }());
  45249. }
  45250. /* */
  45251. var warn = noop;
  45252. var tip = noop;
  45253. var generateComponentTrace = (noop); // work around flow check
  45254. var formatComponentName = (noop);
  45255. {
  45256. var hasConsole = typeof console !== 'undefined';
  45257. var classifyRE = /(?:^|[-_])(\w)/g;
  45258. var classify = function (str) { return str
  45259. .replace(classifyRE, function (c) { return c.toUpperCase(); })
  45260. .replace(/[-_]/g, ''); };
  45261. warn = function (msg, vm) {
  45262. var trace = vm ? generateComponentTrace(vm) : '';
  45263. if (config.warnHandler) {
  45264. config.warnHandler.call(null, msg, vm, trace);
  45265. } else if (hasConsole && (!config.silent)) {
  45266. console.error(("[Vue warn]: " + msg + trace));
  45267. }
  45268. };
  45269. tip = function (msg, vm) {
  45270. if (hasConsole && (!config.silent)) {
  45271. console.warn("[Vue tip]: " + msg + (
  45272. vm ? generateComponentTrace(vm) : ''
  45273. ));
  45274. }
  45275. };
  45276. formatComponentName = function (vm, includeFile) {
  45277. if (vm.$root === vm) {
  45278. return '<Root>'
  45279. }
  45280. var options = typeof vm === 'function' && vm.cid != null
  45281. ? vm.options
  45282. : vm._isVue
  45283. ? vm.$options || vm.constructor.options
  45284. : vm;
  45285. var name = options.name || options._componentTag;
  45286. var file = options.__file;
  45287. if (!name && file) {
  45288. var match = file.match(/([^/\\]+)\.vue$/);
  45289. name = match && match[1];
  45290. }
  45291. return (
  45292. (name ? ("<" + (classify(name)) + ">") : "<Anonymous>") +
  45293. (file && includeFile !== false ? (" at " + file) : '')
  45294. )
  45295. };
  45296. var repeat = function (str, n) {
  45297. var res = '';
  45298. while (n) {
  45299. if (n % 2 === 1) { res += str; }
  45300. if (n > 1) { str += str; }
  45301. n >>= 1;
  45302. }
  45303. return res
  45304. };
  45305. generateComponentTrace = function (vm) {
  45306. if (vm._isVue && vm.$parent) {
  45307. var tree = [];
  45308. var currentRecursiveSequence = 0;
  45309. while (vm) {
  45310. if (tree.length > 0) {
  45311. var last = tree[tree.length - 1];
  45312. if (last.constructor === vm.constructor) {
  45313. currentRecursiveSequence++;
  45314. vm = vm.$parent;
  45315. continue
  45316. } else if (currentRecursiveSequence > 0) {
  45317. tree[tree.length - 1] = [last, currentRecursiveSequence];
  45318. currentRecursiveSequence = 0;
  45319. }
  45320. }
  45321. tree.push(vm);
  45322. vm = vm.$parent;
  45323. }
  45324. return '\n\nfound in\n\n' + tree
  45325. .map(function (vm, i) { return ("" + (i === 0 ? '---> ' : repeat(' ', 5 + i * 2)) + (Array.isArray(vm)
  45326. ? ((formatComponentName(vm[0])) + "... (" + (vm[1]) + " recursive calls)")
  45327. : formatComponentName(vm))); })
  45328. .join('\n')
  45329. } else {
  45330. return ("\n\n(found in " + (formatComponentName(vm)) + ")")
  45331. }
  45332. };
  45333. }
  45334. /* */
  45335. var uid = 0;
  45336. /**
  45337. * A dep is an observable that can have multiple
  45338. * directives subscribing to it.
  45339. */
  45340. var Dep = function Dep () {
  45341. this.id = uid++;
  45342. this.subs = [];
  45343. };
  45344. Dep.prototype.addSub = function addSub (sub) {
  45345. this.subs.push(sub);
  45346. };
  45347. Dep.prototype.removeSub = function removeSub (sub) {
  45348. remove(this.subs, sub);
  45349. };
  45350. Dep.prototype.depend = function depend () {
  45351. if (Dep.target) {
  45352. Dep.target.addDep(this);
  45353. }
  45354. };
  45355. Dep.prototype.notify = function notify () {
  45356. // stabilize the subscriber list first
  45357. var subs = this.subs.slice();
  45358. if (!config.async) {
  45359. // subs aren't sorted in scheduler if not running async
  45360. // we need to sort them now to make sure they fire in correct
  45361. // order
  45362. subs.sort(function (a, b) { return a.id - b.id; });
  45363. }
  45364. for (var i = 0, l = subs.length; i < l; i++) {
  45365. subs[i].update();
  45366. }
  45367. };
  45368. // The current target watcher being evaluated.
  45369. // This is globally unique because only one watcher
  45370. // can be evaluated at a time.
  45371. Dep.target = null;
  45372. var targetStack = [];
  45373. function pushTarget (target) {
  45374. targetStack.push(target);
  45375. Dep.target = target;
  45376. }
  45377. function popTarget () {
  45378. targetStack.pop();
  45379. Dep.target = targetStack[targetStack.length - 1];
  45380. }
  45381. /* */
  45382. var VNode = function VNode (
  45383. tag,
  45384. data,
  45385. children,
  45386. text,
  45387. elm,
  45388. context,
  45389. componentOptions,
  45390. asyncFactory
  45391. ) {
  45392. this.tag = tag;
  45393. this.data = data;
  45394. this.children = children;
  45395. this.text = text;
  45396. this.elm = elm;
  45397. this.ns = undefined;
  45398. this.context = context;
  45399. this.fnContext = undefined;
  45400. this.fnOptions = undefined;
  45401. this.fnScopeId = undefined;
  45402. this.key = data && data.key;
  45403. this.componentOptions = componentOptions;
  45404. this.componentInstance = undefined;
  45405. this.parent = undefined;
  45406. this.raw = false;
  45407. this.isStatic = false;
  45408. this.isRootInsert = true;
  45409. this.isComment = false;
  45410. this.isCloned = false;
  45411. this.isOnce = false;
  45412. this.asyncFactory = asyncFactory;
  45413. this.asyncMeta = undefined;
  45414. this.isAsyncPlaceholder = false;
  45415. };
  45416. var prototypeAccessors = { child: { configurable: true } };
  45417. // DEPRECATED: alias for componentInstance for backwards compat.
  45418. /* istanbul ignore next */
  45419. prototypeAccessors.child.get = function () {
  45420. return this.componentInstance
  45421. };
  45422. Object.defineProperties( VNode.prototype, prototypeAccessors );
  45423. var createEmptyVNode = function (text) {
  45424. if ( text === void 0 ) text = '';
  45425. var node = new VNode();
  45426. node.text = text;
  45427. node.isComment = true;
  45428. return node
  45429. };
  45430. function createTextVNode (val) {
  45431. return new VNode(undefined, undefined, undefined, String(val))
  45432. }
  45433. // optimized shallow clone
  45434. // used for static nodes and slot nodes because they may be reused across
  45435. // multiple renders, cloning them avoids errors when DOM manipulations rely
  45436. // on their elm reference.
  45437. function cloneVNode (vnode) {
  45438. var cloned = new VNode(
  45439. vnode.tag,
  45440. vnode.data,
  45441. // #7975
  45442. // clone children array to avoid mutating original in case of cloning
  45443. // a child.
  45444. vnode.children && vnode.children.slice(),
  45445. vnode.text,
  45446. vnode.elm,
  45447. vnode.context,
  45448. vnode.componentOptions,
  45449. vnode.asyncFactory
  45450. );
  45451. cloned.ns = vnode.ns;
  45452. cloned.isStatic = vnode.isStatic;
  45453. cloned.key = vnode.key;
  45454. cloned.isComment = vnode.isComment;
  45455. cloned.fnContext = vnode.fnContext;
  45456. cloned.fnOptions = vnode.fnOptions;
  45457. cloned.fnScopeId = vnode.fnScopeId;
  45458. cloned.asyncMeta = vnode.asyncMeta;
  45459. cloned.isCloned = true;
  45460. return cloned
  45461. }
  45462. /*
  45463. * not type checking this file because flow doesn't play well with
  45464. * dynamically accessing methods on Array prototype
  45465. */
  45466. var arrayProto = Array.prototype;
  45467. var arrayMethods = Object.create(arrayProto);
  45468. var methodsToPatch = [
  45469. 'push',
  45470. 'pop',
  45471. 'shift',
  45472. 'unshift',
  45473. 'splice',
  45474. 'sort',
  45475. 'reverse'
  45476. ];
  45477. /**
  45478. * Intercept mutating methods and emit events
  45479. */
  45480. methodsToPatch.forEach(function (method) {
  45481. // cache original method
  45482. var original = arrayProto[method];
  45483. def(arrayMethods, method, function mutator () {
  45484. var args = [], len = arguments.length;
  45485. while ( len-- ) args[ len ] = arguments[ len ];
  45486. var result = original.apply(this, args);
  45487. var ob = this.__ob__;
  45488. var inserted;
  45489. switch (method) {
  45490. case 'push':
  45491. case 'unshift':
  45492. inserted = args;
  45493. break
  45494. case 'splice':
  45495. inserted = args.slice(2);
  45496. break
  45497. }
  45498. if (inserted) { ob.observeArray(inserted); }
  45499. // notify change
  45500. ob.dep.notify();
  45501. return result
  45502. });
  45503. });
  45504. /* */
  45505. var arrayKeys = Object.getOwnPropertyNames(arrayMethods);
  45506. /**
  45507. * In some cases we may want to disable observation inside a component's
  45508. * update computation.
  45509. */
  45510. var shouldObserve = true;
  45511. function toggleObserving (value) {
  45512. shouldObserve = value;
  45513. }
  45514. /**
  45515. * Observer class that is attached to each observed
  45516. * object. Once attached, the observer converts the target
  45517. * object's property keys into getter/setters that
  45518. * collect dependencies and dispatch updates.
  45519. */
  45520. var Observer = function Observer (value) {
  45521. this.value = value;
  45522. this.dep = new Dep();
  45523. this.vmCount = 0;
  45524. def(value, '__ob__', this);
  45525. if (Array.isArray(value)) {
  45526. if (hasProto) {
  45527. protoAugment(value, arrayMethods);
  45528. } else {
  45529. copyAugment(value, arrayMethods, arrayKeys);
  45530. }
  45531. this.observeArray(value);
  45532. } else {
  45533. this.walk(value);
  45534. }
  45535. };
  45536. /**
  45537. * Walk through all properties and convert them into
  45538. * getter/setters. This method should only be called when
  45539. * value type is Object.
  45540. */
  45541. Observer.prototype.walk = function walk (obj) {
  45542. var keys = Object.keys(obj);
  45543. for (var i = 0; i < keys.length; i++) {
  45544. defineReactive$$1(obj, keys[i]);
  45545. }
  45546. };
  45547. /**
  45548. * Observe a list of Array items.
  45549. */
  45550. Observer.prototype.observeArray = function observeArray (items) {
  45551. for (var i = 0, l = items.length; i < l; i++) {
  45552. observe(items[i]);
  45553. }
  45554. };
  45555. // helpers
  45556. /**
  45557. * Augment a target Object or Array by intercepting
  45558. * the prototype chain using __proto__
  45559. */
  45560. function protoAugment (target, src) {
  45561. /* eslint-disable no-proto */
  45562. target.__proto__ = src;
  45563. /* eslint-enable no-proto */
  45564. }
  45565. /**
  45566. * Augment a target Object or Array by defining
  45567. * hidden properties.
  45568. */
  45569. /* istanbul ignore next */
  45570. function copyAugment (target, src, keys) {
  45571. for (var i = 0, l = keys.length; i < l; i++) {
  45572. var key = keys[i];
  45573. def(target, key, src[key]);
  45574. }
  45575. }
  45576. /**
  45577. * Attempt to create an observer instance for a value,
  45578. * returns the new observer if successfully observed,
  45579. * or the existing observer if the value already has one.
  45580. */
  45581. function observe (value, asRootData) {
  45582. if (!isObject(value) || value instanceof VNode) {
  45583. return
  45584. }
  45585. var ob;
  45586. if (hasOwn(value, '__ob__') && value.__ob__ instanceof Observer) {
  45587. ob = value.__ob__;
  45588. } else if (
  45589. shouldObserve &&
  45590. !isServerRendering() &&
  45591. (Array.isArray(value) || isPlainObject(value)) &&
  45592. Object.isExtensible(value) &&
  45593. !value._isVue
  45594. ) {
  45595. ob = new Observer(value);
  45596. }
  45597. if (asRootData && ob) {
  45598. ob.vmCount++;
  45599. }
  45600. return ob
  45601. }
  45602. /**
  45603. * Define a reactive property on an Object.
  45604. */
  45605. function defineReactive$$1 (
  45606. obj,
  45607. key,
  45608. val,
  45609. customSetter,
  45610. shallow
  45611. ) {
  45612. var dep = new Dep();
  45613. var property = Object.getOwnPropertyDescriptor(obj, key);
  45614. if (property && property.configurable === false) {
  45615. return
  45616. }
  45617. // cater for pre-defined getter/setters
  45618. var getter = property && property.get;
  45619. var setter = property && property.set;
  45620. if ((!getter || setter) && arguments.length === 2) {
  45621. val = obj[key];
  45622. }
  45623. var childOb = !shallow && observe(val);
  45624. Object.defineProperty(obj, key, {
  45625. enumerable: true,
  45626. configurable: true,
  45627. get: function reactiveGetter () {
  45628. var value = getter ? getter.call(obj) : val;
  45629. if (Dep.target) {
  45630. dep.depend();
  45631. if (childOb) {
  45632. childOb.dep.depend();
  45633. if (Array.isArray(value)) {
  45634. dependArray(value);
  45635. }
  45636. }
  45637. }
  45638. return value
  45639. },
  45640. set: function reactiveSetter (newVal) {
  45641. var value = getter ? getter.call(obj) : val;
  45642. /* eslint-disable no-self-compare */
  45643. if (newVal === value || (newVal !== newVal && value !== value)) {
  45644. return
  45645. }
  45646. /* eslint-enable no-self-compare */
  45647. if (customSetter) {
  45648. customSetter();
  45649. }
  45650. // #7981: for accessor properties without setter
  45651. if (getter && !setter) { return }
  45652. if (setter) {
  45653. setter.call(obj, newVal);
  45654. } else {
  45655. val = newVal;
  45656. }
  45657. childOb = !shallow && observe(newVal);
  45658. dep.notify();
  45659. }
  45660. });
  45661. }
  45662. /**
  45663. * Set a property on an object. Adds the new property and
  45664. * triggers change notification if the property doesn't
  45665. * already exist.
  45666. */
  45667. function set (target, key, val) {
  45668. if (isUndef(target) || isPrimitive(target)
  45669. ) {
  45670. warn(("Cannot set reactive property on undefined, null, or primitive value: " + ((target))));
  45671. }
  45672. if (Array.isArray(target) && isValidArrayIndex(key)) {
  45673. target.length = Math.max(target.length, key);
  45674. target.splice(key, 1, val);
  45675. return val
  45676. }
  45677. if (key in target && !(key in Object.prototype)) {
  45678. target[key] = val;
  45679. return val
  45680. }
  45681. var ob = (target).__ob__;
  45682. if (target._isVue || (ob && ob.vmCount)) {
  45683. warn(
  45684. 'Avoid adding reactive properties to a Vue instance or its root $data ' +
  45685. 'at runtime - declare it upfront in the data option.'
  45686. );
  45687. return val
  45688. }
  45689. if (!ob) {
  45690. target[key] = val;
  45691. return val
  45692. }
  45693. defineReactive$$1(ob.value, key, val);
  45694. ob.dep.notify();
  45695. return val
  45696. }
  45697. /**
  45698. * Delete a property and trigger change if necessary.
  45699. */
  45700. function del (target, key) {
  45701. if (isUndef(target) || isPrimitive(target)
  45702. ) {
  45703. warn(("Cannot delete reactive property on undefined, null, or primitive value: " + ((target))));
  45704. }
  45705. if (Array.isArray(target) && isValidArrayIndex(key)) {
  45706. target.splice(key, 1);
  45707. return
  45708. }
  45709. var ob = (target).__ob__;
  45710. if (target._isVue || (ob && ob.vmCount)) {
  45711. warn(
  45712. 'Avoid deleting properties on a Vue instance or its root $data ' +
  45713. '- just set it to null.'
  45714. );
  45715. return
  45716. }
  45717. if (!hasOwn(target, key)) {
  45718. return
  45719. }
  45720. delete target[key];
  45721. if (!ob) {
  45722. return
  45723. }
  45724. ob.dep.notify();
  45725. }
  45726. /**
  45727. * Collect dependencies on array elements when the array is touched, since
  45728. * we cannot intercept array element access like property getters.
  45729. */
  45730. function dependArray (value) {
  45731. for (var e = (void 0), i = 0, l = value.length; i < l; i++) {
  45732. e = value[i];
  45733. e && e.__ob__ && e.__ob__.dep.depend();
  45734. if (Array.isArray(e)) {
  45735. dependArray(e);
  45736. }
  45737. }
  45738. }
  45739. /* */
  45740. /**
  45741. * Option overwriting strategies are functions that handle
  45742. * how to merge a parent option value and a child option
  45743. * value into the final value.
  45744. */
  45745. var strats = config.optionMergeStrategies;
  45746. /**
  45747. * Options with restrictions
  45748. */
  45749. {
  45750. strats.el = strats.propsData = function (parent, child, vm, key) {
  45751. if (!vm) {
  45752. warn(
  45753. "option \"" + key + "\" can only be used during instance " +
  45754. 'creation with the `new` keyword.'
  45755. );
  45756. }
  45757. return defaultStrat(parent, child)
  45758. };
  45759. }
  45760. /**
  45761. * Helper that recursively merges two data objects together.
  45762. */
  45763. function mergeData (to, from) {
  45764. if (!from) { return to }
  45765. var key, toVal, fromVal;
  45766. var keys = hasSymbol
  45767. ? Reflect.ownKeys(from)
  45768. : Object.keys(from);
  45769. for (var i = 0; i < keys.length; i++) {
  45770. key = keys[i];
  45771. // in case the object is already observed...
  45772. if (key === '__ob__') { continue }
  45773. toVal = to[key];
  45774. fromVal = from[key];
  45775. if (!hasOwn(to, key)) {
  45776. set(to, key, fromVal);
  45777. } else if (
  45778. toVal !== fromVal &&
  45779. isPlainObject(toVal) &&
  45780. isPlainObject(fromVal)
  45781. ) {
  45782. mergeData(toVal, fromVal);
  45783. }
  45784. }
  45785. return to
  45786. }
  45787. /**
  45788. * Data
  45789. */
  45790. function mergeDataOrFn (
  45791. parentVal,
  45792. childVal,
  45793. vm
  45794. ) {
  45795. if (!vm) {
  45796. // in a Vue.extend merge, both should be functions
  45797. if (!childVal) {
  45798. return parentVal
  45799. }
  45800. if (!parentVal) {
  45801. return childVal
  45802. }
  45803. // when parentVal & childVal are both present,
  45804. // we need to return a function that returns the
  45805. // merged result of both functions... no need to
  45806. // check if parentVal is a function here because
  45807. // it has to be a function to pass previous merges.
  45808. return function mergedDataFn () {
  45809. return mergeData(
  45810. typeof childVal === 'function' ? childVal.call(this, this) : childVal,
  45811. typeof parentVal === 'function' ? parentVal.call(this, this) : parentVal
  45812. )
  45813. }
  45814. } else {
  45815. return function mergedInstanceDataFn () {
  45816. // instance merge
  45817. var instanceData = typeof childVal === 'function'
  45818. ? childVal.call(vm, vm)
  45819. : childVal;
  45820. var defaultData = typeof parentVal === 'function'
  45821. ? parentVal.call(vm, vm)
  45822. : parentVal;
  45823. if (instanceData) {
  45824. return mergeData(instanceData, defaultData)
  45825. } else {
  45826. return defaultData
  45827. }
  45828. }
  45829. }
  45830. }
  45831. strats.data = function (
  45832. parentVal,
  45833. childVal,
  45834. vm
  45835. ) {
  45836. if (!vm) {
  45837. if (childVal && typeof childVal !== 'function') {
  45838. warn(
  45839. 'The "data" option should be a function ' +
  45840. 'that returns a per-instance value in component ' +
  45841. 'definitions.',
  45842. vm
  45843. );
  45844. return parentVal
  45845. }
  45846. return mergeDataOrFn(parentVal, childVal)
  45847. }
  45848. return mergeDataOrFn(parentVal, childVal, vm)
  45849. };
  45850. /**
  45851. * Hooks and props are merged as arrays.
  45852. */
  45853. function mergeHook (
  45854. parentVal,
  45855. childVal
  45856. ) {
  45857. var res = childVal
  45858. ? parentVal
  45859. ? parentVal.concat(childVal)
  45860. : Array.isArray(childVal)
  45861. ? childVal
  45862. : [childVal]
  45863. : parentVal;
  45864. return res
  45865. ? dedupeHooks(res)
  45866. : res
  45867. }
  45868. function dedupeHooks (hooks) {
  45869. var res = [];
  45870. for (var i = 0; i < hooks.length; i++) {
  45871. if (res.indexOf(hooks[i]) === -1) {
  45872. res.push(hooks[i]);
  45873. }
  45874. }
  45875. return res
  45876. }
  45877. LIFECYCLE_HOOKS.forEach(function (hook) {
  45878. strats[hook] = mergeHook;
  45879. });
  45880. /**
  45881. * Assets
  45882. *
  45883. * When a vm is present (instance creation), we need to do
  45884. * a three-way merge between constructor options, instance
  45885. * options and parent options.
  45886. */
  45887. function mergeAssets (
  45888. parentVal,
  45889. childVal,
  45890. vm,
  45891. key
  45892. ) {
  45893. var res = Object.create(parentVal || null);
  45894. if (childVal) {
  45895. assertObjectType(key, childVal, vm);
  45896. return extend(res, childVal)
  45897. } else {
  45898. return res
  45899. }
  45900. }
  45901. ASSET_TYPES.forEach(function (type) {
  45902. strats[type + 's'] = mergeAssets;
  45903. });
  45904. /**
  45905. * Watchers.
  45906. *
  45907. * Watchers hashes should not overwrite one
  45908. * another, so we merge them as arrays.
  45909. */
  45910. strats.watch = function (
  45911. parentVal,
  45912. childVal,
  45913. vm,
  45914. key
  45915. ) {
  45916. // work around Firefox's Object.prototype.watch...
  45917. if (parentVal === nativeWatch) { parentVal = undefined; }
  45918. if (childVal === nativeWatch) { childVal = undefined; }
  45919. /* istanbul ignore if */
  45920. if (!childVal) { return Object.create(parentVal || null) }
  45921. {
  45922. assertObjectType(key, childVal, vm);
  45923. }
  45924. if (!parentVal) { return childVal }
  45925. var ret = {};
  45926. extend(ret, parentVal);
  45927. for (var key$1 in childVal) {
  45928. var parent = ret[key$1];
  45929. var child = childVal[key$1];
  45930. if (parent && !Array.isArray(parent)) {
  45931. parent = [parent];
  45932. }
  45933. ret[key$1] = parent
  45934. ? parent.concat(child)
  45935. : Array.isArray(child) ? child : [child];
  45936. }
  45937. return ret
  45938. };
  45939. /**
  45940. * Other object hashes.
  45941. */
  45942. strats.props =
  45943. strats.methods =
  45944. strats.inject =
  45945. strats.computed = function (
  45946. parentVal,
  45947. childVal,
  45948. vm,
  45949. key
  45950. ) {
  45951. if (childVal && "development" !== 'production') {
  45952. assertObjectType(key, childVal, vm);
  45953. }
  45954. if (!parentVal) { return childVal }
  45955. var ret = Object.create(null);
  45956. extend(ret, parentVal);
  45957. if (childVal) { extend(ret, childVal); }
  45958. return ret
  45959. };
  45960. strats.provide = mergeDataOrFn;
  45961. /**
  45962. * Default strategy.
  45963. */
  45964. var defaultStrat = function (parentVal, childVal) {
  45965. return childVal === undefined
  45966. ? parentVal
  45967. : childVal
  45968. };
  45969. /**
  45970. * Validate component names
  45971. */
  45972. function checkComponents (options) {
  45973. for (var key in options.components) {
  45974. validateComponentName(key);
  45975. }
  45976. }
  45977. function validateComponentName (name) {
  45978. if (!new RegExp(("^[a-zA-Z][\\-\\.0-9_" + (unicodeRegExp.source) + "]*$")).test(name)) {
  45979. warn(
  45980. 'Invalid component name: "' + name + '". Component names ' +
  45981. 'should conform to valid custom element name in html5 specification.'
  45982. );
  45983. }
  45984. if (isBuiltInTag(name) || config.isReservedTag(name)) {
  45985. warn(
  45986. 'Do not use built-in or reserved HTML elements as component ' +
  45987. 'id: ' + name
  45988. );
  45989. }
  45990. }
  45991. /**
  45992. * Ensure all props option syntax are normalized into the
  45993. * Object-based format.
  45994. */
  45995. function normalizeProps (options, vm) {
  45996. var props = options.props;
  45997. if (!props) { return }
  45998. var res = {};
  45999. var i, val, name;
  46000. if (Array.isArray(props)) {
  46001. i = props.length;
  46002. while (i--) {
  46003. val = props[i];
  46004. if (typeof val === 'string') {
  46005. name = camelize(val);
  46006. res[name] = { type: null };
  46007. } else {
  46008. warn('props must be strings when using array syntax.');
  46009. }
  46010. }
  46011. } else if (isPlainObject(props)) {
  46012. for (var key in props) {
  46013. val = props[key];
  46014. name = camelize(key);
  46015. res[name] = isPlainObject(val)
  46016. ? val
  46017. : { type: val };
  46018. }
  46019. } else {
  46020. warn(
  46021. "Invalid value for option \"props\": expected an Array or an Object, " +
  46022. "but got " + (toRawType(props)) + ".",
  46023. vm
  46024. );
  46025. }
  46026. options.props = res;
  46027. }
  46028. /**
  46029. * Normalize all injections into Object-based format
  46030. */
  46031. function normalizeInject (options, vm) {
  46032. var inject = options.inject;
  46033. if (!inject) { return }
  46034. var normalized = options.inject = {};
  46035. if (Array.isArray(inject)) {
  46036. for (var i = 0; i < inject.length; i++) {
  46037. normalized[inject[i]] = { from: inject[i] };
  46038. }
  46039. } else if (isPlainObject(inject)) {
  46040. for (var key in inject) {
  46041. var val = inject[key];
  46042. normalized[key] = isPlainObject(val)
  46043. ? extend({ from: key }, val)
  46044. : { from: val };
  46045. }
  46046. } else {
  46047. warn(
  46048. "Invalid value for option \"inject\": expected an Array or an Object, " +
  46049. "but got " + (toRawType(inject)) + ".",
  46050. vm
  46051. );
  46052. }
  46053. }
  46054. /**
  46055. * Normalize raw function directives into object format.
  46056. */
  46057. function normalizeDirectives (options) {
  46058. var dirs = options.directives;
  46059. if (dirs) {
  46060. for (var key in dirs) {
  46061. var def$$1 = dirs[key];
  46062. if (typeof def$$1 === 'function') {
  46063. dirs[key] = { bind: def$$1, update: def$$1 };
  46064. }
  46065. }
  46066. }
  46067. }
  46068. function assertObjectType (name, value, vm) {
  46069. if (!isPlainObject(value)) {
  46070. warn(
  46071. "Invalid value for option \"" + name + "\": expected an Object, " +
  46072. "but got " + (toRawType(value)) + ".",
  46073. vm
  46074. );
  46075. }
  46076. }
  46077. /**
  46078. * Merge two option objects into a new one.
  46079. * Core utility used in both instantiation and inheritance.
  46080. */
  46081. function mergeOptions (
  46082. parent,
  46083. child,
  46084. vm
  46085. ) {
  46086. {
  46087. checkComponents(child);
  46088. }
  46089. if (typeof child === 'function') {
  46090. child = child.options;
  46091. }
  46092. normalizeProps(child, vm);
  46093. normalizeInject(child, vm);
  46094. normalizeDirectives(child);
  46095. // Apply extends and mixins on the child options,
  46096. // but only if it is a raw options object that isn't
  46097. // the result of another mergeOptions call.
  46098. // Only merged options has the _base property.
  46099. if (!child._base) {
  46100. if (child.extends) {
  46101. parent = mergeOptions(parent, child.extends, vm);
  46102. }
  46103. if (child.mixins) {
  46104. for (var i = 0, l = child.mixins.length; i < l; i++) {
  46105. parent = mergeOptions(parent, child.mixins[i], vm);
  46106. }
  46107. }
  46108. }
  46109. var options = {};
  46110. var key;
  46111. for (key in parent) {
  46112. mergeField(key);
  46113. }
  46114. for (key in child) {
  46115. if (!hasOwn(parent, key)) {
  46116. mergeField(key);
  46117. }
  46118. }
  46119. function mergeField (key) {
  46120. var strat = strats[key] || defaultStrat;
  46121. options[key] = strat(parent[key], child[key], vm, key);
  46122. }
  46123. return options
  46124. }
  46125. /**
  46126. * Resolve an asset.
  46127. * This function is used because child instances need access
  46128. * to assets defined in its ancestor chain.
  46129. */
  46130. function resolveAsset (
  46131. options,
  46132. type,
  46133. id,
  46134. warnMissing
  46135. ) {
  46136. /* istanbul ignore if */
  46137. if (typeof id !== 'string') {
  46138. return
  46139. }
  46140. var assets = options[type];
  46141. // check local registration variations first
  46142. if (hasOwn(assets, id)) { return assets[id] }
  46143. var camelizedId = camelize(id);
  46144. if (hasOwn(assets, camelizedId)) { return assets[camelizedId] }
  46145. var PascalCaseId = capitalize(camelizedId);
  46146. if (hasOwn(assets, PascalCaseId)) { return assets[PascalCaseId] }
  46147. // fallback to prototype chain
  46148. var res = assets[id] || assets[camelizedId] || assets[PascalCaseId];
  46149. if (warnMissing && !res) {
  46150. warn(
  46151. 'Failed to resolve ' + type.slice(0, -1) + ': ' + id,
  46152. options
  46153. );
  46154. }
  46155. return res
  46156. }
  46157. /* */
  46158. function validateProp (
  46159. key,
  46160. propOptions,
  46161. propsData,
  46162. vm
  46163. ) {
  46164. var prop = propOptions[key];
  46165. var absent = !hasOwn(propsData, key);
  46166. var value = propsData[key];
  46167. // boolean casting
  46168. var booleanIndex = getTypeIndex(Boolean, prop.type);
  46169. if (booleanIndex > -1) {
  46170. if (absent && !hasOwn(prop, 'default')) {
  46171. value = false;
  46172. } else if (value === '' || value === hyphenate(key)) {
  46173. // only cast empty string / same name to boolean if
  46174. // boolean has higher priority
  46175. var stringIndex = getTypeIndex(String, prop.type);
  46176. if (stringIndex < 0 || booleanIndex < stringIndex) {
  46177. value = true;
  46178. }
  46179. }
  46180. }
  46181. // check default value
  46182. if (value === undefined) {
  46183. value = getPropDefaultValue(vm, prop, key);
  46184. // since the default value is a fresh copy,
  46185. // make sure to observe it.
  46186. var prevShouldObserve = shouldObserve;
  46187. toggleObserving(true);
  46188. observe(value);
  46189. toggleObserving(prevShouldObserve);
  46190. }
  46191. {
  46192. assertProp(prop, key, value, vm, absent);
  46193. }
  46194. return value
  46195. }
  46196. /**
  46197. * Get the default value of a prop.
  46198. */
  46199. function getPropDefaultValue (vm, prop, key) {
  46200. // no default, return undefined
  46201. if (!hasOwn(prop, 'default')) {
  46202. return undefined
  46203. }
  46204. var def = prop.default;
  46205. // warn against non-factory defaults for Object & Array
  46206. if (isObject(def)) {
  46207. warn(
  46208. 'Invalid default value for prop "' + key + '": ' +
  46209. 'Props with type Object/Array must use a factory function ' +
  46210. 'to return the default value.',
  46211. vm
  46212. );
  46213. }
  46214. // the raw prop value was also undefined from previous render,
  46215. // return previous default value to avoid unnecessary watcher trigger
  46216. if (vm && vm.$options.propsData &&
  46217. vm.$options.propsData[key] === undefined &&
  46218. vm._props[key] !== undefined
  46219. ) {
  46220. return vm._props[key]
  46221. }
  46222. // call factory function for non-Function types
  46223. // a value is Function if its prototype is function even across different execution context
  46224. return typeof def === 'function' && getType(prop.type) !== 'Function'
  46225. ? def.call(vm)
  46226. : def
  46227. }
  46228. /**
  46229. * Assert whether a prop is valid.
  46230. */
  46231. function assertProp (
  46232. prop,
  46233. name,
  46234. value,
  46235. vm,
  46236. absent
  46237. ) {
  46238. if (prop.required && absent) {
  46239. warn(
  46240. 'Missing required prop: "' + name + '"',
  46241. vm
  46242. );
  46243. return
  46244. }
  46245. if (value == null && !prop.required) {
  46246. return
  46247. }
  46248. var type = prop.type;
  46249. var valid = !type || type === true;
  46250. var expectedTypes = [];
  46251. if (type) {
  46252. if (!Array.isArray(type)) {
  46253. type = [type];
  46254. }
  46255. for (var i = 0; i < type.length && !valid; i++) {
  46256. var assertedType = assertType(value, type[i]);
  46257. expectedTypes.push(assertedType.expectedType || '');
  46258. valid = assertedType.valid;
  46259. }
  46260. }
  46261. if (!valid) {
  46262. warn(
  46263. getInvalidTypeMessage(name, value, expectedTypes),
  46264. vm
  46265. );
  46266. return
  46267. }
  46268. var validator = prop.validator;
  46269. if (validator) {
  46270. if (!validator(value)) {
  46271. warn(
  46272. 'Invalid prop: custom validator check failed for prop "' + name + '".',
  46273. vm
  46274. );
  46275. }
  46276. }
  46277. }
  46278. var simpleCheckRE = /^(String|Number|Boolean|Function|Symbol)$/;
  46279. function assertType (value, type) {
  46280. var valid;
  46281. var expectedType = getType(type);
  46282. if (simpleCheckRE.test(expectedType)) {
  46283. var t = typeof value;
  46284. valid = t === expectedType.toLowerCase();
  46285. // for primitive wrapper objects
  46286. if (!valid && t === 'object') {
  46287. valid = value instanceof type;
  46288. }
  46289. } else if (expectedType === 'Object') {
  46290. valid = isPlainObject(value);
  46291. } else if (expectedType === 'Array') {
  46292. valid = Array.isArray(value);
  46293. } else {
  46294. valid = value instanceof type;
  46295. }
  46296. return {
  46297. valid: valid,
  46298. expectedType: expectedType
  46299. }
  46300. }
  46301. /**
  46302. * Use function string name to check built-in types,
  46303. * because a simple equality check will fail when running
  46304. * across different vms / iframes.
  46305. */
  46306. function getType (fn) {
  46307. var match = fn && fn.toString().match(/^\s*function (\w+)/);
  46308. return match ? match[1] : ''
  46309. }
  46310. function isSameType (a, b) {
  46311. return getType(a) === getType(b)
  46312. }
  46313. function getTypeIndex (type, expectedTypes) {
  46314. if (!Array.isArray(expectedTypes)) {
  46315. return isSameType(expectedTypes, type) ? 0 : -1
  46316. }
  46317. for (var i = 0, len = expectedTypes.length; i < len; i++) {
  46318. if (isSameType(expectedTypes[i], type)) {
  46319. return i
  46320. }
  46321. }
  46322. return -1
  46323. }
  46324. function getInvalidTypeMessage (name, value, expectedTypes) {
  46325. var message = "Invalid prop: type check failed for prop \"" + name + "\"." +
  46326. " Expected " + (expectedTypes.map(capitalize).join(', '));
  46327. var expectedType = expectedTypes[0];
  46328. var receivedType = toRawType(value);
  46329. var expectedValue = styleValue(value, expectedType);
  46330. var receivedValue = styleValue(value, receivedType);
  46331. // check if we need to specify expected value
  46332. if (expectedTypes.length === 1 &&
  46333. isExplicable(expectedType) &&
  46334. !isBoolean(expectedType, receivedType)) {
  46335. message += " with value " + expectedValue;
  46336. }
  46337. message += ", got " + receivedType + " ";
  46338. // check if we need to specify received value
  46339. if (isExplicable(receivedType)) {
  46340. message += "with value " + receivedValue + ".";
  46341. }
  46342. return message
  46343. }
  46344. function styleValue (value, type) {
  46345. if (type === 'String') {
  46346. return ("\"" + value + "\"")
  46347. } else if (type === 'Number') {
  46348. return ("" + (Number(value)))
  46349. } else {
  46350. return ("" + value)
  46351. }
  46352. }
  46353. function isExplicable (value) {
  46354. var explicitTypes = ['string', 'number', 'boolean'];
  46355. return explicitTypes.some(function (elem) { return value.toLowerCase() === elem; })
  46356. }
  46357. function isBoolean () {
  46358. var args = [], len = arguments.length;
  46359. while ( len-- ) args[ len ] = arguments[ len ];
  46360. return args.some(function (elem) { return elem.toLowerCase() === 'boolean'; })
  46361. }
  46362. /* */
  46363. function handleError (err, vm, info) {
  46364. // Deactivate deps tracking while processing error handler to avoid possible infinite rendering.
  46365. // See: https://github.com/vuejs/vuex/issues/1505
  46366. pushTarget();
  46367. try {
  46368. if (vm) {
  46369. var cur = vm;
  46370. while ((cur = cur.$parent)) {
  46371. var hooks = cur.$options.errorCaptured;
  46372. if (hooks) {
  46373. for (var i = 0; i < hooks.length; i++) {
  46374. try {
  46375. var capture = hooks[i].call(cur, err, vm, info) === false;
  46376. if (capture) { return }
  46377. } catch (e) {
  46378. globalHandleError(e, cur, 'errorCaptured hook');
  46379. }
  46380. }
  46381. }
  46382. }
  46383. }
  46384. globalHandleError(err, vm, info);
  46385. } finally {
  46386. popTarget();
  46387. }
  46388. }
  46389. function invokeWithErrorHandling (
  46390. handler,
  46391. context,
  46392. args,
  46393. vm,
  46394. info
  46395. ) {
  46396. var res;
  46397. try {
  46398. res = args ? handler.apply(context, args) : handler.call(context);
  46399. if (res && !res._isVue && isPromise(res) && !res._handled) {
  46400. res.catch(function (e) { return handleError(e, vm, info + " (Promise/async)"); });
  46401. // issue #9511
  46402. // avoid catch triggering multiple times when nested calls
  46403. res._handled = true;
  46404. }
  46405. } catch (e) {
  46406. handleError(e, vm, info);
  46407. }
  46408. return res
  46409. }
  46410. function globalHandleError (err, vm, info) {
  46411. if (config.errorHandler) {
  46412. try {
  46413. return config.errorHandler.call(null, err, vm, info)
  46414. } catch (e) {
  46415. // if the user intentionally throws the original error in the handler,
  46416. // do not log it twice
  46417. if (e !== err) {
  46418. logError(e, null, 'config.errorHandler');
  46419. }
  46420. }
  46421. }
  46422. logError(err, vm, info);
  46423. }
  46424. function logError (err, vm, info) {
  46425. {
  46426. warn(("Error in " + info + ": \"" + (err.toString()) + "\""), vm);
  46427. }
  46428. /* istanbul ignore else */
  46429. if ((inBrowser || inWeex) && typeof console !== 'undefined') {
  46430. console.error(err);
  46431. } else {
  46432. throw err
  46433. }
  46434. }
  46435. /* */
  46436. var isUsingMicroTask = false;
  46437. var callbacks = [];
  46438. var pending = false;
  46439. function flushCallbacks () {
  46440. pending = false;
  46441. var copies = callbacks.slice(0);
  46442. callbacks.length = 0;
  46443. for (var i = 0; i < copies.length; i++) {
  46444. copies[i]();
  46445. }
  46446. }
  46447. // Here we have async deferring wrappers using microtasks.
  46448. // In 2.5 we used (macro) tasks (in combination with microtasks).
  46449. // However, it has subtle problems when state is changed right before repaint
  46450. // (e.g. #6813, out-in transitions).
  46451. // Also, using (macro) tasks in event handler would cause some weird behaviors
  46452. // that cannot be circumvented (e.g. #7109, #7153, #7546, #7834, #8109).
  46453. // So we now use microtasks everywhere, again.
  46454. // A major drawback of this tradeoff is that there are some scenarios
  46455. // where microtasks have too high a priority and fire in between supposedly
  46456. // sequential events (e.g. #4521, #6690, which have workarounds)
  46457. // or even between bubbling of the same event (#6566).
  46458. var timerFunc;
  46459. // The nextTick behavior leverages the microtask queue, which can be accessed
  46460. // via either native Promise.then or MutationObserver.
  46461. // MutationObserver has wider support, however it is seriously bugged in
  46462. // UIWebView in iOS >= 9.3.3 when triggered in touch event handlers. It
  46463. // completely stops working after triggering a few times... so, if native
  46464. // Promise is available, we will use it:
  46465. /* istanbul ignore next, $flow-disable-line */
  46466. if (typeof Promise !== 'undefined' && isNative(Promise)) {
  46467. var p = Promise.resolve();
  46468. timerFunc = function () {
  46469. p.then(flushCallbacks);
  46470. // In problematic UIWebViews, Promise.then doesn't completely break, but
  46471. // it can get stuck in a weird state where callbacks are pushed into the
  46472. // microtask queue but the queue isn't being flushed, until the browser
  46473. // needs to do some other work, e.g. handle a timer. Therefore we can
  46474. // "force" the microtask queue to be flushed by adding an empty timer.
  46475. if (isIOS) { setTimeout(noop); }
  46476. };
  46477. isUsingMicroTask = true;
  46478. } else if (!isIE && typeof MutationObserver !== 'undefined' && (
  46479. isNative(MutationObserver) ||
  46480. // PhantomJS and iOS 7.x
  46481. MutationObserver.toString() === '[object MutationObserverConstructor]'
  46482. )) {
  46483. // Use MutationObserver where native Promise is not available,
  46484. // e.g. PhantomJS, iOS7, Android 4.4
  46485. // (#6466 MutationObserver is unreliable in IE11)
  46486. var counter = 1;
  46487. var observer = new MutationObserver(flushCallbacks);
  46488. var textNode = document.createTextNode(String(counter));
  46489. observer.observe(textNode, {
  46490. characterData: true
  46491. });
  46492. timerFunc = function () {
  46493. counter = (counter + 1) % 2;
  46494. textNode.data = String(counter);
  46495. };
  46496. isUsingMicroTask = true;
  46497. } else if (typeof setImmediate !== 'undefined' && isNative(setImmediate)) {
  46498. // Fallback to setImmediate.
  46499. // Technically it leverages the (macro) task queue,
  46500. // but it is still a better choice than setTimeout.
  46501. timerFunc = function () {
  46502. setImmediate(flushCallbacks);
  46503. };
  46504. } else {
  46505. // Fallback to setTimeout.
  46506. timerFunc = function () {
  46507. setTimeout(flushCallbacks, 0);
  46508. };
  46509. }
  46510. function nextTick (cb, ctx) {
  46511. var _resolve;
  46512. callbacks.push(function () {
  46513. if (cb) {
  46514. try {
  46515. cb.call(ctx);
  46516. } catch (e) {
  46517. handleError(e, ctx, 'nextTick');
  46518. }
  46519. } else if (_resolve) {
  46520. _resolve(ctx);
  46521. }
  46522. });
  46523. if (!pending) {
  46524. pending = true;
  46525. timerFunc();
  46526. }
  46527. // $flow-disable-line
  46528. if (!cb && typeof Promise !== 'undefined') {
  46529. return new Promise(function (resolve) {
  46530. _resolve = resolve;
  46531. })
  46532. }
  46533. }
  46534. /* */
  46535. var mark;
  46536. var measure;
  46537. {
  46538. var perf = inBrowser && window.performance;
  46539. /* istanbul ignore if */
  46540. if (
  46541. perf &&
  46542. perf.mark &&
  46543. perf.measure &&
  46544. perf.clearMarks &&
  46545. perf.clearMeasures
  46546. ) {
  46547. mark = function (tag) { return perf.mark(tag); };
  46548. measure = function (name, startTag, endTag) {
  46549. perf.measure(name, startTag, endTag);
  46550. perf.clearMarks(startTag);
  46551. perf.clearMarks(endTag);
  46552. // perf.clearMeasures(name)
  46553. };
  46554. }
  46555. }
  46556. /* not type checking this file because flow doesn't play well with Proxy */
  46557. var initProxy;
  46558. {
  46559. var allowedGlobals = makeMap(
  46560. 'Infinity,undefined,NaN,isFinite,isNaN,' +
  46561. 'parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,' +
  46562. 'Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,' +
  46563. 'require' // for Webpack/Browserify
  46564. );
  46565. var warnNonPresent = function (target, key) {
  46566. warn(
  46567. "Property or method \"" + key + "\" is not defined on the instance but " +
  46568. 'referenced during render. Make sure that this property is reactive, ' +
  46569. 'either in the data option, or for class-based components, by ' +
  46570. 'initializing the property. ' +
  46571. 'See: https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties.',
  46572. target
  46573. );
  46574. };
  46575. var warnReservedPrefix = function (target, key) {
  46576. warn(
  46577. "Property \"" + key + "\" must be accessed with \"$data." + key + "\" because " +
  46578. 'properties starting with "$" or "_" are not proxied in the Vue instance to ' +
  46579. 'prevent conflicts with Vue internals. ' +
  46580. 'See: https://vuejs.org/v2/api/#data',
  46581. target
  46582. );
  46583. };
  46584. var hasProxy =
  46585. typeof Proxy !== 'undefined' && isNative(Proxy);
  46586. if (hasProxy) {
  46587. var isBuiltInModifier = makeMap('stop,prevent,self,ctrl,shift,alt,meta,exact');
  46588. config.keyCodes = new Proxy(config.keyCodes, {
  46589. set: function set (target, key, value) {
  46590. if (isBuiltInModifier(key)) {
  46591. warn(("Avoid overwriting built-in modifier in config.keyCodes: ." + key));
  46592. return false
  46593. } else {
  46594. target[key] = value;
  46595. return true
  46596. }
  46597. }
  46598. });
  46599. }
  46600. var hasHandler = {
  46601. has: function has (target, key) {
  46602. var has = key in target;
  46603. var isAllowed = allowedGlobals(key) ||
  46604. (typeof key === 'string' && key.charAt(0) === '_' && !(key in target.$data));
  46605. if (!has && !isAllowed) {
  46606. if (key in target.$data) { warnReservedPrefix(target, key); }
  46607. else { warnNonPresent(target, key); }
  46608. }
  46609. return has || !isAllowed
  46610. }
  46611. };
  46612. var getHandler = {
  46613. get: function get (target, key) {
  46614. if (typeof key === 'string' && !(key in target)) {
  46615. if (key in target.$data) { warnReservedPrefix(target, key); }
  46616. else { warnNonPresent(target, key); }
  46617. }
  46618. return target[key]
  46619. }
  46620. };
  46621. initProxy = function initProxy (vm) {
  46622. if (hasProxy) {
  46623. // determine which proxy handler to use
  46624. var options = vm.$options;
  46625. var handlers = options.render && options.render._withStripped
  46626. ? getHandler
  46627. : hasHandler;
  46628. vm._renderProxy = new Proxy(vm, handlers);
  46629. } else {
  46630. vm._renderProxy = vm;
  46631. }
  46632. };
  46633. }
  46634. /* */
  46635. var seenObjects = new _Set();
  46636. /**
  46637. * Recursively traverse an object to evoke all converted
  46638. * getters, so that every nested property inside the object
  46639. * is collected as a "deep" dependency.
  46640. */
  46641. function traverse (val) {
  46642. _traverse(val, seenObjects);
  46643. seenObjects.clear();
  46644. }
  46645. function _traverse (val, seen) {
  46646. var i, keys;
  46647. var isA = Array.isArray(val);
  46648. if ((!isA && !isObject(val)) || Object.isFrozen(val) || val instanceof VNode) {
  46649. return
  46650. }
  46651. if (val.__ob__) {
  46652. var depId = val.__ob__.dep.id;
  46653. if (seen.has(depId)) {
  46654. return
  46655. }
  46656. seen.add(depId);
  46657. }
  46658. if (isA) {
  46659. i = val.length;
  46660. while (i--) { _traverse(val[i], seen); }
  46661. } else {
  46662. keys = Object.keys(val);
  46663. i = keys.length;
  46664. while (i--) { _traverse(val[keys[i]], seen); }
  46665. }
  46666. }
  46667. /* */
  46668. var normalizeEvent = cached(function (name) {
  46669. var passive = name.charAt(0) === '&';
  46670. name = passive ? name.slice(1) : name;
  46671. var once$$1 = name.charAt(0) === '~'; // Prefixed last, checked first
  46672. name = once$$1 ? name.slice(1) : name;
  46673. var capture = name.charAt(0) === '!';
  46674. name = capture ? name.slice(1) : name;
  46675. return {
  46676. name: name,
  46677. once: once$$1,
  46678. capture: capture,
  46679. passive: passive
  46680. }
  46681. });
  46682. function createFnInvoker (fns, vm) {
  46683. function invoker () {
  46684. var arguments$1 = arguments;
  46685. var fns = invoker.fns;
  46686. if (Array.isArray(fns)) {
  46687. var cloned = fns.slice();
  46688. for (var i = 0; i < cloned.length; i++) {
  46689. invokeWithErrorHandling(cloned[i], null, arguments$1, vm, "v-on handler");
  46690. }
  46691. } else {
  46692. // return handler return value for single handlers
  46693. return invokeWithErrorHandling(fns, null, arguments, vm, "v-on handler")
  46694. }
  46695. }
  46696. invoker.fns = fns;
  46697. return invoker
  46698. }
  46699. function updateListeners (
  46700. on,
  46701. oldOn,
  46702. add,
  46703. remove$$1,
  46704. createOnceHandler,
  46705. vm
  46706. ) {
  46707. var name, def$$1, cur, old, event;
  46708. for (name in on) {
  46709. def$$1 = cur = on[name];
  46710. old = oldOn[name];
  46711. event = normalizeEvent(name);
  46712. if (isUndef(cur)) {
  46713. warn(
  46714. "Invalid handler for event \"" + (event.name) + "\": got " + String(cur),
  46715. vm
  46716. );
  46717. } else if (isUndef(old)) {
  46718. if (isUndef(cur.fns)) {
  46719. cur = on[name] = createFnInvoker(cur, vm);
  46720. }
  46721. if (isTrue(event.once)) {
  46722. cur = on[name] = createOnceHandler(event.name, cur, event.capture);
  46723. }
  46724. add(event.name, cur, event.capture, event.passive, event.params);
  46725. } else if (cur !== old) {
  46726. old.fns = cur;
  46727. on[name] = old;
  46728. }
  46729. }
  46730. for (name in oldOn) {
  46731. if (isUndef(on[name])) {
  46732. event = normalizeEvent(name);
  46733. remove$$1(event.name, oldOn[name], event.capture);
  46734. }
  46735. }
  46736. }
  46737. /* */
  46738. function mergeVNodeHook (def, hookKey, hook) {
  46739. if (def instanceof VNode) {
  46740. def = def.data.hook || (def.data.hook = {});
  46741. }
  46742. var invoker;
  46743. var oldHook = def[hookKey];
  46744. function wrappedHook () {
  46745. hook.apply(this, arguments);
  46746. // important: remove merged hook to ensure it's called only once
  46747. // and prevent memory leak
  46748. remove(invoker.fns, wrappedHook);
  46749. }
  46750. if (isUndef(oldHook)) {
  46751. // no existing hook
  46752. invoker = createFnInvoker([wrappedHook]);
  46753. } else {
  46754. /* istanbul ignore if */
  46755. if (isDef(oldHook.fns) && isTrue(oldHook.merged)) {
  46756. // already a merged invoker
  46757. invoker = oldHook;
  46758. invoker.fns.push(wrappedHook);
  46759. } else {
  46760. // existing plain hook
  46761. invoker = createFnInvoker([oldHook, wrappedHook]);
  46762. }
  46763. }
  46764. invoker.merged = true;
  46765. def[hookKey] = invoker;
  46766. }
  46767. /* */
  46768. function extractPropsFromVNodeData (
  46769. data,
  46770. Ctor,
  46771. tag
  46772. ) {
  46773. // we are only extracting raw values here.
  46774. // validation and default values are handled in the child
  46775. // component itself.
  46776. var propOptions = Ctor.options.props;
  46777. if (isUndef(propOptions)) {
  46778. return
  46779. }
  46780. var res = {};
  46781. var attrs = data.attrs;
  46782. var props = data.props;
  46783. if (isDef(attrs) || isDef(props)) {
  46784. for (var key in propOptions) {
  46785. var altKey = hyphenate(key);
  46786. {
  46787. var keyInLowerCase = key.toLowerCase();
  46788. if (
  46789. key !== keyInLowerCase &&
  46790. attrs && hasOwn(attrs, keyInLowerCase)
  46791. ) {
  46792. tip(
  46793. "Prop \"" + keyInLowerCase + "\" is passed to component " +
  46794. (formatComponentName(tag || Ctor)) + ", but the declared prop name is" +
  46795. " \"" + key + "\". " +
  46796. "Note that HTML attributes are case-insensitive and camelCased " +
  46797. "props need to use their kebab-case equivalents when using in-DOM " +
  46798. "templates. You should probably use \"" + altKey + "\" instead of \"" + key + "\"."
  46799. );
  46800. }
  46801. }
  46802. checkProp(res, props, key, altKey, true) ||
  46803. checkProp(res, attrs, key, altKey, false);
  46804. }
  46805. }
  46806. return res
  46807. }
  46808. function checkProp (
  46809. res,
  46810. hash,
  46811. key,
  46812. altKey,
  46813. preserve
  46814. ) {
  46815. if (isDef(hash)) {
  46816. if (hasOwn(hash, key)) {
  46817. res[key] = hash[key];
  46818. if (!preserve) {
  46819. delete hash[key];
  46820. }
  46821. return true
  46822. } else if (hasOwn(hash, altKey)) {
  46823. res[key] = hash[altKey];
  46824. if (!preserve) {
  46825. delete hash[altKey];
  46826. }
  46827. return true
  46828. }
  46829. }
  46830. return false
  46831. }
  46832. /* */
  46833. // The template compiler attempts to minimize the need for normalization by
  46834. // statically analyzing the template at compile time.
  46835. //
  46836. // For plain HTML markup, normalization can be completely skipped because the
  46837. // generated render function is guaranteed to return Array<VNode>. There are
  46838. // two cases where extra normalization is needed:
  46839. // 1. When the children contains components - because a functional component
  46840. // may return an Array instead of a single root. In this case, just a simple
  46841. // normalization is needed - if any child is an Array, we flatten the whole
  46842. // thing with Array.prototype.concat. It is guaranteed to be only 1-level deep
  46843. // because functional components already normalize their own children.
  46844. function simpleNormalizeChildren (children) {
  46845. for (var i = 0; i < children.length; i++) {
  46846. if (Array.isArray(children[i])) {
  46847. return Array.prototype.concat.apply([], children)
  46848. }
  46849. }
  46850. return children
  46851. }
  46852. // 2. When the children contains constructs that always generated nested Arrays,
  46853. // e.g. <template>, <slot>, v-for, or when the children is provided by user
  46854. // with hand-written render functions / JSX. In such cases a full normalization
  46855. // is needed to cater to all possible types of children values.
  46856. function normalizeChildren (children) {
  46857. return isPrimitive(children)
  46858. ? [createTextVNode(children)]
  46859. : Array.isArray(children)
  46860. ? normalizeArrayChildren(children)
  46861. : undefined
  46862. }
  46863. function isTextNode (node) {
  46864. return isDef(node) && isDef(node.text) && isFalse(node.isComment)
  46865. }
  46866. function normalizeArrayChildren (children, nestedIndex) {
  46867. var res = [];
  46868. var i, c, lastIndex, last;
  46869. for (i = 0; i < children.length; i++) {
  46870. c = children[i];
  46871. if (isUndef(c) || typeof c === 'boolean') { continue }
  46872. lastIndex = res.length - 1;
  46873. last = res[lastIndex];
  46874. // nested
  46875. if (Array.isArray(c)) {
  46876. if (c.length > 0) {
  46877. c = normalizeArrayChildren(c, ((nestedIndex || '') + "_" + i));
  46878. // merge adjacent text nodes
  46879. if (isTextNode(c[0]) && isTextNode(last)) {
  46880. res[lastIndex] = createTextVNode(last.text + (c[0]).text);
  46881. c.shift();
  46882. }
  46883. res.push.apply(res, c);
  46884. }
  46885. } else if (isPrimitive(c)) {
  46886. if (isTextNode(last)) {
  46887. // merge adjacent text nodes
  46888. // this is necessary for SSR hydration because text nodes are
  46889. // essentially merged when rendered to HTML strings
  46890. res[lastIndex] = createTextVNode(last.text + c);
  46891. } else if (c !== '') {
  46892. // convert primitive to vnode
  46893. res.push(createTextVNode(c));
  46894. }
  46895. } else {
  46896. if (isTextNode(c) && isTextNode(last)) {
  46897. // merge adjacent text nodes
  46898. res[lastIndex] = createTextVNode(last.text + c.text);
  46899. } else {
  46900. // default key for nested array children (likely generated by v-for)
  46901. if (isTrue(children._isVList) &&
  46902. isDef(c.tag) &&
  46903. isUndef(c.key) &&
  46904. isDef(nestedIndex)) {
  46905. c.key = "__vlist" + nestedIndex + "_" + i + "__";
  46906. }
  46907. res.push(c);
  46908. }
  46909. }
  46910. }
  46911. return res
  46912. }
  46913. /* */
  46914. function initProvide (vm) {
  46915. var provide = vm.$options.provide;
  46916. if (provide) {
  46917. vm._provided = typeof provide === 'function'
  46918. ? provide.call(vm)
  46919. : provide;
  46920. }
  46921. }
  46922. function initInjections (vm) {
  46923. var result = resolveInject(vm.$options.inject, vm);
  46924. if (result) {
  46925. toggleObserving(false);
  46926. Object.keys(result).forEach(function (key) {
  46927. /* istanbul ignore else */
  46928. {
  46929. defineReactive$$1(vm, key, result[key], function () {
  46930. warn(
  46931. "Avoid mutating an injected value directly since the changes will be " +
  46932. "overwritten whenever the provided component re-renders. " +
  46933. "injection being mutated: \"" + key + "\"",
  46934. vm
  46935. );
  46936. });
  46937. }
  46938. });
  46939. toggleObserving(true);
  46940. }
  46941. }
  46942. function resolveInject (inject, vm) {
  46943. if (inject) {
  46944. // inject is :any because flow is not smart enough to figure out cached
  46945. var result = Object.create(null);
  46946. var keys = hasSymbol
  46947. ? Reflect.ownKeys(inject)
  46948. : Object.keys(inject);
  46949. for (var i = 0; i < keys.length; i++) {
  46950. var key = keys[i];
  46951. // #6574 in case the inject object is observed...
  46952. if (key === '__ob__') { continue }
  46953. var provideKey = inject[key].from;
  46954. var source = vm;
  46955. while (source) {
  46956. if (source._provided && hasOwn(source._provided, provideKey)) {
  46957. result[key] = source._provided[provideKey];
  46958. break
  46959. }
  46960. source = source.$parent;
  46961. }
  46962. if (!source) {
  46963. if ('default' in inject[key]) {
  46964. var provideDefault = inject[key].default;
  46965. result[key] = typeof provideDefault === 'function'
  46966. ? provideDefault.call(vm)
  46967. : provideDefault;
  46968. } else {
  46969. warn(("Injection \"" + key + "\" not found"), vm);
  46970. }
  46971. }
  46972. }
  46973. return result
  46974. }
  46975. }
  46976. /* */
  46977. /**
  46978. * Runtime helper for resolving raw children VNodes into a slot object.
  46979. */
  46980. function resolveSlots (
  46981. children,
  46982. context
  46983. ) {
  46984. if (!children || !children.length) {
  46985. return {}
  46986. }
  46987. var slots = {};
  46988. for (var i = 0, l = children.length; i < l; i++) {
  46989. var child = children[i];
  46990. var data = child.data;
  46991. // remove slot attribute if the node is resolved as a Vue slot node
  46992. if (data && data.attrs && data.attrs.slot) {
  46993. delete data.attrs.slot;
  46994. }
  46995. // named slots should only be respected if the vnode was rendered in the
  46996. // same context.
  46997. if ((child.context === context || child.fnContext === context) &&
  46998. data && data.slot != null
  46999. ) {
  47000. var name = data.slot;
  47001. var slot = (slots[name] || (slots[name] = []));
  47002. if (child.tag === 'template') {
  47003. slot.push.apply(slot, child.children || []);
  47004. } else {
  47005. slot.push(child);
  47006. }
  47007. } else {
  47008. (slots.default || (slots.default = [])).push(child);
  47009. }
  47010. }
  47011. // ignore slots that contains only whitespace
  47012. for (var name$1 in slots) {
  47013. if (slots[name$1].every(isWhitespace)) {
  47014. delete slots[name$1];
  47015. }
  47016. }
  47017. return slots
  47018. }
  47019. function isWhitespace (node) {
  47020. return (node.isComment && !node.asyncFactory) || node.text === ' '
  47021. }
  47022. /* */
  47023. function normalizeScopedSlots (
  47024. slots,
  47025. normalSlots,
  47026. prevSlots
  47027. ) {
  47028. var res;
  47029. var hasNormalSlots = Object.keys(normalSlots).length > 0;
  47030. var isStable = slots ? !!slots.$stable : !hasNormalSlots;
  47031. var key = slots && slots.$key;
  47032. if (!slots) {
  47033. res = {};
  47034. } else if (slots._normalized) {
  47035. // fast path 1: child component re-render only, parent did not change
  47036. return slots._normalized
  47037. } else if (
  47038. isStable &&
  47039. prevSlots &&
  47040. prevSlots !== emptyObject &&
  47041. key === prevSlots.$key &&
  47042. !hasNormalSlots &&
  47043. !prevSlots.$hasNormal
  47044. ) {
  47045. // fast path 2: stable scoped slots w/ no normal slots to proxy,
  47046. // only need to normalize once
  47047. return prevSlots
  47048. } else {
  47049. res = {};
  47050. for (var key$1 in slots) {
  47051. if (slots[key$1] && key$1[0] !== '$') {
  47052. res[key$1] = normalizeScopedSlot(normalSlots, key$1, slots[key$1]);
  47053. }
  47054. }
  47055. }
  47056. // expose normal slots on scopedSlots
  47057. for (var key$2 in normalSlots) {
  47058. if (!(key$2 in res)) {
  47059. res[key$2] = proxyNormalSlot(normalSlots, key$2);
  47060. }
  47061. }
  47062. // avoriaz seems to mock a non-extensible $scopedSlots object
  47063. // and when that is passed down this would cause an error
  47064. if (slots && Object.isExtensible(slots)) {
  47065. (slots)._normalized = res;
  47066. }
  47067. def(res, '$stable', isStable);
  47068. def(res, '$key', key);
  47069. def(res, '$hasNormal', hasNormalSlots);
  47070. return res
  47071. }
  47072. function normalizeScopedSlot(normalSlots, key, fn) {
  47073. var normalized = function () {
  47074. var res = arguments.length ? fn.apply(null, arguments) : fn({});
  47075. res = res && typeof res === 'object' && !Array.isArray(res)
  47076. ? [res] // single vnode
  47077. : normalizeChildren(res);
  47078. return res && (
  47079. res.length === 0 ||
  47080. (res.length === 1 && res[0].isComment) // #9658
  47081. ) ? undefined
  47082. : res
  47083. };
  47084. // this is a slot using the new v-slot syntax without scope. although it is
  47085. // compiled as a scoped slot, render fn users would expect it to be present
  47086. // on this.$slots because the usage is semantically a normal slot.
  47087. if (fn.proxy) {
  47088. Object.defineProperty(normalSlots, key, {
  47089. get: normalized,
  47090. enumerable: true,
  47091. configurable: true
  47092. });
  47093. }
  47094. return normalized
  47095. }
  47096. function proxyNormalSlot(slots, key) {
  47097. return function () { return slots[key]; }
  47098. }
  47099. /* */
  47100. /**
  47101. * Runtime helper for rendering v-for lists.
  47102. */
  47103. function renderList (
  47104. val,
  47105. render
  47106. ) {
  47107. var ret, i, l, keys, key;
  47108. if (Array.isArray(val) || typeof val === 'string') {
  47109. ret = new Array(val.length);
  47110. for (i = 0, l = val.length; i < l; i++) {
  47111. ret[i] = render(val[i], i);
  47112. }
  47113. } else if (typeof val === 'number') {
  47114. ret = new Array(val);
  47115. for (i = 0; i < val; i++) {
  47116. ret[i] = render(i + 1, i);
  47117. }
  47118. } else if (isObject(val)) {
  47119. if (hasSymbol && val[Symbol.iterator]) {
  47120. ret = [];
  47121. var iterator = val[Symbol.iterator]();
  47122. var result = iterator.next();
  47123. while (!result.done) {
  47124. ret.push(render(result.value, ret.length));
  47125. result = iterator.next();
  47126. }
  47127. } else {
  47128. keys = Object.keys(val);
  47129. ret = new Array(keys.length);
  47130. for (i = 0, l = keys.length; i < l; i++) {
  47131. key = keys[i];
  47132. ret[i] = render(val[key], key, i);
  47133. }
  47134. }
  47135. }
  47136. if (!isDef(ret)) {
  47137. ret = [];
  47138. }
  47139. (ret)._isVList = true;
  47140. return ret
  47141. }
  47142. /* */
  47143. /**
  47144. * Runtime helper for rendering <slot>
  47145. */
  47146. function renderSlot (
  47147. name,
  47148. fallback,
  47149. props,
  47150. bindObject
  47151. ) {
  47152. var scopedSlotFn = this.$scopedSlots[name];
  47153. var nodes;
  47154. if (scopedSlotFn) { // scoped slot
  47155. props = props || {};
  47156. if (bindObject) {
  47157. if (!isObject(bindObject)) {
  47158. warn(
  47159. 'slot v-bind without argument expects an Object',
  47160. this
  47161. );
  47162. }
  47163. props = extend(extend({}, bindObject), props);
  47164. }
  47165. nodes = scopedSlotFn(props) || fallback;
  47166. } else {
  47167. nodes = this.$slots[name] || fallback;
  47168. }
  47169. var target = props && props.slot;
  47170. if (target) {
  47171. return this.$createElement('template', { slot: target }, nodes)
  47172. } else {
  47173. return nodes
  47174. }
  47175. }
  47176. /* */
  47177. /**
  47178. * Runtime helper for resolving filters
  47179. */
  47180. function resolveFilter (id) {
  47181. return resolveAsset(this.$options, 'filters', id, true) || identity
  47182. }
  47183. /* */
  47184. function isKeyNotMatch (expect, actual) {
  47185. if (Array.isArray(expect)) {
  47186. return expect.indexOf(actual) === -1
  47187. } else {
  47188. return expect !== actual
  47189. }
  47190. }
  47191. /**
  47192. * Runtime helper for checking keyCodes from config.
  47193. * exposed as Vue.prototype._k
  47194. * passing in eventKeyName as last argument separately for backwards compat
  47195. */
  47196. function checkKeyCodes (
  47197. eventKeyCode,
  47198. key,
  47199. builtInKeyCode,
  47200. eventKeyName,
  47201. builtInKeyName
  47202. ) {
  47203. var mappedKeyCode = config.keyCodes[key] || builtInKeyCode;
  47204. if (builtInKeyName && eventKeyName && !config.keyCodes[key]) {
  47205. return isKeyNotMatch(builtInKeyName, eventKeyName)
  47206. } else if (mappedKeyCode) {
  47207. return isKeyNotMatch(mappedKeyCode, eventKeyCode)
  47208. } else if (eventKeyName) {
  47209. return hyphenate(eventKeyName) !== key
  47210. }
  47211. }
  47212. /* */
  47213. /**
  47214. * Runtime helper for merging v-bind="object" into a VNode's data.
  47215. */
  47216. function bindObjectProps (
  47217. data,
  47218. tag,
  47219. value,
  47220. asProp,
  47221. isSync
  47222. ) {
  47223. if (value) {
  47224. if (!isObject(value)) {
  47225. warn(
  47226. 'v-bind without argument expects an Object or Array value',
  47227. this
  47228. );
  47229. } else {
  47230. if (Array.isArray(value)) {
  47231. value = toObject(value);
  47232. }
  47233. var hash;
  47234. var loop = function ( key ) {
  47235. if (
  47236. key === 'class' ||
  47237. key === 'style' ||
  47238. isReservedAttribute(key)
  47239. ) {
  47240. hash = data;
  47241. } else {
  47242. var type = data.attrs && data.attrs.type;
  47243. hash = asProp || config.mustUseProp(tag, type, key)
  47244. ? data.domProps || (data.domProps = {})
  47245. : data.attrs || (data.attrs = {});
  47246. }
  47247. var camelizedKey = camelize(key);
  47248. var hyphenatedKey = hyphenate(key);
  47249. if (!(camelizedKey in hash) && !(hyphenatedKey in hash)) {
  47250. hash[key] = value[key];
  47251. if (isSync) {
  47252. var on = data.on || (data.on = {});
  47253. on[("update:" + key)] = function ($event) {
  47254. value[key] = $event;
  47255. };
  47256. }
  47257. }
  47258. };
  47259. for (var key in value) loop( key );
  47260. }
  47261. }
  47262. return data
  47263. }
  47264. /* */
  47265. /**
  47266. * Runtime helper for rendering static trees.
  47267. */
  47268. function renderStatic (
  47269. index,
  47270. isInFor
  47271. ) {
  47272. var cached = this._staticTrees || (this._staticTrees = []);
  47273. var tree = cached[index];
  47274. // if has already-rendered static tree and not inside v-for,
  47275. // we can reuse the same tree.
  47276. if (tree && !isInFor) {
  47277. return tree
  47278. }
  47279. // otherwise, render a fresh tree.
  47280. tree = cached[index] = this.$options.staticRenderFns[index].call(
  47281. this._renderProxy,
  47282. null,
  47283. this // for render fns generated for functional component templates
  47284. );
  47285. markStatic(tree, ("__static__" + index), false);
  47286. return tree
  47287. }
  47288. /**
  47289. * Runtime helper for v-once.
  47290. * Effectively it means marking the node as static with a unique key.
  47291. */
  47292. function markOnce (
  47293. tree,
  47294. index,
  47295. key
  47296. ) {
  47297. markStatic(tree, ("__once__" + index + (key ? ("_" + key) : "")), true);
  47298. return tree
  47299. }
  47300. function markStatic (
  47301. tree,
  47302. key,
  47303. isOnce
  47304. ) {
  47305. if (Array.isArray(tree)) {
  47306. for (var i = 0; i < tree.length; i++) {
  47307. if (tree[i] && typeof tree[i] !== 'string') {
  47308. markStaticNode(tree[i], (key + "_" + i), isOnce);
  47309. }
  47310. }
  47311. } else {
  47312. markStaticNode(tree, key, isOnce);
  47313. }
  47314. }
  47315. function markStaticNode (node, key, isOnce) {
  47316. node.isStatic = true;
  47317. node.key = key;
  47318. node.isOnce = isOnce;
  47319. }
  47320. /* */
  47321. function bindObjectListeners (data, value) {
  47322. if (value) {
  47323. if (!isPlainObject(value)) {
  47324. warn(
  47325. 'v-on without argument expects an Object value',
  47326. this
  47327. );
  47328. } else {
  47329. var on = data.on = data.on ? extend({}, data.on) : {};
  47330. for (var key in value) {
  47331. var existing = on[key];
  47332. var ours = value[key];
  47333. on[key] = existing ? [].concat(existing, ours) : ours;
  47334. }
  47335. }
  47336. }
  47337. return data
  47338. }
  47339. /* */
  47340. function resolveScopedSlots (
  47341. fns, // see flow/vnode
  47342. res,
  47343. // the following are added in 2.6
  47344. hasDynamicKeys,
  47345. contentHashKey
  47346. ) {
  47347. res = res || { $stable: !hasDynamicKeys };
  47348. for (var i = 0; i < fns.length; i++) {
  47349. var slot = fns[i];
  47350. if (Array.isArray(slot)) {
  47351. resolveScopedSlots(slot, res, hasDynamicKeys);
  47352. } else if (slot) {
  47353. // marker for reverse proxying v-slot without scope on this.$slots
  47354. if (slot.proxy) {
  47355. slot.fn.proxy = true;
  47356. }
  47357. res[slot.key] = slot.fn;
  47358. }
  47359. }
  47360. if (contentHashKey) {
  47361. (res).$key = contentHashKey;
  47362. }
  47363. return res
  47364. }
  47365. /* */
  47366. function bindDynamicKeys (baseObj, values) {
  47367. for (var i = 0; i < values.length; i += 2) {
  47368. var key = values[i];
  47369. if (typeof key === 'string' && key) {
  47370. baseObj[values[i]] = values[i + 1];
  47371. } else if (key !== '' && key !== null) {
  47372. // null is a special value for explicitly removing a binding
  47373. warn(
  47374. ("Invalid value for dynamic directive argument (expected string or null): " + key),
  47375. this
  47376. );
  47377. }
  47378. }
  47379. return baseObj
  47380. }
  47381. // helper to dynamically append modifier runtime markers to event names.
  47382. // ensure only append when value is already string, otherwise it will be cast
  47383. // to string and cause the type check to miss.
  47384. function prependModifier (value, symbol) {
  47385. return typeof value === 'string' ? symbol + value : value
  47386. }
  47387. /* */
  47388. function installRenderHelpers (target) {
  47389. target._o = markOnce;
  47390. target._n = toNumber;
  47391. target._s = toString;
  47392. target._l = renderList;
  47393. target._t = renderSlot;
  47394. target._q = looseEqual;
  47395. target._i = looseIndexOf;
  47396. target._m = renderStatic;
  47397. target._f = resolveFilter;
  47398. target._k = checkKeyCodes;
  47399. target._b = bindObjectProps;
  47400. target._v = createTextVNode;
  47401. target._e = createEmptyVNode;
  47402. target._u = resolveScopedSlots;
  47403. target._g = bindObjectListeners;
  47404. target._d = bindDynamicKeys;
  47405. target._p = prependModifier;
  47406. }
  47407. /* */
  47408. function FunctionalRenderContext (
  47409. data,
  47410. props,
  47411. children,
  47412. parent,
  47413. Ctor
  47414. ) {
  47415. var this$1 = this;
  47416. var options = Ctor.options;
  47417. // ensure the createElement function in functional components
  47418. // gets a unique context - this is necessary for correct named slot check
  47419. var contextVm;
  47420. if (hasOwn(parent, '_uid')) {
  47421. contextVm = Object.create(parent);
  47422. // $flow-disable-line
  47423. contextVm._original = parent;
  47424. } else {
  47425. // the context vm passed in is a functional context as well.
  47426. // in this case we want to make sure we are able to get a hold to the
  47427. // real context instance.
  47428. contextVm = parent;
  47429. // $flow-disable-line
  47430. parent = parent._original;
  47431. }
  47432. var isCompiled = isTrue(options._compiled);
  47433. var needNormalization = !isCompiled;
  47434. this.data = data;
  47435. this.props = props;
  47436. this.children = children;
  47437. this.parent = parent;
  47438. this.listeners = data.on || emptyObject;
  47439. this.injections = resolveInject(options.inject, parent);
  47440. this.slots = function () {
  47441. if (!this$1.$slots) {
  47442. normalizeScopedSlots(
  47443. data.scopedSlots,
  47444. this$1.$slots = resolveSlots(children, parent)
  47445. );
  47446. }
  47447. return this$1.$slots
  47448. };
  47449. Object.defineProperty(this, 'scopedSlots', ({
  47450. enumerable: true,
  47451. get: function get () {
  47452. return normalizeScopedSlots(data.scopedSlots, this.slots())
  47453. }
  47454. }));
  47455. // support for compiled functional template
  47456. if (isCompiled) {
  47457. // exposing $options for renderStatic()
  47458. this.$options = options;
  47459. // pre-resolve slots for renderSlot()
  47460. this.$slots = this.slots();
  47461. this.$scopedSlots = normalizeScopedSlots(data.scopedSlots, this.$slots);
  47462. }
  47463. if (options._scopeId) {
  47464. this._c = function (a, b, c, d) {
  47465. var vnode = createElement(contextVm, a, b, c, d, needNormalization);
  47466. if (vnode && !Array.isArray(vnode)) {
  47467. vnode.fnScopeId = options._scopeId;
  47468. vnode.fnContext = parent;
  47469. }
  47470. return vnode
  47471. };
  47472. } else {
  47473. this._c = function (a, b, c, d) { return createElement(contextVm, a, b, c, d, needNormalization); };
  47474. }
  47475. }
  47476. installRenderHelpers(FunctionalRenderContext.prototype);
  47477. function createFunctionalComponent (
  47478. Ctor,
  47479. propsData,
  47480. data,
  47481. contextVm,
  47482. children
  47483. ) {
  47484. var options = Ctor.options;
  47485. var props = {};
  47486. var propOptions = options.props;
  47487. if (isDef(propOptions)) {
  47488. for (var key in propOptions) {
  47489. props[key] = validateProp(key, propOptions, propsData || emptyObject);
  47490. }
  47491. } else {
  47492. if (isDef(data.attrs)) { mergeProps(props, data.attrs); }
  47493. if (isDef(data.props)) { mergeProps(props, data.props); }
  47494. }
  47495. var renderContext = new FunctionalRenderContext(
  47496. data,
  47497. props,
  47498. children,
  47499. contextVm,
  47500. Ctor
  47501. );
  47502. var vnode = options.render.call(null, renderContext._c, renderContext);
  47503. if (vnode instanceof VNode) {
  47504. return cloneAndMarkFunctionalResult(vnode, data, renderContext.parent, options, renderContext)
  47505. } else if (Array.isArray(vnode)) {
  47506. var vnodes = normalizeChildren(vnode) || [];
  47507. var res = new Array(vnodes.length);
  47508. for (var i = 0; i < vnodes.length; i++) {
  47509. res[i] = cloneAndMarkFunctionalResult(vnodes[i], data, renderContext.parent, options, renderContext);
  47510. }
  47511. return res
  47512. }
  47513. }
  47514. function cloneAndMarkFunctionalResult (vnode, data, contextVm, options, renderContext) {
  47515. // #7817 clone node before setting fnContext, otherwise if the node is reused
  47516. // (e.g. it was from a cached normal slot) the fnContext causes named slots
  47517. // that should not be matched to match.
  47518. var clone = cloneVNode(vnode);
  47519. clone.fnContext = contextVm;
  47520. clone.fnOptions = options;
  47521. {
  47522. (clone.devtoolsMeta = clone.devtoolsMeta || {}).renderContext = renderContext;
  47523. }
  47524. if (data.slot) {
  47525. (clone.data || (clone.data = {})).slot = data.slot;
  47526. }
  47527. return clone
  47528. }
  47529. function mergeProps (to, from) {
  47530. for (var key in from) {
  47531. to[camelize(key)] = from[key];
  47532. }
  47533. }
  47534. /* */
  47535. /* */
  47536. /* */
  47537. /* */
  47538. // inline hooks to be invoked on component VNodes during patch
  47539. var componentVNodeHooks = {
  47540. init: function init (vnode, hydrating) {
  47541. if (
  47542. vnode.componentInstance &&
  47543. !vnode.componentInstance._isDestroyed &&
  47544. vnode.data.keepAlive
  47545. ) {
  47546. // kept-alive components, treat as a patch
  47547. var mountedNode = vnode; // work around flow
  47548. componentVNodeHooks.prepatch(mountedNode, mountedNode);
  47549. } else {
  47550. var child = vnode.componentInstance = createComponentInstanceForVnode(
  47551. vnode,
  47552. activeInstance
  47553. );
  47554. child.$mount(hydrating ? vnode.elm : undefined, hydrating);
  47555. }
  47556. },
  47557. prepatch: function prepatch (oldVnode, vnode) {
  47558. var options = vnode.componentOptions;
  47559. var child = vnode.componentInstance = oldVnode.componentInstance;
  47560. updateChildComponent(
  47561. child,
  47562. options.propsData, // updated props
  47563. options.listeners, // updated listeners
  47564. vnode, // new parent vnode
  47565. options.children // new children
  47566. );
  47567. },
  47568. insert: function insert (vnode) {
  47569. var context = vnode.context;
  47570. var componentInstance = vnode.componentInstance;
  47571. if (!componentInstance._isMounted) {
  47572. componentInstance._isMounted = true;
  47573. callHook(componentInstance, 'mounted');
  47574. }
  47575. if (vnode.data.keepAlive) {
  47576. if (context._isMounted) {
  47577. // vue-router#1212
  47578. // During updates, a kept-alive component's child components may
  47579. // change, so directly walking the tree here may call activated hooks
  47580. // on incorrect children. Instead we push them into a queue which will
  47581. // be processed after the whole patch process ended.
  47582. queueActivatedComponent(componentInstance);
  47583. } else {
  47584. activateChildComponent(componentInstance, true /* direct */);
  47585. }
  47586. }
  47587. },
  47588. destroy: function destroy (vnode) {
  47589. var componentInstance = vnode.componentInstance;
  47590. if (!componentInstance._isDestroyed) {
  47591. if (!vnode.data.keepAlive) {
  47592. componentInstance.$destroy();
  47593. } else {
  47594. deactivateChildComponent(componentInstance, true /* direct */);
  47595. }
  47596. }
  47597. }
  47598. };
  47599. var hooksToMerge = Object.keys(componentVNodeHooks);
  47600. function createComponent (
  47601. Ctor,
  47602. data,
  47603. context,
  47604. children,
  47605. tag
  47606. ) {
  47607. if (isUndef(Ctor)) {
  47608. return
  47609. }
  47610. var baseCtor = context.$options._base;
  47611. // plain options object: turn it into a constructor
  47612. if (isObject(Ctor)) {
  47613. Ctor = baseCtor.extend(Ctor);
  47614. }
  47615. // if at this stage it's not a constructor or an async component factory,
  47616. // reject.
  47617. if (typeof Ctor !== 'function') {
  47618. {
  47619. warn(("Invalid Component definition: " + (String(Ctor))), context);
  47620. }
  47621. return
  47622. }
  47623. // async component
  47624. var asyncFactory;
  47625. if (isUndef(Ctor.cid)) {
  47626. asyncFactory = Ctor;
  47627. Ctor = resolveAsyncComponent(asyncFactory, baseCtor);
  47628. if (Ctor === undefined) {
  47629. // return a placeholder node for async component, which is rendered
  47630. // as a comment node but preserves all the raw information for the node.
  47631. // the information will be used for async server-rendering and hydration.
  47632. return createAsyncPlaceholder(
  47633. asyncFactory,
  47634. data,
  47635. context,
  47636. children,
  47637. tag
  47638. )
  47639. }
  47640. }
  47641. data = data || {};
  47642. // resolve constructor options in case global mixins are applied after
  47643. // component constructor creation
  47644. resolveConstructorOptions(Ctor);
  47645. // transform component v-model data into props & events
  47646. if (isDef(data.model)) {
  47647. transformModel(Ctor.options, data);
  47648. }
  47649. // extract props
  47650. var propsData = extractPropsFromVNodeData(data, Ctor, tag);
  47651. // functional component
  47652. if (isTrue(Ctor.options.functional)) {
  47653. return createFunctionalComponent(Ctor, propsData, data, context, children)
  47654. }
  47655. // extract listeners, since these needs to be treated as
  47656. // child component listeners instead of DOM listeners
  47657. var listeners = data.on;
  47658. // replace with listeners with .native modifier
  47659. // so it gets processed during parent component patch.
  47660. data.on = data.nativeOn;
  47661. if (isTrue(Ctor.options.abstract)) {
  47662. // abstract components do not keep anything
  47663. // other than props & listeners & slot
  47664. // work around flow
  47665. var slot = data.slot;
  47666. data = {};
  47667. if (slot) {
  47668. data.slot = slot;
  47669. }
  47670. }
  47671. // install component management hooks onto the placeholder node
  47672. installComponentHooks(data);
  47673. // return a placeholder vnode
  47674. var name = Ctor.options.name || tag;
  47675. var vnode = new VNode(
  47676. ("vue-component-" + (Ctor.cid) + (name ? ("-" + name) : '')),
  47677. data, undefined, undefined, undefined, context,
  47678. { Ctor: Ctor, propsData: propsData, listeners: listeners, tag: tag, children: children },
  47679. asyncFactory
  47680. );
  47681. return vnode
  47682. }
  47683. function createComponentInstanceForVnode (
  47684. vnode, // we know it's MountedComponentVNode but flow doesn't
  47685. parent // activeInstance in lifecycle state
  47686. ) {
  47687. var options = {
  47688. _isComponent: true,
  47689. _parentVnode: vnode,
  47690. parent: parent
  47691. };
  47692. // check inline-template render functions
  47693. var inlineTemplate = vnode.data.inlineTemplate;
  47694. if (isDef(inlineTemplate)) {
  47695. options.render = inlineTemplate.render;
  47696. options.staticRenderFns = inlineTemplate.staticRenderFns;
  47697. }
  47698. return new vnode.componentOptions.Ctor(options)
  47699. }
  47700. function installComponentHooks (data) {
  47701. var hooks = data.hook || (data.hook = {});
  47702. for (var i = 0; i < hooksToMerge.length; i++) {
  47703. var key = hooksToMerge[i];
  47704. var existing = hooks[key];
  47705. var toMerge = componentVNodeHooks[key];
  47706. if (existing !== toMerge && !(existing && existing._merged)) {
  47707. hooks[key] = existing ? mergeHook$1(toMerge, existing) : toMerge;
  47708. }
  47709. }
  47710. }
  47711. function mergeHook$1 (f1, f2) {
  47712. var merged = function (a, b) {
  47713. // flow complains about extra args which is why we use any
  47714. f1(a, b);
  47715. f2(a, b);
  47716. };
  47717. merged._merged = true;
  47718. return merged
  47719. }
  47720. // transform component v-model info (value and callback) into
  47721. // prop and event handler respectively.
  47722. function transformModel (options, data) {
  47723. var prop = (options.model && options.model.prop) || 'value';
  47724. var event = (options.model && options.model.event) || 'input'
  47725. ;(data.attrs || (data.attrs = {}))[prop] = data.model.value;
  47726. var on = data.on || (data.on = {});
  47727. var existing = on[event];
  47728. var callback = data.model.callback;
  47729. if (isDef(existing)) {
  47730. if (
  47731. Array.isArray(existing)
  47732. ? existing.indexOf(callback) === -1
  47733. : existing !== callback
  47734. ) {
  47735. on[event] = [callback].concat(existing);
  47736. }
  47737. } else {
  47738. on[event] = callback;
  47739. }
  47740. }
  47741. /* */
  47742. var SIMPLE_NORMALIZE = 1;
  47743. var ALWAYS_NORMALIZE = 2;
  47744. // wrapper function for providing a more flexible interface
  47745. // without getting yelled at by flow
  47746. function createElement (
  47747. context,
  47748. tag,
  47749. data,
  47750. children,
  47751. normalizationType,
  47752. alwaysNormalize
  47753. ) {
  47754. if (Array.isArray(data) || isPrimitive(data)) {
  47755. normalizationType = children;
  47756. children = data;
  47757. data = undefined;
  47758. }
  47759. if (isTrue(alwaysNormalize)) {
  47760. normalizationType = ALWAYS_NORMALIZE;
  47761. }
  47762. return _createElement(context, tag, data, children, normalizationType)
  47763. }
  47764. function _createElement (
  47765. context,
  47766. tag,
  47767. data,
  47768. children,
  47769. normalizationType
  47770. ) {
  47771. if (isDef(data) && isDef((data).__ob__)) {
  47772. warn(
  47773. "Avoid using observed data object as vnode data: " + (JSON.stringify(data)) + "\n" +
  47774. 'Always create fresh vnode data objects in each render!',
  47775. context
  47776. );
  47777. return createEmptyVNode()
  47778. }
  47779. // object syntax in v-bind
  47780. if (isDef(data) && isDef(data.is)) {
  47781. tag = data.is;
  47782. }
  47783. if (!tag) {
  47784. // in case of component :is set to falsy value
  47785. return createEmptyVNode()
  47786. }
  47787. // warn against non-primitive key
  47788. if (isDef(data) && isDef(data.key) && !isPrimitive(data.key)
  47789. ) {
  47790. {
  47791. warn(
  47792. 'Avoid using non-primitive value as key, ' +
  47793. 'use string/number value instead.',
  47794. context
  47795. );
  47796. }
  47797. }
  47798. // support single function children as default scoped slot
  47799. if (Array.isArray(children) &&
  47800. typeof children[0] === 'function'
  47801. ) {
  47802. data = data || {};
  47803. data.scopedSlots = { default: children[0] };
  47804. children.length = 0;
  47805. }
  47806. if (normalizationType === ALWAYS_NORMALIZE) {
  47807. children = normalizeChildren(children);
  47808. } else if (normalizationType === SIMPLE_NORMALIZE) {
  47809. children = simpleNormalizeChildren(children);
  47810. }
  47811. var vnode, ns;
  47812. if (typeof tag === 'string') {
  47813. var Ctor;
  47814. ns = (context.$vnode && context.$vnode.ns) || config.getTagNamespace(tag);
  47815. if (config.isReservedTag(tag)) {
  47816. // platform built-in elements
  47817. if (isDef(data) && isDef(data.nativeOn)) {
  47818. warn(
  47819. ("The .native modifier for v-on is only valid on components but it was used on <" + tag + ">."),
  47820. context
  47821. );
  47822. }
  47823. vnode = new VNode(
  47824. config.parsePlatformTagName(tag), data, children,
  47825. undefined, undefined, context
  47826. );
  47827. } else if ((!data || !data.pre) && isDef(Ctor = resolveAsset(context.$options, 'components', tag))) {
  47828. // component
  47829. vnode = createComponent(Ctor, data, context, children, tag);
  47830. } else {
  47831. // unknown or unlisted namespaced elements
  47832. // check at runtime because it may get assigned a namespace when its
  47833. // parent normalizes children
  47834. vnode = new VNode(
  47835. tag, data, children,
  47836. undefined, undefined, context
  47837. );
  47838. }
  47839. } else {
  47840. // direct component options / constructor
  47841. vnode = createComponent(tag, data, context, children);
  47842. }
  47843. if (Array.isArray(vnode)) {
  47844. return vnode
  47845. } else if (isDef(vnode)) {
  47846. if (isDef(ns)) { applyNS(vnode, ns); }
  47847. if (isDef(data)) { registerDeepBindings(data); }
  47848. return vnode
  47849. } else {
  47850. return createEmptyVNode()
  47851. }
  47852. }
  47853. function applyNS (vnode, ns, force) {
  47854. vnode.ns = ns;
  47855. if (vnode.tag === 'foreignObject') {
  47856. // use default namespace inside foreignObject
  47857. ns = undefined;
  47858. force = true;
  47859. }
  47860. if (isDef(vnode.children)) {
  47861. for (var i = 0, l = vnode.children.length; i < l; i++) {
  47862. var child = vnode.children[i];
  47863. if (isDef(child.tag) && (
  47864. isUndef(child.ns) || (isTrue(force) && child.tag !== 'svg'))) {
  47865. applyNS(child, ns, force);
  47866. }
  47867. }
  47868. }
  47869. }
  47870. // ref #5318
  47871. // necessary to ensure parent re-render when deep bindings like :style and
  47872. // :class are used on slot nodes
  47873. function registerDeepBindings (data) {
  47874. if (isObject(data.style)) {
  47875. traverse(data.style);
  47876. }
  47877. if (isObject(data.class)) {
  47878. traverse(data.class);
  47879. }
  47880. }
  47881. /* */
  47882. function initRender (vm) {
  47883. vm._vnode = null; // the root of the child tree
  47884. vm._staticTrees = null; // v-once cached trees
  47885. var options = vm.$options;
  47886. var parentVnode = vm.$vnode = options._parentVnode; // the placeholder node in parent tree
  47887. var renderContext = parentVnode && parentVnode.context;
  47888. vm.$slots = resolveSlots(options._renderChildren, renderContext);
  47889. vm.$scopedSlots = emptyObject;
  47890. // bind the createElement fn to this instance
  47891. // so that we get proper render context inside it.
  47892. // args order: tag, data, children, normalizationType, alwaysNormalize
  47893. // internal version is used by render functions compiled from templates
  47894. vm._c = function (a, b, c, d) { return createElement(vm, a, b, c, d, false); };
  47895. // normalization is always applied for the public version, used in
  47896. // user-written render functions.
  47897. vm.$createElement = function (a, b, c, d) { return createElement(vm, a, b, c, d, true); };
  47898. // $attrs & $listeners are exposed for easier HOC creation.
  47899. // they need to be reactive so that HOCs using them are always updated
  47900. var parentData = parentVnode && parentVnode.data;
  47901. /* istanbul ignore else */
  47902. {
  47903. defineReactive$$1(vm, '$attrs', parentData && parentData.attrs || emptyObject, function () {
  47904. !isUpdatingChildComponent && warn("$attrs is readonly.", vm);
  47905. }, true);
  47906. defineReactive$$1(vm, '$listeners', options._parentListeners || emptyObject, function () {
  47907. !isUpdatingChildComponent && warn("$listeners is readonly.", vm);
  47908. }, true);
  47909. }
  47910. }
  47911. var currentRenderingInstance = null;
  47912. function renderMixin (Vue) {
  47913. // install runtime convenience helpers
  47914. installRenderHelpers(Vue.prototype);
  47915. Vue.prototype.$nextTick = function (fn) {
  47916. return nextTick(fn, this)
  47917. };
  47918. Vue.prototype._render = function () {
  47919. var vm = this;
  47920. var ref = vm.$options;
  47921. var render = ref.render;
  47922. var _parentVnode = ref._parentVnode;
  47923. if (_parentVnode) {
  47924. vm.$scopedSlots = normalizeScopedSlots(
  47925. _parentVnode.data.scopedSlots,
  47926. vm.$slots,
  47927. vm.$scopedSlots
  47928. );
  47929. }
  47930. // set parent vnode. this allows render functions to have access
  47931. // to the data on the placeholder node.
  47932. vm.$vnode = _parentVnode;
  47933. // render self
  47934. var vnode;
  47935. try {
  47936. // There's no need to maintain a stack because all render fns are called
  47937. // separately from one another. Nested component's render fns are called
  47938. // when parent component is patched.
  47939. currentRenderingInstance = vm;
  47940. vnode = render.call(vm._renderProxy, vm.$createElement);
  47941. } catch (e) {
  47942. handleError(e, vm, "render");
  47943. // return error render result,
  47944. // or previous vnode to prevent render error causing blank component
  47945. /* istanbul ignore else */
  47946. if (vm.$options.renderError) {
  47947. try {
  47948. vnode = vm.$options.renderError.call(vm._renderProxy, vm.$createElement, e);
  47949. } catch (e) {
  47950. handleError(e, vm, "renderError");
  47951. vnode = vm._vnode;
  47952. }
  47953. } else {
  47954. vnode = vm._vnode;
  47955. }
  47956. } finally {
  47957. currentRenderingInstance = null;
  47958. }
  47959. // if the returned array contains only a single node, allow it
  47960. if (Array.isArray(vnode) && vnode.length === 1) {
  47961. vnode = vnode[0];
  47962. }
  47963. // return empty vnode in case the render function errored out
  47964. if (!(vnode instanceof VNode)) {
  47965. if (Array.isArray(vnode)) {
  47966. warn(
  47967. 'Multiple root nodes returned from render function. Render function ' +
  47968. 'should return a single root node.',
  47969. vm
  47970. );
  47971. }
  47972. vnode = createEmptyVNode();
  47973. }
  47974. // set parent
  47975. vnode.parent = _parentVnode;
  47976. return vnode
  47977. };
  47978. }
  47979. /* */
  47980. function ensureCtor (comp, base) {
  47981. if (
  47982. comp.__esModule ||
  47983. (hasSymbol && comp[Symbol.toStringTag] === 'Module')
  47984. ) {
  47985. comp = comp.default;
  47986. }
  47987. return isObject(comp)
  47988. ? base.extend(comp)
  47989. : comp
  47990. }
  47991. function createAsyncPlaceholder (
  47992. factory,
  47993. data,
  47994. context,
  47995. children,
  47996. tag
  47997. ) {
  47998. var node = createEmptyVNode();
  47999. node.asyncFactory = factory;
  48000. node.asyncMeta = { data: data, context: context, children: children, tag: tag };
  48001. return node
  48002. }
  48003. function resolveAsyncComponent (
  48004. factory,
  48005. baseCtor
  48006. ) {
  48007. if (isTrue(factory.error) && isDef(factory.errorComp)) {
  48008. return factory.errorComp
  48009. }
  48010. if (isDef(factory.resolved)) {
  48011. return factory.resolved
  48012. }
  48013. var owner = currentRenderingInstance;
  48014. if (owner && isDef(factory.owners) && factory.owners.indexOf(owner) === -1) {
  48015. // already pending
  48016. factory.owners.push(owner);
  48017. }
  48018. if (isTrue(factory.loading) && isDef(factory.loadingComp)) {
  48019. return factory.loadingComp
  48020. }
  48021. if (owner && !isDef(factory.owners)) {
  48022. var owners = factory.owners = [owner];
  48023. var sync = true;
  48024. var timerLoading = null;
  48025. var timerTimeout = null
  48026. ;(owner).$on('hook:destroyed', function () { return remove(owners, owner); });
  48027. var forceRender = function (renderCompleted) {
  48028. for (var i = 0, l = owners.length; i < l; i++) {
  48029. (owners[i]).$forceUpdate();
  48030. }
  48031. if (renderCompleted) {
  48032. owners.length = 0;
  48033. if (timerLoading !== null) {
  48034. clearTimeout(timerLoading);
  48035. timerLoading = null;
  48036. }
  48037. if (timerTimeout !== null) {
  48038. clearTimeout(timerTimeout);
  48039. timerTimeout = null;
  48040. }
  48041. }
  48042. };
  48043. var resolve = once(function (res) {
  48044. // cache resolved
  48045. factory.resolved = ensureCtor(res, baseCtor);
  48046. // invoke callbacks only if this is not a synchronous resolve
  48047. // (async resolves are shimmed as synchronous during SSR)
  48048. if (!sync) {
  48049. forceRender(true);
  48050. } else {
  48051. owners.length = 0;
  48052. }
  48053. });
  48054. var reject = once(function (reason) {
  48055. warn(
  48056. "Failed to resolve async component: " + (String(factory)) +
  48057. (reason ? ("\nReason: " + reason) : '')
  48058. );
  48059. if (isDef(factory.errorComp)) {
  48060. factory.error = true;
  48061. forceRender(true);
  48062. }
  48063. });
  48064. var res = factory(resolve, reject);
  48065. if (isObject(res)) {
  48066. if (isPromise(res)) {
  48067. // () => Promise
  48068. if (isUndef(factory.resolved)) {
  48069. res.then(resolve, reject);
  48070. }
  48071. } else if (isPromise(res.component)) {
  48072. res.component.then(resolve, reject);
  48073. if (isDef(res.error)) {
  48074. factory.errorComp = ensureCtor(res.error, baseCtor);
  48075. }
  48076. if (isDef(res.loading)) {
  48077. factory.loadingComp = ensureCtor(res.loading, baseCtor);
  48078. if (res.delay === 0) {
  48079. factory.loading = true;
  48080. } else {
  48081. timerLoading = setTimeout(function () {
  48082. timerLoading = null;
  48083. if (isUndef(factory.resolved) && isUndef(factory.error)) {
  48084. factory.loading = true;
  48085. forceRender(false);
  48086. }
  48087. }, res.delay || 200);
  48088. }
  48089. }
  48090. if (isDef(res.timeout)) {
  48091. timerTimeout = setTimeout(function () {
  48092. timerTimeout = null;
  48093. if (isUndef(factory.resolved)) {
  48094. reject(
  48095. "timeout (" + (res.timeout) + "ms)"
  48096. );
  48097. }
  48098. }, res.timeout);
  48099. }
  48100. }
  48101. }
  48102. sync = false;
  48103. // return in case resolved synchronously
  48104. return factory.loading
  48105. ? factory.loadingComp
  48106. : factory.resolved
  48107. }
  48108. }
  48109. /* */
  48110. function isAsyncPlaceholder (node) {
  48111. return node.isComment && node.asyncFactory
  48112. }
  48113. /* */
  48114. function getFirstComponentChild (children) {
  48115. if (Array.isArray(children)) {
  48116. for (var i = 0; i < children.length; i++) {
  48117. var c = children[i];
  48118. if (isDef(c) && (isDef(c.componentOptions) || isAsyncPlaceholder(c))) {
  48119. return c
  48120. }
  48121. }
  48122. }
  48123. }
  48124. /* */
  48125. /* */
  48126. function initEvents (vm) {
  48127. vm._events = Object.create(null);
  48128. vm._hasHookEvent = false;
  48129. // init parent attached events
  48130. var listeners = vm.$options._parentListeners;
  48131. if (listeners) {
  48132. updateComponentListeners(vm, listeners);
  48133. }
  48134. }
  48135. var target;
  48136. function add (event, fn) {
  48137. target.$on(event, fn);
  48138. }
  48139. function remove$1 (event, fn) {
  48140. target.$off(event, fn);
  48141. }
  48142. function createOnceHandler (event, fn) {
  48143. var _target = target;
  48144. return function onceHandler () {
  48145. var res = fn.apply(null, arguments);
  48146. if (res !== null) {
  48147. _target.$off(event, onceHandler);
  48148. }
  48149. }
  48150. }
  48151. function updateComponentListeners (
  48152. vm,
  48153. listeners,
  48154. oldListeners
  48155. ) {
  48156. target = vm;
  48157. updateListeners(listeners, oldListeners || {}, add, remove$1, createOnceHandler, vm);
  48158. target = undefined;
  48159. }
  48160. function eventsMixin (Vue) {
  48161. var hookRE = /^hook:/;
  48162. Vue.prototype.$on = function (event, fn) {
  48163. var vm = this;
  48164. if (Array.isArray(event)) {
  48165. for (var i = 0, l = event.length; i < l; i++) {
  48166. vm.$on(event[i], fn);
  48167. }
  48168. } else {
  48169. (vm._events[event] || (vm._events[event] = [])).push(fn);
  48170. // optimize hook:event cost by using a boolean flag marked at registration
  48171. // instead of a hash lookup
  48172. if (hookRE.test(event)) {
  48173. vm._hasHookEvent = true;
  48174. }
  48175. }
  48176. return vm
  48177. };
  48178. Vue.prototype.$once = function (event, fn) {
  48179. var vm = this;
  48180. function on () {
  48181. vm.$off(event, on);
  48182. fn.apply(vm, arguments);
  48183. }
  48184. on.fn = fn;
  48185. vm.$on(event, on);
  48186. return vm
  48187. };
  48188. Vue.prototype.$off = function (event, fn) {
  48189. var vm = this;
  48190. // all
  48191. if (!arguments.length) {
  48192. vm._events = Object.create(null);
  48193. return vm
  48194. }
  48195. // array of events
  48196. if (Array.isArray(event)) {
  48197. for (var i$1 = 0, l = event.length; i$1 < l; i$1++) {
  48198. vm.$off(event[i$1], fn);
  48199. }
  48200. return vm
  48201. }
  48202. // specific event
  48203. var cbs = vm._events[event];
  48204. if (!cbs) {
  48205. return vm
  48206. }
  48207. if (!fn) {
  48208. vm._events[event] = null;
  48209. return vm
  48210. }
  48211. // specific handler
  48212. var cb;
  48213. var i = cbs.length;
  48214. while (i--) {
  48215. cb = cbs[i];
  48216. if (cb === fn || cb.fn === fn) {
  48217. cbs.splice(i, 1);
  48218. break
  48219. }
  48220. }
  48221. return vm
  48222. };
  48223. Vue.prototype.$emit = function (event) {
  48224. var vm = this;
  48225. {
  48226. var lowerCaseEvent = event.toLowerCase();
  48227. if (lowerCaseEvent !== event && vm._events[lowerCaseEvent]) {
  48228. tip(
  48229. "Event \"" + lowerCaseEvent + "\" is emitted in component " +
  48230. (formatComponentName(vm)) + " but the handler is registered for \"" + event + "\". " +
  48231. "Note that HTML attributes are case-insensitive and you cannot use " +
  48232. "v-on to listen to camelCase events when using in-DOM templates. " +
  48233. "You should probably use \"" + (hyphenate(event)) + "\" instead of \"" + event + "\"."
  48234. );
  48235. }
  48236. }
  48237. var cbs = vm._events[event];
  48238. if (cbs) {
  48239. cbs = cbs.length > 1 ? toArray(cbs) : cbs;
  48240. var args = toArray(arguments, 1);
  48241. var info = "event handler for \"" + event + "\"";
  48242. for (var i = 0, l = cbs.length; i < l; i++) {
  48243. invokeWithErrorHandling(cbs[i], vm, args, vm, info);
  48244. }
  48245. }
  48246. return vm
  48247. };
  48248. }
  48249. /* */
  48250. var activeInstance = null;
  48251. var isUpdatingChildComponent = false;
  48252. function setActiveInstance(vm) {
  48253. var prevActiveInstance = activeInstance;
  48254. activeInstance = vm;
  48255. return function () {
  48256. activeInstance = prevActiveInstance;
  48257. }
  48258. }
  48259. function initLifecycle (vm) {
  48260. var options = vm.$options;
  48261. // locate first non-abstract parent
  48262. var parent = options.parent;
  48263. if (parent && !options.abstract) {
  48264. while (parent.$options.abstract && parent.$parent) {
  48265. parent = parent.$parent;
  48266. }
  48267. parent.$children.push(vm);
  48268. }
  48269. vm.$parent = parent;
  48270. vm.$root = parent ? parent.$root : vm;
  48271. vm.$children = [];
  48272. vm.$refs = {};
  48273. vm._watcher = null;
  48274. vm._inactive = null;
  48275. vm._directInactive = false;
  48276. vm._isMounted = false;
  48277. vm._isDestroyed = false;
  48278. vm._isBeingDestroyed = false;
  48279. }
  48280. function lifecycleMixin (Vue) {
  48281. Vue.prototype._update = function (vnode, hydrating) {
  48282. var vm = this;
  48283. var prevEl = vm.$el;
  48284. var prevVnode = vm._vnode;
  48285. var restoreActiveInstance = setActiveInstance(vm);
  48286. vm._vnode = vnode;
  48287. // Vue.prototype.__patch__ is injected in entry points
  48288. // based on the rendering backend used.
  48289. if (!prevVnode) {
  48290. // initial render
  48291. vm.$el = vm.__patch__(vm.$el, vnode, hydrating, false /* removeOnly */);
  48292. } else {
  48293. // updates
  48294. vm.$el = vm.__patch__(prevVnode, vnode);
  48295. }
  48296. restoreActiveInstance();
  48297. // update __vue__ reference
  48298. if (prevEl) {
  48299. prevEl.__vue__ = null;
  48300. }
  48301. if (vm.$el) {
  48302. vm.$el.__vue__ = vm;
  48303. }
  48304. // if parent is an HOC, update its $el as well
  48305. if (vm.$vnode && vm.$parent && vm.$vnode === vm.$parent._vnode) {
  48306. vm.$parent.$el = vm.$el;
  48307. }
  48308. // updated hook is called by the scheduler to ensure that children are
  48309. // updated in a parent's updated hook.
  48310. };
  48311. Vue.prototype.$forceUpdate = function () {
  48312. var vm = this;
  48313. if (vm._watcher) {
  48314. vm._watcher.update();
  48315. }
  48316. };
  48317. Vue.prototype.$destroy = function () {
  48318. var vm = this;
  48319. if (vm._isBeingDestroyed) {
  48320. return
  48321. }
  48322. callHook(vm, 'beforeDestroy');
  48323. vm._isBeingDestroyed = true;
  48324. // remove self from parent
  48325. var parent = vm.$parent;
  48326. if (parent && !parent._isBeingDestroyed && !vm.$options.abstract) {
  48327. remove(parent.$children, vm);
  48328. }
  48329. // teardown watchers
  48330. if (vm._watcher) {
  48331. vm._watcher.teardown();
  48332. }
  48333. var i = vm._watchers.length;
  48334. while (i--) {
  48335. vm._watchers[i].teardown();
  48336. }
  48337. // remove reference from data ob
  48338. // frozen object may not have observer.
  48339. if (vm._data.__ob__) {
  48340. vm._data.__ob__.vmCount--;
  48341. }
  48342. // call the last hook...
  48343. vm._isDestroyed = true;
  48344. // invoke destroy hooks on current rendered tree
  48345. vm.__patch__(vm._vnode, null);
  48346. // fire destroyed hook
  48347. callHook(vm, 'destroyed');
  48348. // turn off all instance listeners.
  48349. vm.$off();
  48350. // remove __vue__ reference
  48351. if (vm.$el) {
  48352. vm.$el.__vue__ = null;
  48353. }
  48354. // release circular reference (#6759)
  48355. if (vm.$vnode) {
  48356. vm.$vnode.parent = null;
  48357. }
  48358. };
  48359. }
  48360. function mountComponent (
  48361. vm,
  48362. el,
  48363. hydrating
  48364. ) {
  48365. vm.$el = el;
  48366. if (!vm.$options.render) {
  48367. vm.$options.render = createEmptyVNode;
  48368. {
  48369. /* istanbul ignore if */
  48370. if ((vm.$options.template && vm.$options.template.charAt(0) !== '#') ||
  48371. vm.$options.el || el) {
  48372. warn(
  48373. 'You are using the runtime-only build of Vue where the template ' +
  48374. 'compiler is not available. Either pre-compile the templates into ' +
  48375. 'render functions, or use the compiler-included build.',
  48376. vm
  48377. );
  48378. } else {
  48379. warn(
  48380. 'Failed to mount component: template or render function not defined.',
  48381. vm
  48382. );
  48383. }
  48384. }
  48385. }
  48386. callHook(vm, 'beforeMount');
  48387. var updateComponent;
  48388. /* istanbul ignore if */
  48389. if (config.performance && mark) {
  48390. updateComponent = function () {
  48391. var name = vm._name;
  48392. var id = vm._uid;
  48393. var startTag = "vue-perf-start:" + id;
  48394. var endTag = "vue-perf-end:" + id;
  48395. mark(startTag);
  48396. var vnode = vm._render();
  48397. mark(endTag);
  48398. measure(("vue " + name + " render"), startTag, endTag);
  48399. mark(startTag);
  48400. vm._update(vnode, hydrating);
  48401. mark(endTag);
  48402. measure(("vue " + name + " patch"), startTag, endTag);
  48403. };
  48404. } else {
  48405. updateComponent = function () {
  48406. vm._update(vm._render(), hydrating);
  48407. };
  48408. }
  48409. // we set this to vm._watcher inside the watcher's constructor
  48410. // since the watcher's initial patch may call $forceUpdate (e.g. inside child
  48411. // component's mounted hook), which relies on vm._watcher being already defined
  48412. new Watcher(vm, updateComponent, noop, {
  48413. before: function before () {
  48414. if (vm._isMounted && !vm._isDestroyed) {
  48415. callHook(vm, 'beforeUpdate');
  48416. }
  48417. }
  48418. }, true /* isRenderWatcher */);
  48419. hydrating = false;
  48420. // manually mounted instance, call mounted on self
  48421. // mounted is called for render-created child components in its inserted hook
  48422. if (vm.$vnode == null) {
  48423. vm._isMounted = true;
  48424. callHook(vm, 'mounted');
  48425. }
  48426. return vm
  48427. }
  48428. function updateChildComponent (
  48429. vm,
  48430. propsData,
  48431. listeners,
  48432. parentVnode,
  48433. renderChildren
  48434. ) {
  48435. {
  48436. isUpdatingChildComponent = true;
  48437. }
  48438. // determine whether component has slot children
  48439. // we need to do this before overwriting $options._renderChildren.
  48440. // check if there are dynamic scopedSlots (hand-written or compiled but with
  48441. // dynamic slot names). Static scoped slots compiled from template has the
  48442. // "$stable" marker.
  48443. var newScopedSlots = parentVnode.data.scopedSlots;
  48444. var oldScopedSlots = vm.$scopedSlots;
  48445. var hasDynamicScopedSlot = !!(
  48446. (newScopedSlots && !newScopedSlots.$stable) ||
  48447. (oldScopedSlots !== emptyObject && !oldScopedSlots.$stable) ||
  48448. (newScopedSlots && vm.$scopedSlots.$key !== newScopedSlots.$key)
  48449. );
  48450. // Any static slot children from the parent may have changed during parent's
  48451. // update. Dynamic scoped slots may also have changed. In such cases, a forced
  48452. // update is necessary to ensure correctness.
  48453. var needsForceUpdate = !!(
  48454. renderChildren || // has new static slots
  48455. vm.$options._renderChildren || // has old static slots
  48456. hasDynamicScopedSlot
  48457. );
  48458. vm.$options._parentVnode = parentVnode;
  48459. vm.$vnode = parentVnode; // update vm's placeholder node without re-render
  48460. if (vm._vnode) { // update child tree's parent
  48461. vm._vnode.parent = parentVnode;
  48462. }
  48463. vm.$options._renderChildren = renderChildren;
  48464. // update $attrs and $listeners hash
  48465. // these are also reactive so they may trigger child update if the child
  48466. // used them during render
  48467. vm.$attrs = parentVnode.data.attrs || emptyObject;
  48468. vm.$listeners = listeners || emptyObject;
  48469. // update props
  48470. if (propsData && vm.$options.props) {
  48471. toggleObserving(false);
  48472. var props = vm._props;
  48473. var propKeys = vm.$options._propKeys || [];
  48474. for (var i = 0; i < propKeys.length; i++) {
  48475. var key = propKeys[i];
  48476. var propOptions = vm.$options.props; // wtf flow?
  48477. props[key] = validateProp(key, propOptions, propsData, vm);
  48478. }
  48479. toggleObserving(true);
  48480. // keep a copy of raw propsData
  48481. vm.$options.propsData = propsData;
  48482. }
  48483. // update listeners
  48484. listeners = listeners || emptyObject;
  48485. var oldListeners = vm.$options._parentListeners;
  48486. vm.$options._parentListeners = listeners;
  48487. updateComponentListeners(vm, listeners, oldListeners);
  48488. // resolve slots + force update if has children
  48489. if (needsForceUpdate) {
  48490. vm.$slots = resolveSlots(renderChildren, parentVnode.context);
  48491. vm.$forceUpdate();
  48492. }
  48493. {
  48494. isUpdatingChildComponent = false;
  48495. }
  48496. }
  48497. function isInInactiveTree (vm) {
  48498. while (vm && (vm = vm.$parent)) {
  48499. if (vm._inactive) { return true }
  48500. }
  48501. return false
  48502. }
  48503. function activateChildComponent (vm, direct) {
  48504. if (direct) {
  48505. vm._directInactive = false;
  48506. if (isInInactiveTree(vm)) {
  48507. return
  48508. }
  48509. } else if (vm._directInactive) {
  48510. return
  48511. }
  48512. if (vm._inactive || vm._inactive === null) {
  48513. vm._inactive = false;
  48514. for (var i = 0; i < vm.$children.length; i++) {
  48515. activateChildComponent(vm.$children[i]);
  48516. }
  48517. callHook(vm, 'activated');
  48518. }
  48519. }
  48520. function deactivateChildComponent (vm, direct) {
  48521. if (direct) {
  48522. vm._directInactive = true;
  48523. if (isInInactiveTree(vm)) {
  48524. return
  48525. }
  48526. }
  48527. if (!vm._inactive) {
  48528. vm._inactive = true;
  48529. for (var i = 0; i < vm.$children.length; i++) {
  48530. deactivateChildComponent(vm.$children[i]);
  48531. }
  48532. callHook(vm, 'deactivated');
  48533. }
  48534. }
  48535. function callHook (vm, hook) {
  48536. // #7573 disable dep collection when invoking lifecycle hooks
  48537. pushTarget();
  48538. var handlers = vm.$options[hook];
  48539. var info = hook + " hook";
  48540. if (handlers) {
  48541. for (var i = 0, j = handlers.length; i < j; i++) {
  48542. invokeWithErrorHandling(handlers[i], vm, null, vm, info);
  48543. }
  48544. }
  48545. if (vm._hasHookEvent) {
  48546. vm.$emit('hook:' + hook);
  48547. }
  48548. popTarget();
  48549. }
  48550. /* */
  48551. var MAX_UPDATE_COUNT = 100;
  48552. var queue = [];
  48553. var activatedChildren = [];
  48554. var has = {};
  48555. var circular = {};
  48556. var waiting = false;
  48557. var flushing = false;
  48558. var index = 0;
  48559. /**
  48560. * Reset the scheduler's state.
  48561. */
  48562. function resetSchedulerState () {
  48563. index = queue.length = activatedChildren.length = 0;
  48564. has = {};
  48565. {
  48566. circular = {};
  48567. }
  48568. waiting = flushing = false;
  48569. }
  48570. // Async edge case #6566 requires saving the timestamp when event listeners are
  48571. // attached. However, calling performance.now() has a perf overhead especially
  48572. // if the page has thousands of event listeners. Instead, we take a timestamp
  48573. // every time the scheduler flushes and use that for all event listeners
  48574. // attached during that flush.
  48575. var currentFlushTimestamp = 0;
  48576. // Async edge case fix requires storing an event listener's attach timestamp.
  48577. var getNow = Date.now;
  48578. // Determine what event timestamp the browser is using. Annoyingly, the
  48579. // timestamp can either be hi-res (relative to page load) or low-res
  48580. // (relative to UNIX epoch), so in order to compare time we have to use the
  48581. // same timestamp type when saving the flush timestamp.
  48582. // All IE versions use low-res event timestamps, and have problematic clock
  48583. // implementations (#9632)
  48584. if (inBrowser && !isIE) {
  48585. var performance = window.performance;
  48586. if (
  48587. performance &&
  48588. typeof performance.now === 'function' &&
  48589. getNow() > document.createEvent('Event').timeStamp
  48590. ) {
  48591. // if the event timestamp, although evaluated AFTER the Date.now(), is
  48592. // smaller than it, it means the event is using a hi-res timestamp,
  48593. // and we need to use the hi-res version for event listener timestamps as
  48594. // well.
  48595. getNow = function () { return performance.now(); };
  48596. }
  48597. }
  48598. /**
  48599. * Flush both queues and run the watchers.
  48600. */
  48601. function flushSchedulerQueue () {
  48602. currentFlushTimestamp = getNow();
  48603. flushing = true;
  48604. var watcher, id;
  48605. // Sort queue before flush.
  48606. // This ensures that:
  48607. // 1. Components are updated from parent to child. (because parent is always
  48608. // created before the child)
  48609. // 2. A component's user watchers are run before its render watcher (because
  48610. // user watchers are created before the render watcher)
  48611. // 3. If a component is destroyed during a parent component's watcher run,
  48612. // its watchers can be skipped.
  48613. queue.sort(function (a, b) { return a.id - b.id; });
  48614. // do not cache length because more watchers might be pushed
  48615. // as we run existing watchers
  48616. for (index = 0; index < queue.length; index++) {
  48617. watcher = queue[index];
  48618. if (watcher.before) {
  48619. watcher.before();
  48620. }
  48621. id = watcher.id;
  48622. has[id] = null;
  48623. watcher.run();
  48624. // in dev build, check and stop circular updates.
  48625. if (has[id] != null) {
  48626. circular[id] = (circular[id] || 0) + 1;
  48627. if (circular[id] > MAX_UPDATE_COUNT) {
  48628. warn(
  48629. 'You may have an infinite update loop ' + (
  48630. watcher.user
  48631. ? ("in watcher with expression \"" + (watcher.expression) + "\"")
  48632. : "in a component render function."
  48633. ),
  48634. watcher.vm
  48635. );
  48636. break
  48637. }
  48638. }
  48639. }
  48640. // keep copies of post queues before resetting state
  48641. var activatedQueue = activatedChildren.slice();
  48642. var updatedQueue = queue.slice();
  48643. resetSchedulerState();
  48644. // call component updated and activated hooks
  48645. callActivatedHooks(activatedQueue);
  48646. callUpdatedHooks(updatedQueue);
  48647. // devtool hook
  48648. /* istanbul ignore if */
  48649. if (devtools && config.devtools) {
  48650. devtools.emit('flush');
  48651. }
  48652. }
  48653. function callUpdatedHooks (queue) {
  48654. var i = queue.length;
  48655. while (i--) {
  48656. var watcher = queue[i];
  48657. var vm = watcher.vm;
  48658. if (vm._watcher === watcher && vm._isMounted && !vm._isDestroyed) {
  48659. callHook(vm, 'updated');
  48660. }
  48661. }
  48662. }
  48663. /**
  48664. * Queue a kept-alive component that was activated during patch.
  48665. * The queue will be processed after the entire tree has been patched.
  48666. */
  48667. function queueActivatedComponent (vm) {
  48668. // setting _inactive to false here so that a render function can
  48669. // rely on checking whether it's in an inactive tree (e.g. router-view)
  48670. vm._inactive = false;
  48671. activatedChildren.push(vm);
  48672. }
  48673. function callActivatedHooks (queue) {
  48674. for (var i = 0; i < queue.length; i++) {
  48675. queue[i]._inactive = true;
  48676. activateChildComponent(queue[i], true /* true */);
  48677. }
  48678. }
  48679. /**
  48680. * Push a watcher into the watcher queue.
  48681. * Jobs with duplicate IDs will be skipped unless it's
  48682. * pushed when the queue is being flushed.
  48683. */
  48684. function queueWatcher (watcher) {
  48685. var id = watcher.id;
  48686. if (has[id] == null) {
  48687. has[id] = true;
  48688. if (!flushing) {
  48689. queue.push(watcher);
  48690. } else {
  48691. // if already flushing, splice the watcher based on its id
  48692. // if already past its id, it will be run next immediately.
  48693. var i = queue.length - 1;
  48694. while (i > index && queue[i].id > watcher.id) {
  48695. i--;
  48696. }
  48697. queue.splice(i + 1, 0, watcher);
  48698. }
  48699. // queue the flush
  48700. if (!waiting) {
  48701. waiting = true;
  48702. if (!config.async) {
  48703. flushSchedulerQueue();
  48704. return
  48705. }
  48706. nextTick(flushSchedulerQueue);
  48707. }
  48708. }
  48709. }
  48710. /* */
  48711. var uid$2 = 0;
  48712. /**
  48713. * A watcher parses an expression, collects dependencies,
  48714. * and fires callback when the expression value changes.
  48715. * This is used for both the $watch() api and directives.
  48716. */
  48717. var Watcher = function Watcher (
  48718. vm,
  48719. expOrFn,
  48720. cb,
  48721. options,
  48722. isRenderWatcher
  48723. ) {
  48724. this.vm = vm;
  48725. if (isRenderWatcher) {
  48726. vm._watcher = this;
  48727. }
  48728. vm._watchers.push(this);
  48729. // options
  48730. if (options) {
  48731. this.deep = !!options.deep;
  48732. this.user = !!options.user;
  48733. this.lazy = !!options.lazy;
  48734. this.sync = !!options.sync;
  48735. this.before = options.before;
  48736. } else {
  48737. this.deep = this.user = this.lazy = this.sync = false;
  48738. }
  48739. this.cb = cb;
  48740. this.id = ++uid$2; // uid for batching
  48741. this.active = true;
  48742. this.dirty = this.lazy; // for lazy watchers
  48743. this.deps = [];
  48744. this.newDeps = [];
  48745. this.depIds = new _Set();
  48746. this.newDepIds = new _Set();
  48747. this.expression = expOrFn.toString();
  48748. // parse expression for getter
  48749. if (typeof expOrFn === 'function') {
  48750. this.getter = expOrFn;
  48751. } else {
  48752. this.getter = parsePath(expOrFn);
  48753. if (!this.getter) {
  48754. this.getter = noop;
  48755. warn(
  48756. "Failed watching path: \"" + expOrFn + "\" " +
  48757. 'Watcher only accepts simple dot-delimited paths. ' +
  48758. 'For full control, use a function instead.',
  48759. vm
  48760. );
  48761. }
  48762. }
  48763. this.value = this.lazy
  48764. ? undefined
  48765. : this.get();
  48766. };
  48767. /**
  48768. * Evaluate the getter, and re-collect dependencies.
  48769. */
  48770. Watcher.prototype.get = function get () {
  48771. pushTarget(this);
  48772. var value;
  48773. var vm = this.vm;
  48774. try {
  48775. value = this.getter.call(vm, vm);
  48776. } catch (e) {
  48777. if (this.user) {
  48778. handleError(e, vm, ("getter for watcher \"" + (this.expression) + "\""));
  48779. } else {
  48780. throw e
  48781. }
  48782. } finally {
  48783. // "touch" every property so they are all tracked as
  48784. // dependencies for deep watching
  48785. if (this.deep) {
  48786. traverse(value);
  48787. }
  48788. popTarget();
  48789. this.cleanupDeps();
  48790. }
  48791. return value
  48792. };
  48793. /**
  48794. * Add a dependency to this directive.
  48795. */
  48796. Watcher.prototype.addDep = function addDep (dep) {
  48797. var id = dep.id;
  48798. if (!this.newDepIds.has(id)) {
  48799. this.newDepIds.add(id);
  48800. this.newDeps.push(dep);
  48801. if (!this.depIds.has(id)) {
  48802. dep.addSub(this);
  48803. }
  48804. }
  48805. };
  48806. /**
  48807. * Clean up for dependency collection.
  48808. */
  48809. Watcher.prototype.cleanupDeps = function cleanupDeps () {
  48810. var i = this.deps.length;
  48811. while (i--) {
  48812. var dep = this.deps[i];
  48813. if (!this.newDepIds.has(dep.id)) {
  48814. dep.removeSub(this);
  48815. }
  48816. }
  48817. var tmp = this.depIds;
  48818. this.depIds = this.newDepIds;
  48819. this.newDepIds = tmp;
  48820. this.newDepIds.clear();
  48821. tmp = this.deps;
  48822. this.deps = this.newDeps;
  48823. this.newDeps = tmp;
  48824. this.newDeps.length = 0;
  48825. };
  48826. /**
  48827. * Subscriber interface.
  48828. * Will be called when a dependency changes.
  48829. */
  48830. Watcher.prototype.update = function update () {
  48831. /* istanbul ignore else */
  48832. if (this.lazy) {
  48833. this.dirty = true;
  48834. } else if (this.sync) {
  48835. this.run();
  48836. } else {
  48837. queueWatcher(this);
  48838. }
  48839. };
  48840. /**
  48841. * Scheduler job interface.
  48842. * Will be called by the scheduler.
  48843. */
  48844. Watcher.prototype.run = function run () {
  48845. if (this.active) {
  48846. var value = this.get();
  48847. if (
  48848. value !== this.value ||
  48849. // Deep watchers and watchers on Object/Arrays should fire even
  48850. // when the value is the same, because the value may
  48851. // have mutated.
  48852. isObject(value) ||
  48853. this.deep
  48854. ) {
  48855. // set new value
  48856. var oldValue = this.value;
  48857. this.value = value;
  48858. if (this.user) {
  48859. try {
  48860. this.cb.call(this.vm, value, oldValue);
  48861. } catch (e) {
  48862. handleError(e, this.vm, ("callback for watcher \"" + (this.expression) + "\""));
  48863. }
  48864. } else {
  48865. this.cb.call(this.vm, value, oldValue);
  48866. }
  48867. }
  48868. }
  48869. };
  48870. /**
  48871. * Evaluate the value of the watcher.
  48872. * This only gets called for lazy watchers.
  48873. */
  48874. Watcher.prototype.evaluate = function evaluate () {
  48875. this.value = this.get();
  48876. this.dirty = false;
  48877. };
  48878. /**
  48879. * Depend on all deps collected by this watcher.
  48880. */
  48881. Watcher.prototype.depend = function depend () {
  48882. var i = this.deps.length;
  48883. while (i--) {
  48884. this.deps[i].depend();
  48885. }
  48886. };
  48887. /**
  48888. * Remove self from all dependencies' subscriber list.
  48889. */
  48890. Watcher.prototype.teardown = function teardown () {
  48891. if (this.active) {
  48892. // remove self from vm's watcher list
  48893. // this is a somewhat expensive operation so we skip it
  48894. // if the vm is being destroyed.
  48895. if (!this.vm._isBeingDestroyed) {
  48896. remove(this.vm._watchers, this);
  48897. }
  48898. var i = this.deps.length;
  48899. while (i--) {
  48900. this.deps[i].removeSub(this);
  48901. }
  48902. this.active = false;
  48903. }
  48904. };
  48905. /* */
  48906. var sharedPropertyDefinition = {
  48907. enumerable: true,
  48908. configurable: true,
  48909. get: noop,
  48910. set: noop
  48911. };
  48912. function proxy (target, sourceKey, key) {
  48913. sharedPropertyDefinition.get = function proxyGetter () {
  48914. return this[sourceKey][key]
  48915. };
  48916. sharedPropertyDefinition.set = function proxySetter (val) {
  48917. this[sourceKey][key] = val;
  48918. };
  48919. Object.defineProperty(target, key, sharedPropertyDefinition);
  48920. }
  48921. function initState (vm) {
  48922. vm._watchers = [];
  48923. var opts = vm.$options;
  48924. if (opts.props) { initProps(vm, opts.props); }
  48925. if (opts.methods) { initMethods(vm, opts.methods); }
  48926. if (opts.data) {
  48927. initData(vm);
  48928. } else {
  48929. observe(vm._data = {}, true /* asRootData */);
  48930. }
  48931. if (opts.computed) { initComputed(vm, opts.computed); }
  48932. if (opts.watch && opts.watch !== nativeWatch) {
  48933. initWatch(vm, opts.watch);
  48934. }
  48935. }
  48936. function initProps (vm, propsOptions) {
  48937. var propsData = vm.$options.propsData || {};
  48938. var props = vm._props = {};
  48939. // cache prop keys so that future props updates can iterate using Array
  48940. // instead of dynamic object key enumeration.
  48941. var keys = vm.$options._propKeys = [];
  48942. var isRoot = !vm.$parent;
  48943. // root instance props should be converted
  48944. if (!isRoot) {
  48945. toggleObserving(false);
  48946. }
  48947. var loop = function ( key ) {
  48948. keys.push(key);
  48949. var value = validateProp(key, propsOptions, propsData, vm);
  48950. /* istanbul ignore else */
  48951. {
  48952. var hyphenatedKey = hyphenate(key);
  48953. if (isReservedAttribute(hyphenatedKey) ||
  48954. config.isReservedAttr(hyphenatedKey)) {
  48955. warn(
  48956. ("\"" + hyphenatedKey + "\" is a reserved attribute and cannot be used as component prop."),
  48957. vm
  48958. );
  48959. }
  48960. defineReactive$$1(props, key, value, function () {
  48961. if (!isRoot && !isUpdatingChildComponent) {
  48962. warn(
  48963. "Avoid mutating a prop directly since the value will be " +
  48964. "overwritten whenever the parent component re-renders. " +
  48965. "Instead, use a data or computed property based on the prop's " +
  48966. "value. Prop being mutated: \"" + key + "\"",
  48967. vm
  48968. );
  48969. }
  48970. });
  48971. }
  48972. // static props are already proxied on the component's prototype
  48973. // during Vue.extend(). We only need to proxy props defined at
  48974. // instantiation here.
  48975. if (!(key in vm)) {
  48976. proxy(vm, "_props", key);
  48977. }
  48978. };
  48979. for (var key in propsOptions) loop( key );
  48980. toggleObserving(true);
  48981. }
  48982. function initData (vm) {
  48983. var data = vm.$options.data;
  48984. data = vm._data = typeof data === 'function'
  48985. ? getData(data, vm)
  48986. : data || {};
  48987. if (!isPlainObject(data)) {
  48988. data = {};
  48989. warn(
  48990. 'data functions should return an object:\n' +
  48991. 'https://vuejs.org/v2/guide/components.html#data-Must-Be-a-Function',
  48992. vm
  48993. );
  48994. }
  48995. // proxy data on instance
  48996. var keys = Object.keys(data);
  48997. var props = vm.$options.props;
  48998. var methods = vm.$options.methods;
  48999. var i = keys.length;
  49000. while (i--) {
  49001. var key = keys[i];
  49002. {
  49003. if (methods && hasOwn(methods, key)) {
  49004. warn(
  49005. ("Method \"" + key + "\" has already been defined as a data property."),
  49006. vm
  49007. );
  49008. }
  49009. }
  49010. if (props && hasOwn(props, key)) {
  49011. warn(
  49012. "The data property \"" + key + "\" is already declared as a prop. " +
  49013. "Use prop default value instead.",
  49014. vm
  49015. );
  49016. } else if (!isReserved(key)) {
  49017. proxy(vm, "_data", key);
  49018. }
  49019. }
  49020. // observe data
  49021. observe(data, true /* asRootData */);
  49022. }
  49023. function getData (data, vm) {
  49024. // #7573 disable dep collection when invoking data getters
  49025. pushTarget();
  49026. try {
  49027. return data.call(vm, vm)
  49028. } catch (e) {
  49029. handleError(e, vm, "data()");
  49030. return {}
  49031. } finally {
  49032. popTarget();
  49033. }
  49034. }
  49035. var computedWatcherOptions = { lazy: true };
  49036. function initComputed (vm, computed) {
  49037. // $flow-disable-line
  49038. var watchers = vm._computedWatchers = Object.create(null);
  49039. // computed properties are just getters during SSR
  49040. var isSSR = isServerRendering();
  49041. for (var key in computed) {
  49042. var userDef = computed[key];
  49043. var getter = typeof userDef === 'function' ? userDef : userDef.get;
  49044. if (getter == null) {
  49045. warn(
  49046. ("Getter is missing for computed property \"" + key + "\"."),
  49047. vm
  49048. );
  49049. }
  49050. if (!isSSR) {
  49051. // create internal watcher for the computed property.
  49052. watchers[key] = new Watcher(
  49053. vm,
  49054. getter || noop,
  49055. noop,
  49056. computedWatcherOptions
  49057. );
  49058. }
  49059. // component-defined computed properties are already defined on the
  49060. // component prototype. We only need to define computed properties defined
  49061. // at instantiation here.
  49062. if (!(key in vm)) {
  49063. defineComputed(vm, key, userDef);
  49064. } else {
  49065. if (key in vm.$data) {
  49066. warn(("The computed property \"" + key + "\" is already defined in data."), vm);
  49067. } else if (vm.$options.props && key in vm.$options.props) {
  49068. warn(("The computed property \"" + key + "\" is already defined as a prop."), vm);
  49069. }
  49070. }
  49071. }
  49072. }
  49073. function defineComputed (
  49074. target,
  49075. key,
  49076. userDef
  49077. ) {
  49078. var shouldCache = !isServerRendering();
  49079. if (typeof userDef === 'function') {
  49080. sharedPropertyDefinition.get = shouldCache
  49081. ? createComputedGetter(key)
  49082. : createGetterInvoker(userDef);
  49083. sharedPropertyDefinition.set = noop;
  49084. } else {
  49085. sharedPropertyDefinition.get = userDef.get
  49086. ? shouldCache && userDef.cache !== false
  49087. ? createComputedGetter(key)
  49088. : createGetterInvoker(userDef.get)
  49089. : noop;
  49090. sharedPropertyDefinition.set = userDef.set || noop;
  49091. }
  49092. if (sharedPropertyDefinition.set === noop) {
  49093. sharedPropertyDefinition.set = function () {
  49094. warn(
  49095. ("Computed property \"" + key + "\" was assigned to but it has no setter."),
  49096. this
  49097. );
  49098. };
  49099. }
  49100. Object.defineProperty(target, key, sharedPropertyDefinition);
  49101. }
  49102. function createComputedGetter (key) {
  49103. return function computedGetter () {
  49104. var watcher = this._computedWatchers && this._computedWatchers[key];
  49105. if (watcher) {
  49106. if (watcher.dirty) {
  49107. watcher.evaluate();
  49108. }
  49109. if (Dep.target) {
  49110. watcher.depend();
  49111. }
  49112. return watcher.value
  49113. }
  49114. }
  49115. }
  49116. function createGetterInvoker(fn) {
  49117. return function computedGetter () {
  49118. return fn.call(this, this)
  49119. }
  49120. }
  49121. function initMethods (vm, methods) {
  49122. var props = vm.$options.props;
  49123. for (var key in methods) {
  49124. {
  49125. if (typeof methods[key] !== 'function') {
  49126. warn(
  49127. "Method \"" + key + "\" has type \"" + (typeof methods[key]) + "\" in the component definition. " +
  49128. "Did you reference the function correctly?",
  49129. vm
  49130. );
  49131. }
  49132. if (props && hasOwn(props, key)) {
  49133. warn(
  49134. ("Method \"" + key + "\" has already been defined as a prop."),
  49135. vm
  49136. );
  49137. }
  49138. if ((key in vm) && isReserved(key)) {
  49139. warn(
  49140. "Method \"" + key + "\" conflicts with an existing Vue instance method. " +
  49141. "Avoid defining component methods that start with _ or $."
  49142. );
  49143. }
  49144. }
  49145. vm[key] = typeof methods[key] !== 'function' ? noop : bind(methods[key], vm);
  49146. }
  49147. }
  49148. function initWatch (vm, watch) {
  49149. for (var key in watch) {
  49150. var handler = watch[key];
  49151. if (Array.isArray(handler)) {
  49152. for (var i = 0; i < handler.length; i++) {
  49153. createWatcher(vm, key, handler[i]);
  49154. }
  49155. } else {
  49156. createWatcher(vm, key, handler);
  49157. }
  49158. }
  49159. }
  49160. function createWatcher (
  49161. vm,
  49162. expOrFn,
  49163. handler,
  49164. options
  49165. ) {
  49166. if (isPlainObject(handler)) {
  49167. options = handler;
  49168. handler = handler.handler;
  49169. }
  49170. if (typeof handler === 'string') {
  49171. handler = vm[handler];
  49172. }
  49173. return vm.$watch(expOrFn, handler, options)
  49174. }
  49175. function stateMixin (Vue) {
  49176. // flow somehow has problems with directly declared definition object
  49177. // when using Object.defineProperty, so we have to procedurally build up
  49178. // the object here.
  49179. var dataDef = {};
  49180. dataDef.get = function () { return this._data };
  49181. var propsDef = {};
  49182. propsDef.get = function () { return this._props };
  49183. {
  49184. dataDef.set = function () {
  49185. warn(
  49186. 'Avoid replacing instance root $data. ' +
  49187. 'Use nested data properties instead.',
  49188. this
  49189. );
  49190. };
  49191. propsDef.set = function () {
  49192. warn("$props is readonly.", this);
  49193. };
  49194. }
  49195. Object.defineProperty(Vue.prototype, '$data', dataDef);
  49196. Object.defineProperty(Vue.prototype, '$props', propsDef);
  49197. Vue.prototype.$set = set;
  49198. Vue.prototype.$delete = del;
  49199. Vue.prototype.$watch = function (
  49200. expOrFn,
  49201. cb,
  49202. options
  49203. ) {
  49204. var vm = this;
  49205. if (isPlainObject(cb)) {
  49206. return createWatcher(vm, expOrFn, cb, options)
  49207. }
  49208. options = options || {};
  49209. options.user = true;
  49210. var watcher = new Watcher(vm, expOrFn, cb, options);
  49211. if (options.immediate) {
  49212. try {
  49213. cb.call(vm, watcher.value);
  49214. } catch (error) {
  49215. handleError(error, vm, ("callback for immediate watcher \"" + (watcher.expression) + "\""));
  49216. }
  49217. }
  49218. return function unwatchFn () {
  49219. watcher.teardown();
  49220. }
  49221. };
  49222. }
  49223. /* */
  49224. var uid$3 = 0;
  49225. function initMixin (Vue) {
  49226. Vue.prototype._init = function (options) {
  49227. var vm = this;
  49228. // a uid
  49229. vm._uid = uid$3++;
  49230. var startTag, endTag;
  49231. /* istanbul ignore if */
  49232. if (config.performance && mark) {
  49233. startTag = "vue-perf-start:" + (vm._uid);
  49234. endTag = "vue-perf-end:" + (vm._uid);
  49235. mark(startTag);
  49236. }
  49237. // a flag to avoid this being observed
  49238. vm._isVue = true;
  49239. // merge options
  49240. if (options && options._isComponent) {
  49241. // optimize internal component instantiation
  49242. // since dynamic options merging is pretty slow, and none of the
  49243. // internal component options needs special treatment.
  49244. initInternalComponent(vm, options);
  49245. } else {
  49246. vm.$options = mergeOptions(
  49247. resolveConstructorOptions(vm.constructor),
  49248. options || {},
  49249. vm
  49250. );
  49251. }
  49252. /* istanbul ignore else */
  49253. {
  49254. initProxy(vm);
  49255. }
  49256. // expose real self
  49257. vm._self = vm;
  49258. initLifecycle(vm);
  49259. initEvents(vm);
  49260. initRender(vm);
  49261. callHook(vm, 'beforeCreate');
  49262. initInjections(vm); // resolve injections before data/props
  49263. initState(vm);
  49264. initProvide(vm); // resolve provide after data/props
  49265. callHook(vm, 'created');
  49266. /* istanbul ignore if */
  49267. if (config.performance && mark) {
  49268. vm._name = formatComponentName(vm, false);
  49269. mark(endTag);
  49270. measure(("vue " + (vm._name) + " init"), startTag, endTag);
  49271. }
  49272. if (vm.$options.el) {
  49273. vm.$mount(vm.$options.el);
  49274. }
  49275. };
  49276. }
  49277. function initInternalComponent (vm, options) {
  49278. var opts = vm.$options = Object.create(vm.constructor.options);
  49279. // doing this because it's faster than dynamic enumeration.
  49280. var parentVnode = options._parentVnode;
  49281. opts.parent = options.parent;
  49282. opts._parentVnode = parentVnode;
  49283. var vnodeComponentOptions = parentVnode.componentOptions;
  49284. opts.propsData = vnodeComponentOptions.propsData;
  49285. opts._parentListeners = vnodeComponentOptions.listeners;
  49286. opts._renderChildren = vnodeComponentOptions.children;
  49287. opts._componentTag = vnodeComponentOptions.tag;
  49288. if (options.render) {
  49289. opts.render = options.render;
  49290. opts.staticRenderFns = options.staticRenderFns;
  49291. }
  49292. }
  49293. function resolveConstructorOptions (Ctor) {
  49294. var options = Ctor.options;
  49295. if (Ctor.super) {
  49296. var superOptions = resolveConstructorOptions(Ctor.super);
  49297. var cachedSuperOptions = Ctor.superOptions;
  49298. if (superOptions !== cachedSuperOptions) {
  49299. // super option changed,
  49300. // need to resolve new options.
  49301. Ctor.superOptions = superOptions;
  49302. // check if there are any late-modified/attached options (#4976)
  49303. var modifiedOptions = resolveModifiedOptions(Ctor);
  49304. // update base extend options
  49305. if (modifiedOptions) {
  49306. extend(Ctor.extendOptions, modifiedOptions);
  49307. }
  49308. options = Ctor.options = mergeOptions(superOptions, Ctor.extendOptions);
  49309. if (options.name) {
  49310. options.components[options.name] = Ctor;
  49311. }
  49312. }
  49313. }
  49314. return options
  49315. }
  49316. function resolveModifiedOptions (Ctor) {
  49317. var modified;
  49318. var latest = Ctor.options;
  49319. var sealed = Ctor.sealedOptions;
  49320. for (var key in latest) {
  49321. if (latest[key] !== sealed[key]) {
  49322. if (!modified) { modified = {}; }
  49323. modified[key] = latest[key];
  49324. }
  49325. }
  49326. return modified
  49327. }
  49328. function Vue (options) {
  49329. if (!(this instanceof Vue)
  49330. ) {
  49331. warn('Vue is a constructor and should be called with the `new` keyword');
  49332. }
  49333. this._init(options);
  49334. }
  49335. initMixin(Vue);
  49336. stateMixin(Vue);
  49337. eventsMixin(Vue);
  49338. lifecycleMixin(Vue);
  49339. renderMixin(Vue);
  49340. /* */
  49341. function initUse (Vue) {
  49342. Vue.use = function (plugin) {
  49343. var installedPlugins = (this._installedPlugins || (this._installedPlugins = []));
  49344. if (installedPlugins.indexOf(plugin) > -1) {
  49345. return this
  49346. }
  49347. // additional parameters
  49348. var args = toArray(arguments, 1);
  49349. args.unshift(this);
  49350. if (typeof plugin.install === 'function') {
  49351. plugin.install.apply(plugin, args);
  49352. } else if (typeof plugin === 'function') {
  49353. plugin.apply(null, args);
  49354. }
  49355. installedPlugins.push(plugin);
  49356. return this
  49357. };
  49358. }
  49359. /* */
  49360. function initMixin$1 (Vue) {
  49361. Vue.mixin = function (mixin) {
  49362. this.options = mergeOptions(this.options, mixin);
  49363. return this
  49364. };
  49365. }
  49366. /* */
  49367. function initExtend (Vue) {
  49368. /**
  49369. * Each instance constructor, including Vue, has a unique
  49370. * cid. This enables us to create wrapped "child
  49371. * constructors" for prototypal inheritance and cache them.
  49372. */
  49373. Vue.cid = 0;
  49374. var cid = 1;
  49375. /**
  49376. * Class inheritance
  49377. */
  49378. Vue.extend = function (extendOptions) {
  49379. extendOptions = extendOptions || {};
  49380. var Super = this;
  49381. var SuperId = Super.cid;
  49382. var cachedCtors = extendOptions._Ctor || (extendOptions._Ctor = {});
  49383. if (cachedCtors[SuperId]) {
  49384. return cachedCtors[SuperId]
  49385. }
  49386. var name = extendOptions.name || Super.options.name;
  49387. if (name) {
  49388. validateComponentName(name);
  49389. }
  49390. var Sub = function VueComponent (options) {
  49391. this._init(options);
  49392. };
  49393. Sub.prototype = Object.create(Super.prototype);
  49394. Sub.prototype.constructor = Sub;
  49395. Sub.cid = cid++;
  49396. Sub.options = mergeOptions(
  49397. Super.options,
  49398. extendOptions
  49399. );
  49400. Sub['super'] = Super;
  49401. // For props and computed properties, we define the proxy getters on
  49402. // the Vue instances at extension time, on the extended prototype. This
  49403. // avoids Object.defineProperty calls for each instance created.
  49404. if (Sub.options.props) {
  49405. initProps$1(Sub);
  49406. }
  49407. if (Sub.options.computed) {
  49408. initComputed$1(Sub);
  49409. }
  49410. // allow further extension/mixin/plugin usage
  49411. Sub.extend = Super.extend;
  49412. Sub.mixin = Super.mixin;
  49413. Sub.use = Super.use;
  49414. // create asset registers, so extended classes
  49415. // can have their private assets too.
  49416. ASSET_TYPES.forEach(function (type) {
  49417. Sub[type] = Super[type];
  49418. });
  49419. // enable recursive self-lookup
  49420. if (name) {
  49421. Sub.options.components[name] = Sub;
  49422. }
  49423. // keep a reference to the super options at extension time.
  49424. // later at instantiation we can check if Super's options have
  49425. // been updated.
  49426. Sub.superOptions = Super.options;
  49427. Sub.extendOptions = extendOptions;
  49428. Sub.sealedOptions = extend({}, Sub.options);
  49429. // cache constructor
  49430. cachedCtors[SuperId] = Sub;
  49431. return Sub
  49432. };
  49433. }
  49434. function initProps$1 (Comp) {
  49435. var props = Comp.options.props;
  49436. for (var key in props) {
  49437. proxy(Comp.prototype, "_props", key);
  49438. }
  49439. }
  49440. function initComputed$1 (Comp) {
  49441. var computed = Comp.options.computed;
  49442. for (var key in computed) {
  49443. defineComputed(Comp.prototype, key, computed[key]);
  49444. }
  49445. }
  49446. /* */
  49447. function initAssetRegisters (Vue) {
  49448. /**
  49449. * Create asset registration methods.
  49450. */
  49451. ASSET_TYPES.forEach(function (type) {
  49452. Vue[type] = function (
  49453. id,
  49454. definition
  49455. ) {
  49456. if (!definition) {
  49457. return this.options[type + 's'][id]
  49458. } else {
  49459. /* istanbul ignore if */
  49460. if (type === 'component') {
  49461. validateComponentName(id);
  49462. }
  49463. if (type === 'component' && isPlainObject(definition)) {
  49464. definition.name = definition.name || id;
  49465. definition = this.options._base.extend(definition);
  49466. }
  49467. if (type === 'directive' && typeof definition === 'function') {
  49468. definition = { bind: definition, update: definition };
  49469. }
  49470. this.options[type + 's'][id] = definition;
  49471. return definition
  49472. }
  49473. };
  49474. });
  49475. }
  49476. /* */
  49477. function getComponentName (opts) {
  49478. return opts && (opts.Ctor.options.name || opts.tag)
  49479. }
  49480. function matches (pattern, name) {
  49481. if (Array.isArray(pattern)) {
  49482. return pattern.indexOf(name) > -1
  49483. } else if (typeof pattern === 'string') {
  49484. return pattern.split(',').indexOf(name) > -1
  49485. } else if (isRegExp(pattern)) {
  49486. return pattern.test(name)
  49487. }
  49488. /* istanbul ignore next */
  49489. return false
  49490. }
  49491. function pruneCache (keepAliveInstance, filter) {
  49492. var cache = keepAliveInstance.cache;
  49493. var keys = keepAliveInstance.keys;
  49494. var _vnode = keepAliveInstance._vnode;
  49495. for (var key in cache) {
  49496. var cachedNode = cache[key];
  49497. if (cachedNode) {
  49498. var name = getComponentName(cachedNode.componentOptions);
  49499. if (name && !filter(name)) {
  49500. pruneCacheEntry(cache, key, keys, _vnode);
  49501. }
  49502. }
  49503. }
  49504. }
  49505. function pruneCacheEntry (
  49506. cache,
  49507. key,
  49508. keys,
  49509. current
  49510. ) {
  49511. var cached$$1 = cache[key];
  49512. if (cached$$1 && (!current || cached$$1.tag !== current.tag)) {
  49513. cached$$1.componentInstance.$destroy();
  49514. }
  49515. cache[key] = null;
  49516. remove(keys, key);
  49517. }
  49518. var patternTypes = [String, RegExp, Array];
  49519. var KeepAlive = {
  49520. name: 'keep-alive',
  49521. abstract: true,
  49522. props: {
  49523. include: patternTypes,
  49524. exclude: patternTypes,
  49525. max: [String, Number]
  49526. },
  49527. created: function created () {
  49528. this.cache = Object.create(null);
  49529. this.keys = [];
  49530. },
  49531. destroyed: function destroyed () {
  49532. for (var key in this.cache) {
  49533. pruneCacheEntry(this.cache, key, this.keys);
  49534. }
  49535. },
  49536. mounted: function mounted () {
  49537. var this$1 = this;
  49538. this.$watch('include', function (val) {
  49539. pruneCache(this$1, function (name) { return matches(val, name); });
  49540. });
  49541. this.$watch('exclude', function (val) {
  49542. pruneCache(this$1, function (name) { return !matches(val, name); });
  49543. });
  49544. },
  49545. render: function render () {
  49546. var slot = this.$slots.default;
  49547. var vnode = getFirstComponentChild(slot);
  49548. var componentOptions = vnode && vnode.componentOptions;
  49549. if (componentOptions) {
  49550. // check pattern
  49551. var name = getComponentName(componentOptions);
  49552. var ref = this;
  49553. var include = ref.include;
  49554. var exclude = ref.exclude;
  49555. if (
  49556. // not included
  49557. (include && (!name || !matches(include, name))) ||
  49558. // excluded
  49559. (exclude && name && matches(exclude, name))
  49560. ) {
  49561. return vnode
  49562. }
  49563. var ref$1 = this;
  49564. var cache = ref$1.cache;
  49565. var keys = ref$1.keys;
  49566. var key = vnode.key == null
  49567. // same constructor may get registered as different local components
  49568. // so cid alone is not enough (#3269)
  49569. ? componentOptions.Ctor.cid + (componentOptions.tag ? ("::" + (componentOptions.tag)) : '')
  49570. : vnode.key;
  49571. if (cache[key]) {
  49572. vnode.componentInstance = cache[key].componentInstance;
  49573. // make current key freshest
  49574. remove(keys, key);
  49575. keys.push(key);
  49576. } else {
  49577. cache[key] = vnode;
  49578. keys.push(key);
  49579. // prune oldest entry
  49580. if (this.max && keys.length > parseInt(this.max)) {
  49581. pruneCacheEntry(cache, keys[0], keys, this._vnode);
  49582. }
  49583. }
  49584. vnode.data.keepAlive = true;
  49585. }
  49586. return vnode || (slot && slot[0])
  49587. }
  49588. };
  49589. var builtInComponents = {
  49590. KeepAlive: KeepAlive
  49591. };
  49592. /* */
  49593. function initGlobalAPI (Vue) {
  49594. // config
  49595. var configDef = {};
  49596. configDef.get = function () { return config; };
  49597. {
  49598. configDef.set = function () {
  49599. warn(
  49600. 'Do not replace the Vue.config object, set individual fields instead.'
  49601. );
  49602. };
  49603. }
  49604. Object.defineProperty(Vue, 'config', configDef);
  49605. // exposed util methods.
  49606. // NOTE: these are not considered part of the public API - avoid relying on
  49607. // them unless you are aware of the risk.
  49608. Vue.util = {
  49609. warn: warn,
  49610. extend: extend,
  49611. mergeOptions: mergeOptions,
  49612. defineReactive: defineReactive$$1
  49613. };
  49614. Vue.set = set;
  49615. Vue.delete = del;
  49616. Vue.nextTick = nextTick;
  49617. // 2.6 explicit observable API
  49618. Vue.observable = function (obj) {
  49619. observe(obj);
  49620. return obj
  49621. };
  49622. Vue.options = Object.create(null);
  49623. ASSET_TYPES.forEach(function (type) {
  49624. Vue.options[type + 's'] = Object.create(null);
  49625. });
  49626. // this is used to identify the "base" constructor to extend all plain-object
  49627. // components with in Weex's multi-instance scenarios.
  49628. Vue.options._base = Vue;
  49629. extend(Vue.options.components, builtInComponents);
  49630. initUse(Vue);
  49631. initMixin$1(Vue);
  49632. initExtend(Vue);
  49633. initAssetRegisters(Vue);
  49634. }
  49635. initGlobalAPI(Vue);
  49636. Object.defineProperty(Vue.prototype, '$isServer', {
  49637. get: isServerRendering
  49638. });
  49639. Object.defineProperty(Vue.prototype, '$ssrContext', {
  49640. get: function get () {
  49641. /* istanbul ignore next */
  49642. return this.$vnode && this.$vnode.ssrContext
  49643. }
  49644. });
  49645. // expose FunctionalRenderContext for ssr runtime helper installation
  49646. Object.defineProperty(Vue, 'FunctionalRenderContext', {
  49647. value: FunctionalRenderContext
  49648. });
  49649. Vue.version = '2.6.11';
  49650. /* */
  49651. // these are reserved for web because they are directly compiled away
  49652. // during template compilation
  49653. var isReservedAttr = makeMap('style,class');
  49654. // attributes that should be using props for binding
  49655. var acceptValue = makeMap('input,textarea,option,select,progress');
  49656. var mustUseProp = function (tag, type, attr) {
  49657. return (
  49658. (attr === 'value' && acceptValue(tag)) && type !== 'button' ||
  49659. (attr === 'selected' && tag === 'option') ||
  49660. (attr === 'checked' && tag === 'input') ||
  49661. (attr === 'muted' && tag === 'video')
  49662. )
  49663. };
  49664. var isEnumeratedAttr = makeMap('contenteditable,draggable,spellcheck');
  49665. var isValidContentEditableValue = makeMap('events,caret,typing,plaintext-only');
  49666. var convertEnumeratedValue = function (key, value) {
  49667. return isFalsyAttrValue(value) || value === 'false'
  49668. ? 'false'
  49669. // allow arbitrary string value for contenteditable
  49670. : key === 'contenteditable' && isValidContentEditableValue(value)
  49671. ? value
  49672. : 'true'
  49673. };
  49674. var isBooleanAttr = makeMap(
  49675. 'allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,' +
  49676. 'default,defaultchecked,defaultmuted,defaultselected,defer,disabled,' +
  49677. 'enabled,formnovalidate,hidden,indeterminate,inert,ismap,itemscope,loop,multiple,' +
  49678. 'muted,nohref,noresize,noshade,novalidate,nowrap,open,pauseonexit,readonly,' +
  49679. 'required,reversed,scoped,seamless,selected,sortable,translate,' +
  49680. 'truespeed,typemustmatch,visible'
  49681. );
  49682. var xlinkNS = 'http://www.w3.org/1999/xlink';
  49683. var isXlink = function (name) {
  49684. return name.charAt(5) === ':' && name.slice(0, 5) === 'xlink'
  49685. };
  49686. var getXlinkProp = function (name) {
  49687. return isXlink(name) ? name.slice(6, name.length) : ''
  49688. };
  49689. var isFalsyAttrValue = function (val) {
  49690. return val == null || val === false
  49691. };
  49692. /* */
  49693. function genClassForVnode (vnode) {
  49694. var data = vnode.data;
  49695. var parentNode = vnode;
  49696. var childNode = vnode;
  49697. while (isDef(childNode.componentInstance)) {
  49698. childNode = childNode.componentInstance._vnode;
  49699. if (childNode && childNode.data) {
  49700. data = mergeClassData(childNode.data, data);
  49701. }
  49702. }
  49703. while (isDef(parentNode = parentNode.parent)) {
  49704. if (parentNode && parentNode.data) {
  49705. data = mergeClassData(data, parentNode.data);
  49706. }
  49707. }
  49708. return renderClass(data.staticClass, data.class)
  49709. }
  49710. function mergeClassData (child, parent) {
  49711. return {
  49712. staticClass: concat(child.staticClass, parent.staticClass),
  49713. class: isDef(child.class)
  49714. ? [child.class, parent.class]
  49715. : parent.class
  49716. }
  49717. }
  49718. function renderClass (
  49719. staticClass,
  49720. dynamicClass
  49721. ) {
  49722. if (isDef(staticClass) || isDef(dynamicClass)) {
  49723. return concat(staticClass, stringifyClass(dynamicClass))
  49724. }
  49725. /* istanbul ignore next */
  49726. return ''
  49727. }
  49728. function concat (a, b) {
  49729. return a ? b ? (a + ' ' + b) : a : (b || '')
  49730. }
  49731. function stringifyClass (value) {
  49732. if (Array.isArray(value)) {
  49733. return stringifyArray(value)
  49734. }
  49735. if (isObject(value)) {
  49736. return stringifyObject(value)
  49737. }
  49738. if (typeof value === 'string') {
  49739. return value
  49740. }
  49741. /* istanbul ignore next */
  49742. return ''
  49743. }
  49744. function stringifyArray (value) {
  49745. var res = '';
  49746. var stringified;
  49747. for (var i = 0, l = value.length; i < l; i++) {
  49748. if (isDef(stringified = stringifyClass(value[i])) && stringified !== '') {
  49749. if (res) { res += ' '; }
  49750. res += stringified;
  49751. }
  49752. }
  49753. return res
  49754. }
  49755. function stringifyObject (value) {
  49756. var res = '';
  49757. for (var key in value) {
  49758. if (value[key]) {
  49759. if (res) { res += ' '; }
  49760. res += key;
  49761. }
  49762. }
  49763. return res
  49764. }
  49765. /* */
  49766. var namespaceMap = {
  49767. svg: 'http://www.w3.org/2000/svg',
  49768. math: 'http://www.w3.org/1998/Math/MathML'
  49769. };
  49770. var isHTMLTag = makeMap(
  49771. 'html,body,base,head,link,meta,style,title,' +
  49772. 'address,article,aside,footer,header,h1,h2,h3,h4,h5,h6,hgroup,nav,section,' +
  49773. 'div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,' +
  49774. 'a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,rtc,ruby,' +
  49775. 's,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,' +
  49776. 'embed,object,param,source,canvas,script,noscript,del,ins,' +
  49777. 'caption,col,colgroup,table,thead,tbody,td,th,tr,' +
  49778. 'button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,' +
  49779. 'output,progress,select,textarea,' +
  49780. 'details,dialog,menu,menuitem,summary,' +
  49781. 'content,element,shadow,template,blockquote,iframe,tfoot'
  49782. );
  49783. // this map is intentionally selective, only covering SVG elements that may
  49784. // contain child elements.
  49785. var isSVG = makeMap(
  49786. 'svg,animate,circle,clippath,cursor,defs,desc,ellipse,filter,font-face,' +
  49787. 'foreignObject,g,glyph,image,line,marker,mask,missing-glyph,path,pattern,' +
  49788. 'polygon,polyline,rect,switch,symbol,text,textpath,tspan,use,view',
  49789. true
  49790. );
  49791. var isPreTag = function (tag) { return tag === 'pre'; };
  49792. var isReservedTag = function (tag) {
  49793. return isHTMLTag(tag) || isSVG(tag)
  49794. };
  49795. function getTagNamespace (tag) {
  49796. if (isSVG(tag)) {
  49797. return 'svg'
  49798. }
  49799. // basic support for MathML
  49800. // note it doesn't support other MathML elements being component roots
  49801. if (tag === 'math') {
  49802. return 'math'
  49803. }
  49804. }
  49805. var unknownElementCache = Object.create(null);
  49806. function isUnknownElement (tag) {
  49807. /* istanbul ignore if */
  49808. if (!inBrowser) {
  49809. return true
  49810. }
  49811. if (isReservedTag(tag)) {
  49812. return false
  49813. }
  49814. tag = tag.toLowerCase();
  49815. /* istanbul ignore if */
  49816. if (unknownElementCache[tag] != null) {
  49817. return unknownElementCache[tag]
  49818. }
  49819. var el = document.createElement(tag);
  49820. if (tag.indexOf('-') > -1) {
  49821. // http://stackoverflow.com/a/28210364/1070244
  49822. return (unknownElementCache[tag] = (
  49823. el.constructor === window.HTMLUnknownElement ||
  49824. el.constructor === window.HTMLElement
  49825. ))
  49826. } else {
  49827. return (unknownElementCache[tag] = /HTMLUnknownElement/.test(el.toString()))
  49828. }
  49829. }
  49830. var isTextInputType = makeMap('text,number,password,search,email,tel,url');
  49831. /* */
  49832. /**
  49833. * Query an element selector if it's not an element already.
  49834. */
  49835. function query (el) {
  49836. if (typeof el === 'string') {
  49837. var selected = document.querySelector(el);
  49838. if (!selected) {
  49839. warn(
  49840. 'Cannot find element: ' + el
  49841. );
  49842. return document.createElement('div')
  49843. }
  49844. return selected
  49845. } else {
  49846. return el
  49847. }
  49848. }
  49849. /* */
  49850. function createElement$1 (tagName, vnode) {
  49851. var elm = document.createElement(tagName);
  49852. if (tagName !== 'select') {
  49853. return elm
  49854. }
  49855. // false or null will remove the attribute but undefined will not
  49856. if (vnode.data && vnode.data.attrs && vnode.data.attrs.multiple !== undefined) {
  49857. elm.setAttribute('multiple', 'multiple');
  49858. }
  49859. return elm
  49860. }
  49861. function createElementNS (namespace, tagName) {
  49862. return document.createElementNS(namespaceMap[namespace], tagName)
  49863. }
  49864. function createTextNode (text) {
  49865. return document.createTextNode(text)
  49866. }
  49867. function createComment (text) {
  49868. return document.createComment(text)
  49869. }
  49870. function insertBefore (parentNode, newNode, referenceNode) {
  49871. parentNode.insertBefore(newNode, referenceNode);
  49872. }
  49873. function removeChild (node, child) {
  49874. node.removeChild(child);
  49875. }
  49876. function appendChild (node, child) {
  49877. node.appendChild(child);
  49878. }
  49879. function parentNode (node) {
  49880. return node.parentNode
  49881. }
  49882. function nextSibling (node) {
  49883. return node.nextSibling
  49884. }
  49885. function tagName (node) {
  49886. return node.tagName
  49887. }
  49888. function setTextContent (node, text) {
  49889. node.textContent = text;
  49890. }
  49891. function setStyleScope (node, scopeId) {
  49892. node.setAttribute(scopeId, '');
  49893. }
  49894. var nodeOps = /*#__PURE__*/Object.freeze({
  49895. createElement: createElement$1,
  49896. createElementNS: createElementNS,
  49897. createTextNode: createTextNode,
  49898. createComment: createComment,
  49899. insertBefore: insertBefore,
  49900. removeChild: removeChild,
  49901. appendChild: appendChild,
  49902. parentNode: parentNode,
  49903. nextSibling: nextSibling,
  49904. tagName: tagName,
  49905. setTextContent: setTextContent,
  49906. setStyleScope: setStyleScope
  49907. });
  49908. /* */
  49909. var ref = {
  49910. create: function create (_, vnode) {
  49911. registerRef(vnode);
  49912. },
  49913. update: function update (oldVnode, vnode) {
  49914. if (oldVnode.data.ref !== vnode.data.ref) {
  49915. registerRef(oldVnode, true);
  49916. registerRef(vnode);
  49917. }
  49918. },
  49919. destroy: function destroy (vnode) {
  49920. registerRef(vnode, true);
  49921. }
  49922. };
  49923. function registerRef (vnode, isRemoval) {
  49924. var key = vnode.data.ref;
  49925. if (!isDef(key)) { return }
  49926. var vm = vnode.context;
  49927. var ref = vnode.componentInstance || vnode.elm;
  49928. var refs = vm.$refs;
  49929. if (isRemoval) {
  49930. if (Array.isArray(refs[key])) {
  49931. remove(refs[key], ref);
  49932. } else if (refs[key] === ref) {
  49933. refs[key] = undefined;
  49934. }
  49935. } else {
  49936. if (vnode.data.refInFor) {
  49937. if (!Array.isArray(refs[key])) {
  49938. refs[key] = [ref];
  49939. } else if (refs[key].indexOf(ref) < 0) {
  49940. // $flow-disable-line
  49941. refs[key].push(ref);
  49942. }
  49943. } else {
  49944. refs[key] = ref;
  49945. }
  49946. }
  49947. }
  49948. /**
  49949. * Virtual DOM patching algorithm based on Snabbdom by
  49950. * Simon Friis Vindum (@paldepind)
  49951. * Licensed under the MIT License
  49952. * https://github.com/paldepind/snabbdom/blob/master/LICENSE
  49953. *
  49954. * modified by Evan You (@yyx990803)
  49955. *
  49956. * Not type-checking this because this file is perf-critical and the cost
  49957. * of making flow understand it is not worth it.
  49958. */
  49959. var emptyNode = new VNode('', {}, []);
  49960. var hooks = ['create', 'activate', 'update', 'remove', 'destroy'];
  49961. function sameVnode (a, b) {
  49962. return (
  49963. a.key === b.key && (
  49964. (
  49965. a.tag === b.tag &&
  49966. a.isComment === b.isComment &&
  49967. isDef(a.data) === isDef(b.data) &&
  49968. sameInputType(a, b)
  49969. ) || (
  49970. isTrue(a.isAsyncPlaceholder) &&
  49971. a.asyncFactory === b.asyncFactory &&
  49972. isUndef(b.asyncFactory.error)
  49973. )
  49974. )
  49975. )
  49976. }
  49977. function sameInputType (a, b) {
  49978. if (a.tag !== 'input') { return true }
  49979. var i;
  49980. var typeA = isDef(i = a.data) && isDef(i = i.attrs) && i.type;
  49981. var typeB = isDef(i = b.data) && isDef(i = i.attrs) && i.type;
  49982. return typeA === typeB || isTextInputType(typeA) && isTextInputType(typeB)
  49983. }
  49984. function createKeyToOldIdx (children, beginIdx, endIdx) {
  49985. var i, key;
  49986. var map = {};
  49987. for (i = beginIdx; i <= endIdx; ++i) {
  49988. key = children[i].key;
  49989. if (isDef(key)) { map[key] = i; }
  49990. }
  49991. return map
  49992. }
  49993. function createPatchFunction (backend) {
  49994. var i, j;
  49995. var cbs = {};
  49996. var modules = backend.modules;
  49997. var nodeOps = backend.nodeOps;
  49998. for (i = 0; i < hooks.length; ++i) {
  49999. cbs[hooks[i]] = [];
  50000. for (j = 0; j < modules.length; ++j) {
  50001. if (isDef(modules[j][hooks[i]])) {
  50002. cbs[hooks[i]].push(modules[j][hooks[i]]);
  50003. }
  50004. }
  50005. }
  50006. function emptyNodeAt (elm) {
  50007. return new VNode(nodeOps.tagName(elm).toLowerCase(), {}, [], undefined, elm)
  50008. }
  50009. function createRmCb (childElm, listeners) {
  50010. function remove$$1 () {
  50011. if (--remove$$1.listeners === 0) {
  50012. removeNode(childElm);
  50013. }
  50014. }
  50015. remove$$1.listeners = listeners;
  50016. return remove$$1
  50017. }
  50018. function removeNode (el) {
  50019. var parent = nodeOps.parentNode(el);
  50020. // element may have already been removed due to v-html / v-text
  50021. if (isDef(parent)) {
  50022. nodeOps.removeChild(parent, el);
  50023. }
  50024. }
  50025. function isUnknownElement$$1 (vnode, inVPre) {
  50026. return (
  50027. !inVPre &&
  50028. !vnode.ns &&
  50029. !(
  50030. config.ignoredElements.length &&
  50031. config.ignoredElements.some(function (ignore) {
  50032. return isRegExp(ignore)
  50033. ? ignore.test(vnode.tag)
  50034. : ignore === vnode.tag
  50035. })
  50036. ) &&
  50037. config.isUnknownElement(vnode.tag)
  50038. )
  50039. }
  50040. var creatingElmInVPre = 0;
  50041. function createElm (
  50042. vnode,
  50043. insertedVnodeQueue,
  50044. parentElm,
  50045. refElm,
  50046. nested,
  50047. ownerArray,
  50048. index
  50049. ) {
  50050. if (isDef(vnode.elm) && isDef(ownerArray)) {
  50051. // This vnode was used in a previous render!
  50052. // now it's used as a new node, overwriting its elm would cause
  50053. // potential patch errors down the road when it's used as an insertion
  50054. // reference node. Instead, we clone the node on-demand before creating
  50055. // associated DOM element for it.
  50056. vnode = ownerArray[index] = cloneVNode(vnode);
  50057. }
  50058. vnode.isRootInsert = !nested; // for transition enter check
  50059. if (createComponent(vnode, insertedVnodeQueue, parentElm, refElm)) {
  50060. return
  50061. }
  50062. var data = vnode.data;
  50063. var children = vnode.children;
  50064. var tag = vnode.tag;
  50065. if (isDef(tag)) {
  50066. {
  50067. if (data && data.pre) {
  50068. creatingElmInVPre++;
  50069. }
  50070. if (isUnknownElement$$1(vnode, creatingElmInVPre)) {
  50071. warn(
  50072. 'Unknown custom element: <' + tag + '> - did you ' +
  50073. 'register the component correctly? For recursive components, ' +
  50074. 'make sure to provide the "name" option.',
  50075. vnode.context
  50076. );
  50077. }
  50078. }
  50079. vnode.elm = vnode.ns
  50080. ? nodeOps.createElementNS(vnode.ns, tag)
  50081. : nodeOps.createElement(tag, vnode);
  50082. setScope(vnode);
  50083. /* istanbul ignore if */
  50084. {
  50085. createChildren(vnode, children, insertedVnodeQueue);
  50086. if (isDef(data)) {
  50087. invokeCreateHooks(vnode, insertedVnodeQueue);
  50088. }
  50089. insert(parentElm, vnode.elm, refElm);
  50090. }
  50091. if (data && data.pre) {
  50092. creatingElmInVPre--;
  50093. }
  50094. } else if (isTrue(vnode.isComment)) {
  50095. vnode.elm = nodeOps.createComment(vnode.text);
  50096. insert(parentElm, vnode.elm, refElm);
  50097. } else {
  50098. vnode.elm = nodeOps.createTextNode(vnode.text);
  50099. insert(parentElm, vnode.elm, refElm);
  50100. }
  50101. }
  50102. function createComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
  50103. var i = vnode.data;
  50104. if (isDef(i)) {
  50105. var isReactivated = isDef(vnode.componentInstance) && i.keepAlive;
  50106. if (isDef(i = i.hook) && isDef(i = i.init)) {
  50107. i(vnode, false /* hydrating */);
  50108. }
  50109. // after calling the init hook, if the vnode is a child component
  50110. // it should've created a child instance and mounted it. the child
  50111. // component also has set the placeholder vnode's elm.
  50112. // in that case we can just return the element and be done.
  50113. if (isDef(vnode.componentInstance)) {
  50114. initComponent(vnode, insertedVnodeQueue);
  50115. insert(parentElm, vnode.elm, refElm);
  50116. if (isTrue(isReactivated)) {
  50117. reactivateComponent(vnode, insertedVnodeQueue, parentElm, refElm);
  50118. }
  50119. return true
  50120. }
  50121. }
  50122. }
  50123. function initComponent (vnode, insertedVnodeQueue) {
  50124. if (isDef(vnode.data.pendingInsert)) {
  50125. insertedVnodeQueue.push.apply(insertedVnodeQueue, vnode.data.pendingInsert);
  50126. vnode.data.pendingInsert = null;
  50127. }
  50128. vnode.elm = vnode.componentInstance.$el;
  50129. if (isPatchable(vnode)) {
  50130. invokeCreateHooks(vnode, insertedVnodeQueue);
  50131. setScope(vnode);
  50132. } else {
  50133. // empty component root.
  50134. // skip all element-related modules except for ref (#3455)
  50135. registerRef(vnode);
  50136. // make sure to invoke the insert hook
  50137. insertedVnodeQueue.push(vnode);
  50138. }
  50139. }
  50140. function reactivateComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
  50141. var i;
  50142. // hack for #4339: a reactivated component with inner transition
  50143. // does not trigger because the inner node's created hooks are not called
  50144. // again. It's not ideal to involve module-specific logic in here but
  50145. // there doesn't seem to be a better way to do it.
  50146. var innerNode = vnode;
  50147. while (innerNode.componentInstance) {
  50148. innerNode = innerNode.componentInstance._vnode;
  50149. if (isDef(i = innerNode.data) && isDef(i = i.transition)) {
  50150. for (i = 0; i < cbs.activate.length; ++i) {
  50151. cbs.activate[i](emptyNode, innerNode);
  50152. }
  50153. insertedVnodeQueue.push(innerNode);
  50154. break
  50155. }
  50156. }
  50157. // unlike a newly created component,
  50158. // a reactivated keep-alive component doesn't insert itself
  50159. insert(parentElm, vnode.elm, refElm);
  50160. }
  50161. function insert (parent, elm, ref$$1) {
  50162. if (isDef(parent)) {
  50163. if (isDef(ref$$1)) {
  50164. if (nodeOps.parentNode(ref$$1) === parent) {
  50165. nodeOps.insertBefore(parent, elm, ref$$1);
  50166. }
  50167. } else {
  50168. nodeOps.appendChild(parent, elm);
  50169. }
  50170. }
  50171. }
  50172. function createChildren (vnode, children, insertedVnodeQueue) {
  50173. if (Array.isArray(children)) {
  50174. {
  50175. checkDuplicateKeys(children);
  50176. }
  50177. for (var i = 0; i < children.length; ++i) {
  50178. createElm(children[i], insertedVnodeQueue, vnode.elm, null, true, children, i);
  50179. }
  50180. } else if (isPrimitive(vnode.text)) {
  50181. nodeOps.appendChild(vnode.elm, nodeOps.createTextNode(String(vnode.text)));
  50182. }
  50183. }
  50184. function isPatchable (vnode) {
  50185. while (vnode.componentInstance) {
  50186. vnode = vnode.componentInstance._vnode;
  50187. }
  50188. return isDef(vnode.tag)
  50189. }
  50190. function invokeCreateHooks (vnode, insertedVnodeQueue) {
  50191. for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
  50192. cbs.create[i$1](emptyNode, vnode);
  50193. }
  50194. i = vnode.data.hook; // Reuse variable
  50195. if (isDef(i)) {
  50196. if (isDef(i.create)) { i.create(emptyNode, vnode); }
  50197. if (isDef(i.insert)) { insertedVnodeQueue.push(vnode); }
  50198. }
  50199. }
  50200. // set scope id attribute for scoped CSS.
  50201. // this is implemented as a special case to avoid the overhead
  50202. // of going through the normal attribute patching process.
  50203. function setScope (vnode) {
  50204. var i;
  50205. if (isDef(i = vnode.fnScopeId)) {
  50206. nodeOps.setStyleScope(vnode.elm, i);
  50207. } else {
  50208. var ancestor = vnode;
  50209. while (ancestor) {
  50210. if (isDef(i = ancestor.context) && isDef(i = i.$options._scopeId)) {
  50211. nodeOps.setStyleScope(vnode.elm, i);
  50212. }
  50213. ancestor = ancestor.parent;
  50214. }
  50215. }
  50216. // for slot content they should also get the scopeId from the host instance.
  50217. if (isDef(i = activeInstance) &&
  50218. i !== vnode.context &&
  50219. i !== vnode.fnContext &&
  50220. isDef(i = i.$options._scopeId)
  50221. ) {
  50222. nodeOps.setStyleScope(vnode.elm, i);
  50223. }
  50224. }
  50225. function addVnodes (parentElm, refElm, vnodes, startIdx, endIdx, insertedVnodeQueue) {
  50226. for (; startIdx <= endIdx; ++startIdx) {
  50227. createElm(vnodes[startIdx], insertedVnodeQueue, parentElm, refElm, false, vnodes, startIdx);
  50228. }
  50229. }
  50230. function invokeDestroyHook (vnode) {
  50231. var i, j;
  50232. var data = vnode.data;
  50233. if (isDef(data)) {
  50234. if (isDef(i = data.hook) && isDef(i = i.destroy)) { i(vnode); }
  50235. for (i = 0; i < cbs.destroy.length; ++i) { cbs.destroy[i](vnode); }
  50236. }
  50237. if (isDef(i = vnode.children)) {
  50238. for (j = 0; j < vnode.children.length; ++j) {
  50239. invokeDestroyHook(vnode.children[j]);
  50240. }
  50241. }
  50242. }
  50243. function removeVnodes (vnodes, startIdx, endIdx) {
  50244. for (; startIdx <= endIdx; ++startIdx) {
  50245. var ch = vnodes[startIdx];
  50246. if (isDef(ch)) {
  50247. if (isDef(ch.tag)) {
  50248. removeAndInvokeRemoveHook(ch);
  50249. invokeDestroyHook(ch);
  50250. } else { // Text node
  50251. removeNode(ch.elm);
  50252. }
  50253. }
  50254. }
  50255. }
  50256. function removeAndInvokeRemoveHook (vnode, rm) {
  50257. if (isDef(rm) || isDef(vnode.data)) {
  50258. var i;
  50259. var listeners = cbs.remove.length + 1;
  50260. if (isDef(rm)) {
  50261. // we have a recursively passed down rm callback
  50262. // increase the listeners count
  50263. rm.listeners += listeners;
  50264. } else {
  50265. // directly removing
  50266. rm = createRmCb(vnode.elm, listeners);
  50267. }
  50268. // recursively invoke hooks on child component root node
  50269. if (isDef(i = vnode.componentInstance) && isDef(i = i._vnode) && isDef(i.data)) {
  50270. removeAndInvokeRemoveHook(i, rm);
  50271. }
  50272. for (i = 0; i < cbs.remove.length; ++i) {
  50273. cbs.remove[i](vnode, rm);
  50274. }
  50275. if (isDef(i = vnode.data.hook) && isDef(i = i.remove)) {
  50276. i(vnode, rm);
  50277. } else {
  50278. rm();
  50279. }
  50280. } else {
  50281. removeNode(vnode.elm);
  50282. }
  50283. }
  50284. function updateChildren (parentElm, oldCh, newCh, insertedVnodeQueue, removeOnly) {
  50285. var oldStartIdx = 0;
  50286. var newStartIdx = 0;
  50287. var oldEndIdx = oldCh.length - 1;
  50288. var oldStartVnode = oldCh[0];
  50289. var oldEndVnode = oldCh[oldEndIdx];
  50290. var newEndIdx = newCh.length - 1;
  50291. var newStartVnode = newCh[0];
  50292. var newEndVnode = newCh[newEndIdx];
  50293. var oldKeyToIdx, idxInOld, vnodeToMove, refElm;
  50294. // removeOnly is a special flag used only by <transition-group>
  50295. // to ensure removed elements stay in correct relative positions
  50296. // during leaving transitions
  50297. var canMove = !removeOnly;
  50298. {
  50299. checkDuplicateKeys(newCh);
  50300. }
  50301. while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
  50302. if (isUndef(oldStartVnode)) {
  50303. oldStartVnode = oldCh[++oldStartIdx]; // Vnode has been moved left
  50304. } else if (isUndef(oldEndVnode)) {
  50305. oldEndVnode = oldCh[--oldEndIdx];
  50306. } else if (sameVnode(oldStartVnode, newStartVnode)) {
  50307. patchVnode(oldStartVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  50308. oldStartVnode = oldCh[++oldStartIdx];
  50309. newStartVnode = newCh[++newStartIdx];
  50310. } else if (sameVnode(oldEndVnode, newEndVnode)) {
  50311. patchVnode(oldEndVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx);
  50312. oldEndVnode = oldCh[--oldEndIdx];
  50313. newEndVnode = newCh[--newEndIdx];
  50314. } else if (sameVnode(oldStartVnode, newEndVnode)) { // Vnode moved right
  50315. patchVnode(oldStartVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx);
  50316. canMove && nodeOps.insertBefore(parentElm, oldStartVnode.elm, nodeOps.nextSibling(oldEndVnode.elm));
  50317. oldStartVnode = oldCh[++oldStartIdx];
  50318. newEndVnode = newCh[--newEndIdx];
  50319. } else if (sameVnode(oldEndVnode, newStartVnode)) { // Vnode moved left
  50320. patchVnode(oldEndVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  50321. canMove && nodeOps.insertBefore(parentElm, oldEndVnode.elm, oldStartVnode.elm);
  50322. oldEndVnode = oldCh[--oldEndIdx];
  50323. newStartVnode = newCh[++newStartIdx];
  50324. } else {
  50325. if (isUndef(oldKeyToIdx)) { oldKeyToIdx = createKeyToOldIdx(oldCh, oldStartIdx, oldEndIdx); }
  50326. idxInOld = isDef(newStartVnode.key)
  50327. ? oldKeyToIdx[newStartVnode.key]
  50328. : findIdxInOld(newStartVnode, oldCh, oldStartIdx, oldEndIdx);
  50329. if (isUndef(idxInOld)) { // New element
  50330. createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);
  50331. } else {
  50332. vnodeToMove = oldCh[idxInOld];
  50333. if (sameVnode(vnodeToMove, newStartVnode)) {
  50334. patchVnode(vnodeToMove, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  50335. oldCh[idxInOld] = undefined;
  50336. canMove && nodeOps.insertBefore(parentElm, vnodeToMove.elm, oldStartVnode.elm);
  50337. } else {
  50338. // same key but different element. treat as new element
  50339. createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);
  50340. }
  50341. }
  50342. newStartVnode = newCh[++newStartIdx];
  50343. }
  50344. }
  50345. if (oldStartIdx > oldEndIdx) {
  50346. refElm = isUndef(newCh[newEndIdx + 1]) ? null : newCh[newEndIdx + 1].elm;
  50347. addVnodes(parentElm, refElm, newCh, newStartIdx, newEndIdx, insertedVnodeQueue);
  50348. } else if (newStartIdx > newEndIdx) {
  50349. removeVnodes(oldCh, oldStartIdx, oldEndIdx);
  50350. }
  50351. }
  50352. function checkDuplicateKeys (children) {
  50353. var seenKeys = {};
  50354. for (var i = 0; i < children.length; i++) {
  50355. var vnode = children[i];
  50356. var key = vnode.key;
  50357. if (isDef(key)) {
  50358. if (seenKeys[key]) {
  50359. warn(
  50360. ("Duplicate keys detected: '" + key + "'. This may cause an update error."),
  50361. vnode.context
  50362. );
  50363. } else {
  50364. seenKeys[key] = true;
  50365. }
  50366. }
  50367. }
  50368. }
  50369. function findIdxInOld (node, oldCh, start, end) {
  50370. for (var i = start; i < end; i++) {
  50371. var c = oldCh[i];
  50372. if (isDef(c) && sameVnode(node, c)) { return i }
  50373. }
  50374. }
  50375. function patchVnode (
  50376. oldVnode,
  50377. vnode,
  50378. insertedVnodeQueue,
  50379. ownerArray,
  50380. index,
  50381. removeOnly
  50382. ) {
  50383. if (oldVnode === vnode) {
  50384. return
  50385. }
  50386. if (isDef(vnode.elm) && isDef(ownerArray)) {
  50387. // clone reused vnode
  50388. vnode = ownerArray[index] = cloneVNode(vnode);
  50389. }
  50390. var elm = vnode.elm = oldVnode.elm;
  50391. if (isTrue(oldVnode.isAsyncPlaceholder)) {
  50392. if (isDef(vnode.asyncFactory.resolved)) {
  50393. hydrate(oldVnode.elm, vnode, insertedVnodeQueue);
  50394. } else {
  50395. vnode.isAsyncPlaceholder = true;
  50396. }
  50397. return
  50398. }
  50399. // reuse element for static trees.
  50400. // note we only do this if the vnode is cloned -
  50401. // if the new node is not cloned it means the render functions have been
  50402. // reset by the hot-reload-api and we need to do a proper re-render.
  50403. if (isTrue(vnode.isStatic) &&
  50404. isTrue(oldVnode.isStatic) &&
  50405. vnode.key === oldVnode.key &&
  50406. (isTrue(vnode.isCloned) || isTrue(vnode.isOnce))
  50407. ) {
  50408. vnode.componentInstance = oldVnode.componentInstance;
  50409. return
  50410. }
  50411. var i;
  50412. var data = vnode.data;
  50413. if (isDef(data) && isDef(i = data.hook) && isDef(i = i.prepatch)) {
  50414. i(oldVnode, vnode);
  50415. }
  50416. var oldCh = oldVnode.children;
  50417. var ch = vnode.children;
  50418. if (isDef(data) && isPatchable(vnode)) {
  50419. for (i = 0; i < cbs.update.length; ++i) { cbs.update[i](oldVnode, vnode); }
  50420. if (isDef(i = data.hook) && isDef(i = i.update)) { i(oldVnode, vnode); }
  50421. }
  50422. if (isUndef(vnode.text)) {
  50423. if (isDef(oldCh) && isDef(ch)) {
  50424. if (oldCh !== ch) { updateChildren(elm, oldCh, ch, insertedVnodeQueue, removeOnly); }
  50425. } else if (isDef(ch)) {
  50426. {
  50427. checkDuplicateKeys(ch);
  50428. }
  50429. if (isDef(oldVnode.text)) { nodeOps.setTextContent(elm, ''); }
  50430. addVnodes(elm, null, ch, 0, ch.length - 1, insertedVnodeQueue);
  50431. } else if (isDef(oldCh)) {
  50432. removeVnodes(oldCh, 0, oldCh.length - 1);
  50433. } else if (isDef(oldVnode.text)) {
  50434. nodeOps.setTextContent(elm, '');
  50435. }
  50436. } else if (oldVnode.text !== vnode.text) {
  50437. nodeOps.setTextContent(elm, vnode.text);
  50438. }
  50439. if (isDef(data)) {
  50440. if (isDef(i = data.hook) && isDef(i = i.postpatch)) { i(oldVnode, vnode); }
  50441. }
  50442. }
  50443. function invokeInsertHook (vnode, queue, initial) {
  50444. // delay insert hooks for component root nodes, invoke them after the
  50445. // element is really inserted
  50446. if (isTrue(initial) && isDef(vnode.parent)) {
  50447. vnode.parent.data.pendingInsert = queue;
  50448. } else {
  50449. for (var i = 0; i < queue.length; ++i) {
  50450. queue[i].data.hook.insert(queue[i]);
  50451. }
  50452. }
  50453. }
  50454. var hydrationBailed = false;
  50455. // list of modules that can skip create hook during hydration because they
  50456. // are already rendered on the client or has no need for initialization
  50457. // Note: style is excluded because it relies on initial clone for future
  50458. // deep updates (#7063).
  50459. var isRenderedModule = makeMap('attrs,class,staticClass,staticStyle,key');
  50460. // Note: this is a browser-only function so we can assume elms are DOM nodes.
  50461. function hydrate (elm, vnode, insertedVnodeQueue, inVPre) {
  50462. var i;
  50463. var tag = vnode.tag;
  50464. var data = vnode.data;
  50465. var children = vnode.children;
  50466. inVPre = inVPre || (data && data.pre);
  50467. vnode.elm = elm;
  50468. if (isTrue(vnode.isComment) && isDef(vnode.asyncFactory)) {
  50469. vnode.isAsyncPlaceholder = true;
  50470. return true
  50471. }
  50472. // assert node match
  50473. {
  50474. if (!assertNodeMatch(elm, vnode, inVPre)) {
  50475. return false
  50476. }
  50477. }
  50478. if (isDef(data)) {
  50479. if (isDef(i = data.hook) && isDef(i = i.init)) { i(vnode, true /* hydrating */); }
  50480. if (isDef(i = vnode.componentInstance)) {
  50481. // child component. it should have hydrated its own tree.
  50482. initComponent(vnode, insertedVnodeQueue);
  50483. return true
  50484. }
  50485. }
  50486. if (isDef(tag)) {
  50487. if (isDef(children)) {
  50488. // empty element, allow client to pick up and populate children
  50489. if (!elm.hasChildNodes()) {
  50490. createChildren(vnode, children, insertedVnodeQueue);
  50491. } else {
  50492. // v-html and domProps: innerHTML
  50493. if (isDef(i = data) && isDef(i = i.domProps) && isDef(i = i.innerHTML)) {
  50494. if (i !== elm.innerHTML) {
  50495. /* istanbul ignore if */
  50496. if (typeof console !== 'undefined' &&
  50497. !hydrationBailed
  50498. ) {
  50499. hydrationBailed = true;
  50500. console.warn('Parent: ', elm);
  50501. console.warn('server innerHTML: ', i);
  50502. console.warn('client innerHTML: ', elm.innerHTML);
  50503. }
  50504. return false
  50505. }
  50506. } else {
  50507. // iterate and compare children lists
  50508. var childrenMatch = true;
  50509. var childNode = elm.firstChild;
  50510. for (var i$1 = 0; i$1 < children.length; i$1++) {
  50511. if (!childNode || !hydrate(childNode, children[i$1], insertedVnodeQueue, inVPre)) {
  50512. childrenMatch = false;
  50513. break
  50514. }
  50515. childNode = childNode.nextSibling;
  50516. }
  50517. // if childNode is not null, it means the actual childNodes list is
  50518. // longer than the virtual children list.
  50519. if (!childrenMatch || childNode) {
  50520. /* istanbul ignore if */
  50521. if (typeof console !== 'undefined' &&
  50522. !hydrationBailed
  50523. ) {
  50524. hydrationBailed = true;
  50525. console.warn('Parent: ', elm);
  50526. console.warn('Mismatching childNodes vs. VNodes: ', elm.childNodes, children);
  50527. }
  50528. return false
  50529. }
  50530. }
  50531. }
  50532. }
  50533. if (isDef(data)) {
  50534. var fullInvoke = false;
  50535. for (var key in data) {
  50536. if (!isRenderedModule(key)) {
  50537. fullInvoke = true;
  50538. invokeCreateHooks(vnode, insertedVnodeQueue);
  50539. break
  50540. }
  50541. }
  50542. if (!fullInvoke && data['class']) {
  50543. // ensure collecting deps for deep class bindings for future updates
  50544. traverse(data['class']);
  50545. }
  50546. }
  50547. } else if (elm.data !== vnode.text) {
  50548. elm.data = vnode.text;
  50549. }
  50550. return true
  50551. }
  50552. function assertNodeMatch (node, vnode, inVPre) {
  50553. if (isDef(vnode.tag)) {
  50554. return vnode.tag.indexOf('vue-component') === 0 || (
  50555. !isUnknownElement$$1(vnode, inVPre) &&
  50556. vnode.tag.toLowerCase() === (node.tagName && node.tagName.toLowerCase())
  50557. )
  50558. } else {
  50559. return node.nodeType === (vnode.isComment ? 8 : 3)
  50560. }
  50561. }
  50562. return function patch (oldVnode, vnode, hydrating, removeOnly) {
  50563. if (isUndef(vnode)) {
  50564. if (isDef(oldVnode)) { invokeDestroyHook(oldVnode); }
  50565. return
  50566. }
  50567. var isInitialPatch = false;
  50568. var insertedVnodeQueue = [];
  50569. if (isUndef(oldVnode)) {
  50570. // empty mount (likely as component), create new root element
  50571. isInitialPatch = true;
  50572. createElm(vnode, insertedVnodeQueue);
  50573. } else {
  50574. var isRealElement = isDef(oldVnode.nodeType);
  50575. if (!isRealElement && sameVnode(oldVnode, vnode)) {
  50576. // patch existing root node
  50577. patchVnode(oldVnode, vnode, insertedVnodeQueue, null, null, removeOnly);
  50578. } else {
  50579. if (isRealElement) {
  50580. // mounting to a real element
  50581. // check if this is server-rendered content and if we can perform
  50582. // a successful hydration.
  50583. if (oldVnode.nodeType === 1 && oldVnode.hasAttribute(SSR_ATTR)) {
  50584. oldVnode.removeAttribute(SSR_ATTR);
  50585. hydrating = true;
  50586. }
  50587. if (isTrue(hydrating)) {
  50588. if (hydrate(oldVnode, vnode, insertedVnodeQueue)) {
  50589. invokeInsertHook(vnode, insertedVnodeQueue, true);
  50590. return oldVnode
  50591. } else {
  50592. warn(
  50593. 'The client-side rendered virtual DOM tree is not matching ' +
  50594. 'server-rendered content. This is likely caused by incorrect ' +
  50595. 'HTML markup, for example nesting block-level elements inside ' +
  50596. '<p>, or missing <tbody>. Bailing hydration and performing ' +
  50597. 'full client-side render.'
  50598. );
  50599. }
  50600. }
  50601. // either not server-rendered, or hydration failed.
  50602. // create an empty node and replace it
  50603. oldVnode = emptyNodeAt(oldVnode);
  50604. }
  50605. // replacing existing element
  50606. var oldElm = oldVnode.elm;
  50607. var parentElm = nodeOps.parentNode(oldElm);
  50608. // create new node
  50609. createElm(
  50610. vnode,
  50611. insertedVnodeQueue,
  50612. // extremely rare edge case: do not insert if old element is in a
  50613. // leaving transition. Only happens when combining transition +
  50614. // keep-alive + HOCs. (#4590)
  50615. oldElm._leaveCb ? null : parentElm,
  50616. nodeOps.nextSibling(oldElm)
  50617. );
  50618. // update parent placeholder node element, recursively
  50619. if (isDef(vnode.parent)) {
  50620. var ancestor = vnode.parent;
  50621. var patchable = isPatchable(vnode);
  50622. while (ancestor) {
  50623. for (var i = 0; i < cbs.destroy.length; ++i) {
  50624. cbs.destroy[i](ancestor);
  50625. }
  50626. ancestor.elm = vnode.elm;
  50627. if (patchable) {
  50628. for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
  50629. cbs.create[i$1](emptyNode, ancestor);
  50630. }
  50631. // #6513
  50632. // invoke insert hooks that may have been merged by create hooks.
  50633. // e.g. for directives that uses the "inserted" hook.
  50634. var insert = ancestor.data.hook.insert;
  50635. if (insert.merged) {
  50636. // start at index 1 to avoid re-invoking component mounted hook
  50637. for (var i$2 = 1; i$2 < insert.fns.length; i$2++) {
  50638. insert.fns[i$2]();
  50639. }
  50640. }
  50641. } else {
  50642. registerRef(ancestor);
  50643. }
  50644. ancestor = ancestor.parent;
  50645. }
  50646. }
  50647. // destroy old node
  50648. if (isDef(parentElm)) {
  50649. removeVnodes([oldVnode], 0, 0);
  50650. } else if (isDef(oldVnode.tag)) {
  50651. invokeDestroyHook(oldVnode);
  50652. }
  50653. }
  50654. }
  50655. invokeInsertHook(vnode, insertedVnodeQueue, isInitialPatch);
  50656. return vnode.elm
  50657. }
  50658. }
  50659. /* */
  50660. var directives = {
  50661. create: updateDirectives,
  50662. update: updateDirectives,
  50663. destroy: function unbindDirectives (vnode) {
  50664. updateDirectives(vnode, emptyNode);
  50665. }
  50666. };
  50667. function updateDirectives (oldVnode, vnode) {
  50668. if (oldVnode.data.directives || vnode.data.directives) {
  50669. _update(oldVnode, vnode);
  50670. }
  50671. }
  50672. function _update (oldVnode, vnode) {
  50673. var isCreate = oldVnode === emptyNode;
  50674. var isDestroy = vnode === emptyNode;
  50675. var oldDirs = normalizeDirectives$1(oldVnode.data.directives, oldVnode.context);
  50676. var newDirs = normalizeDirectives$1(vnode.data.directives, vnode.context);
  50677. var dirsWithInsert = [];
  50678. var dirsWithPostpatch = [];
  50679. var key, oldDir, dir;
  50680. for (key in newDirs) {
  50681. oldDir = oldDirs[key];
  50682. dir = newDirs[key];
  50683. if (!oldDir) {
  50684. // new directive, bind
  50685. callHook$1(dir, 'bind', vnode, oldVnode);
  50686. if (dir.def && dir.def.inserted) {
  50687. dirsWithInsert.push(dir);
  50688. }
  50689. } else {
  50690. // existing directive, update
  50691. dir.oldValue = oldDir.value;
  50692. dir.oldArg = oldDir.arg;
  50693. callHook$1(dir, 'update', vnode, oldVnode);
  50694. if (dir.def && dir.def.componentUpdated) {
  50695. dirsWithPostpatch.push(dir);
  50696. }
  50697. }
  50698. }
  50699. if (dirsWithInsert.length) {
  50700. var callInsert = function () {
  50701. for (var i = 0; i < dirsWithInsert.length; i++) {
  50702. callHook$1(dirsWithInsert[i], 'inserted', vnode, oldVnode);
  50703. }
  50704. };
  50705. if (isCreate) {
  50706. mergeVNodeHook(vnode, 'insert', callInsert);
  50707. } else {
  50708. callInsert();
  50709. }
  50710. }
  50711. if (dirsWithPostpatch.length) {
  50712. mergeVNodeHook(vnode, 'postpatch', function () {
  50713. for (var i = 0; i < dirsWithPostpatch.length; i++) {
  50714. callHook$1(dirsWithPostpatch[i], 'componentUpdated', vnode, oldVnode);
  50715. }
  50716. });
  50717. }
  50718. if (!isCreate) {
  50719. for (key in oldDirs) {
  50720. if (!newDirs[key]) {
  50721. // no longer present, unbind
  50722. callHook$1(oldDirs[key], 'unbind', oldVnode, oldVnode, isDestroy);
  50723. }
  50724. }
  50725. }
  50726. }
  50727. var emptyModifiers = Object.create(null);
  50728. function normalizeDirectives$1 (
  50729. dirs,
  50730. vm
  50731. ) {
  50732. var res = Object.create(null);
  50733. if (!dirs) {
  50734. // $flow-disable-line
  50735. return res
  50736. }
  50737. var i, dir;
  50738. for (i = 0; i < dirs.length; i++) {
  50739. dir = dirs[i];
  50740. if (!dir.modifiers) {
  50741. // $flow-disable-line
  50742. dir.modifiers = emptyModifiers;
  50743. }
  50744. res[getRawDirName(dir)] = dir;
  50745. dir.def = resolveAsset(vm.$options, 'directives', dir.name, true);
  50746. }
  50747. // $flow-disable-line
  50748. return res
  50749. }
  50750. function getRawDirName (dir) {
  50751. return dir.rawName || ((dir.name) + "." + (Object.keys(dir.modifiers || {}).join('.')))
  50752. }
  50753. function callHook$1 (dir, hook, vnode, oldVnode, isDestroy) {
  50754. var fn = dir.def && dir.def[hook];
  50755. if (fn) {
  50756. try {
  50757. fn(vnode.elm, dir, vnode, oldVnode, isDestroy);
  50758. } catch (e) {
  50759. handleError(e, vnode.context, ("directive " + (dir.name) + " " + hook + " hook"));
  50760. }
  50761. }
  50762. }
  50763. var baseModules = [
  50764. ref,
  50765. directives
  50766. ];
  50767. /* */
  50768. function updateAttrs (oldVnode, vnode) {
  50769. var opts = vnode.componentOptions;
  50770. if (isDef(opts) && opts.Ctor.options.inheritAttrs === false) {
  50771. return
  50772. }
  50773. if (isUndef(oldVnode.data.attrs) && isUndef(vnode.data.attrs)) {
  50774. return
  50775. }
  50776. var key, cur, old;
  50777. var elm = vnode.elm;
  50778. var oldAttrs = oldVnode.data.attrs || {};
  50779. var attrs = vnode.data.attrs || {};
  50780. // clone observed objects, as the user probably wants to mutate it
  50781. if (isDef(attrs.__ob__)) {
  50782. attrs = vnode.data.attrs = extend({}, attrs);
  50783. }
  50784. for (key in attrs) {
  50785. cur = attrs[key];
  50786. old = oldAttrs[key];
  50787. if (old !== cur) {
  50788. setAttr(elm, key, cur);
  50789. }
  50790. }
  50791. // #4391: in IE9, setting type can reset value for input[type=radio]
  50792. // #6666: IE/Edge forces progress value down to 1 before setting a max
  50793. /* istanbul ignore if */
  50794. if ((isIE || isEdge) && attrs.value !== oldAttrs.value) {
  50795. setAttr(elm, 'value', attrs.value);
  50796. }
  50797. for (key in oldAttrs) {
  50798. if (isUndef(attrs[key])) {
  50799. if (isXlink(key)) {
  50800. elm.removeAttributeNS(xlinkNS, getXlinkProp(key));
  50801. } else if (!isEnumeratedAttr(key)) {
  50802. elm.removeAttribute(key);
  50803. }
  50804. }
  50805. }
  50806. }
  50807. function setAttr (el, key, value) {
  50808. if (el.tagName.indexOf('-') > -1) {
  50809. baseSetAttr(el, key, value);
  50810. } else if (isBooleanAttr(key)) {
  50811. // set attribute for blank value
  50812. // e.g. <option disabled>Select one</option>
  50813. if (isFalsyAttrValue(value)) {
  50814. el.removeAttribute(key);
  50815. } else {
  50816. // technically allowfullscreen is a boolean attribute for <iframe>,
  50817. // but Flash expects a value of "true" when used on <embed> tag
  50818. value = key === 'allowfullscreen' && el.tagName === 'EMBED'
  50819. ? 'true'
  50820. : key;
  50821. el.setAttribute(key, value);
  50822. }
  50823. } else if (isEnumeratedAttr(key)) {
  50824. el.setAttribute(key, convertEnumeratedValue(key, value));
  50825. } else if (isXlink(key)) {
  50826. if (isFalsyAttrValue(value)) {
  50827. el.removeAttributeNS(xlinkNS, getXlinkProp(key));
  50828. } else {
  50829. el.setAttributeNS(xlinkNS, key, value);
  50830. }
  50831. } else {
  50832. baseSetAttr(el, key, value);
  50833. }
  50834. }
  50835. function baseSetAttr (el, key, value) {
  50836. if (isFalsyAttrValue(value)) {
  50837. el.removeAttribute(key);
  50838. } else {
  50839. // #7138: IE10 & 11 fires input event when setting placeholder on
  50840. // <textarea>... block the first input event and remove the blocker
  50841. // immediately.
  50842. /* istanbul ignore if */
  50843. if (
  50844. isIE && !isIE9 &&
  50845. el.tagName === 'TEXTAREA' &&
  50846. key === 'placeholder' && value !== '' && !el.__ieph
  50847. ) {
  50848. var blocker = function (e) {
  50849. e.stopImmediatePropagation();
  50850. el.removeEventListener('input', blocker);
  50851. };
  50852. el.addEventListener('input', blocker);
  50853. // $flow-disable-line
  50854. el.__ieph = true; /* IE placeholder patched */
  50855. }
  50856. el.setAttribute(key, value);
  50857. }
  50858. }
  50859. var attrs = {
  50860. create: updateAttrs,
  50861. update: updateAttrs
  50862. };
  50863. /* */
  50864. function updateClass (oldVnode, vnode) {
  50865. var el = vnode.elm;
  50866. var data = vnode.data;
  50867. var oldData = oldVnode.data;
  50868. if (
  50869. isUndef(data.staticClass) &&
  50870. isUndef(data.class) && (
  50871. isUndef(oldData) || (
  50872. isUndef(oldData.staticClass) &&
  50873. isUndef(oldData.class)
  50874. )
  50875. )
  50876. ) {
  50877. return
  50878. }
  50879. var cls = genClassForVnode(vnode);
  50880. // handle transition classes
  50881. var transitionClass = el._transitionClasses;
  50882. if (isDef(transitionClass)) {
  50883. cls = concat(cls, stringifyClass(transitionClass));
  50884. }
  50885. // set the class
  50886. if (cls !== el._prevClass) {
  50887. el.setAttribute('class', cls);
  50888. el._prevClass = cls;
  50889. }
  50890. }
  50891. var klass = {
  50892. create: updateClass,
  50893. update: updateClass
  50894. };
  50895. /* */
  50896. var validDivisionCharRE = /[\w).+\-_$\]]/;
  50897. function parseFilters (exp) {
  50898. var inSingle = false;
  50899. var inDouble = false;
  50900. var inTemplateString = false;
  50901. var inRegex = false;
  50902. var curly = 0;
  50903. var square = 0;
  50904. var paren = 0;
  50905. var lastFilterIndex = 0;
  50906. var c, prev, i, expression, filters;
  50907. for (i = 0; i < exp.length; i++) {
  50908. prev = c;
  50909. c = exp.charCodeAt(i);
  50910. if (inSingle) {
  50911. if (c === 0x27 && prev !== 0x5C) { inSingle = false; }
  50912. } else if (inDouble) {
  50913. if (c === 0x22 && prev !== 0x5C) { inDouble = false; }
  50914. } else if (inTemplateString) {
  50915. if (c === 0x60 && prev !== 0x5C) { inTemplateString = false; }
  50916. } else if (inRegex) {
  50917. if (c === 0x2f && prev !== 0x5C) { inRegex = false; }
  50918. } else if (
  50919. c === 0x7C && // pipe
  50920. exp.charCodeAt(i + 1) !== 0x7C &&
  50921. exp.charCodeAt(i - 1) !== 0x7C &&
  50922. !curly && !square && !paren
  50923. ) {
  50924. if (expression === undefined) {
  50925. // first filter, end of expression
  50926. lastFilterIndex = i + 1;
  50927. expression = exp.slice(0, i).trim();
  50928. } else {
  50929. pushFilter();
  50930. }
  50931. } else {
  50932. switch (c) {
  50933. case 0x22: inDouble = true; break // "
  50934. case 0x27: inSingle = true; break // '
  50935. case 0x60: inTemplateString = true; break // `
  50936. case 0x28: paren++; break // (
  50937. case 0x29: paren--; break // )
  50938. case 0x5B: square++; break // [
  50939. case 0x5D: square--; break // ]
  50940. case 0x7B: curly++; break // {
  50941. case 0x7D: curly--; break // }
  50942. }
  50943. if (c === 0x2f) { // /
  50944. var j = i - 1;
  50945. var p = (void 0);
  50946. // find first non-whitespace prev char
  50947. for (; j >= 0; j--) {
  50948. p = exp.charAt(j);
  50949. if (p !== ' ') { break }
  50950. }
  50951. if (!p || !validDivisionCharRE.test(p)) {
  50952. inRegex = true;
  50953. }
  50954. }
  50955. }
  50956. }
  50957. if (expression === undefined) {
  50958. expression = exp.slice(0, i).trim();
  50959. } else if (lastFilterIndex !== 0) {
  50960. pushFilter();
  50961. }
  50962. function pushFilter () {
  50963. (filters || (filters = [])).push(exp.slice(lastFilterIndex, i).trim());
  50964. lastFilterIndex = i + 1;
  50965. }
  50966. if (filters) {
  50967. for (i = 0; i < filters.length; i++) {
  50968. expression = wrapFilter(expression, filters[i]);
  50969. }
  50970. }
  50971. return expression
  50972. }
  50973. function wrapFilter (exp, filter) {
  50974. var i = filter.indexOf('(');
  50975. if (i < 0) {
  50976. // _f: resolveFilter
  50977. return ("_f(\"" + filter + "\")(" + exp + ")")
  50978. } else {
  50979. var name = filter.slice(0, i);
  50980. var args = filter.slice(i + 1);
  50981. return ("_f(\"" + name + "\")(" + exp + (args !== ')' ? ',' + args : args))
  50982. }
  50983. }
  50984. /* */
  50985. /* eslint-disable no-unused-vars */
  50986. function baseWarn (msg, range) {
  50987. console.error(("[Vue compiler]: " + msg));
  50988. }
  50989. /* eslint-enable no-unused-vars */
  50990. function pluckModuleFunction (
  50991. modules,
  50992. key
  50993. ) {
  50994. return modules
  50995. ? modules.map(function (m) { return m[key]; }).filter(function (_) { return _; })
  50996. : []
  50997. }
  50998. function addProp (el, name, value, range, dynamic) {
  50999. (el.props || (el.props = [])).push(rangeSetItem({ name: name, value: value, dynamic: dynamic }, range));
  51000. el.plain = false;
  51001. }
  51002. function addAttr (el, name, value, range, dynamic) {
  51003. var attrs = dynamic
  51004. ? (el.dynamicAttrs || (el.dynamicAttrs = []))
  51005. : (el.attrs || (el.attrs = []));
  51006. attrs.push(rangeSetItem({ name: name, value: value, dynamic: dynamic }, range));
  51007. el.plain = false;
  51008. }
  51009. // add a raw attr (use this in preTransforms)
  51010. function addRawAttr (el, name, value, range) {
  51011. el.attrsMap[name] = value;
  51012. el.attrsList.push(rangeSetItem({ name: name, value: value }, range));
  51013. }
  51014. function addDirective (
  51015. el,
  51016. name,
  51017. rawName,
  51018. value,
  51019. arg,
  51020. isDynamicArg,
  51021. modifiers,
  51022. range
  51023. ) {
  51024. (el.directives || (el.directives = [])).push(rangeSetItem({
  51025. name: name,
  51026. rawName: rawName,
  51027. value: value,
  51028. arg: arg,
  51029. isDynamicArg: isDynamicArg,
  51030. modifiers: modifiers
  51031. }, range));
  51032. el.plain = false;
  51033. }
  51034. function prependModifierMarker (symbol, name, dynamic) {
  51035. return dynamic
  51036. ? ("_p(" + name + ",\"" + symbol + "\")")
  51037. : symbol + name // mark the event as captured
  51038. }
  51039. function addHandler (
  51040. el,
  51041. name,
  51042. value,
  51043. modifiers,
  51044. important,
  51045. warn,
  51046. range,
  51047. dynamic
  51048. ) {
  51049. modifiers = modifiers || emptyObject;
  51050. // warn prevent and passive modifier
  51051. /* istanbul ignore if */
  51052. if (
  51053. warn &&
  51054. modifiers.prevent && modifiers.passive
  51055. ) {
  51056. warn(
  51057. 'passive and prevent can\'t be used together. ' +
  51058. 'Passive handler can\'t prevent default event.',
  51059. range
  51060. );
  51061. }
  51062. // normalize click.right and click.middle since they don't actually fire
  51063. // this is technically browser-specific, but at least for now browsers are
  51064. // the only target envs that have right/middle clicks.
  51065. if (modifiers.right) {
  51066. if (dynamic) {
  51067. name = "(" + name + ")==='click'?'contextmenu':(" + name + ")";
  51068. } else if (name === 'click') {
  51069. name = 'contextmenu';
  51070. delete modifiers.right;
  51071. }
  51072. } else if (modifiers.middle) {
  51073. if (dynamic) {
  51074. name = "(" + name + ")==='click'?'mouseup':(" + name + ")";
  51075. } else if (name === 'click') {
  51076. name = 'mouseup';
  51077. }
  51078. }
  51079. // check capture modifier
  51080. if (modifiers.capture) {
  51081. delete modifiers.capture;
  51082. name = prependModifierMarker('!', name, dynamic);
  51083. }
  51084. if (modifiers.once) {
  51085. delete modifiers.once;
  51086. name = prependModifierMarker('~', name, dynamic);
  51087. }
  51088. /* istanbul ignore if */
  51089. if (modifiers.passive) {
  51090. delete modifiers.passive;
  51091. name = prependModifierMarker('&', name, dynamic);
  51092. }
  51093. var events;
  51094. if (modifiers.native) {
  51095. delete modifiers.native;
  51096. events = el.nativeEvents || (el.nativeEvents = {});
  51097. } else {
  51098. events = el.events || (el.events = {});
  51099. }
  51100. var newHandler = rangeSetItem({ value: value.trim(), dynamic: dynamic }, range);
  51101. if (modifiers !== emptyObject) {
  51102. newHandler.modifiers = modifiers;
  51103. }
  51104. var handlers = events[name];
  51105. /* istanbul ignore if */
  51106. if (Array.isArray(handlers)) {
  51107. important ? handlers.unshift(newHandler) : handlers.push(newHandler);
  51108. } else if (handlers) {
  51109. events[name] = important ? [newHandler, handlers] : [handlers, newHandler];
  51110. } else {
  51111. events[name] = newHandler;
  51112. }
  51113. el.plain = false;
  51114. }
  51115. function getRawBindingAttr (
  51116. el,
  51117. name
  51118. ) {
  51119. return el.rawAttrsMap[':' + name] ||
  51120. el.rawAttrsMap['v-bind:' + name] ||
  51121. el.rawAttrsMap[name]
  51122. }
  51123. function getBindingAttr (
  51124. el,
  51125. name,
  51126. getStatic
  51127. ) {
  51128. var dynamicValue =
  51129. getAndRemoveAttr(el, ':' + name) ||
  51130. getAndRemoveAttr(el, 'v-bind:' + name);
  51131. if (dynamicValue != null) {
  51132. return parseFilters(dynamicValue)
  51133. } else if (getStatic !== false) {
  51134. var staticValue = getAndRemoveAttr(el, name);
  51135. if (staticValue != null) {
  51136. return JSON.stringify(staticValue)
  51137. }
  51138. }
  51139. }
  51140. // note: this only removes the attr from the Array (attrsList) so that it
  51141. // doesn't get processed by processAttrs.
  51142. // By default it does NOT remove it from the map (attrsMap) because the map is
  51143. // needed during codegen.
  51144. function getAndRemoveAttr (
  51145. el,
  51146. name,
  51147. removeFromMap
  51148. ) {
  51149. var val;
  51150. if ((val = el.attrsMap[name]) != null) {
  51151. var list = el.attrsList;
  51152. for (var i = 0, l = list.length; i < l; i++) {
  51153. if (list[i].name === name) {
  51154. list.splice(i, 1);
  51155. break
  51156. }
  51157. }
  51158. }
  51159. if (removeFromMap) {
  51160. delete el.attrsMap[name];
  51161. }
  51162. return val
  51163. }
  51164. function getAndRemoveAttrByRegex (
  51165. el,
  51166. name
  51167. ) {
  51168. var list = el.attrsList;
  51169. for (var i = 0, l = list.length; i < l; i++) {
  51170. var attr = list[i];
  51171. if (name.test(attr.name)) {
  51172. list.splice(i, 1);
  51173. return attr
  51174. }
  51175. }
  51176. }
  51177. function rangeSetItem (
  51178. item,
  51179. range
  51180. ) {
  51181. if (range) {
  51182. if (range.start != null) {
  51183. item.start = range.start;
  51184. }
  51185. if (range.end != null) {
  51186. item.end = range.end;
  51187. }
  51188. }
  51189. return item
  51190. }
  51191. /* */
  51192. /**
  51193. * Cross-platform code generation for component v-model
  51194. */
  51195. function genComponentModel (
  51196. el,
  51197. value,
  51198. modifiers
  51199. ) {
  51200. var ref = modifiers || {};
  51201. var number = ref.number;
  51202. var trim = ref.trim;
  51203. var baseValueExpression = '$$v';
  51204. var valueExpression = baseValueExpression;
  51205. if (trim) {
  51206. valueExpression =
  51207. "(typeof " + baseValueExpression + " === 'string'" +
  51208. "? " + baseValueExpression + ".trim()" +
  51209. ": " + baseValueExpression + ")";
  51210. }
  51211. if (number) {
  51212. valueExpression = "_n(" + valueExpression + ")";
  51213. }
  51214. var assignment = genAssignmentCode(value, valueExpression);
  51215. el.model = {
  51216. value: ("(" + value + ")"),
  51217. expression: JSON.stringify(value),
  51218. callback: ("function (" + baseValueExpression + ") {" + assignment + "}")
  51219. };
  51220. }
  51221. /**
  51222. * Cross-platform codegen helper for generating v-model value assignment code.
  51223. */
  51224. function genAssignmentCode (
  51225. value,
  51226. assignment
  51227. ) {
  51228. var res = parseModel(value);
  51229. if (res.key === null) {
  51230. return (value + "=" + assignment)
  51231. } else {
  51232. return ("$set(" + (res.exp) + ", " + (res.key) + ", " + assignment + ")")
  51233. }
  51234. }
  51235. /**
  51236. * Parse a v-model expression into a base path and a final key segment.
  51237. * Handles both dot-path and possible square brackets.
  51238. *
  51239. * Possible cases:
  51240. *
  51241. * - test
  51242. * - test[key]
  51243. * - test[test1[key]]
  51244. * - test["a"][key]
  51245. * - xxx.test[a[a].test1[key]]
  51246. * - test.xxx.a["asa"][test1[key]]
  51247. *
  51248. */
  51249. var len, str, chr, index$1, expressionPos, expressionEndPos;
  51250. function parseModel (val) {
  51251. // Fix https://github.com/vuejs/vue/pull/7730
  51252. // allow v-model="obj.val " (trailing whitespace)
  51253. val = val.trim();
  51254. len = val.length;
  51255. if (val.indexOf('[') < 0 || val.lastIndexOf(']') < len - 1) {
  51256. index$1 = val.lastIndexOf('.');
  51257. if (index$1 > -1) {
  51258. return {
  51259. exp: val.slice(0, index$1),
  51260. key: '"' + val.slice(index$1 + 1) + '"'
  51261. }
  51262. } else {
  51263. return {
  51264. exp: val,
  51265. key: null
  51266. }
  51267. }
  51268. }
  51269. str = val;
  51270. index$1 = expressionPos = expressionEndPos = 0;
  51271. while (!eof()) {
  51272. chr = next();
  51273. /* istanbul ignore if */
  51274. if (isStringStart(chr)) {
  51275. parseString(chr);
  51276. } else if (chr === 0x5B) {
  51277. parseBracket(chr);
  51278. }
  51279. }
  51280. return {
  51281. exp: val.slice(0, expressionPos),
  51282. key: val.slice(expressionPos + 1, expressionEndPos)
  51283. }
  51284. }
  51285. function next () {
  51286. return str.charCodeAt(++index$1)
  51287. }
  51288. function eof () {
  51289. return index$1 >= len
  51290. }
  51291. function isStringStart (chr) {
  51292. return chr === 0x22 || chr === 0x27
  51293. }
  51294. function parseBracket (chr) {
  51295. var inBracket = 1;
  51296. expressionPos = index$1;
  51297. while (!eof()) {
  51298. chr = next();
  51299. if (isStringStart(chr)) {
  51300. parseString(chr);
  51301. continue
  51302. }
  51303. if (chr === 0x5B) { inBracket++; }
  51304. if (chr === 0x5D) { inBracket--; }
  51305. if (inBracket === 0) {
  51306. expressionEndPos = index$1;
  51307. break
  51308. }
  51309. }
  51310. }
  51311. function parseString (chr) {
  51312. var stringQuote = chr;
  51313. while (!eof()) {
  51314. chr = next();
  51315. if (chr === stringQuote) {
  51316. break
  51317. }
  51318. }
  51319. }
  51320. /* */
  51321. var warn$1;
  51322. // in some cases, the event used has to be determined at runtime
  51323. // so we used some reserved tokens during compile.
  51324. var RANGE_TOKEN = '__r';
  51325. var CHECKBOX_RADIO_TOKEN = '__c';
  51326. function model (
  51327. el,
  51328. dir,
  51329. _warn
  51330. ) {
  51331. warn$1 = _warn;
  51332. var value = dir.value;
  51333. var modifiers = dir.modifiers;
  51334. var tag = el.tag;
  51335. var type = el.attrsMap.type;
  51336. {
  51337. // inputs with type="file" are read only and setting the input's
  51338. // value will throw an error.
  51339. if (tag === 'input' && type === 'file') {
  51340. warn$1(
  51341. "<" + (el.tag) + " v-model=\"" + value + "\" type=\"file\">:\n" +
  51342. "File inputs are read only. Use a v-on:change listener instead.",
  51343. el.rawAttrsMap['v-model']
  51344. );
  51345. }
  51346. }
  51347. if (el.component) {
  51348. genComponentModel(el, value, modifiers);
  51349. // component v-model doesn't need extra runtime
  51350. return false
  51351. } else if (tag === 'select') {
  51352. genSelect(el, value, modifiers);
  51353. } else if (tag === 'input' && type === 'checkbox') {
  51354. genCheckboxModel(el, value, modifiers);
  51355. } else if (tag === 'input' && type === 'radio') {
  51356. genRadioModel(el, value, modifiers);
  51357. } else if (tag === 'input' || tag === 'textarea') {
  51358. genDefaultModel(el, value, modifiers);
  51359. } else if (!config.isReservedTag(tag)) {
  51360. genComponentModel(el, value, modifiers);
  51361. // component v-model doesn't need extra runtime
  51362. return false
  51363. } else {
  51364. warn$1(
  51365. "<" + (el.tag) + " v-model=\"" + value + "\">: " +
  51366. "v-model is not supported on this element type. " +
  51367. 'If you are working with contenteditable, it\'s recommended to ' +
  51368. 'wrap a library dedicated for that purpose inside a custom component.',
  51369. el.rawAttrsMap['v-model']
  51370. );
  51371. }
  51372. // ensure runtime directive metadata
  51373. return true
  51374. }
  51375. function genCheckboxModel (
  51376. el,
  51377. value,
  51378. modifiers
  51379. ) {
  51380. var number = modifiers && modifiers.number;
  51381. var valueBinding = getBindingAttr(el, 'value') || 'null';
  51382. var trueValueBinding = getBindingAttr(el, 'true-value') || 'true';
  51383. var falseValueBinding = getBindingAttr(el, 'false-value') || 'false';
  51384. addProp(el, 'checked',
  51385. "Array.isArray(" + value + ")" +
  51386. "?_i(" + value + "," + valueBinding + ")>-1" + (
  51387. trueValueBinding === 'true'
  51388. ? (":(" + value + ")")
  51389. : (":_q(" + value + "," + trueValueBinding + ")")
  51390. )
  51391. );
  51392. addHandler(el, 'change',
  51393. "var $$a=" + value + "," +
  51394. '$$el=$event.target,' +
  51395. "$$c=$$el.checked?(" + trueValueBinding + "):(" + falseValueBinding + ");" +
  51396. 'if(Array.isArray($$a)){' +
  51397. "var $$v=" + (number ? '_n(' + valueBinding + ')' : valueBinding) + "," +
  51398. '$$i=_i($$a,$$v);' +
  51399. "if($$el.checked){$$i<0&&(" + (genAssignmentCode(value, '$$a.concat([$$v])')) + ")}" +
  51400. "else{$$i>-1&&(" + (genAssignmentCode(value, '$$a.slice(0,$$i).concat($$a.slice($$i+1))')) + ")}" +
  51401. "}else{" + (genAssignmentCode(value, '$$c')) + "}",
  51402. null, true
  51403. );
  51404. }
  51405. function genRadioModel (
  51406. el,
  51407. value,
  51408. modifiers
  51409. ) {
  51410. var number = modifiers && modifiers.number;
  51411. var valueBinding = getBindingAttr(el, 'value') || 'null';
  51412. valueBinding = number ? ("_n(" + valueBinding + ")") : valueBinding;
  51413. addProp(el, 'checked', ("_q(" + value + "," + valueBinding + ")"));
  51414. addHandler(el, 'change', genAssignmentCode(value, valueBinding), null, true);
  51415. }
  51416. function genSelect (
  51417. el,
  51418. value,
  51419. modifiers
  51420. ) {
  51421. var number = modifiers && modifiers.number;
  51422. var selectedVal = "Array.prototype.filter" +
  51423. ".call($event.target.options,function(o){return o.selected})" +
  51424. ".map(function(o){var val = \"_value\" in o ? o._value : o.value;" +
  51425. "return " + (number ? '_n(val)' : 'val') + "})";
  51426. var assignment = '$event.target.multiple ? $$selectedVal : $$selectedVal[0]';
  51427. var code = "var $$selectedVal = " + selectedVal + ";";
  51428. code = code + " " + (genAssignmentCode(value, assignment));
  51429. addHandler(el, 'change', code, null, true);
  51430. }
  51431. function genDefaultModel (
  51432. el,
  51433. value,
  51434. modifiers
  51435. ) {
  51436. var type = el.attrsMap.type;
  51437. // warn if v-bind:value conflicts with v-model
  51438. // except for inputs with v-bind:type
  51439. {
  51440. var value$1 = el.attrsMap['v-bind:value'] || el.attrsMap[':value'];
  51441. var typeBinding = el.attrsMap['v-bind:type'] || el.attrsMap[':type'];
  51442. if (value$1 && !typeBinding) {
  51443. var binding = el.attrsMap['v-bind:value'] ? 'v-bind:value' : ':value';
  51444. warn$1(
  51445. binding + "=\"" + value$1 + "\" conflicts with v-model on the same element " +
  51446. 'because the latter already expands to a value binding internally',
  51447. el.rawAttrsMap[binding]
  51448. );
  51449. }
  51450. }
  51451. var ref = modifiers || {};
  51452. var lazy = ref.lazy;
  51453. var number = ref.number;
  51454. var trim = ref.trim;
  51455. var needCompositionGuard = !lazy && type !== 'range';
  51456. var event = lazy
  51457. ? 'change'
  51458. : type === 'range'
  51459. ? RANGE_TOKEN
  51460. : 'input';
  51461. var valueExpression = '$event.target.value';
  51462. if (trim) {
  51463. valueExpression = "$event.target.value.trim()";
  51464. }
  51465. if (number) {
  51466. valueExpression = "_n(" + valueExpression + ")";
  51467. }
  51468. var code = genAssignmentCode(value, valueExpression);
  51469. if (needCompositionGuard) {
  51470. code = "if($event.target.composing)return;" + code;
  51471. }
  51472. addProp(el, 'value', ("(" + value + ")"));
  51473. addHandler(el, event, code, null, true);
  51474. if (trim || number) {
  51475. addHandler(el, 'blur', '$forceUpdate()');
  51476. }
  51477. }
  51478. /* */
  51479. // normalize v-model event tokens that can only be determined at runtime.
  51480. // it's important to place the event as the first in the array because
  51481. // the whole point is ensuring the v-model callback gets called before
  51482. // user-attached handlers.
  51483. function normalizeEvents (on) {
  51484. /* istanbul ignore if */
  51485. if (isDef(on[RANGE_TOKEN])) {
  51486. // IE input[type=range] only supports `change` event
  51487. var event = isIE ? 'change' : 'input';
  51488. on[event] = [].concat(on[RANGE_TOKEN], on[event] || []);
  51489. delete on[RANGE_TOKEN];
  51490. }
  51491. // This was originally intended to fix #4521 but no longer necessary
  51492. // after 2.5. Keeping it for backwards compat with generated code from < 2.4
  51493. /* istanbul ignore if */
  51494. if (isDef(on[CHECKBOX_RADIO_TOKEN])) {
  51495. on.change = [].concat(on[CHECKBOX_RADIO_TOKEN], on.change || []);
  51496. delete on[CHECKBOX_RADIO_TOKEN];
  51497. }
  51498. }
  51499. var target$1;
  51500. function createOnceHandler$1 (event, handler, capture) {
  51501. var _target = target$1; // save current target element in closure
  51502. return function onceHandler () {
  51503. var res = handler.apply(null, arguments);
  51504. if (res !== null) {
  51505. remove$2(event, onceHandler, capture, _target);
  51506. }
  51507. }
  51508. }
  51509. // #9446: Firefox <= 53 (in particular, ESR 52) has incorrect Event.timeStamp
  51510. // implementation and does not fire microtasks in between event propagation, so
  51511. // safe to exclude.
  51512. var useMicrotaskFix = isUsingMicroTask && !(isFF && Number(isFF[1]) <= 53);
  51513. function add$1 (
  51514. name,
  51515. handler,
  51516. capture,
  51517. passive
  51518. ) {
  51519. // async edge case #6566: inner click event triggers patch, event handler
  51520. // attached to outer element during patch, and triggered again. This
  51521. // happens because browsers fire microtask ticks between event propagation.
  51522. // the solution is simple: we save the timestamp when a handler is attached,
  51523. // and the handler would only fire if the event passed to it was fired
  51524. // AFTER it was attached.
  51525. if (useMicrotaskFix) {
  51526. var attachedTimestamp = currentFlushTimestamp;
  51527. var original = handler;
  51528. handler = original._wrapper = function (e) {
  51529. if (
  51530. // no bubbling, should always fire.
  51531. // this is just a safety net in case event.timeStamp is unreliable in
  51532. // certain weird environments...
  51533. e.target === e.currentTarget ||
  51534. // event is fired after handler attachment
  51535. e.timeStamp >= attachedTimestamp ||
  51536. // bail for environments that have buggy event.timeStamp implementations
  51537. // #9462 iOS 9 bug: event.timeStamp is 0 after history.pushState
  51538. // #9681 QtWebEngine event.timeStamp is negative value
  51539. e.timeStamp <= 0 ||
  51540. // #9448 bail if event is fired in another document in a multi-page
  51541. // electron/nw.js app, since event.timeStamp will be using a different
  51542. // starting reference
  51543. e.target.ownerDocument !== document
  51544. ) {
  51545. return original.apply(this, arguments)
  51546. }
  51547. };
  51548. }
  51549. target$1.addEventListener(
  51550. name,
  51551. handler,
  51552. supportsPassive
  51553. ? { capture: capture, passive: passive }
  51554. : capture
  51555. );
  51556. }
  51557. function remove$2 (
  51558. name,
  51559. handler,
  51560. capture,
  51561. _target
  51562. ) {
  51563. (_target || target$1).removeEventListener(
  51564. name,
  51565. handler._wrapper || handler,
  51566. capture
  51567. );
  51568. }
  51569. function updateDOMListeners (oldVnode, vnode) {
  51570. if (isUndef(oldVnode.data.on) && isUndef(vnode.data.on)) {
  51571. return
  51572. }
  51573. var on = vnode.data.on || {};
  51574. var oldOn = oldVnode.data.on || {};
  51575. target$1 = vnode.elm;
  51576. normalizeEvents(on);
  51577. updateListeners(on, oldOn, add$1, remove$2, createOnceHandler$1, vnode.context);
  51578. target$1 = undefined;
  51579. }
  51580. var events = {
  51581. create: updateDOMListeners,
  51582. update: updateDOMListeners
  51583. };
  51584. /* */
  51585. var svgContainer;
  51586. function updateDOMProps (oldVnode, vnode) {
  51587. if (isUndef(oldVnode.data.domProps) && isUndef(vnode.data.domProps)) {
  51588. return
  51589. }
  51590. var key, cur;
  51591. var elm = vnode.elm;
  51592. var oldProps = oldVnode.data.domProps || {};
  51593. var props = vnode.data.domProps || {};
  51594. // clone observed objects, as the user probably wants to mutate it
  51595. if (isDef(props.__ob__)) {
  51596. props = vnode.data.domProps = extend({}, props);
  51597. }
  51598. for (key in oldProps) {
  51599. if (!(key in props)) {
  51600. elm[key] = '';
  51601. }
  51602. }
  51603. for (key in props) {
  51604. cur = props[key];
  51605. // ignore children if the node has textContent or innerHTML,
  51606. // as these will throw away existing DOM nodes and cause removal errors
  51607. // on subsequent patches (#3360)
  51608. if (key === 'textContent' || key === 'innerHTML') {
  51609. if (vnode.children) { vnode.children.length = 0; }
  51610. if (cur === oldProps[key]) { continue }
  51611. // #6601 work around Chrome version <= 55 bug where single textNode
  51612. // replaced by innerHTML/textContent retains its parentNode property
  51613. if (elm.childNodes.length === 1) {
  51614. elm.removeChild(elm.childNodes[0]);
  51615. }
  51616. }
  51617. if (key === 'value' && elm.tagName !== 'PROGRESS') {
  51618. // store value as _value as well since
  51619. // non-string values will be stringified
  51620. elm._value = cur;
  51621. // avoid resetting cursor position when value is the same
  51622. var strCur = isUndef(cur) ? '' : String(cur);
  51623. if (shouldUpdateValue(elm, strCur)) {
  51624. elm.value = strCur;
  51625. }
  51626. } else if (key === 'innerHTML' && isSVG(elm.tagName) && isUndef(elm.innerHTML)) {
  51627. // IE doesn't support innerHTML for SVG elements
  51628. svgContainer = svgContainer || document.createElement('div');
  51629. svgContainer.innerHTML = "<svg>" + cur + "</svg>";
  51630. var svg = svgContainer.firstChild;
  51631. while (elm.firstChild) {
  51632. elm.removeChild(elm.firstChild);
  51633. }
  51634. while (svg.firstChild) {
  51635. elm.appendChild(svg.firstChild);
  51636. }
  51637. } else if (
  51638. // skip the update if old and new VDOM state is the same.
  51639. // `value` is handled separately because the DOM value may be temporarily
  51640. // out of sync with VDOM state due to focus, composition and modifiers.
  51641. // This #4521 by skipping the unnecesarry `checked` update.
  51642. cur !== oldProps[key]
  51643. ) {
  51644. // some property updates can throw
  51645. // e.g. `value` on <progress> w/ non-finite value
  51646. try {
  51647. elm[key] = cur;
  51648. } catch (e) {}
  51649. }
  51650. }
  51651. }
  51652. // check platforms/web/util/attrs.js acceptValue
  51653. function shouldUpdateValue (elm, checkVal) {
  51654. return (!elm.composing && (
  51655. elm.tagName === 'OPTION' ||
  51656. isNotInFocusAndDirty(elm, checkVal) ||
  51657. isDirtyWithModifiers(elm, checkVal)
  51658. ))
  51659. }
  51660. function isNotInFocusAndDirty (elm, checkVal) {
  51661. // return true when textbox (.number and .trim) loses focus and its value is
  51662. // not equal to the updated value
  51663. var notInFocus = true;
  51664. // #6157
  51665. // work around IE bug when accessing document.activeElement in an iframe
  51666. try { notInFocus = document.activeElement !== elm; } catch (e) {}
  51667. return notInFocus && elm.value !== checkVal
  51668. }
  51669. function isDirtyWithModifiers (elm, newVal) {
  51670. var value = elm.value;
  51671. var modifiers = elm._vModifiers; // injected by v-model runtime
  51672. if (isDef(modifiers)) {
  51673. if (modifiers.number) {
  51674. return toNumber(value) !== toNumber(newVal)
  51675. }
  51676. if (modifiers.trim) {
  51677. return value.trim() !== newVal.trim()
  51678. }
  51679. }
  51680. return value !== newVal
  51681. }
  51682. var domProps = {
  51683. create: updateDOMProps,
  51684. update: updateDOMProps
  51685. };
  51686. /* */
  51687. var parseStyleText = cached(function (cssText) {
  51688. var res = {};
  51689. var listDelimiter = /;(?![^(]*\))/g;
  51690. var propertyDelimiter = /:(.+)/;
  51691. cssText.split(listDelimiter).forEach(function (item) {
  51692. if (item) {
  51693. var tmp = item.split(propertyDelimiter);
  51694. tmp.length > 1 && (res[tmp[0].trim()] = tmp[1].trim());
  51695. }
  51696. });
  51697. return res
  51698. });
  51699. // merge static and dynamic style data on the same vnode
  51700. function normalizeStyleData (data) {
  51701. var style = normalizeStyleBinding(data.style);
  51702. // static style is pre-processed into an object during compilation
  51703. // and is always a fresh object, so it's safe to merge into it
  51704. return data.staticStyle
  51705. ? extend(data.staticStyle, style)
  51706. : style
  51707. }
  51708. // normalize possible array / string values into Object
  51709. function normalizeStyleBinding (bindingStyle) {
  51710. if (Array.isArray(bindingStyle)) {
  51711. return toObject(bindingStyle)
  51712. }
  51713. if (typeof bindingStyle === 'string') {
  51714. return parseStyleText(bindingStyle)
  51715. }
  51716. return bindingStyle
  51717. }
  51718. /**
  51719. * parent component style should be after child's
  51720. * so that parent component's style could override it
  51721. */
  51722. function getStyle (vnode, checkChild) {
  51723. var res = {};
  51724. var styleData;
  51725. if (checkChild) {
  51726. var childNode = vnode;
  51727. while (childNode.componentInstance) {
  51728. childNode = childNode.componentInstance._vnode;
  51729. if (
  51730. childNode && childNode.data &&
  51731. (styleData = normalizeStyleData(childNode.data))
  51732. ) {
  51733. extend(res, styleData);
  51734. }
  51735. }
  51736. }
  51737. if ((styleData = normalizeStyleData(vnode.data))) {
  51738. extend(res, styleData);
  51739. }
  51740. var parentNode = vnode;
  51741. while ((parentNode = parentNode.parent)) {
  51742. if (parentNode.data && (styleData = normalizeStyleData(parentNode.data))) {
  51743. extend(res, styleData);
  51744. }
  51745. }
  51746. return res
  51747. }
  51748. /* */
  51749. var cssVarRE = /^--/;
  51750. var importantRE = /\s*!important$/;
  51751. var setProp = function (el, name, val) {
  51752. /* istanbul ignore if */
  51753. if (cssVarRE.test(name)) {
  51754. el.style.setProperty(name, val);
  51755. } else if (importantRE.test(val)) {
  51756. el.style.setProperty(hyphenate(name), val.replace(importantRE, ''), 'important');
  51757. } else {
  51758. var normalizedName = normalize(name);
  51759. if (Array.isArray(val)) {
  51760. // Support values array created by autoprefixer, e.g.
  51761. // {display: ["-webkit-box", "-ms-flexbox", "flex"]}
  51762. // Set them one by one, and the browser will only set those it can recognize
  51763. for (var i = 0, len = val.length; i < len; i++) {
  51764. el.style[normalizedName] = val[i];
  51765. }
  51766. } else {
  51767. el.style[normalizedName] = val;
  51768. }
  51769. }
  51770. };
  51771. var vendorNames = ['Webkit', 'Moz', 'ms'];
  51772. var emptyStyle;
  51773. var normalize = cached(function (prop) {
  51774. emptyStyle = emptyStyle || document.createElement('div').style;
  51775. prop = camelize(prop);
  51776. if (prop !== 'filter' && (prop in emptyStyle)) {
  51777. return prop
  51778. }
  51779. var capName = prop.charAt(0).toUpperCase() + prop.slice(1);
  51780. for (var i = 0; i < vendorNames.length; i++) {
  51781. var name = vendorNames[i] + capName;
  51782. if (name in emptyStyle) {
  51783. return name
  51784. }
  51785. }
  51786. });
  51787. function updateStyle (oldVnode, vnode) {
  51788. var data = vnode.data;
  51789. var oldData = oldVnode.data;
  51790. if (isUndef(data.staticStyle) && isUndef(data.style) &&
  51791. isUndef(oldData.staticStyle) && isUndef(oldData.style)
  51792. ) {
  51793. return
  51794. }
  51795. var cur, name;
  51796. var el = vnode.elm;
  51797. var oldStaticStyle = oldData.staticStyle;
  51798. var oldStyleBinding = oldData.normalizedStyle || oldData.style || {};
  51799. // if static style exists, stylebinding already merged into it when doing normalizeStyleData
  51800. var oldStyle = oldStaticStyle || oldStyleBinding;
  51801. var style = normalizeStyleBinding(vnode.data.style) || {};
  51802. // store normalized style under a different key for next diff
  51803. // make sure to clone it if it's reactive, since the user likely wants
  51804. // to mutate it.
  51805. vnode.data.normalizedStyle = isDef(style.__ob__)
  51806. ? extend({}, style)
  51807. : style;
  51808. var newStyle = getStyle(vnode, true);
  51809. for (name in oldStyle) {
  51810. if (isUndef(newStyle[name])) {
  51811. setProp(el, name, '');
  51812. }
  51813. }
  51814. for (name in newStyle) {
  51815. cur = newStyle[name];
  51816. if (cur !== oldStyle[name]) {
  51817. // ie9 setting to null has no effect, must use empty string
  51818. setProp(el, name, cur == null ? '' : cur);
  51819. }
  51820. }
  51821. }
  51822. var style = {
  51823. create: updateStyle,
  51824. update: updateStyle
  51825. };
  51826. /* */
  51827. var whitespaceRE = /\s+/;
  51828. /**
  51829. * Add class with compatibility for SVG since classList is not supported on
  51830. * SVG elements in IE
  51831. */
  51832. function addClass (el, cls) {
  51833. /* istanbul ignore if */
  51834. if (!cls || !(cls = cls.trim())) {
  51835. return
  51836. }
  51837. /* istanbul ignore else */
  51838. if (el.classList) {
  51839. if (cls.indexOf(' ') > -1) {
  51840. cls.split(whitespaceRE).forEach(function (c) { return el.classList.add(c); });
  51841. } else {
  51842. el.classList.add(cls);
  51843. }
  51844. } else {
  51845. var cur = " " + (el.getAttribute('class') || '') + " ";
  51846. if (cur.indexOf(' ' + cls + ' ') < 0) {
  51847. el.setAttribute('class', (cur + cls).trim());
  51848. }
  51849. }
  51850. }
  51851. /**
  51852. * Remove class with compatibility for SVG since classList is not supported on
  51853. * SVG elements in IE
  51854. */
  51855. function removeClass (el, cls) {
  51856. /* istanbul ignore if */
  51857. if (!cls || !(cls = cls.trim())) {
  51858. return
  51859. }
  51860. /* istanbul ignore else */
  51861. if (el.classList) {
  51862. if (cls.indexOf(' ') > -1) {
  51863. cls.split(whitespaceRE).forEach(function (c) { return el.classList.remove(c); });
  51864. } else {
  51865. el.classList.remove(cls);
  51866. }
  51867. if (!el.classList.length) {
  51868. el.removeAttribute('class');
  51869. }
  51870. } else {
  51871. var cur = " " + (el.getAttribute('class') || '') + " ";
  51872. var tar = ' ' + cls + ' ';
  51873. while (cur.indexOf(tar) >= 0) {
  51874. cur = cur.replace(tar, ' ');
  51875. }
  51876. cur = cur.trim();
  51877. if (cur) {
  51878. el.setAttribute('class', cur);
  51879. } else {
  51880. el.removeAttribute('class');
  51881. }
  51882. }
  51883. }
  51884. /* */
  51885. function resolveTransition (def$$1) {
  51886. if (!def$$1) {
  51887. return
  51888. }
  51889. /* istanbul ignore else */
  51890. if (typeof def$$1 === 'object') {
  51891. var res = {};
  51892. if (def$$1.css !== false) {
  51893. extend(res, autoCssTransition(def$$1.name || 'v'));
  51894. }
  51895. extend(res, def$$1);
  51896. return res
  51897. } else if (typeof def$$1 === 'string') {
  51898. return autoCssTransition(def$$1)
  51899. }
  51900. }
  51901. var autoCssTransition = cached(function (name) {
  51902. return {
  51903. enterClass: (name + "-enter"),
  51904. enterToClass: (name + "-enter-to"),
  51905. enterActiveClass: (name + "-enter-active"),
  51906. leaveClass: (name + "-leave"),
  51907. leaveToClass: (name + "-leave-to"),
  51908. leaveActiveClass: (name + "-leave-active")
  51909. }
  51910. });
  51911. var hasTransition = inBrowser && !isIE9;
  51912. var TRANSITION = 'transition';
  51913. var ANIMATION = 'animation';
  51914. // Transition property/event sniffing
  51915. var transitionProp = 'transition';
  51916. var transitionEndEvent = 'transitionend';
  51917. var animationProp = 'animation';
  51918. var animationEndEvent = 'animationend';
  51919. if (hasTransition) {
  51920. /* istanbul ignore if */
  51921. if (window.ontransitionend === undefined &&
  51922. window.onwebkittransitionend !== undefined
  51923. ) {
  51924. transitionProp = 'WebkitTransition';
  51925. transitionEndEvent = 'webkitTransitionEnd';
  51926. }
  51927. if (window.onanimationend === undefined &&
  51928. window.onwebkitanimationend !== undefined
  51929. ) {
  51930. animationProp = 'WebkitAnimation';
  51931. animationEndEvent = 'webkitAnimationEnd';
  51932. }
  51933. }
  51934. // binding to window is necessary to make hot reload work in IE in strict mode
  51935. var raf = inBrowser
  51936. ? window.requestAnimationFrame
  51937. ? window.requestAnimationFrame.bind(window)
  51938. : setTimeout
  51939. : /* istanbul ignore next */ function (fn) { return fn(); };
  51940. function nextFrame (fn) {
  51941. raf(function () {
  51942. raf(fn);
  51943. });
  51944. }
  51945. function addTransitionClass (el, cls) {
  51946. var transitionClasses = el._transitionClasses || (el._transitionClasses = []);
  51947. if (transitionClasses.indexOf(cls) < 0) {
  51948. transitionClasses.push(cls);
  51949. addClass(el, cls);
  51950. }
  51951. }
  51952. function removeTransitionClass (el, cls) {
  51953. if (el._transitionClasses) {
  51954. remove(el._transitionClasses, cls);
  51955. }
  51956. removeClass(el, cls);
  51957. }
  51958. function whenTransitionEnds (
  51959. el,
  51960. expectedType,
  51961. cb
  51962. ) {
  51963. var ref = getTransitionInfo(el, expectedType);
  51964. var type = ref.type;
  51965. var timeout = ref.timeout;
  51966. var propCount = ref.propCount;
  51967. if (!type) { return cb() }
  51968. var event = type === TRANSITION ? transitionEndEvent : animationEndEvent;
  51969. var ended = 0;
  51970. var end = function () {
  51971. el.removeEventListener(event, onEnd);
  51972. cb();
  51973. };
  51974. var onEnd = function (e) {
  51975. if (e.target === el) {
  51976. if (++ended >= propCount) {
  51977. end();
  51978. }
  51979. }
  51980. };
  51981. setTimeout(function () {
  51982. if (ended < propCount) {
  51983. end();
  51984. }
  51985. }, timeout + 1);
  51986. el.addEventListener(event, onEnd);
  51987. }
  51988. var transformRE = /\b(transform|all)(,|$)/;
  51989. function getTransitionInfo (el, expectedType) {
  51990. var styles = window.getComputedStyle(el);
  51991. // JSDOM may return undefined for transition properties
  51992. var transitionDelays = (styles[transitionProp + 'Delay'] || '').split(', ');
  51993. var transitionDurations = (styles[transitionProp + 'Duration'] || '').split(', ');
  51994. var transitionTimeout = getTimeout(transitionDelays, transitionDurations);
  51995. var animationDelays = (styles[animationProp + 'Delay'] || '').split(', ');
  51996. var animationDurations = (styles[animationProp + 'Duration'] || '').split(', ');
  51997. var animationTimeout = getTimeout(animationDelays, animationDurations);
  51998. var type;
  51999. var timeout = 0;
  52000. var propCount = 0;
  52001. /* istanbul ignore if */
  52002. if (expectedType === TRANSITION) {
  52003. if (transitionTimeout > 0) {
  52004. type = TRANSITION;
  52005. timeout = transitionTimeout;
  52006. propCount = transitionDurations.length;
  52007. }
  52008. } else if (expectedType === ANIMATION) {
  52009. if (animationTimeout > 0) {
  52010. type = ANIMATION;
  52011. timeout = animationTimeout;
  52012. propCount = animationDurations.length;
  52013. }
  52014. } else {
  52015. timeout = Math.max(transitionTimeout, animationTimeout);
  52016. type = timeout > 0
  52017. ? transitionTimeout > animationTimeout
  52018. ? TRANSITION
  52019. : ANIMATION
  52020. : null;
  52021. propCount = type
  52022. ? type === TRANSITION
  52023. ? transitionDurations.length
  52024. : animationDurations.length
  52025. : 0;
  52026. }
  52027. var hasTransform =
  52028. type === TRANSITION &&
  52029. transformRE.test(styles[transitionProp + 'Property']);
  52030. return {
  52031. type: type,
  52032. timeout: timeout,
  52033. propCount: propCount,
  52034. hasTransform: hasTransform
  52035. }
  52036. }
  52037. function getTimeout (delays, durations) {
  52038. /* istanbul ignore next */
  52039. while (delays.length < durations.length) {
  52040. delays = delays.concat(delays);
  52041. }
  52042. return Math.max.apply(null, durations.map(function (d, i) {
  52043. return toMs(d) + toMs(delays[i])
  52044. }))
  52045. }
  52046. // Old versions of Chromium (below 61.0.3163.100) formats floating pointer numbers
  52047. // in a locale-dependent way, using a comma instead of a dot.
  52048. // If comma is not replaced with a dot, the input will be rounded down (i.e. acting
  52049. // as a floor function) causing unexpected behaviors
  52050. function toMs (s) {
  52051. return Number(s.slice(0, -1).replace(',', '.')) * 1000
  52052. }
  52053. /* */
  52054. function enter (vnode, toggleDisplay) {
  52055. var el = vnode.elm;
  52056. // call leave callback now
  52057. if (isDef(el._leaveCb)) {
  52058. el._leaveCb.cancelled = true;
  52059. el._leaveCb();
  52060. }
  52061. var data = resolveTransition(vnode.data.transition);
  52062. if (isUndef(data)) {
  52063. return
  52064. }
  52065. /* istanbul ignore if */
  52066. if (isDef(el._enterCb) || el.nodeType !== 1) {
  52067. return
  52068. }
  52069. var css = data.css;
  52070. var type = data.type;
  52071. var enterClass = data.enterClass;
  52072. var enterToClass = data.enterToClass;
  52073. var enterActiveClass = data.enterActiveClass;
  52074. var appearClass = data.appearClass;
  52075. var appearToClass = data.appearToClass;
  52076. var appearActiveClass = data.appearActiveClass;
  52077. var beforeEnter = data.beforeEnter;
  52078. var enter = data.enter;
  52079. var afterEnter = data.afterEnter;
  52080. var enterCancelled = data.enterCancelled;
  52081. var beforeAppear = data.beforeAppear;
  52082. var appear = data.appear;
  52083. var afterAppear = data.afterAppear;
  52084. var appearCancelled = data.appearCancelled;
  52085. var duration = data.duration;
  52086. // activeInstance will always be the <transition> component managing this
  52087. // transition. One edge case to check is when the <transition> is placed
  52088. // as the root node of a child component. In that case we need to check
  52089. // <transition>'s parent for appear check.
  52090. var context = activeInstance;
  52091. var transitionNode = activeInstance.$vnode;
  52092. while (transitionNode && transitionNode.parent) {
  52093. context = transitionNode.context;
  52094. transitionNode = transitionNode.parent;
  52095. }
  52096. var isAppear = !context._isMounted || !vnode.isRootInsert;
  52097. if (isAppear && !appear && appear !== '') {
  52098. return
  52099. }
  52100. var startClass = isAppear && appearClass
  52101. ? appearClass
  52102. : enterClass;
  52103. var activeClass = isAppear && appearActiveClass
  52104. ? appearActiveClass
  52105. : enterActiveClass;
  52106. var toClass = isAppear && appearToClass
  52107. ? appearToClass
  52108. : enterToClass;
  52109. var beforeEnterHook = isAppear
  52110. ? (beforeAppear || beforeEnter)
  52111. : beforeEnter;
  52112. var enterHook = isAppear
  52113. ? (typeof appear === 'function' ? appear : enter)
  52114. : enter;
  52115. var afterEnterHook = isAppear
  52116. ? (afterAppear || afterEnter)
  52117. : afterEnter;
  52118. var enterCancelledHook = isAppear
  52119. ? (appearCancelled || enterCancelled)
  52120. : enterCancelled;
  52121. var explicitEnterDuration = toNumber(
  52122. isObject(duration)
  52123. ? duration.enter
  52124. : duration
  52125. );
  52126. if (explicitEnterDuration != null) {
  52127. checkDuration(explicitEnterDuration, 'enter', vnode);
  52128. }
  52129. var expectsCSS = css !== false && !isIE9;
  52130. var userWantsControl = getHookArgumentsLength(enterHook);
  52131. var cb = el._enterCb = once(function () {
  52132. if (expectsCSS) {
  52133. removeTransitionClass(el, toClass);
  52134. removeTransitionClass(el, activeClass);
  52135. }
  52136. if (cb.cancelled) {
  52137. if (expectsCSS) {
  52138. removeTransitionClass(el, startClass);
  52139. }
  52140. enterCancelledHook && enterCancelledHook(el);
  52141. } else {
  52142. afterEnterHook && afterEnterHook(el);
  52143. }
  52144. el._enterCb = null;
  52145. });
  52146. if (!vnode.data.show) {
  52147. // remove pending leave element on enter by injecting an insert hook
  52148. mergeVNodeHook(vnode, 'insert', function () {
  52149. var parent = el.parentNode;
  52150. var pendingNode = parent && parent._pending && parent._pending[vnode.key];
  52151. if (pendingNode &&
  52152. pendingNode.tag === vnode.tag &&
  52153. pendingNode.elm._leaveCb
  52154. ) {
  52155. pendingNode.elm._leaveCb();
  52156. }
  52157. enterHook && enterHook(el, cb);
  52158. });
  52159. }
  52160. // start enter transition
  52161. beforeEnterHook && beforeEnterHook(el);
  52162. if (expectsCSS) {
  52163. addTransitionClass(el, startClass);
  52164. addTransitionClass(el, activeClass);
  52165. nextFrame(function () {
  52166. removeTransitionClass(el, startClass);
  52167. if (!cb.cancelled) {
  52168. addTransitionClass(el, toClass);
  52169. if (!userWantsControl) {
  52170. if (isValidDuration(explicitEnterDuration)) {
  52171. setTimeout(cb, explicitEnterDuration);
  52172. } else {
  52173. whenTransitionEnds(el, type, cb);
  52174. }
  52175. }
  52176. }
  52177. });
  52178. }
  52179. if (vnode.data.show) {
  52180. toggleDisplay && toggleDisplay();
  52181. enterHook && enterHook(el, cb);
  52182. }
  52183. if (!expectsCSS && !userWantsControl) {
  52184. cb();
  52185. }
  52186. }
  52187. function leave (vnode, rm) {
  52188. var el = vnode.elm;
  52189. // call enter callback now
  52190. if (isDef(el._enterCb)) {
  52191. el._enterCb.cancelled = true;
  52192. el._enterCb();
  52193. }
  52194. var data = resolveTransition(vnode.data.transition);
  52195. if (isUndef(data) || el.nodeType !== 1) {
  52196. return rm()
  52197. }
  52198. /* istanbul ignore if */
  52199. if (isDef(el._leaveCb)) {
  52200. return
  52201. }
  52202. var css = data.css;
  52203. var type = data.type;
  52204. var leaveClass = data.leaveClass;
  52205. var leaveToClass = data.leaveToClass;
  52206. var leaveActiveClass = data.leaveActiveClass;
  52207. var beforeLeave = data.beforeLeave;
  52208. var leave = data.leave;
  52209. var afterLeave = data.afterLeave;
  52210. var leaveCancelled = data.leaveCancelled;
  52211. var delayLeave = data.delayLeave;
  52212. var duration = data.duration;
  52213. var expectsCSS = css !== false && !isIE9;
  52214. var userWantsControl = getHookArgumentsLength(leave);
  52215. var explicitLeaveDuration = toNumber(
  52216. isObject(duration)
  52217. ? duration.leave
  52218. : duration
  52219. );
  52220. if (isDef(explicitLeaveDuration)) {
  52221. checkDuration(explicitLeaveDuration, 'leave', vnode);
  52222. }
  52223. var cb = el._leaveCb = once(function () {
  52224. if (el.parentNode && el.parentNode._pending) {
  52225. el.parentNode._pending[vnode.key] = null;
  52226. }
  52227. if (expectsCSS) {
  52228. removeTransitionClass(el, leaveToClass);
  52229. removeTransitionClass(el, leaveActiveClass);
  52230. }
  52231. if (cb.cancelled) {
  52232. if (expectsCSS) {
  52233. removeTransitionClass(el, leaveClass);
  52234. }
  52235. leaveCancelled && leaveCancelled(el);
  52236. } else {
  52237. rm();
  52238. afterLeave && afterLeave(el);
  52239. }
  52240. el._leaveCb = null;
  52241. });
  52242. if (delayLeave) {
  52243. delayLeave(performLeave);
  52244. } else {
  52245. performLeave();
  52246. }
  52247. function performLeave () {
  52248. // the delayed leave may have already been cancelled
  52249. if (cb.cancelled) {
  52250. return
  52251. }
  52252. // record leaving element
  52253. if (!vnode.data.show && el.parentNode) {
  52254. (el.parentNode._pending || (el.parentNode._pending = {}))[(vnode.key)] = vnode;
  52255. }
  52256. beforeLeave && beforeLeave(el);
  52257. if (expectsCSS) {
  52258. addTransitionClass(el, leaveClass);
  52259. addTransitionClass(el, leaveActiveClass);
  52260. nextFrame(function () {
  52261. removeTransitionClass(el, leaveClass);
  52262. if (!cb.cancelled) {
  52263. addTransitionClass(el, leaveToClass);
  52264. if (!userWantsControl) {
  52265. if (isValidDuration(explicitLeaveDuration)) {
  52266. setTimeout(cb, explicitLeaveDuration);
  52267. } else {
  52268. whenTransitionEnds(el, type, cb);
  52269. }
  52270. }
  52271. }
  52272. });
  52273. }
  52274. leave && leave(el, cb);
  52275. if (!expectsCSS && !userWantsControl) {
  52276. cb();
  52277. }
  52278. }
  52279. }
  52280. // only used in dev mode
  52281. function checkDuration (val, name, vnode) {
  52282. if (typeof val !== 'number') {
  52283. warn(
  52284. "<transition> explicit " + name + " duration is not a valid number - " +
  52285. "got " + (JSON.stringify(val)) + ".",
  52286. vnode.context
  52287. );
  52288. } else if (isNaN(val)) {
  52289. warn(
  52290. "<transition> explicit " + name + " duration is NaN - " +
  52291. 'the duration expression might be incorrect.',
  52292. vnode.context
  52293. );
  52294. }
  52295. }
  52296. function isValidDuration (val) {
  52297. return typeof val === 'number' && !isNaN(val)
  52298. }
  52299. /**
  52300. * Normalize a transition hook's argument length. The hook may be:
  52301. * - a merged hook (invoker) with the original in .fns
  52302. * - a wrapped component method (check ._length)
  52303. * - a plain function (.length)
  52304. */
  52305. function getHookArgumentsLength (fn) {
  52306. if (isUndef(fn)) {
  52307. return false
  52308. }
  52309. var invokerFns = fn.fns;
  52310. if (isDef(invokerFns)) {
  52311. // invoker
  52312. return getHookArgumentsLength(
  52313. Array.isArray(invokerFns)
  52314. ? invokerFns[0]
  52315. : invokerFns
  52316. )
  52317. } else {
  52318. return (fn._length || fn.length) > 1
  52319. }
  52320. }
  52321. function _enter (_, vnode) {
  52322. if (vnode.data.show !== true) {
  52323. enter(vnode);
  52324. }
  52325. }
  52326. var transition = inBrowser ? {
  52327. create: _enter,
  52328. activate: _enter,
  52329. remove: function remove$$1 (vnode, rm) {
  52330. /* istanbul ignore else */
  52331. if (vnode.data.show !== true) {
  52332. leave(vnode, rm);
  52333. } else {
  52334. rm();
  52335. }
  52336. }
  52337. } : {};
  52338. var platformModules = [
  52339. attrs,
  52340. klass,
  52341. events,
  52342. domProps,
  52343. style,
  52344. transition
  52345. ];
  52346. /* */
  52347. // the directive module should be applied last, after all
  52348. // built-in modules have been applied.
  52349. var modules = platformModules.concat(baseModules);
  52350. var patch = createPatchFunction({ nodeOps: nodeOps, modules: modules });
  52351. /**
  52352. * Not type checking this file because flow doesn't like attaching
  52353. * properties to Elements.
  52354. */
  52355. /* istanbul ignore if */
  52356. if (isIE9) {
  52357. // http://www.matts411.com/post/internet-explorer-9-oninput/
  52358. document.addEventListener('selectionchange', function () {
  52359. var el = document.activeElement;
  52360. if (el && el.vmodel) {
  52361. trigger(el, 'input');
  52362. }
  52363. });
  52364. }
  52365. var directive = {
  52366. inserted: function inserted (el, binding, vnode, oldVnode) {
  52367. if (vnode.tag === 'select') {
  52368. // #6903
  52369. if (oldVnode.elm && !oldVnode.elm._vOptions) {
  52370. mergeVNodeHook(vnode, 'postpatch', function () {
  52371. directive.componentUpdated(el, binding, vnode);
  52372. });
  52373. } else {
  52374. setSelected(el, binding, vnode.context);
  52375. }
  52376. el._vOptions = [].map.call(el.options, getValue);
  52377. } else if (vnode.tag === 'textarea' || isTextInputType(el.type)) {
  52378. el._vModifiers = binding.modifiers;
  52379. if (!binding.modifiers.lazy) {
  52380. el.addEventListener('compositionstart', onCompositionStart);
  52381. el.addEventListener('compositionend', onCompositionEnd);
  52382. // Safari < 10.2 & UIWebView doesn't fire compositionend when
  52383. // switching focus before confirming composition choice
  52384. // this also fixes the issue where some browsers e.g. iOS Chrome
  52385. // fires "change" instead of "input" on autocomplete.
  52386. el.addEventListener('change', onCompositionEnd);
  52387. /* istanbul ignore if */
  52388. if (isIE9) {
  52389. el.vmodel = true;
  52390. }
  52391. }
  52392. }
  52393. },
  52394. componentUpdated: function componentUpdated (el, binding, vnode) {
  52395. if (vnode.tag === 'select') {
  52396. setSelected(el, binding, vnode.context);
  52397. // in case the options rendered by v-for have changed,
  52398. // it's possible that the value is out-of-sync with the rendered options.
  52399. // detect such cases and filter out values that no longer has a matching
  52400. // option in the DOM.
  52401. var prevOptions = el._vOptions;
  52402. var curOptions = el._vOptions = [].map.call(el.options, getValue);
  52403. if (curOptions.some(function (o, i) { return !looseEqual(o, prevOptions[i]); })) {
  52404. // trigger change event if
  52405. // no matching option found for at least one value
  52406. var needReset = el.multiple
  52407. ? binding.value.some(function (v) { return hasNoMatchingOption(v, curOptions); })
  52408. : binding.value !== binding.oldValue && hasNoMatchingOption(binding.value, curOptions);
  52409. if (needReset) {
  52410. trigger(el, 'change');
  52411. }
  52412. }
  52413. }
  52414. }
  52415. };
  52416. function setSelected (el, binding, vm) {
  52417. actuallySetSelected(el, binding, vm);
  52418. /* istanbul ignore if */
  52419. if (isIE || isEdge) {
  52420. setTimeout(function () {
  52421. actuallySetSelected(el, binding, vm);
  52422. }, 0);
  52423. }
  52424. }
  52425. function actuallySetSelected (el, binding, vm) {
  52426. var value = binding.value;
  52427. var isMultiple = el.multiple;
  52428. if (isMultiple && !Array.isArray(value)) {
  52429. warn(
  52430. "<select multiple v-model=\"" + (binding.expression) + "\"> " +
  52431. "expects an Array value for its binding, but got " + (Object.prototype.toString.call(value).slice(8, -1)),
  52432. vm
  52433. );
  52434. return
  52435. }
  52436. var selected, option;
  52437. for (var i = 0, l = el.options.length; i < l; i++) {
  52438. option = el.options[i];
  52439. if (isMultiple) {
  52440. selected = looseIndexOf(value, getValue(option)) > -1;
  52441. if (option.selected !== selected) {
  52442. option.selected = selected;
  52443. }
  52444. } else {
  52445. if (looseEqual(getValue(option), value)) {
  52446. if (el.selectedIndex !== i) {
  52447. el.selectedIndex = i;
  52448. }
  52449. return
  52450. }
  52451. }
  52452. }
  52453. if (!isMultiple) {
  52454. el.selectedIndex = -1;
  52455. }
  52456. }
  52457. function hasNoMatchingOption (value, options) {
  52458. return options.every(function (o) { return !looseEqual(o, value); })
  52459. }
  52460. function getValue (option) {
  52461. return '_value' in option
  52462. ? option._value
  52463. : option.value
  52464. }
  52465. function onCompositionStart (e) {
  52466. e.target.composing = true;
  52467. }
  52468. function onCompositionEnd (e) {
  52469. // prevent triggering an input event for no reason
  52470. if (!e.target.composing) { return }
  52471. e.target.composing = false;
  52472. trigger(e.target, 'input');
  52473. }
  52474. function trigger (el, type) {
  52475. var e = document.createEvent('HTMLEvents');
  52476. e.initEvent(type, true, true);
  52477. el.dispatchEvent(e);
  52478. }
  52479. /* */
  52480. // recursively search for possible transition defined inside the component root
  52481. function locateNode (vnode) {
  52482. return vnode.componentInstance && (!vnode.data || !vnode.data.transition)
  52483. ? locateNode(vnode.componentInstance._vnode)
  52484. : vnode
  52485. }
  52486. var show = {
  52487. bind: function bind (el, ref, vnode) {
  52488. var value = ref.value;
  52489. vnode = locateNode(vnode);
  52490. var transition$$1 = vnode.data && vnode.data.transition;
  52491. var originalDisplay = el.__vOriginalDisplay =
  52492. el.style.display === 'none' ? '' : el.style.display;
  52493. if (value && transition$$1) {
  52494. vnode.data.show = true;
  52495. enter(vnode, function () {
  52496. el.style.display = originalDisplay;
  52497. });
  52498. } else {
  52499. el.style.display = value ? originalDisplay : 'none';
  52500. }
  52501. },
  52502. update: function update (el, ref, vnode) {
  52503. var value = ref.value;
  52504. var oldValue = ref.oldValue;
  52505. /* istanbul ignore if */
  52506. if (!value === !oldValue) { return }
  52507. vnode = locateNode(vnode);
  52508. var transition$$1 = vnode.data && vnode.data.transition;
  52509. if (transition$$1) {
  52510. vnode.data.show = true;
  52511. if (value) {
  52512. enter(vnode, function () {
  52513. el.style.display = el.__vOriginalDisplay;
  52514. });
  52515. } else {
  52516. leave(vnode, function () {
  52517. el.style.display = 'none';
  52518. });
  52519. }
  52520. } else {
  52521. el.style.display = value ? el.__vOriginalDisplay : 'none';
  52522. }
  52523. },
  52524. unbind: function unbind (
  52525. el,
  52526. binding,
  52527. vnode,
  52528. oldVnode,
  52529. isDestroy
  52530. ) {
  52531. if (!isDestroy) {
  52532. el.style.display = el.__vOriginalDisplay;
  52533. }
  52534. }
  52535. };
  52536. var platformDirectives = {
  52537. model: directive,
  52538. show: show
  52539. };
  52540. /* */
  52541. var transitionProps = {
  52542. name: String,
  52543. appear: Boolean,
  52544. css: Boolean,
  52545. mode: String,
  52546. type: String,
  52547. enterClass: String,
  52548. leaveClass: String,
  52549. enterToClass: String,
  52550. leaveToClass: String,
  52551. enterActiveClass: String,
  52552. leaveActiveClass: String,
  52553. appearClass: String,
  52554. appearActiveClass: String,
  52555. appearToClass: String,
  52556. duration: [Number, String, Object]
  52557. };
  52558. // in case the child is also an abstract component, e.g. <keep-alive>
  52559. // we want to recursively retrieve the real component to be rendered
  52560. function getRealChild (vnode) {
  52561. var compOptions = vnode && vnode.componentOptions;
  52562. if (compOptions && compOptions.Ctor.options.abstract) {
  52563. return getRealChild(getFirstComponentChild(compOptions.children))
  52564. } else {
  52565. return vnode
  52566. }
  52567. }
  52568. function extractTransitionData (comp) {
  52569. var data = {};
  52570. var options = comp.$options;
  52571. // props
  52572. for (var key in options.propsData) {
  52573. data[key] = comp[key];
  52574. }
  52575. // events.
  52576. // extract listeners and pass them directly to the transition methods
  52577. var listeners = options._parentListeners;
  52578. for (var key$1 in listeners) {
  52579. data[camelize(key$1)] = listeners[key$1];
  52580. }
  52581. return data
  52582. }
  52583. function placeholder (h, rawChild) {
  52584. if (/\d-keep-alive$/.test(rawChild.tag)) {
  52585. return h('keep-alive', {
  52586. props: rawChild.componentOptions.propsData
  52587. })
  52588. }
  52589. }
  52590. function hasParentTransition (vnode) {
  52591. while ((vnode = vnode.parent)) {
  52592. if (vnode.data.transition) {
  52593. return true
  52594. }
  52595. }
  52596. }
  52597. function isSameChild (child, oldChild) {
  52598. return oldChild.key === child.key && oldChild.tag === child.tag
  52599. }
  52600. var isNotTextNode = function (c) { return c.tag || isAsyncPlaceholder(c); };
  52601. var isVShowDirective = function (d) { return d.name === 'show'; };
  52602. var Transition = {
  52603. name: 'transition',
  52604. props: transitionProps,
  52605. abstract: true,
  52606. render: function render (h) {
  52607. var this$1 = this;
  52608. var children = this.$slots.default;
  52609. if (!children) {
  52610. return
  52611. }
  52612. // filter out text nodes (possible whitespaces)
  52613. children = children.filter(isNotTextNode);
  52614. /* istanbul ignore if */
  52615. if (!children.length) {
  52616. return
  52617. }
  52618. // warn multiple elements
  52619. if (children.length > 1) {
  52620. warn(
  52621. '<transition> can only be used on a single element. Use ' +
  52622. '<transition-group> for lists.',
  52623. this.$parent
  52624. );
  52625. }
  52626. var mode = this.mode;
  52627. // warn invalid mode
  52628. if (mode && mode !== 'in-out' && mode !== 'out-in'
  52629. ) {
  52630. warn(
  52631. 'invalid <transition> mode: ' + mode,
  52632. this.$parent
  52633. );
  52634. }
  52635. var rawChild = children[0];
  52636. // if this is a component root node and the component's
  52637. // parent container node also has transition, skip.
  52638. if (hasParentTransition(this.$vnode)) {
  52639. return rawChild
  52640. }
  52641. // apply transition data to child
  52642. // use getRealChild() to ignore abstract components e.g. keep-alive
  52643. var child = getRealChild(rawChild);
  52644. /* istanbul ignore if */
  52645. if (!child) {
  52646. return rawChild
  52647. }
  52648. if (this._leaving) {
  52649. return placeholder(h, rawChild)
  52650. }
  52651. // ensure a key that is unique to the vnode type and to this transition
  52652. // component instance. This key will be used to remove pending leaving nodes
  52653. // during entering.
  52654. var id = "__transition-" + (this._uid) + "-";
  52655. child.key = child.key == null
  52656. ? child.isComment
  52657. ? id + 'comment'
  52658. : id + child.tag
  52659. : isPrimitive(child.key)
  52660. ? (String(child.key).indexOf(id) === 0 ? child.key : id + child.key)
  52661. : child.key;
  52662. var data = (child.data || (child.data = {})).transition = extractTransitionData(this);
  52663. var oldRawChild = this._vnode;
  52664. var oldChild = getRealChild(oldRawChild);
  52665. // mark v-show
  52666. // so that the transition module can hand over the control to the directive
  52667. if (child.data.directives && child.data.directives.some(isVShowDirective)) {
  52668. child.data.show = true;
  52669. }
  52670. if (
  52671. oldChild &&
  52672. oldChild.data &&
  52673. !isSameChild(child, oldChild) &&
  52674. !isAsyncPlaceholder(oldChild) &&
  52675. // #6687 component root is a comment node
  52676. !(oldChild.componentInstance && oldChild.componentInstance._vnode.isComment)
  52677. ) {
  52678. // replace old child transition data with fresh one
  52679. // important for dynamic transitions!
  52680. var oldData = oldChild.data.transition = extend({}, data);
  52681. // handle transition mode
  52682. if (mode === 'out-in') {
  52683. // return placeholder node and queue update when leave finishes
  52684. this._leaving = true;
  52685. mergeVNodeHook(oldData, 'afterLeave', function () {
  52686. this$1._leaving = false;
  52687. this$1.$forceUpdate();
  52688. });
  52689. return placeholder(h, rawChild)
  52690. } else if (mode === 'in-out') {
  52691. if (isAsyncPlaceholder(child)) {
  52692. return oldRawChild
  52693. }
  52694. var delayedLeave;
  52695. var performLeave = function () { delayedLeave(); };
  52696. mergeVNodeHook(data, 'afterEnter', performLeave);
  52697. mergeVNodeHook(data, 'enterCancelled', performLeave);
  52698. mergeVNodeHook(oldData, 'delayLeave', function (leave) { delayedLeave = leave; });
  52699. }
  52700. }
  52701. return rawChild
  52702. }
  52703. };
  52704. /* */
  52705. var props = extend({
  52706. tag: String,
  52707. moveClass: String
  52708. }, transitionProps);
  52709. delete props.mode;
  52710. var TransitionGroup = {
  52711. props: props,
  52712. beforeMount: function beforeMount () {
  52713. var this$1 = this;
  52714. var update = this._update;
  52715. this._update = function (vnode, hydrating) {
  52716. var restoreActiveInstance = setActiveInstance(this$1);
  52717. // force removing pass
  52718. this$1.__patch__(
  52719. this$1._vnode,
  52720. this$1.kept,
  52721. false, // hydrating
  52722. true // removeOnly (!important, avoids unnecessary moves)
  52723. );
  52724. this$1._vnode = this$1.kept;
  52725. restoreActiveInstance();
  52726. update.call(this$1, vnode, hydrating);
  52727. };
  52728. },
  52729. render: function render (h) {
  52730. var tag = this.tag || this.$vnode.data.tag || 'span';
  52731. var map = Object.create(null);
  52732. var prevChildren = this.prevChildren = this.children;
  52733. var rawChildren = this.$slots.default || [];
  52734. var children = this.children = [];
  52735. var transitionData = extractTransitionData(this);
  52736. for (var i = 0; i < rawChildren.length; i++) {
  52737. var c = rawChildren[i];
  52738. if (c.tag) {
  52739. if (c.key != null && String(c.key).indexOf('__vlist') !== 0) {
  52740. children.push(c);
  52741. map[c.key] = c
  52742. ;(c.data || (c.data = {})).transition = transitionData;
  52743. } else {
  52744. var opts = c.componentOptions;
  52745. var name = opts ? (opts.Ctor.options.name || opts.tag || '') : c.tag;
  52746. warn(("<transition-group> children must be keyed: <" + name + ">"));
  52747. }
  52748. }
  52749. }
  52750. if (prevChildren) {
  52751. var kept = [];
  52752. var removed = [];
  52753. for (var i$1 = 0; i$1 < prevChildren.length; i$1++) {
  52754. var c$1 = prevChildren[i$1];
  52755. c$1.data.transition = transitionData;
  52756. c$1.data.pos = c$1.elm.getBoundingClientRect();
  52757. if (map[c$1.key]) {
  52758. kept.push(c$1);
  52759. } else {
  52760. removed.push(c$1);
  52761. }
  52762. }
  52763. this.kept = h(tag, null, kept);
  52764. this.removed = removed;
  52765. }
  52766. return h(tag, null, children)
  52767. },
  52768. updated: function updated () {
  52769. var children = this.prevChildren;
  52770. var moveClass = this.moveClass || ((this.name || 'v') + '-move');
  52771. if (!children.length || !this.hasMove(children[0].elm, moveClass)) {
  52772. return
  52773. }
  52774. // we divide the work into three loops to avoid mixing DOM reads and writes
  52775. // in each iteration - which helps prevent layout thrashing.
  52776. children.forEach(callPendingCbs);
  52777. children.forEach(recordPosition);
  52778. children.forEach(applyTranslation);
  52779. // force reflow to put everything in position
  52780. // assign to this to avoid being removed in tree-shaking
  52781. // $flow-disable-line
  52782. this._reflow = document.body.offsetHeight;
  52783. children.forEach(function (c) {
  52784. if (c.data.moved) {
  52785. var el = c.elm;
  52786. var s = el.style;
  52787. addTransitionClass(el, moveClass);
  52788. s.transform = s.WebkitTransform = s.transitionDuration = '';
  52789. el.addEventListener(transitionEndEvent, el._moveCb = function cb (e) {
  52790. if (e && e.target !== el) {
  52791. return
  52792. }
  52793. if (!e || /transform$/.test(e.propertyName)) {
  52794. el.removeEventListener(transitionEndEvent, cb);
  52795. el._moveCb = null;
  52796. removeTransitionClass(el, moveClass);
  52797. }
  52798. });
  52799. }
  52800. });
  52801. },
  52802. methods: {
  52803. hasMove: function hasMove (el, moveClass) {
  52804. /* istanbul ignore if */
  52805. if (!hasTransition) {
  52806. return false
  52807. }
  52808. /* istanbul ignore if */
  52809. if (this._hasMove) {
  52810. return this._hasMove
  52811. }
  52812. // Detect whether an element with the move class applied has
  52813. // CSS transitions. Since the element may be inside an entering
  52814. // transition at this very moment, we make a clone of it and remove
  52815. // all other transition classes applied to ensure only the move class
  52816. // is applied.
  52817. var clone = el.cloneNode();
  52818. if (el._transitionClasses) {
  52819. el._transitionClasses.forEach(function (cls) { removeClass(clone, cls); });
  52820. }
  52821. addClass(clone, moveClass);
  52822. clone.style.display = 'none';
  52823. this.$el.appendChild(clone);
  52824. var info = getTransitionInfo(clone);
  52825. this.$el.removeChild(clone);
  52826. return (this._hasMove = info.hasTransform)
  52827. }
  52828. }
  52829. };
  52830. function callPendingCbs (c) {
  52831. /* istanbul ignore if */
  52832. if (c.elm._moveCb) {
  52833. c.elm._moveCb();
  52834. }
  52835. /* istanbul ignore if */
  52836. if (c.elm._enterCb) {
  52837. c.elm._enterCb();
  52838. }
  52839. }
  52840. function recordPosition (c) {
  52841. c.data.newPos = c.elm.getBoundingClientRect();
  52842. }
  52843. function applyTranslation (c) {
  52844. var oldPos = c.data.pos;
  52845. var newPos = c.data.newPos;
  52846. var dx = oldPos.left - newPos.left;
  52847. var dy = oldPos.top - newPos.top;
  52848. if (dx || dy) {
  52849. c.data.moved = true;
  52850. var s = c.elm.style;
  52851. s.transform = s.WebkitTransform = "translate(" + dx + "px," + dy + "px)";
  52852. s.transitionDuration = '0s';
  52853. }
  52854. }
  52855. var platformComponents = {
  52856. Transition: Transition,
  52857. TransitionGroup: TransitionGroup
  52858. };
  52859. /* */
  52860. // install platform specific utils
  52861. Vue.config.mustUseProp = mustUseProp;
  52862. Vue.config.isReservedTag = isReservedTag;
  52863. Vue.config.isReservedAttr = isReservedAttr;
  52864. Vue.config.getTagNamespace = getTagNamespace;
  52865. Vue.config.isUnknownElement = isUnknownElement;
  52866. // install platform runtime directives & components
  52867. extend(Vue.options.directives, platformDirectives);
  52868. extend(Vue.options.components, platformComponents);
  52869. // install platform patch function
  52870. Vue.prototype.__patch__ = inBrowser ? patch : noop;
  52871. // public mount method
  52872. Vue.prototype.$mount = function (
  52873. el,
  52874. hydrating
  52875. ) {
  52876. el = el && inBrowser ? query(el) : undefined;
  52877. return mountComponent(this, el, hydrating)
  52878. };
  52879. // devtools global hook
  52880. /* istanbul ignore next */
  52881. if (inBrowser) {
  52882. setTimeout(function () {
  52883. if (config.devtools) {
  52884. if (devtools) {
  52885. devtools.emit('init', Vue);
  52886. } else {
  52887. console[console.info ? 'info' : 'log'](
  52888. 'Download the Vue Devtools extension for a better development experience:\n' +
  52889. 'https://github.com/vuejs/vue-devtools'
  52890. );
  52891. }
  52892. }
  52893. if (config.productionTip !== false &&
  52894. typeof console !== 'undefined'
  52895. ) {
  52896. console[console.info ? 'info' : 'log'](
  52897. "You are running Vue in development mode.\n" +
  52898. "Make sure to turn on production mode when deploying for production.\n" +
  52899. "See more tips at https://vuejs.org/guide/deployment.html"
  52900. );
  52901. }
  52902. }, 0);
  52903. }
  52904. /* */
  52905. var defaultTagRE = /\{\{((?:.|\r?\n)+?)\}\}/g;
  52906. var regexEscapeRE = /[-.*+?^${}()|[\]\/\\]/g;
  52907. var buildRegex = cached(function (delimiters) {
  52908. var open = delimiters[0].replace(regexEscapeRE, '\\$&');
  52909. var close = delimiters[1].replace(regexEscapeRE, '\\$&');
  52910. return new RegExp(open + '((?:.|\\n)+?)' + close, 'g')
  52911. });
  52912. function parseText (
  52913. text,
  52914. delimiters
  52915. ) {
  52916. var tagRE = delimiters ? buildRegex(delimiters) : defaultTagRE;
  52917. if (!tagRE.test(text)) {
  52918. return
  52919. }
  52920. var tokens = [];
  52921. var rawTokens = [];
  52922. var lastIndex = tagRE.lastIndex = 0;
  52923. var match, index, tokenValue;
  52924. while ((match = tagRE.exec(text))) {
  52925. index = match.index;
  52926. // push text token
  52927. if (index > lastIndex) {
  52928. rawTokens.push(tokenValue = text.slice(lastIndex, index));
  52929. tokens.push(JSON.stringify(tokenValue));
  52930. }
  52931. // tag token
  52932. var exp = parseFilters(match[1].trim());
  52933. tokens.push(("_s(" + exp + ")"));
  52934. rawTokens.push({ '@binding': exp });
  52935. lastIndex = index + match[0].length;
  52936. }
  52937. if (lastIndex < text.length) {
  52938. rawTokens.push(tokenValue = text.slice(lastIndex));
  52939. tokens.push(JSON.stringify(tokenValue));
  52940. }
  52941. return {
  52942. expression: tokens.join('+'),
  52943. tokens: rawTokens
  52944. }
  52945. }
  52946. /* */
  52947. function transformNode (el, options) {
  52948. var warn = options.warn || baseWarn;
  52949. var staticClass = getAndRemoveAttr(el, 'class');
  52950. if (staticClass) {
  52951. var res = parseText(staticClass, options.delimiters);
  52952. if (res) {
  52953. warn(
  52954. "class=\"" + staticClass + "\": " +
  52955. 'Interpolation inside attributes has been removed. ' +
  52956. 'Use v-bind or the colon shorthand instead. For example, ' +
  52957. 'instead of <div class="{{ val }}">, use <div :class="val">.',
  52958. el.rawAttrsMap['class']
  52959. );
  52960. }
  52961. }
  52962. if (staticClass) {
  52963. el.staticClass = JSON.stringify(staticClass);
  52964. }
  52965. var classBinding = getBindingAttr(el, 'class', false /* getStatic */);
  52966. if (classBinding) {
  52967. el.classBinding = classBinding;
  52968. }
  52969. }
  52970. function genData (el) {
  52971. var data = '';
  52972. if (el.staticClass) {
  52973. data += "staticClass:" + (el.staticClass) + ",";
  52974. }
  52975. if (el.classBinding) {
  52976. data += "class:" + (el.classBinding) + ",";
  52977. }
  52978. return data
  52979. }
  52980. var klass$1 = {
  52981. staticKeys: ['staticClass'],
  52982. transformNode: transformNode,
  52983. genData: genData
  52984. };
  52985. /* */
  52986. function transformNode$1 (el, options) {
  52987. var warn = options.warn || baseWarn;
  52988. var staticStyle = getAndRemoveAttr(el, 'style');
  52989. if (staticStyle) {
  52990. /* istanbul ignore if */
  52991. {
  52992. var res = parseText(staticStyle, options.delimiters);
  52993. if (res) {
  52994. warn(
  52995. "style=\"" + staticStyle + "\": " +
  52996. 'Interpolation inside attributes has been removed. ' +
  52997. 'Use v-bind or the colon shorthand instead. For example, ' +
  52998. 'instead of <div style="{{ val }}">, use <div :style="val">.',
  52999. el.rawAttrsMap['style']
  53000. );
  53001. }
  53002. }
  53003. el.staticStyle = JSON.stringify(parseStyleText(staticStyle));
  53004. }
  53005. var styleBinding = getBindingAttr(el, 'style', false /* getStatic */);
  53006. if (styleBinding) {
  53007. el.styleBinding = styleBinding;
  53008. }
  53009. }
  53010. function genData$1 (el) {
  53011. var data = '';
  53012. if (el.staticStyle) {
  53013. data += "staticStyle:" + (el.staticStyle) + ",";
  53014. }
  53015. if (el.styleBinding) {
  53016. data += "style:(" + (el.styleBinding) + "),";
  53017. }
  53018. return data
  53019. }
  53020. var style$1 = {
  53021. staticKeys: ['staticStyle'],
  53022. transformNode: transformNode$1,
  53023. genData: genData$1
  53024. };
  53025. /* */
  53026. var decoder;
  53027. var he = {
  53028. decode: function decode (html) {
  53029. decoder = decoder || document.createElement('div');
  53030. decoder.innerHTML = html;
  53031. return decoder.textContent
  53032. }
  53033. };
  53034. /* */
  53035. var isUnaryTag = makeMap(
  53036. 'area,base,br,col,embed,frame,hr,img,input,isindex,keygen,' +
  53037. 'link,meta,param,source,track,wbr'
  53038. );
  53039. // Elements that you can, intentionally, leave open
  53040. // (and which close themselves)
  53041. var canBeLeftOpenTag = makeMap(
  53042. 'colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr,source'
  53043. );
  53044. // HTML5 tags https://html.spec.whatwg.org/multipage/indices.html#elements-3
  53045. // Phrasing Content https://html.spec.whatwg.org/multipage/dom.html#phrasing-content
  53046. var isNonPhrasingTag = makeMap(
  53047. 'address,article,aside,base,blockquote,body,caption,col,colgroup,dd,' +
  53048. 'details,dialog,div,dl,dt,fieldset,figcaption,figure,footer,form,' +
  53049. 'h1,h2,h3,h4,h5,h6,head,header,hgroup,hr,html,legend,li,menuitem,meta,' +
  53050. 'optgroup,option,param,rp,rt,source,style,summary,tbody,td,tfoot,th,thead,' +
  53051. 'title,tr,track'
  53052. );
  53053. /**
  53054. * Not type-checking this file because it's mostly vendor code.
  53055. */
  53056. // Regular Expressions for parsing tags and attributes
  53057. var attribute = /^\s*([^\s"'<>\/=]+)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/;
  53058. var dynamicArgAttribute = /^\s*((?:v-[\w-]+:|@|:|#)\[[^=]+\][^\s"'<>\/=]*)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/;
  53059. var ncname = "[a-zA-Z_][\\-\\.0-9_a-zA-Z" + (unicodeRegExp.source) + "]*";
  53060. var qnameCapture = "((?:" + ncname + "\\:)?" + ncname + ")";
  53061. var startTagOpen = new RegExp(("^<" + qnameCapture));
  53062. var startTagClose = /^\s*(\/?)>/;
  53063. var endTag = new RegExp(("^<\\/" + qnameCapture + "[^>]*>"));
  53064. var doctype = /^<!DOCTYPE [^>]+>/i;
  53065. // #7298: escape - to avoid being passed as HTML comment when inlined in page
  53066. var comment = /^<!\--/;
  53067. var conditionalComment = /^<!\[/;
  53068. // Special Elements (can contain anything)
  53069. var isPlainTextElement = makeMap('script,style,textarea', true);
  53070. var reCache = {};
  53071. var decodingMap = {
  53072. '&lt;': '<',
  53073. '&gt;': '>',
  53074. '&quot;': '"',
  53075. '&amp;': '&',
  53076. '&#10;': '\n',
  53077. '&#9;': '\t',
  53078. '&#39;': "'"
  53079. };
  53080. var encodedAttr = /&(?:lt|gt|quot|amp|#39);/g;
  53081. var encodedAttrWithNewLines = /&(?:lt|gt|quot|amp|#39|#10|#9);/g;
  53082. // #5992
  53083. var isIgnoreNewlineTag = makeMap('pre,textarea', true);
  53084. var shouldIgnoreFirstNewline = function (tag, html) { return tag && isIgnoreNewlineTag(tag) && html[0] === '\n'; };
  53085. function decodeAttr (value, shouldDecodeNewlines) {
  53086. var re = shouldDecodeNewlines ? encodedAttrWithNewLines : encodedAttr;
  53087. return value.replace(re, function (match) { return decodingMap[match]; })
  53088. }
  53089. function parseHTML (html, options) {
  53090. var stack = [];
  53091. var expectHTML = options.expectHTML;
  53092. var isUnaryTag$$1 = options.isUnaryTag || no;
  53093. var canBeLeftOpenTag$$1 = options.canBeLeftOpenTag || no;
  53094. var index = 0;
  53095. var last, lastTag;
  53096. while (html) {
  53097. last = html;
  53098. // Make sure we're not in a plaintext content element like script/style
  53099. if (!lastTag || !isPlainTextElement(lastTag)) {
  53100. var textEnd = html.indexOf('<');
  53101. if (textEnd === 0) {
  53102. // Comment:
  53103. if (comment.test(html)) {
  53104. var commentEnd = html.indexOf('-->');
  53105. if (commentEnd >= 0) {
  53106. if (options.shouldKeepComment) {
  53107. options.comment(html.substring(4, commentEnd), index, index + commentEnd + 3);
  53108. }
  53109. advance(commentEnd + 3);
  53110. continue
  53111. }
  53112. }
  53113. // http://en.wikipedia.org/wiki/Conditional_comment#Downlevel-revealed_conditional_comment
  53114. if (conditionalComment.test(html)) {
  53115. var conditionalEnd = html.indexOf(']>');
  53116. if (conditionalEnd >= 0) {
  53117. advance(conditionalEnd + 2);
  53118. continue
  53119. }
  53120. }
  53121. // Doctype:
  53122. var doctypeMatch = html.match(doctype);
  53123. if (doctypeMatch) {
  53124. advance(doctypeMatch[0].length);
  53125. continue
  53126. }
  53127. // End tag:
  53128. var endTagMatch = html.match(endTag);
  53129. if (endTagMatch) {
  53130. var curIndex = index;
  53131. advance(endTagMatch[0].length);
  53132. parseEndTag(endTagMatch[1], curIndex, index);
  53133. continue
  53134. }
  53135. // Start tag:
  53136. var startTagMatch = parseStartTag();
  53137. if (startTagMatch) {
  53138. handleStartTag(startTagMatch);
  53139. if (shouldIgnoreFirstNewline(startTagMatch.tagName, html)) {
  53140. advance(1);
  53141. }
  53142. continue
  53143. }
  53144. }
  53145. var text = (void 0), rest = (void 0), next = (void 0);
  53146. if (textEnd >= 0) {
  53147. rest = html.slice(textEnd);
  53148. while (
  53149. !endTag.test(rest) &&
  53150. !startTagOpen.test(rest) &&
  53151. !comment.test(rest) &&
  53152. !conditionalComment.test(rest)
  53153. ) {
  53154. // < in plain text, be forgiving and treat it as text
  53155. next = rest.indexOf('<', 1);
  53156. if (next < 0) { break }
  53157. textEnd += next;
  53158. rest = html.slice(textEnd);
  53159. }
  53160. text = html.substring(0, textEnd);
  53161. }
  53162. if (textEnd < 0) {
  53163. text = html;
  53164. }
  53165. if (text) {
  53166. advance(text.length);
  53167. }
  53168. if (options.chars && text) {
  53169. options.chars(text, index - text.length, index);
  53170. }
  53171. } else {
  53172. var endTagLength = 0;
  53173. var stackedTag = lastTag.toLowerCase();
  53174. var reStackedTag = reCache[stackedTag] || (reCache[stackedTag] = new RegExp('([\\s\\S]*?)(</' + stackedTag + '[^>]*>)', 'i'));
  53175. var rest$1 = html.replace(reStackedTag, function (all, text, endTag) {
  53176. endTagLength = endTag.length;
  53177. if (!isPlainTextElement(stackedTag) && stackedTag !== 'noscript') {
  53178. text = text
  53179. .replace(/<!\--([\s\S]*?)-->/g, '$1') // #7298
  53180. .replace(/<!\[CDATA\[([\s\S]*?)]]>/g, '$1');
  53181. }
  53182. if (shouldIgnoreFirstNewline(stackedTag, text)) {
  53183. text = text.slice(1);
  53184. }
  53185. if (options.chars) {
  53186. options.chars(text);
  53187. }
  53188. return ''
  53189. });
  53190. index += html.length - rest$1.length;
  53191. html = rest$1;
  53192. parseEndTag(stackedTag, index - endTagLength, index);
  53193. }
  53194. if (html === last) {
  53195. options.chars && options.chars(html);
  53196. if (!stack.length && options.warn) {
  53197. options.warn(("Mal-formatted tag at end of template: \"" + html + "\""), { start: index + html.length });
  53198. }
  53199. break
  53200. }
  53201. }
  53202. // Clean up any remaining tags
  53203. parseEndTag();
  53204. function advance (n) {
  53205. index += n;
  53206. html = html.substring(n);
  53207. }
  53208. function parseStartTag () {
  53209. var start = html.match(startTagOpen);
  53210. if (start) {
  53211. var match = {
  53212. tagName: start[1],
  53213. attrs: [],
  53214. start: index
  53215. };
  53216. advance(start[0].length);
  53217. var end, attr;
  53218. while (!(end = html.match(startTagClose)) && (attr = html.match(dynamicArgAttribute) || html.match(attribute))) {
  53219. attr.start = index;
  53220. advance(attr[0].length);
  53221. attr.end = index;
  53222. match.attrs.push(attr);
  53223. }
  53224. if (end) {
  53225. match.unarySlash = end[1];
  53226. advance(end[0].length);
  53227. match.end = index;
  53228. return match
  53229. }
  53230. }
  53231. }
  53232. function handleStartTag (match) {
  53233. var tagName = match.tagName;
  53234. var unarySlash = match.unarySlash;
  53235. if (expectHTML) {
  53236. if (lastTag === 'p' && isNonPhrasingTag(tagName)) {
  53237. parseEndTag(lastTag);
  53238. }
  53239. if (canBeLeftOpenTag$$1(tagName) && lastTag === tagName) {
  53240. parseEndTag(tagName);
  53241. }
  53242. }
  53243. var unary = isUnaryTag$$1(tagName) || !!unarySlash;
  53244. var l = match.attrs.length;
  53245. var attrs = new Array(l);
  53246. for (var i = 0; i < l; i++) {
  53247. var args = match.attrs[i];
  53248. var value = args[3] || args[4] || args[5] || '';
  53249. var shouldDecodeNewlines = tagName === 'a' && args[1] === 'href'
  53250. ? options.shouldDecodeNewlinesForHref
  53251. : options.shouldDecodeNewlines;
  53252. attrs[i] = {
  53253. name: args[1],
  53254. value: decodeAttr(value, shouldDecodeNewlines)
  53255. };
  53256. if (options.outputSourceRange) {
  53257. attrs[i].start = args.start + args[0].match(/^\s*/).length;
  53258. attrs[i].end = args.end;
  53259. }
  53260. }
  53261. if (!unary) {
  53262. stack.push({ tag: tagName, lowerCasedTag: tagName.toLowerCase(), attrs: attrs, start: match.start, end: match.end });
  53263. lastTag = tagName;
  53264. }
  53265. if (options.start) {
  53266. options.start(tagName, attrs, unary, match.start, match.end);
  53267. }
  53268. }
  53269. function parseEndTag (tagName, start, end) {
  53270. var pos, lowerCasedTagName;
  53271. if (start == null) { start = index; }
  53272. if (end == null) { end = index; }
  53273. // Find the closest opened tag of the same type
  53274. if (tagName) {
  53275. lowerCasedTagName = tagName.toLowerCase();
  53276. for (pos = stack.length - 1; pos >= 0; pos--) {
  53277. if (stack[pos].lowerCasedTag === lowerCasedTagName) {
  53278. break
  53279. }
  53280. }
  53281. } else {
  53282. // If no tag name is provided, clean shop
  53283. pos = 0;
  53284. }
  53285. if (pos >= 0) {
  53286. // Close all the open elements, up the stack
  53287. for (var i = stack.length - 1; i >= pos; i--) {
  53288. if (i > pos || !tagName &&
  53289. options.warn
  53290. ) {
  53291. options.warn(
  53292. ("tag <" + (stack[i].tag) + "> has no matching end tag."),
  53293. { start: stack[i].start, end: stack[i].end }
  53294. );
  53295. }
  53296. if (options.end) {
  53297. options.end(stack[i].tag, start, end);
  53298. }
  53299. }
  53300. // Remove the open elements from the stack
  53301. stack.length = pos;
  53302. lastTag = pos && stack[pos - 1].tag;
  53303. } else if (lowerCasedTagName === 'br') {
  53304. if (options.start) {
  53305. options.start(tagName, [], true, start, end);
  53306. }
  53307. } else if (lowerCasedTagName === 'p') {
  53308. if (options.start) {
  53309. options.start(tagName, [], false, start, end);
  53310. }
  53311. if (options.end) {
  53312. options.end(tagName, start, end);
  53313. }
  53314. }
  53315. }
  53316. }
  53317. /* */
  53318. var onRE = /^@|^v-on:/;
  53319. var dirRE = /^v-|^@|^:|^#/;
  53320. var forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/;
  53321. var forIteratorRE = /,([^,\}\]]*)(?:,([^,\}\]]*))?$/;
  53322. var stripParensRE = /^\(|\)$/g;
  53323. var dynamicArgRE = /^\[.*\]$/;
  53324. var argRE = /:(.*)$/;
  53325. var bindRE = /^:|^\.|^v-bind:/;
  53326. var modifierRE = /\.[^.\]]+(?=[^\]]*$)/g;
  53327. var slotRE = /^v-slot(:|$)|^#/;
  53328. var lineBreakRE = /[\r\n]/;
  53329. var whitespaceRE$1 = /\s+/g;
  53330. var invalidAttributeRE = /[\s"'<>\/=]/;
  53331. var decodeHTMLCached = cached(he.decode);
  53332. var emptySlotScopeToken = "_empty_";
  53333. // configurable state
  53334. var warn$2;
  53335. var delimiters;
  53336. var transforms;
  53337. var preTransforms;
  53338. var postTransforms;
  53339. var platformIsPreTag;
  53340. var platformMustUseProp;
  53341. var platformGetTagNamespace;
  53342. var maybeComponent;
  53343. function createASTElement (
  53344. tag,
  53345. attrs,
  53346. parent
  53347. ) {
  53348. return {
  53349. type: 1,
  53350. tag: tag,
  53351. attrsList: attrs,
  53352. attrsMap: makeAttrsMap(attrs),
  53353. rawAttrsMap: {},
  53354. parent: parent,
  53355. children: []
  53356. }
  53357. }
  53358. /**
  53359. * Convert HTML string to AST.
  53360. */
  53361. function parse (
  53362. template,
  53363. options
  53364. ) {
  53365. warn$2 = options.warn || baseWarn;
  53366. platformIsPreTag = options.isPreTag || no;
  53367. platformMustUseProp = options.mustUseProp || no;
  53368. platformGetTagNamespace = options.getTagNamespace || no;
  53369. var isReservedTag = options.isReservedTag || no;
  53370. maybeComponent = function (el) { return !!el.component || !isReservedTag(el.tag); };
  53371. transforms = pluckModuleFunction(options.modules, 'transformNode');
  53372. preTransforms = pluckModuleFunction(options.modules, 'preTransformNode');
  53373. postTransforms = pluckModuleFunction(options.modules, 'postTransformNode');
  53374. delimiters = options.delimiters;
  53375. var stack = [];
  53376. var preserveWhitespace = options.preserveWhitespace !== false;
  53377. var whitespaceOption = options.whitespace;
  53378. var root;
  53379. var currentParent;
  53380. var inVPre = false;
  53381. var inPre = false;
  53382. var warned = false;
  53383. function warnOnce (msg, range) {
  53384. if (!warned) {
  53385. warned = true;
  53386. warn$2(msg, range);
  53387. }
  53388. }
  53389. function closeElement (element) {
  53390. trimEndingWhitespace(element);
  53391. if (!inVPre && !element.processed) {
  53392. element = processElement(element, options);
  53393. }
  53394. // tree management
  53395. if (!stack.length && element !== root) {
  53396. // allow root elements with v-if, v-else-if and v-else
  53397. if (root.if && (element.elseif || element.else)) {
  53398. {
  53399. checkRootConstraints(element);
  53400. }
  53401. addIfCondition(root, {
  53402. exp: element.elseif,
  53403. block: element
  53404. });
  53405. } else {
  53406. warnOnce(
  53407. "Component template should contain exactly one root element. " +
  53408. "If you are using v-if on multiple elements, " +
  53409. "use v-else-if to chain them instead.",
  53410. { start: element.start }
  53411. );
  53412. }
  53413. }
  53414. if (currentParent && !element.forbidden) {
  53415. if (element.elseif || element.else) {
  53416. processIfConditions(element, currentParent);
  53417. } else {
  53418. if (element.slotScope) {
  53419. // scoped slot
  53420. // keep it in the children list so that v-else(-if) conditions can
  53421. // find it as the prev node.
  53422. var name = element.slotTarget || '"default"'
  53423. ;(currentParent.scopedSlots || (currentParent.scopedSlots = {}))[name] = element;
  53424. }
  53425. currentParent.children.push(element);
  53426. element.parent = currentParent;
  53427. }
  53428. }
  53429. // final children cleanup
  53430. // filter out scoped slots
  53431. element.children = element.children.filter(function (c) { return !(c).slotScope; });
  53432. // remove trailing whitespace node again
  53433. trimEndingWhitespace(element);
  53434. // check pre state
  53435. if (element.pre) {
  53436. inVPre = false;
  53437. }
  53438. if (platformIsPreTag(element.tag)) {
  53439. inPre = false;
  53440. }
  53441. // apply post-transforms
  53442. for (var i = 0; i < postTransforms.length; i++) {
  53443. postTransforms[i](element, options);
  53444. }
  53445. }
  53446. function trimEndingWhitespace (el) {
  53447. // remove trailing whitespace node
  53448. if (!inPre) {
  53449. var lastNode;
  53450. while (
  53451. (lastNode = el.children[el.children.length - 1]) &&
  53452. lastNode.type === 3 &&
  53453. lastNode.text === ' '
  53454. ) {
  53455. el.children.pop();
  53456. }
  53457. }
  53458. }
  53459. function checkRootConstraints (el) {
  53460. if (el.tag === 'slot' || el.tag === 'template') {
  53461. warnOnce(
  53462. "Cannot use <" + (el.tag) + "> as component root element because it may " +
  53463. 'contain multiple nodes.',
  53464. { start: el.start }
  53465. );
  53466. }
  53467. if (el.attrsMap.hasOwnProperty('v-for')) {
  53468. warnOnce(
  53469. 'Cannot use v-for on stateful component root element because ' +
  53470. 'it renders multiple elements.',
  53471. el.rawAttrsMap['v-for']
  53472. );
  53473. }
  53474. }
  53475. parseHTML(template, {
  53476. warn: warn$2,
  53477. expectHTML: options.expectHTML,
  53478. isUnaryTag: options.isUnaryTag,
  53479. canBeLeftOpenTag: options.canBeLeftOpenTag,
  53480. shouldDecodeNewlines: options.shouldDecodeNewlines,
  53481. shouldDecodeNewlinesForHref: options.shouldDecodeNewlinesForHref,
  53482. shouldKeepComment: options.comments,
  53483. outputSourceRange: options.outputSourceRange,
  53484. start: function start (tag, attrs, unary, start$1, end) {
  53485. // check namespace.
  53486. // inherit parent ns if there is one
  53487. var ns = (currentParent && currentParent.ns) || platformGetTagNamespace(tag);
  53488. // handle IE svg bug
  53489. /* istanbul ignore if */
  53490. if (isIE && ns === 'svg') {
  53491. attrs = guardIESVGBug(attrs);
  53492. }
  53493. var element = createASTElement(tag, attrs, currentParent);
  53494. if (ns) {
  53495. element.ns = ns;
  53496. }
  53497. {
  53498. if (options.outputSourceRange) {
  53499. element.start = start$1;
  53500. element.end = end;
  53501. element.rawAttrsMap = element.attrsList.reduce(function (cumulated, attr) {
  53502. cumulated[attr.name] = attr;
  53503. return cumulated
  53504. }, {});
  53505. }
  53506. attrs.forEach(function (attr) {
  53507. if (invalidAttributeRE.test(attr.name)) {
  53508. warn$2(
  53509. "Invalid dynamic argument expression: attribute names cannot contain " +
  53510. "spaces, quotes, <, >, / or =.",
  53511. {
  53512. start: attr.start + attr.name.indexOf("["),
  53513. end: attr.start + attr.name.length
  53514. }
  53515. );
  53516. }
  53517. });
  53518. }
  53519. if (isForbiddenTag(element) && !isServerRendering()) {
  53520. element.forbidden = true;
  53521. warn$2(
  53522. 'Templates should only be responsible for mapping the state to the ' +
  53523. 'UI. Avoid placing tags with side-effects in your templates, such as ' +
  53524. "<" + tag + ">" + ', as they will not be parsed.',
  53525. { start: element.start }
  53526. );
  53527. }
  53528. // apply pre-transforms
  53529. for (var i = 0; i < preTransforms.length; i++) {
  53530. element = preTransforms[i](element, options) || element;
  53531. }
  53532. if (!inVPre) {
  53533. processPre(element);
  53534. if (element.pre) {
  53535. inVPre = true;
  53536. }
  53537. }
  53538. if (platformIsPreTag(element.tag)) {
  53539. inPre = true;
  53540. }
  53541. if (inVPre) {
  53542. processRawAttrs(element);
  53543. } else if (!element.processed) {
  53544. // structural directives
  53545. processFor(element);
  53546. processIf(element);
  53547. processOnce(element);
  53548. }
  53549. if (!root) {
  53550. root = element;
  53551. {
  53552. checkRootConstraints(root);
  53553. }
  53554. }
  53555. if (!unary) {
  53556. currentParent = element;
  53557. stack.push(element);
  53558. } else {
  53559. closeElement(element);
  53560. }
  53561. },
  53562. end: function end (tag, start, end$1) {
  53563. var element = stack[stack.length - 1];
  53564. // pop stack
  53565. stack.length -= 1;
  53566. currentParent = stack[stack.length - 1];
  53567. if (options.outputSourceRange) {
  53568. element.end = end$1;
  53569. }
  53570. closeElement(element);
  53571. },
  53572. chars: function chars (text, start, end) {
  53573. if (!currentParent) {
  53574. {
  53575. if (text === template) {
  53576. warnOnce(
  53577. 'Component template requires a root element, rather than just text.',
  53578. { start: start }
  53579. );
  53580. } else if ((text = text.trim())) {
  53581. warnOnce(
  53582. ("text \"" + text + "\" outside root element will be ignored."),
  53583. { start: start }
  53584. );
  53585. }
  53586. }
  53587. return
  53588. }
  53589. // IE textarea placeholder bug
  53590. /* istanbul ignore if */
  53591. if (isIE &&
  53592. currentParent.tag === 'textarea' &&
  53593. currentParent.attrsMap.placeholder === text
  53594. ) {
  53595. return
  53596. }
  53597. var children = currentParent.children;
  53598. if (inPre || text.trim()) {
  53599. text = isTextTag(currentParent) ? text : decodeHTMLCached(text);
  53600. } else if (!children.length) {
  53601. // remove the whitespace-only node right after an opening tag
  53602. text = '';
  53603. } else if (whitespaceOption) {
  53604. if (whitespaceOption === 'condense') {
  53605. // in condense mode, remove the whitespace node if it contains
  53606. // line break, otherwise condense to a single space
  53607. text = lineBreakRE.test(text) ? '' : ' ';
  53608. } else {
  53609. text = ' ';
  53610. }
  53611. } else {
  53612. text = preserveWhitespace ? ' ' : '';
  53613. }
  53614. if (text) {
  53615. if (!inPre && whitespaceOption === 'condense') {
  53616. // condense consecutive whitespaces into single space
  53617. text = text.replace(whitespaceRE$1, ' ');
  53618. }
  53619. var res;
  53620. var child;
  53621. if (!inVPre && text !== ' ' && (res = parseText(text, delimiters))) {
  53622. child = {
  53623. type: 2,
  53624. expression: res.expression,
  53625. tokens: res.tokens,
  53626. text: text
  53627. };
  53628. } else if (text !== ' ' || !children.length || children[children.length - 1].text !== ' ') {
  53629. child = {
  53630. type: 3,
  53631. text: text
  53632. };
  53633. }
  53634. if (child) {
  53635. if (options.outputSourceRange) {
  53636. child.start = start;
  53637. child.end = end;
  53638. }
  53639. children.push(child);
  53640. }
  53641. }
  53642. },
  53643. comment: function comment (text, start, end) {
  53644. // adding anyting as a sibling to the root node is forbidden
  53645. // comments should still be allowed, but ignored
  53646. if (currentParent) {
  53647. var child = {
  53648. type: 3,
  53649. text: text,
  53650. isComment: true
  53651. };
  53652. if (options.outputSourceRange) {
  53653. child.start = start;
  53654. child.end = end;
  53655. }
  53656. currentParent.children.push(child);
  53657. }
  53658. }
  53659. });
  53660. return root
  53661. }
  53662. function processPre (el) {
  53663. if (getAndRemoveAttr(el, 'v-pre') != null) {
  53664. el.pre = true;
  53665. }
  53666. }
  53667. function processRawAttrs (el) {
  53668. var list = el.attrsList;
  53669. var len = list.length;
  53670. if (len) {
  53671. var attrs = el.attrs = new Array(len);
  53672. for (var i = 0; i < len; i++) {
  53673. attrs[i] = {
  53674. name: list[i].name,
  53675. value: JSON.stringify(list[i].value)
  53676. };
  53677. if (list[i].start != null) {
  53678. attrs[i].start = list[i].start;
  53679. attrs[i].end = list[i].end;
  53680. }
  53681. }
  53682. } else if (!el.pre) {
  53683. // non root node in pre blocks with no attributes
  53684. el.plain = true;
  53685. }
  53686. }
  53687. function processElement (
  53688. element,
  53689. options
  53690. ) {
  53691. processKey(element);
  53692. // determine whether this is a plain element after
  53693. // removing structural attributes
  53694. element.plain = (
  53695. !element.key &&
  53696. !element.scopedSlots &&
  53697. !element.attrsList.length
  53698. );
  53699. processRef(element);
  53700. processSlotContent(element);
  53701. processSlotOutlet(element);
  53702. processComponent(element);
  53703. for (var i = 0; i < transforms.length; i++) {
  53704. element = transforms[i](element, options) || element;
  53705. }
  53706. processAttrs(element);
  53707. return element
  53708. }
  53709. function processKey (el) {
  53710. var exp = getBindingAttr(el, 'key');
  53711. if (exp) {
  53712. {
  53713. if (el.tag === 'template') {
  53714. warn$2(
  53715. "<template> cannot be keyed. Place the key on real elements instead.",
  53716. getRawBindingAttr(el, 'key')
  53717. );
  53718. }
  53719. if (el.for) {
  53720. var iterator = el.iterator2 || el.iterator1;
  53721. var parent = el.parent;
  53722. if (iterator && iterator === exp && parent && parent.tag === 'transition-group') {
  53723. warn$2(
  53724. "Do not use v-for index as key on <transition-group> children, " +
  53725. "this is the same as not using keys.",
  53726. getRawBindingAttr(el, 'key'),
  53727. true /* tip */
  53728. );
  53729. }
  53730. }
  53731. }
  53732. el.key = exp;
  53733. }
  53734. }
  53735. function processRef (el) {
  53736. var ref = getBindingAttr(el, 'ref');
  53737. if (ref) {
  53738. el.ref = ref;
  53739. el.refInFor = checkInFor(el);
  53740. }
  53741. }
  53742. function processFor (el) {
  53743. var exp;
  53744. if ((exp = getAndRemoveAttr(el, 'v-for'))) {
  53745. var res = parseFor(exp);
  53746. if (res) {
  53747. extend(el, res);
  53748. } else {
  53749. warn$2(
  53750. ("Invalid v-for expression: " + exp),
  53751. el.rawAttrsMap['v-for']
  53752. );
  53753. }
  53754. }
  53755. }
  53756. function parseFor (exp) {
  53757. var inMatch = exp.match(forAliasRE);
  53758. if (!inMatch) { return }
  53759. var res = {};
  53760. res.for = inMatch[2].trim();
  53761. var alias = inMatch[1].trim().replace(stripParensRE, '');
  53762. var iteratorMatch = alias.match(forIteratorRE);
  53763. if (iteratorMatch) {
  53764. res.alias = alias.replace(forIteratorRE, '').trim();
  53765. res.iterator1 = iteratorMatch[1].trim();
  53766. if (iteratorMatch[2]) {
  53767. res.iterator2 = iteratorMatch[2].trim();
  53768. }
  53769. } else {
  53770. res.alias = alias;
  53771. }
  53772. return res
  53773. }
  53774. function processIf (el) {
  53775. var exp = getAndRemoveAttr(el, 'v-if');
  53776. if (exp) {
  53777. el.if = exp;
  53778. addIfCondition(el, {
  53779. exp: exp,
  53780. block: el
  53781. });
  53782. } else {
  53783. if (getAndRemoveAttr(el, 'v-else') != null) {
  53784. el.else = true;
  53785. }
  53786. var elseif = getAndRemoveAttr(el, 'v-else-if');
  53787. if (elseif) {
  53788. el.elseif = elseif;
  53789. }
  53790. }
  53791. }
  53792. function processIfConditions (el, parent) {
  53793. var prev = findPrevElement(parent.children);
  53794. if (prev && prev.if) {
  53795. addIfCondition(prev, {
  53796. exp: el.elseif,
  53797. block: el
  53798. });
  53799. } else {
  53800. warn$2(
  53801. "v-" + (el.elseif ? ('else-if="' + el.elseif + '"') : 'else') + " " +
  53802. "used on element <" + (el.tag) + "> without corresponding v-if.",
  53803. el.rawAttrsMap[el.elseif ? 'v-else-if' : 'v-else']
  53804. );
  53805. }
  53806. }
  53807. function findPrevElement (children) {
  53808. var i = children.length;
  53809. while (i--) {
  53810. if (children[i].type === 1) {
  53811. return children[i]
  53812. } else {
  53813. if (children[i].text !== ' ') {
  53814. warn$2(
  53815. "text \"" + (children[i].text.trim()) + "\" between v-if and v-else(-if) " +
  53816. "will be ignored.",
  53817. children[i]
  53818. );
  53819. }
  53820. children.pop();
  53821. }
  53822. }
  53823. }
  53824. function addIfCondition (el, condition) {
  53825. if (!el.ifConditions) {
  53826. el.ifConditions = [];
  53827. }
  53828. el.ifConditions.push(condition);
  53829. }
  53830. function processOnce (el) {
  53831. var once$$1 = getAndRemoveAttr(el, 'v-once');
  53832. if (once$$1 != null) {
  53833. el.once = true;
  53834. }
  53835. }
  53836. // handle content being passed to a component as slot,
  53837. // e.g. <template slot="xxx">, <div slot-scope="xxx">
  53838. function processSlotContent (el) {
  53839. var slotScope;
  53840. if (el.tag === 'template') {
  53841. slotScope = getAndRemoveAttr(el, 'scope');
  53842. /* istanbul ignore if */
  53843. if (slotScope) {
  53844. warn$2(
  53845. "the \"scope\" attribute for scoped slots have been deprecated and " +
  53846. "replaced by \"slot-scope\" since 2.5. The new \"slot-scope\" attribute " +
  53847. "can also be used on plain elements in addition to <template> to " +
  53848. "denote scoped slots.",
  53849. el.rawAttrsMap['scope'],
  53850. true
  53851. );
  53852. }
  53853. el.slotScope = slotScope || getAndRemoveAttr(el, 'slot-scope');
  53854. } else if ((slotScope = getAndRemoveAttr(el, 'slot-scope'))) {
  53855. /* istanbul ignore if */
  53856. if (el.attrsMap['v-for']) {
  53857. warn$2(
  53858. "Ambiguous combined usage of slot-scope and v-for on <" + (el.tag) + "> " +
  53859. "(v-for takes higher priority). Use a wrapper <template> for the " +
  53860. "scoped slot to make it clearer.",
  53861. el.rawAttrsMap['slot-scope'],
  53862. true
  53863. );
  53864. }
  53865. el.slotScope = slotScope;
  53866. }
  53867. // slot="xxx"
  53868. var slotTarget = getBindingAttr(el, 'slot');
  53869. if (slotTarget) {
  53870. el.slotTarget = slotTarget === '""' ? '"default"' : slotTarget;
  53871. el.slotTargetDynamic = !!(el.attrsMap[':slot'] || el.attrsMap['v-bind:slot']);
  53872. // preserve slot as an attribute for native shadow DOM compat
  53873. // only for non-scoped slots.
  53874. if (el.tag !== 'template' && !el.slotScope) {
  53875. addAttr(el, 'slot', slotTarget, getRawBindingAttr(el, 'slot'));
  53876. }
  53877. }
  53878. // 2.6 v-slot syntax
  53879. {
  53880. if (el.tag === 'template') {
  53881. // v-slot on <template>
  53882. var slotBinding = getAndRemoveAttrByRegex(el, slotRE);
  53883. if (slotBinding) {
  53884. {
  53885. if (el.slotTarget || el.slotScope) {
  53886. warn$2(
  53887. "Unexpected mixed usage of different slot syntaxes.",
  53888. el
  53889. );
  53890. }
  53891. if (el.parent && !maybeComponent(el.parent)) {
  53892. warn$2(
  53893. "<template v-slot> can only appear at the root level inside " +
  53894. "the receiving component",
  53895. el
  53896. );
  53897. }
  53898. }
  53899. var ref = getSlotName(slotBinding);
  53900. var name = ref.name;
  53901. var dynamic = ref.dynamic;
  53902. el.slotTarget = name;
  53903. el.slotTargetDynamic = dynamic;
  53904. el.slotScope = slotBinding.value || emptySlotScopeToken; // force it into a scoped slot for perf
  53905. }
  53906. } else {
  53907. // v-slot on component, denotes default slot
  53908. var slotBinding$1 = getAndRemoveAttrByRegex(el, slotRE);
  53909. if (slotBinding$1) {
  53910. {
  53911. if (!maybeComponent(el)) {
  53912. warn$2(
  53913. "v-slot can only be used on components or <template>.",
  53914. slotBinding$1
  53915. );
  53916. }
  53917. if (el.slotScope || el.slotTarget) {
  53918. warn$2(
  53919. "Unexpected mixed usage of different slot syntaxes.",
  53920. el
  53921. );
  53922. }
  53923. if (el.scopedSlots) {
  53924. warn$2(
  53925. "To avoid scope ambiguity, the default slot should also use " +
  53926. "<template> syntax when there are other named slots.",
  53927. slotBinding$1
  53928. );
  53929. }
  53930. }
  53931. // add the component's children to its default slot
  53932. var slots = el.scopedSlots || (el.scopedSlots = {});
  53933. var ref$1 = getSlotName(slotBinding$1);
  53934. var name$1 = ref$1.name;
  53935. var dynamic$1 = ref$1.dynamic;
  53936. var slotContainer = slots[name$1] = createASTElement('template', [], el);
  53937. slotContainer.slotTarget = name$1;
  53938. slotContainer.slotTargetDynamic = dynamic$1;
  53939. slotContainer.children = el.children.filter(function (c) {
  53940. if (!c.slotScope) {
  53941. c.parent = slotContainer;
  53942. return true
  53943. }
  53944. });
  53945. slotContainer.slotScope = slotBinding$1.value || emptySlotScopeToken;
  53946. // remove children as they are returned from scopedSlots now
  53947. el.children = [];
  53948. // mark el non-plain so data gets generated
  53949. el.plain = false;
  53950. }
  53951. }
  53952. }
  53953. }
  53954. function getSlotName (binding) {
  53955. var name = binding.name.replace(slotRE, '');
  53956. if (!name) {
  53957. if (binding.name[0] !== '#') {
  53958. name = 'default';
  53959. } else {
  53960. warn$2(
  53961. "v-slot shorthand syntax requires a slot name.",
  53962. binding
  53963. );
  53964. }
  53965. }
  53966. return dynamicArgRE.test(name)
  53967. // dynamic [name]
  53968. ? { name: name.slice(1, -1), dynamic: true }
  53969. // static name
  53970. : { name: ("\"" + name + "\""), dynamic: false }
  53971. }
  53972. // handle <slot/> outlets
  53973. function processSlotOutlet (el) {
  53974. if (el.tag === 'slot') {
  53975. el.slotName = getBindingAttr(el, 'name');
  53976. if (el.key) {
  53977. warn$2(
  53978. "`key` does not work on <slot> because slots are abstract outlets " +
  53979. "and can possibly expand into multiple elements. " +
  53980. "Use the key on a wrapping element instead.",
  53981. getRawBindingAttr(el, 'key')
  53982. );
  53983. }
  53984. }
  53985. }
  53986. function processComponent (el) {
  53987. var binding;
  53988. if ((binding = getBindingAttr(el, 'is'))) {
  53989. el.component = binding;
  53990. }
  53991. if (getAndRemoveAttr(el, 'inline-template') != null) {
  53992. el.inlineTemplate = true;
  53993. }
  53994. }
  53995. function processAttrs (el) {
  53996. var list = el.attrsList;
  53997. var i, l, name, rawName, value, modifiers, syncGen, isDynamic;
  53998. for (i = 0, l = list.length; i < l; i++) {
  53999. name = rawName = list[i].name;
  54000. value = list[i].value;
  54001. if (dirRE.test(name)) {
  54002. // mark element as dynamic
  54003. el.hasBindings = true;
  54004. // modifiers
  54005. modifiers = parseModifiers(name.replace(dirRE, ''));
  54006. // support .foo shorthand syntax for the .prop modifier
  54007. if (modifiers) {
  54008. name = name.replace(modifierRE, '');
  54009. }
  54010. if (bindRE.test(name)) { // v-bind
  54011. name = name.replace(bindRE, '');
  54012. value = parseFilters(value);
  54013. isDynamic = dynamicArgRE.test(name);
  54014. if (isDynamic) {
  54015. name = name.slice(1, -1);
  54016. }
  54017. if (
  54018. value.trim().length === 0
  54019. ) {
  54020. warn$2(
  54021. ("The value for a v-bind expression cannot be empty. Found in \"v-bind:" + name + "\"")
  54022. );
  54023. }
  54024. if (modifiers) {
  54025. if (modifiers.prop && !isDynamic) {
  54026. name = camelize(name);
  54027. if (name === 'innerHtml') { name = 'innerHTML'; }
  54028. }
  54029. if (modifiers.camel && !isDynamic) {
  54030. name = camelize(name);
  54031. }
  54032. if (modifiers.sync) {
  54033. syncGen = genAssignmentCode(value, "$event");
  54034. if (!isDynamic) {
  54035. addHandler(
  54036. el,
  54037. ("update:" + (camelize(name))),
  54038. syncGen,
  54039. null,
  54040. false,
  54041. warn$2,
  54042. list[i]
  54043. );
  54044. if (hyphenate(name) !== camelize(name)) {
  54045. addHandler(
  54046. el,
  54047. ("update:" + (hyphenate(name))),
  54048. syncGen,
  54049. null,
  54050. false,
  54051. warn$2,
  54052. list[i]
  54053. );
  54054. }
  54055. } else {
  54056. // handler w/ dynamic event name
  54057. addHandler(
  54058. el,
  54059. ("\"update:\"+(" + name + ")"),
  54060. syncGen,
  54061. null,
  54062. false,
  54063. warn$2,
  54064. list[i],
  54065. true // dynamic
  54066. );
  54067. }
  54068. }
  54069. }
  54070. if ((modifiers && modifiers.prop) || (
  54071. !el.component && platformMustUseProp(el.tag, el.attrsMap.type, name)
  54072. )) {
  54073. addProp(el, name, value, list[i], isDynamic);
  54074. } else {
  54075. addAttr(el, name, value, list[i], isDynamic);
  54076. }
  54077. } else if (onRE.test(name)) { // v-on
  54078. name = name.replace(onRE, '');
  54079. isDynamic = dynamicArgRE.test(name);
  54080. if (isDynamic) {
  54081. name = name.slice(1, -1);
  54082. }
  54083. addHandler(el, name, value, modifiers, false, warn$2, list[i], isDynamic);
  54084. } else { // normal directives
  54085. name = name.replace(dirRE, '');
  54086. // parse arg
  54087. var argMatch = name.match(argRE);
  54088. var arg = argMatch && argMatch[1];
  54089. isDynamic = false;
  54090. if (arg) {
  54091. name = name.slice(0, -(arg.length + 1));
  54092. if (dynamicArgRE.test(arg)) {
  54093. arg = arg.slice(1, -1);
  54094. isDynamic = true;
  54095. }
  54096. }
  54097. addDirective(el, name, rawName, value, arg, isDynamic, modifiers, list[i]);
  54098. if (name === 'model') {
  54099. checkForAliasModel(el, value);
  54100. }
  54101. }
  54102. } else {
  54103. // literal attribute
  54104. {
  54105. var res = parseText(value, delimiters);
  54106. if (res) {
  54107. warn$2(
  54108. name + "=\"" + value + "\": " +
  54109. 'Interpolation inside attributes has been removed. ' +
  54110. 'Use v-bind or the colon shorthand instead. For example, ' +
  54111. 'instead of <div id="{{ val }}">, use <div :id="val">.',
  54112. list[i]
  54113. );
  54114. }
  54115. }
  54116. addAttr(el, name, JSON.stringify(value), list[i]);
  54117. // #6887 firefox doesn't update muted state if set via attribute
  54118. // even immediately after element creation
  54119. if (!el.component &&
  54120. name === 'muted' &&
  54121. platformMustUseProp(el.tag, el.attrsMap.type, name)) {
  54122. addProp(el, name, 'true', list[i]);
  54123. }
  54124. }
  54125. }
  54126. }
  54127. function checkInFor (el) {
  54128. var parent = el;
  54129. while (parent) {
  54130. if (parent.for !== undefined) {
  54131. return true
  54132. }
  54133. parent = parent.parent;
  54134. }
  54135. return false
  54136. }
  54137. function parseModifiers (name) {
  54138. var match = name.match(modifierRE);
  54139. if (match) {
  54140. var ret = {};
  54141. match.forEach(function (m) { ret[m.slice(1)] = true; });
  54142. return ret
  54143. }
  54144. }
  54145. function makeAttrsMap (attrs) {
  54146. var map = {};
  54147. for (var i = 0, l = attrs.length; i < l; i++) {
  54148. if (
  54149. map[attrs[i].name] && !isIE && !isEdge
  54150. ) {
  54151. warn$2('duplicate attribute: ' + attrs[i].name, attrs[i]);
  54152. }
  54153. map[attrs[i].name] = attrs[i].value;
  54154. }
  54155. return map
  54156. }
  54157. // for script (e.g. type="x/template") or style, do not decode content
  54158. function isTextTag (el) {
  54159. return el.tag === 'script' || el.tag === 'style'
  54160. }
  54161. function isForbiddenTag (el) {
  54162. return (
  54163. el.tag === 'style' ||
  54164. (el.tag === 'script' && (
  54165. !el.attrsMap.type ||
  54166. el.attrsMap.type === 'text/javascript'
  54167. ))
  54168. )
  54169. }
  54170. var ieNSBug = /^xmlns:NS\d+/;
  54171. var ieNSPrefix = /^NS\d+:/;
  54172. /* istanbul ignore next */
  54173. function guardIESVGBug (attrs) {
  54174. var res = [];
  54175. for (var i = 0; i < attrs.length; i++) {
  54176. var attr = attrs[i];
  54177. if (!ieNSBug.test(attr.name)) {
  54178. attr.name = attr.name.replace(ieNSPrefix, '');
  54179. res.push(attr);
  54180. }
  54181. }
  54182. return res
  54183. }
  54184. function checkForAliasModel (el, value) {
  54185. var _el = el;
  54186. while (_el) {
  54187. if (_el.for && _el.alias === value) {
  54188. warn$2(
  54189. "<" + (el.tag) + " v-model=\"" + value + "\">: " +
  54190. "You are binding v-model directly to a v-for iteration alias. " +
  54191. "This will not be able to modify the v-for source array because " +
  54192. "writing to the alias is like modifying a function local variable. " +
  54193. "Consider using an array of objects and use v-model on an object property instead.",
  54194. el.rawAttrsMap['v-model']
  54195. );
  54196. }
  54197. _el = _el.parent;
  54198. }
  54199. }
  54200. /* */
  54201. function preTransformNode (el, options) {
  54202. if (el.tag === 'input') {
  54203. var map = el.attrsMap;
  54204. if (!map['v-model']) {
  54205. return
  54206. }
  54207. var typeBinding;
  54208. if (map[':type'] || map['v-bind:type']) {
  54209. typeBinding = getBindingAttr(el, 'type');
  54210. }
  54211. if (!map.type && !typeBinding && map['v-bind']) {
  54212. typeBinding = "(" + (map['v-bind']) + ").type";
  54213. }
  54214. if (typeBinding) {
  54215. var ifCondition = getAndRemoveAttr(el, 'v-if', true);
  54216. var ifConditionExtra = ifCondition ? ("&&(" + ifCondition + ")") : "";
  54217. var hasElse = getAndRemoveAttr(el, 'v-else', true) != null;
  54218. var elseIfCondition = getAndRemoveAttr(el, 'v-else-if', true);
  54219. // 1. checkbox
  54220. var branch0 = cloneASTElement(el);
  54221. // process for on the main node
  54222. processFor(branch0);
  54223. addRawAttr(branch0, 'type', 'checkbox');
  54224. processElement(branch0, options);
  54225. branch0.processed = true; // prevent it from double-processed
  54226. branch0.if = "(" + typeBinding + ")==='checkbox'" + ifConditionExtra;
  54227. addIfCondition(branch0, {
  54228. exp: branch0.if,
  54229. block: branch0
  54230. });
  54231. // 2. add radio else-if condition
  54232. var branch1 = cloneASTElement(el);
  54233. getAndRemoveAttr(branch1, 'v-for', true);
  54234. addRawAttr(branch1, 'type', 'radio');
  54235. processElement(branch1, options);
  54236. addIfCondition(branch0, {
  54237. exp: "(" + typeBinding + ")==='radio'" + ifConditionExtra,
  54238. block: branch1
  54239. });
  54240. // 3. other
  54241. var branch2 = cloneASTElement(el);
  54242. getAndRemoveAttr(branch2, 'v-for', true);
  54243. addRawAttr(branch2, ':type', typeBinding);
  54244. processElement(branch2, options);
  54245. addIfCondition(branch0, {
  54246. exp: ifCondition,
  54247. block: branch2
  54248. });
  54249. if (hasElse) {
  54250. branch0.else = true;
  54251. } else if (elseIfCondition) {
  54252. branch0.elseif = elseIfCondition;
  54253. }
  54254. return branch0
  54255. }
  54256. }
  54257. }
  54258. function cloneASTElement (el) {
  54259. return createASTElement(el.tag, el.attrsList.slice(), el.parent)
  54260. }
  54261. var model$1 = {
  54262. preTransformNode: preTransformNode
  54263. };
  54264. var modules$1 = [
  54265. klass$1,
  54266. style$1,
  54267. model$1
  54268. ];
  54269. /* */
  54270. function text (el, dir) {
  54271. if (dir.value) {
  54272. addProp(el, 'textContent', ("_s(" + (dir.value) + ")"), dir);
  54273. }
  54274. }
  54275. /* */
  54276. function html (el, dir) {
  54277. if (dir.value) {
  54278. addProp(el, 'innerHTML', ("_s(" + (dir.value) + ")"), dir);
  54279. }
  54280. }
  54281. var directives$1 = {
  54282. model: model,
  54283. text: text,
  54284. html: html
  54285. };
  54286. /* */
  54287. var baseOptions = {
  54288. expectHTML: true,
  54289. modules: modules$1,
  54290. directives: directives$1,
  54291. isPreTag: isPreTag,
  54292. isUnaryTag: isUnaryTag,
  54293. mustUseProp: mustUseProp,
  54294. canBeLeftOpenTag: canBeLeftOpenTag,
  54295. isReservedTag: isReservedTag,
  54296. getTagNamespace: getTagNamespace,
  54297. staticKeys: genStaticKeys(modules$1)
  54298. };
  54299. /* */
  54300. var isStaticKey;
  54301. var isPlatformReservedTag;
  54302. var genStaticKeysCached = cached(genStaticKeys$1);
  54303. /**
  54304. * Goal of the optimizer: walk the generated template AST tree
  54305. * and detect sub-trees that are purely static, i.e. parts of
  54306. * the DOM that never needs to change.
  54307. *
  54308. * Once we detect these sub-trees, we can:
  54309. *
  54310. * 1. Hoist them into constants, so that we no longer need to
  54311. * create fresh nodes for them on each re-render;
  54312. * 2. Completely skip them in the patching process.
  54313. */
  54314. function optimize (root, options) {
  54315. if (!root) { return }
  54316. isStaticKey = genStaticKeysCached(options.staticKeys || '');
  54317. isPlatformReservedTag = options.isReservedTag || no;
  54318. // first pass: mark all non-static nodes.
  54319. markStatic$1(root);
  54320. // second pass: mark static roots.
  54321. markStaticRoots(root, false);
  54322. }
  54323. function genStaticKeys$1 (keys) {
  54324. return makeMap(
  54325. 'type,tag,attrsList,attrsMap,plain,parent,children,attrs,start,end,rawAttrsMap' +
  54326. (keys ? ',' + keys : '')
  54327. )
  54328. }
  54329. function markStatic$1 (node) {
  54330. node.static = isStatic(node);
  54331. if (node.type === 1) {
  54332. // do not make component slot content static. this avoids
  54333. // 1. components not able to mutate slot nodes
  54334. // 2. static slot content fails for hot-reloading
  54335. if (
  54336. !isPlatformReservedTag(node.tag) &&
  54337. node.tag !== 'slot' &&
  54338. node.attrsMap['inline-template'] == null
  54339. ) {
  54340. return
  54341. }
  54342. for (var i = 0, l = node.children.length; i < l; i++) {
  54343. var child = node.children[i];
  54344. markStatic$1(child);
  54345. if (!child.static) {
  54346. node.static = false;
  54347. }
  54348. }
  54349. if (node.ifConditions) {
  54350. for (var i$1 = 1, l$1 = node.ifConditions.length; i$1 < l$1; i$1++) {
  54351. var block = node.ifConditions[i$1].block;
  54352. markStatic$1(block);
  54353. if (!block.static) {
  54354. node.static = false;
  54355. }
  54356. }
  54357. }
  54358. }
  54359. }
  54360. function markStaticRoots (node, isInFor) {
  54361. if (node.type === 1) {
  54362. if (node.static || node.once) {
  54363. node.staticInFor = isInFor;
  54364. }
  54365. // For a node to qualify as a static root, it should have children that
  54366. // are not just static text. Otherwise the cost of hoisting out will
  54367. // outweigh the benefits and it's better off to just always render it fresh.
  54368. if (node.static && node.children.length && !(
  54369. node.children.length === 1 &&
  54370. node.children[0].type === 3
  54371. )) {
  54372. node.staticRoot = true;
  54373. return
  54374. } else {
  54375. node.staticRoot = false;
  54376. }
  54377. if (node.children) {
  54378. for (var i = 0, l = node.children.length; i < l; i++) {
  54379. markStaticRoots(node.children[i], isInFor || !!node.for);
  54380. }
  54381. }
  54382. if (node.ifConditions) {
  54383. for (var i$1 = 1, l$1 = node.ifConditions.length; i$1 < l$1; i$1++) {
  54384. markStaticRoots(node.ifConditions[i$1].block, isInFor);
  54385. }
  54386. }
  54387. }
  54388. }
  54389. function isStatic (node) {
  54390. if (node.type === 2) { // expression
  54391. return false
  54392. }
  54393. if (node.type === 3) { // text
  54394. return true
  54395. }
  54396. return !!(node.pre || (
  54397. !node.hasBindings && // no dynamic bindings
  54398. !node.if && !node.for && // not v-if or v-for or v-else
  54399. !isBuiltInTag(node.tag) && // not a built-in
  54400. isPlatformReservedTag(node.tag) && // not a component
  54401. !isDirectChildOfTemplateFor(node) &&
  54402. Object.keys(node).every(isStaticKey)
  54403. ))
  54404. }
  54405. function isDirectChildOfTemplateFor (node) {
  54406. while (node.parent) {
  54407. node = node.parent;
  54408. if (node.tag !== 'template') {
  54409. return false
  54410. }
  54411. if (node.for) {
  54412. return true
  54413. }
  54414. }
  54415. return false
  54416. }
  54417. /* */
  54418. var fnExpRE = /^([\w$_]+|\([^)]*?\))\s*=>|^function(?:\s+[\w$]+)?\s*\(/;
  54419. var fnInvokeRE = /\([^)]*?\);*$/;
  54420. var simplePathRE = /^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*|\['[^']*?']|\["[^"]*?"]|\[\d+]|\[[A-Za-z_$][\w$]*])*$/;
  54421. // KeyboardEvent.keyCode aliases
  54422. var keyCodes = {
  54423. esc: 27,
  54424. tab: 9,
  54425. enter: 13,
  54426. space: 32,
  54427. up: 38,
  54428. left: 37,
  54429. right: 39,
  54430. down: 40,
  54431. 'delete': [8, 46]
  54432. };
  54433. // KeyboardEvent.key aliases
  54434. var keyNames = {
  54435. // #7880: IE11 and Edge use `Esc` for Escape key name.
  54436. esc: ['Esc', 'Escape'],
  54437. tab: 'Tab',
  54438. enter: 'Enter',
  54439. // #9112: IE11 uses `Spacebar` for Space key name.
  54440. space: [' ', 'Spacebar'],
  54441. // #7806: IE11 uses key names without `Arrow` prefix for arrow keys.
  54442. up: ['Up', 'ArrowUp'],
  54443. left: ['Left', 'ArrowLeft'],
  54444. right: ['Right', 'ArrowRight'],
  54445. down: ['Down', 'ArrowDown'],
  54446. // #9112: IE11 uses `Del` for Delete key name.
  54447. 'delete': ['Backspace', 'Delete', 'Del']
  54448. };
  54449. // #4868: modifiers that prevent the execution of the listener
  54450. // need to explicitly return null so that we can determine whether to remove
  54451. // the listener for .once
  54452. var genGuard = function (condition) { return ("if(" + condition + ")return null;"); };
  54453. var modifierCode = {
  54454. stop: '$event.stopPropagation();',
  54455. prevent: '$event.preventDefault();',
  54456. self: genGuard("$event.target !== $event.currentTarget"),
  54457. ctrl: genGuard("!$event.ctrlKey"),
  54458. shift: genGuard("!$event.shiftKey"),
  54459. alt: genGuard("!$event.altKey"),
  54460. meta: genGuard("!$event.metaKey"),
  54461. left: genGuard("'button' in $event && $event.button !== 0"),
  54462. middle: genGuard("'button' in $event && $event.button !== 1"),
  54463. right: genGuard("'button' in $event && $event.button !== 2")
  54464. };
  54465. function genHandlers (
  54466. events,
  54467. isNative
  54468. ) {
  54469. var prefix = isNative ? 'nativeOn:' : 'on:';
  54470. var staticHandlers = "";
  54471. var dynamicHandlers = "";
  54472. for (var name in events) {
  54473. var handlerCode = genHandler(events[name]);
  54474. if (events[name] && events[name].dynamic) {
  54475. dynamicHandlers += name + "," + handlerCode + ",";
  54476. } else {
  54477. staticHandlers += "\"" + name + "\":" + handlerCode + ",";
  54478. }
  54479. }
  54480. staticHandlers = "{" + (staticHandlers.slice(0, -1)) + "}";
  54481. if (dynamicHandlers) {
  54482. return prefix + "_d(" + staticHandlers + ",[" + (dynamicHandlers.slice(0, -1)) + "])"
  54483. } else {
  54484. return prefix + staticHandlers
  54485. }
  54486. }
  54487. function genHandler (handler) {
  54488. if (!handler) {
  54489. return 'function(){}'
  54490. }
  54491. if (Array.isArray(handler)) {
  54492. return ("[" + (handler.map(function (handler) { return genHandler(handler); }).join(',')) + "]")
  54493. }
  54494. var isMethodPath = simplePathRE.test(handler.value);
  54495. var isFunctionExpression = fnExpRE.test(handler.value);
  54496. var isFunctionInvocation = simplePathRE.test(handler.value.replace(fnInvokeRE, ''));
  54497. if (!handler.modifiers) {
  54498. if (isMethodPath || isFunctionExpression) {
  54499. return handler.value
  54500. }
  54501. return ("function($event){" + (isFunctionInvocation ? ("return " + (handler.value)) : handler.value) + "}") // inline statement
  54502. } else {
  54503. var code = '';
  54504. var genModifierCode = '';
  54505. var keys = [];
  54506. for (var key in handler.modifiers) {
  54507. if (modifierCode[key]) {
  54508. genModifierCode += modifierCode[key];
  54509. // left/right
  54510. if (keyCodes[key]) {
  54511. keys.push(key);
  54512. }
  54513. } else if (key === 'exact') {
  54514. var modifiers = (handler.modifiers);
  54515. genModifierCode += genGuard(
  54516. ['ctrl', 'shift', 'alt', 'meta']
  54517. .filter(function (keyModifier) { return !modifiers[keyModifier]; })
  54518. .map(function (keyModifier) { return ("$event." + keyModifier + "Key"); })
  54519. .join('||')
  54520. );
  54521. } else {
  54522. keys.push(key);
  54523. }
  54524. }
  54525. if (keys.length) {
  54526. code += genKeyFilter(keys);
  54527. }
  54528. // Make sure modifiers like prevent and stop get executed after key filtering
  54529. if (genModifierCode) {
  54530. code += genModifierCode;
  54531. }
  54532. var handlerCode = isMethodPath
  54533. ? ("return " + (handler.value) + "($event)")
  54534. : isFunctionExpression
  54535. ? ("return (" + (handler.value) + ")($event)")
  54536. : isFunctionInvocation
  54537. ? ("return " + (handler.value))
  54538. : handler.value;
  54539. return ("function($event){" + code + handlerCode + "}")
  54540. }
  54541. }
  54542. function genKeyFilter (keys) {
  54543. return (
  54544. // make sure the key filters only apply to KeyboardEvents
  54545. // #9441: can't use 'keyCode' in $event because Chrome autofill fires fake
  54546. // key events that do not have keyCode property...
  54547. "if(!$event.type.indexOf('key')&&" +
  54548. (keys.map(genFilterCode).join('&&')) + ")return null;"
  54549. )
  54550. }
  54551. function genFilterCode (key) {
  54552. var keyVal = parseInt(key, 10);
  54553. if (keyVal) {
  54554. return ("$event.keyCode!==" + keyVal)
  54555. }
  54556. var keyCode = keyCodes[key];
  54557. var keyName = keyNames[key];
  54558. return (
  54559. "_k($event.keyCode," +
  54560. (JSON.stringify(key)) + "," +
  54561. (JSON.stringify(keyCode)) + "," +
  54562. "$event.key," +
  54563. "" + (JSON.stringify(keyName)) +
  54564. ")"
  54565. )
  54566. }
  54567. /* */
  54568. function on (el, dir) {
  54569. if (dir.modifiers) {
  54570. warn("v-on without argument does not support modifiers.");
  54571. }
  54572. el.wrapListeners = function (code) { return ("_g(" + code + "," + (dir.value) + ")"); };
  54573. }
  54574. /* */
  54575. function bind$1 (el, dir) {
  54576. el.wrapData = function (code) {
  54577. return ("_b(" + code + ",'" + (el.tag) + "'," + (dir.value) + "," + (dir.modifiers && dir.modifiers.prop ? 'true' : 'false') + (dir.modifiers && dir.modifiers.sync ? ',true' : '') + ")")
  54578. };
  54579. }
  54580. /* */
  54581. var baseDirectives = {
  54582. on: on,
  54583. bind: bind$1,
  54584. cloak: noop
  54585. };
  54586. /* */
  54587. var CodegenState = function CodegenState (options) {
  54588. this.options = options;
  54589. this.warn = options.warn || baseWarn;
  54590. this.transforms = pluckModuleFunction(options.modules, 'transformCode');
  54591. this.dataGenFns = pluckModuleFunction(options.modules, 'genData');
  54592. this.directives = extend(extend({}, baseDirectives), options.directives);
  54593. var isReservedTag = options.isReservedTag || no;
  54594. this.maybeComponent = function (el) { return !!el.component || !isReservedTag(el.tag); };
  54595. this.onceId = 0;
  54596. this.staticRenderFns = [];
  54597. this.pre = false;
  54598. };
  54599. function generate (
  54600. ast,
  54601. options
  54602. ) {
  54603. var state = new CodegenState(options);
  54604. var code = ast ? genElement(ast, state) : '_c("div")';
  54605. return {
  54606. render: ("with(this){return " + code + "}"),
  54607. staticRenderFns: state.staticRenderFns
  54608. }
  54609. }
  54610. function genElement (el, state) {
  54611. if (el.parent) {
  54612. el.pre = el.pre || el.parent.pre;
  54613. }
  54614. if (el.staticRoot && !el.staticProcessed) {
  54615. return genStatic(el, state)
  54616. } else if (el.once && !el.onceProcessed) {
  54617. return genOnce(el, state)
  54618. } else if (el.for && !el.forProcessed) {
  54619. return genFor(el, state)
  54620. } else if (el.if && !el.ifProcessed) {
  54621. return genIf(el, state)
  54622. } else if (el.tag === 'template' && !el.slotTarget && !state.pre) {
  54623. return genChildren(el, state) || 'void 0'
  54624. } else if (el.tag === 'slot') {
  54625. return genSlot(el, state)
  54626. } else {
  54627. // component or element
  54628. var code;
  54629. if (el.component) {
  54630. code = genComponent(el.component, el, state);
  54631. } else {
  54632. var data;
  54633. if (!el.plain || (el.pre && state.maybeComponent(el))) {
  54634. data = genData$2(el, state);
  54635. }
  54636. var children = el.inlineTemplate ? null : genChildren(el, state, true);
  54637. code = "_c('" + (el.tag) + "'" + (data ? ("," + data) : '') + (children ? ("," + children) : '') + ")";
  54638. }
  54639. // module transforms
  54640. for (var i = 0; i < state.transforms.length; i++) {
  54641. code = state.transforms[i](el, code);
  54642. }
  54643. return code
  54644. }
  54645. }
  54646. // hoist static sub-trees out
  54647. function genStatic (el, state) {
  54648. el.staticProcessed = true;
  54649. // Some elements (templates) need to behave differently inside of a v-pre
  54650. // node. All pre nodes are static roots, so we can use this as a location to
  54651. // wrap a state change and reset it upon exiting the pre node.
  54652. var originalPreState = state.pre;
  54653. if (el.pre) {
  54654. state.pre = el.pre;
  54655. }
  54656. state.staticRenderFns.push(("with(this){return " + (genElement(el, state)) + "}"));
  54657. state.pre = originalPreState;
  54658. return ("_m(" + (state.staticRenderFns.length - 1) + (el.staticInFor ? ',true' : '') + ")")
  54659. }
  54660. // v-once
  54661. function genOnce (el, state) {
  54662. el.onceProcessed = true;
  54663. if (el.if && !el.ifProcessed) {
  54664. return genIf(el, state)
  54665. } else if (el.staticInFor) {
  54666. var key = '';
  54667. var parent = el.parent;
  54668. while (parent) {
  54669. if (parent.for) {
  54670. key = parent.key;
  54671. break
  54672. }
  54673. parent = parent.parent;
  54674. }
  54675. if (!key) {
  54676. state.warn(
  54677. "v-once can only be used inside v-for that is keyed. ",
  54678. el.rawAttrsMap['v-once']
  54679. );
  54680. return genElement(el, state)
  54681. }
  54682. return ("_o(" + (genElement(el, state)) + "," + (state.onceId++) + "," + key + ")")
  54683. } else {
  54684. return genStatic(el, state)
  54685. }
  54686. }
  54687. function genIf (
  54688. el,
  54689. state,
  54690. altGen,
  54691. altEmpty
  54692. ) {
  54693. el.ifProcessed = true; // avoid recursion
  54694. return genIfConditions(el.ifConditions.slice(), state, altGen, altEmpty)
  54695. }
  54696. function genIfConditions (
  54697. conditions,
  54698. state,
  54699. altGen,
  54700. altEmpty
  54701. ) {
  54702. if (!conditions.length) {
  54703. return altEmpty || '_e()'
  54704. }
  54705. var condition = conditions.shift();
  54706. if (condition.exp) {
  54707. return ("(" + (condition.exp) + ")?" + (genTernaryExp(condition.block)) + ":" + (genIfConditions(conditions, state, altGen, altEmpty)))
  54708. } else {
  54709. return ("" + (genTernaryExp(condition.block)))
  54710. }
  54711. // v-if with v-once should generate code like (a)?_m(0):_m(1)
  54712. function genTernaryExp (el) {
  54713. return altGen
  54714. ? altGen(el, state)
  54715. : el.once
  54716. ? genOnce(el, state)
  54717. : genElement(el, state)
  54718. }
  54719. }
  54720. function genFor (
  54721. el,
  54722. state,
  54723. altGen,
  54724. altHelper
  54725. ) {
  54726. var exp = el.for;
  54727. var alias = el.alias;
  54728. var iterator1 = el.iterator1 ? ("," + (el.iterator1)) : '';
  54729. var iterator2 = el.iterator2 ? ("," + (el.iterator2)) : '';
  54730. if (state.maybeComponent(el) &&
  54731. el.tag !== 'slot' &&
  54732. el.tag !== 'template' &&
  54733. !el.key
  54734. ) {
  54735. state.warn(
  54736. "<" + (el.tag) + " v-for=\"" + alias + " in " + exp + "\">: component lists rendered with " +
  54737. "v-for should have explicit keys. " +
  54738. "See https://vuejs.org/guide/list.html#key for more info.",
  54739. el.rawAttrsMap['v-for'],
  54740. true /* tip */
  54741. );
  54742. }
  54743. el.forProcessed = true; // avoid recursion
  54744. return (altHelper || '_l') + "((" + exp + ")," +
  54745. "function(" + alias + iterator1 + iterator2 + "){" +
  54746. "return " + ((altGen || genElement)(el, state)) +
  54747. '})'
  54748. }
  54749. function genData$2 (el, state) {
  54750. var data = '{';
  54751. // directives first.
  54752. // directives may mutate the el's other properties before they are generated.
  54753. var dirs = genDirectives(el, state);
  54754. if (dirs) { data += dirs + ','; }
  54755. // key
  54756. if (el.key) {
  54757. data += "key:" + (el.key) + ",";
  54758. }
  54759. // ref
  54760. if (el.ref) {
  54761. data += "ref:" + (el.ref) + ",";
  54762. }
  54763. if (el.refInFor) {
  54764. data += "refInFor:true,";
  54765. }
  54766. // pre
  54767. if (el.pre) {
  54768. data += "pre:true,";
  54769. }
  54770. // record original tag name for components using "is" attribute
  54771. if (el.component) {
  54772. data += "tag:\"" + (el.tag) + "\",";
  54773. }
  54774. // module data generation functions
  54775. for (var i = 0; i < state.dataGenFns.length; i++) {
  54776. data += state.dataGenFns[i](el);
  54777. }
  54778. // attributes
  54779. if (el.attrs) {
  54780. data += "attrs:" + (genProps(el.attrs)) + ",";
  54781. }
  54782. // DOM props
  54783. if (el.props) {
  54784. data += "domProps:" + (genProps(el.props)) + ",";
  54785. }
  54786. // event handlers
  54787. if (el.events) {
  54788. data += (genHandlers(el.events, false)) + ",";
  54789. }
  54790. if (el.nativeEvents) {
  54791. data += (genHandlers(el.nativeEvents, true)) + ",";
  54792. }
  54793. // slot target
  54794. // only for non-scoped slots
  54795. if (el.slotTarget && !el.slotScope) {
  54796. data += "slot:" + (el.slotTarget) + ",";
  54797. }
  54798. // scoped slots
  54799. if (el.scopedSlots) {
  54800. data += (genScopedSlots(el, el.scopedSlots, state)) + ",";
  54801. }
  54802. // component v-model
  54803. if (el.model) {
  54804. data += "model:{value:" + (el.model.value) + ",callback:" + (el.model.callback) + ",expression:" + (el.model.expression) + "},";
  54805. }
  54806. // inline-template
  54807. if (el.inlineTemplate) {
  54808. var inlineTemplate = genInlineTemplate(el, state);
  54809. if (inlineTemplate) {
  54810. data += inlineTemplate + ",";
  54811. }
  54812. }
  54813. data = data.replace(/,$/, '') + '}';
  54814. // v-bind dynamic argument wrap
  54815. // v-bind with dynamic arguments must be applied using the same v-bind object
  54816. // merge helper so that class/style/mustUseProp attrs are handled correctly.
  54817. if (el.dynamicAttrs) {
  54818. data = "_b(" + data + ",\"" + (el.tag) + "\"," + (genProps(el.dynamicAttrs)) + ")";
  54819. }
  54820. // v-bind data wrap
  54821. if (el.wrapData) {
  54822. data = el.wrapData(data);
  54823. }
  54824. // v-on data wrap
  54825. if (el.wrapListeners) {
  54826. data = el.wrapListeners(data);
  54827. }
  54828. return data
  54829. }
  54830. function genDirectives (el, state) {
  54831. var dirs = el.directives;
  54832. if (!dirs) { return }
  54833. var res = 'directives:[';
  54834. var hasRuntime = false;
  54835. var i, l, dir, needRuntime;
  54836. for (i = 0, l = dirs.length; i < l; i++) {
  54837. dir = dirs[i];
  54838. needRuntime = true;
  54839. var gen = state.directives[dir.name];
  54840. if (gen) {
  54841. // compile-time directive that manipulates AST.
  54842. // returns true if it also needs a runtime counterpart.
  54843. needRuntime = !!gen(el, dir, state.warn);
  54844. }
  54845. if (needRuntime) {
  54846. hasRuntime = true;
  54847. 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))) : '') + "},";
  54848. }
  54849. }
  54850. if (hasRuntime) {
  54851. return res.slice(0, -1) + ']'
  54852. }
  54853. }
  54854. function genInlineTemplate (el, state) {
  54855. var ast = el.children[0];
  54856. if (el.children.length !== 1 || ast.type !== 1) {
  54857. state.warn(
  54858. 'Inline-template components must have exactly one child element.',
  54859. { start: el.start }
  54860. );
  54861. }
  54862. if (ast && ast.type === 1) {
  54863. var inlineRenderFns = generate(ast, state.options);
  54864. return ("inlineTemplate:{render:function(){" + (inlineRenderFns.render) + "},staticRenderFns:[" + (inlineRenderFns.staticRenderFns.map(function (code) { return ("function(){" + code + "}"); }).join(',')) + "]}")
  54865. }
  54866. }
  54867. function genScopedSlots (
  54868. el,
  54869. slots,
  54870. state
  54871. ) {
  54872. // by default scoped slots are considered "stable", this allows child
  54873. // components with only scoped slots to skip forced updates from parent.
  54874. // but in some cases we have to bail-out of this optimization
  54875. // for example if the slot contains dynamic names, has v-if or v-for on them...
  54876. var needsForceUpdate = el.for || Object.keys(slots).some(function (key) {
  54877. var slot = slots[key];
  54878. return (
  54879. slot.slotTargetDynamic ||
  54880. slot.if ||
  54881. slot.for ||
  54882. containsSlotChild(slot) // is passing down slot from parent which may be dynamic
  54883. )
  54884. });
  54885. // #9534: if a component with scoped slots is inside a conditional branch,
  54886. // it's possible for the same component to be reused but with different
  54887. // compiled slot content. To avoid that, we generate a unique key based on
  54888. // the generated code of all the slot contents.
  54889. var needsKey = !!el.if;
  54890. // OR when it is inside another scoped slot or v-for (the reactivity may be
  54891. // disconnected due to the intermediate scope variable)
  54892. // #9438, #9506
  54893. // TODO: this can be further optimized by properly analyzing in-scope bindings
  54894. // and skip force updating ones that do not actually use scope variables.
  54895. if (!needsForceUpdate) {
  54896. var parent = el.parent;
  54897. while (parent) {
  54898. if (
  54899. (parent.slotScope && parent.slotScope !== emptySlotScopeToken) ||
  54900. parent.for
  54901. ) {
  54902. needsForceUpdate = true;
  54903. break
  54904. }
  54905. if (parent.if) {
  54906. needsKey = true;
  54907. }
  54908. parent = parent.parent;
  54909. }
  54910. }
  54911. var generatedSlots = Object.keys(slots)
  54912. .map(function (key) { return genScopedSlot(slots[key], state); })
  54913. .join(',');
  54914. return ("scopedSlots:_u([" + generatedSlots + "]" + (needsForceUpdate ? ",null,true" : "") + (!needsForceUpdate && needsKey ? (",null,false," + (hash(generatedSlots))) : "") + ")")
  54915. }
  54916. function hash(str) {
  54917. var hash = 5381;
  54918. var i = str.length;
  54919. while(i) {
  54920. hash = (hash * 33) ^ str.charCodeAt(--i);
  54921. }
  54922. return hash >>> 0
  54923. }
  54924. function containsSlotChild (el) {
  54925. if (el.type === 1) {
  54926. if (el.tag === 'slot') {
  54927. return true
  54928. }
  54929. return el.children.some(containsSlotChild)
  54930. }
  54931. return false
  54932. }
  54933. function genScopedSlot (
  54934. el,
  54935. state
  54936. ) {
  54937. var isLegacySyntax = el.attrsMap['slot-scope'];
  54938. if (el.if && !el.ifProcessed && !isLegacySyntax) {
  54939. return genIf(el, state, genScopedSlot, "null")
  54940. }
  54941. if (el.for && !el.forProcessed) {
  54942. return genFor(el, state, genScopedSlot)
  54943. }
  54944. var slotScope = el.slotScope === emptySlotScopeToken
  54945. ? ""
  54946. : String(el.slotScope);
  54947. var fn = "function(" + slotScope + "){" +
  54948. "return " + (el.tag === 'template'
  54949. ? el.if && isLegacySyntax
  54950. ? ("(" + (el.if) + ")?" + (genChildren(el, state) || 'undefined') + ":undefined")
  54951. : genChildren(el, state) || 'undefined'
  54952. : genElement(el, state)) + "}";
  54953. // reverse proxy v-slot without scope on this.$slots
  54954. var reverseProxy = slotScope ? "" : ",proxy:true";
  54955. return ("{key:" + (el.slotTarget || "\"default\"") + ",fn:" + fn + reverseProxy + "}")
  54956. }
  54957. function genChildren (
  54958. el,
  54959. state,
  54960. checkSkip,
  54961. altGenElement,
  54962. altGenNode
  54963. ) {
  54964. var children = el.children;
  54965. if (children.length) {
  54966. var el$1 = children[0];
  54967. // optimize single v-for
  54968. if (children.length === 1 &&
  54969. el$1.for &&
  54970. el$1.tag !== 'template' &&
  54971. el$1.tag !== 'slot'
  54972. ) {
  54973. var normalizationType = checkSkip
  54974. ? state.maybeComponent(el$1) ? ",1" : ",0"
  54975. : "";
  54976. return ("" + ((altGenElement || genElement)(el$1, state)) + normalizationType)
  54977. }
  54978. var normalizationType$1 = checkSkip
  54979. ? getNormalizationType(children, state.maybeComponent)
  54980. : 0;
  54981. var gen = altGenNode || genNode;
  54982. return ("[" + (children.map(function (c) { return gen(c, state); }).join(',')) + "]" + (normalizationType$1 ? ("," + normalizationType$1) : ''))
  54983. }
  54984. }
  54985. // determine the normalization needed for the children array.
  54986. // 0: no normalization needed
  54987. // 1: simple normalization needed (possible 1-level deep nested array)
  54988. // 2: full normalization needed
  54989. function getNormalizationType (
  54990. children,
  54991. maybeComponent
  54992. ) {
  54993. var res = 0;
  54994. for (var i = 0; i < children.length; i++) {
  54995. var el = children[i];
  54996. if (el.type !== 1) {
  54997. continue
  54998. }
  54999. if (needsNormalization(el) ||
  55000. (el.ifConditions && el.ifConditions.some(function (c) { return needsNormalization(c.block); }))) {
  55001. res = 2;
  55002. break
  55003. }
  55004. if (maybeComponent(el) ||
  55005. (el.ifConditions && el.ifConditions.some(function (c) { return maybeComponent(c.block); }))) {
  55006. res = 1;
  55007. }
  55008. }
  55009. return res
  55010. }
  55011. function needsNormalization (el) {
  55012. return el.for !== undefined || el.tag === 'template' || el.tag === 'slot'
  55013. }
  55014. function genNode (node, state) {
  55015. if (node.type === 1) {
  55016. return genElement(node, state)
  55017. } else if (node.type === 3 && node.isComment) {
  55018. return genComment(node)
  55019. } else {
  55020. return genText(node)
  55021. }
  55022. }
  55023. function genText (text) {
  55024. return ("_v(" + (text.type === 2
  55025. ? text.expression // no need for () because already wrapped in _s()
  55026. : transformSpecialNewlines(JSON.stringify(text.text))) + ")")
  55027. }
  55028. function genComment (comment) {
  55029. return ("_e(" + (JSON.stringify(comment.text)) + ")")
  55030. }
  55031. function genSlot (el, state) {
  55032. var slotName = el.slotName || '"default"';
  55033. var children = genChildren(el, state);
  55034. var res = "_t(" + slotName + (children ? ("," + children) : '');
  55035. var attrs = el.attrs || el.dynamicAttrs
  55036. ? genProps((el.attrs || []).concat(el.dynamicAttrs || []).map(function (attr) { return ({
  55037. // slot props are camelized
  55038. name: camelize(attr.name),
  55039. value: attr.value,
  55040. dynamic: attr.dynamic
  55041. }); }))
  55042. : null;
  55043. var bind$$1 = el.attrsMap['v-bind'];
  55044. if ((attrs || bind$$1) && !children) {
  55045. res += ",null";
  55046. }
  55047. if (attrs) {
  55048. res += "," + attrs;
  55049. }
  55050. if (bind$$1) {
  55051. res += (attrs ? '' : ',null') + "," + bind$$1;
  55052. }
  55053. return res + ')'
  55054. }
  55055. // componentName is el.component, take it as argument to shun flow's pessimistic refinement
  55056. function genComponent (
  55057. componentName,
  55058. el,
  55059. state
  55060. ) {
  55061. var children = el.inlineTemplate ? null : genChildren(el, state, true);
  55062. return ("_c(" + componentName + "," + (genData$2(el, state)) + (children ? ("," + children) : '') + ")")
  55063. }
  55064. function genProps (props) {
  55065. var staticProps = "";
  55066. var dynamicProps = "";
  55067. for (var i = 0; i < props.length; i++) {
  55068. var prop = props[i];
  55069. var value = transformSpecialNewlines(prop.value);
  55070. if (prop.dynamic) {
  55071. dynamicProps += (prop.name) + "," + value + ",";
  55072. } else {
  55073. staticProps += "\"" + (prop.name) + "\":" + value + ",";
  55074. }
  55075. }
  55076. staticProps = "{" + (staticProps.slice(0, -1)) + "}";
  55077. if (dynamicProps) {
  55078. return ("_d(" + staticProps + ",[" + (dynamicProps.slice(0, -1)) + "])")
  55079. } else {
  55080. return staticProps
  55081. }
  55082. }
  55083. // #3895, #4268
  55084. function transformSpecialNewlines (text) {
  55085. return text
  55086. .replace(/\u2028/g, '\\u2028')
  55087. .replace(/\u2029/g, '\\u2029')
  55088. }
  55089. /* */
  55090. // these keywords should not appear inside expressions, but operators like
  55091. // typeof, instanceof and in are allowed
  55092. var prohibitedKeywordRE = new RegExp('\\b' + (
  55093. 'do,if,for,let,new,try,var,case,else,with,await,break,catch,class,const,' +
  55094. 'super,throw,while,yield,delete,export,import,return,switch,default,' +
  55095. 'extends,finally,continue,debugger,function,arguments'
  55096. ).split(',').join('\\b|\\b') + '\\b');
  55097. // these unary operators should not be used as property/method names
  55098. var unaryOperatorsRE = new RegExp('\\b' + (
  55099. 'delete,typeof,void'
  55100. ).split(',').join('\\s*\\([^\\)]*\\)|\\b') + '\\s*\\([^\\)]*\\)');
  55101. // strip strings in expressions
  55102. var stripStringRE = /'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`(?:[^`\\]|\\.)*\$\{|\}(?:[^`\\]|\\.)*`|`(?:[^`\\]|\\.)*`/g;
  55103. // detect problematic expressions in a template
  55104. function detectErrors (ast, warn) {
  55105. if (ast) {
  55106. checkNode(ast, warn);
  55107. }
  55108. }
  55109. function checkNode (node, warn) {
  55110. if (node.type === 1) {
  55111. for (var name in node.attrsMap) {
  55112. if (dirRE.test(name)) {
  55113. var value = node.attrsMap[name];
  55114. if (value) {
  55115. var range = node.rawAttrsMap[name];
  55116. if (name === 'v-for') {
  55117. checkFor(node, ("v-for=\"" + value + "\""), warn, range);
  55118. } else if (name === 'v-slot' || name[0] === '#') {
  55119. checkFunctionParameterExpression(value, (name + "=\"" + value + "\""), warn, range);
  55120. } else if (onRE.test(name)) {
  55121. checkEvent(value, (name + "=\"" + value + "\""), warn, range);
  55122. } else {
  55123. checkExpression(value, (name + "=\"" + value + "\""), warn, range);
  55124. }
  55125. }
  55126. }
  55127. }
  55128. if (node.children) {
  55129. for (var i = 0; i < node.children.length; i++) {
  55130. checkNode(node.children[i], warn);
  55131. }
  55132. }
  55133. } else if (node.type === 2) {
  55134. checkExpression(node.expression, node.text, warn, node);
  55135. }
  55136. }
  55137. function checkEvent (exp, text, warn, range) {
  55138. var stripped = exp.replace(stripStringRE, '');
  55139. var keywordMatch = stripped.match(unaryOperatorsRE);
  55140. if (keywordMatch && stripped.charAt(keywordMatch.index - 1) !== '$') {
  55141. warn(
  55142. "avoid using JavaScript unary operator as property name: " +
  55143. "\"" + (keywordMatch[0]) + "\" in expression " + (text.trim()),
  55144. range
  55145. );
  55146. }
  55147. checkExpression(exp, text, warn, range);
  55148. }
  55149. function checkFor (node, text, warn, range) {
  55150. checkExpression(node.for || '', text, warn, range);
  55151. checkIdentifier(node.alias, 'v-for alias', text, warn, range);
  55152. checkIdentifier(node.iterator1, 'v-for iterator', text, warn, range);
  55153. checkIdentifier(node.iterator2, 'v-for iterator', text, warn, range);
  55154. }
  55155. function checkIdentifier (
  55156. ident,
  55157. type,
  55158. text,
  55159. warn,
  55160. range
  55161. ) {
  55162. if (typeof ident === 'string') {
  55163. try {
  55164. new Function(("var " + ident + "=_"));
  55165. } catch (e) {
  55166. warn(("invalid " + type + " \"" + ident + "\" in expression: " + (text.trim())), range);
  55167. }
  55168. }
  55169. }
  55170. function checkExpression (exp, text, warn, range) {
  55171. try {
  55172. new Function(("return " + exp));
  55173. } catch (e) {
  55174. var keywordMatch = exp.replace(stripStringRE, '').match(prohibitedKeywordRE);
  55175. if (keywordMatch) {
  55176. warn(
  55177. "avoid using JavaScript keyword as property name: " +
  55178. "\"" + (keywordMatch[0]) + "\"\n Raw expression: " + (text.trim()),
  55179. range
  55180. );
  55181. } else {
  55182. warn(
  55183. "invalid expression: " + (e.message) + " in\n\n" +
  55184. " " + exp + "\n\n" +
  55185. " Raw expression: " + (text.trim()) + "\n",
  55186. range
  55187. );
  55188. }
  55189. }
  55190. }
  55191. function checkFunctionParameterExpression (exp, text, warn, range) {
  55192. try {
  55193. new Function(exp, '');
  55194. } catch (e) {
  55195. warn(
  55196. "invalid function parameter expression: " + (e.message) + " in\n\n" +
  55197. " " + exp + "\n\n" +
  55198. " Raw expression: " + (text.trim()) + "\n",
  55199. range
  55200. );
  55201. }
  55202. }
  55203. /* */
  55204. var range = 2;
  55205. function generateCodeFrame (
  55206. source,
  55207. start,
  55208. end
  55209. ) {
  55210. if ( start === void 0 ) start = 0;
  55211. if ( end === void 0 ) end = source.length;
  55212. var lines = source.split(/\r?\n/);
  55213. var count = 0;
  55214. var res = [];
  55215. for (var i = 0; i < lines.length; i++) {
  55216. count += lines[i].length + 1;
  55217. if (count >= start) {
  55218. for (var j = i - range; j <= i + range || end > count; j++) {
  55219. if (j < 0 || j >= lines.length) { continue }
  55220. res.push(("" + (j + 1) + (repeat$1(" ", 3 - String(j + 1).length)) + "| " + (lines[j])));
  55221. var lineLength = lines[j].length;
  55222. if (j === i) {
  55223. // push underline
  55224. var pad = start - (count - lineLength) + 1;
  55225. var length = end > count ? lineLength - pad : end - start;
  55226. res.push(" | " + repeat$1(" ", pad) + repeat$1("^", length));
  55227. } else if (j > i) {
  55228. if (end > count) {
  55229. var length$1 = Math.min(end - count, lineLength);
  55230. res.push(" | " + repeat$1("^", length$1));
  55231. }
  55232. count += lineLength + 1;
  55233. }
  55234. }
  55235. break
  55236. }
  55237. }
  55238. return res.join('\n')
  55239. }
  55240. function repeat$1 (str, n) {
  55241. var result = '';
  55242. if (n > 0) {
  55243. while (true) { // eslint-disable-line
  55244. if (n & 1) { result += str; }
  55245. n >>>= 1;
  55246. if (n <= 0) { break }
  55247. str += str;
  55248. }
  55249. }
  55250. return result
  55251. }
  55252. /* */
  55253. function createFunction (code, errors) {
  55254. try {
  55255. return new Function(code)
  55256. } catch (err) {
  55257. errors.push({ err: err, code: code });
  55258. return noop
  55259. }
  55260. }
  55261. function createCompileToFunctionFn (compile) {
  55262. var cache = Object.create(null);
  55263. return function compileToFunctions (
  55264. template,
  55265. options,
  55266. vm
  55267. ) {
  55268. options = extend({}, options);
  55269. var warn$$1 = options.warn || warn;
  55270. delete options.warn;
  55271. /* istanbul ignore if */
  55272. {
  55273. // detect possible CSP restriction
  55274. try {
  55275. new Function('return 1');
  55276. } catch (e) {
  55277. if (e.toString().match(/unsafe-eval|CSP/)) {
  55278. warn$$1(
  55279. 'It seems you are using the standalone build of Vue.js in an ' +
  55280. 'environment with Content Security Policy that prohibits unsafe-eval. ' +
  55281. 'The template compiler cannot work in this environment. Consider ' +
  55282. 'relaxing the policy to allow unsafe-eval or pre-compiling your ' +
  55283. 'templates into render functions.'
  55284. );
  55285. }
  55286. }
  55287. }
  55288. // check cache
  55289. var key = options.delimiters
  55290. ? String(options.delimiters) + template
  55291. : template;
  55292. if (cache[key]) {
  55293. return cache[key]
  55294. }
  55295. // compile
  55296. var compiled = compile(template, options);
  55297. // check compilation errors/tips
  55298. {
  55299. if (compiled.errors && compiled.errors.length) {
  55300. if (options.outputSourceRange) {
  55301. compiled.errors.forEach(function (e) {
  55302. warn$$1(
  55303. "Error compiling template:\n\n" + (e.msg) + "\n\n" +
  55304. generateCodeFrame(template, e.start, e.end),
  55305. vm
  55306. );
  55307. });
  55308. } else {
  55309. warn$$1(
  55310. "Error compiling template:\n\n" + template + "\n\n" +
  55311. compiled.errors.map(function (e) { return ("- " + e); }).join('\n') + '\n',
  55312. vm
  55313. );
  55314. }
  55315. }
  55316. if (compiled.tips && compiled.tips.length) {
  55317. if (options.outputSourceRange) {
  55318. compiled.tips.forEach(function (e) { return tip(e.msg, vm); });
  55319. } else {
  55320. compiled.tips.forEach(function (msg) { return tip(msg, vm); });
  55321. }
  55322. }
  55323. }
  55324. // turn code into functions
  55325. var res = {};
  55326. var fnGenErrors = [];
  55327. res.render = createFunction(compiled.render, fnGenErrors);
  55328. res.staticRenderFns = compiled.staticRenderFns.map(function (code) {
  55329. return createFunction(code, fnGenErrors)
  55330. });
  55331. // check function generation errors.
  55332. // this should only happen if there is a bug in the compiler itself.
  55333. // mostly for codegen development use
  55334. /* istanbul ignore if */
  55335. {
  55336. if ((!compiled.errors || !compiled.errors.length) && fnGenErrors.length) {
  55337. warn$$1(
  55338. "Failed to generate render function:\n\n" +
  55339. fnGenErrors.map(function (ref) {
  55340. var err = ref.err;
  55341. var code = ref.code;
  55342. return ((err.toString()) + " in\n\n" + code + "\n");
  55343. }).join('\n'),
  55344. vm
  55345. );
  55346. }
  55347. }
  55348. return (cache[key] = res)
  55349. }
  55350. }
  55351. /* */
  55352. function createCompilerCreator (baseCompile) {
  55353. return function createCompiler (baseOptions) {
  55354. function compile (
  55355. template,
  55356. options
  55357. ) {
  55358. var finalOptions = Object.create(baseOptions);
  55359. var errors = [];
  55360. var tips = [];
  55361. var warn = function (msg, range, tip) {
  55362. (tip ? tips : errors).push(msg);
  55363. };
  55364. if (options) {
  55365. if (options.outputSourceRange) {
  55366. // $flow-disable-line
  55367. var leadingSpaceLength = template.match(/^\s*/)[0].length;
  55368. warn = function (msg, range, tip) {
  55369. var data = { msg: msg };
  55370. if (range) {
  55371. if (range.start != null) {
  55372. data.start = range.start + leadingSpaceLength;
  55373. }
  55374. if (range.end != null) {
  55375. data.end = range.end + leadingSpaceLength;
  55376. }
  55377. }
  55378. (tip ? tips : errors).push(data);
  55379. };
  55380. }
  55381. // merge custom modules
  55382. if (options.modules) {
  55383. finalOptions.modules =
  55384. (baseOptions.modules || []).concat(options.modules);
  55385. }
  55386. // merge custom directives
  55387. if (options.directives) {
  55388. finalOptions.directives = extend(
  55389. Object.create(baseOptions.directives || null),
  55390. options.directives
  55391. );
  55392. }
  55393. // copy other options
  55394. for (var key in options) {
  55395. if (key !== 'modules' && key !== 'directives') {
  55396. finalOptions[key] = options[key];
  55397. }
  55398. }
  55399. }
  55400. finalOptions.warn = warn;
  55401. var compiled = baseCompile(template.trim(), finalOptions);
  55402. {
  55403. detectErrors(compiled.ast, warn);
  55404. }
  55405. compiled.errors = errors;
  55406. compiled.tips = tips;
  55407. return compiled
  55408. }
  55409. return {
  55410. compile: compile,
  55411. compileToFunctions: createCompileToFunctionFn(compile)
  55412. }
  55413. }
  55414. }
  55415. /* */
  55416. // `createCompilerCreator` allows creating compilers that use alternative
  55417. // parser/optimizer/codegen, e.g the SSR optimizing compiler.
  55418. // Here we just export a default compiler using the default parts.
  55419. var createCompiler = createCompilerCreator(function baseCompile (
  55420. template,
  55421. options
  55422. ) {
  55423. var ast = parse(template.trim(), options);
  55424. if (options.optimize !== false) {
  55425. optimize(ast, options);
  55426. }
  55427. var code = generate(ast, options);
  55428. return {
  55429. ast: ast,
  55430. render: code.render,
  55431. staticRenderFns: code.staticRenderFns
  55432. }
  55433. });
  55434. /* */
  55435. var ref$1 = createCompiler(baseOptions);
  55436. var compile = ref$1.compile;
  55437. var compileToFunctions = ref$1.compileToFunctions;
  55438. /* */
  55439. // check whether current browser encodes a char inside attribute values
  55440. var div;
  55441. function getShouldDecode (href) {
  55442. div = div || document.createElement('div');
  55443. div.innerHTML = href ? "<a href=\"\n\"/>" : "<div a=\"\n\"/>";
  55444. return div.innerHTML.indexOf('&#10;') > 0
  55445. }
  55446. // #3663: IE encodes newlines inside attribute values while other browsers don't
  55447. var shouldDecodeNewlines = inBrowser ? getShouldDecode(false) : false;
  55448. // #6828: chrome encodes content in a[href]
  55449. var shouldDecodeNewlinesForHref = inBrowser ? getShouldDecode(true) : false;
  55450. /* */
  55451. var idToTemplate = cached(function (id) {
  55452. var el = query(id);
  55453. return el && el.innerHTML
  55454. });
  55455. var mount = Vue.prototype.$mount;
  55456. Vue.prototype.$mount = function (
  55457. el,
  55458. hydrating
  55459. ) {
  55460. el = el && query(el);
  55461. /* istanbul ignore if */
  55462. if (el === document.body || el === document.documentElement) {
  55463. warn(
  55464. "Do not mount Vue to <html> or <body> - mount to normal elements instead."
  55465. );
  55466. return this
  55467. }
  55468. var options = this.$options;
  55469. // resolve template/el and convert to render function
  55470. if (!options.render) {
  55471. var template = options.template;
  55472. if (template) {
  55473. if (typeof template === 'string') {
  55474. if (template.charAt(0) === '#') {
  55475. template = idToTemplate(template);
  55476. /* istanbul ignore if */
  55477. if (!template) {
  55478. warn(
  55479. ("Template element not found or is empty: " + (options.template)),
  55480. this
  55481. );
  55482. }
  55483. }
  55484. } else if (template.nodeType) {
  55485. template = template.innerHTML;
  55486. } else {
  55487. {
  55488. warn('invalid template option:' + template, this);
  55489. }
  55490. return this
  55491. }
  55492. } else if (el) {
  55493. template = getOuterHTML(el);
  55494. }
  55495. if (template) {
  55496. /* istanbul ignore if */
  55497. if (config.performance && mark) {
  55498. mark('compile');
  55499. }
  55500. var ref = compileToFunctions(template, {
  55501. outputSourceRange: "development" !== 'production',
  55502. shouldDecodeNewlines: shouldDecodeNewlines,
  55503. shouldDecodeNewlinesForHref: shouldDecodeNewlinesForHref,
  55504. delimiters: options.delimiters,
  55505. comments: options.comments
  55506. }, this);
  55507. var render = ref.render;
  55508. var staticRenderFns = ref.staticRenderFns;
  55509. options.render = render;
  55510. options.staticRenderFns = staticRenderFns;
  55511. /* istanbul ignore if */
  55512. if (config.performance && mark) {
  55513. mark('compile end');
  55514. measure(("vue " + (this._name) + " compile"), 'compile', 'compile end');
  55515. }
  55516. }
  55517. }
  55518. return mount.call(this, el, hydrating)
  55519. };
  55520. /**
  55521. * Get outerHTML of elements, taking care
  55522. * of SVG elements in IE as well.
  55523. */
  55524. function getOuterHTML (el) {
  55525. if (el.outerHTML) {
  55526. return el.outerHTML
  55527. } else {
  55528. var container = document.createElement('div');
  55529. container.appendChild(el.cloneNode(true));
  55530. return container.innerHTML
  55531. }
  55532. }
  55533. Vue.compile = compileToFunctions;
  55534. module.exports = Vue;
  55535. /* 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))
  55536. /***/ }),
  55537. /***/ "./node_modules/vue/dist/vue.common.js":
  55538. /*!*********************************************!*\
  55539. !*** ./node_modules/vue/dist/vue.common.js ***!
  55540. \*********************************************/
  55541. /*! no static exports found */
  55542. /***/ (function(module, exports, __webpack_require__) {
  55543. if (false) {} else {
  55544. module.exports = __webpack_require__(/*! ./vue.common.dev.js */ "./node_modules/vue/dist/vue.common.dev.js")
  55545. }
  55546. /***/ }),
  55547. /***/ "./node_modules/webpack/buildin/global.js":
  55548. /*!***********************************!*\
  55549. !*** (webpack)/buildin/global.js ***!
  55550. \***********************************/
  55551. /*! no static exports found */
  55552. /***/ (function(module, exports) {
  55553. var g;
  55554. // This works in non-strict mode
  55555. g = (function() {
  55556. return this;
  55557. })();
  55558. try {
  55559. // This works if eval is allowed (see CSP)
  55560. g = g || new Function("return this")();
  55561. } catch (e) {
  55562. // This works if the window reference is available
  55563. if (typeof window === "object") g = window;
  55564. }
  55565. // g can still be undefined, but nothing to do about it...
  55566. // We return undefined, instead of nothing here, so it's
  55567. // easier to handle this case. if(!global) { ...}
  55568. module.exports = g;
  55569. /***/ }),
  55570. /***/ "./node_modules/webpack/buildin/module.js":
  55571. /*!***********************************!*\
  55572. !*** (webpack)/buildin/module.js ***!
  55573. \***********************************/
  55574. /*! no static exports found */
  55575. /***/ (function(module, exports) {
  55576. module.exports = function(module) {
  55577. if (!module.webpackPolyfill) {
  55578. module.deprecate = function() {};
  55579. module.paths = [];
  55580. // module.parent = undefined by default
  55581. if (!module.children) module.children = [];
  55582. Object.defineProperty(module, "loaded", {
  55583. enumerable: true,
  55584. get: function() {
  55585. return module.l;
  55586. }
  55587. });
  55588. Object.defineProperty(module, "id", {
  55589. enumerable: true,
  55590. get: function() {
  55591. return module.i;
  55592. }
  55593. });
  55594. module.webpackPolyfill = 1;
  55595. }
  55596. return module;
  55597. };
  55598. /***/ }),
  55599. /***/ "./resources/js/app.js":
  55600. /*!*****************************!*\
  55601. !*** ./resources/js/app.js ***!
  55602. \*****************************/
  55603. /*! no static exports found */
  55604. /***/ (function(module, exports, __webpack_require__) {
  55605. /**
  55606. * First we will load all of this project's JavaScript dependencies which
  55607. * includes Vue and other libraries. It is a great starting point when
  55608. * building robust, powerful web applications using Vue and Laravel.
  55609. */
  55610. __webpack_require__(/*! ./bootstrap */ "./resources/js/bootstrap.js");
  55611. window.Clipboard = __webpack_require__(/*! clipboard */ "./node_modules/clipboard/dist/clipboard.js");
  55612. __webpack_require__(/*! ./notify.min.js */ "./resources/js/notify.min.js");
  55613. window.Vue = __webpack_require__(/*! vue */ "./node_modules/vue/dist/vue.common.js");
  55614. /**
  55615. * The following block of code may be used to automatically register your
  55616. * Vue components. It will recursively scan this directory for the Vue
  55617. * components and automatically register them with their "basename".
  55618. *
  55619. * Eg. ./components/ExampleComponent.vue -> <example-component></example-component>
  55620. */
  55621. // const files = require.context('./', true, /\.vue$/i)
  55622. // files.keys().map(key => Vue.component(key.split('/').pop().split('.')[0], files(key).default))
  55623. Vue.component('example-component', __webpack_require__(/*! ./components/ExampleComponent.vue */ "./resources/js/components/ExampleComponent.vue")["default"]);
  55624. Vue.component('woinfo', __webpack_require__(/*! ./components/woinfo.vue */ "./resources/js/components/woinfo.vue")["default"]);
  55625. Vue.component('assetinfo', __webpack_require__(/*! ./components/assetinfo.vue */ "./resources/js/components/assetinfo.vue")["default"]);
  55626. Vue.component('credential', __webpack_require__(/*! ./components/credential.vue */ "./resources/js/components/credential.vue")["default"]);
  55627. Vue.component('notes', __webpack_require__(/*! ./components/notes.vue */ "./resources/js/components/notes.vue")["default"]);
  55628. Vue.component('modal', __webpack_require__(/*! ./components/modal.vue */ "./resources/js/components/modal.vue")["default"]);
  55629. Vue.component('woinfo-edit-modal', __webpack_require__(/*! ./components/woinfo-edit-modal.vue */ "./resources/js/components/woinfo-edit-modal.vue")["default"]);
  55630. Vue.component('errorlist', __webpack_require__(/*! ./components/errorlist.vue */ "./resources/js/components/errorlist.vue")["default"]);
  55631. Vue.component('credential-form-modal', __webpack_require__(/*! ./components/credential-form-modal.vue */ "./resources/js/components/credential-form-modal.vue")["default"]);
  55632. Vue.component('autocomplete-custom-dropdown', __webpack_require__(/*! ./components/autocomplete-custom-dropdown.vue */ "./resources/js/components/autocomplete-custom-dropdown.vue")["default"]);
  55633. Vue.component('credential-list', __webpack_require__(/*! ./components/credential-list.vue */ "./resources/js/components/credential-list.vue")["default"]);
  55634. Vue.component('note-form-modal', __webpack_require__(/*! ./components/note-form-modal.vue */ "./resources/js/components/note-form-modal.vue")["default"]);
  55635. /**
  55636. * Next, we will create a fresh Vue application instance and attach it to
  55637. * the page. Then, you may begin adding components to this application
  55638. * or customize the JavaScript scaffolding to fit your unique needs.
  55639. */
  55640. var app = new Vue({
  55641. el: '#app'
  55642. });
  55643. $(function () {
  55644. $('[data-toggle="tooltip"]').tooltip();
  55645. });
  55646. var clipboard = new Clipboard('.btn-clip');
  55647. clipboard.on('success', function (e) {
  55648. $('#' + e.trigger.getAttribute('id')).notify('Copied to Clipboard', {
  55649. position: "right",
  55650. className: 'success'
  55651. });
  55652. e.clearSelection();
  55653. });
  55654. /***/ }),
  55655. /***/ "./resources/js/bootstrap.js":
  55656. /*!***********************************!*\
  55657. !*** ./resources/js/bootstrap.js ***!
  55658. \***********************************/
  55659. /*! no exports provided */
  55660. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55661. "use strict";
  55662. __webpack_require__.r(__webpack_exports__);
  55663. /* harmony import */ var laravel_echo__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! laravel-echo */ "./node_modules/laravel-echo/dist/echo.js");
  55664. window._ = __webpack_require__(/*! lodash */ "./node_modules/lodash/lodash.js");
  55665. /**
  55666. * We'll load jQuery and the Bootstrap jQuery plugin which provides support
  55667. * for JavaScript based Bootstrap features such as modals and tabs. This
  55668. * code may be modified to fit the specific needs of your application.
  55669. */
  55670. try {
  55671. window.Popper = __webpack_require__(/*! popper.js */ "./node_modules/popper.js/dist/esm/popper.js")["default"];
  55672. window.$ = window.jQuery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  55673. __webpack_require__(/*! bootstrap */ "./node_modules/bootstrap/dist/js/bootstrap.js");
  55674. } catch (e) {}
  55675. /**
  55676. * We'll load the axios HTTP library which allows us to easily issue requests
  55677. * to our Laravel back-end. This library automatically handles sending the
  55678. * CSRF token as a header based on the value of the "XSRF" token cookie.
  55679. */
  55680. window.axios = __webpack_require__(/*! axios */ "./node_modules/axios/index.js");
  55681. window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';
  55682. /**
  55683. * Echo exposes an expressive API for subscribing to channels and listening
  55684. * for events that are broadcast by Laravel. Echo and event broadcasting
  55685. * allows your team to easily build robust real-time web applications.
  55686. */
  55687. window.Pusher = __webpack_require__(/*! pusher-js */ "./node_modules/pusher-js/dist/web/pusher.js");
  55688. window.Echo = new laravel_echo__WEBPACK_IMPORTED_MODULE_0__["default"]({
  55689. broadcaster: 'pusher',
  55690. key: "upccrt",
  55691. authEndpoint: '/broadcasting/auth',
  55692. wsHost: window.location.hostname,
  55693. wsPort: 6001,
  55694. disableStats: true
  55695. });
  55696. /***/ }),
  55697. /***/ "./resources/js/components/ExampleComponent.vue":
  55698. /*!******************************************************!*\
  55699. !*** ./resources/js/components/ExampleComponent.vue ***!
  55700. \******************************************************/
  55701. /*! exports provided: default */
  55702. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55703. "use strict";
  55704. __webpack_require__.r(__webpack_exports__);
  55705. /* 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&");
  55706. /* 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&");
  55707. /* 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");
  55708. /* normalize component */
  55709. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  55710. _ExampleComponent_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  55711. _ExampleComponent_vue_vue_type_template_id_299e239e___WEBPACK_IMPORTED_MODULE_0__["render"],
  55712. _ExampleComponent_vue_vue_type_template_id_299e239e___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  55713. false,
  55714. null,
  55715. null,
  55716. null
  55717. )
  55718. /* hot reload */
  55719. if (false) { var api; }
  55720. component.options.__file = "resources/js/components/ExampleComponent.vue"
  55721. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  55722. /***/ }),
  55723. /***/ "./resources/js/components/ExampleComponent.vue?vue&type=script&lang=js&":
  55724. /*!*******************************************************************************!*\
  55725. !*** ./resources/js/components/ExampleComponent.vue?vue&type=script&lang=js& ***!
  55726. \*******************************************************************************/
  55727. /*! exports provided: default */
  55728. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55729. "use strict";
  55730. __webpack_require__.r(__webpack_exports__);
  55731. /* 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&");
  55732. /* 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"]);
  55733. /***/ }),
  55734. /***/ "./resources/js/components/ExampleComponent.vue?vue&type=template&id=299e239e&":
  55735. /*!*************************************************************************************!*\
  55736. !*** ./resources/js/components/ExampleComponent.vue?vue&type=template&id=299e239e& ***!
  55737. \*************************************************************************************/
  55738. /*! exports provided: render, staticRenderFns */
  55739. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55740. "use strict";
  55741. __webpack_require__.r(__webpack_exports__);
  55742. /* 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&");
  55743. /* 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"]; });
  55744. /* 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"]; });
  55745. /***/ }),
  55746. /***/ "./resources/js/components/assetinfo.vue":
  55747. /*!***********************************************!*\
  55748. !*** ./resources/js/components/assetinfo.vue ***!
  55749. \***********************************************/
  55750. /*! exports provided: default */
  55751. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55752. "use strict";
  55753. __webpack_require__.r(__webpack_exports__);
  55754. /* 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&");
  55755. /* 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&");
  55756. /* 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");
  55757. /* normalize component */
  55758. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  55759. _assetinfo_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  55760. _assetinfo_vue_vue_type_template_id_4fe1d2e3___WEBPACK_IMPORTED_MODULE_0__["render"],
  55761. _assetinfo_vue_vue_type_template_id_4fe1d2e3___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  55762. false,
  55763. null,
  55764. null,
  55765. null
  55766. )
  55767. /* hot reload */
  55768. if (false) { var api; }
  55769. component.options.__file = "resources/js/components/assetinfo.vue"
  55770. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  55771. /***/ }),
  55772. /***/ "./resources/js/components/assetinfo.vue?vue&type=script&lang=js&":
  55773. /*!************************************************************************!*\
  55774. !*** ./resources/js/components/assetinfo.vue?vue&type=script&lang=js& ***!
  55775. \************************************************************************/
  55776. /*! exports provided: default */
  55777. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55778. "use strict";
  55779. __webpack_require__.r(__webpack_exports__);
  55780. /* 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&");
  55781. /* 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"]);
  55782. /***/ }),
  55783. /***/ "./resources/js/components/assetinfo.vue?vue&type=template&id=4fe1d2e3&":
  55784. /*!******************************************************************************!*\
  55785. !*** ./resources/js/components/assetinfo.vue?vue&type=template&id=4fe1d2e3& ***!
  55786. \******************************************************************************/
  55787. /*! exports provided: render, staticRenderFns */
  55788. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55789. "use strict";
  55790. __webpack_require__.r(__webpack_exports__);
  55791. /* 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&");
  55792. /* 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"]; });
  55793. /* 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"]; });
  55794. /***/ }),
  55795. /***/ "./resources/js/components/autocomplete-custom-dropdown.vue":
  55796. /*!******************************************************************!*\
  55797. !*** ./resources/js/components/autocomplete-custom-dropdown.vue ***!
  55798. \******************************************************************/
  55799. /*! exports provided: default */
  55800. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55801. "use strict";
  55802. __webpack_require__.r(__webpack_exports__);
  55803. /* 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&");
  55804. /* 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&");
  55805. /* 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");
  55806. /* normalize component */
  55807. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  55808. _autocomplete_custom_dropdown_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  55809. _autocomplete_custom_dropdown_vue_vue_type_template_id_18875e5a___WEBPACK_IMPORTED_MODULE_0__["render"],
  55810. _autocomplete_custom_dropdown_vue_vue_type_template_id_18875e5a___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  55811. false,
  55812. null,
  55813. null,
  55814. null
  55815. )
  55816. /* hot reload */
  55817. if (false) { var api; }
  55818. component.options.__file = "resources/js/components/autocomplete-custom-dropdown.vue"
  55819. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  55820. /***/ }),
  55821. /***/ "./resources/js/components/autocomplete-custom-dropdown.vue?vue&type=script&lang=js&":
  55822. /*!*******************************************************************************************!*\
  55823. !*** ./resources/js/components/autocomplete-custom-dropdown.vue?vue&type=script&lang=js& ***!
  55824. \*******************************************************************************************/
  55825. /*! exports provided: default */
  55826. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55827. "use strict";
  55828. __webpack_require__.r(__webpack_exports__);
  55829. /* 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&");
  55830. /* 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"]);
  55831. /***/ }),
  55832. /***/ "./resources/js/components/autocomplete-custom-dropdown.vue?vue&type=template&id=18875e5a&":
  55833. /*!*************************************************************************************************!*\
  55834. !*** ./resources/js/components/autocomplete-custom-dropdown.vue?vue&type=template&id=18875e5a& ***!
  55835. \*************************************************************************************************/
  55836. /*! exports provided: render, staticRenderFns */
  55837. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55838. "use strict";
  55839. __webpack_require__.r(__webpack_exports__);
  55840. /* 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&");
  55841. /* 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"]; });
  55842. /* 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"]; });
  55843. /***/ }),
  55844. /***/ "./resources/js/components/credential-form-modal.vue":
  55845. /*!***********************************************************!*\
  55846. !*** ./resources/js/components/credential-form-modal.vue ***!
  55847. \***********************************************************/
  55848. /*! exports provided: default */
  55849. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55850. "use strict";
  55851. __webpack_require__.r(__webpack_exports__);
  55852. /* 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&");
  55853. /* 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&");
  55854. /* 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");
  55855. /* normalize component */
  55856. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  55857. _credential_form_modal_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  55858. _credential_form_modal_vue_vue_type_template_id_5ba19d42___WEBPACK_IMPORTED_MODULE_0__["render"],
  55859. _credential_form_modal_vue_vue_type_template_id_5ba19d42___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  55860. false,
  55861. null,
  55862. null,
  55863. null
  55864. )
  55865. /* hot reload */
  55866. if (false) { var api; }
  55867. component.options.__file = "resources/js/components/credential-form-modal.vue"
  55868. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  55869. /***/ }),
  55870. /***/ "./resources/js/components/credential-form-modal.vue?vue&type=script&lang=js&":
  55871. /*!************************************************************************************!*\
  55872. !*** ./resources/js/components/credential-form-modal.vue?vue&type=script&lang=js& ***!
  55873. \************************************************************************************/
  55874. /*! exports provided: default */
  55875. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55876. "use strict";
  55877. __webpack_require__.r(__webpack_exports__);
  55878. /* 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&");
  55879. /* 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"]);
  55880. /***/ }),
  55881. /***/ "./resources/js/components/credential-form-modal.vue?vue&type=template&id=5ba19d42&":
  55882. /*!******************************************************************************************!*\
  55883. !*** ./resources/js/components/credential-form-modal.vue?vue&type=template&id=5ba19d42& ***!
  55884. \******************************************************************************************/
  55885. /*! exports provided: render, staticRenderFns */
  55886. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55887. "use strict";
  55888. __webpack_require__.r(__webpack_exports__);
  55889. /* 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&");
  55890. /* 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"]; });
  55891. /* 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"]; });
  55892. /***/ }),
  55893. /***/ "./resources/js/components/credential-list.vue":
  55894. /*!*****************************************************!*\
  55895. !*** ./resources/js/components/credential-list.vue ***!
  55896. \*****************************************************/
  55897. /*! exports provided: default */
  55898. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55899. "use strict";
  55900. __webpack_require__.r(__webpack_exports__);
  55901. /* harmony import */ var _credential_list_vue_vue_type_template_id_06d8fa4e___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./credential-list.vue?vue&type=template&id=06d8fa4e& */ "./resources/js/components/credential-list.vue?vue&type=template&id=06d8fa4e&");
  55902. /* harmony import */ var _credential_list_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./credential-list.vue?vue&type=script&lang=js& */ "./resources/js/components/credential-list.vue?vue&type=script&lang=js&");
  55903. /* 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");
  55904. /* normalize component */
  55905. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  55906. _credential_list_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  55907. _credential_list_vue_vue_type_template_id_06d8fa4e___WEBPACK_IMPORTED_MODULE_0__["render"],
  55908. _credential_list_vue_vue_type_template_id_06d8fa4e___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  55909. false,
  55910. null,
  55911. null,
  55912. null
  55913. )
  55914. /* hot reload */
  55915. if (false) { var api; }
  55916. component.options.__file = "resources/js/components/credential-list.vue"
  55917. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  55918. /***/ }),
  55919. /***/ "./resources/js/components/credential-list.vue?vue&type=script&lang=js&":
  55920. /*!******************************************************************************!*\
  55921. !*** ./resources/js/components/credential-list.vue?vue&type=script&lang=js& ***!
  55922. \******************************************************************************/
  55923. /*! exports provided: default */
  55924. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55925. "use strict";
  55926. __webpack_require__.r(__webpack_exports__);
  55927. /* harmony import */ var _node_modules_babel_loader_lib_index_js_ref_4_0_node_modules_vue_loader_lib_index_js_vue_loader_options_credential_list_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/babel-loader/lib??ref--4-0!../../../node_modules/vue-loader/lib??vue-loader-options!./credential-list.vue?vue&type=script&lang=js& */ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/credential-list.vue?vue&type=script&lang=js&");
  55928. /* empty/unused harmony star reexport */ /* harmony default export */ __webpack_exports__["default"] = (_node_modules_babel_loader_lib_index_js_ref_4_0_node_modules_vue_loader_lib_index_js_vue_loader_options_credential_list_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__["default"]);
  55929. /***/ }),
  55930. /***/ "./resources/js/components/credential-list.vue?vue&type=template&id=06d8fa4e&":
  55931. /*!************************************************************************************!*\
  55932. !*** ./resources/js/components/credential-list.vue?vue&type=template&id=06d8fa4e& ***!
  55933. \************************************************************************************/
  55934. /*! exports provided: render, staticRenderFns */
  55935. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55936. "use strict";
  55937. __webpack_require__.r(__webpack_exports__);
  55938. /* harmony import */ var _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_credential_list_vue_vue_type_template_id_06d8fa4e___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!../../../node_modules/vue-loader/lib??vue-loader-options!./credential-list.vue?vue&type=template&id=06d8fa4e& */ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/credential-list.vue?vue&type=template&id=06d8fa4e&");
  55939. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "render", function() { return _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_credential_list_vue_vue_type_template_id_06d8fa4e___WEBPACK_IMPORTED_MODULE_0__["render"]; });
  55940. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "staticRenderFns", function() { return _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_credential_list_vue_vue_type_template_id_06d8fa4e___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"]; });
  55941. /***/ }),
  55942. /***/ "./resources/js/components/credential.vue":
  55943. /*!************************************************!*\
  55944. !*** ./resources/js/components/credential.vue ***!
  55945. \************************************************/
  55946. /*! exports provided: default */
  55947. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55948. "use strict";
  55949. __webpack_require__.r(__webpack_exports__);
  55950. /* 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&");
  55951. /* 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&");
  55952. /* 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");
  55953. /* normalize component */
  55954. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  55955. _credential_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  55956. _credential_vue_vue_type_template_id_0f5cc562___WEBPACK_IMPORTED_MODULE_0__["render"],
  55957. _credential_vue_vue_type_template_id_0f5cc562___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  55958. false,
  55959. null,
  55960. null,
  55961. null
  55962. )
  55963. /* hot reload */
  55964. if (false) { var api; }
  55965. component.options.__file = "resources/js/components/credential.vue"
  55966. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  55967. /***/ }),
  55968. /***/ "./resources/js/components/credential.vue?vue&type=script&lang=js&":
  55969. /*!*************************************************************************!*\
  55970. !*** ./resources/js/components/credential.vue?vue&type=script&lang=js& ***!
  55971. \*************************************************************************/
  55972. /*! exports provided: default */
  55973. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55974. "use strict";
  55975. __webpack_require__.r(__webpack_exports__);
  55976. /* 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&");
  55977. /* 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"]);
  55978. /***/ }),
  55979. /***/ "./resources/js/components/credential.vue?vue&type=template&id=0f5cc562&":
  55980. /*!*******************************************************************************!*\
  55981. !*** ./resources/js/components/credential.vue?vue&type=template&id=0f5cc562& ***!
  55982. \*******************************************************************************/
  55983. /*! exports provided: render, staticRenderFns */
  55984. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55985. "use strict";
  55986. __webpack_require__.r(__webpack_exports__);
  55987. /* 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&");
  55988. /* 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"]; });
  55989. /* 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"]; });
  55990. /***/ }),
  55991. /***/ "./resources/js/components/errorlist.vue":
  55992. /*!***********************************************!*\
  55993. !*** ./resources/js/components/errorlist.vue ***!
  55994. \***********************************************/
  55995. /*! exports provided: default */
  55996. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  55997. "use strict";
  55998. __webpack_require__.r(__webpack_exports__);
  55999. /* 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&");
  56000. /* 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&");
  56001. /* 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");
  56002. /* normalize component */
  56003. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  56004. _errorlist_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  56005. _errorlist_vue_vue_type_template_id_1546f5eb___WEBPACK_IMPORTED_MODULE_0__["render"],
  56006. _errorlist_vue_vue_type_template_id_1546f5eb___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  56007. false,
  56008. null,
  56009. null,
  56010. null
  56011. )
  56012. /* hot reload */
  56013. if (false) { var api; }
  56014. component.options.__file = "resources/js/components/errorlist.vue"
  56015. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  56016. /***/ }),
  56017. /***/ "./resources/js/components/errorlist.vue?vue&type=script&lang=js&":
  56018. /*!************************************************************************!*\
  56019. !*** ./resources/js/components/errorlist.vue?vue&type=script&lang=js& ***!
  56020. \************************************************************************/
  56021. /*! exports provided: default */
  56022. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  56023. "use strict";
  56024. __webpack_require__.r(__webpack_exports__);
  56025. /* 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&");
  56026. /* 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"]);
  56027. /***/ }),
  56028. /***/ "./resources/js/components/errorlist.vue?vue&type=template&id=1546f5eb&":
  56029. /*!******************************************************************************!*\
  56030. !*** ./resources/js/components/errorlist.vue?vue&type=template&id=1546f5eb& ***!
  56031. \******************************************************************************/
  56032. /*! exports provided: render, staticRenderFns */
  56033. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  56034. "use strict";
  56035. __webpack_require__.r(__webpack_exports__);
  56036. /* 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&");
  56037. /* 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"]; });
  56038. /* 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"]; });
  56039. /***/ }),
  56040. /***/ "./resources/js/components/modal.vue":
  56041. /*!*******************************************!*\
  56042. !*** ./resources/js/components/modal.vue ***!
  56043. \*******************************************/
  56044. /*! exports provided: default */
  56045. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  56046. "use strict";
  56047. __webpack_require__.r(__webpack_exports__);
  56048. /* 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&");
  56049. /* 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");
  56050. var script = {}
  56051. /* normalize component */
  56052. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_1__["default"])(
  56053. script,
  56054. _modal_vue_vue_type_template_id_478d961c___WEBPACK_IMPORTED_MODULE_0__["render"],
  56055. _modal_vue_vue_type_template_id_478d961c___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  56056. false,
  56057. null,
  56058. null,
  56059. null
  56060. )
  56061. /* hot reload */
  56062. if (false) { var api; }
  56063. component.options.__file = "resources/js/components/modal.vue"
  56064. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  56065. /***/ }),
  56066. /***/ "./resources/js/components/modal.vue?vue&type=template&id=478d961c&":
  56067. /*!**************************************************************************!*\
  56068. !*** ./resources/js/components/modal.vue?vue&type=template&id=478d961c& ***!
  56069. \**************************************************************************/
  56070. /*! exports provided: render, staticRenderFns */
  56071. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  56072. "use strict";
  56073. __webpack_require__.r(__webpack_exports__);
  56074. /* 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&");
  56075. /* 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"]; });
  56076. /* 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"]; });
  56077. /***/ }),
  56078. /***/ "./resources/js/components/note-form-modal.vue":
  56079. /*!*****************************************************!*\
  56080. !*** ./resources/js/components/note-form-modal.vue ***!
  56081. \*****************************************************/
  56082. /*! exports provided: default */
  56083. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  56084. "use strict";
  56085. __webpack_require__.r(__webpack_exports__);
  56086. /* harmony import */ var _note_form_modal_vue_vue_type_template_id_0435c624___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./note-form-modal.vue?vue&type=template&id=0435c624& */ "./resources/js/components/note-form-modal.vue?vue&type=template&id=0435c624&");
  56087. /* harmony import */ var _note_form_modal_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./note-form-modal.vue?vue&type=script&lang=js& */ "./resources/js/components/note-form-modal.vue?vue&type=script&lang=js&");
  56088. /* 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");
  56089. /* normalize component */
  56090. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  56091. _note_form_modal_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  56092. _note_form_modal_vue_vue_type_template_id_0435c624___WEBPACK_IMPORTED_MODULE_0__["render"],
  56093. _note_form_modal_vue_vue_type_template_id_0435c624___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  56094. false,
  56095. null,
  56096. null,
  56097. null
  56098. )
  56099. /* hot reload */
  56100. if (false) { var api; }
  56101. component.options.__file = "resources/js/components/note-form-modal.vue"
  56102. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  56103. /***/ }),
  56104. /***/ "./resources/js/components/note-form-modal.vue?vue&type=script&lang=js&":
  56105. /*!******************************************************************************!*\
  56106. !*** ./resources/js/components/note-form-modal.vue?vue&type=script&lang=js& ***!
  56107. \******************************************************************************/
  56108. /*! exports provided: default */
  56109. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  56110. "use strict";
  56111. __webpack_require__.r(__webpack_exports__);
  56112. /* harmony import */ var _node_modules_babel_loader_lib_index_js_ref_4_0_node_modules_vue_loader_lib_index_js_vue_loader_options_note_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!./note-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/note-form-modal.vue?vue&type=script&lang=js&");
  56113. /* 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_note_form_modal_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__["default"]);
  56114. /***/ }),
  56115. /***/ "./resources/js/components/note-form-modal.vue?vue&type=template&id=0435c624&":
  56116. /*!************************************************************************************!*\
  56117. !*** ./resources/js/components/note-form-modal.vue?vue&type=template&id=0435c624& ***!
  56118. \************************************************************************************/
  56119. /*! exports provided: render, staticRenderFns */
  56120. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  56121. "use strict";
  56122. __webpack_require__.r(__webpack_exports__);
  56123. /* harmony import */ var _node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_vue_loader_lib_index_js_vue_loader_options_note_form_modal_vue_vue_type_template_id_0435c624___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!./note-form-modal.vue?vue&type=template&id=0435c624& */ "./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/note-form-modal.vue?vue&type=template&id=0435c624&");
  56124. /* 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_note_form_modal_vue_vue_type_template_id_0435c624___WEBPACK_IMPORTED_MODULE_0__["render"]; });
  56125. /* 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_note_form_modal_vue_vue_type_template_id_0435c624___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"]; });
  56126. /***/ }),
  56127. /***/ "./resources/js/components/notes.vue":
  56128. /*!*******************************************!*\
  56129. !*** ./resources/js/components/notes.vue ***!
  56130. \*******************************************/
  56131. /*! exports provided: default */
  56132. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  56133. "use strict";
  56134. __webpack_require__.r(__webpack_exports__);
  56135. /* 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&");
  56136. /* 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&");
  56137. /* 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");
  56138. /* normalize component */
  56139. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  56140. _notes_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  56141. _notes_vue_vue_type_template_id_73d141f4___WEBPACK_IMPORTED_MODULE_0__["render"],
  56142. _notes_vue_vue_type_template_id_73d141f4___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  56143. false,
  56144. null,
  56145. null,
  56146. null
  56147. )
  56148. /* hot reload */
  56149. if (false) { var api; }
  56150. component.options.__file = "resources/js/components/notes.vue"
  56151. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  56152. /***/ }),
  56153. /***/ "./resources/js/components/notes.vue?vue&type=script&lang=js&":
  56154. /*!********************************************************************!*\
  56155. !*** ./resources/js/components/notes.vue?vue&type=script&lang=js& ***!
  56156. \********************************************************************/
  56157. /*! exports provided: default */
  56158. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  56159. "use strict";
  56160. __webpack_require__.r(__webpack_exports__);
  56161. /* 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&");
  56162. /* 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"]);
  56163. /***/ }),
  56164. /***/ "./resources/js/components/notes.vue?vue&type=template&id=73d141f4&":
  56165. /*!**************************************************************************!*\
  56166. !*** ./resources/js/components/notes.vue?vue&type=template&id=73d141f4& ***!
  56167. \**************************************************************************/
  56168. /*! exports provided: render, staticRenderFns */
  56169. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  56170. "use strict";
  56171. __webpack_require__.r(__webpack_exports__);
  56172. /* 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&");
  56173. /* 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"]; });
  56174. /* 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"]; });
  56175. /***/ }),
  56176. /***/ "./resources/js/components/woinfo-edit-modal.vue":
  56177. /*!*******************************************************!*\
  56178. !*** ./resources/js/components/woinfo-edit-modal.vue ***!
  56179. \*******************************************************/
  56180. /*! exports provided: default */
  56181. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  56182. "use strict";
  56183. __webpack_require__.r(__webpack_exports__);
  56184. /* 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&");
  56185. /* 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&");
  56186. /* 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");
  56187. /* normalize component */
  56188. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  56189. _woinfo_edit_modal_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  56190. _woinfo_edit_modal_vue_vue_type_template_id_ad3662d4___WEBPACK_IMPORTED_MODULE_0__["render"],
  56191. _woinfo_edit_modal_vue_vue_type_template_id_ad3662d4___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  56192. false,
  56193. null,
  56194. null,
  56195. null
  56196. )
  56197. /* hot reload */
  56198. if (false) { var api; }
  56199. component.options.__file = "resources/js/components/woinfo-edit-modal.vue"
  56200. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  56201. /***/ }),
  56202. /***/ "./resources/js/components/woinfo-edit-modal.vue?vue&type=script&lang=js&":
  56203. /*!********************************************************************************!*\
  56204. !*** ./resources/js/components/woinfo-edit-modal.vue?vue&type=script&lang=js& ***!
  56205. \********************************************************************************/
  56206. /*! exports provided: default */
  56207. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  56208. "use strict";
  56209. __webpack_require__.r(__webpack_exports__);
  56210. /* 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&");
  56211. /* 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"]);
  56212. /***/ }),
  56213. /***/ "./resources/js/components/woinfo-edit-modal.vue?vue&type=template&id=ad3662d4&":
  56214. /*!**************************************************************************************!*\
  56215. !*** ./resources/js/components/woinfo-edit-modal.vue?vue&type=template&id=ad3662d4& ***!
  56216. \**************************************************************************************/
  56217. /*! exports provided: render, staticRenderFns */
  56218. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  56219. "use strict";
  56220. __webpack_require__.r(__webpack_exports__);
  56221. /* 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&");
  56222. /* 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"]; });
  56223. /* 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"]; });
  56224. /***/ }),
  56225. /***/ "./resources/js/components/woinfo.vue":
  56226. /*!********************************************!*\
  56227. !*** ./resources/js/components/woinfo.vue ***!
  56228. \********************************************/
  56229. /*! exports provided: default */
  56230. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  56231. "use strict";
  56232. __webpack_require__.r(__webpack_exports__);
  56233. /* 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&");
  56234. /* 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&");
  56235. /* 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");
  56236. /* normalize component */
  56237. var component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(
  56238. _woinfo_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__["default"],
  56239. _woinfo_vue_vue_type_template_id_33ce32de___WEBPACK_IMPORTED_MODULE_0__["render"],
  56240. _woinfo_vue_vue_type_template_id_33ce32de___WEBPACK_IMPORTED_MODULE_0__["staticRenderFns"],
  56241. false,
  56242. null,
  56243. null,
  56244. null
  56245. )
  56246. /* hot reload */
  56247. if (false) { var api; }
  56248. component.options.__file = "resources/js/components/woinfo.vue"
  56249. /* harmony default export */ __webpack_exports__["default"] = (component.exports);
  56250. /***/ }),
  56251. /***/ "./resources/js/components/woinfo.vue?vue&type=script&lang=js&":
  56252. /*!*********************************************************************!*\
  56253. !*** ./resources/js/components/woinfo.vue?vue&type=script&lang=js& ***!
  56254. \*********************************************************************/
  56255. /*! exports provided: default */
  56256. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  56257. "use strict";
  56258. __webpack_require__.r(__webpack_exports__);
  56259. /* 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&");
  56260. /* 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"]);
  56261. /***/ }),
  56262. /***/ "./resources/js/components/woinfo.vue?vue&type=template&id=33ce32de&":
  56263. /*!***************************************************************************!*\
  56264. !*** ./resources/js/components/woinfo.vue?vue&type=template&id=33ce32de& ***!
  56265. \***************************************************************************/
  56266. /*! exports provided: render, staticRenderFns */
  56267. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  56268. "use strict";
  56269. __webpack_require__.r(__webpack_exports__);
  56270. /* 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&");
  56271. /* 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"]; });
  56272. /* 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"]; });
  56273. /***/ }),
  56274. /***/ "./resources/js/mixins/dateMixin.js":
  56275. /*!******************************************!*\
  56276. !*** ./resources/js/mixins/dateMixin.js ***!
  56277. \******************************************/
  56278. /*! exports provided: default */
  56279. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  56280. "use strict";
  56281. __webpack_require__.r(__webpack_exports__);
  56282. /* harmony default export */ __webpack_exports__["default"] = ({
  56283. methods: {
  56284. treatAsUTC: function treatAsUTC(date) {
  56285. var result = new Date(date);
  56286. result.setMinutes(result.getMinutes() - result.getTimezoneOffset());
  56287. return result;
  56288. },
  56289. daysSinceToday: function daysSinceToday(date) {
  56290. var currentDate = new Date();
  56291. var millisecondsPerDay = 24 * 60 * 60 * 1000;
  56292. return (this.treatAsUTC(currentDate) - this.treatAsUTC(date)) / millisecondsPerDay;
  56293. },
  56294. getHRDate: function getHRDate(dateString) {
  56295. var date = new Date(dateString);
  56296. return date.toLocaleString('default', {
  56297. month: 'short',
  56298. day: 'numeric',
  56299. year: 'numeric',
  56300. hour: 'numeric',
  56301. minute: 'numeric'
  56302. });
  56303. },
  56304. isZero: function isZero(dateString) {
  56305. return dateString === '0000-00-00 00:00:00';
  56306. }
  56307. }
  56308. });
  56309. /***/ }),
  56310. /***/ "./resources/js/notify.min.js":
  56311. /*!************************************!*\
  56312. !*** ./resources/js/notify.min.js ***!
  56313. \************************************/
  56314. /*! no static exports found */
  56315. /***/ (function(module, exports, __webpack_require__) {
  56316. 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); }
  56317. (function (e) {
  56318. true ? !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js")], __WEBPACK_AMD_DEFINE_FACTORY__ = (e),
  56319. __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
  56320. (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
  56321. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)) : undefined;
  56322. })(function (e) {
  56323. function A(t, n, i) {
  56324. typeof i == "string" && (i = {
  56325. className: i
  56326. }), 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);
  56327. }
  56328. var t = [].indexOf || function (e) {
  56329. for (var t = 0, n = this.length; t < n; t++) {
  56330. if (t in this && this[t] === e) return t;
  56331. }
  56332. return -1;
  56333. },
  56334. n = "notify",
  56335. r = n + "js",
  56336. i = n + "!blank",
  56337. s = {
  56338. t: "top",
  56339. m: "middle",
  56340. b: "bottom",
  56341. l: "left",
  56342. c: "center",
  56343. r: "right"
  56344. },
  56345. o = ["l", "c", "r"],
  56346. u = ["t", "m", "b"],
  56347. a = ["t", "b", "l", "r"],
  56348. f = {
  56349. t: "b",
  56350. m: null,
  56351. b: "t",
  56352. l: "r",
  56353. c: null,
  56354. r: "l"
  56355. },
  56356. l = function l(t) {
  56357. var n;
  56358. return n = [], e.each(t.split(/\W+/), function (e, t) {
  56359. var r;
  56360. r = t.toLowerCase().charAt(0);
  56361. if (s[r]) return n.push(r);
  56362. }), n;
  56363. },
  56364. c = {},
  56365. h = {
  56366. name: "core",
  56367. html: '<div class="' + r + '-wrapper">\n <div class="' + r + '-arrow"></div>\n <div class="' + r + '-container"></div>\n</div>',
  56368. 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}"
  56369. },
  56370. p = {
  56371. "border-radius": ["-webkit-", "-moz-"]
  56372. },
  56373. d = function d(e) {
  56374. return c[e];
  56375. },
  56376. v = function v(e) {
  56377. if (!e) throw "Missing Style name";
  56378. c[e] && delete c[e];
  56379. },
  56380. m = function m(t, i) {
  56381. if (!t) throw "Missing Style name";
  56382. if (!i) throw "Missing Style definition";
  56383. if (!i.html) throw "Missing Style HTML";
  56384. var s = c[t];
  56385. s && s.cssElem && (window.console && console.warn(n + ": overwriting style '" + t + "'"), c[t].cssElem.remove()), i.name = t, c[t] = i;
  56386. var o = "";
  56387. i.classes && e.each(i.classes, function (t, n) {
  56388. return o += "." + r + "-" + i.name + "-" + t + " {\n", e.each(n, function (t, n) {
  56389. return p[t] && e.each(p[t], function (e, r) {
  56390. return o += " " + r + t + ": " + n + ";\n";
  56391. }), o += " " + t + ": " + n + ";\n";
  56392. }), o += "}\n";
  56393. }), i.css && (o += "/* styles for " + i.name + " */\n" + i.css), o && (i.cssElem = g(o), i.cssElem.attr("id", "notify-" + i.name));
  56394. var u = {},
  56395. a = e(i.html);
  56396. y("html", a, u), y("text", a, u), i.fields = u;
  56397. },
  56398. g = function g(t) {
  56399. var n, r, i;
  56400. r = x("style"), r.attr("type", "text/css"), e("head").append(r);
  56401. try {
  56402. r.html(t);
  56403. } catch (s) {
  56404. r[0].styleSheet.cssText = t;
  56405. }
  56406. return r;
  56407. },
  56408. y = function y(t, n, r) {
  56409. var s;
  56410. return t !== "html" && (t = "text"), s = "data-notify-" + t, b(n, "[" + s + "]").each(function () {
  56411. var n;
  56412. n = e(this).attr(s), n || (n = i), r[n] = t;
  56413. });
  56414. },
  56415. b = function b(e, t) {
  56416. return e.is(t) ? e : e.find(t);
  56417. },
  56418. w = {
  56419. clickToHide: !0,
  56420. autoHide: !0,
  56421. autoHideDelay: 5e3,
  56422. arrowShow: !0,
  56423. arrowSize: 5,
  56424. breakNewLines: !0,
  56425. elementPosition: "bottom",
  56426. globalPosition: "top right",
  56427. style: "bootstrap",
  56428. className: "error",
  56429. showAnimation: "slideDown",
  56430. showDuration: 400,
  56431. hideAnimation: "slideUp",
  56432. hideDuration: 200,
  56433. gap: 5
  56434. },
  56435. E = function E(t, n) {
  56436. var r;
  56437. return r = function r() {}, r.prototype = t, e.extend(!0, new r(), n);
  56438. },
  56439. S = function S(t) {
  56440. return e.extend(w, t);
  56441. },
  56442. x = function x(t) {
  56443. return e("<" + t + "></" + t + ">");
  56444. },
  56445. T = {},
  56446. N = function N(t) {
  56447. var n;
  56448. return t.is("[type=radio]") && (n = t.parents("form:first").find("[type=radio]").filter(function (n, r) {
  56449. return e(r).attr("name") === t.attr("name");
  56450. }), t = n.first()), t;
  56451. },
  56452. C = function C(e, t, n) {
  56453. var r, i;
  56454. if (typeof n == "string") n = parseInt(n, 10);else if (typeof n != "number") return;
  56455. if (isNaN(n)) return;
  56456. 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;
  56457. },
  56458. k = function k(e, t, n) {
  56459. if (e === "l" || e === "t") return 0;
  56460. if (e === "c" || e === "m") return n / 2 - t / 2;
  56461. if (e === "r" || e === "b") return n - t;
  56462. throw "Invalid alignment";
  56463. },
  56464. L = function L(e) {
  56465. return L.e = L.e || x("div"), L.e.text(e).html();
  56466. };
  56467. A.prototype.loadHTML = function () {
  56468. var t;
  56469. t = this.getStyle(), this.userContainer = e(t.html), this.userFields = t.fields;
  56470. }, A.prototype.show = function (e, t) {
  56471. var n, r, i, s, o;
  56472. r = function (n) {
  56473. return function () {
  56474. !e && !n.elem && n.destroy();
  56475. if (t) return t();
  56476. };
  56477. }(this), o = this.container.parent().parents(":hidden").length > 0, i = this.container.add(this.arrow), n = [];
  56478. 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 {
  56479. if (!!o || !!e) return r();
  56480. s = this.options.hideAnimation, n.push(this.options.hideDuration);
  56481. }
  56482. return n.push(r), i[s].apply(i, n);
  56483. }, A.prototype.setGlobalPosition = function () {
  56484. var t = this.getPosition(),
  56485. n = t[0],
  56486. i = t[1],
  56487. o = s[n],
  56488. u = s[i],
  56489. a = n + "|" + i,
  56490. f = T[a];
  56491. if (!f || !document.body.contains(f[0])) {
  56492. f = T[a] = x("div");
  56493. var l = {};
  56494. 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);
  56495. }
  56496. return f.prepend(this.wrapper);
  56497. }, A.prototype.setElementPosition = function () {
  56498. 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;
  56499. 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"];
  56500. for (w = 0, S = B.length; w < S; w++) {
  56501. D = B[w], N = parseInt(this.elem.css("margin-" + D), 10), N && C(p, D, N);
  56502. }
  56503. b = Math.max(0, this.options.gap - (this.options.arrowShow ? i : 0)), C(p, A, b);
  56504. if (!this.options.arrowShow) this.arrow.hide();else {
  56505. 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";
  56506. for (E = 0, x = a.length; E < x; E++) {
  56507. D = a[E], P = s[D];
  56508. if (D === L) continue;
  56509. l = P === T ? n : "transparent", r["border-" + P] = i + "px solid " + l;
  56510. }
  56511. C(p, s[L], i), t.call(a, O) >= 0 && C(r, s[O], i * 2);
  56512. }
  56513. 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);
  56514. if (r) return this.arrow.removeAttr("style").css(r);
  56515. }, A.prototype.getPosition = function () {
  56516. var e, n, r, i, s, f, c, h;
  56517. h = this.options.position || (this.elem ? this.options.elementPosition : this.options.globalPosition), e = l(h), e.length === 0 && (e[0] = "b");
  56518. if (n = e[0], t.call(a, n) < 0) throw "Must be one of [" + a + "]";
  56519. 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";
  56520. return e.length === 2 && (e[2] = e[1]), e;
  56521. }, A.prototype.getStyle = function (e) {
  56522. var t;
  56523. e || (e = this.options.style), e || (e = "default"), t = c[e];
  56524. if (!t) throw "Missing style: " + e;
  56525. return t;
  56526. }, A.prototype.updateClasses = function () {
  56527. var t, n;
  56528. 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) {
  56529. return r + "-" + n.name + "-" + e;
  56530. }).join(" "), this.userContainer.attr("class", t);
  56531. }, A.prototype.run = function (t, n) {
  56532. var r, s, o, u, a;
  56533. e.isPlainObject(n) ? e.extend(this.options, n) : e.type(n) === "string" && (this.options.className = n);
  56534. if (this.container && !t) {
  56535. this.show(!1);
  56536. return;
  56537. }
  56538. if (!this.container && !t) return;
  56539. s = {}, e.isPlainObject(t) ? s = t : s[i] = t;
  56540. for (o in s) {
  56541. r = s[o], u = this.userFields[o];
  56542. if (!u) continue;
  56543. 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);
  56544. }
  56545. 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));
  56546. }, A.prototype.destroy = function () {
  56547. this.wrapper.data(r, null), this.wrapper.remove();
  56548. }, e[n] = function (t, r, i) {
  56549. return t && t.nodeName || t.jquery ? e(t)[n](r, i) : (i = r, r = t, new A(null, r, i)), t;
  56550. }, e.fn[n] = function (t, n) {
  56551. return e(this).each(function () {
  56552. var i = N(e(this)).data(r);
  56553. i && i.destroy();
  56554. var s = new A(e(this), t, n);
  56555. }), this;
  56556. }, e.extend(e[n], {
  56557. defaults: S,
  56558. addStyle: m,
  56559. removeStyle: v,
  56560. pluginOptions: w,
  56561. getStyle: d,
  56562. insertCSS: g
  56563. }), m("bootstrap", {
  56564. html: "<div>\n<span data-notify-text></span>\n</div>",
  56565. classes: {
  56566. base: {
  56567. "font-weight": "bold",
  56568. padding: "8px 15px 8px 14px",
  56569. "text-shadow": "0 1px 0 rgba(255, 255, 255, 0.5)",
  56570. "background-color": "#fcf8e3",
  56571. border: "1px solid #fbeed5",
  56572. "border-radius": "4px",
  56573. "white-space": "nowrap",
  56574. "padding-left": "25px",
  56575. "background-repeat": "no-repeat",
  56576. "background-position": "3px 7px"
  56577. },
  56578. error: {
  56579. color: "#B94A48",
  56580. "background-color": "#F2DEDE",
  56581. "border-color": "#EED3D7",
  56582. "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=)"
  56583. },
  56584. success: {
  56585. color: "#468847",
  56586. "background-color": "#DFF0D8",
  56587. "border-color": "#D6E9C6",
  56588. "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==)"
  56589. },
  56590. info: {
  56591. color: "#3A87AD",
  56592. "background-color": "#D9EDF7",
  56593. "border-color": "#BCE8F1",
  56594. "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=)"
  56595. },
  56596. warn: {
  56597. color: "#C09853",
  56598. "background-color": "#FCF8E3",
  56599. "border-color": "#FBEED5",
  56600. "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)"
  56601. }
  56602. }
  56603. }), e(function () {
  56604. g(h.css).attr("id", "core-notify"), e(document).on("click", "." + r + "-hidable", function (t) {
  56605. e(this).trigger("notify-hide");
  56606. }), e(document).on("notify-hide", "." + r + "-wrapper", function (t) {
  56607. var n = e(this).data(r);
  56608. n && n.show(!1);
  56609. });
  56610. });
  56611. });
  56612. /***/ }),
  56613. /***/ "./resources/sass/app.scss":
  56614. /*!*********************************!*\
  56615. !*** ./resources/sass/app.scss ***!
  56616. \*********************************/
  56617. /*! no static exports found */
  56618. /***/ (function(module, exports) {
  56619. // removed by extract-text-webpack-plugin
  56620. /***/ }),
  56621. /***/ 0:
  56622. /*!*************************************************************!*\
  56623. !*** multi ./resources/js/app.js ./resources/sass/app.scss ***!
  56624. \*************************************************************/
  56625. /*! no static exports found */
  56626. /***/ (function(module, exports, __webpack_require__) {
  56627. __webpack_require__(/*! /home/vagrant/upccrt/resources/js/app.js */"./resources/js/app.js");
  56628. module.exports = __webpack_require__(/*! /home/vagrant/upccrt/resources/sass/app.scss */"./resources/sass/app.scss");
  56629. /***/ })
  56630. /******/ });