1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191151921519315194151951519615197151981519915200152011520215203152041520515206152071520815209152101521115212152131521415215152161521715218152191522015221152221522315224152251522615227152281522915230152311523215233152341523515236152371523815239152401524115242152431524415245152461524715248152491525015251152521525315254152551525615257152581525915260152611526215263152641526515266152671526815269152701527115272152731527415275152761527715278152791528015281152821528315284152851528615287152881528915290152911529215293152941529515296152971529815299153001530115302153031530415305153061530715308153091531015311153121531315314153151531615317153181531915320 |
- (function (global, factory) {
- typeof exports === 'object' && typeof module !== 'undefined' ? factory() :
- typeof define === 'function' && define.amd ? define(factory) :
- (factory());
- }(this, (function () { 'use strict';
- function unwrapExports (x) {
- return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
- }
- function createCommonjsModule(fn, module) {
- return module = { exports: {} }, fn(module, module.exports), module.exports;
- }
- var _global = createCommonjsModule(function (module) {
- // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
- var global = module.exports = typeof window != 'undefined' && window.Math == Math
- ? window : typeof self != 'undefined' && self.Math == Math ? self
- // eslint-disable-next-line no-new-func
- : Function('return this')();
- if (typeof __g == 'number') __g = global; // eslint-disable-line no-undef
- });
- var _core = createCommonjsModule(function (module) {
- var core = module.exports = { version: '2.5.7' };
- if (typeof __e == 'number') __e = core; // eslint-disable-line no-undef
- });
- var _core_1 = _core.version;
- var _aFunction = function (it) {
- if (typeof it != 'function') throw TypeError(it + ' is not a function!');
- return it;
- };
- // optional / simple context binding
- var _ctx = function (fn, that, length) {
- _aFunction(fn);
- if (that === undefined) return fn;
- switch (length) {
- case 1: return function (a) {
- return fn.call(that, a);
- };
- case 2: return function (a, b) {
- return fn.call(that, a, b);
- };
- case 3: return function (a, b, c) {
- return fn.call(that, a, b, c);
- };
- }
- return function (/* ...args */) {
- return fn.apply(that, arguments);
- };
- };
- var _isObject = function (it) {
- return typeof it === 'object' ? it !== null : typeof it === 'function';
- };
- var _anObject = function (it) {
- if (!_isObject(it)) throw TypeError(it + ' is not an object!');
- return it;
- };
- var _fails = function (exec) {
- try {
- return !!exec();
- } catch (e) {
- return true;
- }
- };
- // Thank's IE8 for his funny defineProperty
- var _descriptors = !_fails(function () {
- return Object.defineProperty({}, 'a', { get: function () { return 7; } }).a != 7;
- });
- var document$1 = _global.document;
- // typeof document.createElement is 'object' in old IE
- var is = _isObject(document$1) && _isObject(document$1.createElement);
- var _domCreate = function (it) {
- return is ? document$1.createElement(it) : {};
- };
- var _ie8DomDefine = !_descriptors && !_fails(function () {
- return Object.defineProperty(_domCreate('div'), 'a', { get: function () { return 7; } }).a != 7;
- });
- // 7.1.1 ToPrimitive(input [, PreferredType])
- // instead of the ES6 spec version, we didn't implement @@toPrimitive case
- // and the second argument - flag - preferred type is a string
- var _toPrimitive = function (it, S) {
- if (!_isObject(it)) return it;
- var fn, val;
- if (S && typeof (fn = it.toString) == 'function' && !_isObject(val = fn.call(it))) return val;
- if (typeof (fn = it.valueOf) == 'function' && !_isObject(val = fn.call(it))) return val;
- if (!S && typeof (fn = it.toString) == 'function' && !_isObject(val = fn.call(it))) return val;
- throw TypeError("Can't convert object to primitive value");
- };
- var dP = Object.defineProperty;
- var f = _descriptors ? Object.defineProperty : function defineProperty(O, P, Attributes) {
- _anObject(O);
- P = _toPrimitive(P, true);
- _anObject(Attributes);
- if (_ie8DomDefine) try {
- return dP(O, P, Attributes);
- } catch (e) { /* empty */ }
- if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported!');
- if ('value' in Attributes) O[P] = Attributes.value;
- return O;
- };
- var _objectDp = {
- f: f
- };
- var _propertyDesc = function (bitmap, value) {
- return {
- enumerable: !(bitmap & 1),
- configurable: !(bitmap & 2),
- writable: !(bitmap & 4),
- value: value
- };
- };
- var _hide = _descriptors ? function (object, key, value) {
- return _objectDp.f(object, key, _propertyDesc(1, value));
- } : function (object, key, value) {
- object[key] = value;
- return object;
- };
- var hasOwnProperty = {}.hasOwnProperty;
- var _has = function (it, key) {
- return hasOwnProperty.call(it, key);
- };
- var PROTOTYPE = 'prototype';
- var $export = function (type, name, source) {
- var IS_FORCED = type & $export.F;
- var IS_GLOBAL = type & $export.G;
- var IS_STATIC = type & $export.S;
- var IS_PROTO = type & $export.P;
- var IS_BIND = type & $export.B;
- var IS_WRAP = type & $export.W;
- var exports = IS_GLOBAL ? _core : _core[name] || (_core[name] = {});
- var expProto = exports[PROTOTYPE];
- var target = IS_GLOBAL ? _global : IS_STATIC ? _global[name] : (_global[name] || {})[PROTOTYPE];
- var key, own, out;
- if (IS_GLOBAL) source = name;
- for (key in source) {
- // contains in native
- own = !IS_FORCED && target && target[key] !== undefined;
- if (own && _has(exports, key)) continue;
- // export native or passed
- out = own ? target[key] : source[key];
- // prevent global pollution for namespaces
- exports[key] = IS_GLOBAL && typeof target[key] != 'function' ? source[key]
- // bind timers to global for call from export context
- : IS_BIND && own ? _ctx(out, _global)
- // wrap global constructors for prevent change them in library
- : IS_WRAP && target[key] == out ? (function (C) {
- var F = function (a, b, c) {
- if (this instanceof C) {
- switch (arguments.length) {
- case 0: return new C();
- case 1: return new C(a);
- case 2: return new C(a, b);
- } return new C(a, b, c);
- } return C.apply(this, arguments);
- };
- F[PROTOTYPE] = C[PROTOTYPE];
- return F;
- // make static versions for prototype methods
- })(out) : IS_PROTO && typeof out == 'function' ? _ctx(Function.call, out) : out;
- // export proto methods to core.%CONSTRUCTOR%.methods.%NAME%
- if (IS_PROTO) {
- (exports.virtual || (exports.virtual = {}))[key] = out;
- // export proto methods to core.%CONSTRUCTOR%.prototype.%NAME%
- if (type & $export.R && expProto && !expProto[key]) _hide(expProto, key, out);
- }
- }
- };
- // type bitmap
- $export.F = 1; // forced
- $export.G = 2; // global
- $export.S = 4; // static
- $export.P = 8; // proto
- $export.B = 16; // bind
- $export.W = 32; // wrap
- $export.U = 64; // safe
- $export.R = 128; // real proto method for `library`
- var _export = $export;
- var toString$1 = {}.toString;
- var _cof = function (it) {
- return toString$1.call(it).slice(8, -1);
- };
- // fallback for non-array-like ES3 and non-enumerable old V8 strings
- // eslint-disable-next-line no-prototype-builtins
- var _iobject = Object('z').propertyIsEnumerable(0) ? Object : function (it) {
- return _cof(it) == 'String' ? it.split('') : Object(it);
- };
- // 7.2.1 RequireObjectCoercible(argument)
- var _defined = function (it) {
- if (it == undefined) throw TypeError("Can't call method on " + it);
- return it;
- };
- // to indexed object, toObject with fallback for non-array-like ES3 strings
- var _toIobject = function (it) {
- return _iobject(_defined(it));
- };
- // 7.1.4 ToInteger
- var ceil = Math.ceil;
- var floor = Math.floor;
- var _toInteger = function (it) {
- return isNaN(it = +it) ? 0 : (it > 0 ? floor : ceil)(it);
- };
- // 7.1.15 ToLength
- var min = Math.min;
- var _toLength = function (it) {
- return it > 0 ? min(_toInteger(it), 0x1fffffffffffff) : 0; // pow(2, 53) - 1 == 9007199254740991
- };
- var max = Math.max;
- var min$1 = Math.min;
- var _toAbsoluteIndex = function (index, length) {
- index = _toInteger(index);
- return index < 0 ? max(index + length, 0) : min$1(index, length);
- };
- // false -> Array#indexOf
- // true -> Array#includes
- var _arrayIncludes = function (IS_INCLUDES) {
- return function ($this, el, fromIndex) {
- var O = _toIobject($this);
- var length = _toLength(O.length);
- var index = _toAbsoluteIndex(fromIndex, length);
- var value;
- // Array#includes uses SameValueZero equality algorithm
- // eslint-disable-next-line no-self-compare
- if (IS_INCLUDES && el != el) while (length > index) {
- value = O[index++];
- // eslint-disable-next-line no-self-compare
- if (value != value) return true;
- // Array#indexOf ignores holes, Array#includes - not
- } else for (;length > index; index++) if (IS_INCLUDES || index in O) {
- if (O[index] === el) return IS_INCLUDES || index || 0;
- } return !IS_INCLUDES && -1;
- };
- };
- var _library = true;
- var _shared = createCommonjsModule(function (module) {
- var SHARED = '__core-js_shared__';
- var store = _global[SHARED] || (_global[SHARED] = {});
- (module.exports = function (key, value) {
- return store[key] || (store[key] = value !== undefined ? value : {});
- })('versions', []).push({
- version: _core.version,
- mode: _library ? 'pure' : 'global',
- copyright: '© 2018 Denis Pushkarev (zloirock.ru)'
- });
- });
- var id = 0;
- var px = Math.random();
- var _uid = function (key) {
- return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id + px).toString(36));
- };
- var shared = _shared('keys');
- var _sharedKey = function (key) {
- return shared[key] || (shared[key] = _uid(key));
- };
- var arrayIndexOf = _arrayIncludes(false);
- var IE_PROTO = _sharedKey('IE_PROTO');
- var _objectKeysInternal = function (object, names) {
- var O = _toIobject(object);
- var i = 0;
- var result = [];
- var key;
- for (key in O) if (key != IE_PROTO) _has(O, key) && result.push(key);
- // Don't enum bug & hidden keys
- while (names.length > i) if (_has(O, key = names[i++])) {
- ~arrayIndexOf(result, key) || result.push(key);
- }
- return result;
- };
- // IE 8- don't enum bug keys
- var _enumBugKeys = (
- 'constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf'
- ).split(',');
- // 19.1.2.14 / 15.2.3.14 Object.keys(O)
- var _objectKeys = Object.keys || function keys(O) {
- return _objectKeysInternal(O, _enumBugKeys);
- };
- var f$1 = Object.getOwnPropertySymbols;
- var _objectGops = {
- f: f$1
- };
- var f$2 = {}.propertyIsEnumerable;
- var _objectPie = {
- f: f$2
- };
- // 7.1.13 ToObject(argument)
- var _toObject = function (it) {
- return Object(_defined(it));
- };
- // 19.1.2.1 Object.assign(target, source, ...)
- var $assign = Object.assign;
- // should work with symbols and should have deterministic property order (V8 bug)
- var _objectAssign = !$assign || _fails(function () {
- var A = {};
- var B = {};
- // eslint-disable-next-line no-undef
- var S = Symbol();
- var K = 'abcdefghijklmnopqrst';
- A[S] = 7;
- K.split('').forEach(function (k) { B[k] = k; });
- return $assign({}, A)[S] != 7 || Object.keys($assign({}, B)).join('') != K;
- }) ? function assign(target, source) { // eslint-disable-line no-unused-vars
- var T = _toObject(target);
- var aLen = arguments.length;
- var index = 1;
- var getSymbols = _objectGops.f;
- var isEnum = _objectPie.f;
- while (aLen > index) {
- var S = _iobject(arguments[index++]);
- var keys = getSymbols ? _objectKeys(S).concat(getSymbols(S)) : _objectKeys(S);
- var length = keys.length;
- var j = 0;
- var key;
- while (length > j) if (isEnum.call(S, key = keys[j++])) T[key] = S[key];
- } return T;
- } : $assign;
- // 19.1.3.1 Object.assign(target, source)
- _export(_export.S + _export.F, 'Object', { assign: _objectAssign });
- var assign = _core.Object.assign;
- var assign$1 = createCommonjsModule(function (module) {
- module.exports = { "default": assign, __esModule: true };
- });
- var _Object$assign = unwrapExports(assign$1);
- // true -> String#at
- // false -> String#codePointAt
- var _stringAt = function (TO_STRING) {
- return function (that, pos) {
- var s = String(_defined(that));
- var i = _toInteger(pos);
- var l = s.length;
- var a, b;
- if (i < 0 || i >= l) return TO_STRING ? '' : undefined;
- a = s.charCodeAt(i);
- return a < 0xd800 || a > 0xdbff || i + 1 === l || (b = s.charCodeAt(i + 1)) < 0xdc00 || b > 0xdfff
- ? TO_STRING ? s.charAt(i) : a
- : TO_STRING ? s.slice(i, i + 2) : (a - 0xd800 << 10) + (b - 0xdc00) + 0x10000;
- };
- };
- var _redefine = _hide;
- var _iterators = {};
- var _objectDps = _descriptors ? Object.defineProperties : function defineProperties(O, Properties) {
- _anObject(O);
- var keys = _objectKeys(Properties);
- var length = keys.length;
- var i = 0;
- var P;
- while (length > i) _objectDp.f(O, P = keys[i++], Properties[P]);
- return O;
- };
- var document$2 = _global.document;
- var _html = document$2 && document$2.documentElement;
- // 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties])
- var IE_PROTO$1 = _sharedKey('IE_PROTO');
- var Empty = function () { /* empty */ };
- var PROTOTYPE$1 = 'prototype';
- // Create object with fake `null` prototype: use iframe Object with cleared prototype
- var createDict = function () {
- // Thrash, waste and sodomy: IE GC bug
- var iframe = _domCreate('iframe');
- var i = _enumBugKeys.length;
- var lt = '<';
- var gt = '>';
- var iframeDocument;
- iframe.style.display = 'none';
- _html.appendChild(iframe);
- iframe.src = 'javascript:'; // eslint-disable-line no-script-url
- // createDict = iframe.contentWindow.Object;
- // html.removeChild(iframe);
- iframeDocument = iframe.contentWindow.document;
- iframeDocument.open();
- iframeDocument.write(lt + 'script' + gt + 'document.F=Object' + lt + '/script' + gt);
- iframeDocument.close();
- createDict = iframeDocument.F;
- while (i--) delete createDict[PROTOTYPE$1][_enumBugKeys[i]];
- return createDict();
- };
- var _objectCreate = Object.create || function create(O, Properties) {
- var result;
- if (O !== null) {
- Empty[PROTOTYPE$1] = _anObject(O);
- result = new Empty();
- Empty[PROTOTYPE$1] = null;
- // add "__proto__" for Object.getPrototypeOf polyfill
- result[IE_PROTO$1] = O;
- } else result = createDict();
- return Properties === undefined ? result : _objectDps(result, Properties);
- };
- var _wks = createCommonjsModule(function (module) {
- var store = _shared('wks');
- var Symbol = _global.Symbol;
- var USE_SYMBOL = typeof Symbol == 'function';
- var $exports = module.exports = function (name) {
- return store[name] || (store[name] =
- USE_SYMBOL && Symbol[name] || (USE_SYMBOL ? Symbol : _uid)('Symbol.' + name));
- };
- $exports.store = store;
- });
- var def = _objectDp.f;
- var TAG = _wks('toStringTag');
- var _setToStringTag = function (it, tag, stat) {
- if (it && !_has(it = stat ? it : it.prototype, TAG)) def(it, TAG, { configurable: true, value: tag });
- };
- var IteratorPrototype = {};
- // 25.1.2.1.1 %IteratorPrototype%[@@iterator]()
- _hide(IteratorPrototype, _wks('iterator'), function () { return this; });
- var _iterCreate = function (Constructor, NAME, next) {
- Constructor.prototype = _objectCreate(IteratorPrototype, { next: _propertyDesc(1, next) });
- _setToStringTag(Constructor, NAME + ' Iterator');
- };
- // 19.1.2.9 / 15.2.3.2 Object.getPrototypeOf(O)
- var IE_PROTO$2 = _sharedKey('IE_PROTO');
- var ObjectProto = Object.prototype;
- var _objectGpo = Object.getPrototypeOf || function (O) {
- O = _toObject(O);
- if (_has(O, IE_PROTO$2)) return O[IE_PROTO$2];
- if (typeof O.constructor == 'function' && O instanceof O.constructor) {
- return O.constructor.prototype;
- } return O instanceof Object ? ObjectProto : null;
- };
- var ITERATOR = _wks('iterator');
- var BUGGY = !([].keys && 'next' in [].keys()); // Safari has buggy iterators w/o `next`
- var FF_ITERATOR = '@@iterator';
- var KEYS = 'keys';
- var VALUES = 'values';
- var returnThis = function () { return this; };
- var _iterDefine = function (Base, NAME, Constructor, next, DEFAULT, IS_SET, FORCED) {
- _iterCreate(Constructor, NAME, next);
- var getMethod = function (kind) {
- if (!BUGGY && kind in proto) return proto[kind];
- switch (kind) {
- case KEYS: return function keys() { return new Constructor(this, kind); };
- case VALUES: return function values() { return new Constructor(this, kind); };
- } return function entries() { return new Constructor(this, kind); };
- };
- var TAG = NAME + ' Iterator';
- var DEF_VALUES = DEFAULT == VALUES;
- var VALUES_BUG = false;
- var proto = Base.prototype;
- var $native = proto[ITERATOR] || proto[FF_ITERATOR] || DEFAULT && proto[DEFAULT];
- var $default = $native || getMethod(DEFAULT);
- var $entries = DEFAULT ? !DEF_VALUES ? $default : getMethod('entries') : undefined;
- var $anyNative = NAME == 'Array' ? proto.entries || $native : $native;
- var methods, key, IteratorPrototype;
- // Fix native
- if ($anyNative) {
- IteratorPrototype = _objectGpo($anyNative.call(new Base()));
- if (IteratorPrototype !== Object.prototype && IteratorPrototype.next) {
- // Set @@toStringTag to native iterators
- _setToStringTag(IteratorPrototype, TAG, true);
- // fix for some old engines
- if (!_library && typeof IteratorPrototype[ITERATOR] != 'function') _hide(IteratorPrototype, ITERATOR, returnThis);
- }
- }
- // fix Array#{values, @@iterator}.name in V8 / FF
- if (DEF_VALUES && $native && $native.name !== VALUES) {
- VALUES_BUG = true;
- $default = function values() { return $native.call(this); };
- }
- // Define iterator
- if ((!_library || FORCED) && (BUGGY || VALUES_BUG || !proto[ITERATOR])) {
- _hide(proto, ITERATOR, $default);
- }
- // Plug for library
- _iterators[NAME] = $default;
- _iterators[TAG] = returnThis;
- if (DEFAULT) {
- methods = {
- values: DEF_VALUES ? $default : getMethod(VALUES),
- keys: IS_SET ? $default : getMethod(KEYS),
- entries: $entries
- };
- if (FORCED) for (key in methods) {
- if (!(key in proto)) _redefine(proto, key, methods[key]);
- } else _export(_export.P + _export.F * (BUGGY || VALUES_BUG), NAME, methods);
- }
- return methods;
- };
- var $at = _stringAt(true);
- // 21.1.3.27 String.prototype[@@iterator]()
- _iterDefine(String, 'String', function (iterated) {
- this._t = String(iterated); // target
- this._i = 0; // next index
- // 21.1.5.2.1 %StringIteratorPrototype%.next()
- }, function () {
- var O = this._t;
- var index = this._i;
- var point;
- if (index >= O.length) return { value: undefined, done: true };
- point = $at(O, index);
- this._i += point.length;
- return { value: point, done: false };
- });
- var _iterStep = function (done, value) {
- return { value: value, done: !!done };
- };
- // 22.1.3.4 Array.prototype.entries()
- // 22.1.3.13 Array.prototype.keys()
- // 22.1.3.29 Array.prototype.values()
- // 22.1.3.30 Array.prototype[@@iterator]()
- var es6_array_iterator = _iterDefine(Array, 'Array', function (iterated, kind) {
- this._t = _toIobject(iterated); // target
- this._i = 0; // next index
- this._k = kind; // kind
- // 22.1.5.2.1 %ArrayIteratorPrototype%.next()
- }, function () {
- var O = this._t;
- var kind = this._k;
- var index = this._i++;
- if (!O || index >= O.length) {
- this._t = undefined;
- return _iterStep(1);
- }
- if (kind == 'keys') return _iterStep(0, index);
- if (kind == 'values') return _iterStep(0, O[index]);
- return _iterStep(0, [index, O[index]]);
- }, 'values');
- // argumentsList[@@iterator] is %ArrayProto_values% (9.4.4.6, 9.4.4.7)
- _iterators.Arguments = _iterators.Array;
- var TO_STRING_TAG = _wks('toStringTag');
- var DOMIterables = ('CSSRuleList,CSSStyleDeclaration,CSSValueList,ClientRectList,DOMRectList,DOMStringList,' +
- 'DOMTokenList,DataTransferItemList,FileList,HTMLAllCollection,HTMLCollection,HTMLFormElement,HTMLSelectElement,' +
- 'MediaList,MimeTypeArray,NamedNodeMap,NodeList,PaintRequestList,Plugin,PluginArray,SVGLengthList,SVGNumberList,' +
- 'SVGPathSegList,SVGPointList,SVGStringList,SVGTransformList,SourceBufferList,StyleSheetList,TextTrackCueList,' +
- 'TextTrackList,TouchList').split(',');
- for (var i = 0; i < DOMIterables.length; i++) {
- var NAME = DOMIterables[i];
- var Collection = _global[NAME];
- var proto = Collection && Collection.prototype;
- if (proto && !proto[TO_STRING_TAG]) _hide(proto, TO_STRING_TAG, NAME);
- _iterators[NAME] = _iterators.Array;
- }
- // getting tag from 19.1.3.6 Object.prototype.toString()
- var TAG$1 = _wks('toStringTag');
- // ES3 wrong here
- var ARG = _cof(function () { return arguments; }()) == 'Arguments';
- // fallback for IE11 Script Access Denied error
- var tryGet = function (it, key) {
- try {
- return it[key];
- } catch (e) { /* empty */ }
- };
- var _classof = function (it) {
- var O, T, B;
- return it === undefined ? 'Undefined' : it === null ? 'Null'
- // @@toStringTag case
- : typeof (T = tryGet(O = Object(it), TAG$1)) == 'string' ? T
- // builtinTag case
- : ARG ? _cof(O)
- // ES3 arguments fallback
- : (B = _cof(O)) == 'Object' && typeof O.callee == 'function' ? 'Arguments' : B;
- };
- var _anInstance = function (it, Constructor, name, forbiddenField) {
- if (!(it instanceof Constructor) || (forbiddenField !== undefined && forbiddenField in it)) {
- throw TypeError(name + ': incorrect invocation!');
- } return it;
- };
- // call something on iterator step with safe closing on error
- var _iterCall = function (iterator, fn, value, entries) {
- try {
- return entries ? fn(_anObject(value)[0], value[1]) : fn(value);
- // 7.4.6 IteratorClose(iterator, completion)
- } catch (e) {
- var ret = iterator['return'];
- if (ret !== undefined) _anObject(ret.call(iterator));
- throw e;
- }
- };
- // check on default Array iterator
- var ITERATOR$1 = _wks('iterator');
- var ArrayProto = Array.prototype;
- var _isArrayIter = function (it) {
- return it !== undefined && (_iterators.Array === it || ArrayProto[ITERATOR$1] === it);
- };
- var ITERATOR$2 = _wks('iterator');
- var core_getIteratorMethod = _core.getIteratorMethod = function (it) {
- if (it != undefined) return it[ITERATOR$2]
- || it['@@iterator']
- || _iterators[_classof(it)];
- };
- var _forOf = createCommonjsModule(function (module) {
- var BREAK = {};
- var RETURN = {};
- var exports = module.exports = function (iterable, entries, fn, that, ITERATOR) {
- var iterFn = ITERATOR ? function () { return iterable; } : core_getIteratorMethod(iterable);
- var f = _ctx(fn, that, entries ? 2 : 1);
- var index = 0;
- var length, step, iterator, result;
- if (typeof iterFn != 'function') throw TypeError(iterable + ' is not iterable!');
- // fast case for arrays with default iterator
- if (_isArrayIter(iterFn)) for (length = _toLength(iterable.length); length > index; index++) {
- result = entries ? f(_anObject(step = iterable[index])[0], step[1]) : f(iterable[index]);
- if (result === BREAK || result === RETURN) return result;
- } else for (iterator = iterFn.call(iterable); !(step = iterator.next()).done;) {
- result = _iterCall(iterator, f, step.value, entries);
- if (result === BREAK || result === RETURN) return result;
- }
- };
- exports.BREAK = BREAK;
- exports.RETURN = RETURN;
- });
- // 7.3.20 SpeciesConstructor(O, defaultConstructor)
- var SPECIES = _wks('species');
- var _speciesConstructor = function (O, D) {
- var C = _anObject(O).constructor;
- var S;
- return C === undefined || (S = _anObject(C)[SPECIES]) == undefined ? D : _aFunction(S);
- };
- // fast apply, http://jsperf.lnkit.com/fast-apply/5
- var _invoke = function (fn, args, that) {
- var un = that === undefined;
- switch (args.length) {
- case 0: return un ? fn()
- : fn.call(that);
- case 1: return un ? fn(args[0])
- : fn.call(that, args[0]);
- case 2: return un ? fn(args[0], args[1])
- : fn.call(that, args[0], args[1]);
- case 3: return un ? fn(args[0], args[1], args[2])
- : fn.call(that, args[0], args[1], args[2]);
- case 4: return un ? fn(args[0], args[1], args[2], args[3])
- : fn.call(that, args[0], args[1], args[2], args[3]);
- } return fn.apply(that, args);
- };
- var process = _global.process;
- var setTask = _global.setImmediate;
- var clearTask = _global.clearImmediate;
- var MessageChannel = _global.MessageChannel;
- var Dispatch = _global.Dispatch;
- var counter = 0;
- var queue = {};
- var ONREADYSTATECHANGE = 'onreadystatechange';
- var defer, channel, port;
- var run = function () {
- var id = +this;
- // eslint-disable-next-line no-prototype-builtins
- if (queue.hasOwnProperty(id)) {
- var fn = queue[id];
- delete queue[id];
- fn();
- }
- };
- var listener = function (event) {
- run.call(event.data);
- };
- // Node.js 0.9+ & IE10+ has setImmediate, otherwise:
- if (!setTask || !clearTask) {
- setTask = function setImmediate(fn) {
- var args = [];
- var i = 1;
- while (arguments.length > i) args.push(arguments[i++]);
- queue[++counter] = function () {
- // eslint-disable-next-line no-new-func
- _invoke(typeof fn == 'function' ? fn : Function(fn), args);
- };
- defer(counter);
- return counter;
- };
- clearTask = function clearImmediate(id) {
- delete queue[id];
- };
- // Node.js 0.8-
- if (_cof(process) == 'process') {
- defer = function (id) {
- process.nextTick(_ctx(run, id, 1));
- };
- // Sphere (JS game engine) Dispatch API
- } else if (Dispatch && Dispatch.now) {
- defer = function (id) {
- Dispatch.now(_ctx(run, id, 1));
- };
- // Browsers with MessageChannel, includes WebWorkers
- } else if (MessageChannel) {
- channel = new MessageChannel();
- port = channel.port2;
- channel.port1.onmessage = listener;
- defer = _ctx(port.postMessage, port, 1);
- // Browsers with postMessage, skip WebWorkers
- // IE8 has postMessage, but it's sync & typeof its postMessage is 'object'
- } else if (_global.addEventListener && typeof postMessage == 'function' && !_global.importScripts) {
- defer = function (id) {
- _global.postMessage(id + '', '*');
- };
- _global.addEventListener('message', listener, false);
- // IE8-
- } else if (ONREADYSTATECHANGE in _domCreate('script')) {
- defer = function (id) {
- _html.appendChild(_domCreate('script'))[ONREADYSTATECHANGE] = function () {
- _html.removeChild(this);
- run.call(id);
- };
- };
- // Rest old browsers
- } else {
- defer = function (id) {
- setTimeout(_ctx(run, id, 1), 0);
- };
- }
- }
- var _task = {
- set: setTask,
- clear: clearTask
- };
- var macrotask = _task.set;
- var Observer = _global.MutationObserver || _global.WebKitMutationObserver;
- var process$1 = _global.process;
- var Promise = _global.Promise;
- var isNode = _cof(process$1) == 'process';
- var _microtask = function () {
- var head, last, notify;
- var flush = function () {
- var parent, fn;
- if (isNode && (parent = process$1.domain)) parent.exit();
- while (head) {
- fn = head.fn;
- head = head.next;
- try {
- fn();
- } catch (e) {
- if (head) notify();
- else last = undefined;
- throw e;
- }
- } last = undefined;
- if (parent) parent.enter();
- };
- // Node.js
- if (isNode) {
- notify = function () {
- process$1.nextTick(flush);
- };
- // browsers with MutationObserver, except iOS Safari - https://github.com/zloirock/core-js/issues/339
- } else if (Observer && !(_global.navigator && _global.navigator.standalone)) {
- var toggle = true;
- var node = document.createTextNode('');
- new Observer(flush).observe(node, { characterData: true }); // eslint-disable-line no-new
- notify = function () {
- node.data = toggle = !toggle;
- };
- // environments with maybe non-completely correct, but existent Promise
- } else if (Promise && Promise.resolve) {
- // Promise.resolve without an argument throws an error in LG WebOS 2
- var promise = Promise.resolve(undefined);
- notify = function () {
- promise.then(flush);
- };
- // for other environments - macrotask based on:
- // - setImmediate
- // - MessageChannel
- // - window.postMessag
- // - onreadystatechange
- // - setTimeout
- } else {
- notify = function () {
- // strange IE + webpack dev server bug - use .call(global)
- macrotask.call(_global, flush);
- };
- }
- return function (fn) {
- var task = { fn: fn, next: undefined };
- if (last) last.next = task;
- if (!head) {
- head = task;
- notify();
- } last = task;
- };
- };
- // 25.4.1.5 NewPromiseCapability(C)
- function PromiseCapability(C) {
- var resolve, reject;
- this.promise = new C(function ($$resolve, $$reject) {
- if (resolve !== undefined || reject !== undefined) throw TypeError('Bad Promise constructor');
- resolve = $$resolve;
- reject = $$reject;
- });
- this.resolve = _aFunction(resolve);
- this.reject = _aFunction(reject);
- }
- var f$3 = function (C) {
- return new PromiseCapability(C);
- };
- var _newPromiseCapability = {
- f: f$3
- };
- var _perform = function (exec) {
- try {
- return { e: false, v: exec() };
- } catch (e) {
- return { e: true, v: e };
- }
- };
- var navigator = _global.navigator;
- var _userAgent = navigator && navigator.userAgent || '';
- var _promiseResolve = function (C, x) {
- _anObject(C);
- if (_isObject(x) && x.constructor === C) return x;
- var promiseCapability = _newPromiseCapability.f(C);
- var resolve = promiseCapability.resolve;
- resolve(x);
- return promiseCapability.promise;
- };
- var _redefineAll = function (target, src, safe) {
- for (var key in src) {
- if (safe && target[key]) target[key] = src[key];
- else _hide(target, key, src[key]);
- } return target;
- };
- var SPECIES$1 = _wks('species');
- var _setSpecies = function (KEY) {
- var C = typeof _core[KEY] == 'function' ? _core[KEY] : _global[KEY];
- if (_descriptors && C && !C[SPECIES$1]) _objectDp.f(C, SPECIES$1, {
- configurable: true,
- get: function () { return this; }
- });
- };
- var ITERATOR$3 = _wks('iterator');
- var SAFE_CLOSING = false;
- try {
- var riter = [7][ITERATOR$3]();
- riter['return'] = function () { SAFE_CLOSING = true; };
- } catch (e) { /* empty */ }
- var _iterDetect = function (exec, skipClosing) {
- if (!skipClosing && !SAFE_CLOSING) return false;
- var safe = false;
- try {
- var arr = [7];
- var iter = arr[ITERATOR$3]();
- iter.next = function () { return { done: safe = true }; };
- arr[ITERATOR$3] = function () { return iter; };
- exec(arr);
- } catch (e) { /* empty */ }
- return safe;
- };
- var task = _task.set;
- var microtask = _microtask();
- var PROMISE = 'Promise';
- var TypeError$1 = _global.TypeError;
- var process$2 = _global.process;
- var versions = process$2 && process$2.versions;
- var v8 = versions && versions.v8 || '';
- var $Promise = _global[PROMISE];
- var isNode$1 = _classof(process$2) == 'process';
- var empty = function () { /* empty */ };
- var Internal, newGenericPromiseCapability, OwnPromiseCapability, Wrapper;
- var newPromiseCapability = newGenericPromiseCapability = _newPromiseCapability.f;
- var USE_NATIVE = !!function () {
- try {
- // correct subclassing with @@species support
- var promise = $Promise.resolve(1);
- var FakePromise = (promise.constructor = {})[_wks('species')] = function (exec) {
- exec(empty, empty);
- };
- // unhandled rejections tracking support, NodeJS Promise without it fails @@species test
- return (isNode$1 || typeof PromiseRejectionEvent == 'function')
- && promise.then(empty) instanceof FakePromise
- // v8 6.6 (Node 10 and Chrome 66) have a bug with resolving custom thenables
- // https://bugs.chromium.org/p/chromium/issues/detail?id=830565
- // we can't detect it synchronously, so just check versions
- && v8.indexOf('6.6') !== 0
- && _userAgent.indexOf('Chrome/66') === -1;
- } catch (e) { /* empty */ }
- }();
- // helpers
- var isThenable = function (it) {
- var then;
- return _isObject(it) && typeof (then = it.then) == 'function' ? then : false;
- };
- var notify = function (promise, isReject) {
- if (promise._n) return;
- promise._n = true;
- var chain = promise._c;
- microtask(function () {
- var value = promise._v;
- var ok = promise._s == 1;
- var i = 0;
- var run = function (reaction) {
- var handler = ok ? reaction.ok : reaction.fail;
- var resolve = reaction.resolve;
- var reject = reaction.reject;
- var domain = reaction.domain;
- var result, then, exited;
- try {
- if (handler) {
- if (!ok) {
- if (promise._h == 2) onHandleUnhandled(promise);
- promise._h = 1;
- }
- if (handler === true) result = value;
- else {
- if (domain) domain.enter();
- result = handler(value); // may throw
- if (domain) {
- domain.exit();
- exited = true;
- }
- }
- if (result === reaction.promise) {
- reject(TypeError$1('Promise-chain cycle'));
- } else if (then = isThenable(result)) {
- then.call(result, resolve, reject);
- } else resolve(result);
- } else reject(value);
- } catch (e) {
- if (domain && !exited) domain.exit();
- reject(e);
- }
- };
- while (chain.length > i) run(chain[i++]); // variable length - can't use forEach
- promise._c = [];
- promise._n = false;
- if (isReject && !promise._h) onUnhandled(promise);
- });
- };
- var onUnhandled = function (promise) {
- task.call(_global, function () {
- var value = promise._v;
- var unhandled = isUnhandled(promise);
- var result, handler, console;
- if (unhandled) {
- result = _perform(function () {
- if (isNode$1) {
- process$2.emit('unhandledRejection', value, promise);
- } else if (handler = _global.onunhandledrejection) {
- handler({ promise: promise, reason: value });
- } else if ((console = _global.console) && console.error) {
- console.error('Unhandled promise rejection', value);
- }
- });
- // Browsers should not trigger `rejectionHandled` event if it was handled here, NodeJS - should
- promise._h = isNode$1 || isUnhandled(promise) ? 2 : 1;
- } promise._a = undefined;
- if (unhandled && result.e) throw result.v;
- });
- };
- var isUnhandled = function (promise) {
- return promise._h !== 1 && (promise._a || promise._c).length === 0;
- };
- var onHandleUnhandled = function (promise) {
- task.call(_global, function () {
- var handler;
- if (isNode$1) {
- process$2.emit('rejectionHandled', promise);
- } else if (handler = _global.onrejectionhandled) {
- handler({ promise: promise, reason: promise._v });
- }
- });
- };
- var $reject = function (value) {
- var promise = this;
- if (promise._d) return;
- promise._d = true;
- promise = promise._w || promise; // unwrap
- promise._v = value;
- promise._s = 2;
- if (!promise._a) promise._a = promise._c.slice();
- notify(promise, true);
- };
- var $resolve = function (value) {
- var promise = this;
- var then;
- if (promise._d) return;
- promise._d = true;
- promise = promise._w || promise; // unwrap
- try {
- if (promise === value) throw TypeError$1("Promise can't be resolved itself");
- if (then = isThenable(value)) {
- microtask(function () {
- var wrapper = { _w: promise, _d: false }; // wrap
- try {
- then.call(value, _ctx($resolve, wrapper, 1), _ctx($reject, wrapper, 1));
- } catch (e) {
- $reject.call(wrapper, e);
- }
- });
- } else {
- promise._v = value;
- promise._s = 1;
- notify(promise, false);
- }
- } catch (e) {
- $reject.call({ _w: promise, _d: false }, e); // wrap
- }
- };
- // constructor polyfill
- if (!USE_NATIVE) {
- // 25.4.3.1 Promise(executor)
- $Promise = function Promise(executor) {
- _anInstance(this, $Promise, PROMISE, '_h');
- _aFunction(executor);
- Internal.call(this);
- try {
- executor(_ctx($resolve, this, 1), _ctx($reject, this, 1));
- } catch (err) {
- $reject.call(this, err);
- }
- };
- // eslint-disable-next-line no-unused-vars
- Internal = function Promise(executor) {
- this._c = []; // <- awaiting reactions
- this._a = undefined; // <- checked in isUnhandled reactions
- this._s = 0; // <- state
- this._d = false; // <- done
- this._v = undefined; // <- value
- this._h = 0; // <- rejection state, 0 - default, 1 - handled, 2 - unhandled
- this._n = false; // <- notify
- };
- Internal.prototype = _redefineAll($Promise.prototype, {
- // 25.4.5.3 Promise.prototype.then(onFulfilled, onRejected)
- then: function then(onFulfilled, onRejected) {
- var reaction = newPromiseCapability(_speciesConstructor(this, $Promise));
- reaction.ok = typeof onFulfilled == 'function' ? onFulfilled : true;
- reaction.fail = typeof onRejected == 'function' && onRejected;
- reaction.domain = isNode$1 ? process$2.domain : undefined;
- this._c.push(reaction);
- if (this._a) this._a.push(reaction);
- if (this._s) notify(this, false);
- return reaction.promise;
- },
- // 25.4.5.1 Promise.prototype.catch(onRejected)
- 'catch': function (onRejected) {
- return this.then(undefined, onRejected);
- }
- });
- OwnPromiseCapability = function () {
- var promise = new Internal();
- this.promise = promise;
- this.resolve = _ctx($resolve, promise, 1);
- this.reject = _ctx($reject, promise, 1);
- };
- _newPromiseCapability.f = newPromiseCapability = function (C) {
- return C === $Promise || C === Wrapper
- ? new OwnPromiseCapability(C)
- : newGenericPromiseCapability(C);
- };
- }
- _export(_export.G + _export.W + _export.F * !USE_NATIVE, { Promise: $Promise });
- _setToStringTag($Promise, PROMISE);
- _setSpecies(PROMISE);
- Wrapper = _core[PROMISE];
- // statics
- _export(_export.S + _export.F * !USE_NATIVE, PROMISE, {
- // 25.4.4.5 Promise.reject(r)
- reject: function reject(r) {
- var capability = newPromiseCapability(this);
- var $$reject = capability.reject;
- $$reject(r);
- return capability.promise;
- }
- });
- _export(_export.S + _export.F * (_library || !USE_NATIVE), PROMISE, {
- // 25.4.4.6 Promise.resolve(x)
- resolve: function resolve(x) {
- return _promiseResolve(_library && this === Wrapper ? $Promise : this, x);
- }
- });
- _export(_export.S + _export.F * !(USE_NATIVE && _iterDetect(function (iter) {
- $Promise.all(iter)['catch'](empty);
- })), PROMISE, {
- // 25.4.4.1 Promise.all(iterable)
- all: function all(iterable) {
- var C = this;
- var capability = newPromiseCapability(C);
- var resolve = capability.resolve;
- var reject = capability.reject;
- var result = _perform(function () {
- var values = [];
- var index = 0;
- var remaining = 1;
- _forOf(iterable, false, function (promise) {
- var $index = index++;
- var alreadyCalled = false;
- values.push(undefined);
- remaining++;
- C.resolve(promise).then(function (value) {
- if (alreadyCalled) return;
- alreadyCalled = true;
- values[$index] = value;
- --remaining || resolve(values);
- }, reject);
- });
- --remaining || resolve(values);
- });
- if (result.e) reject(result.v);
- return capability.promise;
- },
- // 25.4.4.4 Promise.race(iterable)
- race: function race(iterable) {
- var C = this;
- var capability = newPromiseCapability(C);
- var reject = capability.reject;
- var result = _perform(function () {
- _forOf(iterable, false, function (promise) {
- C.resolve(promise).then(capability.resolve, reject);
- });
- });
- if (result.e) reject(result.v);
- return capability.promise;
- }
- });
- _export(_export.P + _export.R, 'Promise', { 'finally': function (onFinally) {
- var C = _speciesConstructor(this, _core.Promise || _global.Promise);
- var isFunction = typeof onFinally == 'function';
- return this.then(
- isFunction ? function (x) {
- return _promiseResolve(C, onFinally()).then(function () { return x; });
- } : onFinally,
- isFunction ? function (e) {
- return _promiseResolve(C, onFinally()).then(function () { throw e; });
- } : onFinally
- );
- } });
- // https://github.com/tc39/proposal-promise-try
- _export(_export.S, 'Promise', { 'try': function (callbackfn) {
- var promiseCapability = _newPromiseCapability.f(this);
- var result = _perform(callbackfn);
- (result.e ? promiseCapability.reject : promiseCapability.resolve)(result.v);
- return promiseCapability.promise;
- } });
- var promise = _core.Promise;
- var promise$1 = createCommonjsModule(function (module) {
- module.exports = { "default": promise, __esModule: true };
- });
- var _Promise = unwrapExports(promise$1);
- // most Object methods by ES6 should accept primitives
- var _objectSap = function (KEY, exec) {
- var fn = (_core.Object || {})[KEY] || Object[KEY];
- var exp = {};
- exp[KEY] = exec(fn);
- _export(_export.S + _export.F * _fails(function () { fn(1); }), 'Object', exp);
- };
- // 19.1.2.14 Object.keys(O)
- _objectSap('keys', function () {
- return function keys(it) {
- return _objectKeys(_toObject(it));
- };
- });
- var keys = _core.Object.keys;
- var keys$1 = createCommonjsModule(function (module) {
- module.exports = { "default": keys, __esModule: true };
- });
- var _Object$keys = unwrapExports(keys$1);
- var f$4 = _wks;
- var _wksExt = {
- f: f$4
- };
- var iterator = _wksExt.f('iterator');
- var iterator$1 = createCommonjsModule(function (module) {
- module.exports = { "default": iterator, __esModule: true };
- });
- var _Symbol$iterator = unwrapExports(iterator$1);
- var _meta = createCommonjsModule(function (module) {
- var META = _uid('meta');
- var setDesc = _objectDp.f;
- var id = 0;
- var isExtensible = Object.isExtensible || function () {
- return true;
- };
- var FREEZE = !_fails(function () {
- return isExtensible(Object.preventExtensions({}));
- });
- var setMeta = function (it) {
- setDesc(it, META, { value: {
- i: 'O' + ++id, // object ID
- w: {} // weak collections IDs
- } });
- };
- var fastKey = function (it, create) {
- // return primitive with prefix
- if (!_isObject(it)) return typeof it == 'symbol' ? it : (typeof it == 'string' ? 'S' : 'P') + it;
- if (!_has(it, META)) {
- // can't set metadata to uncaught frozen object
- if (!isExtensible(it)) return 'F';
- // not necessary to add metadata
- if (!create) return 'E';
- // add missing metadata
- setMeta(it);
- // return object ID
- } return it[META].i;
- };
- var getWeak = function (it, create) {
- if (!_has(it, META)) {
- // can't set metadata to uncaught frozen object
- if (!isExtensible(it)) return true;
- // not necessary to add metadata
- if (!create) return false;
- // add missing metadata
- setMeta(it);
- // return hash weak collections IDs
- } return it[META].w;
- };
- // add metadata on freeze-family methods calling
- var onFreeze = function (it) {
- if (FREEZE && meta.NEED && isExtensible(it) && !_has(it, META)) setMeta(it);
- return it;
- };
- var meta = module.exports = {
- KEY: META,
- NEED: false,
- fastKey: fastKey,
- getWeak: getWeak,
- onFreeze: onFreeze
- };
- });
- var _meta_1 = _meta.KEY;
- var _meta_2 = _meta.NEED;
- var _meta_3 = _meta.fastKey;
- var _meta_4 = _meta.getWeak;
- var _meta_5 = _meta.onFreeze;
- var defineProperty = _objectDp.f;
- var _wksDefine = function (name) {
- var $Symbol = _core.Symbol || (_core.Symbol = _library ? {} : _global.Symbol || {});
- if (name.charAt(0) != '_' && !(name in $Symbol)) defineProperty($Symbol, name, { value: _wksExt.f(name) });
- };
- // all enumerable object keys, includes symbols
- var _enumKeys = function (it) {
- var result = _objectKeys(it);
- var getSymbols = _objectGops.f;
- if (getSymbols) {
- var symbols = getSymbols(it);
- var isEnum = _objectPie.f;
- var i = 0;
- var key;
- while (symbols.length > i) if (isEnum.call(it, key = symbols[i++])) result.push(key);
- } return result;
- };
- // 7.2.2 IsArray(argument)
- var _isArray = Array.isArray || function isArray(arg) {
- return _cof(arg) == 'Array';
- };
- // 19.1.2.7 / 15.2.3.4 Object.getOwnPropertyNames(O)
- var hiddenKeys = _enumBugKeys.concat('length', 'prototype');
- var f$5 = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {
- return _objectKeysInternal(O, hiddenKeys);
- };
- var _objectGopn = {
- f: f$5
- };
- // fallback for IE11 buggy Object.getOwnPropertyNames with iframe and window
- var gOPN = _objectGopn.f;
- var toString$2 = {}.toString;
- var windowNames = typeof window == 'object' && window && Object.getOwnPropertyNames
- ? Object.getOwnPropertyNames(window) : [];
- var getWindowNames = function (it) {
- try {
- return gOPN(it);
- } catch (e) {
- return windowNames.slice();
- }
- };
- var f$6 = function getOwnPropertyNames(it) {
- return windowNames && toString$2.call(it) == '[object Window]' ? getWindowNames(it) : gOPN(_toIobject(it));
- };
- var _objectGopnExt = {
- f: f$6
- };
- var gOPD = Object.getOwnPropertyDescriptor;
- var f$7 = _descriptors ? gOPD : function getOwnPropertyDescriptor(O, P) {
- O = _toIobject(O);
- P = _toPrimitive(P, true);
- if (_ie8DomDefine) try {
- return gOPD(O, P);
- } catch (e) { /* empty */ }
- if (_has(O, P)) return _propertyDesc(!_objectPie.f.call(O, P), O[P]);
- };
- var _objectGopd = {
- f: f$7
- };
- // ECMAScript 6 symbols shim
- var META = _meta.KEY;
- var gOPD$1 = _objectGopd.f;
- var dP$1 = _objectDp.f;
- var gOPN$1 = _objectGopnExt.f;
- var $Symbol = _global.Symbol;
- var $JSON = _global.JSON;
- var _stringify = $JSON && $JSON.stringify;
- var PROTOTYPE$2 = 'prototype';
- var HIDDEN = _wks('_hidden');
- var TO_PRIMITIVE = _wks('toPrimitive');
- var isEnum = {}.propertyIsEnumerable;
- var SymbolRegistry = _shared('symbol-registry');
- var AllSymbols = _shared('symbols');
- var OPSymbols = _shared('op-symbols');
- var ObjectProto$1 = Object[PROTOTYPE$2];
- var USE_NATIVE$1 = typeof $Symbol == 'function';
- var QObject = _global.QObject;
- // Don't use setters in Qt Script, https://github.com/zloirock/core-js/issues/173
- var setter = !QObject || !QObject[PROTOTYPE$2] || !QObject[PROTOTYPE$2].findChild;
- // fallback for old Android, https://code.google.com/p/v8/issues/detail?id=687
- var setSymbolDesc = _descriptors && _fails(function () {
- return _objectCreate(dP$1({}, 'a', {
- get: function () { return dP$1(this, 'a', { value: 7 }).a; }
- })).a != 7;
- }) ? function (it, key, D) {
- var protoDesc = gOPD$1(ObjectProto$1, key);
- if (protoDesc) delete ObjectProto$1[key];
- dP$1(it, key, D);
- if (protoDesc && it !== ObjectProto$1) dP$1(ObjectProto$1, key, protoDesc);
- } : dP$1;
- var wrap = function (tag) {
- var sym = AllSymbols[tag] = _objectCreate($Symbol[PROTOTYPE$2]);
- sym._k = tag;
- return sym;
- };
- var isSymbol = USE_NATIVE$1 && typeof $Symbol.iterator == 'symbol' ? function (it) {
- return typeof it == 'symbol';
- } : function (it) {
- return it instanceof $Symbol;
- };
- var $defineProperty = function defineProperty(it, key, D) {
- if (it === ObjectProto$1) $defineProperty(OPSymbols, key, D);
- _anObject(it);
- key = _toPrimitive(key, true);
- _anObject(D);
- if (_has(AllSymbols, key)) {
- if (!D.enumerable) {
- if (!_has(it, HIDDEN)) dP$1(it, HIDDEN, _propertyDesc(1, {}));
- it[HIDDEN][key] = true;
- } else {
- if (_has(it, HIDDEN) && it[HIDDEN][key]) it[HIDDEN][key] = false;
- D = _objectCreate(D, { enumerable: _propertyDesc(0, false) });
- } return setSymbolDesc(it, key, D);
- } return dP$1(it, key, D);
- };
- var $defineProperties = function defineProperties(it, P) {
- _anObject(it);
- var keys = _enumKeys(P = _toIobject(P));
- var i = 0;
- var l = keys.length;
- var key;
- while (l > i) $defineProperty(it, key = keys[i++], P[key]);
- return it;
- };
- var $create = function create(it, P) {
- return P === undefined ? _objectCreate(it) : $defineProperties(_objectCreate(it), P);
- };
- var $propertyIsEnumerable = function propertyIsEnumerable(key) {
- var E = isEnum.call(this, key = _toPrimitive(key, true));
- if (this === ObjectProto$1 && _has(AllSymbols, key) && !_has(OPSymbols, key)) return false;
- return E || !_has(this, key) || !_has(AllSymbols, key) || _has(this, HIDDEN) && this[HIDDEN][key] ? E : true;
- };
- var $getOwnPropertyDescriptor = function getOwnPropertyDescriptor(it, key) {
- it = _toIobject(it);
- key = _toPrimitive(key, true);
- if (it === ObjectProto$1 && _has(AllSymbols, key) && !_has(OPSymbols, key)) return;
- var D = gOPD$1(it, key);
- if (D && _has(AllSymbols, key) && !(_has(it, HIDDEN) && it[HIDDEN][key])) D.enumerable = true;
- return D;
- };
- var $getOwnPropertyNames = function getOwnPropertyNames(it) {
- var names = gOPN$1(_toIobject(it));
- var result = [];
- var i = 0;
- var key;
- while (names.length > i) {
- if (!_has(AllSymbols, key = names[i++]) && key != HIDDEN && key != META) result.push(key);
- } return result;
- };
- var $getOwnPropertySymbols = function getOwnPropertySymbols(it) {
- var IS_OP = it === ObjectProto$1;
- var names = gOPN$1(IS_OP ? OPSymbols : _toIobject(it));
- var result = [];
- var i = 0;
- var key;
- while (names.length > i) {
- if (_has(AllSymbols, key = names[i++]) && (IS_OP ? _has(ObjectProto$1, key) : true)) result.push(AllSymbols[key]);
- } return result;
- };
- // 19.4.1.1 Symbol([description])
- if (!USE_NATIVE$1) {
- $Symbol = function Symbol() {
- if (this instanceof $Symbol) throw TypeError('Symbol is not a constructor!');
- var tag = _uid(arguments.length > 0 ? arguments[0] : undefined);
- var $set = function (value) {
- if (this === ObjectProto$1) $set.call(OPSymbols, value);
- if (_has(this, HIDDEN) && _has(this[HIDDEN], tag)) this[HIDDEN][tag] = false;
- setSymbolDesc(this, tag, _propertyDesc(1, value));
- };
- if (_descriptors && setter) setSymbolDesc(ObjectProto$1, tag, { configurable: true, set: $set });
- return wrap(tag);
- };
- _redefine($Symbol[PROTOTYPE$2], 'toString', function toString() {
- return this._k;
- });
- _objectGopd.f = $getOwnPropertyDescriptor;
- _objectDp.f = $defineProperty;
- _objectGopn.f = _objectGopnExt.f = $getOwnPropertyNames;
- _objectPie.f = $propertyIsEnumerable;
- _objectGops.f = $getOwnPropertySymbols;
- if (_descriptors && !_library) {
- _redefine(ObjectProto$1, 'propertyIsEnumerable', $propertyIsEnumerable, true);
- }
- _wksExt.f = function (name) {
- return wrap(_wks(name));
- };
- }
- _export(_export.G + _export.W + _export.F * !USE_NATIVE$1, { Symbol: $Symbol });
- for (var es6Symbols = (
- // 19.4.2.2, 19.4.2.3, 19.4.2.4, 19.4.2.6, 19.4.2.8, 19.4.2.9, 19.4.2.10, 19.4.2.11, 19.4.2.12, 19.4.2.13, 19.4.2.14
- 'hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables'
- ).split(','), j = 0; es6Symbols.length > j;)_wks(es6Symbols[j++]);
- for (var wellKnownSymbols = _objectKeys(_wks.store), k = 0; wellKnownSymbols.length > k;) _wksDefine(wellKnownSymbols[k++]);
- _export(_export.S + _export.F * !USE_NATIVE$1, 'Symbol', {
- // 19.4.2.1 Symbol.for(key)
- 'for': function (key) {
- return _has(SymbolRegistry, key += '')
- ? SymbolRegistry[key]
- : SymbolRegistry[key] = $Symbol(key);
- },
- // 19.4.2.5 Symbol.keyFor(sym)
- keyFor: function keyFor(sym) {
- if (!isSymbol(sym)) throw TypeError(sym + ' is not a symbol!');
- for (var key in SymbolRegistry) if (SymbolRegistry[key] === sym) return key;
- },
- useSetter: function () { setter = true; },
- useSimple: function () { setter = false; }
- });
- _export(_export.S + _export.F * !USE_NATIVE$1, 'Object', {
- // 19.1.2.2 Object.create(O [, Properties])
- create: $create,
- // 19.1.2.4 Object.defineProperty(O, P, Attributes)
- defineProperty: $defineProperty,
- // 19.1.2.3 Object.defineProperties(O, Properties)
- defineProperties: $defineProperties,
- // 19.1.2.6 Object.getOwnPropertyDescriptor(O, P)
- getOwnPropertyDescriptor: $getOwnPropertyDescriptor,
- // 19.1.2.7 Object.getOwnPropertyNames(O)
- getOwnPropertyNames: $getOwnPropertyNames,
- // 19.1.2.8 Object.getOwnPropertySymbols(O)
- getOwnPropertySymbols: $getOwnPropertySymbols
- });
- // 24.3.2 JSON.stringify(value [, replacer [, space]])
- $JSON && _export(_export.S + _export.F * (!USE_NATIVE$1 || _fails(function () {
- var S = $Symbol();
- // MS Edge converts symbol values to JSON as {}
- // WebKit converts symbol values to JSON as null
- // V8 throws on boxed symbols
- return _stringify([S]) != '[null]' || _stringify({ a: S }) != '{}' || _stringify(Object(S)) != '{}';
- })), 'JSON', {
- stringify: function stringify(it) {
- var args = [it];
- var i = 1;
- var replacer, $replacer;
- while (arguments.length > i) args.push(arguments[i++]);
- $replacer = replacer = args[1];
- if (!_isObject(replacer) && it === undefined || isSymbol(it)) return; // IE8 returns string on undefined
- if (!_isArray(replacer)) replacer = function (key, value) {
- if (typeof $replacer == 'function') value = $replacer.call(this, key, value);
- if (!isSymbol(value)) return value;
- };
- args[1] = replacer;
- return _stringify.apply($JSON, args);
- }
- });
- // 19.4.3.4 Symbol.prototype[@@toPrimitive](hint)
- $Symbol[PROTOTYPE$2][TO_PRIMITIVE] || _hide($Symbol[PROTOTYPE$2], TO_PRIMITIVE, $Symbol[PROTOTYPE$2].valueOf);
- // 19.4.3.5 Symbol.prototype[@@toStringTag]
- _setToStringTag($Symbol, 'Symbol');
- // 20.2.1.9 Math[@@toStringTag]
- _setToStringTag(Math, 'Math', true);
- // 24.3.3 JSON[@@toStringTag]
- _setToStringTag(_global.JSON, 'JSON', true);
- _wksDefine('asyncIterator');
- _wksDefine('observable');
- var symbol = _core.Symbol;
- var symbol$1 = createCommonjsModule(function (module) {
- module.exports = { "default": symbol, __esModule: true };
- });
- var _Symbol = unwrapExports(symbol$1);
- var _typeof_1 = createCommonjsModule(function (module, exports) {
- exports.__esModule = true;
- var _iterator2 = _interopRequireDefault(iterator$1);
- var _symbol2 = _interopRequireDefault(symbol$1);
- var _typeof = typeof _symbol2.default === "function" && typeof _iterator2.default === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof _symbol2.default === "function" && obj.constructor === _symbol2.default && obj !== _symbol2.default.prototype ? "symbol" : typeof obj; };
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
- exports.default = typeof _symbol2.default === "function" && _typeof(_iterator2.default) === "symbol" ? function (obj) {
- return typeof obj === "undefined" ? "undefined" : _typeof(obj);
- } : function (obj) {
- return obj && typeof _symbol2.default === "function" && obj.constructor === _symbol2.default && obj !== _symbol2.default.prototype ? "symbol" : typeof obj === "undefined" ? "undefined" : _typeof(obj);
- };
- });
- var _typeof = unwrapExports(_typeof_1);
- // 19.1.2.9 Object.getPrototypeOf(O)
- _objectSap('getPrototypeOf', function () {
- return function getPrototypeOf(it) {
- return _objectGpo(_toObject(it));
- };
- });
- var getPrototypeOf = _core.Object.getPrototypeOf;
- var getPrototypeOf$1 = createCommonjsModule(function (module) {
- module.exports = { "default": getPrototypeOf, __esModule: true };
- });
- var _Object$getPrototypeOf = unwrapExports(getPrototypeOf$1);
- var classCallCheck = createCommonjsModule(function (module, exports) {
- exports.__esModule = true;
- exports.default = function (instance, Constructor) {
- if (!(instance instanceof Constructor)) {
- throw new TypeError("Cannot call a class as a function");
- }
- };
- });
- var _classCallCheck = unwrapExports(classCallCheck);
- var possibleConstructorReturn = createCommonjsModule(function (module, exports) {
- exports.__esModule = true;
- var _typeof3 = _interopRequireDefault(_typeof_1);
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
- exports.default = function (self, call) {
- if (!self) {
- throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
- }
- return call && ((typeof call === "undefined" ? "undefined" : (0, _typeof3.default)(call)) === "object" || typeof call === "function") ? call : self;
- };
- });
- var _possibleConstructorReturn = unwrapExports(possibleConstructorReturn);
- // Works with __proto__ only. Old v8 can't work with null proto objects.
- /* eslint-disable no-proto */
- var check = function (O, proto) {
- _anObject(O);
- if (!_isObject(proto) && proto !== null) throw TypeError(proto + ": can't set as prototype!");
- };
- var _setProto = {
- set: Object.setPrototypeOf || ('__proto__' in {} ? // eslint-disable-line
- function (test, buggy, set) {
- try {
- set = _ctx(Function.call, _objectGopd.f(Object.prototype, '__proto__').set, 2);
- set(test, []);
- buggy = !(test instanceof Array);
- } catch (e) { buggy = true; }
- return function setPrototypeOf(O, proto) {
- check(O, proto);
- if (buggy) O.__proto__ = proto;
- else set(O, proto);
- return O;
- };
- }({}, false) : undefined),
- check: check
- };
- // 19.1.3.19 Object.setPrototypeOf(O, proto)
- _export(_export.S, 'Object', { setPrototypeOf: _setProto.set });
- var setPrototypeOf = _core.Object.setPrototypeOf;
- var setPrototypeOf$1 = createCommonjsModule(function (module) {
- module.exports = { "default": setPrototypeOf, __esModule: true };
- });
- unwrapExports(setPrototypeOf$1);
- // 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties])
- _export(_export.S, 'Object', { create: _objectCreate });
- var $Object = _core.Object;
- var create = function create(P, D) {
- return $Object.create(P, D);
- };
- var create$1 = createCommonjsModule(function (module) {
- module.exports = { "default": create, __esModule: true };
- });
- var _Object$create = unwrapExports(create$1);
- var inherits = createCommonjsModule(function (module, exports) {
- exports.__esModule = true;
- var _setPrototypeOf2 = _interopRequireDefault(setPrototypeOf$1);
- var _create2 = _interopRequireDefault(create$1);
- var _typeof3 = _interopRequireDefault(_typeof_1);
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
- exports.default = function (subClass, superClass) {
- if (typeof superClass !== "function" && superClass !== null) {
- throw new TypeError("Super expression must either be null or a function, not " + (typeof superClass === "undefined" ? "undefined" : (0, _typeof3.default)(superClass)));
- }
- subClass.prototype = (0, _create2.default)(superClass && superClass.prototype, {
- constructor: {
- value: subClass,
- enumerable: false,
- writable: true,
- configurable: true
- }
- });
- if (superClass) _setPrototypeOf2.default ? (0, _setPrototypeOf2.default)(subClass, superClass) : subClass.__proto__ = superClass;
- };
- });
- var _inherits = unwrapExports(inherits);
- // 19.1.2.4 / 15.2.3.6 Object.defineProperty(O, P, Attributes)
- _export(_export.S + _export.F * !_descriptors, 'Object', { defineProperty: _objectDp.f });
- var $Object$1 = _core.Object;
- var defineProperty$1 = function defineProperty(it, key, desc) {
- return $Object$1.defineProperty(it, key, desc);
- };
- var defineProperty$2 = createCommonjsModule(function (module) {
- module.exports = { "default": defineProperty$1, __esModule: true };
- });
- var _Object$defineProperty = unwrapExports(defineProperty$2);
- var defineProperty$3 = createCommonjsModule(function (module, exports) {
- exports.__esModule = true;
- var _defineProperty2 = _interopRequireDefault(defineProperty$2);
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
- exports.default = function (obj, key, value) {
- if (key in obj) {
- (0, _defineProperty2.default)(obj, key, {
- value: value,
- enumerable: true,
- configurable: true,
- writable: true
- });
- } else {
- obj[key] = value;
- }
- return obj;
- };
- });
- var _defineProperty = unwrapExports(defineProperty$3);
- var core_getIterator = _core.getIterator = function (it) {
- var iterFn = core_getIteratorMethod(it);
- if (typeof iterFn != 'function') throw TypeError(it + ' is not iterable!');
- return _anObject(iterFn.call(it));
- };
- var getIterator = core_getIterator;
- var getIterator$1 = createCommonjsModule(function (module) {
- module.exports = { "default": getIterator, __esModule: true };
- });
- var _getIterator = unwrapExports(getIterator$1);
- var _validateCollection = function (it, TYPE) {
- if (!_isObject(it) || it._t !== TYPE) throw TypeError('Incompatible receiver, ' + TYPE + ' required!');
- return it;
- };
- var dP$2 = _objectDp.f;
- var fastKey = _meta.fastKey;
- var SIZE = _descriptors ? '_s' : 'size';
- var getEntry = function (that, key) {
- // fast case
- var index = fastKey(key);
- var entry;
- if (index !== 'F') return that._i[index];
- // frozen object case
- for (entry = that._f; entry; entry = entry.n) {
- if (entry.k == key) return entry;
- }
- };
- var _collectionStrong = {
- getConstructor: function (wrapper, NAME, IS_MAP, ADDER) {
- var C = wrapper(function (that, iterable) {
- _anInstance(that, C, NAME, '_i');
- that._t = NAME; // collection type
- that._i = _objectCreate(null); // index
- that._f = undefined; // first entry
- that._l = undefined; // last entry
- that[SIZE] = 0; // size
- if (iterable != undefined) _forOf(iterable, IS_MAP, that[ADDER], that);
- });
- _redefineAll(C.prototype, {
- // 23.1.3.1 Map.prototype.clear()
- // 23.2.3.2 Set.prototype.clear()
- clear: function clear() {
- for (var that = _validateCollection(this, NAME), data = that._i, entry = that._f; entry; entry = entry.n) {
- entry.r = true;
- if (entry.p) entry.p = entry.p.n = undefined;
- delete data[entry.i];
- }
- that._f = that._l = undefined;
- that[SIZE] = 0;
- },
- // 23.1.3.3 Map.prototype.delete(key)
- // 23.2.3.4 Set.prototype.delete(value)
- 'delete': function (key) {
- var that = _validateCollection(this, NAME);
- var entry = getEntry(that, key);
- if (entry) {
- var next = entry.n;
- var prev = entry.p;
- delete that._i[entry.i];
- entry.r = true;
- if (prev) prev.n = next;
- if (next) next.p = prev;
- if (that._f == entry) that._f = next;
- if (that._l == entry) that._l = prev;
- that[SIZE]--;
- } return !!entry;
- },
- // 23.2.3.6 Set.prototype.forEach(callbackfn, thisArg = undefined)
- // 23.1.3.5 Map.prototype.forEach(callbackfn, thisArg = undefined)
- forEach: function forEach(callbackfn /* , that = undefined */) {
- _validateCollection(this, NAME);
- var f = _ctx(callbackfn, arguments.length > 1 ? arguments[1] : undefined, 3);
- var entry;
- while (entry = entry ? entry.n : this._f) {
- f(entry.v, entry.k, this);
- // revert to the last existing entry
- while (entry && entry.r) entry = entry.p;
- }
- },
- // 23.1.3.7 Map.prototype.has(key)
- // 23.2.3.7 Set.prototype.has(value)
- has: function has(key) {
- return !!getEntry(_validateCollection(this, NAME), key);
- }
- });
- if (_descriptors) dP$2(C.prototype, 'size', {
- get: function () {
- return _validateCollection(this, NAME)[SIZE];
- }
- });
- return C;
- },
- def: function (that, key, value) {
- var entry = getEntry(that, key);
- var prev, index;
- // change existing entry
- if (entry) {
- entry.v = value;
- // create new entry
- } else {
- that._l = entry = {
- i: index = fastKey(key, true), // <- index
- k: key, // <- key
- v: value, // <- value
- p: prev = that._l, // <- previous entry
- n: undefined, // <- next entry
- r: false // <- removed
- };
- if (!that._f) that._f = entry;
- if (prev) prev.n = entry;
- that[SIZE]++;
- // add to index
- if (index !== 'F') that._i[index] = entry;
- } return that;
- },
- getEntry: getEntry,
- setStrong: function (C, NAME, IS_MAP) {
- // add .keys, .values, .entries, [@@iterator]
- // 23.1.3.4, 23.1.3.8, 23.1.3.11, 23.1.3.12, 23.2.3.5, 23.2.3.8, 23.2.3.10, 23.2.3.11
- _iterDefine(C, NAME, function (iterated, kind) {
- this._t = _validateCollection(iterated, NAME); // target
- this._k = kind; // kind
- this._l = undefined; // previous
- }, function () {
- var that = this;
- var kind = that._k;
- var entry = that._l;
- // revert to the last existing entry
- while (entry && entry.r) entry = entry.p;
- // get next entry
- if (!that._t || !(that._l = entry = entry ? entry.n : that._t._f)) {
- // or finish the iteration
- that._t = undefined;
- return _iterStep(1);
- }
- // return step by kind
- if (kind == 'keys') return _iterStep(0, entry.k);
- if (kind == 'values') return _iterStep(0, entry.v);
- return _iterStep(0, [entry.k, entry.v]);
- }, IS_MAP ? 'entries' : 'values', !IS_MAP, true);
- // add [@@species], 23.1.2.2, 23.2.2.2
- _setSpecies(NAME);
- }
- };
- var SPECIES$2 = _wks('species');
- var _arraySpeciesConstructor = function (original) {
- var C;
- if (_isArray(original)) {
- C = original.constructor;
- // cross-realm fallback
- if (typeof C == 'function' && (C === Array || _isArray(C.prototype))) C = undefined;
- if (_isObject(C)) {
- C = C[SPECIES$2];
- if (C === null) C = undefined;
- }
- } return C === undefined ? Array : C;
- };
- // 9.4.2.3 ArraySpeciesCreate(originalArray, length)
- var _arraySpeciesCreate = function (original, length) {
- return new (_arraySpeciesConstructor(original))(length);
- };
- // 0 -> Array#forEach
- // 1 -> Array#map
- // 2 -> Array#filter
- // 3 -> Array#some
- // 4 -> Array#every
- // 5 -> Array#find
- // 6 -> Array#findIndex
- var _arrayMethods = function (TYPE, $create) {
- var IS_MAP = TYPE == 1;
- var IS_FILTER = TYPE == 2;
- var IS_SOME = TYPE == 3;
- var IS_EVERY = TYPE == 4;
- var IS_FIND_INDEX = TYPE == 6;
- var NO_HOLES = TYPE == 5 || IS_FIND_INDEX;
- var create = $create || _arraySpeciesCreate;
- return function ($this, callbackfn, that) {
- var O = _toObject($this);
- var self = _iobject(O);
- var f = _ctx(callbackfn, that, 3);
- var length = _toLength(self.length);
- var index = 0;
- var result = IS_MAP ? create($this, length) : IS_FILTER ? create($this, 0) : undefined;
- var val, res;
- for (;length > index; index++) if (NO_HOLES || index in self) {
- val = self[index];
- res = f(val, index, O);
- if (TYPE) {
- if (IS_MAP) result[index] = res; // map
- else if (res) switch (TYPE) {
- case 3: return true; // some
- case 5: return val; // find
- case 6: return index; // findIndex
- case 2: result.push(val); // filter
- } else if (IS_EVERY) return false; // every
- }
- }
- return IS_FIND_INDEX ? -1 : IS_SOME || IS_EVERY ? IS_EVERY : result;
- };
- };
- var dP$3 = _objectDp.f;
- var each = _arrayMethods(0);
- var _collection = function (NAME, wrapper, methods, common, IS_MAP, IS_WEAK) {
- var Base = _global[NAME];
- var C = Base;
- var ADDER = IS_MAP ? 'set' : 'add';
- var proto = C && C.prototype;
- var O = {};
- if (!_descriptors || typeof C != 'function' || !(IS_WEAK || proto.forEach && !_fails(function () {
- new C().entries().next();
- }))) {
- // create collection constructor
- C = common.getConstructor(wrapper, NAME, IS_MAP, ADDER);
- _redefineAll(C.prototype, methods);
- _meta.NEED = true;
- } else {
- C = wrapper(function (target, iterable) {
- _anInstance(target, C, NAME, '_c');
- target._c = new Base();
- if (iterable != undefined) _forOf(iterable, IS_MAP, target[ADDER], target);
- });
- each('add,clear,delete,forEach,get,has,set,keys,values,entries,toJSON'.split(','), function (KEY) {
- var IS_ADDER = KEY == 'add' || KEY == 'set';
- if (KEY in proto && !(IS_WEAK && KEY == 'clear')) _hide(C.prototype, KEY, function (a, b) {
- _anInstance(this, C, KEY);
- if (!IS_ADDER && IS_WEAK && !_isObject(a)) return KEY == 'get' ? undefined : false;
- var result = this._c[KEY](a === 0 ? 0 : a, b);
- return IS_ADDER ? this : result;
- });
- });
- IS_WEAK || dP$3(C.prototype, 'size', {
- get: function () {
- return this._c.size;
- }
- });
- }
- _setToStringTag(C, NAME);
- O[NAME] = C;
- _export(_export.G + _export.W + _export.F, O);
- if (!IS_WEAK) common.setStrong(C, NAME, IS_MAP);
- return C;
- };
- var MAP = 'Map';
- // 23.1 Map Objects
- var es6_map = _collection(MAP, function (get) {
- return function Map() { return get(this, arguments.length > 0 ? arguments[0] : undefined); };
- }, {
- // 23.1.3.6 Map.prototype.get(key)
- get: function get(key) {
- var entry = _collectionStrong.getEntry(_validateCollection(this, MAP), key);
- return entry && entry.v;
- },
- // 23.1.3.9 Map.prototype.set(key, value)
- set: function set(key, value) {
- return _collectionStrong.def(_validateCollection(this, MAP), key === 0 ? 0 : key, value);
- }
- }, _collectionStrong, true);
- var _arrayFromIterable = function (iter, ITERATOR) {
- var result = [];
- _forOf(iter, false, result.push, result, ITERATOR);
- return result;
- };
- // https://github.com/DavidBruant/Map-Set.prototype.toJSON
- var _collectionToJson = function (NAME) {
- return function toJSON() {
- if (_classof(this) != NAME) throw TypeError(NAME + "#toJSON isn't generic");
- return _arrayFromIterable(this);
- };
- };
- // https://github.com/DavidBruant/Map-Set.prototype.toJSON
- _export(_export.P + _export.R, 'Map', { toJSON: _collectionToJson('Map') });
- // https://tc39.github.io/proposal-setmap-offrom/
- var _setCollectionOf = function (COLLECTION) {
- _export(_export.S, COLLECTION, { of: function of() {
- var length = arguments.length;
- var A = new Array(length);
- while (length--) A[length] = arguments[length];
- return new this(A);
- } });
- };
- // https://tc39.github.io/proposal-setmap-offrom/#sec-map.of
- _setCollectionOf('Map');
- // https://tc39.github.io/proposal-setmap-offrom/
- var _setCollectionFrom = function (COLLECTION) {
- _export(_export.S, COLLECTION, { from: function from(source /* , mapFn, thisArg */) {
- var mapFn = arguments[1];
- var mapping, A, n, cb;
- _aFunction(this);
- mapping = mapFn !== undefined;
- if (mapping) _aFunction(mapFn);
- if (source == undefined) return new this();
- A = [];
- if (mapping) {
- n = 0;
- cb = _ctx(mapFn, arguments[2], 2);
- _forOf(source, false, function (nextItem) {
- A.push(cb(nextItem, n++));
- });
- } else {
- _forOf(source, false, A.push, A);
- }
- return new this(A);
- } });
- };
- // https://tc39.github.io/proposal-setmap-offrom/#sec-map.from
- _setCollectionFrom('Map');
- var map = _core.Map;
- var map$1 = createCommonjsModule(function (module) {
- module.exports = { "default": map, __esModule: true };
- });
- var _Map = unwrapExports(map$1);
- var colorName = {
- "aliceblue": [240, 248, 255],
- "antiquewhite": [250, 235, 215],
- "aqua": [0, 255, 255],
- "aquamarine": [127, 255, 212],
- "azure": [240, 255, 255],
- "beige": [245, 245, 220],
- "bisque": [255, 228, 196],
- "black": [0, 0, 0],
- "blanchedalmond": [255, 235, 205],
- "blue": [0, 0, 255],
- "blueviolet": [138, 43, 226],
- "brown": [165, 42, 42],
- "burlywood": [222, 184, 135],
- "cadetblue": [95, 158, 160],
- "chartreuse": [127, 255, 0],
- "chocolate": [210, 105, 30],
- "coral": [255, 127, 80],
- "cornflowerblue": [100, 149, 237],
- "cornsilk": [255, 248, 220],
- "crimson": [220, 20, 60],
- "cyan": [0, 255, 255],
- "darkblue": [0, 0, 139],
- "darkcyan": [0, 139, 139],
- "darkgoldenrod": [184, 134, 11],
- "darkgray": [169, 169, 169],
- "darkgreen": [0, 100, 0],
- "darkgrey": [169, 169, 169],
- "darkkhaki": [189, 183, 107],
- "darkmagenta": [139, 0, 139],
- "darkolivegreen": [85, 107, 47],
- "darkorange": [255, 140, 0],
- "darkorchid": [153, 50, 204],
- "darkred": [139, 0, 0],
- "darksalmon": [233, 150, 122],
- "darkseagreen": [143, 188, 143],
- "darkslateblue": [72, 61, 139],
- "darkslategray": [47, 79, 79],
- "darkslategrey": [47, 79, 79],
- "darkturquoise": [0, 206, 209],
- "darkviolet": [148, 0, 211],
- "deeppink": [255, 20, 147],
- "deepskyblue": [0, 191, 255],
- "dimgray": [105, 105, 105],
- "dimgrey": [105, 105, 105],
- "dodgerblue": [30, 144, 255],
- "firebrick": [178, 34, 34],
- "floralwhite": [255, 250, 240],
- "forestgreen": [34, 139, 34],
- "fuchsia": [255, 0, 255],
- "gainsboro": [220, 220, 220],
- "ghostwhite": [248, 248, 255],
- "gold": [255, 215, 0],
- "goldenrod": [218, 165, 32],
- "gray": [128, 128, 128],
- "green": [0, 128, 0],
- "greenyellow": [173, 255, 47],
- "grey": [128, 128, 128],
- "honeydew": [240, 255, 240],
- "hotpink": [255, 105, 180],
- "indianred": [205, 92, 92],
- "indigo": [75, 0, 130],
- "ivory": [255, 255, 240],
- "khaki": [240, 230, 140],
- "lavender": [230, 230, 250],
- "lavenderblush": [255, 240, 245],
- "lawngreen": [124, 252, 0],
- "lemonchiffon": [255, 250, 205],
- "lightblue": [173, 216, 230],
- "lightcoral": [240, 128, 128],
- "lightcyan": [224, 255, 255],
- "lightgoldenrodyellow": [250, 250, 210],
- "lightgray": [211, 211, 211],
- "lightgreen": [144, 238, 144],
- "lightgrey": [211, 211, 211],
- "lightpink": [255, 182, 193],
- "lightsalmon": [255, 160, 122],
- "lightseagreen": [32, 178, 170],
- "lightskyblue": [135, 206, 250],
- "lightslategray": [119, 136, 153],
- "lightslategrey": [119, 136, 153],
- "lightsteelblue": [176, 196, 222],
- "lightyellow": [255, 255, 224],
- "lime": [0, 255, 0],
- "limegreen": [50, 205, 50],
- "linen": [250, 240, 230],
- "magenta": [255, 0, 255],
- "maroon": [128, 0, 0],
- "mediumaquamarine": [102, 205, 170],
- "mediumblue": [0, 0, 205],
- "mediumorchid": [186, 85, 211],
- "mediumpurple": [147, 112, 219],
- "mediumseagreen": [60, 179, 113],
- "mediumslateblue": [123, 104, 238],
- "mediumspringgreen": [0, 250, 154],
- "mediumturquoise": [72, 209, 204],
- "mediumvioletred": [199, 21, 133],
- "midnightblue": [25, 25, 112],
- "mintcream": [245, 255, 250],
- "mistyrose": [255, 228, 225],
- "moccasin": [255, 228, 181],
- "navajowhite": [255, 222, 173],
- "navy": [0, 0, 128],
- "oldlace": [253, 245, 230],
- "olive": [128, 128, 0],
- "olivedrab": [107, 142, 35],
- "orange": [255, 165, 0],
- "orangered": [255, 69, 0],
- "orchid": [218, 112, 214],
- "palegoldenrod": [238, 232, 170],
- "palegreen": [152, 251, 152],
- "paleturquoise": [175, 238, 238],
- "palevioletred": [219, 112, 147],
- "papayawhip": [255, 239, 213],
- "peachpuff": [255, 218, 185],
- "peru": [205, 133, 63],
- "pink": [255, 192, 203],
- "plum": [221, 160, 221],
- "powderblue": [176, 224, 230],
- "purple": [128, 0, 128],
- "rebeccapurple": [102, 51, 153],
- "red": [255, 0, 0],
- "rosybrown": [188, 143, 143],
- "royalblue": [65, 105, 225],
- "saddlebrown": [139, 69, 19],
- "salmon": [250, 128, 114],
- "sandybrown": [244, 164, 96],
- "seagreen": [46, 139, 87],
- "seashell": [255, 245, 238],
- "sienna": [160, 82, 45],
- "silver": [192, 192, 192],
- "skyblue": [135, 206, 235],
- "slateblue": [106, 90, 205],
- "slategray": [112, 128, 144],
- "slategrey": [112, 128, 144],
- "snow": [255, 250, 250],
- "springgreen": [0, 255, 127],
- "steelblue": [70, 130, 180],
- "tan": [210, 180, 140],
- "teal": [0, 128, 128],
- "thistle": [216, 191, 216],
- "tomato": [255, 99, 71],
- "turquoise": [64, 224, 208],
- "violet": [238, 130, 238],
- "wheat": [245, 222, 179],
- "white": [255, 255, 255],
- "whitesmoke": [245, 245, 245],
- "yellow": [255, 255, 0],
- "yellowgreen": [154, 205, 50]
- };
- var conversions = createCommonjsModule(function (module) {
- /* MIT license */
- // NOTE: conversions should only return primitive values (i.e. arrays, or
- // values that give correct `typeof` results).
- // do not use box values types (i.e. Number(), String(), etc.)
- var reverseKeywords = {};
- for (var key in colorName) {
- if (colorName.hasOwnProperty(key)) {
- reverseKeywords[colorName[key]] = key;
- }
- }
- var convert = module.exports = {
- rgb: {channels: 3, labels: 'rgb'},
- hsl: {channels: 3, labels: 'hsl'},
- hsv: {channels: 3, labels: 'hsv'},
- hwb: {channels: 3, labels: 'hwb'},
- cmyk: {channels: 4, labels: 'cmyk'},
- xyz: {channels: 3, labels: 'xyz'},
- lab: {channels: 3, labels: 'lab'},
- lch: {channels: 3, labels: 'lch'},
- hex: {channels: 1, labels: ['hex']},
- keyword: {channels: 1, labels: ['keyword']},
- ansi16: {channels: 1, labels: ['ansi16']},
- ansi256: {channels: 1, labels: ['ansi256']},
- hcg: {channels: 3, labels: ['h', 'c', 'g']},
- apple: {channels: 3, labels: ['r16', 'g16', 'b16']},
- gray: {channels: 1, labels: ['gray']}
- };
- // hide .channels and .labels properties
- for (var model in convert) {
- if (convert.hasOwnProperty(model)) {
- if (!('channels' in convert[model])) {
- throw new Error('missing channels property: ' + model);
- }
- if (!('labels' in convert[model])) {
- throw new Error('missing channel labels property: ' + model);
- }
- if (convert[model].labels.length !== convert[model].channels) {
- throw new Error('channel and label counts mismatch: ' + model);
- }
- var channels = convert[model].channels;
- var labels = convert[model].labels;
- delete convert[model].channels;
- delete convert[model].labels;
- Object.defineProperty(convert[model], 'channels', {value: channels});
- Object.defineProperty(convert[model], 'labels', {value: labels});
- }
- }
- convert.rgb.hsl = function (rgb) {
- var r = rgb[0] / 255;
- var g = rgb[1] / 255;
- var b = rgb[2] / 255;
- var min = Math.min(r, g, b);
- var max = Math.max(r, g, b);
- var delta = max - min;
- var h;
- var s;
- var l;
- if (max === min) {
- h = 0;
- } else if (r === max) {
- h = (g - b) / delta;
- } else if (g === max) {
- h = 2 + (b - r) / delta;
- } else if (b === max) {
- h = 4 + (r - g) / delta;
- }
- h = Math.min(h * 60, 360);
- if (h < 0) {
- h += 360;
- }
- l = (min + max) / 2;
- if (max === min) {
- s = 0;
- } else if (l <= 0.5) {
- s = delta / (max + min);
- } else {
- s = delta / (2 - max - min);
- }
- return [h, s * 100, l * 100];
- };
- convert.rgb.hsv = function (rgb) {
- var rdif;
- var gdif;
- var bdif;
- var h;
- var s;
- var r = rgb[0] / 255;
- var g = rgb[1] / 255;
- var b = rgb[2] / 255;
- var v = Math.max(r, g, b);
- var diff = v - Math.min(r, g, b);
- var diffc = function (c) {
- return (v - c) / 6 / diff + 1 / 2;
- };
- if (diff === 0) {
- h = s = 0;
- } else {
- s = diff / v;
- rdif = diffc(r);
- gdif = diffc(g);
- bdif = diffc(b);
- if (r === v) {
- h = bdif - gdif;
- } else if (g === v) {
- h = (1 / 3) + rdif - bdif;
- } else if (b === v) {
- h = (2 / 3) + gdif - rdif;
- }
- if (h < 0) {
- h += 1;
- } else if (h > 1) {
- h -= 1;
- }
- }
- return [
- h * 360,
- s * 100,
- v * 100
- ];
- };
- convert.rgb.hwb = function (rgb) {
- var r = rgb[0];
- var g = rgb[1];
- var b = rgb[2];
- var h = convert.rgb.hsl(rgb)[0];
- var w = 1 / 255 * Math.min(r, Math.min(g, b));
- b = 1 - 1 / 255 * Math.max(r, Math.max(g, b));
- return [h, w * 100, b * 100];
- };
- convert.rgb.cmyk = function (rgb) {
- var r = rgb[0] / 255;
- var g = rgb[1] / 255;
- var b = rgb[2] / 255;
- var c;
- var m;
- var y;
- var k;
- k = Math.min(1 - r, 1 - g, 1 - b);
- c = (1 - r - k) / (1 - k) || 0;
- m = (1 - g - k) / (1 - k) || 0;
- y = (1 - b - k) / (1 - k) || 0;
- return [c * 100, m * 100, y * 100, k * 100];
- };
- /**
- * See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance
- * */
- function comparativeDistance(x, y) {
- return (
- Math.pow(x[0] - y[0], 2) +
- Math.pow(x[1] - y[1], 2) +
- Math.pow(x[2] - y[2], 2)
- );
- }
- convert.rgb.keyword = function (rgb) {
- var reversed = reverseKeywords[rgb];
- if (reversed) {
- return reversed;
- }
- var currentClosestDistance = Infinity;
- var currentClosestKeyword;
- for (var keyword in colorName) {
- if (colorName.hasOwnProperty(keyword)) {
- var value = colorName[keyword];
- // Compute comparative distance
- var distance = comparativeDistance(rgb, value);
- // Check if its less, if so set as closest
- if (distance < currentClosestDistance) {
- currentClosestDistance = distance;
- currentClosestKeyword = keyword;
- }
- }
- }
- return currentClosestKeyword;
- };
- convert.keyword.rgb = function (keyword) {
- return colorName[keyword];
- };
- convert.rgb.xyz = function (rgb) {
- var r = rgb[0] / 255;
- var g = rgb[1] / 255;
- var b = rgb[2] / 255;
- // assume sRGB
- r = r > 0.04045 ? Math.pow(((r + 0.055) / 1.055), 2.4) : (r / 12.92);
- g = g > 0.04045 ? Math.pow(((g + 0.055) / 1.055), 2.4) : (g / 12.92);
- b = b > 0.04045 ? Math.pow(((b + 0.055) / 1.055), 2.4) : (b / 12.92);
- var x = (r * 0.4124) + (g * 0.3576) + (b * 0.1805);
- var y = (r * 0.2126) + (g * 0.7152) + (b * 0.0722);
- var z = (r * 0.0193) + (g * 0.1192) + (b * 0.9505);
- return [x * 100, y * 100, z * 100];
- };
- convert.rgb.lab = function (rgb) {
- var xyz = convert.rgb.xyz(rgb);
- var x = xyz[0];
- var y = xyz[1];
- var z = xyz[2];
- var l;
- var a;
- var b;
- x /= 95.047;
- y /= 100;
- z /= 108.883;
- x = x > 0.008856 ? Math.pow(x, 1 / 3) : (7.787 * x) + (16 / 116);
- y = y > 0.008856 ? Math.pow(y, 1 / 3) : (7.787 * y) + (16 / 116);
- z = z > 0.008856 ? Math.pow(z, 1 / 3) : (7.787 * z) + (16 / 116);
- l = (116 * y) - 16;
- a = 500 * (x - y);
- b = 200 * (y - z);
- return [l, a, b];
- };
- convert.hsl.rgb = function (hsl) {
- var h = hsl[0] / 360;
- var s = hsl[1] / 100;
- var l = hsl[2] / 100;
- var t1;
- var t2;
- var t3;
- var rgb;
- var val;
- if (s === 0) {
- val = l * 255;
- return [val, val, val];
- }
- if (l < 0.5) {
- t2 = l * (1 + s);
- } else {
- t2 = l + s - l * s;
- }
- t1 = 2 * l - t2;
- rgb = [0, 0, 0];
- for (var i = 0; i < 3; i++) {
- t3 = h + 1 / 3 * -(i - 1);
- if (t3 < 0) {
- t3++;
- }
- if (t3 > 1) {
- t3--;
- }
- if (6 * t3 < 1) {
- val = t1 + (t2 - t1) * 6 * t3;
- } else if (2 * t3 < 1) {
- val = t2;
- } else if (3 * t3 < 2) {
- val = t1 + (t2 - t1) * (2 / 3 - t3) * 6;
- } else {
- val = t1;
- }
- rgb[i] = val * 255;
- }
- return rgb;
- };
- convert.hsl.hsv = function (hsl) {
- var h = hsl[0];
- var s = hsl[1] / 100;
- var l = hsl[2] / 100;
- var smin = s;
- var lmin = Math.max(l, 0.01);
- var sv;
- var v;
- l *= 2;
- s *= (l <= 1) ? l : 2 - l;
- smin *= lmin <= 1 ? lmin : 2 - lmin;
- v = (l + s) / 2;
- sv = l === 0 ? (2 * smin) / (lmin + smin) : (2 * s) / (l + s);
- return [h, sv * 100, v * 100];
- };
- convert.hsv.rgb = function (hsv) {
- var h = hsv[0] / 60;
- var s = hsv[1] / 100;
- var v = hsv[2] / 100;
- var hi = Math.floor(h) % 6;
- var f = h - Math.floor(h);
- var p = 255 * v * (1 - s);
- var q = 255 * v * (1 - (s * f));
- var t = 255 * v * (1 - (s * (1 - f)));
- v *= 255;
- switch (hi) {
- case 0:
- return [v, t, p];
- case 1:
- return [q, v, p];
- case 2:
- return [p, v, t];
- case 3:
- return [p, q, v];
- case 4:
- return [t, p, v];
- case 5:
- return [v, p, q];
- }
- };
- convert.hsv.hsl = function (hsv) {
- var h = hsv[0];
- var s = hsv[1] / 100;
- var v = hsv[2] / 100;
- var vmin = Math.max(v, 0.01);
- var lmin;
- var sl;
- var l;
- l = (2 - s) * v;
- lmin = (2 - s) * vmin;
- sl = s * vmin;
- sl /= (lmin <= 1) ? lmin : 2 - lmin;
- sl = sl || 0;
- l /= 2;
- return [h, sl * 100, l * 100];
- };
- // http://dev.w3.org/csswg/css-color/#hwb-to-rgb
- convert.hwb.rgb = function (hwb) {
- var h = hwb[0] / 360;
- var wh = hwb[1] / 100;
- var bl = hwb[2] / 100;
- var ratio = wh + bl;
- var i;
- var v;
- var f;
- var n;
- // wh + bl cant be > 1
- if (ratio > 1) {
- wh /= ratio;
- bl /= ratio;
- }
- i = Math.floor(6 * h);
- v = 1 - bl;
- f = 6 * h - i;
- if ((i & 0x01) !== 0) {
- f = 1 - f;
- }
- n = wh + f * (v - wh); // linear interpolation
- var r;
- var g;
- var b;
- switch (i) {
- default:
- case 6:
- case 0: r = v; g = n; b = wh; break;
- case 1: r = n; g = v; b = wh; break;
- case 2: r = wh; g = v; b = n; break;
- case 3: r = wh; g = n; b = v; break;
- case 4: r = n; g = wh; b = v; break;
- case 5: r = v; g = wh; b = n; break;
- }
- return [r * 255, g * 255, b * 255];
- };
- convert.cmyk.rgb = function (cmyk) {
- var c = cmyk[0] / 100;
- var m = cmyk[1] / 100;
- var y = cmyk[2] / 100;
- var k = cmyk[3] / 100;
- var r;
- var g;
- var b;
- r = 1 - Math.min(1, c * (1 - k) + k);
- g = 1 - Math.min(1, m * (1 - k) + k);
- b = 1 - Math.min(1, y * (1 - k) + k);
- return [r * 255, g * 255, b * 255];
- };
- convert.xyz.rgb = function (xyz) {
- var x = xyz[0] / 100;
- var y = xyz[1] / 100;
- var z = xyz[2] / 100;
- var r;
- var g;
- var b;
- r = (x * 3.2406) + (y * -1.5372) + (z * -0.4986);
- g = (x * -0.9689) + (y * 1.8758) + (z * 0.0415);
- b = (x * 0.0557) + (y * -0.2040) + (z * 1.0570);
- // assume sRGB
- r = r > 0.0031308
- ? ((1.055 * Math.pow(r, 1.0 / 2.4)) - 0.055)
- : r * 12.92;
- g = g > 0.0031308
- ? ((1.055 * Math.pow(g, 1.0 / 2.4)) - 0.055)
- : g * 12.92;
- b = b > 0.0031308
- ? ((1.055 * Math.pow(b, 1.0 / 2.4)) - 0.055)
- : b * 12.92;
- r = Math.min(Math.max(0, r), 1);
- g = Math.min(Math.max(0, g), 1);
- b = Math.min(Math.max(0, b), 1);
- return [r * 255, g * 255, b * 255];
- };
- convert.xyz.lab = function (xyz) {
- var x = xyz[0];
- var y = xyz[1];
- var z = xyz[2];
- var l;
- var a;
- var b;
- x /= 95.047;
- y /= 100;
- z /= 108.883;
- x = x > 0.008856 ? Math.pow(x, 1 / 3) : (7.787 * x) + (16 / 116);
- y = y > 0.008856 ? Math.pow(y, 1 / 3) : (7.787 * y) + (16 / 116);
- z = z > 0.008856 ? Math.pow(z, 1 / 3) : (7.787 * z) + (16 / 116);
- l = (116 * y) - 16;
- a = 500 * (x - y);
- b = 200 * (y - z);
- return [l, a, b];
- };
- convert.lab.xyz = function (lab) {
- var l = lab[0];
- var a = lab[1];
- var b = lab[2];
- var x;
- var y;
- var z;
- y = (l + 16) / 116;
- x = a / 500 + y;
- z = y - b / 200;
- var y2 = Math.pow(y, 3);
- var x2 = Math.pow(x, 3);
- var z2 = Math.pow(z, 3);
- y = y2 > 0.008856 ? y2 : (y - 16 / 116) / 7.787;
- x = x2 > 0.008856 ? x2 : (x - 16 / 116) / 7.787;
- z = z2 > 0.008856 ? z2 : (z - 16 / 116) / 7.787;
- x *= 95.047;
- y *= 100;
- z *= 108.883;
- return [x, y, z];
- };
- convert.lab.lch = function (lab) {
- var l = lab[0];
- var a = lab[1];
- var b = lab[2];
- var hr;
- var h;
- var c;
- hr = Math.atan2(b, a);
- h = hr * 360 / 2 / Math.PI;
- if (h < 0) {
- h += 360;
- }
- c = Math.sqrt(a * a + b * b);
- return [l, c, h];
- };
- convert.lch.lab = function (lch) {
- var l = lch[0];
- var c = lch[1];
- var h = lch[2];
- var a;
- var b;
- var hr;
- hr = h / 360 * 2 * Math.PI;
- a = c * Math.cos(hr);
- b = c * Math.sin(hr);
- return [l, a, b];
- };
- convert.rgb.ansi16 = function (args) {
- var r = args[0];
- var g = args[1];
- var b = args[2];
- var value = 1 in arguments ? arguments[1] : convert.rgb.hsv(args)[2]; // hsv -> ansi16 optimization
- value = Math.round(value / 50);
- if (value === 0) {
- return 30;
- }
- var ansi = 30
- + ((Math.round(b / 255) << 2)
- | (Math.round(g / 255) << 1)
- | Math.round(r / 255));
- if (value === 2) {
- ansi += 60;
- }
- return ansi;
- };
- convert.hsv.ansi16 = function (args) {
- // optimization here; we already know the value and don't need to get
- // it converted for us.
- return convert.rgb.ansi16(convert.hsv.rgb(args), args[2]);
- };
- convert.rgb.ansi256 = function (args) {
- var r = args[0];
- var g = args[1];
- var b = args[2];
- // we use the extended greyscale palette here, with the exception of
- // black and white. normal palette only has 4 greyscale shades.
- if (r === g && g === b) {
- if (r < 8) {
- return 16;
- }
- if (r > 248) {
- return 231;
- }
- return Math.round(((r - 8) / 247) * 24) + 232;
- }
- var ansi = 16
- + (36 * Math.round(r / 255 * 5))
- + (6 * Math.round(g / 255 * 5))
- + Math.round(b / 255 * 5);
- return ansi;
- };
- convert.ansi16.rgb = function (args) {
- var color = args % 10;
- // handle greyscale
- if (color === 0 || color === 7) {
- if (args > 50) {
- color += 3.5;
- }
- color = color / 10.5 * 255;
- return [color, color, color];
- }
- var mult = (~~(args > 50) + 1) * 0.5;
- var r = ((color & 1) * mult) * 255;
- var g = (((color >> 1) & 1) * mult) * 255;
- var b = (((color >> 2) & 1) * mult) * 255;
- return [r, g, b];
- };
- convert.ansi256.rgb = function (args) {
- // handle greyscale
- if (args >= 232) {
- var c = (args - 232) * 10 + 8;
- return [c, c, c];
- }
- args -= 16;
- var rem;
- var r = Math.floor(args / 36) / 5 * 255;
- var g = Math.floor((rem = args % 36) / 6) / 5 * 255;
- var b = (rem % 6) / 5 * 255;
- return [r, g, b];
- };
- convert.rgb.hex = function (args) {
- var integer = ((Math.round(args[0]) & 0xFF) << 16)
- + ((Math.round(args[1]) & 0xFF) << 8)
- + (Math.round(args[2]) & 0xFF);
- var string = integer.toString(16).toUpperCase();
- return '000000'.substring(string.length) + string;
- };
- convert.hex.rgb = function (args) {
- var match = args.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);
- if (!match) {
- return [0, 0, 0];
- }
- var colorString = match[0];
- if (match[0].length === 3) {
- colorString = colorString.split('').map(function (char) {
- return char + char;
- }).join('');
- }
- var integer = parseInt(colorString, 16);
- var r = (integer >> 16) & 0xFF;
- var g = (integer >> 8) & 0xFF;
- var b = integer & 0xFF;
- return [r, g, b];
- };
- convert.rgb.hcg = function (rgb) {
- var r = rgb[0] / 255;
- var g = rgb[1] / 255;
- var b = rgb[2] / 255;
- var max = Math.max(Math.max(r, g), b);
- var min = Math.min(Math.min(r, g), b);
- var chroma = (max - min);
- var grayscale;
- var hue;
- if (chroma < 1) {
- grayscale = min / (1 - chroma);
- } else {
- grayscale = 0;
- }
- if (chroma <= 0) {
- hue = 0;
- } else
- if (max === r) {
- hue = ((g - b) / chroma) % 6;
- } else
- if (max === g) {
- hue = 2 + (b - r) / chroma;
- } else {
- hue = 4 + (r - g) / chroma + 4;
- }
- hue /= 6;
- hue %= 1;
- return [hue * 360, chroma * 100, grayscale * 100];
- };
- convert.hsl.hcg = function (hsl) {
- var s = hsl[1] / 100;
- var l = hsl[2] / 100;
- var c = 1;
- var f = 0;
- if (l < 0.5) {
- c = 2.0 * s * l;
- } else {
- c = 2.0 * s * (1.0 - l);
- }
- if (c < 1.0) {
- f = (l - 0.5 * c) / (1.0 - c);
- }
- return [hsl[0], c * 100, f * 100];
- };
- convert.hsv.hcg = function (hsv) {
- var s = hsv[1] / 100;
- var v = hsv[2] / 100;
- var c = s * v;
- var f = 0;
- if (c < 1.0) {
- f = (v - c) / (1 - c);
- }
- return [hsv[0], c * 100, f * 100];
- };
- convert.hcg.rgb = function (hcg) {
- var h = hcg[0] / 360;
- var c = hcg[1] / 100;
- var g = hcg[2] / 100;
- if (c === 0.0) {
- return [g * 255, g * 255, g * 255];
- }
- var pure = [0, 0, 0];
- var hi = (h % 1) * 6;
- var v = hi % 1;
- var w = 1 - v;
- var mg = 0;
- switch (Math.floor(hi)) {
- case 0:
- pure[0] = 1; pure[1] = v; pure[2] = 0; break;
- case 1:
- pure[0] = w; pure[1] = 1; pure[2] = 0; break;
- case 2:
- pure[0] = 0; pure[1] = 1; pure[2] = v; break;
- case 3:
- pure[0] = 0; pure[1] = w; pure[2] = 1; break;
- case 4:
- pure[0] = v; pure[1] = 0; pure[2] = 1; break;
- default:
- pure[0] = 1; pure[1] = 0; pure[2] = w;
- }
- mg = (1.0 - c) * g;
- return [
- (c * pure[0] + mg) * 255,
- (c * pure[1] + mg) * 255,
- (c * pure[2] + mg) * 255
- ];
- };
- convert.hcg.hsv = function (hcg) {
- var c = hcg[1] / 100;
- var g = hcg[2] / 100;
- var v = c + g * (1.0 - c);
- var f = 0;
- if (v > 0.0) {
- f = c / v;
- }
- return [hcg[0], f * 100, v * 100];
- };
- convert.hcg.hsl = function (hcg) {
- var c = hcg[1] / 100;
- var g = hcg[2] / 100;
- var l = g * (1.0 - c) + 0.5 * c;
- var s = 0;
- if (l > 0.0 && l < 0.5) {
- s = c / (2 * l);
- } else
- if (l >= 0.5 && l < 1.0) {
- s = c / (2 * (1 - l));
- }
- return [hcg[0], s * 100, l * 100];
- };
- convert.hcg.hwb = function (hcg) {
- var c = hcg[1] / 100;
- var g = hcg[2] / 100;
- var v = c + g * (1.0 - c);
- return [hcg[0], (v - c) * 100, (1 - v) * 100];
- };
- convert.hwb.hcg = function (hwb) {
- var w = hwb[1] / 100;
- var b = hwb[2] / 100;
- var v = 1 - b;
- var c = v - w;
- var g = 0;
- if (c < 1) {
- g = (v - c) / (1 - c);
- }
- return [hwb[0], c * 100, g * 100];
- };
- convert.apple.rgb = function (apple) {
- return [(apple[0] / 65535) * 255, (apple[1] / 65535) * 255, (apple[2] / 65535) * 255];
- };
- convert.rgb.apple = function (rgb) {
- return [(rgb[0] / 255) * 65535, (rgb[1] / 255) * 65535, (rgb[2] / 255) * 65535];
- };
- convert.gray.rgb = function (args) {
- return [args[0] / 100 * 255, args[0] / 100 * 255, args[0] / 100 * 255];
- };
- convert.gray.hsl = convert.gray.hsv = function (args) {
- return [0, 0, args[0]];
- };
- convert.gray.hwb = function (gray) {
- return [0, 100, gray[0]];
- };
- convert.gray.cmyk = function (gray) {
- return [0, 0, 0, gray[0]];
- };
- convert.gray.lab = function (gray) {
- return [gray[0], 0, 0];
- };
- convert.gray.hex = function (gray) {
- var val = Math.round(gray[0] / 100 * 255) & 0xFF;
- var integer = (val << 16) + (val << 8) + val;
- var string = integer.toString(16).toUpperCase();
- return '000000'.substring(string.length) + string;
- };
- convert.rgb.gray = function (rgb) {
- var val = (rgb[0] + rgb[1] + rgb[2]) / 3;
- return [val / 255 * 100];
- };
- });
- var conversions_1 = conversions.rgb;
- var conversions_2 = conversions.hsl;
- var conversions_3 = conversions.hsv;
- var conversions_4 = conversions.hwb;
- var conversions_5 = conversions.cmyk;
- var conversions_6 = conversions.xyz;
- var conversions_7 = conversions.lab;
- var conversions_8 = conversions.lch;
- var conversions_9 = conversions.hex;
- var conversions_10 = conversions.keyword;
- var conversions_11 = conversions.ansi16;
- var conversions_12 = conversions.ansi256;
- var conversions_13 = conversions.hcg;
- var conversions_14 = conversions.apple;
- var conversions_15 = conversions.gray;
- /*
- this function routes a model to all other models.
- all functions that are routed have a property `.conversion` attached
- to the returned synthetic function. This property is an array
- of strings, each with the steps in between the 'from' and 'to'
- color models (inclusive).
- conversions that are not possible simply are not included.
- */
- function buildGraph() {
- var graph = {};
- // https://jsperf.com/object-keys-vs-for-in-with-closure/3
- var models = Object.keys(conversions);
- for (var len = models.length, i = 0; i < len; i++) {
- graph[models[i]] = {
- // http://jsperf.com/1-vs-infinity
- // micro-opt, but this is simple.
- distance: -1,
- parent: null
- };
- }
- return graph;
- }
- // https://en.wikipedia.org/wiki/Breadth-first_search
- function deriveBFS(fromModel) {
- var graph = buildGraph();
- var queue = [fromModel]; // unshift -> queue -> pop
- graph[fromModel].distance = 0;
- while (queue.length) {
- var current = queue.pop();
- var adjacents = Object.keys(conversions[current]);
- for (var len = adjacents.length, i = 0; i < len; i++) {
- var adjacent = adjacents[i];
- var node = graph[adjacent];
- if (node.distance === -1) {
- node.distance = graph[current].distance + 1;
- node.parent = current;
- queue.unshift(adjacent);
- }
- }
- }
- return graph;
- }
- function link(from, to) {
- return function (args) {
- return to(from(args));
- };
- }
- function wrapConversion(toModel, graph) {
- var path = [graph[toModel].parent, toModel];
- var fn = conversions[graph[toModel].parent][toModel];
- var cur = graph[toModel].parent;
- while (graph[cur].parent) {
- path.unshift(graph[cur].parent);
- fn = link(conversions[graph[cur].parent][cur], fn);
- cur = graph[cur].parent;
- }
- fn.conversion = path;
- return fn;
- }
- var route = function (fromModel) {
- var graph = deriveBFS(fromModel);
- var conversion = {};
- var models = Object.keys(graph);
- for (var len = models.length, i = 0; i < len; i++) {
- var toModel = models[i];
- var node = graph[toModel];
- if (node.parent === null) {
- // no possible conversion, or this node is the source model.
- continue;
- }
- conversion[toModel] = wrapConversion(toModel, graph);
- }
- return conversion;
- };
- var convert = {};
- var models = Object.keys(conversions);
- function wrapRaw(fn) {
- var wrappedFn = function (args) {
- if (args === undefined || args === null) {
- return args;
- }
- if (arguments.length > 1) {
- args = Array.prototype.slice.call(arguments);
- }
- return fn(args);
- };
- // preserve .conversion property if there is one
- if ('conversion' in fn) {
- wrappedFn.conversion = fn.conversion;
- }
- return wrappedFn;
- }
- function wrapRounded(fn) {
- var wrappedFn = function (args) {
- if (args === undefined || args === null) {
- return args;
- }
- if (arguments.length > 1) {
- args = Array.prototype.slice.call(arguments);
- }
- var result = fn(args);
- // we're assuming the result is an array here.
- // see notice in conversions.js; don't use box types
- // in conversion functions.
- if (typeof result === 'object') {
- for (var len = result.length, i = 0; i < len; i++) {
- result[i] = Math.round(result[i]);
- }
- }
- return result;
- };
- // preserve .conversion property if there is one
- if ('conversion' in fn) {
- wrappedFn.conversion = fn.conversion;
- }
- return wrappedFn;
- }
- models.forEach(function (fromModel) {
- convert[fromModel] = {};
- Object.defineProperty(convert[fromModel], 'channels', {value: conversions[fromModel].channels});
- Object.defineProperty(convert[fromModel], 'labels', {value: conversions[fromModel].labels});
- var routes = route(fromModel);
- var routeModels = Object.keys(routes);
- routeModels.forEach(function (toModel) {
- var fn = routes[toModel];
- convert[fromModel][toModel] = wrapRounded(fn);
- convert[fromModel][toModel].raw = wrapRaw(fn);
- });
- });
- var colorConvert = convert;
- var ansiStyles = createCommonjsModule(function (module) {
- var wrapAnsi16 = function wrapAnsi16(fn, offset) {
- return function () {
- var code = fn.apply(colorConvert, arguments);
- return '\x1B[' + (code + offset) + 'm';
- };
- };
- var wrapAnsi256 = function wrapAnsi256(fn, offset) {
- return function () {
- var code = fn.apply(colorConvert, arguments);
- return '\x1B[' + (38 + offset) + ';5;' + code + 'm';
- };
- };
- var wrapAnsi16m = function wrapAnsi16m(fn, offset) {
- return function () {
- var rgb = fn.apply(colorConvert, arguments);
- return '\x1B[' + (38 + offset) + ';2;' + rgb[0] + ';' + rgb[1] + ';' + rgb[2] + 'm';
- };
- };
- function assembleStyles() {
- var codes = new _Map();
- var styles = {
- modifier: {
- reset: [0, 0],
- // 21 isn't widely supported and 22 does the same thing
- bold: [1, 22],
- dim: [2, 22],
- italic: [3, 23],
- underline: [4, 24],
- inverse: [7, 27],
- hidden: [8, 28],
- strikethrough: [9, 29]
- },
- color: {
- black: [30, 39],
- red: [31, 39],
- green: [32, 39],
- yellow: [33, 39],
- blue: [34, 39],
- magenta: [35, 39],
- cyan: [36, 39],
- white: [37, 39],
- gray: [90, 39],
- // Bright color
- redBright: [91, 39],
- greenBright: [92, 39],
- yellowBright: [93, 39],
- blueBright: [94, 39],
- magentaBright: [95, 39],
- cyanBright: [96, 39],
- whiteBright: [97, 39]
- },
- bgColor: {
- bgBlack: [40, 49],
- bgRed: [41, 49],
- bgGreen: [42, 49],
- bgYellow: [43, 49],
- bgBlue: [44, 49],
- bgMagenta: [45, 49],
- bgCyan: [46, 49],
- bgWhite: [47, 49],
- // Bright color
- bgBlackBright: [100, 49],
- bgRedBright: [101, 49],
- bgGreenBright: [102, 49],
- bgYellowBright: [103, 49],
- bgBlueBright: [104, 49],
- bgMagentaBright: [105, 49],
- bgCyanBright: [106, 49],
- bgWhiteBright: [107, 49]
- }
- };
- // Fix humans
- styles.color.grey = styles.color.gray;
- var _iteratorNormalCompletion = true;
- var _didIteratorError = false;
- var _iteratorError = undefined;
- try {
- for (var _iterator = _getIterator(_Object$keys(styles)), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
- var groupName = _step.value;
- var group = styles[groupName];
- var _iteratorNormalCompletion3 = true;
- var _didIteratorError3 = false;
- var _iteratorError3 = undefined;
- try {
- for (var _iterator3 = _getIterator(_Object$keys(group)), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) {
- var styleName = _step3.value;
- var style = group[styleName];
- styles[styleName] = {
- open: '\x1B[' + style[0] + 'm',
- close: '\x1B[' + style[1] + 'm'
- };
- group[styleName] = styles[styleName];
- codes.set(style[0], style[1]);
- }
- } catch (err) {
- _didIteratorError3 = true;
- _iteratorError3 = err;
- } finally {
- try {
- if (!_iteratorNormalCompletion3 && _iterator3.return) {
- _iterator3.return();
- }
- } finally {
- if (_didIteratorError3) {
- throw _iteratorError3;
- }
- }
- }
- _Object$defineProperty(styles, groupName, {
- value: group,
- enumerable: false
- });
- Object.defineProperty(styles, 'codes', {
- value: codes,
- enumerable: false
- });
- }
- } catch (err) {
- _didIteratorError = true;
- _iteratorError = err;
- } finally {
- try {
- if (!_iteratorNormalCompletion && _iterator.return) {
- _iterator.return();
- }
- } finally {
- if (_didIteratorError) {
- throw _iteratorError;
- }
- }
- }
- var ansi2ansi = function ansi2ansi(n) {
- return n;
- };
- var rgb2rgb = function rgb2rgb(r, g, b) {
- return [r, g, b];
- };
- styles.color.close = '\x1B[39m';
- styles.bgColor.close = '\x1B[49m';
- styles.color.ansi = {
- ansi: wrapAnsi16(ansi2ansi, 0)
- };
- styles.color.ansi256 = {
- ansi256: wrapAnsi256(ansi2ansi, 0)
- };
- styles.color.ansi16m = {
- rgb: wrapAnsi16m(rgb2rgb, 0)
- };
- styles.bgColor.ansi = {
- ansi: wrapAnsi16(ansi2ansi, 10)
- };
- styles.bgColor.ansi256 = {
- ansi256: wrapAnsi256(ansi2ansi, 10)
- };
- styles.bgColor.ansi16m = {
- rgb: wrapAnsi16m(rgb2rgb, 10)
- };
- var _iteratorNormalCompletion2 = true;
- var _didIteratorError2 = false;
- var _iteratorError2 = undefined;
- try {
- for (var _iterator2 = _getIterator(_Object$keys(colorConvert)), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
- var key = _step2.value;
- if (_typeof(colorConvert[key]) !== 'object') {
- continue;
- }
- var suite = colorConvert[key];
- if (key === 'ansi16') {
- key = 'ansi';
- }
- if ('ansi16' in suite) {
- styles.color.ansi[key] = wrapAnsi16(suite.ansi16, 0);
- styles.bgColor.ansi[key] = wrapAnsi16(suite.ansi16, 10);
- }
- if ('ansi256' in suite) {
- styles.color.ansi256[key] = wrapAnsi256(suite.ansi256, 0);
- styles.bgColor.ansi256[key] = wrapAnsi256(suite.ansi256, 10);
- }
- if ('rgb' in suite) {
- styles.color.ansi16m[key] = wrapAnsi16m(suite.rgb, 0);
- styles.bgColor.ansi16m[key] = wrapAnsi16m(suite.rgb, 10);
- }
- }
- } catch (err) {
- _didIteratorError2 = true;
- _iteratorError2 = err;
- } finally {
- try {
- if (!_iteratorNormalCompletion2 && _iterator2.return) {
- _iterator2.return();
- }
- } finally {
- if (_didIteratorError2) {
- throw _iteratorError2;
- }
- }
- }
- return styles;
- }
- // Make the export immutable
- Object.defineProperty(module, 'exports', {
- enumerable: true,
- get: assembleStyles
- });
- });
- var fake_chalk = createCommonjsModule(function (module) {
- var _ansiStyles2 = _interopRequireDefault(ansiStyles);
- function _interopRequireDefault(obj) {
- return obj && obj.__esModule ? obj : { default: obj };
- }
- var returnInput = function returnInput(str) {
- return str;
- };
- /**
- * Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- *
- */
- var allColorsAsFunc = _Object$keys(_ansiStyles2.default).map(function (style) {
- return _defineProperty({}, style, returnInput);
- }).reduce(function (acc, cur) {
- return _Object$assign(acc, cur);
- });
- _Object$keys(allColorsAsFunc).map(function (color) {
- return allColorsAsFunc[color];
- }).forEach(function (style) {
- _Object$assign(style, allColorsAsFunc);
- _Object$assign(returnInput, style);
- });
- module.exports = allColorsAsFunc;
- });
- unwrapExports(fake_chalk);
- var SET = 'Set';
- // 23.2 Set Objects
- var es6_set = _collection(SET, function (get) {
- return function Set() { return get(this, arguments.length > 0 ? arguments[0] : undefined); };
- }, {
- // 23.2.3.1 Set.prototype.add(value)
- add: function add(value) {
- return _collectionStrong.def(_validateCollection(this, SET), value = value === 0 ? 0 : value, value);
- }
- }, _collectionStrong);
- // https://github.com/DavidBruant/Map-Set.prototype.toJSON
- _export(_export.P + _export.R, 'Set', { toJSON: _collectionToJson('Set') });
- // https://tc39.github.io/proposal-setmap-offrom/#sec-set.of
- _setCollectionOf('Set');
- // https://tc39.github.io/proposal-setmap-offrom/#sec-set.from
- _setCollectionFrom('Set');
- var set = _core.Set;
- var set$1 = createCommonjsModule(function (module) {
- module.exports = { "default": set, __esModule: true };
- });
- var _Set = unwrapExports(set$1);
- var build = createCommonjsModule(function (module) {
- // get the type of a value with handling the edge cases like `typeof []`
- // and `typeof null`
- var getType = function getType(value) {
- if (value === undefined) {
- return 'undefined';
- } else if (value === null) {
- return 'null';
- } else if (Array.isArray(value)) {
- return 'array';
- } else if (typeof value === 'boolean') {
- return 'boolean';
- } else if (typeof value === 'function') {
- return 'function';
- } else if (typeof value === 'number') {
- return 'number';
- } else if (typeof value === 'string') {
- return 'string';
- } else if ((typeof value === 'undefined' ? 'undefined' : _typeof(value)) === 'object') {
- if (value.constructor === RegExp) {
- return 'regexp';
- } else if (value.constructor === _Map) {
- return 'map';
- } else if (value.constructor === _Set) {
- return 'set';
- } else if (value.constructor === Date) {
- return 'date';
- }
- return 'object';
- // $FlowFixMe https://github.com/facebook/flow/issues/1015
- } else if ((typeof value === 'undefined' ? 'undefined' : _typeof(value)) === 'symbol') {
- return 'symbol';
- }
- throw new Error('value of unknown type: ' + value);
- };
- module.exports = getType;
- });
- // 7.2.9 SameValue(x, y)
- var _sameValue = Object.is || function is(x, y) {
- // eslint-disable-next-line no-self-compare
- return x === y ? x !== 0 || 1 / x === 1 / y : x != x && y != y;
- };
- // 19.1.3.10 Object.is(value1, value2)
- _export(_export.S, 'Object', { is: _sameValue });
- var is$1 = _core.Object.is;
- var is$2 = createCommonjsModule(function (module) {
- module.exports = { "default": is$1, __esModule: true };
- });
- var _Object$is = unwrapExports(is$2);
- var getOwnPropertySymbols = _core.Object.getOwnPropertySymbols;
- var getOwnPropertySymbols$1 = createCommonjsModule(function (module) {
- module.exports = { "default": getOwnPropertySymbols, __esModule: true };
- });
- var _Object$getOwnPropertySymbols = unwrapExports(getOwnPropertySymbols$1);
- var collections = createCommonjsModule(function (module, exports) {
- Object.defineProperty(exports, '__esModule', {
- value: true
- });
- exports.printIteratorEntries = printIteratorEntries;
- exports.printIteratorValues = printIteratorValues;
- exports.printListItems = printListItems;
- exports.printObjectProperties = printObjectProperties;
- var getSymbols = _Object$getOwnPropertySymbols || function (obj) {
- return [];
- };
- /**
- * Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- *
- *
- */
- var isSymbol = function isSymbol(key) {
- return (
- // $FlowFixMe string literal `symbol`. This value is not a valid `typeof` return value
- (typeof key === 'undefined' ? 'undefined' : _typeof(key)) === 'symbol' || toString.call(key) === '[object Symbol]'
- );
- };
- // Return entries (for example, of a map)
- // with spacing, indentation, and comma
- // without surrounding punctuation (for example, braces)
- function printIteratorEntries(
- // Flow 0.51.0: property `@@iterator` of $Iterator not found in Object
- iterator, config, indentation, depth, refs, printer) {
- var separator = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : ': ';
- var result = '';
- var current = iterator.next();
- if (!current.done) {
- result += config.spacingOuter;
- var indentationNext = indentation + config.indent;
- while (!current.done) {
- var name = printer(current.value[0], config, indentationNext, depth, refs);
- var value = printer(current.value[1], config, indentationNext, depth, refs);
- result += indentationNext + name + separator + value;
- current = iterator.next();
- if (!current.done) {
- result += ',' + config.spacingInner;
- } else if (!config.min) {
- result += ',';
- }
- }
- result += config.spacingOuter + indentation;
- }
- return result;
- }
- // Return values (for example, of a set)
- // with spacing, indentation, and comma
- // without surrounding punctuation (braces or brackets)
- function printIteratorValues(iterator, config, indentation, depth, refs, printer) {
- var result = '';
- var current = iterator.next();
- if (!current.done) {
- result += config.spacingOuter;
- var indentationNext = indentation + config.indent;
- while (!current.done) {
- result += indentationNext + printer(current.value, config, indentationNext, depth, refs);
- current = iterator.next();
- if (!current.done) {
- result += ',' + config.spacingInner;
- } else if (!config.min) {
- result += ',';
- }
- }
- result += config.spacingOuter + indentation;
- }
- return result;
- }
- // Return items (for example, of an array)
- // with spacing, indentation, and comma
- // without surrounding punctuation (for example, brackets)
- function printListItems(list, config, indentation, depth, refs, printer) {
- var result = '';
- if (list.length) {
- result += config.spacingOuter;
- var indentationNext = indentation + config.indent;
- for (var i = 0; i < list.length; i++) {
- result += indentationNext + printer(list[i], config, indentationNext, depth, refs);
- if (i < list.length - 1) {
- result += ',' + config.spacingInner;
- } else if (!config.min) {
- result += ',';
- }
- }
- result += config.spacingOuter + indentation;
- }
- return result;
- }
- // Return properties of an object
- // with spacing, indentation, and comma
- // without surrounding punctuation (for example, braces)
- function printObjectProperties(val, config, indentation, depth, refs, printer) {
- var result = '';
- var keys = _Object$keys(val).sort();
- var symbols = getSymbols(val);
- if (symbols.length) {
- keys = keys.filter(function (key) {
- return !isSymbol(key);
- }).concat(symbols);
- }
- if (keys.length) {
- result += config.spacingOuter;
- var indentationNext = indentation + config.indent;
- for (var i = 0; i < keys.length; i++) {
- var key = keys[i];
- var name = printer(key, config, indentationNext, depth, refs);
- var value = printer(val[key], config, indentationNext, depth, refs);
- result += indentationNext + name + ': ' + value;
- if (i < keys.length - 1) {
- result += ',' + config.spacingInner;
- } else if (!config.min) {
- result += ',';
- }
- }
- result += config.spacingOuter + indentation;
- }
- return result;
- }
- });
- unwrapExports(collections);
- var collections_1 = collections.printIteratorEntries;
- var collections_2 = collections.printIteratorValues;
- var collections_3 = collections.printListItems;
- var collections_4 = collections.printObjectProperties;
- var _for = _core.Symbol['for'];
- var _for$1 = createCommonjsModule(function (module) {
- module.exports = { "default": _for, __esModule: true };
- });
- var _Symbol$for = unwrapExports(_for$1);
- var asymmetric_matcher = createCommonjsModule(function (module, exports) {
- Object.defineProperty(exports, '__esModule', {
- value: true
- });
- exports.test = exports.serialize = undefined;
- /**
- * Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- *
- *
- */
- var asymmetricMatcher = _Symbol$for('jest.asymmetricMatcher');
- var SPACE = ' ';
- var serialize = exports.serialize = function (val, config, indentation, depth, refs, printer) {
- var stringedValue = val.toString();
- if (stringedValue === 'ArrayContaining' || stringedValue === 'ArrayNotContaining') {
- if (++depth > config.maxDepth) {
- return '[' + stringedValue + ']';
- }
- return stringedValue + SPACE + '[' + (0, collections.printListItems)(val.sample, config, indentation, depth, refs, printer) + ']';
- }
- if (stringedValue === 'ObjectContaining' || stringedValue === 'ObjectNotContaining') {
- if (++depth > config.maxDepth) {
- return '[' + stringedValue + ']';
- }
- return stringedValue + SPACE + '{' + (0, collections.printObjectProperties)(val.sample, config, indentation, depth, refs, printer) + '}';
- }
- if (stringedValue === 'StringMatching' || stringedValue === 'StringNotMatching') {
- return stringedValue + SPACE + printer(val.sample, config, indentation, depth, refs);
- }
- if (stringedValue === 'StringContaining' || stringedValue === 'StringNotContaining') {
- return stringedValue + SPACE + printer(val.sample, config, indentation, depth, refs);
- }
- return val.toAsymmetricMatcher();
- };
- var test = exports.test = function (val) {
- return val && val.$$typeof === asymmetricMatcher;
- };
- exports.default = { serialize: serialize, test: test };
- });
- unwrapExports(asymmetric_matcher);
- var asymmetric_matcher_1 = asymmetric_matcher.test;
- var asymmetric_matcher_2 = asymmetric_matcher.serialize;
- var ansiRegex = createCommonjsModule(function (module) {
- module.exports = function () {
- var pattern = ['[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:[a-zA-Z\\d]*(?:;[a-zA-Z\\d]*)*)?\\u0007)', '(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PRZcf-ntqry=><~]))'].join('|');
- return new RegExp(pattern, 'g');
- };
- });
- var convert_ansi = createCommonjsModule(function (module, exports) {
- Object.defineProperty(exports, '__esModule', {
- value: true
- });
- exports.serialize = exports.test = undefined;
- var _ansiRegex2 = _interopRequireDefault(ansiRegex);
- var _ansiStyles2 = _interopRequireDefault(ansiStyles);
- function _interopRequireDefault(obj) {
- return obj && obj.__esModule ? obj : { default: obj };
- }
- var toHumanReadableAnsi = function toHumanReadableAnsi(text) {
- return text.replace((0, _ansiRegex2.default)(), function (match, offset, string) {
- switch (match) {
- case _ansiStyles2.default.red.close:
- case _ansiStyles2.default.green.close:
- case _ansiStyles2.default.cyan.close:
- case _ansiStyles2.default.gray.close:
- case _ansiStyles2.default.white.close:
- case _ansiStyles2.default.yellow.close:
- case _ansiStyles2.default.bgRed.close:
- case _ansiStyles2.default.bgGreen.close:
- case _ansiStyles2.default.bgYellow.close:
- case _ansiStyles2.default.inverse.close:
- case _ansiStyles2.default.dim.close:
- case _ansiStyles2.default.bold.close:
- case _ansiStyles2.default.reset.open:
- case _ansiStyles2.default.reset.close:
- return '</>';
- case _ansiStyles2.default.red.open:
- return '<red>';
- case _ansiStyles2.default.green.open:
- return '<green>';
- case _ansiStyles2.default.cyan.open:
- return '<cyan>';
- case _ansiStyles2.default.gray.open:
- return '<gray>';
- case _ansiStyles2.default.white.open:
- return '<white>';
- case _ansiStyles2.default.yellow.open:
- return '<yellow>';
- case _ansiStyles2.default.bgRed.open:
- return '<bgRed>';
- case _ansiStyles2.default.bgGreen.open:
- return '<bgGreen>';
- case _ansiStyles2.default.bgYellow.open:
- return '<bgYellow>';
- case _ansiStyles2.default.inverse.open:
- return '<inverse>';
- case _ansiStyles2.default.dim.open:
- return '<dim>';
- case _ansiStyles2.default.bold.open:
- return '<bold>';
- default:
- return '';
- }
- });
- };
- /**
- * Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- *
- *
- */
- var test = exports.test = function (val) {
- return typeof val === 'string' && val.match((0, _ansiRegex2.default)());
- };
- var serialize = exports.serialize = function (val, config, indentation, depth, refs, printer) {
- return printer(toHumanReadableAnsi(val), config, indentation, depth, refs);
- };
- exports.default = { serialize: serialize, test: test };
- });
- unwrapExports(convert_ansi);
- var convert_ansi_1 = convert_ansi.serialize;
- var convert_ansi_2 = convert_ansi.test;
- var dom_collection = createCommonjsModule(function (module, exports) {
- Object.defineProperty(exports, '__esModule', {
- value: true
- });
- exports.serialize = exports.test = undefined;
- /**
- * Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- *
- *
- */
- var SPACE = ' ';
- var COLLECTION_NAMES = ['DOMStringMap', 'NamedNodeMap'];
- var test = exports.test = function (val) {
- return val && val.constructor && COLLECTION_NAMES.indexOf(val.constructor.name) !== -1;
- };
- var convertCollectionToObject = function convertCollectionToObject(collection) {
- var result = {};
- if (collection.constructor.name === 'NamedNodeMap') {
- for (var i = 0; i < collection.length; i++) {
- result[collection[i].name] = collection[i].value;
- }
- } else {
- result = _Object$assign({}, collection);
- }
- return result;
- };
- var serialize = exports.serialize = function (collection, config, indentation, depth, refs, printer) {
- if (++depth > config.maxDepth) {
- return '[' + collection.constructor.name + ']';
- }
- return collection.constructor.name + SPACE + '{' + (0, collections.printObjectProperties)(convertCollectionToObject(collection), config, indentation, depth, refs, printer) + '}';
- };
- exports.default = { serialize: serialize, test: test };
- });
- unwrapExports(dom_collection);
- var dom_collection_1 = dom_collection.serialize;
- var dom_collection_2 = dom_collection.test;
- var escape_html = createCommonjsModule(function (module, exports) {
- Object.defineProperty(exports, '__esModule', {
- value: true
- });
- exports.default = escapeHTML;
- /**
- * Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- *
- *
- */
- function escapeHTML(str) {
- return str.replace(/</g, '<').replace(/>/g, '>');
- }
- });
- unwrapExports(escape_html);
- var markup = createCommonjsModule(function (module, exports) {
- Object.defineProperty(exports, '__esModule', {
- value: true
- });
- exports.printElementAsLeaf = exports.printElement = exports.printComment = exports.printText = exports.printChildren = exports.printProps = undefined;
- var _escape_html2 = _interopRequireDefault(escape_html);
- function _interopRequireDefault(obj) {
- return obj && obj.__esModule ? obj : { default: obj };
- }
- // Return empty string if keys is empty.
- /**
- * Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- *
- *
- */
- var printProps = exports.printProps = function (keys, props, config, indentation, depth, refs, printer) {
- var indentationNext = indentation + config.indent;
- var colors = config.colors;
- return keys.map(function (key) {
- var value = props[key];
- var printed = printer(value, config, indentationNext, depth, refs);
- if (typeof value !== 'string') {
- if (printed.indexOf('\n') !== -1) {
- printed = config.spacingOuter + indentationNext + printed + config.spacingOuter + indentation;
- }
- printed = '{' + printed + '}';
- }
- return config.spacingInner + indentation + colors.prop.open + key + colors.prop.close + '=' + colors.value.open + printed + colors.value.close;
- }).join('');
- };
- // Return empty string if children is empty.
- var printChildren = exports.printChildren = function (children, config, indentation, depth, refs, printer) {
- return children.map(function (child) {
- return config.spacingOuter + indentation + (typeof child === 'string' ? printText(child, config) : printer(child, config, indentation, depth, refs));
- }).join('');
- };
- var printText = exports.printText = function (text, config) {
- var contentColor = config.colors.content;
- return contentColor.open + (0, _escape_html2.default)(text) + contentColor.close;
- };
- var printComment = exports.printComment = function (comment, config) {
- var commentColor = config.colors.comment;
- return commentColor.open + '<!--' + (0, _escape_html2.default)(comment) + '-->' + commentColor.close;
- };
- // Separate the functions to format props, children, and element,
- // so a plugin could override a particular function, if needed.
- // Too bad, so sad: the traditional (but unnecessary) space
- // in a self-closing tagColor requires a second test of printedProps.
- var printElement = exports.printElement = function (type, printedProps, printedChildren, config, indentation) {
- var tagColor = config.colors.tag;
- return tagColor.open + '<' + type + (printedProps && tagColor.close + printedProps + config.spacingOuter + indentation + tagColor.open) + (printedChildren ? '>' + tagColor.close + printedChildren + config.spacingOuter + indentation + tagColor.open + '</' + type : (printedProps && !config.min ? '' : ' ') + '/') + '>' + tagColor.close;
- };
- var printElementAsLeaf = exports.printElementAsLeaf = function (type, config) {
- var tagColor = config.colors.tag;
- return tagColor.open + '<' + type + tagColor.close + ' …' + tagColor.open + ' />' + tagColor.close;
- };
- });
- unwrapExports(markup);
- var markup_1 = markup.printElementAsLeaf;
- var markup_2 = markup.printElement;
- var markup_3 = markup.printComment;
- var markup_4 = markup.printText;
- var markup_5 = markup.printChildren;
- var markup_6 = markup.printProps;
- var dom_element = createCommonjsModule(function (module, exports) {
- Object.defineProperty(exports, '__esModule', {
- value: true
- });
- exports.serialize = exports.test = undefined;
- /**
- * Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- *
- *
- */
- var ELEMENT_NODE = 1;
- var TEXT_NODE = 3;
- var COMMENT_NODE = 8;
- var FRAGMENT_NODE = 11;
- var ELEMENT_REGEXP = /^((HTML|SVG)\w*)?Element$/;
- var testNode = function testNode(nodeType, name) {
- return nodeType === ELEMENT_NODE && ELEMENT_REGEXP.test(name) || nodeType === TEXT_NODE && name === 'Text' || nodeType === COMMENT_NODE && name === 'Comment' || nodeType === FRAGMENT_NODE && name === 'DocumentFragment';
- };
- var test = exports.test = function (val) {
- return val && val.constructor && val.constructor.name && testNode(val.nodeType, val.constructor.name);
- };
- // Convert array of attribute objects to keys array and props object.
- var keysMapper = function keysMapper(attribute) {
- return attribute.name;
- };
- var propsReducer = function propsReducer(props, attribute) {
- props[attribute.name] = attribute.value;
- return props;
- };
- var serialize = exports.serialize = function (node, config, indentation, depth, refs, printer) {
- if (node.nodeType === TEXT_NODE) {
- return (0, markup.printText)(node.data, config);
- }
- if (node.nodeType === COMMENT_NODE) {
- return (0, markup.printComment)(node.data, config);
- }
- var type = node.nodeType === FRAGMENT_NODE ? 'DocumentFragment' : node.tagName.toLowerCase();
- if (++depth > config.maxDepth) {
- return (0, markup.printElementAsLeaf)(type, config);
- }
- return (0, markup.printElement)(type, (0, markup.printProps)(Array.prototype.map.call(node.attributes || [], keysMapper).sort(), Array.prototype.reduce.call(node.attributes || [], propsReducer, {}), config, indentation + config.indent, depth, refs, printer), (0, markup.printChildren)(Array.prototype.slice.call(node.childNodes || node.children), config, indentation + config.indent, depth, refs, printer), config, indentation);
- };
- exports.default = { serialize: serialize, test: test };
- });
- unwrapExports(dom_element);
- var dom_element_1 = dom_element.serialize;
- var dom_element_2 = dom_element.test;
- var immutable = createCommonjsModule(function (module, exports) {
- Object.defineProperty(exports, '__esModule', {
- value: true
- });
- exports.test = exports.serialize = undefined;
- // SENTINEL constants are from https://github.com/facebook/immutable-js
- /**
- * Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- *
- *
- */
- var IS_ITERABLE_SENTINEL = '@@__IMMUTABLE_ITERABLE__@@';
- var IS_LIST_SENTINEL = '@@__IMMUTABLE_LIST__@@';
- var IS_KEYED_SENTINEL = '@@__IMMUTABLE_KEYED__@@';
- var IS_MAP_SENTINEL = '@@__IMMUTABLE_MAP__@@';
- var IS_ORDERED_SENTINEL = '@@__IMMUTABLE_ORDERED__@@';
- var IS_RECORD_SENTINEL = '@@__IMMUTABLE_RECORD__@@'; // immutable v4
- var IS_SEQ_SENTINEL = '@@__IMMUTABLE_SEQ__@@';
- var IS_SET_SENTINEL = '@@__IMMUTABLE_SET__@@';
- var IS_STACK_SENTINEL = '@@__IMMUTABLE_STACK__@@';
- var getImmutableName = function getImmutableName(name) {
- return 'Immutable.' + name;
- };
- var printAsLeaf = function printAsLeaf(name) {
- return '[' + name + ']';
- };
- var SPACE = ' ';
- var LAZY = '…'; // Seq is lazy if it calls a method like filter
- var printImmutableEntries = function printImmutableEntries(val, config, indentation, depth, refs, printer, type) {
- return ++depth > config.maxDepth ? printAsLeaf(getImmutableName(type)) : getImmutableName(type) + SPACE + '{' + (0, collections.printIteratorEntries)(val.entries(), config, indentation, depth, refs, printer) + '}';
- };
- // Record has an entries method because it is a collection in immutable v3.
- // Return an iterator for Immutable Record from version v3 or v4.
- var getRecordEntries = function getRecordEntries(val) {
- var i = 0;
- return {
- next: function next() {
- if (i < val._keys.length) {
- var key = val._keys[i++];
- return { done: false, value: [key, val.get(key)] };
- }
- return { done: true };
- }
- };
- };
- var printImmutableRecord = function printImmutableRecord(val, config, indentation, depth, refs, printer) {
- // _name property is defined only for an Immutable Record instance
- // which was constructed with a second optional descriptive name arg
- var name = getImmutableName(val._name || 'Record');
- return ++depth > config.maxDepth ? printAsLeaf(name) : name + SPACE + '{' + (0, collections.printIteratorEntries)(getRecordEntries(val), config, indentation, depth, refs, printer) + '}';
- };
- var printImmutableSeq = function printImmutableSeq(val, config, indentation, depth, refs, printer) {
- var name = getImmutableName('Seq');
- if (++depth > config.maxDepth) {
- return printAsLeaf(name);
- }
- if (val[IS_KEYED_SENTINEL]) {
- return name + SPACE + '{' + (
- // from Immutable collection of entries or from ECMAScript object
- val._iter || val._object ? (0, collections.printIteratorEntries)(val.entries(), config, indentation, depth, refs, printer) : LAZY) + '}';
- }
- return name + SPACE + '[' + (val._iter || // from Immutable collection of values
- val._array || // from ECMAScript array
- val._collection || // from ECMAScript collection in immutable v4
- val._iterable // from ECMAScript collection in immutable v3
- ? (0, collections.printIteratorValues)(val.values(), config, indentation, depth, refs, printer) : LAZY) + ']';
- };
- var printImmutableValues = function printImmutableValues(val, config, indentation, depth, refs, printer, type) {
- return ++depth > config.maxDepth ? printAsLeaf(getImmutableName(type)) : getImmutableName(type) + SPACE + '[' + (0, collections.printIteratorValues)(val.values(), config, indentation, depth, refs, printer) + ']';
- };
- var serialize = exports.serialize = function (val, config, indentation, depth, refs, printer) {
- if (val[IS_MAP_SENTINEL]) {
- return printImmutableEntries(val, config, indentation, depth, refs, printer, val[IS_ORDERED_SENTINEL] ? 'OrderedMap' : 'Map');
- }
- if (val[IS_LIST_SENTINEL]) {
- return printImmutableValues(val, config, indentation, depth, refs, printer, 'List');
- }
- if (val[IS_SET_SENTINEL]) {
- return printImmutableValues(val, config, indentation, depth, refs, printer, val[IS_ORDERED_SENTINEL] ? 'OrderedSet' : 'Set');
- }
- if (val[IS_STACK_SENTINEL]) {
- return printImmutableValues(val, config, indentation, depth, refs, printer, 'Stack');
- }
- if (val[IS_SEQ_SENTINEL]) {
- return printImmutableSeq(val, config, indentation, depth, refs, printer);
- }
- // For compatibility with immutable v3 and v4, let record be the default.
- return printImmutableRecord(val, config, indentation, depth, refs, printer);
- };
- // Explicitly comparing sentinel properties to true avoids false positive
- // when mock identity-obj-proxy returns the key as the value for any key.
- var test = exports.test = function (val) {
- return val && (val[IS_ITERABLE_SENTINEL] === true || val[IS_RECORD_SENTINEL] === true);
- };
- exports.default = { serialize: serialize, test: test };
- });
- unwrapExports(immutable);
- var immutable_1 = immutable.test;
- var immutable_2 = immutable.serialize;
- var react_element = createCommonjsModule(function (module, exports) {
- Object.defineProperty(exports, '__esModule', {
- value: true
- });
- exports.test = exports.serialize = undefined;
- /**
- * Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- *
- *
- */
- var elementSymbol = _Symbol$for('react.element');
- var fragmentSymbol = _Symbol$for('react.fragment');
- var forwardRefSymbol = _Symbol$for('react.forward_ref');
- var providerSymbol = _Symbol$for('react.provider');
- var contextSymbol = _Symbol$for('react.context');
- // Given element.props.children, or subtree during recursive traversal,
- // return flattened array of children.
- var getChildren = function getChildren(arg) {
- var children = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
- if (Array.isArray(arg)) {
- arg.forEach(function (item) {
- getChildren(item, children);
- });
- } else if (arg != null && arg !== false) {
- children.push(arg);
- }
- return children;
- };
- var getType = function getType(element) {
- var type = element.type;
- if (typeof type === 'string') {
- return type;
- }
- if (typeof type === 'function') {
- return type.displayName || type.name || 'Unknown';
- }
- if (type === fragmentSymbol) {
- return 'React.Fragment';
- }
- if ((typeof type === 'undefined' ? 'undefined' : _typeof(type)) === 'object' && type !== null) {
- if (type.$$typeof === providerSymbol) {
- return 'Context.Provider';
- }
- if (type.$$typeof === contextSymbol) {
- return 'Context.Consumer';
- }
- if (type.$$typeof === forwardRefSymbol) {
- var functionName = type.render.displayName || type.render.name || '';
- return functionName !== '' ? 'ForwardRef(' + functionName + ')' : 'ForwardRef';
- }
- }
- return 'UNDEFINED';
- };
- var getPropKeys = function getPropKeys(element) {
- var props = element.props;
- return _Object$keys(props).filter(function (key) {
- return key !== 'children' && props[key] !== undefined;
- }).sort();
- };
- var serialize = exports.serialize = function (element, config, indentation, depth, refs, printer) {
- return ++depth > config.maxDepth ? (0, markup.printElementAsLeaf)(getType(element), config) : (0, markup.printElement)(getType(element), (0, markup.printProps)(getPropKeys(element), element.props, config, indentation + config.indent, depth, refs, printer), (0, markup.printChildren)(getChildren(element.props.children), config, indentation + config.indent, depth, refs, printer), config, indentation);
- };
- var test = exports.test = function (val) {
- return val && val.$$typeof === elementSymbol;
- };
- exports.default = { serialize: serialize, test: test };
- });
- unwrapExports(react_element);
- var react_element_1 = react_element.test;
- var react_element_2 = react_element.serialize;
- var react_test_component = createCommonjsModule(function (module, exports) {
- Object.defineProperty(exports, '__esModule', {
- value: true
- });
- exports.test = exports.serialize = undefined;
- /**
- * Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- *
- *
- */
- var testSymbol = _Symbol$for('react.test.json');
- var getPropKeys = function getPropKeys(object) {
- var props = object.props;
- return props ? _Object$keys(props).filter(function (key) {
- return props[key] !== undefined;
- }).sort() : [];
- };
- var serialize = exports.serialize = function (object, config, indentation, depth, refs, printer) {
- return ++depth > config.maxDepth ? (0, markup.printElementAsLeaf)(object.type, config) : (0, markup.printElement)(object.type, object.props ? (0, markup.printProps)(getPropKeys(object),
- // Despite ternary expression, Flow 0.51.0 found incorrect error:
- // undefined is incompatible with the expected param type of Object
- // $FlowFixMe
- object.props, config, indentation + config.indent, depth, refs, printer) : '', object.children ? (0, markup.printChildren)(object.children, config, indentation + config.indent, depth, refs, printer) : '', config, indentation);
- };
- var test = exports.test = function (val) {
- return val && val.$$typeof === testSymbol;
- };
- exports.default = { serialize: serialize, test: test };
- });
- unwrapExports(react_test_component);
- var react_test_component_1 = react_test_component.test;
- var react_test_component_2 = react_test_component.serialize;
- var build$1 = createCommonjsModule(function (module) {
- var _ansiStyles2 = _interopRequireDefault(ansiStyles);
- var _asymmetric_matcher2 = _interopRequireDefault(asymmetric_matcher);
- var _convert_ansi2 = _interopRequireDefault(convert_ansi);
- var _dom_collection2 = _interopRequireDefault(dom_collection);
- var _dom_element2 = _interopRequireDefault(dom_element);
- var _immutable2 = _interopRequireDefault(immutable);
- var _react_element2 = _interopRequireDefault(react_element);
- var _react_test_component2 = _interopRequireDefault(react_test_component);
- function _interopRequireDefault(obj) {
- return obj && obj.__esModule ? obj : { default: obj };
- }
- /**
- * Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- *
- *
- */
- var toString = Object.prototype.toString;
- var toISOString = Date.prototype.toISOString;
- var errorToString = Error.prototype.toString;
- var regExpToString = RegExp.prototype.toString;
- var symbolToString = _Symbol.prototype.toString;
- // Explicitly comparing typeof constructor to function avoids undefined as name
- // when mock identity-obj-proxy returns the key as the value for any key.
- var getConstructorName = function getConstructorName(val) {
- return typeof val.constructor === 'function' && val.constructor.name || 'Object';
- };
- // Is val is equal to global window object? Works even if it does not exist :)
- /* global window */
- var isWindow = function isWindow(val) {
- return typeof window !== 'undefined' && val === window;
- };
- var SYMBOL_REGEXP = /^Symbol\((.*)\)(.*)$/;
- var NEWLINE_REGEXP = /\n/gi;
- var PrettyFormatPluginError = function (_Error) {
- _inherits(PrettyFormatPluginError, _Error);
- function PrettyFormatPluginError(message, stack) {
- _classCallCheck(this, PrettyFormatPluginError);
- var _this = _possibleConstructorReturn(this, (PrettyFormatPluginError.__proto__ || _Object$getPrototypeOf(PrettyFormatPluginError)).call(this, message));
- _this.stack = stack;
- _this.name = _this.constructor.name;
- return _this;
- }
- return PrettyFormatPluginError;
- }(Error);
- function isToStringedArrayType(toStringed) {
- return toStringed === '[object Array]' || toStringed === '[object ArrayBuffer]' || toStringed === '[object DataView]' || toStringed === '[object Float32Array]' || toStringed === '[object Float64Array]' || toStringed === '[object Int8Array]' || toStringed === '[object Int16Array]' || toStringed === '[object Int32Array]' || toStringed === '[object Uint8Array]' || toStringed === '[object Uint8ClampedArray]' || toStringed === '[object Uint16Array]' || toStringed === '[object Uint32Array]';
- }
- function printNumber(val) {
- return _Object$is(val, -0) ? '-0' : String(val);
- }
- function printFunction(val, printFunctionName) {
- if (!printFunctionName) {
- return '[Function]';
- }
- return '[Function ' + (val.name || 'anonymous') + ']';
- }
- function printSymbol(val) {
- return symbolToString.call(val).replace(SYMBOL_REGEXP, 'Symbol($1)');
- }
- function printError(val) {
- return '[' + errorToString.call(val) + ']';
- }
- function printBasicValue(val, printFunctionName, escapeRegex) {
- if (val === true || val === false) {
- return '' + val;
- }
- if (val === undefined) {
- return 'undefined';
- }
- if (val === null) {
- return 'null';
- }
- var typeOf = typeof val === 'undefined' ? 'undefined' : _typeof(val);
- if (typeOf === 'number') {
- return printNumber(val);
- }
- if (typeOf === 'string') {
- return '"' + val.replace(/"|\\/g, '\\$&') + '"';
- }
- if (typeOf === 'function') {
- return printFunction(val, printFunctionName);
- }
- if (typeOf === 'symbol') {
- return printSymbol(val);
- }
- var toStringed = toString.call(val);
- if (toStringed === '[object WeakMap]') {
- return 'WeakMap {}';
- }
- if (toStringed === '[object WeakSet]') {
- return 'WeakSet {}';
- }
- if (toStringed === '[object Function]' || toStringed === '[object GeneratorFunction]') {
- return printFunction(val, printFunctionName);
- }
- if (toStringed === '[object Symbol]') {
- return printSymbol(val);
- }
- if (toStringed === '[object Date]') {
- return isNaN(+val) ? 'Date { NaN }' : toISOString.call(val);
- }
- if (toStringed === '[object Error]') {
- return printError(val);
- }
- if (toStringed === '[object RegExp]') {
- if (escapeRegex) {
- // https://github.com/benjamingr/RegExp.escape/blob/master/polyfill.js
- return regExpToString.call(val).replace(/[\\^$*+?.()|[\]{}]/g, '\\$&');
- }
- return regExpToString.call(val);
- }
- if (val instanceof Error) {
- return printError(val);
- }
- return null;
- }
- function printComplexValue(val, config, indentation, depth, refs, hasCalledToJSON) {
- if (refs.indexOf(val) !== -1) {
- return '[Circular]';
- }
- refs = refs.slice();
- refs.push(val);
- var hitMaxDepth = ++depth > config.maxDepth;
- var min = config.min;
- if (config.callToJSON && !hitMaxDepth && val.toJSON && typeof val.toJSON === 'function' && !hasCalledToJSON) {
- return printer(val.toJSON(), config, indentation, depth, refs, true);
- }
- var toStringed = toString.call(val);
- if (toStringed === '[object Arguments]') {
- return hitMaxDepth ? '[Arguments]' : (min ? '' : 'Arguments ') + '[' + (0, collections.printListItems)(val, config, indentation, depth, refs, printer) + ']';
- }
- if (isToStringedArrayType(toStringed)) {
- return hitMaxDepth ? '[' + val.constructor.name + ']' : (min ? '' : val.constructor.name + ' ') + '[' + (0, collections.printListItems)(val, config, indentation, depth, refs, printer) + ']';
- }
- if (toStringed === '[object Map]') {
- return hitMaxDepth ? '[Map]' : 'Map {' + (0, collections.printIteratorEntries)(val.entries(), config, indentation, depth, refs, printer, ' => ') + '}';
- }
- if (toStringed === '[object Set]') {
- return hitMaxDepth ? '[Set]' : 'Set {' + (0, collections.printIteratorValues)(val.values(), config, indentation, depth, refs, printer) + '}';
- }
- // Avoid failure to serialize global window object in jsdom test environment.
- // For example, not even relevant if window is prop of React element.
- return hitMaxDepth || isWindow(val) ? '[' + getConstructorName(val) + ']' : (min ? '' : getConstructorName(val) + ' ') + '{' + (0, collections.printObjectProperties)(val, config, indentation, depth, refs, printer) + '}';
- }
- function printPlugin(plugin, val, config, indentation, depth, refs) {
- var printed = void 0;
- try {
- printed = plugin.serialize ? plugin.serialize(val, config, indentation, depth, refs, printer) : plugin.print(val, function (valChild) {
- return printer(valChild, config, indentation, depth, refs);
- }, function (str) {
- var indentationNext = indentation + config.indent;
- return indentationNext + str.replace(NEWLINE_REGEXP, '\n' + indentationNext);
- }, {
- edgeSpacing: config.spacingOuter,
- min: config.min,
- spacing: config.spacingInner
- }, config.colors);
- } catch (error) {
- throw new PrettyFormatPluginError(error.message, error.stack);
- }
- if (typeof printed !== 'string') {
- throw new Error('pretty-format: Plugin must return type "string" but instead returned "' + (typeof printed === 'undefined' ? 'undefined' : _typeof(printed)) + '".');
- }
- return printed;
- }
- function findPlugin(plugins, val) {
- for (var p = 0; p < plugins.length; p++) {
- try {
- if (plugins[p].test(val)) {
- return plugins[p];
- }
- } catch (error) {
- throw new PrettyFormatPluginError(error.message, error.stack);
- }
- }
- return null;
- }
- function printer(val, config, indentation, depth, refs, hasCalledToJSON) {
- var plugin = findPlugin(config.plugins, val);
- if (plugin !== null) {
- return printPlugin(plugin, val, config, indentation, depth, refs);
- }
- var basicResult = printBasicValue(val, config.printFunctionName, config.escapeRegex);
- if (basicResult !== null) {
- return basicResult;
- }
- return printComplexValue(val, config, indentation, depth, refs, hasCalledToJSON);
- }
- var DEFAULT_THEME = {
- comment: 'gray',
- content: 'reset',
- prop: 'yellow',
- tag: 'cyan',
- value: 'green'
- };
- var DEFAULT_THEME_KEYS = _Object$keys(DEFAULT_THEME);
- var DEFAULT_OPTIONS = {
- callToJSON: true,
- escapeRegex: false,
- highlight: false,
- indent: 2,
- maxDepth: Infinity,
- min: false,
- plugins: [],
- printFunctionName: true,
- theme: DEFAULT_THEME
- };
- function validateOptions(options) {
- _Object$keys(options).forEach(function (key) {
- if (!DEFAULT_OPTIONS.hasOwnProperty(key)) {
- throw new Error('pretty-format: Unknown option "' + key + '".');
- }
- });
- if (options.min && options.indent !== undefined && options.indent !== 0) {
- throw new Error('pretty-format: Options "min" and "indent" cannot be used together.');
- }
- if (options.theme !== undefined) {
- if (options.theme === null) {
- throw new Error('pretty-format: Option "theme" must not be null.');
- }
- if (_typeof(options.theme) !== 'object') {
- throw new Error('pretty-format: Option "theme" must be of type "object" but instead received "' + _typeof(options.theme) + '".');
- }
- }
- }
- var getColorsHighlight = function getColorsHighlight(options
- // $FlowFixMe: Flow thinks keys from `Colors` are missing from `DEFAULT_THEME_KEYS`
- ) {
- return DEFAULT_THEME_KEYS.reduce(function (colors, key) {
- var value = options.theme && options.theme[key] !== undefined ? options.theme[key] : DEFAULT_THEME[key];
- var color = _ansiStyles2.default[value];
- if (color && typeof color.close === 'string' && typeof color.open === 'string') {
- colors[key] = color;
- } else {
- throw new Error('pretty-format: Option "theme" has a key "' + key + '" whose value "' + value + '" is undefined in ansi-styles.');
- }
- return colors;
- }, _Object$create(null));
- };
- var getColorsEmpty = function getColorsEmpty() {
- return (
- // $FlowFixMe: Flow thinks keys from `Colors` are missing from `DEFAULT_THEME_KEYS`
- DEFAULT_THEME_KEYS.reduce(function (colors, key) {
- colors[key] = { close: '', open: '' };
- return colors;
- }, _Object$create(null))
- );
- };
- var getPrintFunctionName = function getPrintFunctionName(options) {
- return options && options.printFunctionName !== undefined ? options.printFunctionName : DEFAULT_OPTIONS.printFunctionName;
- };
- var getEscapeRegex = function getEscapeRegex(options) {
- return options && options.escapeRegex !== undefined ? options.escapeRegex : DEFAULT_OPTIONS.escapeRegex;
- };
- var getConfig = function getConfig(options) {
- return {
- callToJSON: options && options.callToJSON !== undefined ? options.callToJSON : DEFAULT_OPTIONS.callToJSON,
- colors: options && options.highlight ? getColorsHighlight(options) : getColorsEmpty(),
- escapeRegex: getEscapeRegex(options),
- indent: options && options.min ? '' : createIndent(options && options.indent !== undefined ? options.indent : DEFAULT_OPTIONS.indent),
- maxDepth: options && options.maxDepth !== undefined ? options.maxDepth : DEFAULT_OPTIONS.maxDepth,
- min: options && options.min !== undefined ? options.min : DEFAULT_OPTIONS.min,
- plugins: options && options.plugins !== undefined ? options.plugins : DEFAULT_OPTIONS.plugins,
- printFunctionName: getPrintFunctionName(options),
- spacingInner: options && options.min ? ' ' : '\n',
- spacingOuter: options && options.min ? '' : '\n'
- };
- };
- function createIndent(indent) {
- return new Array(indent + 1).join(' ');
- }
- function prettyFormat(val, options) {
- if (options) {
- validateOptions(options);
- if (options.plugins) {
- var plugin = findPlugin(options.plugins, val);
- if (plugin !== null) {
- return printPlugin(plugin, val, getConfig(options), '', 0, []);
- }
- }
- }
- var basicResult = printBasicValue(val, getPrintFunctionName(options), getEscapeRegex(options));
- if (basicResult !== null) {
- return basicResult;
- }
- return printComplexValue(val, getConfig(options), '', 0, []);
- }
- prettyFormat.plugins = {
- AsymmetricMatcher: _asymmetric_matcher2.default,
- ConvertAnsi: _convert_ansi2.default,
- DOMCollection: _dom_collection2.default,
- DOMElement: _dom_element2.default,
- Immutable: _immutable2.default,
- ReactElement: _react_element2.default,
- ReactTestComponent: _react_test_component2.default
- };
- module.exports = prettyFormat;
- });
- unwrapExports(build$1);
- var build$2 = createCommonjsModule(function (module, exports) {
- Object.defineProperty(exports, '__esModule', {
- value: true
- });
- exports.matcherHint = exports.pluralize = exports.ensureNumbers = exports.ensureExpectedIsNumber = exports.ensureActualIsNumber = exports.ensureNoExpected = exports.printWithType = exports.printExpected = exports.printReceived = exports.highlightTrailingWhitespace = exports.stringify = exports.SUGGEST_TO_CONTAIN_EQUAL = exports.SUGGEST_TO_EQUAL = exports.RECEIVED_COLOR = exports.EXPECTED_COLOR = undefined;
- var _chalk2 = _interopRequireDefault(fake_chalk);
- var _jestGetType2 = _interopRequireDefault(build);
- var _prettyFormat2 = _interopRequireDefault(build$1);
- function _interopRequireDefault(obj) {
- return obj && obj.__esModule ? obj : { default: obj };
- }
- var _prettyFormat$plugins = _prettyFormat2.default.plugins;
- /**
- * Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- *
- *
- */
- var AsymmetricMatcher = _prettyFormat$plugins.AsymmetricMatcher,
- DOMCollection = _prettyFormat$plugins.DOMCollection,
- DOMElement = _prettyFormat$plugins.DOMElement,
- Immutable = _prettyFormat$plugins.Immutable,
- ReactElement = _prettyFormat$plugins.ReactElement,
- ReactTestComponent = _prettyFormat$plugins.ReactTestComponent;
- var PLUGINS = [ReactTestComponent, ReactElement, DOMElement, DOMCollection, Immutable, AsymmetricMatcher];
- var EXPECTED_COLOR = exports.EXPECTED_COLOR = _chalk2.default.green;
- var RECEIVED_COLOR = exports.RECEIVED_COLOR = _chalk2.default.red;
- var NUMBERS = ['zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten', 'eleven', 'twelve', 'thirteen'];
- var SUGGEST_TO_EQUAL = exports.SUGGEST_TO_EQUAL = _chalk2.default.dim('Note that you are testing for equality with the stricter `toBe` matcher using `Object.is`. For deep equality only, use `toEqual` instead.');
- var SUGGEST_TO_CONTAIN_EQUAL = exports.SUGGEST_TO_CONTAIN_EQUAL = _chalk2.default.dim('Looks like you wanted to test for object/array equality with the stricter `toContain` matcher. You probably need to use `toContainEqual` instead.');
- var stringify = exports.stringify = function (object) {
- var maxDepth = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 10;
- var MAX_LENGTH = 10000;
- var result = void 0;
- try {
- result = (0, _prettyFormat2.default)(object, {
- maxDepth: maxDepth,
- min: true,
- plugins: PLUGINS
- });
- } catch (e) {
- result = (0, _prettyFormat2.default)(object, {
- callToJSON: false,
- maxDepth: maxDepth,
- min: true,
- plugins: PLUGINS
- });
- }
- return result.length >= MAX_LENGTH && maxDepth > 1 ? stringify(object, Math.floor(maxDepth / 2)) : result;
- };
- var highlightTrailingWhitespace = exports.highlightTrailingWhitespace = function (text) {
- return text.replace(/\s+$/gm, _chalk2.default.inverse('$&'));
- };
- var printReceived = exports.printReceived = function (object) {
- return RECEIVED_COLOR(highlightTrailingWhitespace(stringify(object)));
- };
- var printExpected = exports.printExpected = function (value) {
- return EXPECTED_COLOR(highlightTrailingWhitespace(stringify(value)));
- };
- var printWithType = exports.printWithType = function (name, received, print) {
- var type = (0, _jestGetType2.default)(received);
- return name + ':' + (type !== 'null' && type !== 'undefined' ? '\n ' + type + ': ' : ' ') + print(received);
- };
- var ensureNoExpected = exports.ensureNoExpected = function (expected, matcherName) {
- matcherName || (matcherName = 'This');
- if (typeof expected !== 'undefined') {
- throw new Error(matcherHint('[.not]' + matcherName, undefined, '') + '\n\n' + 'Matcher does not accept any arguments.\n' + printWithType('Got', expected, printExpected));
- }
- };
- var ensureActualIsNumber = exports.ensureActualIsNumber = function (actual, matcherName) {
- matcherName || (matcherName = 'This matcher');
- if (typeof actual !== 'number') {
- throw new Error(matcherHint('[.not]' + matcherName) + '\n\n' + 'Received value must be a number.\n' + printWithType('Received', actual, printReceived));
- }
- };
- var ensureExpectedIsNumber = exports.ensureExpectedIsNumber = function (expected, matcherName) {
- matcherName || (matcherName = 'This matcher');
- if (typeof expected !== 'number') {
- throw new Error(matcherHint('[.not]' + matcherName) + '\n\n' + 'Expected value must be a number.\n' + printWithType('Got', expected, printExpected));
- }
- };
- var ensureNumbers = exports.ensureNumbers = function (actual, expected, matcherName) {
- ensureActualIsNumber(actual, matcherName);
- ensureExpectedIsNumber(expected, matcherName);
- };
- var pluralize = exports.pluralize = function (word, count) {
- return (NUMBERS[count] || count) + ' ' + word + (count === 1 ? '' : 's');
- };
- var matcherHint = exports.matcherHint = function (matcherName) {
- var received = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'received';
- var expected = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'expected';
- var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
- var comment = options.comment,
- isDirectExpectCall = options.isDirectExpectCall,
- isNot = options.isNot,
- secondArgument = options.secondArgument;
- return _chalk2.default.dim('expect' + (isDirectExpectCall ? '' : '(')) + RECEIVED_COLOR(received) + (isNot ? _chalk2.default.dim(').') + 'not' + _chalk2.default.dim(matcherName + '(') : _chalk2.default.dim((isDirectExpectCall ? '' : ')') + matcherName + '(')) + EXPECTED_COLOR(expected) + (secondArgument ? '' + _chalk2.default.dim(', ') + EXPECTED_COLOR(secondArgument) : '') + _chalk2.default.dim(')' + (comment ? ' // ' + comment : ''));
- };
- });
- var index$1 = unwrapExports(build$2);
- var build_1 = build$2.matcherHint;
- var build_2 = build$2.pluralize;
- var build_3 = build$2.ensureNumbers;
- var build_4 = build$2.ensureExpectedIsNumber;
- var build_5 = build$2.ensureActualIsNumber;
- var build_6 = build$2.ensureNoExpected;
- var build_7 = build$2.printWithType;
- var build_8 = build$2.printExpected;
- var build_9 = build$2.printReceived;
- var build_10 = build$2.highlightTrailingWhitespace;
- var build_11 = build$2.stringify;
- var build_12 = build$2.SUGGEST_TO_CONTAIN_EQUAL;
- var build_13 = build$2.SUGGEST_TO_EQUAL;
- var build_14 = build$2.RECEIVED_COLOR;
- var build_15 = build$2.EXPECTED_COLOR;
- var matcherUtils = Object.freeze({
- default: index$1,
- __moduleExports: build$2,
- matcherHint: build_1,
- pluralize: build_2,
- ensureNumbers: build_3,
- ensureExpectedIsNumber: build_4,
- ensureActualIsNumber: build_5,
- ensureNoExpected: build_6,
- printWithType: build_7,
- printExpected: build_8,
- printReceived: build_9,
- highlightTrailingWhitespace: build_10,
- stringify: build_11,
- SUGGEST_TO_CONTAIN_EQUAL: build_12,
- SUGGEST_TO_EQUAL: build_13,
- RECEIVED_COLOR: build_14,
- EXPECTED_COLOR: build_15
- });
- // 19.1.2.6 Object.getOwnPropertyDescriptor(O, P)
- var $getOwnPropertyDescriptor$1 = _objectGopd.f;
- _objectSap('getOwnPropertyDescriptor', function () {
- return function getOwnPropertyDescriptor(it, key) {
- return $getOwnPropertyDescriptor$1(_toIobject(it), key);
- };
- });
- var $Object$2 = _core.Object;
- var getOwnPropertyDescriptor = function getOwnPropertyDescriptor(it, key) {
- return $Object$2.getOwnPropertyDescriptor(it, key);
- };
- var getOwnPropertyDescriptor$1 = createCommonjsModule(function (module) {
- module.exports = { "default": getOwnPropertyDescriptor, __esModule: true };
- });
- var _Object$getOwnPropertyDescriptor = unwrapExports(getOwnPropertyDescriptor$1);
- /*
- Copyright (c) 2008-2016 Pivotal Labs
- Permission is hereby granted, free of charge, to any person obtaining
- a copy of this software and associated documentation files (the
- "Software"), to deal in the Software without restriction, including
- without limitation the rights to use, copy, modify, merge, publish,
- distribute, sublicense, and/or sell copies of the Software, and to
- permit persons to whom the Software is furnished to do so, subject to
- the following conditions:
- The above copyright notice and this permission notice shall be
- included in all copies or substantial portions of the Software.
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
- */
- /* eslint-disable */
- // Extracted out of jasmine 2.5.2
- function equals(a, b, customTesters, strictCheck) {
- customTesters = customTesters || [];
- return eq(a, b, [], [], customTesters, strictCheck ? hasKey : hasDefinedKey);
- }
- function isAsymmetric(obj) {
- return obj && isA('Function', obj.asymmetricMatch);
- }
- function asymmetricMatch(a, b) {
- var asymmetricA = isAsymmetric(a),
- asymmetricB = isAsymmetric(b);
- if (asymmetricA && asymmetricB) {
- return undefined;
- }
- if (asymmetricA) {
- return a.asymmetricMatch(b);
- }
- if (asymmetricB) {
- return b.asymmetricMatch(a);
- }
- }
- // Equality function lovingly adapted from isEqual in
- // [Underscore](http://underscorejs.org)
- function eq(a, b, aStack, bStack, customTesters, hasKey) {
- var result = true;
- var asymmetricResult = asymmetricMatch(a, b);
- if (asymmetricResult !== undefined) {
- return asymmetricResult;
- }
- for (var i = 0; i < customTesters.length; i++) {
- var customTesterResult = customTesters[i](a, b);
- if (customTesterResult !== undefined) {
- return customTesterResult;
- }
- }
- if (a instanceof Error && b instanceof Error) {
- return a.message == b.message;
- }
- if (_Object$is(a, b)) {
- return true;
- }
- // A strict comparison is necessary because `null == undefined`.
- if (a === null || b === null) {
- return a === b;
- }
- var className = Object.prototype.toString.call(a);
- if (className != Object.prototype.toString.call(b)) {
- return false;
- }
- switch (className) {
- // Strings, numbers, dates, and booleans are compared by value.
- case '[object String]':
- // Primitives and their corresponding object wrappers are equivalent; thus, `"5"` is
- // equivalent to `new String("5")`.
- return a == String(b);
- case '[object Number]':
- // `NaN`s are equivalent, but non-reflexive. An `egal` comparison is performed for
- // other numeric values.
- return a != +a ? b != +b : a === 0 ? 1 / a == 1 / b : a == +b;
- case '[object Date]':
- case '[object Boolean]':
- // Coerce dates and booleans to numeric primitive values. Dates are compared by their
- // millisecond representations. Note that invalid dates with millisecond representations
- // of `NaN` are not equivalent.
- return +a == +b;
- // RegExps are compared by their source patterns and flags.
- case '[object RegExp]':
- return a.source == b.source && a.global == b.global && a.multiline == b.multiline && a.ignoreCase == b.ignoreCase;
- }
- if ((typeof a === 'undefined' ? 'undefined' : _typeof(a)) != 'object' || (typeof b === 'undefined' ? 'undefined' : _typeof(b)) != 'object') {
- return false;
- }
- var aIsDomNode = isDomNode(a);
- var bIsDomNode = isDomNode(b);
- if (aIsDomNode && bIsDomNode) {
- // At first try to use DOM3 method isEqualNode
- if (a.isEqualNode) {
- return a.isEqualNode(b);
- }
- // IE8 doesn't support isEqualNode, try to use outerHTML && innerText
- var aIsElement = a instanceof Element;
- var bIsElement = b instanceof Element;
- if (aIsElement && bIsElement) {
- return a.outerHTML == b.outerHTML;
- }
- if (aIsElement || bIsElement) {
- return false;
- }
- return a.innerText == b.innerText && a.textContent == b.textContent;
- }
- if (aIsDomNode || bIsDomNode) {
- return false;
- }
- // Assume equality for cyclic structures. The algorithm for detecting cyclic
- // structures is adapted from ES 5.1 section 15.12.3, abstract operation `JO`.
- var length = aStack.length;
- while (length--) {
- // Linear search. Performance is inversely proportional to the number of
- // unique nested structures.
- if (aStack[length] == a) {
- return bStack[length] == b;
- }
- }
- // Add the first object to the stack of traversed objects.
- aStack.push(a);
- bStack.push(b);
- var size = 0;
- // Recursively compare objects and arrays.
- // Compare array lengths to determine if a deep comparison is necessary.
- if (className == '[object Array]') {
- size = a.length;
- if (size !== b.length) {
- return false;
- }
- while (size--) {
- result = eq(a[size], b[size], aStack, bStack, customTesters, hasKey);
- if (!result) {
- return false;
- }
- }
- }
- // Deep compare objects.
- var aKeys = keys$2(a, className == '[object Array]', hasKey),
- key;
- size = aKeys.length;
- // Ensure that both objects contain the same number of properties before comparing deep equality.
- if (keys$2(b, className == '[object Array]', hasKey).length !== size) {
- return false;
- }
- while (size--) {
- key = aKeys[size];
- // Deep compare each member
- result = hasKey(b, key) && eq(a[key], b[key], aStack, bStack, customTesters, hasKey);
- if (!result) {
- return false;
- }
- }
- // Remove the first object from the stack of traversed objects.
- aStack.pop();
- bStack.pop();
- return result;
- }
- function keys$2(obj, isArray, hasKey) {
- var allKeys = function (o) {
- var keys = [];
- for (var key in o) {
- if (hasKey(o, key)) {
- keys.push(key);
- }
- }
- return keys.concat(_Object$getOwnPropertySymbols(o).filter(
- //$FlowFixMe Jest complains about nullability, but we know for sure that property 'symbol' does exist.
- function (symbol) {
- return _Object$getOwnPropertyDescriptor(o, symbol).enumerable;
- }));
- }(obj);
- if (!isArray) {
- return allKeys;
- }
- var extraKeys = [];
- if (allKeys.length === 0) {
- return allKeys;
- }
- for (var x = 0; x < allKeys.length; x++) {
- //$FlowFixMe
- if (_typeof(allKeys[x]) === 'symbol' || !allKeys[x].match(/^[0-9]+$/)) {
- extraKeys.push(allKeys[x]);
- }
- }
- return extraKeys;
- }
- function hasDefinedKey(obj, key) {
- return hasKey(obj, key) && obj[key] !== undefined;
- }
- function hasKey(obj, key) {
- return Object.prototype.hasOwnProperty.call(obj, key);
- }
- function isA(typeName, value) {
- return Object.prototype.toString.apply(value) === '[object ' + typeName + ']';
- }
- function isDomNode(obj) {
- return obj !== null && (typeof obj === 'undefined' ? 'undefined' : _typeof(obj)) === 'object' && typeof obj.nodeType === 'number' && typeof obj.nodeName === 'string';
- }
- function fnNameFor(func) {
- if (func.name) {
- return func.name;
- }
- var matches = func.toString().match(/^\s*function\s*(\w*)\s*\(/);
- return matches ? matches[1] : '<anonymous>';
- }
- function isUndefined(obj) {
- return obj === void 0;
- }
- function getPrototype(obj) {
- if (_Object$getPrototypeOf) {
- return _Object$getPrototypeOf(obj);
- }
- if (obj.constructor.prototype == obj) {
- return null;
- }
- return obj.constructor.prototype;
- }
- function hasProperty(obj, property) {
- if (!obj) {
- return false;
- }
- if (Object.prototype.hasOwnProperty.call(obj, property)) {
- return true;
- }
- return hasProperty(getPrototype(obj), property);
- }
- // SENTINEL constants are from https://github.com/facebook/immutable-js
- var IS_KEYED_SENTINEL = '@@__IMMUTABLE_KEYED__@@';
- var IS_SET_SENTINEL = '@@__IMMUTABLE_SET__@@';
- var IS_ORDERED_SENTINEL = '@@__IMMUTABLE_ORDERED__@@';
- function isImmutableUnorderedKeyed(maybeKeyed) {
- return !!(maybeKeyed && maybeKeyed[IS_KEYED_SENTINEL] && !maybeKeyed[IS_ORDERED_SENTINEL]);
- }
- function isImmutableUnorderedSet(maybeSet) {
- return !!(maybeSet && maybeSet[IS_SET_SENTINEL] && !maybeSet[IS_ORDERED_SENTINEL]);
- }
- var hasOwnProperty$1 = function hasOwnProperty(object, value) {
- return Object.prototype.hasOwnProperty.call(object, value) || Object.prototype.hasOwnProperty.call(object.constructor.prototype, value);
- };
- var getPath = function getPath(object, propertyPath) {
- if (!Array.isArray(propertyPath)) {
- propertyPath = propertyPath.split('.');
- }
- if (propertyPath.length) {
- var lastProp = propertyPath.length === 1;
- var prop = propertyPath[0];
- var newObject = object[prop];
- if (!lastProp && (newObject === null || newObject === undefined)) {
- // This is not the last prop in the chain. If we keep recursing it will
- // hit a `can't access property X of undefined | null`. At this point we
- // know that the chain has broken and we can return right away.
- return {
- hasEndProp: false,
- lastTraversedObject: object,
- traversedPath: []
- };
- }
- var result = getPath(newObject, propertyPath.slice(1));
- if (result.lastTraversedObject === null) {
- result.lastTraversedObject = object;
- }
- result.traversedPath.unshift(prop);
- if (lastProp) {
- result.hasEndProp = hasOwnProperty$1(object, prop);
- if (!result.hasEndProp) {
- result.traversedPath.shift();
- }
- }
- return result;
- }
- return {
- lastTraversedObject: null,
- traversedPath: [],
- value: object
- };
- };
- // Strip properties from object that are not present in the subset. Useful for
- // printing the diff for toMatchObject() without adding unrelated noise.
- var getObjectSubset = function getObjectSubset(object, subset) {
- if (Array.isArray(object)) {
- if (Array.isArray(subset) && subset.length === object.length) {
- return subset.map(function (sub, i) {
- return getObjectSubset(object[i], sub);
- });
- }
- } else if (object instanceof Date) {
- return object;
- } else if ((typeof object === 'undefined' ? 'undefined' : _typeof(object)) === 'object' && object !== null && (typeof subset === 'undefined' ? 'undefined' : _typeof(subset)) === 'object' && subset !== null) {
- var trimmed = {};
- _Object$keys(subset).filter(function (key) {
- return hasOwnProperty$1(object, key);
- }).forEach(function (key) {
- return trimmed[key] = getObjectSubset(object[key], subset[key]);
- });
- if (_Object$keys(trimmed).length > 0) {
- return trimmed;
- }
- }
- return object;
- };
- var IteratorSymbol = _Symbol$iterator;
- var hasIterator = function hasIterator(object) {
- return !!(object != null && object[IteratorSymbol]);
- };
- var iterableEquality = function iterableEquality(a, b) {
- if ((typeof a === 'undefined' ? 'undefined' : _typeof(a)) !== 'object' || (typeof b === 'undefined' ? 'undefined' : _typeof(b)) !== 'object' || Array.isArray(a) || Array.isArray(b) || !hasIterator(a) || !hasIterator(b)) {
- return undefined;
- }
- if (a.constructor !== b.constructor) {
- return false;
- }
- if (a.size !== undefined) {
- if (a.size !== b.size) {
- return false;
- } else if (isA('Set', a) || isImmutableUnorderedSet(a)) {
- var allFound = true;
- var _iteratorNormalCompletion = true;
- var _didIteratorError = false;
- var _iteratorError = undefined;
- try {
- for (var _iterator = _getIterator(a), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
- var aValue = _step.value;
- if (!b.has(aValue)) {
- var has = false;
- var _iteratorNormalCompletion2 = true;
- var _didIteratorError2 = false;
- var _iteratorError2 = undefined;
- try {
- for (var _iterator2 = _getIterator(b), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
- var bValue = _step2.value;
- var isEqual = equals(aValue, bValue, [iterableEquality]);
- if (isEqual === true) {
- has = true;
- }
- }
- } catch (err) {
- _didIteratorError2 = true;
- _iteratorError2 = err;
- } finally {
- try {
- if (!_iteratorNormalCompletion2 && _iterator2.return) {
- _iterator2.return();
- }
- } finally {
- if (_didIteratorError2) {
- throw _iteratorError2;
- }
- }
- }
- if (has === false) {
- allFound = false;
- break;
- }
- }
- }
- } catch (err) {
- _didIteratorError = true;
- _iteratorError = err;
- } finally {
- try {
- if (!_iteratorNormalCompletion && _iterator.return) {
- _iterator.return();
- }
- } finally {
- if (_didIteratorError) {
- throw _iteratorError;
- }
- }
- }
- if (allFound) {
- return true;
- }
- } else if (isA('Map', a) || isImmutableUnorderedKeyed(a)) {
- var _allFound = true;
- var _iteratorNormalCompletion3 = true;
- var _didIteratorError3 = false;
- var _iteratorError3 = undefined;
- try {
- for (var _iterator3 = _getIterator(a), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) {
- var aEntry = _step3.value;
- if (!b.has(aEntry[0]) || !equals(aEntry[1], b.get(aEntry[0]), [iterableEquality])) {
- var _has = false;
- var _iteratorNormalCompletion4 = true;
- var _didIteratorError4 = false;
- var _iteratorError4 = undefined;
- try {
- for (var _iterator4 = _getIterator(b), _step4; !(_iteratorNormalCompletion4 = (_step4 = _iterator4.next()).done); _iteratorNormalCompletion4 = true) {
- var bEntry = _step4.value;
- var matchedKey = equals(aEntry[0], bEntry[0], [iterableEquality]);
- var matchedValue = false;
- if (matchedKey === true) {
- matchedValue = equals(aEntry[1], bEntry[1], [iterableEquality]);
- }
- if (matchedValue === true) {
- _has = true;
- }
- }
- } catch (err) {
- _didIteratorError4 = true;
- _iteratorError4 = err;
- } finally {
- try {
- if (!_iteratorNormalCompletion4 && _iterator4.return) {
- _iterator4.return();
- }
- } finally {
- if (_didIteratorError4) {
- throw _iteratorError4;
- }
- }
- }
- if (_has === false) {
- _allFound = false;
- break;
- }
- }
- }
- } catch (err) {
- _didIteratorError3 = true;
- _iteratorError3 = err;
- } finally {
- try {
- if (!_iteratorNormalCompletion3 && _iterator3.return) {
- _iterator3.return();
- }
- } finally {
- if (_didIteratorError3) {
- throw _iteratorError3;
- }
- }
- }
- if (_allFound) {
- return true;
- }
- }
- }
- var bIterator = b[IteratorSymbol]();
- var _iteratorNormalCompletion5 = true;
- var _didIteratorError5 = false;
- var _iteratorError5 = undefined;
- try {
- for (var _iterator5 = _getIterator(a), _step5; !(_iteratorNormalCompletion5 = (_step5 = _iterator5.next()).done); _iteratorNormalCompletion5 = true) {
- var _aValue = _step5.value;
- var nextB = bIterator.next();
- if (nextB.done || !equals(_aValue, nextB.value, [iterableEquality])) {
- return false;
- }
- }
- } catch (err) {
- _didIteratorError5 = true;
- _iteratorError5 = err;
- } finally {
- try {
- if (!_iteratorNormalCompletion5 && _iterator5.return) {
- _iterator5.return();
- }
- } finally {
- if (_didIteratorError5) {
- throw _iteratorError5;
- }
- }
- }
- if (!bIterator.next().done) {
- return false;
- }
- return true;
- };
- var isObjectWithKeys = function isObjectWithKeys(a) {
- return a !== null && (typeof a === 'undefined' ? 'undefined' : _typeof(a)) === 'object' && !(a instanceof Error) && !(a instanceof Array) && !(a instanceof Date);
- };
- var subsetEquality = function subsetEquality(object, subset) {
- if (!isObjectWithKeys(subset)) {
- return undefined;
- }
- return _Object$keys(subset).every(function (key) {
- return object != null && hasOwnProperty$1(object, key) && equals(object[key], subset[key], [iterableEquality, subsetEquality]);
- });
- };
- var typeEquality = function typeEquality(a, b) {
- if (a == null || b == null || a.constructor.name === b.constructor.name) {
- return undefined;
- }
- return false;
- };
- var partition = function partition(items, predicate) {
- var result = [[], []];
- items.forEach(function (item) {
- return result[predicate(item) ? 0 : 1].push(item);
- });
- return result;
- };
- // Copied from https://github.com/graingert/angular.js/blob/a43574052e9775cbc1d7dd8a086752c979b0f020/src/Angular.js#L685-L693
- var isError = function isError(value) {
- switch (Object.prototype.toString.call(value)) {
- case '[object Error]':
- return true;
- case '[object Exception]':
- return true;
- case '[object DOMException]':
- return true;
- default:
- return value instanceof Error;
- }
- };
- function emptyObject(obj) {
- return obj && (typeof obj === 'undefined' ? 'undefined' : _typeof(obj)) === 'object' ? !_Object$keys(obj).length : false;
- }
- var MULTILINE_REGEXP = /[\r\n]/;
- var isOneline = function isOneline(expected, received) {
- return typeof expected === 'string' && typeof received === 'string' && (!MULTILINE_REGEXP.test(expected) || !MULTILINE_REGEXP.test(received));
- };
- var _createProperty = function (object, index, value) {
- if (index in object) _objectDp.f(object, index, _propertyDesc(0, value));
- else object[index] = value;
- };
- _export(_export.S + _export.F * !_iterDetect(function (iter) { }), 'Array', {
- // 22.1.2.1 Array.from(arrayLike, mapfn = undefined, thisArg = undefined)
- from: function from(arrayLike /* , mapfn = undefined, thisArg = undefined */) {
- var O = _toObject(arrayLike);
- var C = typeof this == 'function' ? this : Array;
- var aLen = arguments.length;
- var mapfn = aLen > 1 ? arguments[1] : undefined;
- var mapping = mapfn !== undefined;
- var index = 0;
- var iterFn = core_getIteratorMethod(O);
- var length, result, step, iterator;
- if (mapping) mapfn = _ctx(mapfn, aLen > 2 ? arguments[2] : undefined, 2);
- // if object isn't iterable or it's array with default iterator - use simple case
- if (iterFn != undefined && !(C == Array && _isArrayIter(iterFn))) {
- for (iterator = iterFn.call(O), result = new C(); !(step = iterator.next()).done; index++) {
- _createProperty(result, index, mapping ? _iterCall(iterator, mapfn, [step.value, index], true) : step.value);
- }
- } else {
- length = _toLength(O.length);
- for (result = new C(length); length > index; index++) {
- _createProperty(result, index, mapping ? mapfn(O[index], index) : O[index]);
- }
- }
- result.length = index;
- return result;
- }
- });
- var from = _core.Array.from;
- var from$1 = createCommonjsModule(function (module) {
- module.exports = { "default": from, __esModule: true };
- });
- var _Array$from = unwrapExports(from$1);
- // 20.1.2.4 Number.isNaN(number)
- _export(_export.S, 'Number', {
- isNaN: function isNaN(number) {
- // eslint-disable-next-line no-self-compare
- return number != number;
- }
- });
- var isNan = _core.Number.isNaN;
- var isNan$1 = createCommonjsModule(function (module) {
- module.exports = { "default": isNan, __esModule: true };
- });
- var _Number$isNaN = unwrapExports(isNan$1);
- var base = createCommonjsModule(function (module, exports) {
- exports.__esModule = true;
- exports['default'] = /*istanbul ignore end*/Diff;
- function Diff() {}
- Diff.prototype = {
- /*istanbul ignore start*/ /*istanbul ignore end*/diff: function diff(oldString, newString) {
- /*istanbul ignore start*/var /*istanbul ignore end*/options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
- var callback = options.callback;
- if (typeof options === 'function') {
- callback = options;
- options = {};
- }
- this.options = options;
- var self = this;
- function done(value) {
- if (callback) {
- setTimeout(function () {
- callback(undefined, value);
- }, 0);
- return true;
- } else {
- return value;
- }
- }
- // Allow subclasses to massage the input prior to running
- oldString = this.castInput(oldString);
- newString = this.castInput(newString);
- oldString = this.removeEmpty(this.tokenize(oldString));
- newString = this.removeEmpty(this.tokenize(newString));
- var newLen = newString.length,
- oldLen = oldString.length;
- var editLength = 1;
- var maxEditLength = newLen + oldLen;
- var bestPath = [{ newPos: -1, components: [] }];
- // Seed editLength = 0, i.e. the content starts with the same values
- var oldPos = this.extractCommon(bestPath[0], newString, oldString, 0);
- if (bestPath[0].newPos + 1 >= newLen && oldPos + 1 >= oldLen) {
- // Identity per the equality and tokenizer
- return done([{ value: this.join(newString), count: newString.length }]);
- }
- // Main worker method. checks all permutations of a given edit length for acceptance.
- function execEditLength() {
- for (var diagonalPath = -1 * editLength; diagonalPath <= editLength; diagonalPath += 2) {
- var basePath = /*istanbul ignore start*/void 0 /*istanbul ignore end*/;
- var addPath = bestPath[diagonalPath - 1],
- removePath = bestPath[diagonalPath + 1],
- _oldPos = (removePath ? removePath.newPos : 0) - diagonalPath;
- if (addPath) {
- // No one else is going to attempt to use this value, clear it
- bestPath[diagonalPath - 1] = undefined;
- }
- var canAdd = addPath && addPath.newPos + 1 < newLen,
- canRemove = removePath && 0 <= _oldPos && _oldPos < oldLen;
- if (!canAdd && !canRemove) {
- // If this path is a terminal then prune
- bestPath[diagonalPath] = undefined;
- continue;
- }
- // Select the diagonal that we want to branch from. We select the prior
- // path whose position in the new string is the farthest from the origin
- // and does not pass the bounds of the diff graph
- if (!canAdd || canRemove && addPath.newPos < removePath.newPos) {
- basePath = clonePath(removePath);
- self.pushComponent(basePath.components, undefined, true);
- } else {
- basePath = addPath; // No need to clone, we've pulled it from the list
- basePath.newPos++;
- self.pushComponent(basePath.components, true, undefined);
- }
- _oldPos = self.extractCommon(basePath, newString, oldString, diagonalPath);
- // If we have hit the end of both strings, then we are done
- if (basePath.newPos + 1 >= newLen && _oldPos + 1 >= oldLen) {
- return done(buildValues(self, basePath.components, newString, oldString, self.useLongestToken));
- } else {
- // Otherwise track this path as a potential candidate and continue.
- bestPath[diagonalPath] = basePath;
- }
- }
- editLength++;
- }
- // Performs the length of edit iteration. Is a bit fugly as this has to support the
- // sync and async mode which is never fun. Loops over execEditLength until a value
- // is produced.
- if (callback) {
- (function exec() {
- setTimeout(function () {
- // This should not happen, but we want to be safe.
- /* istanbul ignore next */
- if (editLength > maxEditLength) {
- return callback();
- }
- if (!execEditLength()) {
- exec();
- }
- }, 0);
- })();
- } else {
- while (editLength <= maxEditLength) {
- var ret = execEditLength();
- if (ret) {
- return ret;
- }
- }
- }
- },
- /*istanbul ignore start*/ /*istanbul ignore end*/pushComponent: function pushComponent(components, added, removed) {
- var last = components[components.length - 1];
- if (last && last.added === added && last.removed === removed) {
- // We need to clone here as the component clone operation is just
- // as shallow array clone
- components[components.length - 1] = { count: last.count + 1, added: added, removed: removed };
- } else {
- components.push({ count: 1, added: added, removed: removed });
- }
- },
- /*istanbul ignore start*/ /*istanbul ignore end*/extractCommon: function extractCommon(basePath, newString, oldString, diagonalPath) {
- var newLen = newString.length,
- oldLen = oldString.length,
- newPos = basePath.newPos,
- oldPos = newPos - diagonalPath,
- commonCount = 0;
- while (newPos + 1 < newLen && oldPos + 1 < oldLen && this.equals(newString[newPos + 1], oldString[oldPos + 1])) {
- newPos++;
- oldPos++;
- commonCount++;
- }
- if (commonCount) {
- basePath.components.push({ count: commonCount });
- }
- basePath.newPos = newPos;
- return oldPos;
- },
- /*istanbul ignore start*/ /*istanbul ignore end*/equals: function equals(left, right) {
- if (this.options.comparator) {
- return this.options.comparator(left, right);
- } else {
- return left === right || this.options.ignoreCase && left.toLowerCase() === right.toLowerCase();
- }
- },
- /*istanbul ignore start*/ /*istanbul ignore end*/removeEmpty: function removeEmpty(array) {
- var ret = [];
- for (var i = 0; i < array.length; i++) {
- if (array[i]) {
- ret.push(array[i]);
- }
- }
- return ret;
- },
- /*istanbul ignore start*/ /*istanbul ignore end*/castInput: function castInput(value) {
- return value;
- },
- /*istanbul ignore start*/ /*istanbul ignore end*/tokenize: function tokenize(value) {
- return value.split('');
- },
- /*istanbul ignore start*/ /*istanbul ignore end*/join: function join(chars) {
- return chars.join('');
- }
- };
- function buildValues(diff, components, newString, oldString, useLongestToken) {
- var componentPos = 0,
- componentLen = components.length,
- newPos = 0,
- oldPos = 0;
- for (; componentPos < componentLen; componentPos++) {
- var component = components[componentPos];
- if (!component.removed) {
- if (!component.added && useLongestToken) {
- var value = newString.slice(newPos, newPos + component.count);
- value = value.map(function (value, i) {
- var oldValue = oldString[oldPos + i];
- return oldValue.length > value.length ? oldValue : value;
- });
- component.value = diff.join(value);
- } else {
- component.value = diff.join(newString.slice(newPos, newPos + component.count));
- }
- newPos += component.count;
- // Common case
- if (!component.added) {
- oldPos += component.count;
- }
- } else {
- component.value = diff.join(oldString.slice(oldPos, oldPos + component.count));
- oldPos += component.count;
- // Reverse add and remove so removes are output first to match common convention
- // The diffing algorithm is tied to add then remove output and this is the simplest
- // route to get the desired output with minimal overhead.
- if (componentPos && components[componentPos - 1].added) {
- var tmp = components[componentPos - 1];
- components[componentPos - 1] = components[componentPos];
- components[componentPos] = tmp;
- }
- }
- }
- // Special case handle for when one terminal is ignored (i.e. whitespace).
- // For this case we merge the terminal into the prior string and drop the change.
- // This is only available for string mode.
- var lastComponent = components[componentLen - 1];
- if (componentLen > 1 && typeof lastComponent.value === 'string' && (lastComponent.added || lastComponent.removed) && diff.equals('', lastComponent.value)) {
- components[componentLen - 2].value += lastComponent.value;
- components.pop();
- }
- return components;
- }
- function clonePath(path) {
- return { newPos: path.newPos, components: path.components.slice(0) };
- }
- });
- unwrapExports(base);
- var character = createCommonjsModule(function (module, exports) {
- exports.__esModule = true;
- exports.characterDiff = undefined;
- exports. /*istanbul ignore end*/diffChars = diffChars;
- /*istanbul ignore start*/var _base2 = _interopRequireDefault(base);
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
- /*istanbul ignore end*/var characterDiff = /*istanbul ignore start*/exports. /*istanbul ignore end*/characterDiff = new /*istanbul ignore start*/_base2['default'] /*istanbul ignore end*/();
- function diffChars(oldStr, newStr, options) {
- return characterDiff.diff(oldStr, newStr, options);
- }
- });
- unwrapExports(character);
- var character_1 = character.characterDiff;
- var character_2 = character.diffChars;
- var params = createCommonjsModule(function (module, exports) {
- exports.__esModule = true;
- exports. /*istanbul ignore end*/generateOptions = generateOptions;
- function generateOptions(options, defaults) {
- if (typeof options === 'function') {
- defaults.callback = options;
- } else if (options) {
- for (var name in options) {
- /* istanbul ignore else */
- if (options.hasOwnProperty(name)) {
- defaults[name] = options[name];
- }
- }
- }
- return defaults;
- }
- });
- unwrapExports(params);
- var params_1 = params.generateOptions;
- var word = createCommonjsModule(function (module, exports) {
- exports.__esModule = true;
- exports.wordDiff = undefined;
- exports. /*istanbul ignore end*/diffWords = diffWords;
- /*istanbul ignore start*/exports. /*istanbul ignore end*/diffWordsWithSpace = diffWordsWithSpace;
- /*istanbul ignore start*/var _base2 = _interopRequireDefault(base);
- /*istanbul ignore end*/
- /*istanbul ignore start*/function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
- /*istanbul ignore end*/ // Based on https://en.wikipedia.org/wiki/Latin_script_in_Unicode
- //
- // Ranges and exceptions:
- // Latin-1 Supplement, 0080–00FF
- // - U+00D7 × Multiplication sign
- // - U+00F7 ÷ Division sign
- // Latin Extended-A, 0100–017F
- // Latin Extended-B, 0180–024F
- // IPA Extensions, 0250–02AF
- // Spacing Modifier Letters, 02B0–02FF
- // - U+02C7 ˇ ˇ Caron
- // - U+02D8 ˘ ˘ Breve
- // - U+02D9 ˙ ˙ Dot Above
- // - U+02DA ˚ ˚ Ring Above
- // - U+02DB ˛ ˛ Ogonek
- // - U+02DC ˜ ˜ Small Tilde
- // - U+02DD ˝ ˝ Double Acute Accent
- // Latin Extended Additional, 1E00–1EFF
- var extendedWordChars = /^[A-Za-z\xC0-\u02C6\u02C8-\u02D7\u02DE-\u02FF\u1E00-\u1EFF]+$/;
- var reWhitespace = /\S/;
- var wordDiff = /*istanbul ignore start*/exports. /*istanbul ignore end*/wordDiff = new /*istanbul ignore start*/_base2['default'] /*istanbul ignore end*/();
- wordDiff.equals = function (left, right) {
- if (this.options.ignoreCase) {
- left = left.toLowerCase();
- right = right.toLowerCase();
- }
- return left === right || this.options.ignoreWhitespace && !reWhitespace.test(left) && !reWhitespace.test(right);
- };
- wordDiff.tokenize = function (value) {
- var tokens = value.split(/(\s+|\b)/);
- // Join the boundary splits that we do not consider to be boundaries. This is primarily the extended Latin character set.
- for (var i = 0; i < tokens.length - 1; i++) {
- // If we have an empty string in the next field and we have only word chars before and after, merge
- if (!tokens[i + 1] && tokens[i + 2] && extendedWordChars.test(tokens[i]) && extendedWordChars.test(tokens[i + 2])) {
- tokens[i] += tokens[i + 2];
- tokens.splice(i + 1, 2);
- i--;
- }
- }
- return tokens;
- };
- function diffWords(oldStr, newStr, options) {
- options = /*istanbul ignore start*/(0, params.generateOptions) /*istanbul ignore end*/(options, { ignoreWhitespace: true });
- return wordDiff.diff(oldStr, newStr, options);
- }
- function diffWordsWithSpace(oldStr, newStr, options) {
- return wordDiff.diff(oldStr, newStr, options);
- }
- });
- unwrapExports(word);
- var word_1 = word.wordDiff;
- var word_2 = word.diffWords;
- var word_3 = word.diffWordsWithSpace;
- var line = createCommonjsModule(function (module, exports) {
- exports.__esModule = true;
- exports.lineDiff = undefined;
- exports. /*istanbul ignore end*/diffLines = diffLines;
- /*istanbul ignore start*/exports. /*istanbul ignore end*/diffTrimmedLines = diffTrimmedLines;
- /*istanbul ignore start*/var _base2 = _interopRequireDefault(base);
- /*istanbul ignore end*/
- /*istanbul ignore start*/function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
- /*istanbul ignore end*/var lineDiff = /*istanbul ignore start*/exports. /*istanbul ignore end*/lineDiff = new /*istanbul ignore start*/_base2['default'] /*istanbul ignore end*/();
- lineDiff.tokenize = function (value) {
- var retLines = [],
- linesAndNewlines = value.split(/(\n|\r\n)/);
- // Ignore the final empty token that occurs if the string ends with a new line
- if (!linesAndNewlines[linesAndNewlines.length - 1]) {
- linesAndNewlines.pop();
- }
- // Merge the content and line separators into single tokens
- for (var i = 0; i < linesAndNewlines.length; i++) {
- var line = linesAndNewlines[i];
- if (i % 2 && !this.options.newlineIsToken) {
- retLines[retLines.length - 1] += line;
- } else {
- if (this.options.ignoreWhitespace) {
- line = line.trim();
- }
- retLines.push(line);
- }
- }
- return retLines;
- };
- function diffLines(oldStr, newStr, callback) {
- return lineDiff.diff(oldStr, newStr, callback);
- }
- function diffTrimmedLines(oldStr, newStr, callback) {
- var options = /*istanbul ignore start*/(0, params.generateOptions) /*istanbul ignore end*/(callback, { ignoreWhitespace: true });
- return lineDiff.diff(oldStr, newStr, options);
- }
- });
- unwrapExports(line);
- var line_1 = line.lineDiff;
- var line_2 = line.diffLines;
- var line_3 = line.diffTrimmedLines;
- var sentence = createCommonjsModule(function (module, exports) {
- exports.__esModule = true;
- exports.sentenceDiff = undefined;
- exports. /*istanbul ignore end*/diffSentences = diffSentences;
- /*istanbul ignore start*/var _base2 = _interopRequireDefault(base);
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
- /*istanbul ignore end*/var sentenceDiff = /*istanbul ignore start*/exports. /*istanbul ignore end*/sentenceDiff = new /*istanbul ignore start*/_base2['default'] /*istanbul ignore end*/();
- sentenceDiff.tokenize = function (value) {
- return value.split(/(\S.+?[.!?])(?=\s+|$)/);
- };
- function diffSentences(oldStr, newStr, callback) {
- return sentenceDiff.diff(oldStr, newStr, callback);
- }
- });
- unwrapExports(sentence);
- var sentence_1 = sentence.sentenceDiff;
- var sentence_2 = sentence.diffSentences;
- var css = createCommonjsModule(function (module, exports) {
- exports.__esModule = true;
- exports.cssDiff = undefined;
- exports. /*istanbul ignore end*/diffCss = diffCss;
- /*istanbul ignore start*/var _base2 = _interopRequireDefault(base);
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
- /*istanbul ignore end*/var cssDiff = /*istanbul ignore start*/exports. /*istanbul ignore end*/cssDiff = new /*istanbul ignore start*/_base2['default'] /*istanbul ignore end*/();
- cssDiff.tokenize = function (value) {
- return value.split(/([{}:;,]|\s+)/);
- };
- function diffCss(oldStr, newStr, callback) {
- return cssDiff.diff(oldStr, newStr, callback);
- }
- });
- unwrapExports(css);
- var css_1 = css.cssDiff;
- var css_2 = css.diffCss;
- var json = createCommonjsModule(function (module, exports) {
- exports.__esModule = true;
- exports.jsonDiff = undefined;
- 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; };
- exports. /*istanbul ignore end*/diffJson = diffJson;
- /*istanbul ignore start*/exports. /*istanbul ignore end*/canonicalize = canonicalize;
- /*istanbul ignore start*/var _base2 = _interopRequireDefault(base);
- /*istanbul ignore end*/
- /*istanbul ignore start*/function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
- /*istanbul ignore end*/var objectPrototypeToString = Object.prototype.toString;
- var jsonDiff = /*istanbul ignore start*/exports. /*istanbul ignore end*/jsonDiff = new /*istanbul ignore start*/_base2['default'] /*istanbul ignore end*/();
- // Discriminate between two lines of pretty-printed, serialized JSON where one of them has a
- // dangling comma and the other doesn't. Turns out including the dangling comma yields the nicest output:
- jsonDiff.useLongestToken = true;
- jsonDiff.tokenize = /*istanbul ignore start*/line.lineDiff /*istanbul ignore end*/.tokenize;
- jsonDiff.castInput = function (value) {
- /*istanbul ignore start*/var _options = /*istanbul ignore end*/this.options,
- undefinedReplacement = _options.undefinedReplacement,
- _options$stringifyRep = _options.stringifyReplacer,
- stringifyReplacer = _options$stringifyRep === undefined ? function (k, v) /*istanbul ignore start*/{
- return (/*istanbul ignore end*/typeof v === 'undefined' ? undefinedReplacement : v
- );
- } : _options$stringifyRep;
- return typeof value === 'string' ? value : JSON.stringify(canonicalize(value, null, null, stringifyReplacer), stringifyReplacer, ' ');
- };
- jsonDiff.equals = function (left, right) {
- return (/*istanbul ignore start*/_base2['default'] /*istanbul ignore end*/.prototype.equals.call(jsonDiff, left.replace(/,([\r\n])/g, '$1'), right.replace(/,([\r\n])/g, '$1'))
- );
- };
- function diffJson(oldObj, newObj, options) {
- return jsonDiff.diff(oldObj, newObj, options);
- }
- // This function handles the presence of circular references by bailing out when encountering an
- // object that is already on the "stack" of items being processed. Accepts an optional replacer
- function canonicalize(obj, stack, replacementStack, replacer, key) {
- stack = stack || [];
- replacementStack = replacementStack || [];
- if (replacer) {
- obj = replacer(key, obj);
- }
- var i = /*istanbul ignore start*/void 0 /*istanbul ignore end*/;
- for (i = 0; i < stack.length; i += 1) {
- if (stack[i] === obj) {
- return replacementStack[i];
- }
- }
- var canonicalizedObj = /*istanbul ignore start*/void 0 /*istanbul ignore end*/;
- if ('[object Array]' === objectPrototypeToString.call(obj)) {
- stack.push(obj);
- canonicalizedObj = new Array(obj.length);
- replacementStack.push(canonicalizedObj);
- for (i = 0; i < obj.length; i += 1) {
- canonicalizedObj[i] = canonicalize(obj[i], stack, replacementStack, replacer, key);
- }
- stack.pop();
- replacementStack.pop();
- return canonicalizedObj;
- }
- if (obj && obj.toJSON) {
- obj = obj.toJSON();
- }
- if ( /*istanbul ignore start*/(typeof /*istanbul ignore end*/obj === 'undefined' ? 'undefined' : _typeof(obj)) === 'object' && obj !== null) {
- stack.push(obj);
- canonicalizedObj = {};
- replacementStack.push(canonicalizedObj);
- var sortedKeys = [],
- _key = /*istanbul ignore start*/void 0 /*istanbul ignore end*/;
- for (_key in obj) {
- /* istanbul ignore else */
- if (obj.hasOwnProperty(_key)) {
- sortedKeys.push(_key);
- }
- }
- sortedKeys.sort();
- for (i = 0; i < sortedKeys.length; i += 1) {
- _key = sortedKeys[i];
- canonicalizedObj[_key] = canonicalize(obj[_key], stack, replacementStack, replacer, _key);
- }
- stack.pop();
- replacementStack.pop();
- } else {
- canonicalizedObj = obj;
- }
- return canonicalizedObj;
- }
- });
- unwrapExports(json);
- var json_1 = json.jsonDiff;
- var json_2 = json.diffJson;
- var json_3 = json.canonicalize;
- var array = createCommonjsModule(function (module, exports) {
- exports.__esModule = true;
- exports.arrayDiff = undefined;
- exports. /*istanbul ignore end*/diffArrays = diffArrays;
- /*istanbul ignore start*/var _base2 = _interopRequireDefault(base);
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
- /*istanbul ignore end*/var arrayDiff = /*istanbul ignore start*/exports. /*istanbul ignore end*/arrayDiff = new /*istanbul ignore start*/_base2['default'] /*istanbul ignore end*/();
- arrayDiff.tokenize = function (value) {
- return value.slice();
- };
- arrayDiff.join = arrayDiff.removeEmpty = function (value) {
- return value;
- };
- function diffArrays(oldArr, newArr, callback) {
- return arrayDiff.diff(oldArr, newArr, callback);
- }
- });
- unwrapExports(array);
- var array_1 = array.arrayDiff;
- var array_2 = array.diffArrays;
- var parse = createCommonjsModule(function (module, exports) {
- exports.__esModule = true;
- exports. /*istanbul ignore end*/parsePatch = parsePatch;
- function parsePatch(uniDiff) {
- /*istanbul ignore start*/var /*istanbul ignore end*/options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
- var diffstr = uniDiff.split(/\r\n|[\n\v\f\r\x85]/),
- delimiters = uniDiff.match(/\r\n|[\n\v\f\r\x85]/g) || [],
- list = [],
- i = 0;
- function parseIndex() {
- var index = {};
- list.push(index);
- // Parse diff metadata
- while (i < diffstr.length) {
- var line = diffstr[i];
- // File header found, end parsing diff metadata
- if (/^(\-\-\-|\+\+\+|@@)\s/.test(line)) {
- break;
- }
- // Diff index
- var header = /^(?:Index:|diff(?: -r \w+)+)\s+(.+?)\s*$/.exec(line);
- if (header) {
- index.index = header[1];
- }
- i++;
- }
- // Parse file headers if they are defined. Unified diff requires them, but
- // there's no technical issues to have an isolated hunk without file header
- parseFileHeader(index);
- parseFileHeader(index);
- // Parse hunks
- index.hunks = [];
- while (i < diffstr.length) {
- var _line = diffstr[i];
- if (/^(Index:|diff|\-\-\-|\+\+\+)\s/.test(_line)) {
- break;
- } else if (/^@@/.test(_line)) {
- index.hunks.push(parseHunk());
- } else if (_line && options.strict) {
- // Ignore unexpected content unless in strict mode
- throw new Error('Unknown line ' + (i + 1) + ' ' + JSON.stringify(_line));
- } else {
- i++;
- }
- }
- }
- // Parses the --- and +++ headers, if none are found, no lines
- // are consumed.
- function parseFileHeader(index) {
- var fileHeader = /^(---|\+\+\+)\s+(.*)$/.exec(diffstr[i]);
- if (fileHeader) {
- var keyPrefix = fileHeader[1] === '---' ? 'old' : 'new';
- var data = fileHeader[2].split('\t', 2);
- var fileName = data[0].replace(/\\\\/g, '\\');
- if (/^".*"$/.test(fileName)) {
- fileName = fileName.substr(1, fileName.length - 2);
- }
- index[keyPrefix + 'FileName'] = fileName;
- index[keyPrefix + 'Header'] = (data[1] || '').trim();
- i++;
- }
- }
- // Parses a hunk
- // This assumes that we are at the start of a hunk.
- function parseHunk() {
- var chunkHeaderIndex = i,
- chunkHeaderLine = diffstr[i++],
- chunkHeader = chunkHeaderLine.split(/@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@/);
- var hunk = {
- oldStart: +chunkHeader[1],
- oldLines: +chunkHeader[2] || 1,
- newStart: +chunkHeader[3],
- newLines: +chunkHeader[4] || 1,
- lines: [],
- linedelimiters: []
- };
- var addCount = 0,
- removeCount = 0;
- for (; i < diffstr.length; i++) {
- // Lines starting with '---' could be mistaken for the "remove line" operation
- // But they could be the header for the next file. Therefore prune such cases out.
- if (diffstr[i].indexOf('--- ') === 0 && i + 2 < diffstr.length && diffstr[i + 1].indexOf('+++ ') === 0 && diffstr[i + 2].indexOf('@@') === 0) {
- break;
- }
- var operation = diffstr[i].length == 0 && i != diffstr.length - 1 ? ' ' : diffstr[i][0];
- if (operation === '+' || operation === '-' || operation === ' ' || operation === '\\') {
- hunk.lines.push(diffstr[i]);
- hunk.linedelimiters.push(delimiters[i] || '\n');
- if (operation === '+') {
- addCount++;
- } else if (operation === '-') {
- removeCount++;
- } else if (operation === ' ') {
- addCount++;
- removeCount++;
- }
- } else {
- break;
- }
- }
- // Handle the empty block count case
- if (!addCount && hunk.newLines === 1) {
- hunk.newLines = 0;
- }
- if (!removeCount && hunk.oldLines === 1) {
- hunk.oldLines = 0;
- }
- // Perform optional sanity checking
- if (options.strict) {
- if (addCount !== hunk.newLines) {
- throw new Error('Added line count did not match for hunk at line ' + (chunkHeaderIndex + 1));
- }
- if (removeCount !== hunk.oldLines) {
- throw new Error('Removed line count did not match for hunk at line ' + (chunkHeaderIndex + 1));
- }
- }
- return hunk;
- }
- while (i < diffstr.length) {
- parseIndex();
- }
- return list;
- }
- });
- unwrapExports(parse);
- var parse_1 = parse.parsePatch;
- var distanceIterator = createCommonjsModule(function (module, exports) {
- exports.__esModule = true;
- exports["default"] = /*istanbul ignore end*/function (start, minLine, maxLine) {
- var wantForward = true,
- backwardExhausted = false,
- forwardExhausted = false,
- localOffset = 1;
- return function iterator() {
- if (wantForward && !forwardExhausted) {
- if (backwardExhausted) {
- localOffset++;
- } else {
- wantForward = false;
- }
- // Check if trying to fit beyond text length, and if not, check it fits
- // after offset location (or desired location on first iteration)
- if (start + localOffset <= maxLine) {
- return localOffset;
- }
- forwardExhausted = true;
- }
- if (!backwardExhausted) {
- if (!forwardExhausted) {
- wantForward = true;
- }
- // Check if trying to fit before text beginning, and if not, check it fits
- // before offset location
- if (minLine <= start - localOffset) {
- return -localOffset++;
- }
- backwardExhausted = true;
- return iterator();
- }
- // We tried to fit hunk before text beginning and beyond text length, then
- // hunk can't fit on the text. Return undefined
- };
- };
- });
- unwrapExports(distanceIterator);
- var apply = createCommonjsModule(function (module, exports) {
- exports.__esModule = true;
- exports. /*istanbul ignore end*/applyPatch = applyPatch;
- /*istanbul ignore start*/exports. /*istanbul ignore end*/applyPatches = applyPatches;
- /*istanbul ignore start*/var _distanceIterator2 = _interopRequireDefault(distanceIterator);
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
- /*istanbul ignore end*/function applyPatch(source, uniDiff) {
- /*istanbul ignore start*/var /*istanbul ignore end*/options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
- if (typeof uniDiff === 'string') {
- uniDiff = /*istanbul ignore start*/(0, parse.parsePatch) /*istanbul ignore end*/(uniDiff);
- }
- if (Array.isArray(uniDiff)) {
- if (uniDiff.length > 1) {
- throw new Error('applyPatch only works with a single input.');
- }
- uniDiff = uniDiff[0];
- }
- // Apply the diff to the input
- var lines = source.split(/\r\n|[\n\v\f\r\x85]/),
- delimiters = source.match(/\r\n|[\n\v\f\r\x85]/g) || [],
- hunks = uniDiff.hunks,
- compareLine = options.compareLine || function (lineNumber, line, operation, patchContent) /*istanbul ignore start*/{
- return (/*istanbul ignore end*/line === patchContent
- );
- },
- errorCount = 0,
- fuzzFactor = options.fuzzFactor || 0,
- minLine = 0,
- offset = 0,
- removeEOFNL = /*istanbul ignore start*/void 0 /*istanbul ignore end*/,
- addEOFNL = /*istanbul ignore start*/void 0 /*istanbul ignore end*/;
- /**
- * Checks if the hunk exactly fits on the provided location
- */
- function hunkFits(hunk, toPos) {
- for (var j = 0; j < hunk.lines.length; j++) {
- var line = hunk.lines[j],
- operation = line.length > 0 ? line[0] : ' ',
- content = line.length > 0 ? line.substr(1) : line;
- if (operation === ' ' || operation === '-') {
- // Context sanity check
- if (!compareLine(toPos + 1, lines[toPos], operation, content)) {
- errorCount++;
- if (errorCount > fuzzFactor) {
- return false;
- }
- }
- toPos++;
- }
- }
- return true;
- }
- // Search best fit offsets for each hunk based on the previous ones
- for (var i = 0; i < hunks.length; i++) {
- var hunk = hunks[i],
- maxLine = lines.length - hunk.oldLines,
- localOffset = 0,
- toPos = offset + hunk.oldStart - 1;
- var iterator = /*istanbul ignore start*/(0, _distanceIterator2['default']) /*istanbul ignore end*/(toPos, minLine, maxLine);
- for (; localOffset !== undefined; localOffset = iterator()) {
- if (hunkFits(hunk, toPos + localOffset)) {
- hunk.offset = offset += localOffset;
- break;
- }
- }
- if (localOffset === undefined) {
- return false;
- }
- // Set lower text limit to end of the current hunk, so next ones don't try
- // to fit over already patched text
- minLine = hunk.offset + hunk.oldStart + hunk.oldLines;
- }
- // Apply patch hunks
- var diffOffset = 0;
- for (var _i = 0; _i < hunks.length; _i++) {
- var _hunk = hunks[_i],
- _toPos = _hunk.oldStart + _hunk.offset + diffOffset - 1;
- diffOffset += _hunk.newLines - _hunk.oldLines;
- if (_toPos < 0) {
- // Creating a new file
- _toPos = 0;
- }
- for (var j = 0; j < _hunk.lines.length; j++) {
- var line = _hunk.lines[j],
- operation = line.length > 0 ? line[0] : ' ',
- content = line.length > 0 ? line.substr(1) : line,
- delimiter = _hunk.linedelimiters[j];
- if (operation === ' ') {
- _toPos++;
- } else if (operation === '-') {
- lines.splice(_toPos, 1);
- delimiters.splice(_toPos, 1);
- /* istanbul ignore else */
- } else if (operation === '+') {
- lines.splice(_toPos, 0, content);
- delimiters.splice(_toPos, 0, delimiter);
- _toPos++;
- } else if (operation === '\\') {
- var previousOperation = _hunk.lines[j - 1] ? _hunk.lines[j - 1][0] : null;
- if (previousOperation === '+') {
- removeEOFNL = true;
- } else if (previousOperation === '-') {
- addEOFNL = true;
- }
- }
- }
- }
- // Handle EOFNL insertion/removal
- if (removeEOFNL) {
- while (!lines[lines.length - 1]) {
- lines.pop();
- delimiters.pop();
- }
- } else if (addEOFNL) {
- lines.push('');
- delimiters.push('\n');
- }
- for (var _k = 0; _k < lines.length - 1; _k++) {
- lines[_k] = lines[_k] + delimiters[_k];
- }
- return lines.join('');
- }
- // Wrapper that supports multiple file patches via callbacks.
- function applyPatches(uniDiff, options) {
- if (typeof uniDiff === 'string') {
- uniDiff = /*istanbul ignore start*/(0, parse.parsePatch) /*istanbul ignore end*/(uniDiff);
- }
- var currentIndex = 0;
- function processIndex() {
- var index = uniDiff[currentIndex++];
- if (!index) {
- return options.complete();
- }
- options.loadFile(index, function (err, data) {
- if (err) {
- return options.complete(err);
- }
- var updatedContent = applyPatch(data, index, options);
- options.patched(index, updatedContent, function (err) {
- if (err) {
- return options.complete(err);
- }
- processIndex();
- });
- });
- }
- processIndex();
- }
- });
- unwrapExports(apply);
- var apply_1 = apply.applyPatch;
- var apply_2 = apply.applyPatches;
- var create$2 = createCommonjsModule(function (module, exports) {
- exports.__esModule = true;
- exports. /*istanbul ignore end*/structuredPatch = structuredPatch;
- /*istanbul ignore start*/exports. /*istanbul ignore end*/createTwoFilesPatch = createTwoFilesPatch;
- /*istanbul ignore start*/exports. /*istanbul ignore end*/createPatch = createPatch;
- /*istanbul ignore start*/function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
- /*istanbul ignore end*/function structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options) {
- if (!options) {
- options = {};
- }
- if (typeof options.context === 'undefined') {
- options.context = 4;
- }
- var diff = /*istanbul ignore start*/(0, line.diffLines) /*istanbul ignore end*/(oldStr, newStr, options);
- diff.push({ value: '', lines: [] }); // Append an empty value to make cleanup easier
- function contextLines(lines) {
- return lines.map(function (entry) {
- return ' ' + entry;
- });
- }
- var hunks = [];
- var oldRangeStart = 0,
- newRangeStart = 0,
- curRange = [],
- oldLine = 1,
- newLine = 1;
- /*istanbul ignore start*/var _loop = function _loop( /*istanbul ignore end*/i) {
- var current = diff[i],
- lines = current.lines || current.value.replace(/\n$/, '').split('\n');
- current.lines = lines;
- if (current.added || current.removed) {
- /*istanbul ignore start*/var _curRange;
- /*istanbul ignore end*/ // If we have previous context, start with that
- if (!oldRangeStart) {
- var prev = diff[i - 1];
- oldRangeStart = oldLine;
- newRangeStart = newLine;
- if (prev) {
- curRange = options.context > 0 ? contextLines(prev.lines.slice(-options.context)) : [];
- oldRangeStart -= curRange.length;
- newRangeStart -= curRange.length;
- }
- }
- // Output our changes
- /*istanbul ignore start*/(_curRange = /*istanbul ignore end*/curRange).push. /*istanbul ignore start*/apply /*istanbul ignore end*/( /*istanbul ignore start*/_curRange /*istanbul ignore end*/, /*istanbul ignore start*/_toConsumableArray( /*istanbul ignore end*/lines.map(function (entry) {
- return (current.added ? '+' : '-') + entry;
- })));
- // Track the updated file position
- if (current.added) {
- newLine += lines.length;
- } else {
- oldLine += lines.length;
- }
- } else {
- // Identical context lines. Track line changes
- if (oldRangeStart) {
- // Close out any changes that have been output (or join overlapping)
- if (lines.length <= options.context * 2 && i < diff.length - 2) {
- /*istanbul ignore start*/var _curRange2;
- /*istanbul ignore end*/ // Overlapping
- /*istanbul ignore start*/(_curRange2 = /*istanbul ignore end*/curRange).push. /*istanbul ignore start*/apply /*istanbul ignore end*/( /*istanbul ignore start*/_curRange2 /*istanbul ignore end*/, /*istanbul ignore start*/_toConsumableArray( /*istanbul ignore end*/contextLines(lines)));
- } else {
- /*istanbul ignore start*/var _curRange3;
- /*istanbul ignore end*/ // end the range and output
- var contextSize = Math.min(lines.length, options.context);
- /*istanbul ignore start*/(_curRange3 = /*istanbul ignore end*/curRange).push. /*istanbul ignore start*/apply /*istanbul ignore end*/( /*istanbul ignore start*/_curRange3 /*istanbul ignore end*/, /*istanbul ignore start*/_toConsumableArray( /*istanbul ignore end*/contextLines(lines.slice(0, contextSize))));
- var hunk = {
- oldStart: oldRangeStart,
- oldLines: oldLine - oldRangeStart + contextSize,
- newStart: newRangeStart,
- newLines: newLine - newRangeStart + contextSize,
- lines: curRange
- };
- if (i >= diff.length - 2 && lines.length <= options.context) {
- // EOF is inside this hunk
- var oldEOFNewline = /\n$/.test(oldStr);
- var newEOFNewline = /\n$/.test(newStr);
- if (lines.length == 0 && !oldEOFNewline) {
- // special case: old has no eol and no trailing context; no-nl can end up before adds
- curRange.splice(hunk.oldLines, 0, '\\ No newline at end of file');
- } else if (!oldEOFNewline || !newEOFNewline) {
- curRange.push('\\ No newline at end of file');
- }
- }
- hunks.push(hunk);
- oldRangeStart = 0;
- newRangeStart = 0;
- curRange = [];
- }
- }
- oldLine += lines.length;
- newLine += lines.length;
- }
- };
- for (var i = 0; i < diff.length; i++) {
- /*istanbul ignore start*/_loop( /*istanbul ignore end*/i);
- }
- return {
- oldFileName: oldFileName, newFileName: newFileName,
- oldHeader: oldHeader, newHeader: newHeader,
- hunks: hunks
- };
- }
- function createTwoFilesPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options) {
- var diff = structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options);
- var ret = [];
- if (oldFileName == newFileName) {
- ret.push('Index: ' + oldFileName);
- }
- ret.push('===================================================================');
- ret.push('--- ' + diff.oldFileName + (typeof diff.oldHeader === 'undefined' ? '' : '\t' + diff.oldHeader));
- ret.push('+++ ' + diff.newFileName + (typeof diff.newHeader === 'undefined' ? '' : '\t' + diff.newHeader));
- for (var i = 0; i < diff.hunks.length; i++) {
- var hunk = diff.hunks[i];
- ret.push('@@ -' + hunk.oldStart + ',' + hunk.oldLines + ' +' + hunk.newStart + ',' + hunk.newLines + ' @@');
- ret.push.apply(ret, hunk.lines);
- }
- return ret.join('\n') + '\n';
- }
- function createPatch(fileName, oldStr, newStr, oldHeader, newHeader, options) {
- return createTwoFilesPatch(fileName, fileName, oldStr, newStr, oldHeader, newHeader, options);
- }
- });
- unwrapExports(create$2);
- var create_1 = create$2.structuredPatch;
- var create_2 = create$2.createTwoFilesPatch;
- var create_3 = create$2.createPatch;
- var array$2 = createCommonjsModule(function (module, exports) {
- exports.__esModule = true;
- exports. /*istanbul ignore end*/arrayEqual = arrayEqual;
- /*istanbul ignore start*/exports. /*istanbul ignore end*/arrayStartsWith = arrayStartsWith;
- function arrayEqual(a, b) {
- if (a.length !== b.length) {
- return false;
- }
- return arrayStartsWith(a, b);
- }
- function arrayStartsWith(array, start) {
- if (start.length > array.length) {
- return false;
- }
- for (var i = 0; i < start.length; i++) {
- if (start[i] !== array[i]) {
- return false;
- }
- }
- return true;
- }
- });
- unwrapExports(array$2);
- var array_1$1 = array$2.arrayEqual;
- var array_2$1 = array$2.arrayStartsWith;
- var merge_1 = createCommonjsModule(function (module, exports) {
- exports.__esModule = true;
- exports. /*istanbul ignore end*/calcLineCount = calcLineCount;
- /*istanbul ignore start*/exports. /*istanbul ignore end*/merge = merge;
- /*istanbul ignore start*/function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
- /*istanbul ignore end*/function calcLineCount(hunk) {
- /*istanbul ignore start*/var _calcOldNewLineCount = /*istanbul ignore end*/calcOldNewLineCount(hunk.lines),
- oldLines = _calcOldNewLineCount.oldLines,
- newLines = _calcOldNewLineCount.newLines;
- if (oldLines !== undefined) {
- hunk.oldLines = oldLines;
- } else {
- delete hunk.oldLines;
- }
- if (newLines !== undefined) {
- hunk.newLines = newLines;
- } else {
- delete hunk.newLines;
- }
- }
- function merge(mine, theirs, base) {
- mine = loadPatch(mine, base);
- theirs = loadPatch(theirs, base);
- var ret = {};
- // For index we just let it pass through as it doesn't have any necessary meaning.
- // Leaving sanity checks on this to the API consumer that may know more about the
- // meaning in their own context.
- if (mine.index || theirs.index) {
- ret.index = mine.index || theirs.index;
- }
- if (mine.newFileName || theirs.newFileName) {
- if (!fileNameChanged(mine)) {
- // No header or no change in ours, use theirs (and ours if theirs does not exist)
- ret.oldFileName = theirs.oldFileName || mine.oldFileName;
- ret.newFileName = theirs.newFileName || mine.newFileName;
- ret.oldHeader = theirs.oldHeader || mine.oldHeader;
- ret.newHeader = theirs.newHeader || mine.newHeader;
- } else if (!fileNameChanged(theirs)) {
- // No header or no change in theirs, use ours
- ret.oldFileName = mine.oldFileName;
- ret.newFileName = mine.newFileName;
- ret.oldHeader = mine.oldHeader;
- ret.newHeader = mine.newHeader;
- } else {
- // Both changed... figure it out
- ret.oldFileName = selectField(ret, mine.oldFileName, theirs.oldFileName);
- ret.newFileName = selectField(ret, mine.newFileName, theirs.newFileName);
- ret.oldHeader = selectField(ret, mine.oldHeader, theirs.oldHeader);
- ret.newHeader = selectField(ret, mine.newHeader, theirs.newHeader);
- }
- }
- ret.hunks = [];
- var mineIndex = 0,
- theirsIndex = 0,
- mineOffset = 0,
- theirsOffset = 0;
- while (mineIndex < mine.hunks.length || theirsIndex < theirs.hunks.length) {
- var mineCurrent = mine.hunks[mineIndex] || { oldStart: Infinity },
- theirsCurrent = theirs.hunks[theirsIndex] || { oldStart: Infinity };
- if (hunkBefore(mineCurrent, theirsCurrent)) {
- // This patch does not overlap with any of the others, yay.
- ret.hunks.push(cloneHunk(mineCurrent, mineOffset));
- mineIndex++;
- theirsOffset += mineCurrent.newLines - mineCurrent.oldLines;
- } else if (hunkBefore(theirsCurrent, mineCurrent)) {
- // This patch does not overlap with any of the others, yay.
- ret.hunks.push(cloneHunk(theirsCurrent, theirsOffset));
- theirsIndex++;
- mineOffset += theirsCurrent.newLines - theirsCurrent.oldLines;
- } else {
- // Overlap, merge as best we can
- var mergedHunk = {
- oldStart: Math.min(mineCurrent.oldStart, theirsCurrent.oldStart),
- oldLines: 0,
- newStart: Math.min(mineCurrent.newStart + mineOffset, theirsCurrent.oldStart + theirsOffset),
- newLines: 0,
- lines: []
- };
- mergeLines(mergedHunk, mineCurrent.oldStart, mineCurrent.lines, theirsCurrent.oldStart, theirsCurrent.lines);
- theirsIndex++;
- mineIndex++;
- ret.hunks.push(mergedHunk);
- }
- }
- return ret;
- }
- function loadPatch(param, base) {
- if (typeof param === 'string') {
- if (/^@@/m.test(param) || /^Index:/m.test(param)) {
- return (/*istanbul ignore start*/(0, parse.parsePatch) /*istanbul ignore end*/(param)[0]
- );
- }
- if (!base) {
- throw new Error('Must provide a base reference or pass in a patch');
- }
- return (/*istanbul ignore start*/(0, create$2.structuredPatch) /*istanbul ignore end*/(undefined, undefined, base, param)
- );
- }
- return param;
- }
- function fileNameChanged(patch) {
- return patch.newFileName && patch.newFileName !== patch.oldFileName;
- }
- function selectField(index, mine, theirs) {
- if (mine === theirs) {
- return mine;
- } else {
- index.conflict = true;
- return { mine: mine, theirs: theirs };
- }
- }
- function hunkBefore(test, check) {
- return test.oldStart < check.oldStart && test.oldStart + test.oldLines < check.oldStart;
- }
- function cloneHunk(hunk, offset) {
- return {
- oldStart: hunk.oldStart, oldLines: hunk.oldLines,
- newStart: hunk.newStart + offset, newLines: hunk.newLines,
- lines: hunk.lines
- };
- }
- function mergeLines(hunk, mineOffset, mineLines, theirOffset, theirLines) {
- // This will generally result in a conflicted hunk, but there are cases where the context
- // is the only overlap where we can successfully merge the content here.
- var mine = { offset: mineOffset, lines: mineLines, index: 0 },
- their = { offset: theirOffset, lines: theirLines, index: 0 };
- // Handle any leading content
- insertLeading(hunk, mine, their);
- insertLeading(hunk, their, mine);
- // Now in the overlap content. Scan through and select the best changes from each.
- while (mine.index < mine.lines.length && their.index < their.lines.length) {
- var mineCurrent = mine.lines[mine.index],
- theirCurrent = their.lines[their.index];
- if ((mineCurrent[0] === '-' || mineCurrent[0] === '+') && (theirCurrent[0] === '-' || theirCurrent[0] === '+')) {
- // Both modified ...
- mutualChange(hunk, mine, their);
- } else if (mineCurrent[0] === '+' && theirCurrent[0] === ' ') {
- /*istanbul ignore start*/var _hunk$lines;
- /*istanbul ignore end*/ // Mine inserted
- /*istanbul ignore start*/(_hunk$lines = /*istanbul ignore end*/hunk.lines).push. /*istanbul ignore start*/apply /*istanbul ignore end*/( /*istanbul ignore start*/_hunk$lines /*istanbul ignore end*/, /*istanbul ignore start*/_toConsumableArray( /*istanbul ignore end*/collectChange(mine)));
- } else if (theirCurrent[0] === '+' && mineCurrent[0] === ' ') {
- /*istanbul ignore start*/var _hunk$lines2;
- /*istanbul ignore end*/ // Theirs inserted
- /*istanbul ignore start*/(_hunk$lines2 = /*istanbul ignore end*/hunk.lines).push. /*istanbul ignore start*/apply /*istanbul ignore end*/( /*istanbul ignore start*/_hunk$lines2 /*istanbul ignore end*/, /*istanbul ignore start*/_toConsumableArray( /*istanbul ignore end*/collectChange(their)));
- } else if (mineCurrent[0] === '-' && theirCurrent[0] === ' ') {
- // Mine removed or edited
- removal(hunk, mine, their);
- } else if (theirCurrent[0] === '-' && mineCurrent[0] === ' ') {
- // Their removed or edited
- removal(hunk, their, mine, true);
- } else if (mineCurrent === theirCurrent) {
- // Context identity
- hunk.lines.push(mineCurrent);
- mine.index++;
- their.index++;
- } else {
- // Context mismatch
- conflict(hunk, collectChange(mine), collectChange(their));
- }
- }
- // Now push anything that may be remaining
- insertTrailing(hunk, mine);
- insertTrailing(hunk, their);
- calcLineCount(hunk);
- }
- function mutualChange(hunk, mine, their) {
- var myChanges = collectChange(mine),
- theirChanges = collectChange(their);
- if (allRemoves(myChanges) && allRemoves(theirChanges)) {
- // Special case for remove changes that are supersets of one another
- if ( /*istanbul ignore start*/(0, array$2.arrayStartsWith) /*istanbul ignore end*/(myChanges, theirChanges) && skipRemoveSuperset(their, myChanges, myChanges.length - theirChanges.length)) {
- /*istanbul ignore start*/var _hunk$lines3;
- /*istanbul ignore end*/ /*istanbul ignore start*/(_hunk$lines3 = /*istanbul ignore end*/hunk.lines).push. /*istanbul ignore start*/apply /*istanbul ignore end*/( /*istanbul ignore start*/_hunk$lines3 /*istanbul ignore end*/, /*istanbul ignore start*/_toConsumableArray( /*istanbul ignore end*/myChanges));
- return;
- } else if ( /*istanbul ignore start*/(0, array$2.arrayStartsWith) /*istanbul ignore end*/(theirChanges, myChanges) && skipRemoveSuperset(mine, theirChanges, theirChanges.length - myChanges.length)) {
- /*istanbul ignore start*/var _hunk$lines4;
- /*istanbul ignore end*/ /*istanbul ignore start*/(_hunk$lines4 = /*istanbul ignore end*/hunk.lines).push. /*istanbul ignore start*/apply /*istanbul ignore end*/( /*istanbul ignore start*/_hunk$lines4 /*istanbul ignore end*/, /*istanbul ignore start*/_toConsumableArray( /*istanbul ignore end*/theirChanges));
- return;
- }
- } else if ( /*istanbul ignore start*/(0, array$2.arrayEqual) /*istanbul ignore end*/(myChanges, theirChanges)) {
- /*istanbul ignore start*/var _hunk$lines5;
- /*istanbul ignore end*/ /*istanbul ignore start*/(_hunk$lines5 = /*istanbul ignore end*/hunk.lines).push. /*istanbul ignore start*/apply /*istanbul ignore end*/( /*istanbul ignore start*/_hunk$lines5 /*istanbul ignore end*/, /*istanbul ignore start*/_toConsumableArray( /*istanbul ignore end*/myChanges));
- return;
- }
- conflict(hunk, myChanges, theirChanges);
- }
- function removal(hunk, mine, their, swap) {
- var myChanges = collectChange(mine),
- theirChanges = collectContext(their, myChanges);
- if (theirChanges.merged) {
- /*istanbul ignore start*/var _hunk$lines6;
- /*istanbul ignore end*/ /*istanbul ignore start*/(_hunk$lines6 = /*istanbul ignore end*/hunk.lines).push. /*istanbul ignore start*/apply /*istanbul ignore end*/( /*istanbul ignore start*/_hunk$lines6 /*istanbul ignore end*/, /*istanbul ignore start*/_toConsumableArray( /*istanbul ignore end*/theirChanges.merged));
- } else {
- conflict(hunk, swap ? theirChanges : myChanges, swap ? myChanges : theirChanges);
- }
- }
- function conflict(hunk, mine, their) {
- hunk.conflict = true;
- hunk.lines.push({
- conflict: true,
- mine: mine,
- theirs: their
- });
- }
- function insertLeading(hunk, insert, their) {
- while (insert.offset < their.offset && insert.index < insert.lines.length) {
- var line = insert.lines[insert.index++];
- hunk.lines.push(line);
- insert.offset++;
- }
- }
- function insertTrailing(hunk, insert) {
- while (insert.index < insert.lines.length) {
- var line = insert.lines[insert.index++];
- hunk.lines.push(line);
- }
- }
- function collectChange(state) {
- var ret = [],
- operation = state.lines[state.index][0];
- while (state.index < state.lines.length) {
- var line = state.lines[state.index];
- // Group additions that are immediately after subtractions and treat them as one "atomic" modify change.
- if (operation === '-' && line[0] === '+') {
- operation = '+';
- }
- if (operation === line[0]) {
- ret.push(line);
- state.index++;
- } else {
- break;
- }
- }
- return ret;
- }
- function collectContext(state, matchChanges) {
- var changes = [],
- merged = [],
- matchIndex = 0,
- contextChanges = false,
- conflicted = false;
- while (matchIndex < matchChanges.length && state.index < state.lines.length) {
- var change = state.lines[state.index],
- match = matchChanges[matchIndex];
- // Once we've hit our add, then we are done
- if (match[0] === '+') {
- break;
- }
- contextChanges = contextChanges || change[0] !== ' ';
- merged.push(match);
- matchIndex++;
- // Consume any additions in the other block as a conflict to attempt
- // to pull in the remaining context after this
- if (change[0] === '+') {
- conflicted = true;
- while (change[0] === '+') {
- changes.push(change);
- change = state.lines[++state.index];
- }
- }
- if (match.substr(1) === change.substr(1)) {
- changes.push(change);
- state.index++;
- } else {
- conflicted = true;
- }
- }
- if ((matchChanges[matchIndex] || '')[0] === '+' && contextChanges) {
- conflicted = true;
- }
- if (conflicted) {
- return changes;
- }
- while (matchIndex < matchChanges.length) {
- merged.push(matchChanges[matchIndex++]);
- }
- return {
- merged: merged,
- changes: changes
- };
- }
- function allRemoves(changes) {
- return changes.reduce(function (prev, change) {
- return prev && change[0] === '-';
- }, true);
- }
- function skipRemoveSuperset(state, removeChanges, delta) {
- for (var i = 0; i < delta; i++) {
- var changeContent = removeChanges[removeChanges.length - delta + i].substr(1);
- if (state.lines[state.index + i] !== ' ' + changeContent) {
- return false;
- }
- }
- state.index += delta;
- return true;
- }
- function calcOldNewLineCount(lines) {
- var oldLines = 0;
- var newLines = 0;
- lines.forEach(function (line) {
- if (typeof line !== 'string') {
- var myCount = calcOldNewLineCount(line.mine);
- var theirCount = calcOldNewLineCount(line.theirs);
- if (oldLines !== undefined) {
- if (myCount.oldLines === theirCount.oldLines) {
- oldLines += myCount.oldLines;
- } else {
- oldLines = undefined;
- }
- }
- if (newLines !== undefined) {
- if (myCount.newLines === theirCount.newLines) {
- newLines += myCount.newLines;
- } else {
- newLines = undefined;
- }
- }
- } else {
- if (newLines !== undefined && (line[0] === '+' || line[0] === ' ')) {
- newLines++;
- }
- if (oldLines !== undefined && (line[0] === '-' || line[0] === ' ')) {
- oldLines++;
- }
- }
- });
- return { oldLines: oldLines, newLines: newLines };
- }
- });
- unwrapExports(merge_1);
- var merge_2 = merge_1.calcLineCount;
- var merge_3 = merge_1.merge;
- var dmp = createCommonjsModule(function (module, exports) {
- exports.__esModule = true;
- exports. /*istanbul ignore end*/convertChangesToDMP = convertChangesToDMP;
- // See: http://code.google.com/p/google-diff-match-patch/wiki/API
- function convertChangesToDMP(changes) {
- var ret = [],
- change = /*istanbul ignore start*/void 0 /*istanbul ignore end*/,
- operation = /*istanbul ignore start*/void 0 /*istanbul ignore end*/;
- for (var i = 0; i < changes.length; i++) {
- change = changes[i];
- if (change.added) {
- operation = 1;
- } else if (change.removed) {
- operation = -1;
- } else {
- operation = 0;
- }
- ret.push([operation, change.value]);
- }
- return ret;
- }
- });
- unwrapExports(dmp);
- var dmp_1 = dmp.convertChangesToDMP;
- var xml = createCommonjsModule(function (module, exports) {
- exports.__esModule = true;
- exports. /*istanbul ignore end*/convertChangesToXML = convertChangesToXML;
- function convertChangesToXML(changes) {
- var ret = [];
- for (var i = 0; i < changes.length; i++) {
- var change = changes[i];
- if (change.added) {
- ret.push('<ins>');
- } else if (change.removed) {
- ret.push('<del>');
- }
- ret.push(escapeHTML(change.value));
- if (change.added) {
- ret.push('</ins>');
- } else if (change.removed) {
- ret.push('</del>');
- }
- }
- return ret.join('');
- }
- function escapeHTML(s) {
- var n = s;
- n = n.replace(/&/g, '&');
- n = n.replace(/</g, '<');
- n = n.replace(/>/g, '>');
- n = n.replace(/"/g, '"');
- return n;
- }
- });
- unwrapExports(xml);
- var xml_1 = xml.convertChangesToXML;
- var lib = createCommonjsModule(function (module, exports) {
- exports.__esModule = true;
- exports.canonicalize = exports.convertChangesToXML = exports.convertChangesToDMP = exports.merge = exports.parsePatch = exports.applyPatches = exports.applyPatch = exports.createPatch = exports.createTwoFilesPatch = exports.structuredPatch = exports.diffArrays = exports.diffJson = exports.diffCss = exports.diffSentences = exports.diffTrimmedLines = exports.diffLines = exports.diffWordsWithSpace = exports.diffWords = exports.diffChars = exports.Diff = undefined;
- /*istanbul ignore end*/
- /*istanbul ignore start*/var _base2 = _interopRequireDefault(base);
- /*istanbul ignore end*/
- /*istanbul ignore start*/function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
- /* See LICENSE file for terms of use */
- /*
- * Text diff implementation.
- *
- * This library supports the following APIS:
- * JsDiff.diffChars: Character by character diff
- * JsDiff.diffWords: Word (as defined by \b regex) diff which ignores whitespace
- * JsDiff.diffLines: Line based diff
- *
- * JsDiff.diffCss: Diff targeted at CSS content
- *
- * These methods are based on the implementation proposed in
- * "An O(ND) Difference Algorithm and its Variations" (Myers, 1986).
- * http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.4.6927
- */
- exports. /*istanbul ignore end*/Diff = _base2['default'];
- /*istanbul ignore start*/exports. /*istanbul ignore end*/diffChars = character.diffChars;
- /*istanbul ignore start*/exports. /*istanbul ignore end*/diffWords = word.diffWords;
- /*istanbul ignore start*/exports. /*istanbul ignore end*/diffWordsWithSpace = word.diffWordsWithSpace;
- /*istanbul ignore start*/exports. /*istanbul ignore end*/diffLines = line.diffLines;
- /*istanbul ignore start*/exports. /*istanbul ignore end*/diffTrimmedLines = line.diffTrimmedLines;
- /*istanbul ignore start*/exports. /*istanbul ignore end*/diffSentences = sentence.diffSentences;
- /*istanbul ignore start*/exports. /*istanbul ignore end*/diffCss = css.diffCss;
- /*istanbul ignore start*/exports. /*istanbul ignore end*/diffJson = json.diffJson;
- /*istanbul ignore start*/exports. /*istanbul ignore end*/diffArrays = array.diffArrays;
- /*istanbul ignore start*/exports. /*istanbul ignore end*/structuredPatch = create$2.structuredPatch;
- /*istanbul ignore start*/exports. /*istanbul ignore end*/createTwoFilesPatch = create$2.createTwoFilesPatch;
- /*istanbul ignore start*/exports. /*istanbul ignore end*/createPatch = create$2.createPatch;
- /*istanbul ignore start*/exports. /*istanbul ignore end*/applyPatch = apply.applyPatch;
- /*istanbul ignore start*/exports. /*istanbul ignore end*/applyPatches = apply.applyPatches;
- /*istanbul ignore start*/exports. /*istanbul ignore end*/parsePatch = parse.parsePatch;
- /*istanbul ignore start*/exports. /*istanbul ignore end*/merge = merge_1.merge;
- /*istanbul ignore start*/exports. /*istanbul ignore end*/convertChangesToDMP = dmp.convertChangesToDMP;
- /*istanbul ignore start*/exports. /*istanbul ignore end*/convertChangesToXML = xml.convertChangesToXML;
- /*istanbul ignore start*/exports. /*istanbul ignore end*/canonicalize = json.canonicalize;
- });
- unwrapExports(lib);
- var lib_1 = lib.canonicalize;
- var lib_2 = lib.convertChangesToXML;
- var lib_3 = lib.convertChangesToDMP;
- var lib_4 = lib.merge;
- var lib_5 = lib.parsePatch;
- var lib_6 = lib.applyPatches;
- var lib_7 = lib.applyPatch;
- var lib_8 = lib.createPatch;
- var lib_9 = lib.createTwoFilesPatch;
- var lib_10 = lib.structuredPatch;
- var lib_11 = lib.diffArrays;
- var lib_12 = lib.diffJson;
- var lib_13 = lib.diffCss;
- var lib_14 = lib.diffSentences;
- var lib_15 = lib.diffTrimmedLines;
- var lib_16 = lib.diffLines;
- var lib_17 = lib.diffWordsWithSpace;
- var lib_18 = lib.diffWords;
- var lib_19 = lib.diffChars;
- var lib_20 = lib.Diff;
- var constants = createCommonjsModule(function (module, exports) {
- Object.defineProperty(exports, '__esModule', {
- value: true
- });
- exports.SIMILAR_MESSAGE = exports.NO_DIFF_MESSAGE = undefined;
- var _chalk2 = _interopRequireDefault(fake_chalk);
- function _interopRequireDefault(obj) {
- return obj && obj.__esModule ? obj : { default: obj };
- }
- var NO_DIFF_MESSAGE = exports.NO_DIFF_MESSAGE = _chalk2.default.dim('Compared values have no visual difference.');
- /**
- * Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- *
- *
- */
- var SIMILAR_MESSAGE = exports.SIMILAR_MESSAGE = _chalk2.default.dim('Compared values serialize to the same structure.\n' + 'Printing internal object structure without calling `toJSON` instead.');
- });
- unwrapExports(constants);
- var constants_1 = constants.SIMILAR_MESSAGE;
- var constants_2 = constants.NO_DIFF_MESSAGE;
- var diff_strings = createCommonjsModule(function (module, exports) {
- Object.defineProperty(exports, '__esModule', {
- value: true
- });
- exports.default = diffStrings;
- var _chalk2 = _interopRequireDefault(fake_chalk);
- function _interopRequireDefault(obj) {
- return obj && obj.__esModule ? obj : { default: obj };
- }
- var DIFF_CONTEXT_DEFAULT = 5; // removed | added | equal
- // Given diff digit, return array which consists of:
- // if compared line is removed or added: corresponding original line
- // if compared line is equal: original received and expected lines
- /**
- * Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- *
- *
- */
- // Given chunk, return diff character.
- var getDiffChar = function getDiffChar(chunk) {
- return chunk.removed ? '-' : chunk.added ? '+' : ' ';
- };
- // Given diff character in line of hunk or computed from properties of chunk.
- var getDiffDigit = function getDiffDigit(char) {
- return char === '-' ? -1 : char === '+' ? 1 : 0;
- };
- // Color for text of line.
- var getColor = function getColor(digit, onlyIndentationChanged) {
- if (digit === -1) {
- return _chalk2.default.green; // removed
- }
- if (digit === 1) {
- return _chalk2.default.red; // added
- }
- return onlyIndentationChanged ? _chalk2.default.cyan : _chalk2.default.dim;
- };
- // Do NOT color leading or trailing spaces if original lines are equal:
- // Background color for leading or trailing spaces.
- var getBgColor = function getBgColor(digit, onlyIndentationChanged) {
- return digit === 0 && !onlyIndentationChanged ? _chalk2.default.bgYellow : _chalk2.default.inverse;
- };
- // ONLY trailing if expected value is snapshot or multiline string.
- var highlightTrailingSpaces = function highlightTrailingSpaces(line, bgColor) {
- return line.replace(/\s+$/, bgColor('$&'));
- };
- // BOTH leading AND trailing if expected value is data structure.
- var highlightLeadingTrailingSpaces = function highlightLeadingTrailingSpaces(line, bgColor
- // If line consists of ALL spaces: highlight all of them.
- ) {
- return highlightTrailingSpaces(line, bgColor).replace(
- // If line has an ODD length of leading spaces: highlight only the LAST.
- /^(\s\s)*(\s)(?=[^\s])/, '$1' + bgColor('$2'));
- };
- var getAnnotation = function getAnnotation(options) {
- return _chalk2.default.green('- ' + (options && options.aAnnotation || 'Expected')) + '\n' + _chalk2.default.red('+ ' + (options && options.bAnnotation || 'Received')) + '\n\n';
- };
- // Given string, return array of its lines.
- var splitIntoLines = function splitIntoLines(string) {
- var lines = string.split('\n');
- if (lines.length !== 0 && lines[lines.length - 1] === '') {
- lines.pop();
- }
- return lines;
- };
- // Given diff character and compared line, return original line with colors.
- var formatLine = function formatLine(char, lineCompared, getOriginal) {
- var digit = getDiffDigit(char);
- if (getOriginal) {
- // Compared without indentation if expected value is data structure.
- var lineArray = getOriginal(digit);
- var lineOriginal = lineArray[0];
- var onlyIndentationChanged = digit === 0 && lineOriginal.length !== lineArray[1].length;
- return getColor(digit, onlyIndentationChanged)(char + ' ' +
- // Prepend indentation spaces from original to compared line.
- lineOriginal.slice(0, lineOriginal.length - lineCompared.length) + highlightLeadingTrailingSpaces(lineCompared, getBgColor(digit, onlyIndentationChanged)));
- }
- // Format compared line when expected is snapshot or multiline string.
- return getColor(digit)(char + ' ' + highlightTrailingSpaces(lineCompared, getBgColor(digit)));
- };
- // Given original lines, return callback function
- // which given diff digit, returns array.
- var getterForChunks = function getterForChunks(original) {
- var linesExpected = splitIntoLines(original.a);
- var linesReceived = splitIntoLines(original.b);
- var iExpected = 0;
- var iReceived = 0;
- return function (digit) {
- if (digit === -1) {
- return [linesExpected[iExpected++]];
- }
- if (digit === 1) {
- return [linesReceived[iReceived++]];
- }
- // Because compared line is equal: original received and expected lines.
- return [linesReceived[iReceived++], linesExpected[iExpected++]];
- };
- };
- // jest --expand
- var formatChunks = function formatChunks(a, b, original) {
- var chunks = (0, lib.diffLines)(a, b);
- if (chunks.every(function (chunk) {
- return !chunk.removed && !chunk.added;
- })) {
- return null;
- }
- var getOriginal = original && getterForChunks(original);
- return chunks.reduce(function (lines, chunk) {
- var char = getDiffChar(chunk);
- splitIntoLines(chunk.value).forEach(function (line) {
- lines.push(formatLine(char, line, getOriginal));
- });
- return lines;
- }, []).join('\n');
- };
- // Only show patch marks ("@@ ... @@") if the diff is big.
- // To determine this, we need to compare either the original string (a) to
- // `hunk.oldLines` or a new string to `hunk.newLines`.
- // If the `oldLinesCount` is greater than `hunk.oldLines`
- // we can be sure that at least 1 line has been "hidden".
- var shouldShowPatchMarks = function shouldShowPatchMarks(hunk, oldLinesCount) {
- return oldLinesCount > hunk.oldLines;
- };
- var createPatchMark = function createPatchMark(hunk) {
- var markOld = '-' + hunk.oldStart + ',' + hunk.oldLines;
- var markNew = '+' + hunk.newStart + ',' + hunk.newLines;
- return _chalk2.default.yellow('@@ ' + markOld + ' ' + markNew + ' @@');
- };
- // Given original lines, return callback function which given indexes for hunk,
- // returns another callback function which given diff digit, returns array.
- var getterForHunks = function getterForHunks(original) {
- var linesExpected = splitIntoLines(original.a);
- var linesReceived = splitIntoLines(original.b);
- return function (iExpected, iReceived) {
- return function (digit) {
- if (digit === -1) {
- return [linesExpected[iExpected++]];
- }
- if (digit === 1) {
- return [linesReceived[iReceived++]];
- }
- // Because compared line is equal: original received and expected lines.
- return [linesReceived[iReceived++], linesExpected[iExpected++]];
- };
- };
- };
- // jest --no-expand
- var formatHunks = function formatHunks(a, b, contextLines, original) {
- var options = {
- context: typeof contextLines === 'number' && contextLines >= 0 ? contextLines : DIFF_CONTEXT_DEFAULT
- };
- var _structuredPatch = (0, lib.structuredPatch)('', '', a, b, '', '', options);
- var hunks = _structuredPatch.hunks;
- if (hunks.length === 0) {
- return null;
- }
- var getter = original && getterForHunks(original);
- var oldLinesCount = (a.match(/\n/g) || []).length;
- return hunks.reduce(function (lines, hunk) {
- if (shouldShowPatchMarks(hunk, oldLinesCount)) {
- lines.push(createPatchMark(hunk));
- }
- // Hunk properties are one-based but index args are zero-based.
- var getOriginal = getter && getter(hunk.oldStart - 1, hunk.newStart - 1);
- hunk.lines.forEach(function (line) {
- lines.push(formatLine(line[0], line.slice(1), getOriginal));
- });
- return lines;
- }, []).join('\n');
- };
- function diffStrings(a, b, options, original) {
- // Because `formatHunks` and `formatChunks` ignore one trailing newline,
- // always append newline to strings:
- a += '\n';
- b += '\n';
- // `diff` uses the Myers LCS diff algorithm which runs in O(n+d^2) time
- // (where "d" is the edit distance) and can get very slow for large edit
- // distances. Mitigate the cost by switching to a lower-resolution diff
- // whenever linebreaks are involved.
- var result = options && options.expand === false ? formatHunks(a, b, options && options.contextLines, original) : formatChunks(a, b, original);
- return result === null ? constants.NO_DIFF_MESSAGE : getAnnotation(options) + result;
- }
- });
- unwrapExports(diff_strings);
- var build$3 = createCommonjsModule(function (module) {
- var _prettyFormat2 = _interopRequireDefault(build$1);
- var _chalk2 = _interopRequireDefault(fake_chalk);
- var _jestGetType2 = _interopRequireDefault(build);
- var _diff_strings2 = _interopRequireDefault(diff_strings);
- function _interopRequireDefault(obj) {
- return obj && obj.__esModule ? obj : { default: obj };
- }
- /**
- * Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- *
- *
- */
- var _prettyFormat$plugins = _prettyFormat2.default.plugins;
- var AsymmetricMatcher = _prettyFormat$plugins.AsymmetricMatcher,
- DOMCollection = _prettyFormat$plugins.DOMCollection,
- DOMElement = _prettyFormat$plugins.DOMElement,
- Immutable = _prettyFormat$plugins.Immutable,
- ReactElement = _prettyFormat$plugins.ReactElement,
- ReactTestComponent = _prettyFormat$plugins.ReactTestComponent;
- var PLUGINS = [ReactTestComponent, ReactElement, DOMElement, DOMCollection, Immutable, AsymmetricMatcher];
- var FORMAT_OPTIONS = {
- plugins: PLUGINS
- };
- var FORMAT_OPTIONS_0 = _Object$assign({}, FORMAT_OPTIONS, {
- indent: 0
- });
- var FALLBACK_FORMAT_OPTIONS = {
- callToJSON: false,
- maxDepth: 10,
- plugins: PLUGINS
- };
- var FALLBACK_FORMAT_OPTIONS_0 = _Object$assign({}, FALLBACK_FORMAT_OPTIONS, {
- indent: 0
- });
- // Generate a string that will highlight the difference between two values
- // with green and red. (similar to how github does code diffing)
- function diff(a, b, options) {
- if (a === b) {
- return constants.NO_DIFF_MESSAGE;
- }
- var aType = (0, _jestGetType2.default)(a);
- var expectedType = aType;
- var omitDifference = false;
- if (aType === 'object' && typeof a.asymmetricMatch === 'function') {
- if (a.$$typeof !== _Symbol$for('jest.asymmetricMatcher')) {
- // Do not know expected type of user-defined asymmetric matcher.
- return null;
- }
- if (typeof a.getExpectedType !== 'function') {
- // For example, expect.anything() matches either null or undefined
- return null;
- }
- expectedType = a.getExpectedType();
- // Primitive types boolean and number omit difference below.
- // For example, omit difference for expect.stringMatching(regexp)
- omitDifference = expectedType === 'string';
- }
- if (expectedType !== (0, _jestGetType2.default)(b)) {
- return ' Comparing two different types of values.' + (' Expected ' + _chalk2.default.green(expectedType) + ' but ') + ('received ' + _chalk2.default.red((0, _jestGetType2.default)(b)) + '.');
- }
- if (omitDifference) {
- return null;
- }
- switch (aType) {
- case 'string':
- return (0, _diff_strings2.default)(a, b, options);
- case 'number':
- case 'boolean':
- return null;
- case 'map':
- return compareObjects(sortMap(a), sortMap(b), options);
- case 'set':
- return compareObjects(sortSet(a), sortSet(b), options);
- default:
- return compareObjects(a, b, options);
- }
- }
- function sortMap(map) {
- return new _Map(_Array$from(map.entries()).sort());
- }
- function sortSet(set) {
- return new _Set(_Array$from(set.values()).sort());
- }
- function compareObjects(a, b, options) {
- var diffMessage = void 0;
- var hasThrown = false;
- try {
- diffMessage = (0, _diff_strings2.default)((0, _prettyFormat2.default)(a, FORMAT_OPTIONS_0), (0, _prettyFormat2.default)(b, FORMAT_OPTIONS_0), options, {
- a: (0, _prettyFormat2.default)(a, FORMAT_OPTIONS),
- b: (0, _prettyFormat2.default)(b, FORMAT_OPTIONS)
- });
- } catch (e) {
- hasThrown = true;
- }
- // If the comparison yields no results, compare again but this time
- // without calling `toJSON`. It's also possible that toJSON might throw.
- if (!diffMessage || diffMessage === constants.NO_DIFF_MESSAGE) {
- diffMessage = (0, _diff_strings2.default)((0, _prettyFormat2.default)(a, FALLBACK_FORMAT_OPTIONS_0), (0, _prettyFormat2.default)(b, FALLBACK_FORMAT_OPTIONS_0), options, {
- a: (0, _prettyFormat2.default)(a, FALLBACK_FORMAT_OPTIONS),
- b: (0, _prettyFormat2.default)(b, FALLBACK_FORMAT_OPTIONS)
- });
- if (diffMessage !== constants.NO_DIFF_MESSAGE && !hasThrown) {
- diffMessage = constants.SIMILAR_MESSAGE + '\n\n' + diffMessage;
- }
- }
- return diffMessage;
- }
- module.exports = diff;
- });
- var diff = unwrapExports(build$3);
- // Copyright Joyent, Inc. and other Node contributors.
- //
- // Permission is hereby granted, free of charge, to any person obtaining a
- // copy of this software and associated documentation files (the
- // "Software"), to deal in the Software without restriction, including
- // without limitation the rights to use, copy, modify, merge, publish,
- // distribute, sublicense, and/or sell copies of the Software, and to permit
- // persons to whom the Software is furnished to do so, subject to the
- // following conditions:
- //
- // The above copyright notice and this permission notice shall be included
- // in all copies or substantial portions of the Software.
- //
- // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
- // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
- // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
- // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
- // USE OR OTHER DEALINGS IN THE SOFTWARE.
- // resolves . and .. elements in a path array with directory names there
- // must be no slashes, empty elements, or device names (c:\) in the array
- // (so also no leading and trailing slashes - it does not distinguish
- // relative and absolute paths)
- function normalizeArray(parts, allowAboveRoot) {
- // if the path tries to go above the root, `up` ends up > 0
- var up = 0;
- for (var i = parts.length - 1; i >= 0; i--) {
- var last = parts[i];
- if (last === '.') {
- parts.splice(i, 1);
- } else if (last === '..') {
- parts.splice(i, 1);
- up++;
- } else if (up) {
- parts.splice(i, 1);
- up--;
- }
- }
- // if the path is allowed to go above the root, restore leading ..s
- if (allowAboveRoot) {
- for (; up--; up) {
- parts.unshift('..');
- }
- }
- return parts;
- }
- // Split a filename into [root, dir, basename, ext], unix version
- // 'root' is just a slash, or nothing.
- var splitPathRe =
- /^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/;
- var splitPath = function(filename) {
- return splitPathRe.exec(filename).slice(1);
- };
- // path.resolve([from ...], to)
- // posix version
- function resolve() {
- var resolvedPath = '',
- resolvedAbsolute = false;
- for (var i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) {
- var path = (i >= 0) ? arguments[i] : '/';
- // Skip empty and invalid entries
- if (typeof path !== 'string') {
- throw new TypeError('Arguments to path.resolve must be strings');
- } else if (!path) {
- continue;
- }
- resolvedPath = path + '/' + resolvedPath;
- resolvedAbsolute = path.charAt(0) === '/';
- }
- // At this point the path should be resolved to a full absolute path, but
- // handle relative paths to be safe (might happen when process.cwd() fails)
- // Normalize the path
- resolvedPath = normalizeArray(filter(resolvedPath.split('/'), function(p) {
- return !!p;
- }), !resolvedAbsolute).join('/');
- return ((resolvedAbsolute ? '/' : '') + resolvedPath) || '.';
- }
- // path.normalize(path)
- // posix version
- function normalize(path) {
- var isPathAbsolute = isAbsolute(path),
- trailingSlash = substr(path, -1) === '/';
- // Normalize the path
- path = normalizeArray(filter(path.split('/'), function(p) {
- return !!p;
- }), !isPathAbsolute).join('/');
- if (!path && !isPathAbsolute) {
- path = '.';
- }
- if (path && trailingSlash) {
- path += '/';
- }
- return (isPathAbsolute ? '/' : '') + path;
- }
- // posix version
- function isAbsolute(path) {
- return path.charAt(0) === '/';
- }
- // posix version
- function join() {
- var paths = Array.prototype.slice.call(arguments, 0);
- return normalize(filter(paths, function(p, index) {
- if (typeof p !== 'string') {
- throw new TypeError('Arguments to path.join must be strings');
- }
- return p;
- }).join('/'));
- }
- // path.relative(from, to)
- // posix version
- function relative(from, to) {
- from = resolve(from).substr(1);
- to = resolve(to).substr(1);
- function trim(arr) {
- var start = 0;
- for (; start < arr.length; start++) {
- if (arr[start] !== '') break;
- }
- var end = arr.length - 1;
- for (; end >= 0; end--) {
- if (arr[end] !== '') break;
- }
- if (start > end) return [];
- return arr.slice(start, end - start + 1);
- }
- var fromParts = trim(from.split('/'));
- var toParts = trim(to.split('/'));
- var length = Math.min(fromParts.length, toParts.length);
- var samePartsLength = length;
- for (var i = 0; i < length; i++) {
- if (fromParts[i] !== toParts[i]) {
- samePartsLength = i;
- break;
- }
- }
- var outputParts = [];
- for (var i = samePartsLength; i < fromParts.length; i++) {
- outputParts.push('..');
- }
- outputParts = outputParts.concat(toParts.slice(samePartsLength));
- return outputParts.join('/');
- }
- var sep = '/';
- var delimiter = ':';
- function dirname(path) {
- var result = splitPath(path),
- root = result[0],
- dir = result[1];
- if (!root && !dir) {
- // No dirname whatsoever
- return '.';
- }
- if (dir) {
- // It has a dirname, strip trailing slash
- dir = dir.substr(0, dir.length - 1);
- }
- return root + dir;
- }
- function basename(path, ext) {
- var f = splitPath(path)[2];
- // TODO: make this comparison case-insensitive on windows?
- if (ext && f.substr(-1 * ext.length) === ext) {
- f = f.substr(0, f.length - ext.length);
- }
- return f;
- }
- function extname(path) {
- return splitPath(path)[3];
- }
- var path = {
- extname: extname,
- basename: basename,
- dirname: dirname,
- sep: sep,
- delimiter: delimiter,
- relative: relative,
- join: join,
- isAbsolute: isAbsolute,
- normalize: normalize,
- resolve: resolve
- };
- function filter (xs, f) {
- if (xs.filter) return xs.filter(f);
- var res = [];
- for (var i = 0; i < xs.length; i++) {
- if (f(xs[i], i, xs)) res.push(xs[i]);
- }
- return res;
- }
- // String.prototype.substr - negative index don't work in IE8
- var substr = 'ab'.substr(-1) === 'b' ?
- function (str, start, len) { return str.substr(start, len) } :
- function (str, start, len) {
- if (start < 0) start = str.length + start;
- return str.substr(start, len);
- }
- ;
- var path$1 = Object.freeze({
- resolve: resolve,
- normalize: normalize,
- isAbsolute: isAbsolute,
- join: join,
- relative: relative,
- sep: sep,
- delimiter: delimiter,
- dirname: dirname,
- basename: basename,
- extname: extname,
- default: path
- });
- var path$2 = ( path$1 && path ) || path$1;
- var build$4 = createCommonjsModule(function (module, exports) {
- Object.defineProperty(exports, '__esModule', {
- value: true
- });
- exports.replacePathSepForRegex = exports.escapeStrForRegex = exports.escapePathForRegex = undefined;
- var _path2 = _interopRequireDefault(path$2);
- function _interopRequireDefault(obj) {
- return obj && obj.__esModule ? obj : { default: obj };
- }
- var escapePathForRegex = exports.escapePathForRegex = function (dir) {
- if (_path2.default.sep === '\\') {
- // Replace "\" with "/" so it's not escaped by escapeStrForRegex.
- // replacePathSepForRegex will convert it back.
- dir = dir.replace(/\\/g, '/');
- }
- return replacePathSepForRegex(escapeStrForRegex(dir));
- };
- /**
- * Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- *
- *
- */
- var escapeStrForRegex = exports.escapeStrForRegex = function (string) {
- return string.replace(/[[\]{}()*+?.\\^$|]/g, '\\$&');
- };
- var replacePathSepForRegex = exports.replacePathSepForRegex = function (string) {
- if (_path2.default.sep === '\\') {
- return string.replace(/(\/|(.)?\\(?![[\]{}()*+?.^$|\\]))/g, function (_match, p1, p2) {
- return p2 && p2 !== '\\' ? p2 + '\\\\' : '\\\\';
- });
- }
- return string;
- };
- });
- unwrapExports(build$4);
- var build_1$1 = build$4.replacePathSepForRegex;
- var build_2$1 = build$4.escapeStrForRegex;
- var build_3$1 = build$4.escapePathForRegex;
- var matchers = {
- toBe: function toBe(received, expected) {
- var _this = this;
- var comment = 'Object.is equality';
- var pass = _Object$is(received, expected);
- var message = pass ? function () {
- return build_1('.toBe', undefined, undefined, {
- comment: comment,
- isNot: true
- }) + '\n\n' + ('Expected: ' + build_8(expected) + '\n') + ('Received: ' + build_9(received));
- } : function () {
- var suggestToEqual = build(received) === build(expected) && (build(received) === 'object' || build(expected) === 'array') && equals(received, expected, [iterableEquality]);
- var oneline = isOneline(expected, received);
- var diffString = diff(expected, received, { expand: _this.expand });
- return build_1('.toBe', undefined, undefined, {
- comment: comment,
- isNot: false
- }) + '\n\n' + ('Expected: ' + build_8(expected) + '\n') + ('Received: ' + build_9(received)) + (diffString && !oneline ? '\n\nDifference:\n\n' + diffString : '') + (suggestToEqual ? ' ' + build_13 : '');
- };
- // Passing the the actual and expected objects so that a custom reporter
- // could access them, for example in order to display a custom visual diff,
- // or create a different error message
- return { actual: received, expected: expected, message: message, name: 'toBe', pass: pass };
- },
- toBeCloseTo: function toBeCloseTo(actual, expected) {
- var _this2 = this;
- var precision = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 2;
- var secondArgument = arguments.length === 3 ? 'precision' : null;
- build_3(actual, expected, '.toBeCloseTo');
- var pass = Math.abs(expected - actual) < Math.pow(10, -precision) / 2;
- var message = function message() {
- return build_1('.toBeCloseTo', undefined, undefined, {
- isNot: _this2.isNot,
- secondArgument: secondArgument
- }) + '\n\n' + ('Precision: ' + build_8(precision) + '-digit\n') + ('Expected: ' + build_8(expected) + '\n') + ('Received: ' + build_9(actual));
- };
- return { message: message, pass: pass };
- },
- toBeDefined: function toBeDefined(actual, expected) {
- var _this3 = this;
- build_6(expected, '.toBeDefined');
- var pass = actual !== void 0;
- var message = function message() {
- return build_1('.toBeDefined', 'received', '', {
- isNot: _this3.isNot
- }) + '\n\n' + ('Received: ' + build_9(actual));
- };
- return { message: message, pass: pass };
- },
- toBeFalsy: function toBeFalsy(actual, expected) {
- var _this4 = this;
- build_6(expected, '.toBeFalsy');
- var pass = !actual;
- var message = function message() {
- return build_1('.toBeFalsy', 'received', '', {
- isNot: _this4.isNot
- }) + '\n\n' + ('Received: ' + build_9(actual));
- };
- return { message: message, pass: pass };
- },
- toBeGreaterThan: function toBeGreaterThan(actual, expected) {
- var _this5 = this;
- build_3(actual, expected, '.toBeGreaterThan');
- var pass = actual > expected;
- var message = function message() {
- return build_1('.toBeGreaterThan', undefined, undefined, {
- isNot: _this5.isNot
- }) + '\n\n' + ('Expected: ' + build_8(expected) + '\n') + ('Received: ' + build_9(actual));
- };
- return { message: message, pass: pass };
- },
- toBeGreaterThanOrEqual: function toBeGreaterThanOrEqual(actual, expected) {
- var _this6 = this;
- build_3(actual, expected, '.toBeGreaterThanOrEqual');
- var pass = actual >= expected;
- var message = function message() {
- return build_1('.toBeGreaterThanOrEqual', undefined, undefined, {
- isNot: _this6.isNot
- }) + '\n\n' + ('Expected: ' + build_8(expected) + '\n') + ('Received: ' + build_9(actual));
- };
- return { message: message, pass: pass };
- },
- toBeInstanceOf: function toBeInstanceOf(received, constructor) {
- var _this7 = this;
- var constType = build(constructor);
- if (constType !== 'function') {
- throw new Error(build_1('.toBeInstanceOf', 'value', 'constructor', {
- isNot: this.isNot
- }) + '\n\n' + 'Expected constructor to be a function. Instead got:\n' + (' ' + build_8(constType)));
- }
- var pass = received instanceof constructor;
- var message = pass ? function () {
- return build_1('.toBeInstanceOf', 'value', 'constructor', {
- isNot: _this7.isNot
- }) + '\n\n' + ('Expected constructor: ' + build_15(constructor.name || String(constructor)) + '\n') + ('Received value: ' + build_9(received));
- } : function () {
- return build_1('.toBeInstanceOf', 'value', 'constructor', {
- isNot: _this7.isNot
- }) + '\n\n' + ('Expected constructor: ' + build_15(constructor.name || String(constructor)) + '\n') + ('Received constructor: ' + build_14(received != null ? received.constructor && received.constructor.name : '') + '\n') + ('Received value: ' + build_9(received));
- };
- return { message: message, pass: pass };
- },
- toBeLessThan: function toBeLessThan(actual, expected) {
- var _this8 = this;
- build_3(actual, expected, '.toBeLessThan');
- var pass = actual < expected;
- var message = function message() {
- return build_1('.toBeLessThan', undefined, undefined, {
- isNot: _this8.isNot
- }) + '\n\n' + ('Expected: ' + build_8(expected) + '\n') + ('Received: ' + build_9(actual));
- };
- return { message: message, pass: pass };
- },
- toBeLessThanOrEqual: function toBeLessThanOrEqual(actual, expected) {
- var _this9 = this;
- build_3(actual, expected, '.toBeLessThanOrEqual');
- var pass = actual <= expected;
- var message = function message() {
- return build_1('.toBeLessThanOrEqual', undefined, undefined, {
- isNot: _this9.isNot
- }) + '\n\n' + ('Expected: ' + build_8(expected) + '\n') + ('Received: ' + build_9(actual));
- };
- return { message: message, pass: pass };
- },
- toBeNaN: function toBeNaN(actual, expected) {
- var _this10 = this;
- build_6(expected, '.toBeNaN');
- var pass = _Number$isNaN(actual);
- var message = function message() {
- return build_1('.toBeNaN', 'received', '', {
- isNot: _this10.isNot
- }) + '\n\n' + ('Received: ' + build_9(actual));
- };
- return { message: message, pass: pass };
- },
- toBeNull: function toBeNull(actual, expected) {
- var _this11 = this;
- build_6(expected, '.toBeNull');
- var pass = actual === null;
- var message = function message() {
- return build_1('.toBeNull', 'received', '', {
- isNot: _this11.isNot
- }) + '\n\n' + ('Received: ' + build_9(actual));
- };
- return { message: message, pass: pass };
- },
- toBeTruthy: function toBeTruthy(actual, expected) {
- var _this12 = this;
- build_6(expected, '.toBeTruthy');
- var pass = !!actual;
- var message = function message() {
- return build_1('.toBeTruthy', 'received', '', {
- isNot: _this12.isNot
- }) + '\n\n' + ('Received: ' + build_9(actual));
- };
- return { message: message, pass: pass };
- },
- toBeUndefined: function toBeUndefined(actual, expected) {
- var _this13 = this;
- build_6(expected, '.toBeUndefined');
- var pass = actual === void 0;
- var message = function message() {
- return build_1('.toBeUndefined', 'received', '', {
- isNot: _this13.isNot
- }) + '\n\n' + ('Received: ' + build_9(actual));
- };
- return { message: message, pass: pass };
- },
- toContain: function toContain(collection, value) {
- var collectionType = build(collection);
- var converted = null;
- if (Array.isArray(collection) || typeof collection === 'string') {
- // strings have `indexOf` so we don't need to convert
- // arrays have `indexOf` and we don't want to make a copy
- converted = collection;
- } else {
- try {
- converted = _Array$from(collection);
- } catch (e) {
- throw new Error(build_1('[.not].toContainEqual', 'collection', 'value') + '\n\n' + ('Expected ' + build_14('collection') + ' to be an array-like structure.\n') + build_7('Received', collection, build_9));
- }
- }
- // At this point, we're either a string or an Array,
- // which was converted from an array-like structure.
- var pass = converted.indexOf(value) != -1;
- var message = pass ? function () {
- return build_1('.not.toContain', collectionType, 'value') + '\n\n' + ('Expected ' + collectionType + ':\n') + (' ' + build_9(collection) + '\n') + 'Not to contain value:\n' + (' ' + build_8(value) + '\n');
- } : function () {
- var suggestToContainEqual = converted !== null && typeof converted !== 'string' && converted instanceof Array && converted.findIndex(function (item) {
- return equals(item, value, [iterableEquality]);
- }) !== -1;
- return build_1('.toContain', collectionType, 'value') + '\n\n' + ('Expected ' + collectionType + ':\n') + (' ' + build_9(collection) + '\n') + 'To contain value:\n' + (' ' + build_8(value)) + (suggestToContainEqual ? '\n\n' + build_12 : '');
- };
- return { message: message, pass: pass };
- },
- toContainEqual: function toContainEqual(collection, value) {
- var collectionType = build(collection);
- var converted = null;
- if (Array.isArray(collection)) {
- converted = collection;
- } else {
- try {
- converted = _Array$from(collection);
- } catch (e) {
- throw new Error(build_1('[.not].toContainEqual', 'collection', 'value') + '\n\n' + ('Expected ' + build_14('collection') + ' to be an array-like structure.\n') + build_7('Received', collection, build_9));
- }
- }
- var pass = converted.findIndex(function (item) {
- return equals(item, value, [iterableEquality]);
- }) !== -1;
- var message = pass ? function () {
- return build_1('.not.toContainEqual', collectionType, 'value') + '\n\n' + ('Expected ' + collectionType + ':\n') + (' ' + build_9(collection) + '\n') + 'Not to contain a value equal to:\n' + (' ' + build_8(value) + '\n');
- } : function () {
- return build_1('.toContainEqual', collectionType, 'value') + '\n\n' + ('Expected ' + collectionType + ':\n') + (' ' + build_9(collection) + '\n') + 'To contain a value equal to:\n' + (' ' + build_8(value));
- };
- return { message: message, pass: pass };
- },
- toEqual: function toEqual(received, expected) {
- var _this14 = this;
- var pass = equals(received, expected, [iterableEquality]);
- var message = pass ? function () {
- return build_1('.not.toEqual') + '\n\n' + 'Expected value to not equal:\n' + (' ' + build_8(expected) + '\n') + 'Received:\n' + (' ' + build_9(received));
- } : function () {
- var oneline = isOneline(expected, received);
- var diffString = diff(expected, received, { expand: _this14.expand });
- return build_1('.toEqual') + '\n\n' + 'Expected value to equal:\n' + (' ' + build_8(expected) + '\n') + 'Received:\n' + (' ' + build_9(received)) + (diffString && !oneline ? '\n\nDifference:\n\n' + diffString : '');
- };
- // Passing the the actual and expected objects so that a custom reporter
- // could access them, for example in order to display a custom visual diff,
- // or create a different error message
- return { actual: received, expected: expected, message: message, name: 'toEqual', pass: pass };
- },
- toHaveLength: function toHaveLength(received, length) {
- if (typeof received !== 'string' && (!received || typeof received.length !== 'number')) {
- throw new Error(build_1('[.not].toHaveLength', 'received', 'length') + '\n\n' + 'Expected value to have a \'length\' property that is a number. ' + 'Received:\n' + (' ' + build_9(received) + '\n') + (received ? 'received.length:\n ' + build_9(received.length) : ''));
- }
- var pass = received.length === length;
- var message = pass ? function () {
- return build_1('.not.toHaveLength', 'received', 'length') + '\n\n' + 'Expected value to not have length:\n' + (' ' + build_8(length) + '\n') + 'Received:\n' + (' ' + build_9(received) + '\n') + 'received.length:\n' + (' ' + build_9(received.length));
- } : function () {
- return build_1('.toHaveLength', 'received', 'length') + '\n\n' + 'Expected value to have length:\n' + (' ' + build_8(length) + '\n') + 'Received:\n' + (' ' + build_9(received) + '\n') + 'received.length:\n' + (' ' + build_9(received.length));
- };
- return { message: message, pass: pass };
- },
- toHaveProperty: function toHaveProperty(object, keyPath, value) {
- var _this15 = this;
- var valuePassed = arguments.length === 3;
- var secondArgument = valuePassed ? 'value' : null;
- if (!object && typeof object !== 'string' && typeof object !== 'number') {
- throw new Error(build_1('[.not].toHaveProperty', 'object', 'path', {
- secondArgument: secondArgument
- }) + '\n\n' + ('Expected ' + build_14('object') + ' to be an object. Received:\n') + (' ' + build(object) + ': ' + build_9(object)));
- }
- var keyPathType = build(keyPath);
- if (keyPathType !== 'string' && keyPathType !== 'array') {
- throw new Error(build_1('[.not].toHaveProperty', 'object', 'path', {
- secondArgument: secondArgument
- }) + '\n\n' + ('Expected ' + build_15('path') + ' to be a string or an array. Received:\n') + (' ' + build(keyPath) + ': ' + build_9(keyPath)));
- }
- var result = getPath(object, keyPath);
- var lastTraversedObject = result.lastTraversedObject,
- hasEndProp = result.hasEndProp;
- var pass = valuePassed ? equals(result.value, value, [iterableEquality]) : hasEndProp;
- var traversedPath = result.traversedPath.join('.');
- var message = pass ? function () {
- return build_1('.not.toHaveProperty', 'object', 'path', {
- secondArgument: secondArgument
- }) + '\n\n' + 'Expected the object:\n' + (' ' + build_9(object) + '\n') + 'Not to have a nested property:\n' + (' ' + build_8(keyPath) + '\n') + (valuePassed ? 'With a value of:\n ' + build_8(value) + '\n' : '');
- } : function () {
- var diffString = valuePassed && hasEndProp ? diff(value, result.value, { expand: _this15.expand }) : '';
- return build_1('.toHaveProperty', 'object', 'path', {
- secondArgument: secondArgument
- }) + '\n\n' + 'Expected the object:\n' + (' ' + build_9(object) + '\n') + 'To have a nested property:\n' + (' ' + build_8(keyPath) + '\n') + (valuePassed ? 'With a value of:\n ' + build_8(value) + '\n' : '') + (hasEndProp ? 'Received:\n' + (' ' + build_9(result.value)) + (diffString ? '\n\nDifference:\n\n' + diffString : '') : traversedPath ? 'Received:\n ' + build_14('object') + '.' + traversedPath + ': ' + build_9(lastTraversedObject) : '');
- };
- if (pass === undefined) {
- throw new Error('pass must be initialized');
- }
- return { message: message, pass: pass };
- },
- toMatch: function toMatch(received, expected) {
- if (typeof received !== 'string') {
- throw new Error(build_1('[.not].toMatch', 'string', 'expected') + '\n\n' + (build_14('string') + ' value must be a string.\n') + build_7('Received', received, build_9));
- }
- if (!(expected && typeof expected.test === 'function') && !(typeof expected === 'string')) {
- throw new Error(build_1('[.not].toMatch', 'string', 'expected') + '\n\n' + (build_15('expected') + ' value must be a string or a regular expression.\n') + build_7('Expected', expected, build_8));
- }
- var pass = new RegExp(typeof expected === 'string' ? build_2$1(expected) : expected).test(received);
- var message = pass ? function () {
- return build_1('.not.toMatch') + '\n\nExpected value not to match:\n' + (' ' + build_8(expected)) + '\nReceived:\n' + (' ' + build_9(received));
- } : function () {
- return build_1('.toMatch') + '\n\nExpected value to match:\n' + (' ' + build_8(expected)) + '\nReceived:\n' + (' ' + build_9(received));
- };
- return { message: message, pass: pass };
- },
- toMatchObject: function toMatchObject(receivedObject, expectedObject) {
- var _this16 = this;
- if ((typeof receivedObject === 'undefined' ? 'undefined' : _typeof(receivedObject)) !== 'object' || receivedObject === null) {
- throw new Error(build_1('[.not].toMatchObject', 'object', 'expected') + '\n\n' + (build_14('received') + ' value must be an object.\n') + build_7('Received', receivedObject, build_9));
- }
- if ((typeof expectedObject === 'undefined' ? 'undefined' : _typeof(expectedObject)) !== 'object' || expectedObject === null) {
- throw new Error(build_1('[.not].toMatchObject', 'object', 'expected') + '\n\n' + (build_15('expected') + ' value must be an object.\n') + build_7('Expected', expectedObject, build_8));
- }
- var pass = equals(receivedObject, expectedObject, [iterableEquality, subsetEquality]);
- var message = pass ? function () {
- return build_1('.not.toMatchObject') + '\n\nExpected value not to match object:\n' + (' ' + build_8(expectedObject)) + '\nReceived:\n' + (' ' + build_9(receivedObject));
- } : function () {
- var diffString = diff(expectedObject, getObjectSubset(receivedObject, expectedObject), {
- expand: _this16.expand
- });
- return build_1('.toMatchObject') + '\n\nExpected value to match object:\n' + (' ' + build_8(expectedObject)) + '\nReceived:\n' + (' ' + build_9(receivedObject)) + (diffString ? '\nDifference:\n' + diffString : '');
- };
- return { message: message, pass: pass };
- },
- toStrictEqual: function toStrictEqual(received, expected) {
- var _this17 = this;
- var pass = equals(received, expected, [iterableEquality, typeEquality], true);
- var message = pass ? function () {
- return build_1('.not.toStrictEqual') + '\n\n' + 'Expected value to not equal:\n' + (' ' + build_8(expected) + '\n') + 'Received:\n' + (' ' + build_9(received));
- } : function () {
- var diffString = diff(expected, received, {
- expand: _this17.expand
- });
- return build_1('.toStrictEqual') + '\n\n' + 'Expected value to equal:\n' + (' ' + build_8(expected) + '\n') + 'Received:\n' + (' ' + build_9(received)) + (diffString ? '\n\nDifference:\n\n' + diffString : '');
- };
- // Passing the the actual and expected objects so that a custom reporter
- // could access them, for example in order to display a custom visual diff,
- // or create a different error message
- return { actual: received, expected: expected, message: message, name: 'toStrictEqual', pass: pass };
- }
- };
- var ITERATOR$4 = _wks('iterator');
- var core_isIterable = _core.isIterable = function (it) {
- var O = Object(it);
- return O[ITERATOR$4] !== undefined
- || '@@iterator' in O
- // eslint-disable-next-line no-prototype-builtins
- || _iterators.hasOwnProperty(_classof(O));
- };
- var isIterable = core_isIterable;
- var isIterable$1 = createCommonjsModule(function (module) {
- module.exports = { "default": isIterable, __esModule: true };
- });
- unwrapExports(isIterable$1);
- var slicedToArray = createCommonjsModule(function (module, exports) {
- exports.__esModule = true;
- var _isIterable3 = _interopRequireDefault(isIterable$1);
- var _getIterator3 = _interopRequireDefault(getIterator$1);
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
- exports.default = function () {
- function sliceIterator(arr, i) {
- var _arr = [];
- var _n = true;
- var _d = false;
- var _e = undefined;
- try {
- for (var _i = (0, _getIterator3.default)(arr), _s; !(_n = (_s = _i.next()).done); _n = true) {
- _arr.push(_s.value);
- if (i && _arr.length === i) break;
- }
- } catch (err) {
- _d = true;
- _e = err;
- } finally {
- try {
- if (!_n && _i["return"]) _i["return"]();
- } finally {
- if (_d) throw _e;
- }
- }
- return _arr;
- }
- return function (arr, i) {
- if (Array.isArray(arr)) {
- return arr;
- } else if ((0, _isIterable3.default)(Object(arr))) {
- return sliceIterator(arr, i);
- } else {
- throw new TypeError("Invalid attempt to destructure non-iterable instance");
- }
- };
- }();
- });
- var _slicedToArray = unwrapExports(slicedToArray);
- /**
- * Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- *
- *
- */
- var CALL_PRINT_LIMIT = 3;
- var RETURN_PRINT_LIMIT = 5;
- var LAST_CALL_PRINT_LIMIT = 1;
- var createToBeCalledMatcher = function createToBeCalledMatcher(matcherName) {
- return function (received, expected) {
- build_6(expected, matcherName);
- ensureMock(received, matcherName);
- var receivedIsSpy = isSpy(received);
- var type = receivedIsSpy ? 'spy' : 'mock function';
- var receivedName = receivedIsSpy ? 'spy' : received.getMockName();
- var identifier = receivedIsSpy || receivedName === 'jest.fn()' ? type : type + ' "' + receivedName + '"';
- var count = receivedIsSpy ? received.calls.count() : received.mock.calls.length;
- var calls = receivedIsSpy ? received.calls.all().map(function (x) {
- return x.args;
- }) : received.mock.calls;
- var pass = count > 0;
- var message = pass ? function () {
- return build_1('.not' + matcherName, receivedName, '') + '\n\n' + ('Expected ' + identifier + ' not to be called ') + formatReceivedCalls(calls, CALL_PRINT_LIMIT, { sameSentence: true });
- } : function () {
- return build_1(matcherName, receivedName, '') + '\n\n' + ('Expected ' + identifier + ' to have been called, but it was not called.');
- };
- return { message: message, pass: pass };
- };
- };
- var createToReturnMatcher = function createToReturnMatcher(matcherName) {
- return function (received, expected) {
- build_6(expected, matcherName);
- ensureMock(received, matcherName);
- var receivedName = received.getMockName();
- var identifier = receivedName === 'jest.fn()' ? 'mock function' : 'mock function "' + receivedName + '"';
- // List of return values that correspond only to calls that did not throw
- // an error
- var returnValues = received.mock.results.filter(function (result) {
- return !result.isThrow;
- }).map(function (result) {
- return result.value;
- });
- var count = returnValues.length;
- var pass = count > 0;
- var message = pass ? function () {
- return build_1('.not' + matcherName, receivedName, '') + '\n\n' + ('Expected ' + identifier + ' not to have returned, but it returned:\n') + (' ' + getPrintedReturnValues(returnValues, RETURN_PRINT_LIMIT));
- } : function () {
- return build_1(matcherName, receivedName, '') + '\n\n' + ('Expected ' + identifier + ' to have returned.');
- };
- return { message: message, pass: pass };
- };
- };
- var createToBeCalledTimesMatcher = function createToBeCalledTimesMatcher(matcherName) {
- return function (received, expected) {
- build_4(expected, matcherName);
- ensureMock(received, matcherName);
- var receivedIsSpy = isSpy(received);
- var type = receivedIsSpy ? 'spy' : 'mock function';
- var receivedName = receivedIsSpy ? 'spy' : received.getMockName();
- var identifier = receivedIsSpy || receivedName === 'jest.fn()' ? type : type + ' "' + receivedName + '"';
- var count = receivedIsSpy ? received.calls.count() : received.mock.calls.length;
- var pass = count === expected;
- var message = pass ? function () {
- return build_1('.not' + matcherName, receivedName, String(expected)) + '\n\n' + ('Expected ' + identifier + ' not to be called ') + (build_15(build_2('time', expected)) + ', but it was') + (' called exactly ' + build_14(build_2('time', count)) + '.');
- } : function () {
- return build_1(matcherName, receivedName, String(expected)) + '\n\n' + ('Expected ' + identifier + ' to have been called ') + (build_15(build_2('time', expected)) + ',') + (' but it was called ' + build_14(build_2('time', count)) + '.');
- };
- return { message: message, pass: pass };
- };
- };
- var createToReturnTimesMatcher = function createToReturnTimesMatcher(matcherName) {
- return function (received, expected) {
- build_4(expected, matcherName);
- ensureMock(received, matcherName);
- var receivedName = received.getMockName();
- var identifier = receivedName === 'jest.fn()' ? 'mock function' : 'mock function "' + receivedName + '"';
- // List of return results that correspond only to calls that did not throw
- // an error
- var returnResults = received.mock.results.filter(function (result) {
- return !result.isThrow;
- });
- var count = returnResults.length;
- var pass = count === expected;
- var message = pass ? function () {
- return build_1('.not' + matcherName, receivedName, String(expected)) + '\n\n' + ('Expected ' + identifier + ' not to have returned ') + (build_15(build_2('time', expected)) + ', but it') + (' returned exactly ' + build_14(build_2('time', count)) + '.');
- } : function () {
- return build_1(matcherName, receivedName, String(expected)) + '\n\n' + ('Expected ' + identifier + ' to have returned ') + (build_15(build_2('time', expected)) + ',') + (' but it returned ' + build_14(build_2('time', count)) + '.');
- };
- return { message: message, pass: pass };
- };
- };
- var createToBeCalledWithMatcher = function createToBeCalledWithMatcher(matcherName) {
- return function (received) {
- for (var _len = arguments.length, expected = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
- expected[_key - 1] = arguments[_key];
- }
- ensureMock(received, matcherName);
- var receivedIsSpy = isSpy(received);
- var type = receivedIsSpy ? 'spy' : 'mock function';
- var receivedName = receivedIsSpy ? 'spy' : received.getMockName();
- var identifier = receivedIsSpy || receivedName === 'jest.fn()' ? type : type + ' "' + receivedName + '"';
- var calls = receivedIsSpy ? received.calls.all().map(function (x) {
- return x.args;
- }) : received.mock.calls;
- var _partition = partition(calls, function (call) {
- return equals(call, expected, [iterableEquality]);
- }),
- _partition2 = _slicedToArray(_partition, 2),
- match = _partition2[0],
- fail = _partition2[1];
- var pass = match.length > 0;
- var message = pass ? function () {
- return build_1('.not' + matcherName, receivedName) + '\n\n' + ('Expected ' + identifier + ' not to have been called with:\n') + (' ' + build_8(expected));
- } : function () {
- return build_1(matcherName, receivedName) + '\n\n' + ('Expected ' + identifier + ' to have been called with:\n') + formatMismatchedCalls(fail, expected, CALL_PRINT_LIMIT);
- };
- return { message: message, pass: pass };
- };
- };
- var createToReturnWithMatcher = function createToReturnWithMatcher(matcherName) {
- return function (received, expected) {
- ensureMock(received, matcherName);
- var receivedName = received.getMockName();
- var identifier = receivedName === 'jest.fn()' ? 'mock function' : 'mock function "' + receivedName + '"';
- // List of return values that correspond only to calls that did not throw
- // an error
- var returnValues = received.mock.results.filter(function (result) {
- return !result.isThrow;
- }).map(function (result) {
- return result.value;
- });
- var _partition3 = partition(returnValues, function (value) {
- return equals(expected, value, [iterableEquality]);
- }),
- _partition4 = _slicedToArray(_partition3, 1),
- match = _partition4[0];
- var pass = match.length > 0;
- var message = pass ? function () {
- return build_1('.not' + matcherName, receivedName) + '\n\n' + ('Expected ' + identifier + ' not to have returned:\n') + (' ' + build_8(expected) + '\n') + 'But it returned exactly:\n' + (' ' + build_9(expected));
- } : function () {
- return build_1(matcherName, receivedName) + '\n\n' + ('Expected ' + identifier + ' to have returned:\n') + formatMismatchedReturnValues(returnValues, expected, RETURN_PRINT_LIMIT);
- };
- return { message: message, pass: pass };
- };
- };
- var createLastCalledWithMatcher = function createLastCalledWithMatcher(matcherName) {
- return function (received) {
- for (var _len2 = arguments.length, expected = Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
- expected[_key2 - 1] = arguments[_key2];
- }
- ensureMock(received, matcherName);
- var receivedIsSpy = isSpy(received);
- var type = receivedIsSpy ? 'spy' : 'mock function';
- var receivedName = receivedIsSpy ? 'spy' : received.getMockName();
- var identifier = receivedIsSpy || receivedName === 'jest.fn()' ? type : type + ' "' + receivedName + '"';
- var calls = receivedIsSpy ? received.calls.all().map(function (x) {
- return x.args;
- }) : received.mock.calls;
- var pass = equals(calls[calls.length - 1], expected, [iterableEquality]);
- var message = pass ? function () {
- return build_1('.not' + matcherName, receivedName) + '\n\n' + ('Expected ' + identifier + ' to not have been last called with:\n') + (' ' + build_8(expected));
- } : function () {
- return build_1(matcherName, receivedName) + '\n\n' + ('Expected ' + identifier + ' to have been last called with:\n') + formatMismatchedCalls(calls, expected, LAST_CALL_PRINT_LIMIT);
- };
- return { message: message, pass: pass };
- };
- };
- var createLastReturnedMatcher = function createLastReturnedMatcher(matcherName) {
- return function (received, expected) {
- ensureMock(received, matcherName);
- var receivedName = received.getMockName();
- var identifier = receivedName === 'jest.fn()' ? 'mock function' : 'mock function "' + receivedName + '"';
- var results = received.mock.results;
- var lastResult = results[results.length - 1];
- var pass = !!lastResult && !lastResult.isThrow && equals(lastResult.value, expected, [iterableEquality]);
- var message = pass ? function () {
- return build_1('.not' + matcherName, receivedName) + '\n\n' + ('Expected ' + identifier + ' to not have last returned:\n') + (' ' + build_8(expected) + '\n') + 'But it last returned exactly:\n' + (' ' + build_9(lastResult.value));
- } : function () {
- return build_1(matcherName, receivedName) + '\n\n' + ('Expected ' + identifier + ' to have last returned:\n') + (' ' + build_8(expected) + '\n') + (!lastResult ? 'But it was ' + build_14('not called') : lastResult.isThrow ? 'But the last call ' + build_14('threw an error') : 'But the last call returned:\n ' + build_9(lastResult.value));
- };
- return { message: message, pass: pass };
- };
- };
- var createNthCalledWithMatcher = function createNthCalledWithMatcher(matcherName) {
- return function (received, nth) {
- for (var _len3 = arguments.length, expected = Array(_len3 > 2 ? _len3 - 2 : 0), _key3 = 2; _key3 < _len3; _key3++) {
- expected[_key3 - 2] = arguments[_key3];
- }
- ensureMock(received, matcherName);
- var receivedIsSpy = isSpy(received);
- var type = receivedIsSpy ? 'spy' : 'mock function';
- if (typeof nth !== 'number' || parseInt(nth, 10) !== nth || nth < 1) {
- var _message = function _message() {
- return 'nth value ' + build_9(nth) + ' must be a positive integer greater than ' + build_8(0);
- };
- var _pass = false;
- return { message: _message, pass: _pass };
- }
- var receivedName = receivedIsSpy ? 'spy' : received.getMockName();
- var identifier = receivedIsSpy || receivedName === 'jest.fn()' ? type : type + ' "' + receivedName + '"';
- var calls = receivedIsSpy ? received.calls.all().map(function (x) {
- return x.args;
- }) : received.mock.calls;
- var pass = equals(calls[nth - 1], expected, [iterableEquality]);
- var message = pass ? function () {
- return build_1('.not' + matcherName, receivedName) + '\n\n' + ('Expected ' + identifier + ' ' + nthToString(nth) + ' call to not have been called with:\n') + (' ' + build_8(expected));
- } : function () {
- return build_1(matcherName, receivedName) + '\n\n' + ('Expected ' + identifier + ' ' + nthToString(nth) + ' call to have been called with:\n') + formatMismatchedCalls(calls[nth - 1] ? [calls[nth - 1]] : [], expected, LAST_CALL_PRINT_LIMIT);
- };
- return { message: message, pass: pass };
- };
- };
- var createNthReturnedWithMatcher = function createNthReturnedWithMatcher(matcherName) {
- return function (received, nth, expected) {
- ensureMock(received, matcherName);
- if (typeof nth !== 'number' || parseInt(nth, 10) !== nth || nth < 1) {
- var _message2 = function _message2() {
- return 'nth value ' + build_9(nth) + ' must be a positive integer greater than ' + build_8(0);
- };
- var _pass2 = false;
- return { message: _message2, pass: _pass2 };
- }
- var receivedName = received.getMockName();
- var identifier = receivedName === 'jest.fn()' ? 'mock function' : 'mock function "' + receivedName + '"';
- var results = received.mock.results;
- var nthResult = results[nth - 1];
- var pass = !!nthResult && !nthResult.isThrow && equals(nthResult.value, expected, [iterableEquality]);
- var nthString = nthToString(nth);
- var message = pass ? function () {
- return build_1('.not' + matcherName, receivedName) + '\n\n' + ('Expected ' + identifier + ' ' + nthString + ' call to not have returned with:\n') + (' ' + build_8(expected) + '\n') + ('But the ' + nthString + ' call returned exactly:\n') + (' ' + build_9(nthResult.value));
- } : function () {
- return build_1(matcherName, receivedName) + '\n\n' + ('Expected ' + identifier + ' ' + nthString + ' call to have returned with:\n') + (' ' + build_8(expected) + '\n') + (results.length === 0 ? 'But it was ' + build_14('not called') : nth > results.length ? 'But it was only called ' + build_9(results.length) + ' times' : nthResult.isThrow ? 'But the ' + nthString + ' call ' + build_14('threw an error') : 'But the ' + nthString + ' call returned with:\n ' + build_9(nthResult.value));
- };
- return { message: message, pass: pass };
- };
- };
- var spyMatchers = {
- lastCalledWith: createLastCalledWithMatcher('.lastCalledWith'),
- lastReturnedWith: createLastReturnedMatcher('.lastReturnedWith'),
- nthCalledWith: createNthCalledWithMatcher('.nthCalledWith'),
- nthReturnedWith: createNthReturnedWithMatcher('.nthReturnedWith'),
- toBeCalled: createToBeCalledMatcher('.toBeCalled'),
- toBeCalledTimes: createToBeCalledTimesMatcher('.toBeCalledTimes'),
- toBeCalledWith: createToBeCalledWithMatcher('.toBeCalledWith'),
- toHaveBeenCalled: createToBeCalledMatcher('.toHaveBeenCalled'),
- toHaveBeenCalledTimes: createToBeCalledTimesMatcher('.toHaveBeenCalledTimes'),
- toHaveBeenCalledWith: createToBeCalledWithMatcher('.toHaveBeenCalledWith'),
- toHaveBeenLastCalledWith: createLastCalledWithMatcher('.toHaveBeenLastCalledWith'),
- toHaveBeenNthCalledWith: createNthCalledWithMatcher('.toHaveBeenNthCalledWith'),
- toHaveLastReturnedWith: createLastReturnedMatcher('.toHaveLastReturnedWith'),
- toHaveNthReturnedWith: createNthReturnedWithMatcher('.toHaveNthReturnedWith'),
- toHaveReturned: createToReturnMatcher('.toHaveReturned'),
- toHaveReturnedTimes: createToReturnTimesMatcher('.toHaveReturnedTimes'),
- toHaveReturnedWith: createToReturnWithMatcher('.toHaveReturnedWith'),
- toReturn: createToReturnMatcher('.toReturn'),
- toReturnTimes: createToReturnTimesMatcher('.toReturnTimes'),
- toReturnWith: createToReturnWithMatcher('.toReturnWith')
- };
- var isSpy = function isSpy(spy) {
- return spy.calls && typeof spy.calls.count === 'function';
- };
- var ensureMock = function ensureMock(mockOrSpy, matcherName) {
- if (!mockOrSpy || (mockOrSpy.calls === undefined || mockOrSpy.calls.all === undefined) && mockOrSpy._isMockFunction !== true) {
- throw new Error(build_1('[.not]' + matcherName, 'jest.fn()', '') + '\n\n' + (build_14('jest.fn()') + ' value must be a mock function ') + 'or spy.\n' + build_7('Received', mockOrSpy, build_9));
- }
- };
- var getPrintedCalls = function getPrintedCalls(calls, limit, sep, fn) {
- var result = [];
- var i = calls.length;
- while (--i >= 0 && --limit >= 0) {
- result.push(fn(calls[i]));
- }
- return result.join(sep);
- };
- var getPrintedReturnValues = function getPrintedReturnValues(calls, limit) {
- var result = [];
- for (var i = 0; i < calls.length && i < limit; i += 1) {
- result.push(build_9(calls[i]));
- }
- if (calls.length > limit) {
- result.push('...and ' + build_9(calls.length - limit) + ' more');
- }
- return result.join('\n\n ');
- };
- var formatReceivedCalls = function formatReceivedCalls(calls, limit, options) {
- if (calls.length) {
- var but = options && options.sameSentence ? 'but' : 'But';
- var count = calls.length - limit;
- var printedCalls = getPrintedCalls(calls, limit, ', ', build_9);
- return but + ' it was called ' + 'with:\n ' + printedCalls + (count > 0 ? '\nand ' + build_14(build_2('more call', count)) + '.' : '');
- } else {
- return 'But it was ' + build_14('not called') + '.';
- }
- };
- var formatMismatchedCalls = function formatMismatchedCalls(calls, expected, limit) {
- if (calls.length) {
- return getPrintedCalls(calls, limit, '\n\n', formatMismatchedArgs.bind(null, expected));
- } else {
- return ' ' + build_8(expected) + '\n' + ('But it was ' + build_14('not called') + '.');
- }
- };
- var formatMismatchedReturnValues = function formatMismatchedReturnValues(returnValues, expected, limit) {
- if (returnValues.length) {
- return ' ' + build_8(expected) + '\n' + 'But it returned:\n' + (' ' + getPrintedReturnValues(returnValues, limit));
- } else {
- return ' ' + build_8(expected) + '\n' + ('But it did ' + build_14('not return') + '.');
- }
- };
- var formatMismatchedArgs = function formatMismatchedArgs(expected, received) {
- var length = Math.max(expected.length, received.length);
- var printedArgs = [];
- for (var i = 0; i < length; i++) {
- if (!equals(expected[i], received[i], [iterableEquality])) {
- var oneline = isOneline(expected[i], received[i]);
- var diffString = diff(expected[i], received[i]);
- printedArgs.push(' ' + build_8(expected[i]) + '\n' + ('as argument ' + (i + 1) + ', but it was called with\n') + (' ' + build_9(received[i]) + '.') + (diffString && !oneline ? '\n\nDifference:\n\n' + diffString : ''));
- } else if (i >= expected.length) {
- printedArgs.push(' Did not expect argument ' + (i + 1) + ' ' + ('but it was called with ' + build_9(received[i]) + '.'));
- }
- }
- return printedArgs.join('\n');
- };
- var nthToString = function nthToString(nth) {
- switch (nth) {
- case 1:
- return 'first';
- case 2:
- return 'second';
- case 3:
- return 'third';
- }
- return nth + 'th';
- };
- var global$1 = (typeof global !== "undefined" ? global :
- typeof self !== "undefined" ? self :
- typeof window !== "undefined" ? window : {});
- // shim for using process in browser
- // based off https://github.com/defunctzombie/node-process/blob/master/browser.js
- function defaultSetTimout() {
- throw new Error('setTimeout has not been defined');
- }
- function defaultClearTimeout () {
- throw new Error('clearTimeout has not been defined');
- }
- var cachedSetTimeout = defaultSetTimout;
- var cachedClearTimeout = defaultClearTimeout;
- if (typeof global$1.setTimeout === 'function') {
- cachedSetTimeout = setTimeout;
- }
- if (typeof global$1.clearTimeout === 'function') {
- cachedClearTimeout = clearTimeout;
- }
- function runTimeout(fun) {
- if (cachedSetTimeout === setTimeout) {
- //normal enviroments in sane situations
- return setTimeout(fun, 0);
- }
- // if setTimeout wasn't available but was latter defined
- if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
- cachedSetTimeout = setTimeout;
- return setTimeout(fun, 0);
- }
- try {
- // when when somebody has screwed with setTimeout but no I.E. maddness
- return cachedSetTimeout(fun, 0);
- } catch(e){
- try {
- // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
- return cachedSetTimeout.call(null, fun, 0);
- } catch(e){
- // 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
- return cachedSetTimeout.call(this, fun, 0);
- }
- }
- }
- function runClearTimeout(marker) {
- if (cachedClearTimeout === clearTimeout) {
- //normal enviroments in sane situations
- return clearTimeout(marker);
- }
- // if clearTimeout wasn't available but was latter defined
- if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
- cachedClearTimeout = clearTimeout;
- return clearTimeout(marker);
- }
- try {
- // when when somebody has screwed with setTimeout but no I.E. maddness
- return cachedClearTimeout(marker);
- } catch (e){
- try {
- // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
- return cachedClearTimeout.call(null, marker);
- } catch (e){
- // 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.
- // Some versions of I.E. have different rules for clearTimeout vs setTimeout
- return cachedClearTimeout.call(this, marker);
- }
- }
- }
- var queue$1 = [];
- var draining = false;
- var currentQueue;
- var queueIndex = -1;
- function cleanUpNextTick() {
- if (!draining || !currentQueue) {
- return;
- }
- draining = false;
- if (currentQueue.length) {
- queue$1 = currentQueue.concat(queue$1);
- } else {
- queueIndex = -1;
- }
- if (queue$1.length) {
- drainQueue();
- }
- }
- function drainQueue() {
- if (draining) {
- return;
- }
- var timeout = runTimeout(cleanUpNextTick);
- draining = true;
- var len = queue$1.length;
- while(len) {
- currentQueue = queue$1;
- queue$1 = [];
- while (++queueIndex < len) {
- if (currentQueue) {
- currentQueue[queueIndex].run();
- }
- }
- queueIndex = -1;
- len = queue$1.length;
- }
- currentQueue = null;
- draining = false;
- runClearTimeout(timeout);
- }
- function nextTick(fun) {
- var args = new Array(arguments.length - 1);
- if (arguments.length > 1) {
- for (var i = 1; i < arguments.length; i++) {
- args[i - 1] = arguments[i];
- }
- }
- queue$1.push(new Item(fun, args));
- if (queue$1.length === 1 && !draining) {
- runTimeout(drainQueue);
- }
- }
- // v8 likes predictible objects
- function Item(fun, array) {
- this.fun = fun;
- this.array = array;
- }
- Item.prototype.run = function () {
- this.fun.apply(null, this.array);
- };
- var title = 'browser';
- var platform = 'browser';
- var browser = true;
- var env = {};
- var argv = [];
- var version = ''; // empty string to avoid regexp issues
- var versions$1 = {};
- var release = {};
- var config = {};
- function noop() {}
- var on = noop;
- var addListener = noop;
- var once = noop;
- var off = noop;
- var removeListener = noop;
- var removeAllListeners = noop;
- var emit = noop;
- function binding(name) {
- throw new Error('process.binding is not supported');
- }
- function cwd () { return '/' }
- function chdir (dir) {
- throw new Error('process.chdir is not supported');
- }function umask() { return 0; }
- // from https://github.com/kumavis/browser-process-hrtime/blob/master/index.js
- var performance = global$1.performance || {};
- var performanceNow =
- performance.now ||
- performance.mozNow ||
- performance.msNow ||
- performance.oNow ||
- performance.webkitNow ||
- function(){ return (new Date()).getTime() };
- // generate timestamp or delta
- // see http://nodejs.org/api/process.html#process_process_hrtime
- function hrtime(previousTimestamp){
- var clocktime = performanceNow.call(performance)*1e-3;
- var seconds = Math.floor(clocktime);
- var nanoseconds = Math.floor((clocktime%1)*1e9);
- if (previousTimestamp) {
- seconds = seconds - previousTimestamp[0];
- nanoseconds = nanoseconds - previousTimestamp[1];
- if (nanoseconds<0) {
- seconds--;
- nanoseconds += 1e9;
- }
- }
- return [seconds,nanoseconds]
- }
- var startTime = new Date();
- function uptime() {
- var currentTime = new Date();
- var dif = currentTime - startTime;
- return dif / 1000;
- }
- var process$3 = {
- nextTick: nextTick,
- title: title,
- browser: browser,
- env: env,
- argv: argv,
- version: version,
- versions: versions$1,
- on: on,
- addListener: addListener,
- once: once,
- off: off,
- removeListener: removeListener,
- removeAllListeners: removeAllListeners,
- emit: emit,
- binding: binding,
- cwd: cwd,
- chdir: chdir,
- umask: umask,
- hrtime: hrtime,
- platform: platform,
- release: release,
- config: config,
- uptime: uptime
- };
- var empty$1 = {};
- var empty$2 = Object.freeze({
- default: empty$1
- });
- /*!
- * filename-regex <https://github.com/regexps/filename-regex>
- *
- * Copyright (c) 2014-2015, Jon Schlinkert
- * Licensed under the MIT license.
- */
- var filenameRegex = function filenameRegex() {
- return /([^\\\/]+)$/;
- };
- /*!
- * arr-flatten <https://github.com/jonschlinkert/arr-flatten>
- *
- * Copyright (c) 2014-2017, Jon Schlinkert.
- * Released under the MIT License.
- */
- var arrFlatten = function (arr) {
- return flat(arr, []);
- };
- function flat(arr, res) {
- var i = 0, cur;
- var len = arr.length;
- for (; i < len; i++) {
- cur = arr[i];
- Array.isArray(cur) ? flat(cur, res) : res.push(cur);
- }
- return res;
- }
- var slice = [].slice;
- /**
- * Return the difference between the first array and
- * additional arrays.
- *
- * ```js
- * var diff = require('{%= name %}');
- *
- * var a = ['a', 'b', 'c', 'd'];
- * var b = ['b', 'c'];
- *
- * console.log(diff(a, b))
- * //=> ['a', 'd']
- * ```
- *
- * @param {Array} `a`
- * @param {Array} `b`
- * @return {Array}
- * @api public
- */
- function diff$1(arr, arrays) {
- var argsLen = arguments.length;
- var len = arr.length, i = -1;
- var res = [], arrays;
- if (argsLen === 1) {
- return arr;
- }
- if (argsLen > 2) {
- arrays = arrFlatten(slice.call(arguments, 1));
- }
- while (++i < len) {
- if (!~arrays.indexOf(arr[i])) {
- res.push(arr[i]);
- }
- }
- return res;
- }
- /**
- * Expose `diff`
- */
- var arrDiff = diff$1;
- /*!
- * array-unique <https://github.com/jonschlinkert/array-unique>
- *
- * Copyright (c) 2014-2015, Jon Schlinkert.
- * Licensed under the MIT License.
- */
- var arrayUnique = function unique(arr) {
- if (!Array.isArray(arr)) {
- throw new TypeError('array-unique expects an array.');
- }
- var len = arr.length;
- var i = -1;
- while (i++ < len) {
- var j = i + 1;
- for (; j < arr.length; ++j) {
- if (arr[i] === arr[j]) {
- arr.splice(j--, 1);
- }
- }
- }
- return arr;
- };
- var toString$3 = {}.toString;
- var isarray = Array.isArray || function (arr) {
- return toString$3.call(arr) == '[object Array]';
- };
- var isobject = function isObject(val) {
- return val != null && typeof val === 'object' && isarray(val) === false;
- };
- /*!
- * Determine if an object is a Buffer
- *
- * @author Feross Aboukhadijeh <https://feross.org>
- * @license MIT
- */
- // The _isBuffer check is for Safari 5-7 support, because it's missing
- // Object.prototype.constructor. Remove this eventually
- var isBuffer_1 = function (obj) {
- return obj != null && (isBuffer(obj) || isSlowBuffer(obj) || !!obj._isBuffer)
- };
- function isBuffer (obj) {
- return !!obj.constructor && typeof obj.constructor.isBuffer === 'function' && obj.constructor.isBuffer(obj)
- }
- // For Node v0.10 support. Remove this eventually.
- function isSlowBuffer (obj) {
- return typeof obj.readFloatLE === 'function' && typeof obj.slice === 'function' && isBuffer(obj.slice(0, 0))
- }
- var toString$4 = Object.prototype.toString;
- /**
- * Get the native `typeof` a value.
- *
- * @param {*} `val`
- * @return {*} Native javascript type
- */
- var kindOf = function kindOf(val) {
- // primitivies
- if (typeof val === 'undefined') {
- return 'undefined';
- }
- if (val === null) {
- return 'null';
- }
- if (val === true || val === false || val instanceof Boolean) {
- return 'boolean';
- }
- if (typeof val === 'string' || val instanceof String) {
- return 'string';
- }
- if (typeof val === 'number' || val instanceof Number) {
- return 'number';
- }
- // functions
- if (typeof val === 'function' || val instanceof Function) {
- return 'function';
- }
- // array
- if (typeof Array.isArray !== 'undefined' && Array.isArray(val)) {
- return 'array';
- }
- // check for instances of RegExp and Date before calling `toString`
- if (val instanceof RegExp) {
- return 'regexp';
- }
- if (val instanceof Date) {
- return 'date';
- }
- // other objects
- var type = toString$4.call(val);
- if (type === '[object RegExp]') {
- return 'regexp';
- }
- if (type === '[object Date]') {
- return 'date';
- }
- if (type === '[object Arguments]') {
- return 'arguments';
- }
- if (type === '[object Error]') {
- return 'error';
- }
- // buffer
- if (isBuffer_1(val)) {
- return 'buffer';
- }
- // es6: Map, WeakMap, Set, WeakSet
- if (type === '[object Set]') {
- return 'set';
- }
- if (type === '[object WeakSet]') {
- return 'weakset';
- }
- if (type === '[object Map]') {
- return 'map';
- }
- if (type === '[object WeakMap]') {
- return 'weakmap';
- }
- if (type === '[object Symbol]') {
- return 'symbol';
- }
- // typed arrays
- if (type === '[object Int8Array]') {
- return 'int8array';
- }
- if (type === '[object Uint8Array]') {
- return 'uint8array';
- }
- if (type === '[object Uint8ClampedArray]') {
- return 'uint8clampedarray';
- }
- if (type === '[object Int16Array]') {
- return 'int16array';
- }
- if (type === '[object Uint16Array]') {
- return 'uint16array';
- }
- if (type === '[object Int32Array]') {
- return 'int32array';
- }
- if (type === '[object Uint32Array]') {
- return 'uint32array';
- }
- if (type === '[object Float32Array]') {
- return 'float32array';
- }
- if (type === '[object Float64Array]') {
- return 'float64array';
- }
- // must be a plain object
- return 'object';
- };
- var isNumber = function isNumber(num) {
- var type = kindOf(num);
- if (type !== 'number' && type !== 'string') {
- return false;
- }
- var n = +num;
- return (n - n + 1) >= 0 && num !== '';
- };
- /*!
- * is-number <https://github.com/jonschlinkert/is-number>
- *
- * Copyright (c) 2014-2017, Jon Schlinkert.
- * Released under the MIT License.
- */
- var isNumber$1 = function isNumber(num) {
- var type = typeof num;
- if (type === 'string' || num instanceof String) {
- // an empty string would be coerced to true with the below logic
- if (!num.trim()) return false;
- } else if (type !== 'number' && !(num instanceof Number)) {
- return false;
- }
- return (num - num + 1) >= 0;
- };
- var toString$5 = Object.prototype.toString;
- var kindOf$1 = function kindOf(val) {
- if (val === void 0) return 'undefined';
- if (val === null) return 'null';
- var type = typeof val;
- if (type === 'boolean') return 'boolean';
- if (type === 'string') return 'string';
- if (type === 'number') return 'number';
- if (type === 'symbol') return 'symbol';
- if (type === 'function') {
- return isGeneratorFn(val) ? 'generatorfunction' : 'function';
- }
- if (isArray(val)) return 'array';
- if (isBuffer$1(val)) return 'buffer';
- if (isArguments(val)) return 'arguments';
- if (isDate(val)) return 'date';
- if (isError$1(val)) return 'error';
- if (isRegexp(val)) return 'regexp';
- switch (ctorName(val)) {
- case 'Symbol': return 'symbol';
- case 'Promise': return 'promise';
- // Set, Map, WeakSet, WeakMap
- case 'WeakMap': return 'weakmap';
- case 'WeakSet': return 'weakset';
- case 'Map': return 'map';
- case 'Set': return 'set';
- // 8-bit typed arrays
- case 'Int8Array': return 'int8array';
- case 'Uint8Array': return 'uint8array';
- case 'Uint8ClampedArray': return 'uint8clampedarray';
- // 16-bit typed arrays
- case 'Int16Array': return 'int16array';
- case 'Uint16Array': return 'uint16array';
- // 32-bit typed arrays
- case 'Int32Array': return 'int32array';
- case 'Uint32Array': return 'uint32array';
- case 'Float32Array': return 'float32array';
- case 'Float64Array': return 'float64array';
- }
- if (isGeneratorObj(val)) {
- return 'generator';
- }
- // Non-plain objects
- type = toString$5.call(val);
- switch (type) {
- case '[object Object]': return 'object';
- // iterators
- case '[object Map Iterator]': return 'mapiterator';
- case '[object Set Iterator]': return 'setiterator';
- case '[object String Iterator]': return 'stringiterator';
- case '[object Array Iterator]': return 'arrayiterator';
- }
- // other
- return type.slice(8, -1).toLowerCase().replace(/\s/g, '');
- };
- function ctorName(val) {
- return val.constructor ? val.constructor.name : null;
- }
- function isArray(val) {
- if (Array.isArray) return Array.isArray(val);
- return val instanceof Array;
- }
- function isError$1(val) {
- return val instanceof Error || (typeof val.message === 'string' && val.constructor && typeof val.constructor.stackTraceLimit === 'number');
- }
- function isDate(val) {
- if (val instanceof Date) return true;
- return typeof val.toDateString === 'function'
- && typeof val.getDate === 'function'
- && typeof val.setDate === 'function';
- }
- function isRegexp(val) {
- if (val instanceof RegExp) return true;
- return typeof val.flags === 'string'
- && typeof val.ignoreCase === 'boolean'
- && typeof val.multiline === 'boolean'
- && typeof val.global === 'boolean';
- }
- function isGeneratorFn(name, val) {
- return ctorName(name) === 'GeneratorFunction';
- }
- function isGeneratorObj(val) {
- return typeof val.throw === 'function'
- && typeof val.return === 'function'
- && typeof val.next === 'function';
- }
- function isArguments(val) {
- try {
- if (typeof val.length === 'number' && typeof val.callee === 'function') {
- return true;
- }
- } catch (err) {
- if (err.message.indexOf('callee') !== -1) {
- return true;
- }
- }
- return false;
- }
- /**
- * If you need to support Safari 5-7 (8-10 yr-old browser),
- * take a look at https://github.com/feross/is-buffer
- */
- function isBuffer$1(val) {
- if (val.constructor && typeof val.constructor.isBuffer === 'function') {
- return val.constructor.isBuffer(val);
- }
- return false;
- }
- var crypto = ( empty$2 && empty$1 ) || empty$2;
- var max$1 = Math.pow(2, 32);
- var node = random;
- var cryptographic = true;
- function random () {
- var buf = crypto
- .randomBytes(4)
- .toString('hex');
- return parseInt(buf, 16) / max$1
- }
- node.cryptographic = cryptographic;
- /**
- * Expose `randomatic`
- */
- var randomatic_1 = randomatic;
- var isCrypto = !!node.cryptographic;
- /**
- * Available mask characters
- */
- var type = {
- lower: 'abcdefghijklmnopqrstuvwxyz',
- upper: 'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
- number: '0123456789',
- special: '~!@#$%^&()_+-={}[];\',.'
- };
- type.all = type.lower + type.upper + type.number + type.special;
- /**
- * Generate random character sequences of a specified `length`,
- * based on the given `pattern`.
- *
- * @param {String} `pattern` The pattern to use for generating the random string.
- * @param {String} `length` The length of the string to generate.
- * @param {String} `options`
- * @return {String}
- * @api public
- */
- function randomatic(pattern, length, options) {
- if (typeof pattern === 'undefined') {
- throw new Error('randomatic expects a string or number.');
- }
- var custom = false;
- if (arguments.length === 1) {
- if (typeof pattern === 'string') {
- length = pattern.length;
- } else if (isNumber$1(pattern)) {
- options = {};
- length = pattern;
- pattern = '*';
- }
- }
- if (kindOf$1(length) === 'object' && length.hasOwnProperty('chars')) {
- options = length;
- pattern = options.chars;
- length = pattern.length;
- custom = true;
- }
- var opts = options || {};
- var mask = '';
- var res = '';
- // Characters to be used
- if (pattern.indexOf('?') !== -1) mask += opts.chars;
- if (pattern.indexOf('a') !== -1) mask += type.lower;
- if (pattern.indexOf('A') !== -1) mask += type.upper;
- if (pattern.indexOf('0') !== -1) mask += type.number;
- if (pattern.indexOf('!') !== -1) mask += type.special;
- if (pattern.indexOf('*') !== -1) mask += type.all;
- if (custom) mask += pattern;
- while (length--) {
- res += mask.charAt(parseInt(node() * mask.length, 10));
- }
- return res;
- }randomatic_1.isCrypto = isCrypto;
- /*!
- * repeat-string <https://github.com/jonschlinkert/repeat-string>
- *
- * Copyright (c) 2014-2015, Jon Schlinkert.
- * Licensed under the MIT License.
- */
- /**
- * Results cache
- */
- var res = '';
- var cache;
- /**
- * Expose `repeat`
- */
- var repeatString = repeat;
- /**
- * Repeat the given `string` the specified `number`
- * of times.
- *
- * **Example:**
- *
- * ```js
- * var repeat = require('repeat-string');
- * repeat('A', 5);
- * //=> AAAAA
- * ```
- *
- * @param {String} `string` The string to repeat
- * @param {Number} `number` The number of times to repeat the string
- * @return {String} Repeated string
- * @api public
- */
- function repeat(str, num) {
- if (typeof str !== 'string') {
- throw new TypeError('expected a string');
- }
- // cover common, quick use cases
- if (num === 1) return str;
- if (num === 2) return str + str;
- var max = str.length * num;
- if (cache !== str || typeof cache === 'undefined') {
- cache = str;
- res = '';
- } else if (res.length >= max) {
- return res.substr(0, max);
- }
- while (max > res.length && num > 1) {
- if (num & 1) {
- res += str;
- }
- num >>= 1;
- str += str;
- }
- res += str;
- res = res.substr(0, max);
- return res;
- }
- /*!
- * repeat-element <https://github.com/jonschlinkert/repeat-element>
- *
- * Copyright (c) 2015 Jon Schlinkert.
- * Licensed under the MIT license.
- */
- var repeatElement = function repeat(ele, num) {
- var arr = new Array(num);
- for (var i = 0; i < num; i++) {
- arr[i] = ele;
- }
- return arr;
- };
- /**
- * Expose `fillRange`
- */
- var fillRange_1 = fillRange;
- /**
- * Return a range of numbers or letters.
- *
- * @param {String} `a` Start of the range
- * @param {String} `b` End of the range
- * @param {String} `step` Increment or decrement to use.
- * @param {Function} `fn` Custom function to modify each element in the range.
- * @return {Array}
- */
- function fillRange(a, b, step, options, fn) {
- if (a == null || b == null) {
- throw new Error('fill-range expects the first and second args to be strings.');
- }
- if (typeof step === 'function') {
- fn = step; options = {}; step = null;
- }
- if (typeof options === 'function') {
- fn = options; options = {};
- }
- if (isobject(step)) {
- options = step; step = '';
- }
- var expand, regex = false, sep = '';
- var opts = options || {};
- if (typeof opts.silent === 'undefined') {
- opts.silent = true;
- }
- step = step || opts.step;
- // store a ref to unmodified arg
- var origA = a, origB = b;
- b = (b.toString() === '-0') ? 0 : b;
- if (opts.optimize || opts.makeRe) {
- step = step ? (step += '~') : step;
- expand = true;
- regex = true;
- sep = '~';
- }
- // handle special step characters
- if (typeof step === 'string') {
- var match = stepRe().exec(step);
- if (match) {
- var i = match.index;
- var m = match[0];
- // repeat string
- if (m === '+') {
- return repeatElement(a, b);
- // randomize a, `b` times
- } else if (m === '?') {
- return [randomatic_1(a, b)];
- // expand right, no regex reduction
- } else if (m === '>') {
- step = step.substr(0, i) + step.substr(i + 1);
- expand = true;
- // expand to an array, or if valid create a reduced
- // string for a regex logic `or`
- } else if (m === '|') {
- step = step.substr(0, i) + step.substr(i + 1);
- expand = true;
- regex = true;
- sep = m;
- // expand to an array, or if valid create a reduced
- // string for a regex range
- } else if (m === '~') {
- step = step.substr(0, i) + step.substr(i + 1);
- expand = true;
- regex = true;
- sep = m;
- }
- } else if (!isNumber(step)) {
- if (!opts.silent) {
- throw new TypeError('fill-range: invalid step.');
- }
- return null;
- }
- }
- if (/[.&*()[\]^%$#@!]/.test(a) || /[.&*()[\]^%$#@!]/.test(b)) {
- if (!opts.silent) {
- throw new RangeError('fill-range: invalid range arguments.');
- }
- return null;
- }
- // has neither a letter nor number, or has both letters and numbers
- // this needs to be after the step logic
- if (!noAlphaNum(a) || !noAlphaNum(b) || hasBoth(a) || hasBoth(b)) {
- if (!opts.silent) {
- throw new RangeError('fill-range: invalid range arguments.');
- }
- return null;
- }
- // validate arguments
- var isNumA = isNumber(zeros(a));
- var isNumB = isNumber(zeros(b));
- if ((!isNumA && isNumB) || (isNumA && !isNumB)) {
- if (!opts.silent) {
- throw new TypeError('fill-range: first range argument is incompatible with second.');
- }
- return null;
- }
- // by this point both are the same, so we
- // can use A to check going forward.
- var isNum = isNumA;
- var num = formatStep(step);
- // is the range alphabetical? or numeric?
- if (isNum) {
- // if numeric, coerce to an integer
- a = +a; b = +b;
- } else {
- // otherwise, get the charCode to expand alpha ranges
- a = a.charCodeAt(0);
- b = b.charCodeAt(0);
- }
- // is the pattern descending?
- var isDescending = a > b;
- // don't create a character class if the args are < 0
- if (a < 0 || b < 0) {
- expand = false;
- regex = false;
- }
- // detect padding
- var padding = isPadded(origA, origB);
- var res, pad, arr = [];
- var ii = 0;
- // character classes, ranges and logical `or`
- if (regex) {
- if (shouldExpand(a, b, num, isNum, padding, opts)) {
- // make sure the correct separator is used
- if (sep === '|' || sep === '~') {
- sep = detectSeparator(a, b, num, isNum, isDescending);
- }
- return wrap$1([origA, origB], sep, opts);
- }
- }
- while (isDescending ? (a >= b) : (a <= b)) {
- if (padding && isNum) {
- pad = padding(a);
- }
- // custom function
- if (typeof fn === 'function') {
- res = fn(a, isNum, pad, ii++);
- // letters
- } else if (!isNum) {
- if (regex && isInvalidChar(a)) {
- res = null;
- } else {
- res = String.fromCharCode(a);
- }
- // numbers
- } else {
- res = formatPadding(a, pad);
- }
- // add result to the array, filtering any nulled values
- if (res !== null) arr.push(res);
- // increment or decrement
- if (isDescending) {
- a -= num;
- } else {
- a += num;
- }
- }
- // now that the array is expanded, we need to handle regex
- // character classes, ranges or logical `or` that wasn't
- // already handled before the loop
- if ((regex || expand) && !opts.noexpand) {
- // make sure the correct separator is used
- if (sep === '|' || sep === '~') {
- sep = detectSeparator(a, b, num, isNum, isDescending);
- }
- if (arr.length === 1 || a < 0 || b < 0) { return arr; }
- return wrap$1(arr, sep, opts);
- }
- return arr;
- }
- /**
- * Wrap the string with the correct regex
- * syntax.
- */
- function wrap$1(arr, sep, opts) {
- if (sep === '~') { sep = '-'; }
- var str = arr.join(sep);
- var pre = opts && opts.regexPrefix;
- // regex logical `or`
- if (sep === '|') {
- str = pre ? pre + str : str;
- str = '(' + str + ')';
- }
- // regex character class
- if (sep === '-') {
- str = (pre && pre === '^')
- ? pre + str
- : str;
- str = '[' + str + ']';
- }
- return [str];
- }
- /**
- * Check for invalid characters
- */
- function isCharClass(a, b, step, isNum, isDescending) {
- if (isDescending) { return false; }
- if (isNum) { return a <= 9 && b <= 9; }
- if (a < b) { return step === 1; }
- return false;
- }
- /**
- * Detect the correct separator to use
- */
- function shouldExpand(a, b, num, isNum, padding, opts) {
- if (isNum && (a > 9 || b > 9)) { return false; }
- return !padding && num === 1 && a < b;
- }
- /**
- * Detect the correct separator to use
- */
- function detectSeparator(a, b, step, isNum, isDescending) {
- var isChar = isCharClass(a, b, step, isNum, isDescending);
- if (!isChar) {
- return '|';
- }
- return '~';
- }
- /**
- * Correctly format the step based on type
- */
- function formatStep(step) {
- return Math.abs(step >> 0) || 1;
- }
- /**
- * Format padding, taking leading `-` into account
- */
- function formatPadding(ch, pad) {
- var res = pad ? pad + ch : ch;
- if (pad && ch.toString().charAt(0) === '-') {
- res = '-' + pad + ch.toString().substr(1);
- }
- return res.toString();
- }
- /**
- * Check for invalid characters
- */
- function isInvalidChar(str) {
- var ch = toStr(str);
- return ch === '\\'
- || ch === '['
- || ch === ']'
- || ch === '^'
- || ch === '('
- || ch === ')'
- || ch === '`';
- }
- /**
- * Convert to a string from a charCode
- */
- function toStr(ch) {
- return String.fromCharCode(ch);
- }
- /**
- * Step regex
- */
- function stepRe() {
- return /\?|>|\||\+|\~/g;
- }
- /**
- * Return true if `val` has either a letter
- * or a number
- */
- function noAlphaNum(val) {
- return /[a-z0-9]/i.test(val);
- }
- /**
- * Return true if `val` has both a letter and
- * a number (invalid)
- */
- function hasBoth(val) {
- return /[a-z][0-9]|[0-9][a-z]/i.test(val);
- }
- /**
- * Normalize zeros for checks
- */
- function zeros(val) {
- if (/^-*0+$/.test(val.toString())) {
- return '0';
- }
- return val;
- }
- /**
- * Return true if `val` has leading zeros,
- * or a similar valid pattern.
- */
- function hasZeros(val) {
- return /[^.]\.|^-*0+[0-9]/.test(val);
- }
- /**
- * If the string is padded, returns a curried function with
- * the a cached padding string, or `false` if no padding.
- *
- * @param {*} `origA` String or number.
- * @return {String|Boolean}
- */
- function isPadded(origA, origB) {
- if (hasZeros(origA) || hasZeros(origB)) {
- var alen = length(origA);
- var blen = length(origB);
- var len = alen >= blen
- ? alen
- : blen;
- return function (a) {
- return repeatString('0', len - length(a));
- };
- }
- return false;
- }
- /**
- * Get the string length of `val`
- */
- function length(val) {
- return val.toString().length;
- }
- var expandRange = function expandRange(str, options, fn) {
- if (typeof str !== 'string') {
- throw new TypeError('expand-range expects a string.');
- }
- if (typeof options === 'function') {
- fn = options;
- options = {};
- }
- if (typeof options === 'boolean') {
- options = {};
- options.makeRe = true;
- }
- // create arguments to pass to fill-range
- var opts = options || {};
- var args = str.split('..');
- var len = args.length;
- if (len > 3) { return str; }
- // if only one argument, it can't expand so return it
- if (len === 1) { return args; }
- // if `true`, tell fill-range to regexify the string
- if (typeof fn === 'boolean' && fn === true) {
- opts.makeRe = true;
- }
- args.push(opts);
- return fillRange_1.apply(null, args.concat(fn));
- };
- /*!
- * preserve <https://github.com/jonschlinkert/preserve>
- *
- * Copyright (c) 2014-2015, Jon Schlinkert.
- * Licensed under the MIT license.
- */
- /**
- * Replace tokens in `str` with a temporary, heuristic placeholder.
- *
- * ```js
- * tokens.before('{a\\,b}');
- * //=> '{__ID1__}'
- * ```
- *
- * @param {String} `str`
- * @return {String} String with placeholders.
- * @api public
- */
- var before = function before(str, re) {
- return str.replace(re, function (match) {
- var id = randomize();
- cache$1[id] = match;
- return '__ID' + id + '__';
- });
- };
- /**
- * Replace placeholders in `str` with original tokens.
- *
- * ```js
- * tokens.after('{__ID1__}');
- * //=> '{a\\,b}'
- * ```
- *
- * @param {String} `str` String with placeholders
- * @return {String} `str` String with original tokens.
- * @api public
- */
- var after = function after(str) {
- return str.replace(/__ID(.{5})__/g, function (_, id) {
- return cache$1[id];
- });
- };
- function randomize() {
- return Math.random().toString().slice(2, 7);
- }
- var cache$1 = {};
- var preserve = {
- before: before,
- after: after
- };
- /**
- * Module dependencies
- */
- /**
- * Expose `braces`
- */
- var braces_1 = function(str, options) {
- if (typeof str !== 'string') {
- throw new Error('braces expects a string');
- }
- return braces(str, options);
- };
- /**
- * Expand `{foo,bar}` or `{1..5}` braces in the
- * given `string`.
- *
- * @param {String} `str`
- * @param {Array} `arr`
- * @param {Object} `options`
- * @return {Array}
- */
- function braces(str, arr, options) {
- if (str === '') {
- return [];
- }
- if (!Array.isArray(arr)) {
- options = arr;
- arr = [];
- }
- var opts = options || {};
- arr = arr || [];
- if (typeof opts.nodupes === 'undefined') {
- opts.nodupes = true;
- }
- var fn = opts.fn;
- var es6;
- if (typeof opts === 'function') {
- fn = opts;
- opts = {};
- }
- if (!(patternRe instanceof RegExp)) {
- patternRe = patternRegex();
- }
- var matches = str.match(patternRe) || [];
- var m = matches[0];
- switch(m) {
- case '\\,':
- return escapeCommas(str, arr, opts);
- case '\\.':
- return escapeDots(str, arr, opts);
- case '\/.':
- return escapePaths(str, arr, opts);
- case ' ':
- return splitWhitespace(str);
- case '{,}':
- return exponential(str, opts, braces);
- case '{}':
- return emptyBraces(str, arr, opts);
- case '\\{':
- case '\\}':
- return escapeBraces(str, arr, opts);
- case '${':
- if (!/\{[^{]+\{/.test(str)) {
- return arr.concat(str);
- } else {
- es6 = true;
- str = preserve.before(str, es6Regex());
- }
- }
- if (!(braceRe instanceof RegExp)) {
- braceRe = braceRegex();
- }
- var match = braceRe.exec(str);
- if (match == null) {
- return [str];
- }
- var outter = match[1];
- var inner = match[2];
- if (inner === '') { return [str]; }
- var segs, segsLength;
- if (inner.indexOf('..') !== -1) {
- segs = expandRange(inner, opts, fn) || inner.split(',');
- segsLength = segs.length;
- } else if (inner[0] === '"' || inner[0] === '\'') {
- return arr.concat(str.split(/['"]/).join(''));
- } else {
- segs = inner.split(',');
- if (opts.makeRe) {
- return braces(str.replace(outter, wrap$2(segs, '|')), opts);
- }
- segsLength = segs.length;
- if (segsLength === 1 && opts.bash) {
- segs[0] = wrap$2(segs[0], '\\');
- }
- }
- var len = segs.length;
- var i = 0, val;
- while (len--) {
- var path = segs[i++];
- if (/(\.[^.\/])/.test(path)) {
- if (segsLength > 1) {
- return segs;
- } else {
- return [str];
- }
- }
- val = splice(str, outter, path);
- if (/\{[^{}]+?\}/.test(val)) {
- arr = braces(val, arr, opts);
- } else if (val !== '') {
- if (opts.nodupes && arr.indexOf(val) !== -1) { continue; }
- arr.push(es6 ? preserve.after(val) : val);
- }
- }
- if (opts.strict) { return filter$1(arr, filterEmpty); }
- return arr;
- }
- /**
- * Expand exponential ranges
- *
- * `a{,}{,}` => ['a', 'a', 'a', 'a']
- */
- function exponential(str, options, fn) {
- if (typeof options === 'function') {
- fn = options;
- options = null;
- }
- var opts = options || {};
- var esc = '__ESC_EXP__';
- var exp = 0;
- var res;
- var parts = str.split('{,}');
- if (opts.nodupes) {
- return fn(parts.join(''), opts);
- }
- exp = parts.length - 1;
- res = fn(parts.join(esc), opts);
- var len = res.length;
- var arr = [];
- var i = 0;
- while (len--) {
- var ele = res[i++];
- var idx = ele.indexOf(esc);
- if (idx === -1) {
- arr.push(ele);
- } else {
- ele = ele.split('__ESC_EXP__').join('');
- if (!!ele && opts.nodupes !== false) {
- arr.push(ele);
- } else {
- var num = Math.pow(2, exp);
- arr.push.apply(arr, repeatElement(ele, num));
- }
- }
- }
- return arr;
- }
- /**
- * Wrap a value with parens, brackets or braces,
- * based on the given character/separator.
- *
- * @param {String|Array} `val`
- * @param {String} `ch`
- * @return {String}
- */
- function wrap$2(val, ch) {
- if (ch === '|') {
- return '(' + val.join(ch) + ')';
- }
- if (ch === ',') {
- return '{' + val.join(ch) + '}';
- }
- if (ch === '-') {
- return '[' + val.join(ch) + ']';
- }
- if (ch === '\\') {
- return '\\{' + val + '\\}';
- }
- }
- /**
- * Handle empty braces: `{}`
- */
- function emptyBraces(str, arr, opts) {
- return braces(str.split('{}').join('\\{\\}'), arr, opts);
- }
- /**
- * Filter out empty-ish values
- */
- function filterEmpty(ele) {
- return !!ele && ele !== '\\';
- }
- /**
- * Handle patterns with whitespace
- */
- function splitWhitespace(str) {
- var segs = str.split(' ');
- var len = segs.length;
- var res = [];
- var i = 0;
- while (len--) {
- res.push.apply(res, braces(segs[i++]));
- }
- return res;
- }
- /**
- * Handle escaped braces: `\\{foo,bar}`
- */
- function escapeBraces(str, arr, opts) {
- if (!/\{[^{]+\{/.test(str)) {
- return arr.concat(str.split('\\').join(''));
- } else {
- str = str.split('\\{').join('__LT_BRACE__');
- str = str.split('\\}').join('__RT_BRACE__');
- return map$2(braces(str, arr, opts), function(ele) {
- ele = ele.split('__LT_BRACE__').join('{');
- return ele.split('__RT_BRACE__').join('}');
- });
- }
- }
- /**
- * Handle escaped dots: `{1\\.2}`
- */
- function escapeDots(str, arr, opts) {
- if (!/[^\\]\..+\\\./.test(str)) {
- return arr.concat(str.split('\\').join(''));
- } else {
- str = str.split('\\.').join('__ESC_DOT__');
- return map$2(braces(str, arr, opts), function(ele) {
- return ele.split('__ESC_DOT__').join('.');
- });
- }
- }
- /**
- * Handle escaped dots: `{1\\.2}`
- */
- function escapePaths(str, arr, opts) {
- str = str.split('\/.').join('__ESC_PATH__');
- return map$2(braces(str, arr, opts), function(ele) {
- return ele.split('__ESC_PATH__').join('\/.');
- });
- }
- /**
- * Handle escaped commas: `{a\\,b}`
- */
- function escapeCommas(str, arr, opts) {
- if (!/\w,/.test(str)) {
- return arr.concat(str.split('\\').join(''));
- } else {
- str = str.split('\\,').join('__ESC_COMMA__');
- return map$2(braces(str, arr, opts), function(ele) {
- return ele.split('__ESC_COMMA__').join(',');
- });
- }
- }
- /**
- * Regex for common patterns
- */
- function patternRegex() {
- return /\${|( (?=[{,}])|(?=[{,}]) )|{}|{,}|\\,(?=.*[{}])|\/\.(?=.*[{}])|\\\.(?={)|\\{|\\}/;
- }
- /**
- * Braces regex.
- */
- function braceRegex() {
- return /.*(\\?\{([^}]+)\})/;
- }
- /**
- * es6 delimiter regex.
- */
- function es6Regex() {
- return /\$\{([^}]+)\}/;
- }
- var braceRe;
- var patternRe;
- /**
- * Faster alternative to `String.replace()` when the
- * index of the token to be replaces can't be supplied
- */
- function splice(str, token, replacement) {
- var i = str.indexOf(token);
- return str.substr(0, i) + replacement
- + str.substr(i + token.length);
- }
- /**
- * Fast array map
- */
- function map$2(arr, fn) {
- if (arr == null) {
- return [];
- }
- var len = arr.length;
- var res = new Array(len);
- var i = -1;
- while (++i < len) {
- res[i] = fn(arr[i], i, arr);
- }
- return res;
- }
- /**
- * Fast array filter
- */
- function filter$1(arr, cb) {
- if (arr == null) return [];
- if (typeof cb !== 'function') {
- throw new TypeError('braces: filter expects a callback function.');
- }
- var len = arr.length;
- var res = arr.slice();
- var i = 0;
- while (len--) {
- if (!cb(arr[len], i++)) {
- res.splice(len, 1);
- }
- }
- return res;
- }
- /*!
- * is-posix-bracket <https://github.com/jonschlinkert/is-posix-bracket>
- *
- * Copyright (c) 2015-2016, Jon Schlinkert.
- * Licensed under the MIT License.
- */
- var isPosixBracket = function isPosixBracket(str) {
- return typeof str === 'string' && /\[([:.=+])(?:[^\[\]]|)+\1\]/.test(str);
- };
- /**
- * POSIX character classes
- */
- var POSIX = {
- alnum: 'a-zA-Z0-9',
- alpha: 'a-zA-Z',
- blank: ' \\t',
- cntrl: '\\x00-\\x1F\\x7F',
- digit: '0-9',
- graph: '\\x21-\\x7E',
- lower: 'a-z',
- print: '\\x20-\\x7E',
- punct: '-!"#$%&\'()\\*+,./:;<=>?@[\\]^_`{|}~',
- space: ' \\t\\r\\n\\v\\f',
- upper: 'A-Z',
- word: 'A-Za-z0-9_',
- xdigit: 'A-Fa-f0-9',
- };
- /**
- * Expose `brackets`
- */
- var expandBrackets = brackets;
- function brackets(str) {
- if (!isPosixBracket(str)) {
- return str;
- }
- var negated = false;
- if (str.indexOf('[^') !== -1) {
- negated = true;
- str = str.split('[^').join('[');
- }
- if (str.indexOf('[!') !== -1) {
- negated = true;
- str = str.split('[!').join('[');
- }
- var a = str.split('[');
- var b = str.split(']');
- var imbalanced = a.length !== b.length;
- var parts = str.split(/(?::\]\[:|\[?\[:|:\]\]?)/);
- var len = parts.length, i = 0;
- var end = '', beg = '';
- var res = [];
- // start at the end (innermost) first
- while (len--) {
- var inner = parts[i++];
- if (inner === '^[!' || inner === '[!') {
- inner = '';
- negated = true;
- }
- var prefix = negated ? '^' : '';
- var ch = POSIX[inner];
- if (ch) {
- res.push('[' + prefix + ch + ']');
- } else if (inner) {
- if (/^\[?\w-\w\]?$/.test(inner)) {
- if (i === parts.length) {
- res.push('[' + prefix + inner);
- } else if (i === 1) {
- res.push(prefix + inner + ']');
- } else {
- res.push(prefix + inner);
- }
- } else {
- if (i === 1) {
- beg += inner;
- } else if (i === parts.length) {
- end += inner;
- } else {
- res.push('[' + prefix + inner + ']');
- }
- }
- }
- }
- var result = res.join('|');
- var rlen = res.length || 1;
- if (rlen > 1) {
- result = '(?:' + result + ')';
- rlen = 1;
- }
- if (beg) {
- rlen++;
- if (beg.charAt(0) === '[') {
- if (imbalanced) {
- beg = '\\[' + beg.slice(1);
- } else {
- beg += ']';
- }
- }
- result = beg + result;
- }
- if (end) {
- rlen++;
- if (end.slice(-1) === ']') {
- if (imbalanced) {
- end = end.slice(0, end.length - 1) + '\\]';
- } else {
- end = '[' + end;
- }
- }
- result += end;
- }
- if (rlen > 1) {
- result = result.split('][').join(']|[');
- if (result.indexOf('|') !== -1 && !/\(\?/.test(result)) {
- result = '(?:' + result + ')';
- }
- }
- result = result.replace(/\[+=|=\]+/g, '\\b');
- return result;
- }
- brackets.makeRe = function(pattern) {
- try {
- return new RegExp(brackets(pattern));
- } catch (err) {}
- };
- brackets.isMatch = function(str, pattern) {
- try {
- return brackets.makeRe(pattern).test(str);
- } catch (err) {
- return false;
- }
- };
- brackets.match = function(arr, pattern) {
- var len = arr.length, i = 0;
- var res = arr.slice();
- var re = brackets.makeRe(pattern);
- while (i < len) {
- var ele = arr[i++];
- if (!re.test(ele)) {
- continue;
- }
- res.splice(i, 1);
- }
- return res;
- };
- /*!
- * is-extglob <https://github.com/jonschlinkert/is-extglob>
- *
- * Copyright (c) 2014-2015, Jon Schlinkert.
- * Licensed under the MIT License.
- */
- var isExtglob = function isExtglob(str) {
- return typeof str === 'string'
- && /[@?!+*]\(/.test(str);
- };
- /**
- * Module dependencies
- */
- var re, cache$2 = {};
- /**
- * Expose `extglob`
- */
- var extglob_1 = extglob;
- /**
- * Convert the given extglob `string` to a regex-compatible
- * string.
- *
- * ```js
- * var extglob = require('extglob');
- * extglob('!(a?(b))');
- * //=> '(?!a(?:b)?)[^/]*?'
- * ```
- *
- * @param {String} `str` The string to convert.
- * @param {Object} `options`
- * @option {Boolean} [options] `esc` If `false` special characters will not be escaped. Defaults to `true`.
- * @option {Boolean} [options] `regex` If `true` a regular expression is returned instead of a string.
- * @return {String}
- * @api public
- */
- function extglob(str, opts) {
- opts = opts || {};
- var o = {}, i = 0;
- // fix common character reversals
- // '*!(.js)' => '*.!(js)'
- str = str.replace(/!\(([^\w*()])/g, '$1!(');
- // support file extension negation
- str = str.replace(/([*\/])\.!\([*]\)/g, function (m, ch) {
- if (ch === '/') {
- return escape('\\/[^.]+');
- }
- return escape('[^.]+');
- });
- // create a unique key for caching by
- // combining the string and options
- var key = str
- + String(!!opts.regex)
- + String(!!opts.contains)
- + String(!!opts.escape);
- if (cache$2.hasOwnProperty(key)) {
- return cache$2[key];
- }
- if (!(re instanceof RegExp)) {
- re = regex();
- }
- opts.negate = false;
- var m;
- while (m = re.exec(str)) {
- var prefix = m[1];
- var inner = m[3];
- if (prefix === '!') {
- opts.negate = true;
- }
- var id = '__EXTGLOB_' + (i++) + '__';
- // use the prefix of the _last_ (outtermost) pattern
- o[id] = wrap$3(inner, prefix, opts.escape);
- str = str.split(m[0]).join(id);
- }
- var keys = Object.keys(o);
- var len = keys.length;
- // we have to loop again to allow us to convert
- // patterns in reverse order (starting with the
- // innermost/last pattern first)
- while (len--) {
- var prop = keys[len];
- str = str.split(prop).join(o[prop]);
- }
- var result = opts.regex
- ? toRegex(str, opts.contains, opts.negate)
- : str;
- result = result.split('.').join('\\.');
- // cache the result and return it
- return (cache$2[key] = result);
- }
- /**
- * Convert `string` to a regex string.
- *
- * @param {String} `str`
- * @param {String} `prefix` Character that determines how to wrap the string.
- * @param {Boolean} `esc` If `false` special characters will not be escaped. Defaults to `true`.
- * @return {String}
- */
- function wrap$3(inner, prefix, esc) {
- if (esc) inner = escape(inner);
- switch (prefix) {
- case '!':
- return '(?!' + inner + ')[^/]' + (esc ? '%%%~' : '*?');
- case '@':
- return '(?:' + inner + ')';
- case '+':
- return '(?:' + inner + ')+';
- case '*':
- return '(?:' + inner + ')' + (esc ? '%%' : '*')
- case '?':
- return '(?:' + inner + '|)';
- default:
- return inner;
- }
- }
- function escape(str) {
- str = str.split('*').join('[^/]%%%~');
- str = str.split('.').join('\\.');
- return str;
- }
- /**
- * extglob regex.
- */
- function regex() {
- return /(\\?[@?!+*$]\\?)(\(([^()]*?)\))/;
- }
- /**
- * Negation regex
- */
- function negate(str) {
- return '(?!^' + str + ').*$';
- }
- /**
- * Create the regex to do the matching. If
- * the leading character in the `pattern` is `!`
- * a negation regex is returned.
- *
- * @param {String} `pattern`
- * @param {Boolean} `contains` Allow loose matching.
- * @param {Boolean} `isNegated` True if the pattern is a negation pattern.
- */
- function toRegex(pattern, contains, isNegated) {
- var prefix = contains ? '^' : '';
- var after = contains ? '$' : '';
- pattern = ('(?:' + pattern + ')' + after);
- if (isNegated) {
- pattern = prefix + negate(pattern);
- }
- return new RegExp(prefix + pattern);
- }
- /*!
- * is-glob <https://github.com/jonschlinkert/is-glob>
- *
- * Copyright (c) 2014-2015, Jon Schlinkert.
- * Licensed under the MIT License.
- */
- var isGlob = function isGlob(str) {
- return typeof str === 'string'
- && (/[*!?{}(|)[\]]/.test(str)
- || isExtglob(str));
- };
- var isWin = process$3.platform === 'win32';
- var removeTrailingSeparator = function (str) {
- var i = str.length - 1;
- if (i < 2) {
- return str;
- }
- while (isSeparator(str, i)) {
- i--;
- }
- return str.substr(0, i + 1);
- };
- function isSeparator(str, i) {
- var char = str[i];
- return i > 0 && (char === '/' || (isWin && char === '\\'));
- }
- /*!
- * normalize-path <https://github.com/jonschlinkert/normalize-path>
- *
- * Copyright (c) 2014-2017, Jon Schlinkert.
- * Released under the MIT License.
- */
- var normalizePath = function normalizePath(str, stripTrailing) {
- if (typeof str !== 'string') {
- throw new TypeError('expected a string');
- }
- str = str.replace(/[\\\/]+/g, '/');
- if (stripTrailing !== false) {
- str = removeTrailingSeparator(str);
- }
- return str;
- };
- /*!
- * is-extendable <https://github.com/jonschlinkert/is-extendable>
- *
- * Copyright (c) 2015, Jon Schlinkert.
- * Licensed under the MIT License.
- */
- var isExtendable = function isExtendable(val) {
- return typeof val !== 'undefined' && val !== null
- && (typeof val === 'object' || typeof val === 'function');
- };
- /*!
- * for-in <https://github.com/jonschlinkert/for-in>
- *
- * Copyright (c) 2014-2017, Jon Schlinkert.
- * Released under the MIT License.
- */
- var forIn = function forIn(obj, fn, thisArg) {
- for (var key in obj) {
- if (fn.call(thisArg, obj[key], key, obj) === false) {
- break;
- }
- }
- };
- var hasOwn = Object.prototype.hasOwnProperty;
- var forOwn = function forOwn(obj, fn, thisArg) {
- forIn(obj, function(val, key) {
- if (hasOwn.call(obj, key)) {
- return fn.call(thisArg, obj[key], key, obj);
- }
- });
- };
- var object_omit = function omit(obj, keys) {
- if (!isExtendable(obj)) return {};
- keys = [].concat.apply([], [].slice.call(arguments, 1));
- var last = keys[keys.length - 1];
- var res = {}, fn;
- if (typeof last === 'function') {
- fn = keys.pop();
- }
- var isFunction = typeof fn === 'function';
- if (!keys.length && !isFunction) {
- return obj;
- }
- forOwn(obj, function(value, key) {
- if (keys.indexOf(key) === -1) {
- if (!isFunction) {
- res[key] = value;
- } else if (fn(value, key, obj)) {
- res[key] = value;
- }
- }
- });
- return res;
- };
- var globParent = function globParent(str) {
- str += 'a'; // preserves full path in case of trailing path separator
- do {str = path$2.dirname(str);} while (isGlob(str));
- return str;
- };
- var globBase = function globBase(pattern) {
- if (typeof pattern !== 'string') {
- throw new TypeError('glob-base expects a string.');
- }
- var res = {};
- res.base = globParent(pattern);
- res.isGlob = isGlob(pattern);
- if (res.base !== '.') {
- res.glob = pattern.substr(res.base.length);
- if (res.glob.charAt(0) === '/') {
- res.glob = res.glob.substr(1);
- }
- } else {
- res.glob = pattern;
- }
- if (!res.isGlob) {
- res.base = dirname$1(pattern);
- res.glob = res.base !== '.'
- ? pattern.substr(res.base.length)
- : pattern;
- }
- if (res.glob.substr(0, 2) === './') {
- res.glob = res.glob.substr(2);
- }
- if (res.glob.charAt(0) === '/') {
- res.glob = res.glob.substr(1);
- }
- return res;
- };
- function dirname$1(glob) {
- if (glob.slice(-1) === '/') return glob;
- return path$2.dirname(glob);
- }
- /*!
- * is-dotfile <https://github.com/jonschlinkert/is-dotfile>
- *
- * Copyright (c) 2015-2017, Jon Schlinkert.
- * Released under the MIT License.
- */
- var isDotfile = function(str) {
- if (str.charCodeAt(0) === 46 /* . */ && str.indexOf('/', 1) === -1) {
- return true;
- }
- var slash = str.lastIndexOf('/');
- return slash !== -1 ? str.charCodeAt(slash + 1) === 46 /* . */ : false;
- };
- var parseGlob = createCommonjsModule(function (module) {
- /**
- * Expose `cache`
- */
- var cache = module.exports.cache = {};
- /**
- * Parse a glob pattern into tokens.
- *
- * When no paths or '**' are in the glob, we use a
- * different strategy for parsing the filename, since
- * file names can contain braces and other difficult
- * patterns. such as:
- *
- * - `*.{a,b}`
- * - `(**|*.js)`
- */
- module.exports = function parseGlob(glob) {
- if (cache.hasOwnProperty(glob)) {
- return cache[glob];
- }
- var tok = {};
- tok.orig = glob;
- tok.is = {};
- // unescape dots and slashes in braces/brackets
- glob = escape(glob);
- var parsed = globBase(glob);
- tok.is.glob = parsed.isGlob;
- tok.glob = parsed.glob;
- tok.base = parsed.base;
- var segs = /([^\/]*)$/.exec(glob);
- tok.path = {};
- tok.path.dirname = '';
- tok.path.basename = segs[1] || '';
- tok.path.dirname = glob.split(tok.path.basename).join('') || '';
- var basename = (tok.path.basename || '').split('.') || '';
- tok.path.filename = basename[0] || '';
- tok.path.extname = basename.slice(1).join('.') || '';
- tok.path.ext = '';
- if (isGlob(tok.path.dirname) && !tok.path.basename) {
- if (!/\/$/.test(tok.glob)) {
- tok.path.basename = tok.glob;
- }
- tok.path.dirname = tok.base;
- }
- if (glob.indexOf('/') === -1 && !tok.is.globstar) {
- tok.path.dirname = '';
- tok.path.basename = tok.orig;
- }
- var dot = tok.path.basename.indexOf('.');
- if (dot !== -1) {
- tok.path.filename = tok.path.basename.slice(0, dot);
- tok.path.extname = tok.path.basename.slice(dot);
- }
- if (tok.path.extname.charAt(0) === '.') {
- var exts = tok.path.extname.split('.');
- tok.path.ext = exts[exts.length - 1];
- }
- // unescape dots and slashes in braces/brackets
- tok.glob = unescape(tok.glob);
- tok.path.dirname = unescape(tok.path.dirname);
- tok.path.basename = unescape(tok.path.basename);
- tok.path.filename = unescape(tok.path.filename);
- tok.path.extname = unescape(tok.path.extname);
- // Booleans
- var is = (glob && tok.is.glob);
- tok.is.negated = glob && glob.charAt(0) === '!';
- tok.is.extglob = glob && isExtglob(glob);
- tok.is.braces = has(is, glob, '{');
- tok.is.brackets = has(is, glob, '[:');
- tok.is.globstar = has(is, glob, '**');
- tok.is.dotfile = isDotfile(tok.path.basename) || isDotfile(tok.path.filename);
- tok.is.dotdir = dotdir(tok.path.dirname);
- return (cache[glob] = tok);
- };
- /**
- * Returns true if the glob matches dot-directories.
- *
- * @param {Object} `tok` The tokens object
- * @param {Object} `path` The path object
- * @return {Object}
- */
- function dotdir(base) {
- if (base.indexOf('/.') !== -1) {
- return true;
- }
- if (base.charAt(0) === '.' && base.charAt(1) !== '/') {
- return true;
- }
- return false;
- }
- /**
- * Returns true if the pattern has the given `ch`aracter(s)
- *
- * @param {Object} `glob` The glob pattern.
- * @param {Object} `ch` The character to test for
- * @return {Object}
- */
- function has(is, glob, ch) {
- return is && glob.indexOf(ch) !== -1;
- }
- /**
- * Escape/unescape utils
- */
- function escape(str) {
- var re = /\{([^{}]*?)}|\(([^()]*?)\)|\[([^\[\]]*?)\]/g;
- return str.replace(re, function (outter, braces, parens, brackets) {
- var inner = braces || parens || brackets;
- if (!inner) { return outter; }
- return outter.split(inner).join(esc(inner));
- });
- }
- function esc(str) {
- str = str.split('/').join('__SLASH__');
- str = str.split('.').join('__DOT__');
- return str;
- }
- function unescape(str) {
- str = str.split('__SLASH__').join('/');
- str = str.split('__DOT__').join('.');
- return str;
- }
- });
- var parseGlob_1 = parseGlob.cache;
- /*!
- * is-primitive <https://github.com/jonschlinkert/is-primitive>
- *
- * Copyright (c) 2014-2015, Jon Schlinkert.
- * Licensed under the MIT License.
- */
- // see http://jsperf.com/testing-value-is-primitive/7
- var isPrimitive = function isPrimitive(value) {
- return value == null || (typeof value !== 'function' && typeof value !== 'object');
- };
- var isEqualShallow = function isEqual(a, b) {
- if (!a && !b) { return true; }
- if (!a && b || a && !b) { return false; }
- var numKeysA = 0, numKeysB = 0, key;
- for (key in b) {
- numKeysB++;
- if (!isPrimitive(b[key]) || !a.hasOwnProperty(key) || (a[key] !== b[key])) {
- return false;
- }
- }
- for (key in a) {
- numKeysA++;
- }
- return numKeysA === numKeysB;
- };
- var basic = {};
- var cache$3 = {};
- /**
- * Expose `regexCache`
- */
- var regexCache_1 = regexCache;
- /**
- * Memoize the results of a call to the new RegExp constructor.
- *
- * @param {Function} fn [description]
- * @param {String} str [description]
- * @param {Options} options [description]
- * @param {Boolean} nocompare [description]
- * @return {RegExp}
- */
- function regexCache(fn, str, opts) {
- var key = '_default_', regex, cached;
- if (!str && !opts) {
- if (typeof fn !== 'function') {
- return fn;
- }
- return basic[key] || (basic[key] = fn(str));
- }
- var isString = typeof str === 'string';
- if (isString) {
- if (!opts) {
- return basic[str] || (basic[str] = fn(str));
- }
- key = str;
- } else {
- opts = str;
- }
- cached = cache$3[key];
- if (cached && isEqualShallow(cached.opts, opts)) {
- return cached.regex;
- }
- memo(key, opts, (regex = fn(str, opts)));
- return regex;
- }
- function memo(key, opts, regex) {
- cache$3[key] = {regex: regex, opts: opts};
- }
- /**
- * Expose `cache`
- */
- var cache_1 = cache$3;
- var basic_1 = basic;
- regexCache_1.cache = cache_1;
- regexCache_1.basic = basic_1;
- var utils_1 = createCommonjsModule(function (module) {
- var win32 = process$3 && process$3.platform === 'win32';
- var utils = module.exports;
- /**
- * Module dependencies
- */
- utils.diff = arrDiff;
- utils.unique = arrayUnique;
- utils.braces = braces_1;
- utils.brackets = expandBrackets;
- utils.extglob = extglob_1;
- utils.isExtglob = isExtglob;
- utils.isGlob = isGlob;
- utils.typeOf = kindOf;
- utils.normalize = normalizePath;
- utils.omit = object_omit;
- utils.parseGlob = parseGlob;
- utils.cache = regexCache_1;
- /**
- * Get the filename of a filepath
- *
- * @param {String} `string`
- * @return {String}
- */
- utils.filename = function filename(fp) {
- var seg = fp.match(filenameRegex());
- return seg && seg[0];
- };
- /**
- * Returns a function that returns true if the given
- * pattern is the same as a given `filepath`
- *
- * @param {String} `pattern`
- * @return {Function}
- */
- utils.isPath = function isPath(pattern, opts) {
- opts = opts || {};
- return function(fp) {
- var unixified = utils.unixify(fp, opts);
- if(opts.nocase){
- return pattern.toLowerCase() === unixified.toLowerCase();
- }
- return pattern === unixified;
- };
- };
- /**
- * Returns a function that returns true if the given
- * pattern contains a `filepath`
- *
- * @param {String} `pattern`
- * @return {Function}
- */
- utils.hasPath = function hasPath(pattern, opts) {
- return function(fp) {
- return utils.unixify(pattern, opts).indexOf(fp) !== -1;
- };
- };
- /**
- * Returns a function that returns true if the given
- * pattern matches or contains a `filepath`
- *
- * @param {String} `pattern`
- * @return {Function}
- */
- utils.matchPath = function matchPath(pattern, opts) {
- var fn = (opts && opts.contains)
- ? utils.hasPath(pattern, opts)
- : utils.isPath(pattern, opts);
- return fn;
- };
- /**
- * Returns a function that returns true if the given
- * regex matches the `filename` of a file path.
- *
- * @param {RegExp} `re`
- * @return {Boolean}
- */
- utils.hasFilename = function hasFilename(re) {
- return function(fp) {
- var name = utils.filename(fp);
- return name && re.test(name);
- };
- };
- /**
- * Coerce `val` to an array
- *
- * @param {*} val
- * @return {Array}
- */
- utils.arrayify = function arrayify(val) {
- return !Array.isArray(val)
- ? [val]
- : val;
- };
- /**
- * Normalize all slashes in a file path or glob pattern to
- * forward slashes.
- */
- utils.unixify = function unixify(fp, opts) {
- if (opts && opts.unixify === false) return fp;
- if (opts && opts.unixify === true || win32 || path$2.sep === '\\') {
- return utils.normalize(fp, false);
- }
- if (opts && opts.unescape === true) {
- return fp ? fp.toString().replace(/\\(\w)/g, '$1') : '';
- }
- return fp;
- };
- /**
- * Escape/unescape utils
- */
- utils.escapePath = function escapePath(fp) {
- return fp.replace(/[\\.]/g, '\\$&');
- };
- utils.unescapeGlob = function unescapeGlob(fp) {
- return fp.replace(/[\\"']/g, '');
- };
- utils.escapeRe = function escapeRe(str) {
- return str.replace(/[-[\\$*+?.#^\s{}(|)\]]/g, '\\$&');
- };
- /**
- * Expose `utils`
- */
- module.exports = utils;
- });
- var chars = {}, unesc, temp;
- function reverse(object, prepender) {
- return Object.keys(object).reduce(function(reversed, key) {
- var newKey = prepender ? prepender + key : key; // Optionally prepend a string to key.
- reversed[object[key]] = newKey; // Swap key and value.
- return reversed; // Return the result.
- }, {});
- }
- /**
- * Regex for common characters
- */
- chars.escapeRegex = {
- '?': /\?/g,
- '@': /\@/g,
- '!': /\!/g,
- '+': /\+/g,
- '*': /\*/g,
- '(': /\(/g,
- ')': /\)/g,
- '[': /\[/g,
- ']': /\]/g
- };
- /**
- * Escape characters
- */
- chars.ESC = {
- '?': '__UNESC_QMRK__',
- '@': '__UNESC_AMPE__',
- '!': '__UNESC_EXCL__',
- '+': '__UNESC_PLUS__',
- '*': '__UNESC_STAR__',
- ',': '__UNESC_COMMA__',
- '(': '__UNESC_LTPAREN__',
- ')': '__UNESC_RTPAREN__',
- '[': '__UNESC_LTBRACK__',
- ']': '__UNESC_RTBRACK__'
- };
- /**
- * Unescape characters
- */
- chars.UNESC = unesc || (unesc = reverse(chars.ESC, '\\'));
- chars.ESC_TEMP = {
- '?': '__TEMP_QMRK__',
- '@': '__TEMP_AMPE__',
- '!': '__TEMP_EXCL__',
- '*': '__TEMP_STAR__',
- '+': '__TEMP_PLUS__',
- ',': '__TEMP_COMMA__',
- '(': '__TEMP_LTPAREN__',
- ')': '__TEMP_RTPAREN__',
- '[': '__TEMP_LTBRACK__',
- ']': '__TEMP_RTBRACK__'
- };
- chars.TEMP = temp || (temp = reverse(chars.ESC_TEMP));
- var chars_1 = chars;
- var glob = createCommonjsModule(function (module) {
- /**
- * Expose `Glob`
- */
- var Glob = module.exports = function Glob(pattern, options) {
- if (!(this instanceof Glob)) {
- return new Glob(pattern, options);
- }
- this.options = options || {};
- this.pattern = pattern;
- this.history = [];
- this.tokens = {};
- this.init(pattern);
- };
- /**
- * Initialize defaults
- */
- Glob.prototype.init = function(pattern) {
- this.orig = pattern;
- this.negated = this.isNegated();
- this.options.track = this.options.track || false;
- this.options.makeRe = true;
- };
- /**
- * Push a change into `glob.history`. Useful
- * for debugging.
- */
- Glob.prototype.track = function(msg) {
- if (this.options.track) {
- this.history.push({msg: msg, pattern: this.pattern});
- }
- };
- /**
- * Return true if `glob.pattern` was negated
- * with `!`, also remove the `!` from the pattern.
- *
- * @return {Boolean}
- */
- Glob.prototype.isNegated = function() {
- if (this.pattern.charCodeAt(0) === 33 /* '!' */) {
- this.pattern = this.pattern.slice(1);
- return true;
- }
- return false;
- };
- /**
- * Expand braces in the given glob pattern.
- *
- * We only need to use the [braces] lib when
- * patterns are nested.
- */
- Glob.prototype.braces = function() {
- if (this.options.nobraces !== true && this.options.nobrace !== true) {
- // naive/fast check for imbalanced characters
- var a = this.pattern.match(/[\{\(\[]/g);
- var b = this.pattern.match(/[\}\)\]]/g);
- // if imbalanced, don't optimize the pattern
- if (a && b && (a.length !== b.length)) {
- this.options.makeRe = false;
- }
- // expand brace patterns and join the resulting array
- var expanded = utils_1.braces(this.pattern, this.options);
- this.pattern = expanded.join('|');
- }
- };
- /**
- * Expand bracket expressions in `glob.pattern`
- */
- Glob.prototype.brackets = function() {
- if (this.options.nobrackets !== true) {
- this.pattern = utils_1.brackets(this.pattern);
- }
- };
- /**
- * Expand bracket expressions in `glob.pattern`
- */
- Glob.prototype.extglob = function() {
- if (this.options.noextglob === true) return;
- if (utils_1.isExtglob(this.pattern)) {
- this.pattern = utils_1.extglob(this.pattern, {escape: true});
- }
- };
- /**
- * Parse the given pattern
- */
- Glob.prototype.parse = function(pattern) {
- this.tokens = utils_1.parseGlob(pattern || this.pattern, true);
- return this.tokens;
- };
- /**
- * Replace `a` with `b`. Also tracks the change before and
- * after each replacement. This is disabled by default, but
- * can be enabled by setting `options.track` to true.
- *
- * Also, when the pattern is a string, `.split()` is used,
- * because it's much faster than replace.
- *
- * @param {RegExp|String} `a`
- * @param {String} `b`
- * @param {Boolean} `escape` When `true`, escapes `*` and `?` in the replacement.
- * @return {String}
- */
- Glob.prototype._replace = function(a, b, escape) {
- this.track('before (find): "' + a + '" (replace with): "' + b + '"');
- if (escape) b = esc(b);
- if (a && b && typeof a === 'string') {
- this.pattern = this.pattern.split(a).join(b);
- } else {
- this.pattern = this.pattern.replace(a, b);
- }
- this.track('after');
- };
- /**
- * Escape special characters in the given string.
- *
- * @param {String} `str` Glob pattern
- * @return {String}
- */
- Glob.prototype.escape = function(str) {
- this.track('before escape: ');
- var re = /["\\](['"]?[^"'\\]['"]?)/g;
- this.pattern = str.replace(re, function($0, $1) {
- var o = chars_1.ESC;
- var ch = o && o[$1];
- if (ch) {
- return ch;
- }
- if (/[a-z]/i.test($0)) {
- return $0.split('\\').join('');
- }
- return $0;
- });
- this.track('after escape: ');
- };
- /**
- * Unescape special characters in the given string.
- *
- * @param {String} `str`
- * @return {String}
- */
- Glob.prototype.unescape = function(str) {
- var re = /__([A-Z]+)_([A-Z]+)__/g;
- this.pattern = str.replace(re, function($0, $1) {
- return chars_1[$1][$0];
- });
- this.pattern = unesc(this.pattern);
- };
- /**
- * Escape/unescape utils
- */
- function esc(str) {
- str = str.split('?').join('%~');
- str = str.split('*').join('%%');
- return str;
- }
- function unesc(str) {
- str = str.split('%~').join('?');
- str = str.split('%%').join('*');
- return str;
- }
- });
- /**
- * Expose `expand`
- */
- var expand_1 = expand;
- /**
- * Expand a glob pattern to resolve braces and
- * similar patterns before converting to regex.
- *
- * @param {String|Array} `pattern`
- * @param {Array} `files`
- * @param {Options} `opts`
- * @return {Array}
- */
- function expand(pattern, options) {
- if (typeof pattern !== 'string') {
- throw new TypeError('micromatch.expand(): argument should be a string.');
- }
- var glob$$1 = new glob(pattern, options || {});
- var opts = glob$$1.options;
- if (!utils_1.isGlob(pattern)) {
- glob$$1.pattern = glob$$1.pattern.replace(/([\/.])/g, '\\$1');
- return glob$$1;
- }
- glob$$1.pattern = glob$$1.pattern.replace(/(\+)(?!\()/g, '\\$1');
- glob$$1.pattern = glob$$1.pattern.split('$').join('\\$');
- if (typeof opts.braces !== 'boolean' && typeof opts.nobraces !== 'boolean') {
- opts.braces = true;
- }
- if (glob$$1.pattern === '.*') {
- return {
- pattern: '\\.' + star,
- tokens: tok,
- options: opts
- };
- }
- if (glob$$1.pattern === '*') {
- return {
- pattern: oneStar(opts.dot),
- tokens: tok,
- options: opts
- };
- }
- // parse the glob pattern into tokens
- glob$$1.parse();
- var tok = glob$$1.tokens;
- tok.is.negated = opts.negated;
- // dotfile handling
- if ((opts.dotfiles === true || tok.is.dotfile) && opts.dot !== false) {
- opts.dotfiles = true;
- opts.dot = true;
- }
- if ((opts.dotdirs === true || tok.is.dotdir) && opts.dot !== false) {
- opts.dotdirs = true;
- opts.dot = true;
- }
- // check for braces with a dotfile pattern
- if (/[{,]\./.test(glob$$1.pattern)) {
- opts.makeRe = false;
- opts.dot = true;
- }
- if (opts.nonegate !== true) {
- opts.negated = glob$$1.negated;
- }
- // if the leading character is a dot or a slash, escape it
- if (glob$$1.pattern.charAt(0) === '.' && glob$$1.pattern.charAt(1) !== '/') {
- glob$$1.pattern = '\\' + glob$$1.pattern;
- }
- /**
- * Extended globs
- */
- // expand braces, e.g `{1..5}`
- glob$$1.track('before braces');
- if (tok.is.braces) {
- glob$$1.braces();
- }
- glob$$1.track('after braces');
- // expand extglobs, e.g `foo/!(a|b)`
- glob$$1.track('before extglob');
- if (tok.is.extglob) {
- glob$$1.extglob();
- }
- glob$$1.track('after extglob');
- // expand brackets, e.g `[[:alpha:]]`
- glob$$1.track('before brackets');
- if (tok.is.brackets) {
- glob$$1.brackets();
- }
- glob$$1.track('after brackets');
- // special patterns
- glob$$1._replace('[!', '[^');
- glob$$1._replace('(?', '(%~');
- glob$$1._replace(/\[\]/, '\\[\\]');
- glob$$1._replace('/[', '/' + (opts.dot ? dotfiles : nodot) + '[', true);
- glob$$1._replace('/?', '/' + (opts.dot ? dotfiles : nodot) + '[^/]', true);
- glob$$1._replace('/.', '/(?=.)\\.', true);
- // windows drives
- glob$$1._replace(/^(\w):([\\\/]+?)/gi, '(?=.)$1:$2', true);
- // negate slashes in exclusion ranges
- if (glob$$1.pattern.indexOf('[^') !== -1) {
- glob$$1.pattern = negateSlash(glob$$1.pattern);
- }
- if (opts.globstar !== false && glob$$1.pattern === '**') {
- glob$$1.pattern = globstar(opts.dot);
- } else {
- glob$$1.pattern = balance(glob$$1.pattern, '[', ']');
- glob$$1.escape(glob$$1.pattern);
- // if the pattern has `**`
- if (tok.is.globstar) {
- glob$$1.pattern = collapse(glob$$1.pattern, '/**');
- glob$$1.pattern = collapse(glob$$1.pattern, '**/');
- glob$$1._replace('/**/', '(?:/' + globstar(opts.dot) + '/|/)', true);
- glob$$1._replace(/\*{2,}/g, '**');
- // 'foo/*'
- glob$$1._replace(/(\w+)\*(?!\/)/g, '$1[^/]*?', true);
- glob$$1._replace(/\*\*\/\*(\w)/g, globstar(opts.dot) + '\\/' + (opts.dot ? dotfiles : nodot) + '[^/]*?$1', true);
- if (opts.dot !== true) {
- glob$$1._replace(/\*\*\/(.)/g, '(?:**\\/|)$1');
- }
- // 'foo/**' or '{**,*}', but not 'foo**'
- if (tok.path.dirname !== '' || /,\*\*|\*\*,/.test(glob$$1.orig)) {
- glob$$1._replace('**', globstar(opts.dot), true);
- }
- }
- // ends with /*
- glob$$1._replace(/\/\*$/, '\\/' + oneStar(opts.dot), true);
- // ends with *, no slashes
- glob$$1._replace(/(?!\/)\*$/, star, true);
- // has 'n*.' (partial wildcard w/ file extension)
- glob$$1._replace(/([^\/]+)\*/, '$1' + oneStar(true), true);
- // has '*'
- glob$$1._replace('*', oneStar(opts.dot), true);
- glob$$1._replace('?.', '?\\.', true);
- glob$$1._replace('?:', '?:', true);
- glob$$1._replace(/\?+/g, function(match) {
- var len = match.length;
- if (len === 1) {
- return qmark;
- }
- return qmark + '{' + len + '}';
- });
- // escape '.abc' => '\\.abc'
- glob$$1._replace(/\.([*\w]+)/g, '\\.$1');
- // fix '[^\\\\/]'
- glob$$1._replace(/\[\^[\\\/]+\]/g, qmark);
- // '///' => '\/'
- glob$$1._replace(/\/+/g, '\\/');
- // '\\\\\\' => '\\'
- glob$$1._replace(/\\{2,}/g, '\\');
- }
- // unescape previously escaped patterns
- glob$$1.unescape(glob$$1.pattern);
- glob$$1._replace('__UNESC_STAR__', '*');
- // escape dots that follow qmarks
- glob$$1._replace('?.', '?\\.');
- // remove unnecessary slashes in character classes
- glob$$1._replace('[^\\/]', qmark);
- if (glob$$1.pattern.length > 1) {
- if (/^[\[?*]/.test(glob$$1.pattern)) {
- // only prepend the string if we don't want to match dotfiles
- glob$$1.pattern = (opts.dot ? dotfiles : nodot) + glob$$1.pattern;
- }
- }
- return glob$$1;
- }
- /**
- * Collapse repeated character sequences.
- *
- * ```js
- * collapse('a/../../../b', '../');
- * //=> 'a/../b'
- * ```
- *
- * @param {String} `str`
- * @param {String} `ch` Character sequence to collapse
- * @return {String}
- */
- function collapse(str, ch) {
- var res = str.split(ch);
- var isFirst = res[0] === '';
- var isLast = res[res.length - 1] === '';
- res = res.filter(Boolean);
- if (isFirst) res.unshift('');
- if (isLast) res.push('');
- return res.join(ch);
- }
- /**
- * Negate slashes in exclusion ranges, per glob spec:
- *
- * ```js
- * negateSlash('[^foo]');
- * //=> '[^\\/foo]'
- * ```
- *
- * @param {String} `str` glob pattern
- * @return {String}
- */
- function negateSlash(str) {
- return str.replace(/\[\^([^\]]*?)\]/g, function(match, inner) {
- if (inner.indexOf('/') === -1) {
- inner = '\\/' + inner;
- }
- return '[^' + inner + ']';
- });
- }
- /**
- * Escape imbalanced braces/bracket. This is a very
- * basic, naive implementation that only does enough
- * to serve the purpose.
- */
- function balance(str, a, b) {
- var aarr = str.split(a);
- var alen = aarr.join('').length;
- var blen = str.split(b).join('').length;
- if (alen !== blen) {
- str = aarr.join('\\' + a);
- return str.split(b).join('\\' + b);
- }
- return str;
- }
- /**
- * Special patterns to be converted to regex.
- * Heuristics are used to simplify patterns
- * and speed up processing.
- */
- /* eslint no-multi-spaces: 0 */
- var qmark = '[^/]';
- var star = qmark + '*?';
- var nodot = '(?!\\.)(?=.)';
- var dotfileGlob = '(?:\\/|^)\\.{1,2}($|\\/)';
- var dotfiles = '(?!' + dotfileGlob + ')(?=.)';
- var twoStarDot = '(?:(?!' + dotfileGlob + ').)*?';
- /**
- * Create a regex for `*`.
- *
- * If `dot` is true, or the pattern does not begin with
- * a leading star, then return the simpler regex.
- */
- function oneStar(dotfile) {
- return dotfile ? '(?!' + dotfileGlob + ')(?=.)' + star : (nodot + star);
- }
- function globstar(dotfile) {
- if (dotfile) { return twoStarDot; }
- return '(?:(?!(?:\\/|^)\\.).)*?';
- }
- /**
- * The main function. Pass an array of filepaths,
- * and a string or array of glob patterns
- *
- * @param {Array|String} `files`
- * @param {Array|String} `patterns`
- * @param {Object} `opts`
- * @return {Array} Array of matches
- */
- function micromatch(files, patterns, opts) {
- if (!files || !patterns) return [];
- opts = opts || {};
- if (typeof opts.cache === 'undefined') {
- opts.cache = true;
- }
- if (!Array.isArray(patterns)) {
- return match(files, patterns, opts);
- }
- var len = patterns.length, i = 0;
- var omit = [], keep = [];
- while (len--) {
- var glob = patterns[i++];
- if (typeof glob === 'string' && glob.charCodeAt(0) === 33 /* ! */) {
- omit.push.apply(omit, match(files, glob.slice(1), opts));
- } else {
- keep.push.apply(keep, match(files, glob, opts));
- }
- }
- return utils_1.diff(keep, omit);
- }
- /**
- * Return an array of files that match the given glob pattern.
- *
- * This function is called by the main `micromatch` function If you only
- * need to pass a single pattern you might get very minor speed improvements
- * using this function.
- *
- * @param {Array} `files`
- * @param {String} `pattern`
- * @param {Object} `options`
- * @return {Array}
- */
- function match(files, pattern, opts) {
- if (utils_1.typeOf(files) !== 'string' && !Array.isArray(files)) {
- throw new Error(msg('match', 'files', 'a string or array'));
- }
- files = utils_1.arrayify(files);
- opts = opts || {};
- var negate = opts.negate || false;
- var orig = pattern;
- if (typeof pattern === 'string') {
- negate = pattern.charAt(0) === '!';
- if (negate) {
- pattern = pattern.slice(1);
- }
- // we need to remove the character regardless,
- // so the above logic is still needed
- if (opts.nonegate === true) {
- negate = false;
- }
- }
- var _isMatch = matcher(pattern, opts);
- var len = files.length, i = 0;
- var res = [];
- while (i < len) {
- var file = files[i++];
- var fp = utils_1.unixify(file, opts);
- if (!_isMatch(fp)) { continue; }
- res.push(fp);
- }
- if (res.length === 0) {
- if (opts.failglob === true) {
- throw new Error('micromatch.match() found no matches for: "' + orig + '".');
- }
- if (opts.nonull || opts.nullglob) {
- res.push(utils_1.unescapeGlob(orig));
- }
- }
- // if `negate` was defined, diff negated files
- if (negate) { res = utils_1.diff(files, res); }
- // if `ignore` was defined, diff ignored filed
- if (opts.ignore && opts.ignore.length) {
- pattern = opts.ignore;
- opts = utils_1.omit(opts, ['ignore']);
- res = utils_1.diff(res, micromatch(res, pattern, opts));
- }
- if (opts.nodupes) {
- return utils_1.unique(res);
- }
- return res;
- }
- /**
- * Returns a function that takes a glob pattern or array of glob patterns
- * to be used with `Array#filter()`. (Internally this function generates
- * the matching function using the [matcher] method).
- *
- * ```js
- * var fn = mm.filter('[a-c]');
- * ['a', 'b', 'c', 'd', 'e'].filter(fn);
- * //=> ['a', 'b', 'c']
- * ```
- * @param {String|Array} `patterns` Can be a glob or array of globs.
- * @param {Options} `opts` Options to pass to the [matcher] method.
- * @return {Function} Filter function to be passed to `Array#filter()`.
- */
- function filter$2(patterns, opts) {
- if (!Array.isArray(patterns) && typeof patterns !== 'string') {
- throw new TypeError(msg('filter', 'patterns', 'a string or array'));
- }
- patterns = utils_1.arrayify(patterns);
- var len = patterns.length, i = 0;
- var patternMatchers = Array(len);
- while (i < len) {
- patternMatchers[i] = matcher(patterns[i++], opts);
- }
- return function(fp) {
- if (fp == null) return [];
- var len = patternMatchers.length, i = 0;
- var res = true;
- fp = utils_1.unixify(fp, opts);
- while (i < len) {
- var fn = patternMatchers[i++];
- if (!fn(fp)) {
- res = false;
- break;
- }
- }
- return res;
- };
- }
- /**
- * Returns true if the filepath contains the given
- * pattern. Can also return a function for matching.
- *
- * ```js
- * isMatch('foo.md', '*.md', {});
- * //=> true
- *
- * isMatch('*.md', {})('foo.md')
- * //=> true
- * ```
- * @param {String} `fp`
- * @param {String} `pattern`
- * @param {Object} `opts`
- * @return {Boolean}
- */
- function isMatch(fp, pattern, opts) {
- if (typeof fp !== 'string') {
- throw new TypeError(msg('isMatch', 'filepath', 'a string'));
- }
- fp = utils_1.unixify(fp, opts);
- if (utils_1.typeOf(pattern) === 'object') {
- return matcher(fp, pattern);
- }
- return matcher(pattern, opts)(fp);
- }
- /**
- * Returns true if the filepath matches the
- * given pattern.
- */
- function contains(fp, pattern, opts) {
- if (typeof fp !== 'string') {
- throw new TypeError(msg('contains', 'pattern', 'a string'));
- }
- opts = opts || {};
- opts.contains = (pattern !== '');
- fp = utils_1.unixify(fp, opts);
- if (opts.contains && !utils_1.isGlob(pattern)) {
- return fp.indexOf(pattern) !== -1;
- }
- return matcher(pattern, opts)(fp);
- }
- /**
- * Returns true if a file path matches any of the
- * given patterns.
- *
- * @param {String} `fp` The filepath to test.
- * @param {String|Array} `patterns` Glob patterns to use.
- * @param {Object} `opts` Options to pass to the `matcher()` function.
- * @return {String}
- */
- function any(fp, patterns, opts) {
- if (!Array.isArray(patterns) && typeof patterns !== 'string') {
- throw new TypeError(msg('any', 'patterns', 'a string or array'));
- }
- patterns = utils_1.arrayify(patterns);
- var len = patterns.length;
- fp = utils_1.unixify(fp, opts);
- while (len--) {
- var isMatch = matcher(patterns[len], opts);
- if (isMatch(fp)) {
- return true;
- }
- }
- return false;
- }
- /**
- * Filter the keys of an object with the given `glob` pattern
- * and `options`
- *
- * @param {Object} `object`
- * @param {Pattern} `object`
- * @return {Array}
- */
- function matchKeys(obj, glob, options) {
- if (utils_1.typeOf(obj) !== 'object') {
- throw new TypeError(msg('matchKeys', 'first argument', 'an object'));
- }
- var fn = matcher(glob, options);
- var res = {};
- for (var key in obj) {
- if (obj.hasOwnProperty(key) && fn(key)) {
- res[key] = obj[key];
- }
- }
- return res;
- }
- /**
- * Return a function for matching based on the
- * given `pattern` and `options`.
- *
- * @param {String} `pattern`
- * @param {Object} `options`
- * @return {Function}
- */
- function matcher(pattern, opts) {
- // pattern is a function
- if (typeof pattern === 'function') {
- return pattern;
- }
- // pattern is a regex
- if (pattern instanceof RegExp) {
- return function(fp) {
- return pattern.test(fp);
- };
- }
- if (typeof pattern !== 'string') {
- throw new TypeError(msg('matcher', 'pattern', 'a string, regex, or function'));
- }
- // strings, all the way down...
- pattern = utils_1.unixify(pattern, opts);
- // pattern is a non-glob string
- if (!utils_1.isGlob(pattern)) {
- return utils_1.matchPath(pattern, opts);
- }
- // pattern is a glob string
- var re = makeRe(pattern, opts);
- // `matchBase` is defined
- if (opts && opts.matchBase) {
- return utils_1.hasFilename(re, opts);
- }
- // `matchBase` is not defined
- return function(fp) {
- fp = utils_1.unixify(fp, opts);
- return re.test(fp);
- };
- }
- /**
- * Create and cache a regular expression for matching
- * file paths.
- *
- * If the leading character in the `glob` is `!`, a negation
- * regex is returned.
- *
- * @param {String} `glob`
- * @param {Object} `options`
- * @return {RegExp}
- */
- function toRegex$1(glob, options) {
- // clone options to prevent mutating the original object
- var opts = Object.create(options || {});
- var flags = opts.flags || '';
- if (opts.nocase && flags.indexOf('i') === -1) {
- flags += 'i';
- }
- var parsed = expand_1(glob, opts);
- // pass in tokens to avoid parsing more than once
- opts.negated = opts.negated || parsed.negated;
- opts.negate = opts.negated;
- glob = wrapGlob(parsed.pattern, opts);
- var re;
- try {
- re = new RegExp(glob, flags);
- return re;
- } catch (err) {
- err.reason = 'micromatch invalid regex: (' + re + ')';
- if (opts.strict) throw new SyntaxError(err);
- }
- // we're only here if a bad pattern was used and the user
- // passed `options.silent`, so match nothing
- return /$^/;
- }
- /**
- * Create the regex to do the matching. If the leading
- * character in the `glob` is `!` a negation regex is returned.
- *
- * @param {String} `glob`
- * @param {Boolean} `negate`
- */
- function wrapGlob(glob, opts) {
- var prefix = (opts && !opts.contains) ? '^' : '';
- var after = (opts && !opts.contains) ? '$' : '';
- glob = ('(?:' + glob + ')' + after);
- if (opts && opts.negate) {
- return prefix + ('(?!^' + glob + ').*$');
- }
- return prefix + glob;
- }
- /**
- * Create and cache a regular expression for matching file paths.
- * If the leading character in the `glob` is `!`, a negation
- * regex is returned.
- *
- * @param {String} `glob`
- * @param {Object} `options`
- * @return {RegExp}
- */
- function makeRe(glob, opts) {
- if (utils_1.typeOf(glob) !== 'string') {
- throw new Error(msg('makeRe', 'glob', 'a string'));
- }
- return utils_1.cache(toRegex$1, glob, opts);
- }
- /**
- * Make error messages consistent. Follows this format:
- *
- * ```js
- * msg(methodName, argNumber, nativeType);
- * // example:
- * msg('matchKeys', 'first', 'an object');
- * ```
- *
- * @param {String} `method`
- * @param {String} `num`
- * @param {String} `type`
- * @return {String}
- */
- function msg(method, what, type) {
- return 'micromatch.' + method + '(): ' + what + ' should be ' + type + '.';
- }
- /**
- * Public methods
- */
- /* eslint no-multi-spaces: 0 */
- micromatch.any = any;
- micromatch.braces = micromatch.braceExpand = utils_1.braces;
- micromatch.contains = contains;
- micromatch.expand = expand_1;
- micromatch.filter = filter$2;
- micromatch.isMatch = isMatch;
- micromatch.makeRe = makeRe;
- micromatch.match = match;
- micromatch.matcher = matcher;
- micromatch.matchKeys = matchKeys;
- /**
- * Expose `micromatch`
- */
- var micromatch_1 = micromatch;
- var slash = function (str) {
- var isExtendedLengthPath = /^\\\\\?\\/.test(str);
- var hasNonAscii = /[^\x00-\x80]+/.test(str);
- if (isExtendedLengthPath || hasNonAscii) {
- return str;
- }
- return str.replace(/\\/g, '/');
- };
- var jsTokens = createCommonjsModule(function (module, exports) {
- // Copyright 2014, 2015, 2016, 2017 Simon Lydell
- // License: MIT. (See LICENSE.)
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- // This regex comes from regex.coffee, and is inserted here by generate-index.js
- // (run `npm run build`).
- exports.default = /((['"])(?:(?!\2|\\).|\\(?:\r\n|[\s\S]))*(\2)?|`(?:[^`\\$]|\\[\s\S]|\$(?!\{)|\$\{(?:[^{}]|\{[^}]*\}?)*\}?)*(`)?)|(\/\/.*)|(\/\*(?:[^*]|\*(?!\/))*(\*\/)?)|(\/(?!\*)(?:\[(?:(?![\]\\]).|\\.)*\]|(?![\/\]\\]).|\\.)+\/(?:(?!\s*(?:\b|[\u0080-\uFFFF$\\'"~({]|[+\-!](?!=)|\.?\d))|[gmiyu]{1,5}\b(?![\u0080-\uFFFF$\\]|\s*(?:[+\-*%&|^<>!=?({]|\/(?![\/*])))))|(0[xX][\da-fA-F]+|0[oO][0-7]+|0[bB][01]+|(?:\d*\.\d+|\d+\.?)(?:[eE][+-]?\d+)?)|((?!\d)(?:(?!\s)[$\w\u0080-\uFFFF]|\\u[\da-fA-F]{4}|\\u\{[\da-fA-F]+\})+)|(--|\+\+|&&|\|\||=>|\.{3}|(?:[+\-\/%&|^]|\*{1,2}|<{1,2}|>{1,3}|!=?|={1,2})=?|[?~.,:;[\](){}])|(\s+)|(^$|[\s\S])/g;
- exports.matchToToken = function(match) {
- var token = {type: "invalid", value: match[0]};
- if (match[ 1]) token.type = "string", token.closed = !!(match[3] || match[4]);
- else if (match[ 5]) token.type = "comment";
- else if (match[ 6]) token.type = "comment", token.closed = !!match[7];
- else if (match[ 8]) token.type = "regex";
- else if (match[ 9]) token.type = "number";
- else if (match[10]) token.type = "name";
- else if (match[11]) token.type = "punctuator";
- else if (match[12]) token.type = "whitespace";
- return token
- };
- });
- unwrapExports(jsTokens);
- var jsTokens_1 = jsTokens.matchToToken;
- var ast = createCommonjsModule(function (module) {
- /*
- Copyright (C) 2013 Yusuke Suzuki <utatane.tea@gmail.com>
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are met:
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS'
- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
- DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
- (function () {
- function isExpression(node) {
- if (node == null) { return false; }
- switch (node.type) {
- case 'ArrayExpression':
- case 'AssignmentExpression':
- case 'BinaryExpression':
- case 'CallExpression':
- case 'ConditionalExpression':
- case 'FunctionExpression':
- case 'Identifier':
- case 'Literal':
- case 'LogicalExpression':
- case 'MemberExpression':
- case 'NewExpression':
- case 'ObjectExpression':
- case 'SequenceExpression':
- case 'ThisExpression':
- case 'UnaryExpression':
- case 'UpdateExpression':
- return true;
- }
- return false;
- }
- function isIterationStatement(node) {
- if (node == null) { return false; }
- switch (node.type) {
- case 'DoWhileStatement':
- case 'ForInStatement':
- case 'ForStatement':
- case 'WhileStatement':
- return true;
- }
- return false;
- }
- function isStatement(node) {
- if (node == null) { return false; }
- switch (node.type) {
- case 'BlockStatement':
- case 'BreakStatement':
- case 'ContinueStatement':
- case 'DebuggerStatement':
- case 'DoWhileStatement':
- case 'EmptyStatement':
- case 'ExpressionStatement':
- case 'ForInStatement':
- case 'ForStatement':
- case 'IfStatement':
- case 'LabeledStatement':
- case 'ReturnStatement':
- case 'SwitchStatement':
- case 'ThrowStatement':
- case 'TryStatement':
- case 'VariableDeclaration':
- case 'WhileStatement':
- case 'WithStatement':
- return true;
- }
- return false;
- }
- function isSourceElement(node) {
- return isStatement(node) || node != null && node.type === 'FunctionDeclaration';
- }
- function trailingStatement(node) {
- switch (node.type) {
- case 'IfStatement':
- if (node.alternate != null) {
- return node.alternate;
- }
- return node.consequent;
- case 'LabeledStatement':
- case 'ForStatement':
- case 'ForInStatement':
- case 'WhileStatement':
- case 'WithStatement':
- return node.body;
- }
- return null;
- }
- function isProblematicIfStatement(node) {
- var current;
- if (node.type !== 'IfStatement') {
- return false;
- }
- if (node.alternate == null) {
- return false;
- }
- current = node.consequent;
- do {
- if (current.type === 'IfStatement') {
- if (current.alternate == null) {
- return true;
- }
- }
- current = trailingStatement(current);
- } while (current);
- return false;
- }
- module.exports = {
- isExpression: isExpression,
- isStatement: isStatement,
- isIterationStatement: isIterationStatement,
- isSourceElement: isSourceElement,
- isProblematicIfStatement: isProblematicIfStatement,
- trailingStatement: trailingStatement
- };
- }());
- /* vim: set sw=4 ts=4 et tw=80 : */
- });
- var ast_1 = ast.isExpression;
- var ast_2 = ast.isStatement;
- var ast_3 = ast.isIterationStatement;
- var ast_4 = ast.isSourceElement;
- var ast_5 = ast.isProblematicIfStatement;
- var ast_6 = ast.trailingStatement;
- var code = createCommonjsModule(function (module) {
- /*
- Copyright (C) 2013-2014 Yusuke Suzuki <utatane.tea@gmail.com>
- Copyright (C) 2014 Ivan Nikulin <ifaaan@gmail.com>
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are met:
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
- DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
- (function () {
- var ES6Regex, ES5Regex, NON_ASCII_WHITESPACES, IDENTIFIER_START, IDENTIFIER_PART, ch;
- // See `tools/generate-identifier-regex.js`.
- ES5Regex = {
- // ECMAScript 5.1/Unicode v7.0.0 NonAsciiIdentifierStart:
- NonAsciiIdentifierStart: /[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0-\u08B2\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58\u0C59\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D60\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F4\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19C1-\u19C7\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FCC\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA78E\uA790-\uA7AD\uA7B0\uA7B1\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB5F\uAB64\uAB65\uABC0-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]/,
- // ECMAScript 5.1/Unicode v7.0.0 NonAsciiIdentifierPart:
- NonAsciiIdentifierPart: /[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u08A0-\u08B2\u08E4-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58\u0C59\u0C60-\u0C63\u0C66-\u0C6F\u0C81-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D01-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D57\u0D60-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1380-\u138F\u13A0-\u13F4\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19D9\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1CD0-\u1CD2\u1CD4-\u1CF6\u1CF8\u1CF9\u1D00-\u1DF5\u1DFC-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u200C\u200D\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u2E2F\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099\u309A\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FCC\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA69D\uA69F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA78E\uA790-\uA7AD\uA7B0\uA7B1\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C4\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB5F\uAB64\uAB65\uABC0-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2D\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]/
- };
- ES6Regex = {
- // ECMAScript 6/Unicode v7.0.0 NonAsciiIdentifierStart:
- NonAsciiIdentifierStart: /[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0-\u08B2\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58\u0C59\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D60\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F4\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19C1-\u19C7\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309B-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FCC\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA78E\uA790-\uA7AD\uA7B0\uA7B1\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB5F\uAB64\uAB65\uABC0-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF30-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDE00-\uDE11\uDE13-\uDE2B\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF5D-\uDF61]|\uD805[\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDE00-\uDE2F\uDE44\uDE80-\uDEAA]|\uD806[\uDCA0-\uDCDF\uDCFF\uDEC0-\uDEF8]|\uD808[\uDC00-\uDF98]|\uD809[\uDC00-\uDC6E]|[\uD80C\uD840-\uD868\uD86A-\uD86C][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50\uDF93-\uDF9F]|\uD82C[\uDC00\uDC01]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD83A[\uDC00-\uDCC4]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D]|\uD87E[\uDC00-\uDE1D]/,
- // ECMAScript 6/Unicode v7.0.0 NonAsciiIdentifierPart:
- NonAsciiIdentifierPart: /[\xAA\xB5\xB7\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u08A0-\u08B2\u08E4-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58\u0C59\u0C60-\u0C63\u0C66-\u0C6F\u0C81-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D01-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D57\u0D60-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1369-\u1371\u1380-\u138F\u13A0-\u13F4\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19DA\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1CD0-\u1CD2\u1CD4-\u1CF6\u1CF8\u1CF9\u1D00-\u1DF5\u1DFC-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u200C\u200D\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FCC\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA69D\uA69F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA78E\uA790-\uA7AD\uA7B0\uA7B1\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C4\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB5F\uAB64\uAB65\uABC0-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2D\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDDFD\uDE80-\uDE9C\uDEA0-\uDED0\uDEE0\uDF00-\uDF1F\uDF30-\uDF4A\uDF50-\uDF7A\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00-\uDE03\uDE05\uDE06\uDE0C-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE38-\uDE3A\uDE3F\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE6\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48]|\uD804[\uDC00-\uDC46\uDC66-\uDC6F\uDC7F-\uDCBA\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD00-\uDD34\uDD36-\uDD3F\uDD50-\uDD73\uDD76\uDD80-\uDDC4\uDDD0-\uDDDA\uDE00-\uDE11\uDE13-\uDE37\uDEB0-\uDEEA\uDEF0-\uDEF9\uDF01-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3C-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF57\uDF5D-\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC80-\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDB5\uDDB8-\uDDC0\uDE00-\uDE40\uDE44\uDE50-\uDE59\uDE80-\uDEB7\uDEC0-\uDEC9]|\uD806[\uDCA0-\uDCE9\uDCFF\uDEC0-\uDEF8]|\uD808[\uDC00-\uDF98]|\uD809[\uDC00-\uDC6E]|[\uD80C\uD840-\uD868\uD86A-\uD86C][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDEF0-\uDEF4\uDF00-\uDF36\uDF40-\uDF43\uDF50-\uDF59\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50-\uDF7E\uDF8F-\uDF9F]|\uD82C[\uDC00\uDC01]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD83A[\uDC00-\uDCC4\uDCD0-\uDCD6]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D]|\uD87E[\uDC00-\uDE1D]|\uDB40[\uDD00-\uDDEF]/
- };
- function isDecimalDigit(ch) {
- return 0x30 <= ch && ch <= 0x39; // 0..9
- }
- function isHexDigit(ch) {
- return 0x30 <= ch && ch <= 0x39 || // 0..9
- 0x61 <= ch && ch <= 0x66 || // a..f
- 0x41 <= ch && ch <= 0x46; // A..F
- }
- function isOctalDigit(ch) {
- return ch >= 0x30 && ch <= 0x37; // 0..7
- }
- // 7.2 White Space
- NON_ASCII_WHITESPACES = [
- 0x1680, 0x180E,
- 0x2000, 0x2001, 0x2002, 0x2003, 0x2004, 0x2005, 0x2006, 0x2007, 0x2008, 0x2009, 0x200A,
- 0x202F, 0x205F,
- 0x3000,
- 0xFEFF
- ];
- function isWhiteSpace(ch) {
- return ch === 0x20 || ch === 0x09 || ch === 0x0B || ch === 0x0C || ch === 0xA0 ||
- ch >= 0x1680 && NON_ASCII_WHITESPACES.indexOf(ch) >= 0;
- }
- // 7.3 Line Terminators
- function isLineTerminator(ch) {
- return ch === 0x0A || ch === 0x0D || ch === 0x2028 || ch === 0x2029;
- }
- // 7.6 Identifier Names and Identifiers
- function fromCodePoint(cp) {
- if (cp <= 0xFFFF) { return String.fromCharCode(cp); }
- var cu1 = String.fromCharCode(Math.floor((cp - 0x10000) / 0x400) + 0xD800);
- var cu2 = String.fromCharCode(((cp - 0x10000) % 0x400) + 0xDC00);
- return cu1 + cu2;
- }
- IDENTIFIER_START = new Array(0x80);
- for(ch = 0; ch < 0x80; ++ch) {
- IDENTIFIER_START[ch] =
- ch >= 0x61 && ch <= 0x7A || // a..z
- ch >= 0x41 && ch <= 0x5A || // A..Z
- ch === 0x24 || ch === 0x5F; // $ (dollar) and _ (underscore)
- }
- IDENTIFIER_PART = new Array(0x80);
- for(ch = 0; ch < 0x80; ++ch) {
- IDENTIFIER_PART[ch] =
- ch >= 0x61 && ch <= 0x7A || // a..z
- ch >= 0x41 && ch <= 0x5A || // A..Z
- ch >= 0x30 && ch <= 0x39 || // 0..9
- ch === 0x24 || ch === 0x5F; // $ (dollar) and _ (underscore)
- }
- function isIdentifierStartES5(ch) {
- return ch < 0x80 ? IDENTIFIER_START[ch] : ES5Regex.NonAsciiIdentifierStart.test(fromCodePoint(ch));
- }
- function isIdentifierPartES5(ch) {
- return ch < 0x80 ? IDENTIFIER_PART[ch] : ES5Regex.NonAsciiIdentifierPart.test(fromCodePoint(ch));
- }
- function isIdentifierStartES6(ch) {
- return ch < 0x80 ? IDENTIFIER_START[ch] : ES6Regex.NonAsciiIdentifierStart.test(fromCodePoint(ch));
- }
- function isIdentifierPartES6(ch) {
- return ch < 0x80 ? IDENTIFIER_PART[ch] : ES6Regex.NonAsciiIdentifierPart.test(fromCodePoint(ch));
- }
- module.exports = {
- isDecimalDigit: isDecimalDigit,
- isHexDigit: isHexDigit,
- isOctalDigit: isOctalDigit,
- isWhiteSpace: isWhiteSpace,
- isLineTerminator: isLineTerminator,
- isIdentifierStartES5: isIdentifierStartES5,
- isIdentifierPartES5: isIdentifierPartES5,
- isIdentifierStartES6: isIdentifierStartES6,
- isIdentifierPartES6: isIdentifierPartES6
- };
- }());
- /* vim: set sw=4 ts=4 et tw=80 : */
- });
- var code_1 = code.isDecimalDigit;
- var code_2 = code.isHexDigit;
- var code_3 = code.isOctalDigit;
- var code_4 = code.isWhiteSpace;
- var code_5 = code.isLineTerminator;
- var code_6 = code.isIdentifierStartES5;
- var code_7 = code.isIdentifierPartES5;
- var code_8 = code.isIdentifierStartES6;
- var code_9 = code.isIdentifierPartES6;
- var keyword = createCommonjsModule(function (module) {
- /*
- Copyright (C) 2013 Yusuke Suzuki <utatane.tea@gmail.com>
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are met:
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
- DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
- (function () {
- var code$$1 = code;
- function isStrictModeReservedWordES6(id) {
- switch (id) {
- case 'implements':
- case 'interface':
- case 'package':
- case 'private':
- case 'protected':
- case 'public':
- case 'static':
- case 'let':
- return true;
- default:
- return false;
- }
- }
- function isKeywordES5(id, strict) {
- // yield should not be treated as keyword under non-strict mode.
- if (!strict && id === 'yield') {
- return false;
- }
- return isKeywordES6(id, strict);
- }
- function isKeywordES6(id, strict) {
- if (strict && isStrictModeReservedWordES6(id)) {
- return true;
- }
- switch (id.length) {
- case 2:
- return (id === 'if') || (id === 'in') || (id === 'do');
- case 3:
- return (id === 'var') || (id === 'for') || (id === 'new') || (id === 'try');
- case 4:
- return (id === 'this') || (id === 'else') || (id === 'case') ||
- (id === 'void') || (id === 'with') || (id === 'enum');
- case 5:
- return (id === 'while') || (id === 'break') || (id === 'catch') ||
- (id === 'throw') || (id === 'const') || (id === 'yield') ||
- (id === 'class') || (id === 'super');
- case 6:
- return (id === 'return') || (id === 'typeof') || (id === 'delete') ||
- (id === 'switch') || (id === 'export') || (id === 'import');
- case 7:
- return (id === 'default') || (id === 'finally') || (id === 'extends');
- case 8:
- return (id === 'function') || (id === 'continue') || (id === 'debugger');
- case 10:
- return (id === 'instanceof');
- default:
- return false;
- }
- }
- function isReservedWordES5(id, strict) {
- return id === 'null' || id === 'true' || id === 'false' || isKeywordES5(id, strict);
- }
- function isReservedWordES6(id, strict) {
- return id === 'null' || id === 'true' || id === 'false' || isKeywordES6(id, strict);
- }
- function isRestrictedWord(id) {
- return id === 'eval' || id === 'arguments';
- }
- function isIdentifierNameES5(id) {
- var i, iz, ch;
- if (id.length === 0) { return false; }
- ch = id.charCodeAt(0);
- if (!code$$1.isIdentifierStartES5(ch)) {
- return false;
- }
- for (i = 1, iz = id.length; i < iz; ++i) {
- ch = id.charCodeAt(i);
- if (!code$$1.isIdentifierPartES5(ch)) {
- return false;
- }
- }
- return true;
- }
- function decodeUtf16(lead, trail) {
- return (lead - 0xD800) * 0x400 + (trail - 0xDC00) + 0x10000;
- }
- function isIdentifierNameES6(id) {
- var i, iz, ch, lowCh, check;
- if (id.length === 0) { return false; }
- check = code$$1.isIdentifierStartES6;
- for (i = 0, iz = id.length; i < iz; ++i) {
- ch = id.charCodeAt(i);
- if (0xD800 <= ch && ch <= 0xDBFF) {
- ++i;
- if (i >= iz) { return false; }
- lowCh = id.charCodeAt(i);
- if (!(0xDC00 <= lowCh && lowCh <= 0xDFFF)) {
- return false;
- }
- ch = decodeUtf16(ch, lowCh);
- }
- if (!check(ch)) {
- return false;
- }
- check = code$$1.isIdentifierPartES6;
- }
- return true;
- }
- function isIdentifierES5(id, strict) {
- return isIdentifierNameES5(id) && !isReservedWordES5(id, strict);
- }
- function isIdentifierES6(id, strict) {
- return isIdentifierNameES6(id) && !isReservedWordES6(id, strict);
- }
- module.exports = {
- isKeywordES5: isKeywordES5,
- isKeywordES6: isKeywordES6,
- isReservedWordES5: isReservedWordES5,
- isReservedWordES6: isReservedWordES6,
- isRestrictedWord: isRestrictedWord,
- isIdentifierNameES5: isIdentifierNameES5,
- isIdentifierNameES6: isIdentifierNameES6,
- isIdentifierES5: isIdentifierES5,
- isIdentifierES6: isIdentifierES6
- };
- }());
- /* vim: set sw=4 ts=4 et tw=80 : */
- });
- var keyword_1 = keyword.isKeywordES5;
- var keyword_2 = keyword.isKeywordES6;
- var keyword_3 = keyword.isReservedWordES5;
- var keyword_4 = keyword.isReservedWordES6;
- var keyword_5 = keyword.isRestrictedWord;
- var keyword_6 = keyword.isIdentifierNameES5;
- var keyword_7 = keyword.isIdentifierNameES6;
- var keyword_8 = keyword.isIdentifierES5;
- var keyword_9 = keyword.isIdentifierES6;
- var utils = createCommonjsModule(function (module, exports) {
- /*
- Copyright (C) 2013 Yusuke Suzuki <utatane.tea@gmail.com>
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are met:
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
- DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
- (function () {
- exports.ast = ast;
- exports.code = code;
- exports.keyword = keyword;
- }());
- /* vim: set sw=4 ts=4 et tw=80 : */
- });
- var utils_1$1 = utils.ast;
- var utils_2 = utils.code;
- var utils_3 = utils.keyword;
- var lib$1 = createCommonjsModule(function (module, exports) {
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.shouldHighlight = shouldHighlight;
- exports.getChalk = getChalk;
- exports.default = highlight;
- function _jsTokens() {
- var data = _interopRequireWildcard(jsTokens);
- _jsTokens = function _jsTokens() {
- return data;
- };
- return data;
- }
- function _esutils() {
- var data = _interopRequireDefault(utils);
- _esutils = function _esutils() {
- return data;
- };
- return data;
- }
- function _chalk() {
- var data = _interopRequireDefault(fake_chalk);
- _chalk = function _chalk() {
- return data;
- };
- return data;
- }
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
- function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
- function getDefs(chalk) {
- return {
- keyword: chalk.cyan,
- capitalized: chalk.yellow,
- jsx_tag: chalk.yellow,
- punctuator: chalk.yellow,
- number: chalk.magenta,
- string: chalk.green,
- regex: chalk.magenta,
- comment: chalk.grey,
- invalid: chalk.white.bgRed.bold
- };
- }
- var NEWLINE = /\r\n|[\n\r\u2028\u2029]/;
- var JSX_TAG = /^[a-z][\w-]*$/i;
- var BRACKET = /^[()[\]{}]$/;
- function getTokenType(match) {
- var _match$slice = match.slice(-2),
- offset = _match$slice[0],
- text = _match$slice[1];
- var token = (0, _jsTokens().matchToToken)(match);
- if (token.type === "name") {
- if (_esutils().default.keyword.isReservedWordES6(token.value)) {
- return "keyword";
- }
- if (JSX_TAG.test(token.value) && (text[offset - 1] === "<" || text.substr(offset - 2, 2) == "</")) {
- return "jsx_tag";
- }
- if (token.value[0] !== token.value[0].toLowerCase()) {
- return "capitalized";
- }
- }
- if (token.type === "punctuator" && BRACKET.test(token.value)) {
- return "bracket";
- }
- if (token.type === "invalid" && (token.value === "@" || token.value === "#")) {
- return "punctuator";
- }
- return token.type;
- }
- function highlightTokens(defs, text) {
- return text.replace(_jsTokens().default, function () {
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
- args[_key] = arguments[_key];
- }
- var type = getTokenType(args);
- var colorize = defs[type];
- if (colorize) {
- return args[0].split(NEWLINE).map(function (str) {
- return colorize(str);
- }).join("\n");
- } else {
- return args[0];
- }
- });
- }
- function shouldHighlight(options) {
- return _chalk().default.supportsColor || options.forceColor;
- }
- function getChalk(options) {
- var chalk = _chalk().default;
- if (options.forceColor) {
- chalk = new (_chalk().default.constructor)({
- enabled: true,
- level: 1
- });
- }
- return chalk;
- }
- function highlight(code, options) {
- if (options === void 0) {
- options = {};
- }
- if (shouldHighlight(options)) {
- var chalk = getChalk(options);
- var defs = getDefs(chalk);
- return highlightTokens(defs, code);
- } else {
- return code;
- }
- }
- });
- unwrapExports(lib$1);
- var lib_1$1 = lib$1.shouldHighlight;
- var lib_2$1 = lib$1.getChalk;
- var lib$2 = createCommonjsModule(function (module, exports) {
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.codeFrameColumns = codeFrameColumns;
- exports.default = _default;
- function _highlight() {
- var data = _interopRequireWildcard(lib$1);
- _highlight = function _highlight() {
- return data;
- };
- return data;
- }
- function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
- var deprecationWarningShown = false;
- function getDefs(chalk) {
- return {
- gutter: chalk.grey,
- marker: chalk.red.bold,
- message: chalk.red.bold
- };
- }
- var NEWLINE = /\r\n|[\n\r\u2028\u2029]/;
- function getMarkerLines(loc, source, opts) {
- var startLoc = Object.assign({}, {
- column: 0,
- line: -1
- }, loc.start);
- var endLoc = Object.assign({}, startLoc, loc.end);
- var _ref = opts || {},
- _ref$linesAbove = _ref.linesAbove,
- linesAbove = _ref$linesAbove === void 0 ? 2 : _ref$linesAbove,
- _ref$linesBelow = _ref.linesBelow,
- linesBelow = _ref$linesBelow === void 0 ? 3 : _ref$linesBelow;
- var startLine = startLoc.line;
- var startColumn = startLoc.column;
- var endLine = endLoc.line;
- var endColumn = endLoc.column;
- var start = Math.max(startLine - (linesAbove + 1), 0);
- var end = Math.min(source.length, endLine + linesBelow);
- if (startLine === -1) {
- start = 0;
- }
- if (endLine === -1) {
- end = source.length;
- }
- var lineDiff = endLine - startLine;
- var markerLines = {};
- if (lineDiff) {
- for (var i = 0; i <= lineDiff; i++) {
- var lineNumber = i + startLine;
- if (!startColumn) {
- markerLines[lineNumber] = true;
- } else if (i === 0) {
- var sourceLength = source[lineNumber - 1].length;
- markerLines[lineNumber] = [startColumn, sourceLength - startColumn];
- } else if (i === lineDiff) {
- markerLines[lineNumber] = [0, endColumn];
- } else {
- var _sourceLength = source[lineNumber - i].length;
- markerLines[lineNumber] = [0, _sourceLength];
- }
- }
- } else {
- if (startColumn === endColumn) {
- if (startColumn) {
- markerLines[startLine] = [startColumn, 0];
- } else {
- markerLines[startLine] = true;
- }
- } else {
- markerLines[startLine] = [startColumn, endColumn - startColumn];
- }
- }
- return {
- start: start,
- end: end,
- markerLines: markerLines
- };
- }
- function codeFrameColumns(rawLines, loc, opts) {
- if (opts === void 0) {
- opts = {};
- }
- var highlighted = (opts.highlightCode || opts.forceColor) && (0, _highlight().shouldHighlight)(opts);
- var chalk = (0, _highlight().getChalk)(opts);
- var defs = getDefs(chalk);
- var maybeHighlight = function maybeHighlight(chalkFn, string) {
- return highlighted ? chalkFn(string) : string;
- };
- if (highlighted) rawLines = (0, _highlight().default)(rawLines, opts);
- var lines = rawLines.split(NEWLINE);
- var _getMarkerLines = getMarkerLines(loc, lines, opts),
- start = _getMarkerLines.start,
- end = _getMarkerLines.end,
- markerLines = _getMarkerLines.markerLines;
- var hasColumns = loc.start && typeof loc.start.column === "number";
- var numberMaxWidth = String(end).length;
- var frame = lines.slice(start, end).map(function (line, index) {
- var number = start + 1 + index;
- var paddedNumber = (" " + number).slice(-numberMaxWidth);
- var gutter = " " + paddedNumber + " | ";
- var hasMarker = markerLines[number];
- var lastMarkerLine = !markerLines[number + 1];
- if (hasMarker) {
- var markerLine = "";
- if (Array.isArray(hasMarker)) {
- var markerSpacing = line.slice(0, Math.max(hasMarker[0] - 1, 0)).replace(/[^\t]/g, " ");
- var numberOfMarkers = hasMarker[1] || 1;
- markerLine = ["\n ", maybeHighlight(defs.gutter, gutter.replace(/\d/g, " ")), markerSpacing, maybeHighlight(defs.marker, "^").repeat(numberOfMarkers)].join("");
- if (lastMarkerLine && opts.message) {
- markerLine += " " + maybeHighlight(defs.message, opts.message);
- }
- }
- return [maybeHighlight(defs.marker, ">"), maybeHighlight(defs.gutter, gutter), line, markerLine].join("");
- } else {
- return " " + maybeHighlight(defs.gutter, gutter) + line;
- }
- }).join("\n");
- if (opts.message && !hasColumns) {
- frame = "" + " ".repeat(numberMaxWidth + 1) + opts.message + "\n" + frame;
- }
- if (highlighted) {
- return chalk.reset(frame);
- } else {
- return frame;
- }
- }
- function _default(rawLines, lineNumber, colNumber, opts) {
- if (opts === void 0) {
- opts = {};
- }
- if (!deprecationWarningShown) {
- deprecationWarningShown = true;
- var message = "Passing lineNumber and colNumber is deprecated to @babel/code-frame. Please use `codeFrameColumns`.";
- if (process$3.emitWarning) {
- process$3.emitWarning(message, "DeprecationWarning");
- } else {
- var deprecationError = new Error(message);
- deprecationError.name = "DeprecationWarning";
- console.warn(new Error(message));
- }
- }
- colNumber = Math.max(colNumber, 0);
- var location = {
- start: {
- column: colNumber,
- line: lineNumber
- }
- };
- return codeFrameColumns(rawLines, location, opts);
- }
- });
- unwrapExports(lib$2);
- var lib_1$2 = lib$2.codeFrameColumns;
- var stackUtils = createCommonjsModule(function (module) {
- module.exports = StackUtils;
- function StackUtils(opts) {
- if (!(this instanceof StackUtils)) {
- throw new Error('StackUtils constructor must be called with new');
- }
- opts = opts || {};
- this._cwd = (opts.cwd || process$3.cwd()).replace(/\\/g, '/');
- this._internals = opts.internals || [];
- this._wrapCallSite = opts.wrapCallSite || false;
- }
- module.exports.nodeInternals = nodeInternals;
- function nodeInternals() {
- if (!module.exports.natives) {
- module.exports.natives = Object.keys(process$3.binding('natives'));
- module.exports.natives.push('bootstrap_node', 'node');
- }
- return module.exports.natives.map(function (n) {
- return new RegExp('\\(' + n + '\\.js:\\d+:\\d+\\)$');
- }).concat([
- /\s*at (bootstrap_)?node\.js:\d+:\d+?$/,
- /\/\.node-spawn-wrap-\w+-\w+\/node:\d+:\d+\)?$/
- ]);
- }
- StackUtils.prototype.clean = function (stack) {
- if (!Array.isArray(stack)) {
- stack = stack.split('\n');
- }
- if (!(/^\s*at /.test(stack[0])) &&
- (/^\s*at /.test(stack[1]))) {
- stack = stack.slice(1);
- }
- var outdent = false;
- var lastNonAtLine = null;
- var result = [];
- stack.forEach(function (st) {
- st = st.replace(/\\/g, '/');
- var isInternal = this._internals.some(function (internal) {
- return internal.test(st);
- });
- if (isInternal) {
- return null;
- }
- var isAtLine = /^\s*at /.test(st);
- if (outdent) {
- st = st.replace(/\s+$/, '').replace(/^(\s+)at /, '$1');
- } else {
- st = st.trim();
- if (isAtLine) {
- st = st.substring(3);
- }
- }
- st = st.replace(this._cwd + '/', '');
- if (st) {
- if (isAtLine) {
- if (lastNonAtLine) {
- result.push(lastNonAtLine);
- lastNonAtLine = null;
- }
- result.push(st);
- } else {
- outdent = true;
- lastNonAtLine = st;
- }
- }
- }, this);
- stack = result.join('\n').trim();
- if (stack) {
- return stack + '\n';
- }
- return '';
- };
- StackUtils.prototype.captureString = function (limit, fn) {
- if (typeof limit === 'function') {
- fn = limit;
- limit = Infinity;
- }
- if (!fn) {
- fn = this.captureString;
- }
- var limitBefore = Error.stackTraceLimit;
- if (limit) {
- Error.stackTraceLimit = limit;
- }
- var obj = {};
- Error.captureStackTrace(obj, fn);
- var stack = obj.stack;
- Error.stackTraceLimit = limitBefore;
- return this.clean(stack);
- };
- StackUtils.prototype.capture = function (limit, fn) {
- if (typeof limit === 'function') {
- fn = limit;
- limit = Infinity;
- }
- if (!fn) {
- fn = this.capture;
- }
- var prepBefore = Error.prepareStackTrace;
- var limitBefore = Error.stackTraceLimit;
- var wrapCallSite = this._wrapCallSite;
- Error.prepareStackTrace = function (obj, site) {
- if (wrapCallSite) {
- return site.map(wrapCallSite);
- }
- return site;
- };
- if (limit) {
- Error.stackTraceLimit = limit;
- }
- var obj = {};
- Error.captureStackTrace(obj, fn);
- var stack = obj.stack;
- Error.prepareStackTrace = prepBefore;
- Error.stackTraceLimit = limitBefore;
- return stack;
- };
- StackUtils.prototype.at = function at(fn) {
- if (!fn) {
- fn = at;
- }
- var site = this.capture(1, fn)[0];
- if (!site) {
- return {};
- }
- var res = {
- line: site.getLineNumber(),
- column: site.getColumnNumber()
- };
- this._setFile(res, site.getFileName());
- if (site.isConstructor()) {
- res.constructor = true;
- }
- if (site.isEval()) {
- res.evalOrigin = site.getEvalOrigin();
- }
- if (site.isNative()) {
- res.native = true;
- }
- var typename = null;
- try {
- typename = site.getTypeName();
- } catch (er) {}
- if (typename &&
- typename !== 'Object' &&
- typename !== '[object Object]') {
- res.type = typename;
- }
- var fname = site.getFunctionName();
- if (fname) {
- res.function = fname;
- }
- var meth = site.getMethodName();
- if (meth && fname !== meth) {
- res.method = meth;
- }
- return res;
- };
- StackUtils.prototype._setFile = function (result, filename) {
- if (filename) {
- filename = filename.replace(/\\/g, '/');
- if ((filename.indexOf(this._cwd + '/') === 0)) {
- filename = filename.substr(this._cwd.length + 1);
- }
- result.file = filename;
- }
- };
- var re = new RegExp(
- '^' +
- // Sometimes we strip out the ' at' because it's noisy
- '(?:\\s*at )?' +
- // $1 = ctor if 'new'
- '(?:(new) )?' +
- // $2 = function name (can be literally anything)
- // May contain method at the end as [as xyz]
- '(?:(.*?) \\()?' +
- // (eval at <anonymous> (file.js:1:1),
- // $3 = eval origin
- // $4:$5:$6 are eval file/line/col, but not normally reported
- '(?:eval at ([^ ]+) \\((.+?):(\\d+):(\\d+)\\), )?' +
- // file:line:col
- // $7:$8:$9
- // $10 = 'native' if native
- '(?:(.+?):(\\d+):(\\d+)|(native))' +
- // maybe close the paren, then end
- // if $11 is ), then we only allow balanced parens in the filename
- // any imbalance is placed on the fname. This is a heuristic, and
- // bound to be incorrect in some edge cases. The bet is that
- // having weird characters in method names is more common than
- // having weird characters in filenames, which seems reasonable.
- '(\\)?)$'
- );
- var methodRe = /^(.*?) \[as (.*?)\]$/;
- StackUtils.prototype.parseLine = function parseLine(line) {
- var match = line && line.match(re);
- if (!match) {
- return null;
- }
- var ctor = match[1] === 'new';
- var fname = match[2];
- var evalOrigin = match[3];
- var evalFile = match[4];
- var evalLine = Number(match[5]);
- var evalCol = Number(match[6]);
- var file = match[7];
- var lnum = match[8];
- var col = match[9];
- var native = match[10] === 'native';
- var closeParen = match[11] === ')';
- var res = {};
- if (lnum) {
- res.line = Number(lnum);
- }
- if (col) {
- res.column = Number(col);
- }
- if (closeParen && file) {
- // make sure parens are balanced
- // if we have a file like "asdf) [as foo] (xyz.js", then odds are
- // that the fname should be += " (asdf) [as foo]" and the file
- // should be just "xyz.js"
- // walk backwards from the end to find the last unbalanced (
- var closes = 0;
- for (var i = file.length - 1; i > 0; i--) {
- if (file.charAt(i) === ')') {
- closes ++;
- } else if (file.charAt(i) === '(' && file.charAt(i - 1) === ' ') {
- closes --;
- if (closes === -1 && file.charAt(i - 1) === ' ') {
- var before = file.substr(0, i - 1);
- var after = file.substr(i + 1);
- file = after;
- fname += ' (' + before;
- break;
- }
- }
- }
- }
- if (fname) {
- var methodMatch = fname.match(methodRe);
- if (methodMatch) {
- fname = methodMatch[1];
- var meth = methodMatch[2];
- }
- }
- this._setFile(res, file);
- if (ctor) {
- res.constructor = true;
- }
- if (evalOrigin) {
- res.evalOrigin = evalOrigin;
- res.evalLine = evalLine;
- res.evalColumn = evalCol;
- res.evalFile = evalFile && evalFile.replace(/\\/g, '/');
- }
- if (native) {
- res.native = true;
- }
- if (fname) {
- res.function = fname;
- }
- if (meth && fname !== meth) {
- res.method = meth;
- }
- return res;
- };
- var bound = new StackUtils();
- Object.keys(StackUtils.prototype).forEach(function (key) {
- StackUtils[key] = bound[key].bind(bound);
- });
- });
- var stackUtils_1 = stackUtils.nodeInternals;
- var stackUtils_2 = stackUtils.natives;
- var build$5 = createCommonjsModule(function (module, exports) {
- Object.defineProperty(exports, '__esModule', {
- value: true
- });
- exports.separateMessageFromStack = exports.formatResultsErrors = exports.formatStackTrace = exports.getTopFrame = exports.getStackTraceLines = exports.formatExecError = undefined;
- var _fs2 = _interopRequireDefault(crypto);
- var _path2 = _interopRequireDefault(path$2);
- var _chalk2 = _interopRequireDefault(fake_chalk);
- var _micromatch2 = _interopRequireDefault(micromatch_1);
- var _slash2 = _interopRequireDefault(slash);
- var _stackUtils2 = _interopRequireDefault(stackUtils);
- function _interopRequireDefault(obj) {
- return obj && obj.__esModule ? obj : { default: obj };
- }
- // stack utils tries to create pretty stack by making paths relative.
- var stackUtils$$1 = new _stackUtils2.default({
- cwd: 'something which does not exist'
- });
- /**
- * Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- *
- *
- */
- var nodeInternals = [];
- try {
- nodeInternals = _stackUtils2.default.nodeInternals()
- // this is to have the tests be the same in node 4 and node 6.
- // TODO: Remove when we drop support for node 4
- .concat(new RegExp('internal/process/next_tick.js'));
- } catch (e) {
- // `StackUtils.nodeInternals()` fails in browsers. We don't need to remove
- // node internals in the browser though, so no issue.
- }
- var PATH_NODE_MODULES = _path2.default.sep + 'node_modules' + _path2.default.sep;
- var PATH_JEST_PACKAGES = _path2.default.sep + 'jest' + _path2.default.sep + 'packages' + _path2.default.sep;
- // filter for noisy stack trace lines
- var JASMINE_IGNORE = /^\s+at(?:(?:.jasmine\-)|\s+jasmine\.buildExpectationResult)/;
- var JEST_INTERNALS_IGNORE = /^\s+at.*?jest(-.*?)?(\/|\\)(build|node_modules|packages)(\/|\\)/;
- var ANONYMOUS_FN_IGNORE = /^\s+at <anonymous>.*$/;
- var ANONYMOUS_PROMISE_IGNORE = /^\s+at (new )?Promise \(<anonymous>\).*$/;
- var ANONYMOUS_GENERATOR_IGNORE = /^\s+at Generator.next \(<anonymous>\).*$/;
- var NATIVE_NEXT_IGNORE = /^\s+at next \(native\).*$/;
- var TITLE_INDENT = ' ';
- var MESSAGE_INDENT = ' ';
- var STACK_INDENT = ' ';
- var ANCESTRY_SEPARATOR = ' \u203A ';
- var TITLE_BULLET = _chalk2.default.bold('\u25CF ');
- var STACK_TRACE_COLOR = _chalk2.default.dim;
- var STACK_PATH_REGEXP = /\s*at.*\(?(\:\d*\:\d*|native)\)?/;
- var EXEC_ERROR_MESSAGE = 'Test suite failed to run';
- var ERROR_TEXT = 'Error: ';
- var indentAllLines = function indentAllLines(lines, indent) {
- return lines.split('\n').map(function (line) {
- return line ? indent + line : line;
- }).join('\n');
- };
- var trim = function trim(string) {
- return (string || '').trim();
- };
- // Some errors contain not only line numbers in stack traces
- // e.g. SyntaxErrors can contain snippets of code, and we don't
- // want to trim those, because they may have pointers to the column/character
- // which will get misaligned.
- var trimPaths = function trimPaths(string) {
- return string.match(STACK_PATH_REGEXP) ? trim(string) : string;
- };
- var getRenderedCallsite = function getRenderedCallsite(fileContent, line, column) {
- var renderedCallsite = (0, lib$2.codeFrameColumns)(fileContent, { start: { column: column, line: line } }, { highlightCode: true });
- renderedCallsite = indentAllLines(renderedCallsite, MESSAGE_INDENT);
- renderedCallsite = '\n' + renderedCallsite + '\n';
- return renderedCallsite;
- };
- // ExecError is an error thrown outside of the test suite (not inside an `it` or
- // `before/after each` hooks). If it's thrown, none of the tests in the file
- // are executed.
- var formatExecError = exports.formatExecError = function (error, config, options, testPath, reuseMessage) {
- if (!error || typeof error === 'number') {
- error = new Error('Expected an Error, but "' + String(error) + '" was thrown');
- error.stack = '';
- }
- var message = void 0,
- stack = void 0;
- if (typeof error === 'string' || !error) {
- error || (error = 'EMPTY ERROR');
- message = '';
- stack = error;
- } else {
- message = error.message;
- stack = error.stack;
- }
- var separated = separateMessageFromStack(stack || '');
- stack = separated.stack;
- if (separated.message.indexOf(trim(message)) !== -1) {
- // Often stack trace already contains the duplicate of the message
- message = separated.message;
- }
- message = indentAllLines(message, MESSAGE_INDENT);
- stack = stack && !options.noStackTrace ? '\n' + formatStackTrace(stack, config, options, testPath) : '';
- if (message.match(/^\s*$/) && stack.match(/^\s*$/)) {
- // this can happen if an empty object is thrown.
- message = MESSAGE_INDENT + 'Error: No message was provided';
- }
- var messageToUse = void 0;
- if (reuseMessage) {
- messageToUse = ' ' + message.trim();
- } else {
- messageToUse = EXEC_ERROR_MESSAGE + '\n\n' + message;
- }
- return TITLE_INDENT + TITLE_BULLET + messageToUse + stack + '\n';
- };
- var removeInternalStackEntries = function removeInternalStackEntries(lines, options) {
- var pathCounter = 0;
- return lines.filter(function (line) {
- if (ANONYMOUS_FN_IGNORE.test(line)) {
- return false;
- }
- if (ANONYMOUS_PROMISE_IGNORE.test(line)) {
- return false;
- }
- if (ANONYMOUS_GENERATOR_IGNORE.test(line)) {
- return false;
- }
- if (NATIVE_NEXT_IGNORE.test(line)) {
- return false;
- }
- if (nodeInternals.some(function (internal) {
- return internal.test(line);
- })) {
- return false;
- }
- if (!STACK_PATH_REGEXP.test(line)) {
- return true;
- }
- if (JASMINE_IGNORE.test(line)) {
- return false;
- }
- if (++pathCounter === 1) {
- return true; // always keep the first line even if it's from Jest
- }
- if (options.noStackTrace) {
- return false;
- }
- if (JEST_INTERNALS_IGNORE.test(line)) {
- return false;
- }
- return true;
- });
- };
- var formatPaths = function formatPaths(config, relativeTestPath, line) {
- // Extract the file path from the trace line.
- var match = line.match(/(^\s*at .*?\(?)([^()]+)(:[0-9]+:[0-9]+\)?.*$)/);
- if (!match) {
- return line;
- }
- var filePath = (0, _slash2.default)(_path2.default.relative(config.rootDir, match[2]));
- // highlight paths from the current test file
- if (config.testMatch && config.testMatch.length && (0, _micromatch2.default)(filePath, config.testMatch) || filePath === relativeTestPath) {
- filePath = _chalk2.default.reset.cyan(filePath);
- }
- return STACK_TRACE_COLOR(match[1]) + filePath + STACK_TRACE_COLOR(match[3]);
- };
- var getStackTraceLines = exports.getStackTraceLines = function (stack) {
- var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : { noStackTrace: false };
- return removeInternalStackEntries(stack.split(/\n/), options);
- };
- var getTopFrame = exports.getTopFrame = function (lines) {
- var _iteratorNormalCompletion = true;
- var _didIteratorError = false;
- var _iteratorError = undefined;
- try {
- for (var _iterator = _getIterator(lines), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
- var line = _step.value;
- if (line.includes(PATH_NODE_MODULES) || line.includes(PATH_JEST_PACKAGES)) {
- continue;
- }
- var parsedFrame = stackUtils$$1.parseLine(line.trim());
- if (parsedFrame && parsedFrame.file) {
- return parsedFrame;
- }
- }
- } catch (err) {
- _didIteratorError = true;
- _iteratorError = err;
- } finally {
- try {
- if (!_iteratorNormalCompletion && _iterator.return) {
- _iterator.return();
- }
- } finally {
- if (_didIteratorError) {
- throw _iteratorError;
- }
- }
- }
- return null;
- };
- var formatStackTrace = exports.formatStackTrace = function (stack, config, options, testPath) {
- var lines = getStackTraceLines(stack, options);
- var topFrame = getTopFrame(lines);
- var renderedCallsite = '';
- var relativeTestPath = testPath ? (0, _slash2.default)(_path2.default.relative(config.rootDir, testPath)) : null;
- if (topFrame) {
- var filename = topFrame.file;
- if (_path2.default.isAbsolute(filename)) {
- var fileContent = void 0;
- try {
- // TODO: check & read HasteFS instead of reading the filesystem:
- // see: https://github.com/facebook/jest/pull/5405#discussion_r164281696
- fileContent = _fs2.default.readFileSync(filename, 'utf8');
- renderedCallsite = getRenderedCallsite(fileContent, topFrame.line, topFrame.column);
- } catch (e) {
- // the file does not exist or is inaccessible, we ignore
- }
- }
- }
- var stacktrace = lines.filter(Boolean).map(function (line) {
- return STACK_INDENT + formatPaths(config, relativeTestPath, trimPaths(line));
- }).join('\n');
- return renderedCallsite + '\n' + stacktrace;
- };
- var formatResultsErrors = exports.formatResultsErrors = function (testResults, config, options, testPath) {
- var failedResults = testResults.reduce(function (errors, result) {
- result.failureMessages.forEach(function (content) {
- return errors.push({ content: content, result: result });
- });
- return errors;
- }, []);
- if (!failedResults.length) {
- return null;
- }
- return failedResults.map(function (_ref) {
- var result = _ref.result,
- content = _ref.content;
- var _separateMessageFromS = separateMessageFromStack(content);
- var message = _separateMessageFromS.message,
- stack = _separateMessageFromS.stack;
- stack = options.noStackTrace ? '' : STACK_TRACE_COLOR(formatStackTrace(stack, config, options, testPath)) + '\n';
- message = indentAllLines(message, MESSAGE_INDENT);
- var title = _chalk2.default.bold.red(TITLE_INDENT + TITLE_BULLET + result.ancestorTitles.join(ANCESTRY_SEPARATOR) + (result.ancestorTitles.length ? ANCESTRY_SEPARATOR : '') + result.title) + '\n';
- return title + '\n' + message + '\n' + stack;
- }).join('\n');
- };
- // jasmine and worker farm sometimes don't give us access to the actual
- // Error object, so we have to regexp out the message from the stack string
- // to format it.
- var separateMessageFromStack = exports.separateMessageFromStack = function (content) {
- if (!content) {
- return { message: '', stack: '' };
- }
- var messageMatch = content.match(/(^(.|\n)*?(?=\n\s*at\s.*\:\d*\:\d*))/);
- var message = messageMatch ? messageMatch[0] : 'Error';
- var stack = messageMatch ? content.slice(message.length) : content;
- // If the error is a plain error instead of a SyntaxError or TypeError
- // we remove it from the message because it is generally not useful.
- if (message.startsWith(ERROR_TEXT)) {
- message = message.substr(ERROR_TEXT.length);
- }
- return { message: message, stack: stack };
- };
- });
- unwrapExports(build$5);
- var build_1$2 = build$5.separateMessageFromStack;
- var build_2$2 = build$5.formatResultsErrors;
- var build_3$2 = build$5.formatStackTrace;
- var build_4$1 = build$5.getTopFrame;
- var build_5$1 = build$5.getStackTraceLines;
- var build_6$1 = build$5.formatExecError;
- var createMatcher = function createMatcher(matcherName, fromPromise) {
- return function (actual, expected) {
- var value = expected;
- var error = void 0;
- if (fromPromise && isError(actual)) {
- error = actual;
- } else {
- if (typeof actual !== 'function') {
- if (!fromPromise) {
- throw new Error(build_1(matcherName, 'function', build(value)) + '\n\n' + 'Received value must be a function, but instead ' + ('"' + build(actual) + '" was found'));
- }
- } else {
- try {
- actual();
- } catch (e) {
- error = e;
- }
- }
- }
- if (typeof expected === 'string') {
- expected = new RegExp(build_2$1(expected));
- }
- if (typeof expected === 'function') {
- return toThrowMatchingError(matcherName, error, expected);
- } else if (expected && typeof expected.test === 'function') {
- return toThrowMatchingStringOrRegexp(matcherName, error, expected, value);
- } else if (expected && (typeof expected === 'undefined' ? 'undefined' : _typeof(expected)) === 'object') {
- return toThrowMatchingErrorInstance(matcherName, error, expected);
- } else if (expected === undefined) {
- var pass = error !== undefined;
- return {
- message: pass ? function () {
- return build_1('.not' + matcherName, 'function', '') + '\n\n' + 'Expected the function not to throw an error.\n' + printActualErrorMessage(error);
- } : function () {
- return build_1(matcherName, 'function', build(value)) + '\n\n' + 'Expected the function to throw an error.\n' + printActualErrorMessage(error);
- },
- pass: pass
- };
- } else {
- throw new Error(build_1('.not' + matcherName, 'function', build(value)) + '\n\n' + 'Unexpected argument passed.\nExpected: ' + (build_8('string') + ', ' + build_8('Error (type)') + ' or ' + build_8('regexp') + '.\n') + build_7('Got', String(expected), build_8));
- }
- };
- };
- var matchers$1 = {
- toThrow: createMatcher('.toThrow'),
- toThrowError: createMatcher('.toThrowError')
- };
- var toThrowMatchingStringOrRegexp = function toThrowMatchingStringOrRegexp(name, error, pattern, value) {
- if (error && !error.message && !error.name) {
- error = new Error(error);
- }
- var pass = !!(error && error.message.match(pattern));
- var message = pass ? function () {
- return build_1('.not' + name, 'function', build(value)) + '\n\n' + 'Expected the function not to throw an error matching:\n' + (' ' + build_8(value) + '\n') + printActualErrorMessage(error);
- } : function () {
- return build_1(name, 'function', build(value)) + '\n\n' + 'Expected the function to throw an error matching:\n' + (' ' + build_8(value) + '\n') + printActualErrorMessage(error);
- };
- return { message: message, pass: pass };
- };
- var toThrowMatchingErrorInstance = function toThrowMatchingErrorInstance(name, error, expectedError) {
- if (error && !error.message && !error.name) {
- error = new Error(error);
- }
- var pass = equals(error, expectedError);
- var message = pass ? function () {
- return build_1('.not' + name, 'function', 'error') + '\n\n' + 'Expected the function not to throw an error matching:\n' + (' ' + build_8(expectedError) + '\n') + printActualErrorMessage(error);
- } : function () {
- return build_1(name, 'function', 'error') + '\n\n' + 'Expected the function to throw an error matching:\n' + (' ' + build_8(expectedError) + '\n') + printActualErrorMessage(error);
- };
- return { message: message, pass: pass };
- };
- var toThrowMatchingError = function toThrowMatchingError(name, error, ErrorClass) {
- var pass = !!(error && error instanceof ErrorClass);
- var message = pass ? function () {
- return build_1('.not' + name, 'function', 'type') + '\n\n' + 'Expected the function not to throw an error of type:\n' + (' ' + build_8(ErrorClass.name) + '\n') + printActualErrorMessage(error);
- } : function () {
- return build_1(name, 'function', 'type') + '\n\n' + 'Expected the function to throw an error of type:\n' + (' ' + build_8(ErrorClass.name) + '\n') + printActualErrorMessage(error);
- };
- return { message: message, pass: pass };
- };
- var printActualErrorMessage = function printActualErrorMessage(error) {
- if (error) {
- var _separateMessageFromS = build_1$2(error.stack),
- message = _separateMessageFromS.message,
- stack = _separateMessageFromS.stack;
- return 'Instead, it threw:\n' + build_14(' ' + build_10(message) + build_3$2(stack, {
- rootDir: process$3.cwd(),
- testMatch: []
- }, {
- noStackTrace: false
- }));
- }
- return 'But it didn\'t throw anything.';
- };
- var createClass = createCommonjsModule(function (module, exports) {
- exports.__esModule = true;
- var _defineProperty2 = _interopRequireDefault(defineProperty$2);
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
- exports.default = 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;
- (0, _defineProperty2.default)(target, descriptor.key, descriptor);
- }
- }
- return function (Constructor, protoProps, staticProps) {
- if (protoProps) defineProperties(Constructor.prototype, protoProps);
- if (staticProps) defineProperties(Constructor, staticProps);
- return Constructor;
- };
- }();
- });
- var _createClass = unwrapExports(createClass);
- var AsymmetricMatcher = function AsymmetricMatcher() {
- _classCallCheck(this, AsymmetricMatcher);
- this.$$typeof = _Symbol$for('jest.asymmetricMatcher');
- };
- var Any = function (_AsymmetricMatcher) {
- _inherits(Any, _AsymmetricMatcher);
- function Any(sample) {
- _classCallCheck(this, Any);
- var _this = _possibleConstructorReturn(this, (Any.__proto__ || _Object$getPrototypeOf(Any)).call(this));
- if (typeof sample === 'undefined') {
- throw new TypeError('any() expects to be passed a constructor function. ' + 'Please pass one or use anything() to match any object.');
- }
- _this.sample = sample;
- return _this;
- }
- _createClass(Any, [{
- key: 'asymmetricMatch',
- value: function asymmetricMatch(other) {
- if (this.sample == String) {
- return typeof other == 'string' || other instanceof String;
- }
- if (this.sample == Number) {
- return typeof other == 'number' || other instanceof Number;
- }
- if (this.sample == Function) {
- return typeof other == 'function' || other instanceof Function;
- }
- if (this.sample == Object) {
- return (typeof other === 'undefined' ? 'undefined' : _typeof(other)) == 'object';
- }
- if (this.sample == Boolean) {
- return typeof other == 'boolean';
- }
- return other instanceof this.sample;
- }
- }, {
- key: 'toString',
- value: function toString() {
- return 'Any';
- }
- }, {
- key: 'getExpectedType',
- value: function getExpectedType() {
- if (this.sample == String) {
- return 'string';
- }
- if (this.sample == Number) {
- return 'number';
- }
- if (this.sample == Function) {
- return 'function';
- }
- if (this.sample == Object) {
- return 'object';
- }
- if (this.sample == Boolean) {
- return 'boolean';
- }
- return fnNameFor(this.sample);
- }
- }, {
- key: 'toAsymmetricMatcher',
- value: function toAsymmetricMatcher() {
- return 'Any<' + fnNameFor(this.sample) + '>';
- }
- }]);
- return Any;
- }(AsymmetricMatcher);
- var Anything = function (_AsymmetricMatcher2) {
- _inherits(Anything, _AsymmetricMatcher2);
- function Anything() {
- _classCallCheck(this, Anything);
- return _possibleConstructorReturn(this, (Anything.__proto__ || _Object$getPrototypeOf(Anything)).apply(this, arguments));
- }
- _createClass(Anything, [{
- key: 'asymmetricMatch',
- value: function asymmetricMatch(other) {
- return !isUndefined(other) && other !== null;
- }
- }, {
- key: 'toString',
- value: function toString() {
- return 'Anything';
- }
- // No getExpectedType method, because it matches either null or undefined.
- }, {
- key: 'toAsymmetricMatcher',
- value: function toAsymmetricMatcher() {
- return 'Anything';
- }
- }]);
- return Anything;
- }(AsymmetricMatcher);
- var ArrayContaining = function (_AsymmetricMatcher3) {
- _inherits(ArrayContaining, _AsymmetricMatcher3);
- function ArrayContaining(sample) {
- var inverse = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
- _classCallCheck(this, ArrayContaining);
- var _this3 = _possibleConstructorReturn(this, (ArrayContaining.__proto__ || _Object$getPrototypeOf(ArrayContaining)).call(this));
- _this3.sample = sample;
- _this3.inverse = inverse;
- return _this3;
- }
- _createClass(ArrayContaining, [{
- key: 'asymmetricMatch',
- value: function asymmetricMatch(other) {
- if (!Array.isArray(this.sample)) {
- throw new Error('You must provide an array to ' + this.toString() + ', not \'' + _typeof(this.sample) + "'.");
- }
- var result = this.sample.length === 0 || Array.isArray(other) && this.sample.every(function (item) {
- return other.some(function (another) {
- return equals(item, another);
- });
- });
- return this.inverse ? !result : result;
- }
- }, {
- key: 'toString',
- value: function toString() {
- return 'Array' + (this.inverse ? 'Not' : '') + 'Containing';
- }
- }, {
- key: 'getExpectedType',
- value: function getExpectedType() {
- return 'array';
- }
- }]);
- return ArrayContaining;
- }(AsymmetricMatcher);
- var ObjectContaining = function (_AsymmetricMatcher4) {
- _inherits(ObjectContaining, _AsymmetricMatcher4);
- function ObjectContaining(sample) {
- var inverse = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
- _classCallCheck(this, ObjectContaining);
- var _this4 = _possibleConstructorReturn(this, (ObjectContaining.__proto__ || _Object$getPrototypeOf(ObjectContaining)).call(this));
- _this4.sample = sample;
- _this4.inverse = inverse;
- return _this4;
- }
- _createClass(ObjectContaining, [{
- key: 'asymmetricMatch',
- value: function asymmetricMatch(other) {
- if (_typeof(this.sample) !== 'object') {
- throw new Error('You must provide an object to ' + this.toString() + ', not \'' + _typeof(this.sample) + "'.");
- }
- if (this.inverse) {
- for (var property in this.sample) {
- if (hasProperty(other, property) && equals(this.sample[property], other[property]) && !emptyObject(this.sample[property]) && !emptyObject(other[property])) {
- return false;
- }
- }
- return true;
- } else {
- for (var _property in this.sample) {
- if (!hasProperty(other, _property) || !equals(this.sample[_property], other[_property])) {
- return false;
- }
- }
- return true;
- }
- }
- }, {
- key: 'toString',
- value: function toString() {
- return 'Object' + (this.inverse ? 'Not' : '') + 'Containing';
- }
- }, {
- key: 'getExpectedType',
- value: function getExpectedType() {
- return 'object';
- }
- }]);
- return ObjectContaining;
- }(AsymmetricMatcher);
- var StringContaining = function (_AsymmetricMatcher5) {
- _inherits(StringContaining, _AsymmetricMatcher5);
- function StringContaining(sample) {
- var inverse = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
- _classCallCheck(this, StringContaining);
- var _this5 = _possibleConstructorReturn(this, (StringContaining.__proto__ || _Object$getPrototypeOf(StringContaining)).call(this));
- if (!isA('String', sample)) {
- throw new Error('Expected is not a string');
- }
- _this5.sample = sample;
- _this5.inverse = inverse;
- return _this5;
- }
- _createClass(StringContaining, [{
- key: 'asymmetricMatch',
- value: function asymmetricMatch(other) {
- if (!isA('String', other)) {
- throw new Error('Actual is not a string');
- }
- var result = other.includes(this.sample);
- return this.inverse ? !result : result;
- }
- }, {
- key: 'toString',
- value: function toString() {
- return 'String' + (this.inverse ? 'Not' : '') + 'Containing';
- }
- }, {
- key: 'getExpectedType',
- value: function getExpectedType() {
- return 'string';
- }
- }]);
- return StringContaining;
- }(AsymmetricMatcher);
- var StringMatching = function (_AsymmetricMatcher6) {
- _inherits(StringMatching, _AsymmetricMatcher6);
- function StringMatching(sample) {
- var inverse = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
- _classCallCheck(this, StringMatching);
- var _this6 = _possibleConstructorReturn(this, (StringMatching.__proto__ || _Object$getPrototypeOf(StringMatching)).call(this));
- if (!isA('String', sample) && !isA('RegExp', sample)) {
- throw new Error('Expected is not a String or a RegExp');
- }
- _this6.sample = new RegExp(sample);
- _this6.inverse = inverse;
- return _this6;
- }
- _createClass(StringMatching, [{
- key: 'asymmetricMatch',
- value: function asymmetricMatch(other) {
- if (!isA('String', other)) {
- throw new Error('Actual is not a string');
- }
- var result = this.sample.test(other);
- return this.inverse ? !result : result;
- }
- }, {
- key: 'toString',
- value: function toString() {
- return 'String' + (this.inverse ? 'Not' : '') + 'Matching';
- }
- }, {
- key: 'getExpectedType',
- value: function getExpectedType() {
- return 'string';
- }
- }]);
- return StringMatching;
- }(AsymmetricMatcher);
- var any$1 = function any(expectedObject) {
- return new Any(expectedObject);
- };
- var anything = function anything() {
- return new Anything();
- };
- var arrayContaining = function arrayContaining(sample) {
- return new ArrayContaining(sample);
- };
- var arrayNotContaining = function arrayNotContaining(sample) {
- return new ArrayContaining(sample, true);
- };
- var objectContaining = function objectContaining(sample) {
- return new ObjectContaining(sample);
- };
- var objectNotContaining = function objectNotContaining(sample) {
- return new ObjectContaining(sample, true);
- };
- var stringContaining = function stringContaining(expected) {
- return new StringContaining(expected);
- };
- var stringNotContaining = function stringNotContaining(expected) {
- return new StringContaining(expected, true);
- };
- var stringMatching = function stringMatching(expected) {
- return new StringMatching(expected);
- };
- var stringNotMatching = function stringNotMatching(expected) {
- return new StringMatching(expected, true);
- };
- var toConsumableArray = createCommonjsModule(function (module, exports) {
- exports.__esModule = true;
- var _from2 = _interopRequireDefault(from$1);
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
- exports.default = function (arr) {
- if (Array.isArray(arr)) {
- for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) {
- arr2[i] = arr[i];
- }
- return arr2;
- } else {
- return (0, _from2.default)(arr);
- }
- };
- });
- var _toConsumableArray = unwrapExports(toConsumableArray);
- // Global matchers object holds the list of available matchers and
- // the state, that can hold matcher specific values that change over time.
- var JEST_MATCHERS_OBJECT = _Symbol$for('$$jest-matchers-object');
- // Notes a built-in/internal Jest matcher.
- // Jest may override the stack trace of Errors thrown by internal matchers.
- var INTERNAL_MATCHER_FLAG = _Symbol$for('$$jest-internal-matcher');
- if (!global$1[JEST_MATCHERS_OBJECT]) {
- _Object$defineProperty(global$1, JEST_MATCHERS_OBJECT, {
- value: {
- matchers: _Object$create(null),
- state: {
- assertionCalls: 0,
- expectedAssertionsNumber: null,
- isExpectingAssertions: false,
- suppressedErrors: [] // errors that are not thrown immediately.
- }
- }
- });
- }
- var getState = function getState() {
- return global$1[JEST_MATCHERS_OBJECT].state;
- };
- var setState = function setState(state) {
- _Object$assign(global$1[JEST_MATCHERS_OBJECT].state, state);
- };
- var getMatchers = function getMatchers() {
- return global$1[JEST_MATCHERS_OBJECT].matchers;
- };
- var setMatchers = function setMatchers(matchers, isInternal, expect) {
- _Object$keys(matchers).forEach(function (key) {
- var matcher = matchers[key];
- _Object$defineProperty(matcher, INTERNAL_MATCHER_FLAG, {
- value: isInternal
- });
- if (!isInternal) {
- // expect is defined
- var CustomMatcher = function (_AsymmetricMatcher) {
- _inherits(CustomMatcher, _AsymmetricMatcher);
- function CustomMatcher() {
- var inverse = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
- _classCallCheck(this, CustomMatcher);
- var _this = _possibleConstructorReturn(this, (CustomMatcher.__proto__ || _Object$getPrototypeOf(CustomMatcher)).call(this));
- _this.inverse = inverse;
- for (var _len = arguments.length, sample = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
- sample[_key - 1] = arguments[_key];
- }
- _this.sample = sample;
- return _this;
- }
- _createClass(CustomMatcher, [{
- key: 'asymmetricMatch',
- value: function asymmetricMatch(other) {
- var _matcher = matcher.apply(undefined, [other].concat(_toConsumableArray(this.sample))),
- pass = _matcher.pass;
- return this.inverse ? !pass : pass;
- }
- }, {
- key: 'toString',
- value: function toString() {
- return '' + (this.inverse ? 'not.' : '') + key;
- }
- }, {
- key: 'getExpectedType',
- value: function getExpectedType() {
- return 'any';
- }
- }, {
- key: 'toAsymmetricMatcher',
- value: function toAsymmetricMatcher() {
- return this.toString() + '<' + this.sample.join(', ') + '>';
- }
- }]);
- return CustomMatcher;
- }(AsymmetricMatcher);
- expect[key] = function () {
- for (var _len2 = arguments.length, sample = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
- sample[_key2] = arguments[_key2];
- }
- return new (Function.prototype.bind.apply(CustomMatcher, [null].concat([false], sample)))();
- };
- if (!expect.not) {
- expect.not = {};
- }
- expect.not[key] = function () {
- for (var _len3 = arguments.length, sample = Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
- sample[_key3] = arguments[_key3];
- }
- return new (Function.prototype.bind.apply(CustomMatcher, [null].concat([true], sample)))();
- };
- }
- });
- _Object$assign(global$1[JEST_MATCHERS_OBJECT].matchers, matchers);
- };
- var resetAssertionsLocalState = function resetAssertionsLocalState() {
- setState({
- assertionCalls: 0,
- expectedAssertionsNumber: null,
- isExpectingAssertions: false
- });
- };
- // Create and format all errors related to the mismatched number of `expect`
- // calls and reset the matcher's state.
- var extractExpectedAssertionsErrors = function extractExpectedAssertionsErrors() {
- var result = [];
- var _getState = getState(),
- assertionCalls = _getState.assertionCalls,
- expectedAssertionsNumber = _getState.expectedAssertionsNumber,
- expectedAssertionsNumberError = _getState.expectedAssertionsNumberError,
- isExpectingAssertions = _getState.isExpectingAssertions,
- isExpectingAssertionsError = _getState.isExpectingAssertionsError;
- resetAssertionsLocalState();
- if (typeof expectedAssertionsNumber === 'number' && assertionCalls !== expectedAssertionsNumber) {
- var numOfAssertionsExpected = build_15(build_2('assertion', expectedAssertionsNumber));
- expectedAssertionsNumberError.message = build_1('.assertions', '', String(expectedAssertionsNumber), {
- isDirectExpectCall: true
- }) + '\n\n' + ('Expected ' + numOfAssertionsExpected + ' to be called but received ') + build_14(build_2('assertion call', assertionCalls || 0)) + '.';
- result.push({
- actual: assertionCalls,
- error: expectedAssertionsNumberError,
- expected: expectedAssertionsNumber
- });
- }
- if (isExpectingAssertions && assertionCalls === 0) {
- var expected = build_15('at least one assertion');
- var received = build_14('received none');
- isExpectingAssertionsError.message = build_1('.hasAssertions', '', '', {
- isDirectExpectCall: true
- }) + '\n\n' + ('Expected ' + expected + ' to be called but ' + received + '.');
- result.push({
- actual: 'none',
- error: isExpectingAssertionsError,
- expected: 'at least one'
- });
- }
- return result;
- };
- var JestAssertionError = function (_Error) {
- _inherits(JestAssertionError, _Error);
- function JestAssertionError() {
- _classCallCheck(this, JestAssertionError);
- return _possibleConstructorReturn(this, (JestAssertionError.__proto__ || _Object$getPrototypeOf(JestAssertionError)).apply(this, arguments));
- }
- return JestAssertionError;
- }(Error);
- var isPromise = function isPromise(obj) {
- return !!obj && ((typeof obj === 'undefined' ? 'undefined' : _typeof(obj)) === 'object' || typeof obj === 'function') && typeof obj.then === 'function';
- };
- var createToThrowErrorMatchingSnapshotMatcher = function createToThrowErrorMatchingSnapshotMatcher(matcher) {
- return function (received, testNameOrInlineSnapshot) {
- return matcher.apply(this, [received, testNameOrInlineSnapshot, true]);
- };
- };
- var getPromiseMatcher = function getPromiseMatcher(name, matcher) {
- if (name === 'toThrow' || name === 'toThrowError') {
- return createMatcher('.' + name, true);
- } else if (name === 'toThrowErrorMatchingSnapshot' || name === 'toThrowErrorMatchingInlineSnapshot') {
- return createToThrowErrorMatchingSnapshotMatcher(matcher);
- }
- return null;
- };
- var expect = function expect(actual) {
- if ((arguments.length <= 1 ? 0 : arguments.length - 1) !== 0) {
- throw new Error('Expect takes at most one argument.');
- }
- var allMatchers = getMatchers();
- var expectation = {
- not: {},
- rejects: { not: {} },
- resolves: { not: {} }
- };
- var err = new JestAssertionError();
- _Object$keys(allMatchers).forEach(function (name) {
- var matcher = allMatchers[name];
- var promiseMatcher = getPromiseMatcher(name, matcher) || matcher;
- expectation[name] = makeThrowingMatcher(matcher, false, actual);
- expectation.not[name] = makeThrowingMatcher(matcher, true, actual);
- expectation.resolves[name] = makeResolveMatcher(name, promiseMatcher, false, actual, err);
- expectation.resolves.not[name] = makeResolveMatcher(name, promiseMatcher, true, actual, err);
- expectation.rejects[name] = makeRejectMatcher(name, promiseMatcher, false, actual, err);
- expectation.rejects.not[name] = makeRejectMatcher(name, promiseMatcher, true, actual, err);
- });
- return expectation;
- };
- var getMessage = function getMessage(message) {
- return message && message() || build_14('No message was specified for this matcher.');
- };
- var makeResolveMatcher = function makeResolveMatcher(matcherName, matcher, isNot, actual, outerErr) {
- return function () {
- for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
- args[_key] = arguments[_key];
- }
- var matcherStatement = '.resolves.' + (isNot ? 'not.' : '') + matcherName;
- if (!isPromise(actual)) {
- throw new JestAssertionError(build_1(matcherStatement, 'received', '') + '\n\n' + (build_14('received') + ' value must be a Promise.\n') + build_7('Received', actual, build_9));
- }
- var innerErr = new JestAssertionError();
- return actual.then(function (result) {
- return makeThrowingMatcher(matcher, isNot, result, innerErr).apply(null, args);
- }, function (reason) {
- outerErr.message = build_1(matcherStatement, 'received', '') + '\n\n' + ('Expected ' + build_14('received') + ' Promise to resolve, ') + 'instead it rejected to value\n' + (' ' + build_9(reason));
- return _Promise.reject(outerErr);
- });
- };
- };
- var makeRejectMatcher = function makeRejectMatcher(matcherName, matcher, isNot, actual, outerErr) {
- return function () {
- for (var _len2 = arguments.length, args = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
- args[_key2] = arguments[_key2];
- }
- var matcherStatement = '.rejects.' + (isNot ? 'not.' : '') + matcherName;
- if (!isPromise(actual)) {
- throw new JestAssertionError(build_1(matcherStatement, 'received', '') + '\n\n' + (build_14('received') + ' value must be a Promise.\n') + build_7('Received', actual, build_9));
- }
- var innerErr = new JestAssertionError();
- return actual.then(function (result) {
- outerErr.message = build_1(matcherStatement, 'received', '') + '\n\n' + ('Expected ' + build_14('received') + ' Promise to reject, ') + 'instead it resolved to value\n' + (' ' + build_9(result));
- return _Promise.reject(outerErr);
- }, function (reason) {
- return makeThrowingMatcher(matcher, isNot, reason, innerErr).apply(null, args);
- });
- };
- };
- var makeThrowingMatcher = function makeThrowingMatcher(matcher, isNot, actual, err) {
- return function throwingMatcher() {
- var throws = true;
- var utils = _Object$assign({}, matcherUtils, {
- iterableEquality: iterableEquality,
- subsetEquality: subsetEquality
- });
- var matcherContext = _Object$assign(
- // When throws is disabled, the matcher will not throw errors during test
- // execution but instead add them to the global matcher state. If a
- // matcher throws, test execution is normally stopped immediately. The
- // snapshot matcher uses it because we want to log all snapshot
- // failures in a test.
- { dontThrow: function dontThrow() {
- return throws = false;
- } }, getState(), {
- equals: equals,
- error: err,
- isNot: isNot,
- utils: utils
- });
- var processResult = function processResult(result) {
- _validateResult(result);
- getState().assertionCalls++;
- if (result.pass && isNot || !result.pass && !isNot) {
- // XOR
- var message = getMessage(result.message);
- var error = void 0;
- if (err) {
- error = err;
- error.message = message;
- } else {
- error = new JestAssertionError(message);
- // Try to remove this function from the stack trace frame.
- // Guard for some environments (browsers) that do not support this feature.
- if (Error.captureStackTrace) {
- Error.captureStackTrace(error, throwingMatcher);
- }
- }
- // Passing the result of the matcher with the error so that a custom
- // reporter could access the actual and expected objects of the result
- // for example in order to display a custom visual diff
- error.matcherResult = result;
- if (throws) {
- throw error;
- } else {
- getState().suppressedErrors.push(error);
- }
- }
- };
- var handlError = function handlError(error) {
- if (matcher[INTERNAL_MATCHER_FLAG] === true && !(error instanceof JestAssertionError) && error.name !== 'PrettyFormatPluginError' &&
- // Guard for some environments (browsers) that do not support this feature.
- Error.captureStackTrace) {
- // Try to remove this and deeper functions from the stack trace frame.
- Error.captureStackTrace(error, throwingMatcher);
- }
- throw error;
- };
- var potentialResult = void 0;
- try {
- for (var _len3 = arguments.length, args = Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
- args[_key3] = arguments[_key3];
- }
- potentialResult = matcher.apply(matcherContext, [actual].concat(args));
- if (isPromise(potentialResult)) {
- var asyncResult = potentialResult;
- return asyncResult.then(function (aResult) {
- return processResult(aResult);
- }).catch(function (error) {
- return handlError(error);
- });
- } else {
- var syncResult = potentialResult;
- return processResult(syncResult);
- }
- } catch (error) {
- return handlError(error);
- }
- };
- };
- expect.extend = function (matchers$$1) {
- return setMatchers(matchers$$1, false, expect);
- };
- expect.anything = anything;
- expect.any = any$1;
- expect.not = {
- arrayContaining: arrayNotContaining,
- objectContaining: objectNotContaining,
- stringContaining: stringNotContaining,
- stringMatching: stringNotMatching
- };
- expect.objectContaining = objectContaining;
- expect.arrayContaining = arrayContaining;
- expect.stringContaining = stringContaining;
- expect.stringMatching = stringMatching;
- var _validateResult = function _validateResult(result) {
- if ((typeof result === 'undefined' ? 'undefined' : _typeof(result)) !== 'object' || typeof result.pass !== 'boolean' || result.message && typeof result.message !== 'string' && typeof result.message !== 'function') {
- throw new Error('Unexpected return from a matcher function.\n' + 'Matcher functions should ' + 'return an object in the following format:\n' + ' {message?: string | function, pass: boolean}\n' + ('\'' + build_11(result) + '\' was returned'));
- }
- };
- function assertions(expected) {
- var error = new Error();
- if (Error.captureStackTrace) {
- Error.captureStackTrace(error, assertions);
- }
- getState().expectedAssertionsNumber = expected;
- getState().expectedAssertionsNumberError = error;
- }
- function hasAssertions() {
- var error = new Error();
- if (Error.captureStackTrace) {
- Error.captureStackTrace(error, hasAssertions);
- }
- build_6(arguments.length <= 0 ? undefined : arguments[0], '.hasAssertions');
- getState().isExpectingAssertions = true;
- getState().isExpectingAssertionsError = error;
- }
- // add default jest matchers
- setMatchers(matchers, true, expect);
- setMatchers(spyMatchers, true, expect);
- setMatchers(matchers$1, true, expect);
- expect.addSnapshotSerializer = function () {
- return void 0;
- };
- expect.assertions = assertions;
- expect.hasAssertions = hasAssertions;
- expect.getState = getState;
- expect.setState = setState;
- expect.extractExpectedAssertionsErrors = extractExpectedAssertionsErrors;
- module.exports = expect;
- })));
|