mocha.js 566 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279152801528115282152831528415285152861528715288152891529015291152921529315294152951529615297152981529915300153011530215303153041530515306153071530815309153101531115312153131531415315153161531715318153191532015321153221532315324153251532615327153281532915330153311533215333153341533515336153371533815339153401534115342153431534415345153461534715348153491535015351153521535315354153551535615357153581535915360153611536215363153641536515366153671536815369153701537115372153731537415375153761537715378153791538015381153821538315384153851538615387153881538915390153911539215393153941539515396153971539815399154001540115402154031540415405154061540715408154091541015411154121541315414154151541615417154181541915420154211542215423154241542515426154271542815429154301543115432154331543415435154361543715438154391544015441154421544315444154451544615447154481544915450154511545215453154541545515456154571545815459154601546115462154631546415465154661546715468154691547015471154721547315474154751547615477154781547915480154811548215483154841548515486154871548815489154901549115492154931549415495154961549715498154991550015501155021550315504155051550615507155081550915510155111551215513155141551515516155171551815519155201552115522155231552415525155261552715528155291553015531155321553315534155351553615537155381553915540155411554215543155441554515546155471554815549155501555115552155531555415555155561555715558155591556015561155621556315564155651556615567155681556915570155711557215573155741557515576155771557815579155801558115582155831558415585155861558715588155891559015591155921559315594155951559615597155981559915600156011560215603156041560515606156071560815609156101561115612156131561415615156161561715618156191562015621156221562315624156251562615627156281562915630156311563215633156341563515636156371563815639156401564115642156431564415645156461564715648156491565015651156521565315654156551565615657156581565915660156611566215663156641566515666156671566815669156701567115672156731567415675156761567715678156791568015681156821568315684156851568615687156881568915690156911569215693156941569515696156971569815699157001570115702157031570415705157061570715708157091571015711157121571315714157151571615717157181571915720157211572215723157241572515726157271572815729157301573115732157331573415735157361573715738157391574015741157421574315744157451574615747157481574915750157511575215753157541575515756157571575815759157601576115762157631576415765157661576715768157691577015771157721577315774157751577615777157781577915780157811578215783157841578515786157871578815789157901579115792157931579415795157961579715798157991580015801158021580315804158051580615807158081580915810158111581215813158141581515816158171581815819158201582115822158231582415825158261582715828158291583015831158321583315834158351583615837158381583915840158411584215843158441584515846158471584815849158501585115852158531585415855158561585715858158591586015861158621586315864158651586615867158681586915870158711587215873158741587515876158771587815879158801588115882158831588415885158861588715888158891589015891158921589315894158951589615897158981589915900159011590215903159041590515906159071590815909159101591115912159131591415915159161591715918159191592015921159221592315924159251592615927159281592915930159311593215933159341593515936159371593815939159401594115942159431594415945159461594715948159491595015951159521595315954159551595615957159581595915960159611596215963159641596515966159671596815969159701597115972159731597415975159761597715978159791598015981159821598315984159851598615987159881598915990159911599215993159941599515996159971599815999160001600116002160031600416005160061600716008160091601016011160121601316014160151601616017160181601916020160211602216023160241602516026160271602816029160301603116032160331603416035160361603716038160391604016041160421604316044160451604616047160481604916050160511605216053160541605516056160571605816059160601606116062160631606416065160661606716068160691607016071160721607316074160751607616077160781607916080160811608216083160841608516086160871608816089160901609116092160931609416095160961609716098160991610016101161021610316104161051610616107161081610916110161111611216113161141611516116161171611816119161201612116122161231612416125161261612716128161291613016131161321613316134161351613616137161381613916140161411614216143161441614516146161471614816149161501615116152161531615416155161561615716158161591616016161161621616316164161651616616167161681616916170161711617216173161741617516176161771617816179161801618116182161831618416185161861618716188161891619016191161921619316194161951619616197161981619916200162011620216203162041620516206162071620816209162101621116212162131621416215162161621716218162191622016221162221622316224162251622616227162281622916230162311623216233162341623516236162371623816239162401624116242162431624416245162461624716248162491625016251162521625316254162551625616257162581625916260162611626216263162641626516266162671626816269162701627116272162731627416275162761627716278162791628016281162821628316284162851628616287162881628916290162911629216293162941629516296162971629816299163001630116302163031630416305163061630716308163091631016311163121631316314163151631616317163181631916320163211632216323163241632516326163271632816329163301633116332163331633416335163361633716338163391634016341163421634316344163451634616347163481634916350163511635216353163541635516356163571635816359163601636116362163631636416365163661636716368163691637016371163721637316374163751637616377163781637916380163811638216383163841638516386163871638816389163901639116392163931639416395163961639716398163991640016401164021640316404164051640616407164081640916410164111641216413164141641516416164171641816419164201642116422164231642416425164261642716428164291643016431164321643316434164351643616437164381643916440164411644216443164441644516446164471644816449164501645116452164531645416455164561645716458164591646016461164621646316464164651646616467164681646916470164711647216473164741647516476164771647816479164801648116482164831648416485164861648716488164891649016491164921649316494164951649616497164981649916500165011650216503165041650516506165071650816509165101651116512165131651416515165161651716518165191652016521165221652316524165251652616527165281652916530165311653216533165341653516536165371653816539165401654116542165431654416545165461654716548165491655016551165521655316554165551655616557165581655916560165611656216563165641656516566165671656816569165701657116572165731657416575165761657716578165791658016581165821658316584165851658616587165881658916590165911659216593165941659516596165971659816599166001660116602166031660416605166061660716608166091661016611166121661316614166151661616617166181661916620166211662216623166241662516626166271662816629166301663116632166331663416635166361663716638166391664016641166421664316644166451664616647166481664916650166511665216653166541665516656166571665816659166601666116662166631666416665166661666716668166691667016671166721667316674166751667616677166781667916680166811668216683166841668516686166871668816689166901669116692166931669416695166961669716698166991670016701167021670316704167051670616707167081670916710167111671216713167141671516716167171671816719167201672116722167231672416725167261672716728167291673016731167321673316734167351673616737167381673916740167411674216743167441674516746167471674816749167501675116752167531675416755167561675716758167591676016761167621676316764167651676616767167681676916770167711677216773167741677516776167771677816779167801678116782167831678416785167861678716788167891679016791167921679316794167951679616797167981679916800168011680216803168041680516806168071680816809168101681116812168131681416815168161681716818168191682016821168221682316824168251682616827168281682916830168311683216833168341683516836168371683816839168401684116842168431684416845168461684716848168491685016851168521685316854168551685616857168581685916860168611686216863168641686516866168671686816869168701687116872168731687416875168761687716878168791688016881168821688316884168851688616887168881688916890168911689216893168941689516896168971689816899169001690116902169031690416905169061690716908169091691016911169121691316914169151691616917169181691916920169211692216923169241692516926169271692816929169301693116932169331693416935169361693716938169391694016941169421694316944169451694616947169481694916950169511695216953169541695516956169571695816959169601696116962169631696416965169661696716968169691697016971169721697316974169751697616977169781697916980169811698216983169841698516986169871698816989169901699116992169931699416995169961699716998169991700017001170021700317004170051700617007170081700917010170111701217013170141701517016170171701817019170201702117022170231702417025170261702717028170291703017031170321703317034170351703617037170381703917040170411704217043170441704517046170471704817049170501705117052170531705417055170561705717058170591706017061170621706317064170651706617067170681706917070170711707217073170741707517076170771707817079170801708117082170831708417085170861708717088170891709017091170921709317094170951709617097170981709917100171011710217103171041710517106171071710817109171101711117112171131711417115171161711717118171191712017121171221712317124171251712617127171281712917130171311713217133171341713517136171371713817139171401714117142171431714417145171461714717148171491715017151171521715317154171551715617157171581715917160171611716217163171641716517166171671716817169171701717117172171731717417175171761717717178171791718017181171821718317184171851718617187171881718917190171911719217193171941719517196171971719817199172001720117202172031720417205172061720717208172091721017211172121721317214172151721617217172181721917220172211722217223172241722517226172271722817229172301723117232172331723417235172361723717238172391724017241172421724317244172451724617247172481724917250172511725217253172541725517256172571725817259172601726117262172631726417265172661726717268172691727017271172721727317274172751727617277172781727917280172811728217283172841728517286172871728817289172901729117292172931729417295172961729717298172991730017301173021730317304173051730617307173081730917310173111731217313173141731517316173171731817319173201732117322173231732417325173261732717328173291733017331173321733317334173351733617337173381733917340173411734217343173441734517346173471734817349173501735117352173531735417355173561735717358173591736017361173621736317364173651736617367173681736917370173711737217373173741737517376173771737817379173801738117382173831738417385173861738717388173891739017391173921739317394173951739617397173981739917400174011740217403174041740517406174071740817409174101741117412174131741417415174161741717418174191742017421174221742317424174251742617427174281742917430174311743217433174341743517436174371743817439174401744117442174431744417445174461744717448174491745017451174521745317454174551745617457174581745917460174611746217463174641746517466174671746817469174701747117472174731747417475174761747717478174791748017481174821748317484174851748617487174881748917490174911749217493174941749517496174971749817499175001750117502175031750417505175061750717508175091751017511175121751317514175151751617517175181751917520175211752217523175241752517526175271752817529175301753117532175331753417535175361753717538175391754017541175421754317544175451754617547175481754917550175511755217553175541755517556175571755817559175601756117562175631756417565175661756717568175691757017571175721757317574175751757617577175781757917580175811758217583175841758517586175871758817589175901759117592175931759417595175961759717598175991760017601176021760317604176051760617607176081760917610176111761217613176141761517616176171761817619176201762117622176231762417625176261762717628176291763017631176321763317634176351763617637176381763917640176411764217643176441764517646176471764817649176501765117652176531765417655176561765717658176591766017661176621766317664176651766617667176681766917670176711767217673176741767517676176771767817679176801768117682176831768417685176861768717688176891769017691176921769317694176951769617697176981769917700177011770217703177041770517706177071770817709177101771117712177131771417715177161771717718177191772017721177221772317724177251772617727177281772917730177311773217733177341773517736177371773817739177401774117742177431774417745177461774717748177491775017751177521775317754177551775617757177581775917760177611776217763177641776517766177671776817769177701777117772177731777417775177761777717778177791778017781177821778317784177851778617787177881778917790177911779217793177941779517796177971779817799178001780117802178031780417805178061780717808178091781017811178121781317814178151781617817178181781917820178211782217823178241782517826178271782817829178301783117832178331783417835178361783717838178391784017841178421784317844178451784617847178481784917850178511785217853178541785517856178571785817859178601786117862178631786417865178661786717868178691787017871178721787317874178751787617877178781787917880178811788217883178841788517886178871788817889178901789117892178931789417895178961789717898178991790017901179021790317904179051790617907179081790917910
  1. (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
  2. (function (process,global){
  3. 'use strict';
  4. /* eslint no-unused-vars: off */
  5. /* eslint-env commonjs */
  6. /**
  7. * Shim process.stdout.
  8. */
  9. process.stdout = require('browser-stdout')({label: false});
  10. var Mocha = require('./lib/mocha');
  11. /**
  12. * Create a Mocha instance.
  13. *
  14. * @return {undefined}
  15. */
  16. var mocha = new Mocha({reporter: 'html'});
  17. /**
  18. * Save timer references to avoid Sinon interfering (see GH-237).
  19. */
  20. var Date = global.Date;
  21. var setTimeout = global.setTimeout;
  22. var setInterval = global.setInterval;
  23. var clearTimeout = global.clearTimeout;
  24. var clearInterval = global.clearInterval;
  25. var uncaughtExceptionHandlers = [];
  26. var originalOnerrorHandler = global.onerror;
  27. /**
  28. * Remove uncaughtException listener.
  29. * Revert to original onerror handler if previously defined.
  30. */
  31. process.removeListener = function(e, fn) {
  32. if (e === 'uncaughtException') {
  33. if (originalOnerrorHandler) {
  34. global.onerror = originalOnerrorHandler;
  35. } else {
  36. global.onerror = function() {};
  37. }
  38. var i = uncaughtExceptionHandlers.indexOf(fn);
  39. if (i !== -1) {
  40. uncaughtExceptionHandlers.splice(i, 1);
  41. }
  42. }
  43. };
  44. /**
  45. * Implements uncaughtException listener.
  46. */
  47. process.on = function(e, fn) {
  48. if (e === 'uncaughtException') {
  49. global.onerror = function(err, url, line) {
  50. fn(new Error(err + ' (' + url + ':' + line + ')'));
  51. return !mocha.allowUncaught;
  52. };
  53. uncaughtExceptionHandlers.push(fn);
  54. }
  55. };
  56. // The BDD UI is registered by default, but no UI will be functional in the
  57. // browser without an explicit call to the overridden `mocha.ui` (see below).
  58. // Ensure that this default UI does not expose its methods to the global scope.
  59. mocha.suite.removeAllListeners('pre-require');
  60. var immediateQueue = [];
  61. var immediateTimeout;
  62. function timeslice() {
  63. var immediateStart = new Date().getTime();
  64. while (immediateQueue.length && new Date().getTime() - immediateStart < 100) {
  65. immediateQueue.shift()();
  66. }
  67. if (immediateQueue.length) {
  68. immediateTimeout = setTimeout(timeslice, 0);
  69. } else {
  70. immediateTimeout = null;
  71. }
  72. }
  73. /**
  74. * High-performance override of Runner.immediately.
  75. */
  76. Mocha.Runner.immediately = function(callback) {
  77. immediateQueue.push(callback);
  78. if (!immediateTimeout) {
  79. immediateTimeout = setTimeout(timeslice, 0);
  80. }
  81. };
  82. /**
  83. * Function to allow assertion libraries to throw errors directly into mocha.
  84. * This is useful when running tests in a browser because window.onerror will
  85. * only receive the 'message' attribute of the Error.
  86. */
  87. mocha.throwError = function(err) {
  88. uncaughtExceptionHandlers.forEach(function(fn) {
  89. fn(err);
  90. });
  91. throw err;
  92. };
  93. /**
  94. * Override ui to ensure that the ui functions are initialized.
  95. * Normally this would happen in Mocha.prototype.loadFiles.
  96. */
  97. mocha.ui = function(ui) {
  98. Mocha.prototype.ui.call(this, ui);
  99. this.suite.emit('pre-require', global, null, this);
  100. return this;
  101. };
  102. /**
  103. * Setup mocha with the given setting options.
  104. */
  105. mocha.setup = function(opts) {
  106. if (typeof opts === 'string') {
  107. opts = {ui: opts};
  108. }
  109. for (var opt in opts) {
  110. if (opts.hasOwnProperty(opt)) {
  111. this[opt](opts[opt]);
  112. }
  113. }
  114. return this;
  115. };
  116. /**
  117. * Run mocha, returning the Runner.
  118. */
  119. mocha.run = function(fn) {
  120. var options = mocha.options;
  121. mocha.globals('location');
  122. var query = Mocha.utils.parseQuery(global.location.search || '');
  123. if (query.grep) {
  124. mocha.grep(query.grep);
  125. }
  126. if (query.fgrep) {
  127. mocha.fgrep(query.fgrep);
  128. }
  129. if (query.invert) {
  130. mocha.invert();
  131. }
  132. return Mocha.prototype.run.call(mocha, function(err) {
  133. // The DOM Document is not available in Web Workers.
  134. var document = global.document;
  135. if (
  136. document &&
  137. document.getElementById('mocha') &&
  138. options.noHighlighting !== true
  139. ) {
  140. Mocha.utils.highlightTags('code');
  141. }
  142. if (fn) {
  143. fn(err);
  144. }
  145. });
  146. };
  147. /**
  148. * Expose the process shim.
  149. * https://github.com/mochajs/mocha/pull/916
  150. */
  151. Mocha.process = process;
  152. /**
  153. * Expose mocha.
  154. */
  155. global.Mocha = Mocha;
  156. global.mocha = mocha;
  157. // this allows test/acceptance/required-tokens.js to pass; thus,
  158. // you can now do `const describe = require('mocha').describe` in a
  159. // browser context (assuming browserification). should fix #880
  160. module.exports = global;
  161. }).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
  162. },{"./lib/mocha":14,"_process":68,"browser-stdout":41}],2:[function(require,module,exports){
  163. (function (process,global){
  164. 'use strict';
  165. /**
  166. * Web Notifications module.
  167. * @module Growl
  168. */
  169. /**
  170. * Save timer references to avoid Sinon interfering (see GH-237).
  171. */
  172. var Date = global.Date;
  173. var setTimeout = global.setTimeout;
  174. var EVENT_RUN_END = require('../runner').constants.EVENT_RUN_END;
  175. /**
  176. * Checks if browser notification support exists.
  177. *
  178. * @public
  179. * @see {@link https://caniuse.com/#feat=notifications|Browser support (notifications)}
  180. * @see {@link https://caniuse.com/#feat=promises|Browser support (promises)}
  181. * @see {@link Mocha#growl}
  182. * @see {@link Mocha#isGrowlCapable}
  183. * @return {boolean} whether browser notification support exists
  184. */
  185. exports.isCapable = function() {
  186. var hasNotificationSupport = 'Notification' in window;
  187. var hasPromiseSupport = typeof Promise === 'function';
  188. return process.browser && hasNotificationSupport && hasPromiseSupport;
  189. };
  190. /**
  191. * Implements browser notifications as a pseudo-reporter.
  192. *
  193. * @public
  194. * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/notification|Notification API}
  195. * @see {@link https://developers.google.com/web/fundamentals/push-notifications/display-a-notification|Displaying a Notification}
  196. * @see {@link Growl#isPermitted}
  197. * @see {@link Mocha#_growl}
  198. * @param {Runner} runner - Runner instance.
  199. */
  200. exports.notify = function(runner) {
  201. var promise = isPermitted();
  202. /**
  203. * Attempt notification.
  204. */
  205. var sendNotification = function() {
  206. // If user hasn't responded yet... "No notification for you!" (Seinfeld)
  207. Promise.race([promise, Promise.resolve(undefined)])
  208. .then(canNotify)
  209. .then(function() {
  210. display(runner);
  211. })
  212. .catch(notPermitted);
  213. };
  214. runner.once(EVENT_RUN_END, sendNotification);
  215. };
  216. /**
  217. * Checks if browser notification is permitted by user.
  218. *
  219. * @private
  220. * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Notification/permission|Notification.permission}
  221. * @see {@link Mocha#growl}
  222. * @see {@link Mocha#isGrowlPermitted}
  223. * @returns {Promise<boolean>} promise determining if browser notification
  224. * permissible when fulfilled.
  225. */
  226. function isPermitted() {
  227. var permitted = {
  228. granted: function allow() {
  229. return Promise.resolve(true);
  230. },
  231. denied: function deny() {
  232. return Promise.resolve(false);
  233. },
  234. default: function ask() {
  235. return Notification.requestPermission().then(function(permission) {
  236. return permission === 'granted';
  237. });
  238. }
  239. };
  240. return permitted[Notification.permission]();
  241. }
  242. /**
  243. * @summary
  244. * Determines if notification should proceed.
  245. *
  246. * @description
  247. * Notification shall <strong>not</strong> proceed unless `value` is true.
  248. *
  249. * `value` will equal one of:
  250. * <ul>
  251. * <li><code>true</code> (from `isPermitted`)</li>
  252. * <li><code>false</code> (from `isPermitted`)</li>
  253. * <li><code>undefined</code> (from `Promise.race`)</li>
  254. * </ul>
  255. *
  256. * @private
  257. * @param {boolean|undefined} value - Determines if notification permissible.
  258. * @returns {Promise<undefined>} Notification can proceed
  259. */
  260. function canNotify(value) {
  261. if (!value) {
  262. var why = value === false ? 'blocked' : 'unacknowledged';
  263. var reason = 'not permitted by user (' + why + ')';
  264. return Promise.reject(new Error(reason));
  265. }
  266. return Promise.resolve();
  267. }
  268. /**
  269. * Displays the notification.
  270. *
  271. * @private
  272. * @param {Runner} runner - Runner instance.
  273. */
  274. function display(runner) {
  275. var stats = runner.stats;
  276. var symbol = {
  277. cross: '\u274C',
  278. tick: '\u2705'
  279. };
  280. var logo = require('../../package').notifyLogo;
  281. var _message;
  282. var message;
  283. var title;
  284. if (stats.failures) {
  285. _message = stats.failures + ' of ' + stats.tests + ' tests failed';
  286. message = symbol.cross + ' ' + _message;
  287. title = 'Failed';
  288. } else {
  289. _message = stats.passes + ' tests passed in ' + stats.duration + 'ms';
  290. message = symbol.tick + ' ' + _message;
  291. title = 'Passed';
  292. }
  293. // Send notification
  294. var options = {
  295. badge: logo,
  296. body: message,
  297. dir: 'ltr',
  298. icon: logo,
  299. lang: 'en-US',
  300. name: 'mocha',
  301. requireInteraction: false,
  302. timestamp: Date.now()
  303. };
  304. var notification = new Notification(title, options);
  305. // Autoclose after brief delay (makes various browsers act same)
  306. var FORCE_DURATION = 4000;
  307. setTimeout(notification.close.bind(notification), FORCE_DURATION);
  308. }
  309. /**
  310. * As notifications are tangential to our purpose, just log the error.
  311. *
  312. * @private
  313. * @param {Error} err - Why notification didn't happen.
  314. */
  315. function notPermitted(err) {
  316. console.error('notification error:', err.message);
  317. }
  318. }).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
  319. },{"../../package":89,"../runner":34,"_process":68}],3:[function(require,module,exports){
  320. 'use strict';
  321. /**
  322. * Expose `Progress`.
  323. */
  324. module.exports = Progress;
  325. /**
  326. * Initialize a new `Progress` indicator.
  327. */
  328. function Progress() {
  329. this.percent = 0;
  330. this.size(0);
  331. this.fontSize(11);
  332. this.font('helvetica, arial, sans-serif');
  333. }
  334. /**
  335. * Set progress size to `size`.
  336. *
  337. * @public
  338. * @param {number} size
  339. * @return {Progress} Progress instance.
  340. */
  341. Progress.prototype.size = function(size) {
  342. this._size = size;
  343. return this;
  344. };
  345. /**
  346. * Set text to `text`.
  347. *
  348. * @public
  349. * @param {string} text
  350. * @return {Progress} Progress instance.
  351. */
  352. Progress.prototype.text = function(text) {
  353. this._text = text;
  354. return this;
  355. };
  356. /**
  357. * Set font size to `size`.
  358. *
  359. * @public
  360. * @param {number} size
  361. * @return {Progress} Progress instance.
  362. */
  363. Progress.prototype.fontSize = function(size) {
  364. this._fontSize = size;
  365. return this;
  366. };
  367. /**
  368. * Set font to `family`.
  369. *
  370. * @param {string} family
  371. * @return {Progress} Progress instance.
  372. */
  373. Progress.prototype.font = function(family) {
  374. this._font = family;
  375. return this;
  376. };
  377. /**
  378. * Update percentage to `n`.
  379. *
  380. * @param {number} n
  381. * @return {Progress} Progress instance.
  382. */
  383. Progress.prototype.update = function(n) {
  384. this.percent = n;
  385. return this;
  386. };
  387. /**
  388. * Draw on `ctx`.
  389. *
  390. * @param {CanvasRenderingContext2d} ctx
  391. * @return {Progress} Progress instance.
  392. */
  393. Progress.prototype.draw = function(ctx) {
  394. try {
  395. var percent = Math.min(this.percent, 100);
  396. var size = this._size;
  397. var half = size / 2;
  398. var x = half;
  399. var y = half;
  400. var rad = half - 1;
  401. var fontSize = this._fontSize;
  402. ctx.font = fontSize + 'px ' + this._font;
  403. var angle = Math.PI * 2 * (percent / 100);
  404. ctx.clearRect(0, 0, size, size);
  405. // outer circle
  406. ctx.strokeStyle = '#9f9f9f';
  407. ctx.beginPath();
  408. ctx.arc(x, y, rad, 0, angle, false);
  409. ctx.stroke();
  410. // inner circle
  411. ctx.strokeStyle = '#eee';
  412. ctx.beginPath();
  413. ctx.arc(x, y, rad - 1, 0, angle, true);
  414. ctx.stroke();
  415. // text
  416. var text = this._text || (percent | 0) + '%';
  417. var w = ctx.measureText(text).width;
  418. ctx.fillText(text, x - w / 2 + 1, y + fontSize / 2 - 1);
  419. } catch (ignore) {
  420. // don't fail if we can't render progress
  421. }
  422. return this;
  423. };
  424. },{}],4:[function(require,module,exports){
  425. (function (global){
  426. 'use strict';
  427. exports.isatty = function isatty() {
  428. return true;
  429. };
  430. exports.getWindowSize = function getWindowSize() {
  431. if ('innerHeight' in global) {
  432. return [global.innerHeight, global.innerWidth];
  433. }
  434. // In a Web Worker, the DOM Window is not available.
  435. return [640, 480];
  436. };
  437. }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
  438. },{}],5:[function(require,module,exports){
  439. 'use strict';
  440. /**
  441. * @module Context
  442. */
  443. /**
  444. * Expose `Context`.
  445. */
  446. module.exports = Context;
  447. /**
  448. * Initialize a new `Context`.
  449. *
  450. * @private
  451. */
  452. function Context() {}
  453. /**
  454. * Set or get the context `Runnable` to `runnable`.
  455. *
  456. * @private
  457. * @param {Runnable} runnable
  458. * @return {Context} context
  459. */
  460. Context.prototype.runnable = function(runnable) {
  461. if (!arguments.length) {
  462. return this._runnable;
  463. }
  464. this.test = this._runnable = runnable;
  465. return this;
  466. };
  467. /**
  468. * Set or get test timeout `ms`.
  469. *
  470. * @private
  471. * @param {number} ms
  472. * @return {Context} self
  473. */
  474. Context.prototype.timeout = function(ms) {
  475. if (!arguments.length) {
  476. return this.runnable().timeout();
  477. }
  478. this.runnable().timeout(ms);
  479. return this;
  480. };
  481. /**
  482. * Set test timeout `enabled`.
  483. *
  484. * @private
  485. * @param {boolean} enabled
  486. * @return {Context} self
  487. */
  488. Context.prototype.enableTimeouts = function(enabled) {
  489. if (!arguments.length) {
  490. return this.runnable().enableTimeouts();
  491. }
  492. this.runnable().enableTimeouts(enabled);
  493. return this;
  494. };
  495. /**
  496. * Set or get test slowness threshold `ms`.
  497. *
  498. * @private
  499. * @param {number} ms
  500. * @return {Context} self
  501. */
  502. Context.prototype.slow = function(ms) {
  503. if (!arguments.length) {
  504. return this.runnable().slow();
  505. }
  506. this.runnable().slow(ms);
  507. return this;
  508. };
  509. /**
  510. * Mark a test as skipped.
  511. *
  512. * @private
  513. * @throws Pending
  514. */
  515. Context.prototype.skip = function() {
  516. this.runnable().skip();
  517. };
  518. /**
  519. * Set or get a number of allowed retries on failed tests
  520. *
  521. * @private
  522. * @param {number} n
  523. * @return {Context} self
  524. */
  525. Context.prototype.retries = function(n) {
  526. if (!arguments.length) {
  527. return this.runnable().retries();
  528. }
  529. this.runnable().retries(n);
  530. return this;
  531. };
  532. },{}],6:[function(require,module,exports){
  533. 'use strict';
  534. /**
  535. * @module Errors
  536. */
  537. /**
  538. * Factory functions to create throwable error objects
  539. */
  540. /**
  541. * Creates an error object to be thrown when no files to be tested could be found using specified pattern.
  542. *
  543. * @public
  544. * @param {string} message - Error message to be displayed.
  545. * @param {string} pattern - User-specified argument value.
  546. * @returns {Error} instance detailing the error condition
  547. */
  548. function createNoFilesMatchPatternError(message, pattern) {
  549. var err = new Error(message);
  550. err.code = 'ERR_MOCHA_NO_FILES_MATCH_PATTERN';
  551. err.pattern = pattern;
  552. return err;
  553. }
  554. /**
  555. * Creates an error object to be thrown when the reporter specified in the options was not found.
  556. *
  557. * @public
  558. * @param {string} message - Error message to be displayed.
  559. * @param {string} reporter - User-specified reporter value.
  560. * @returns {Error} instance detailing the error condition
  561. */
  562. function createInvalidReporterError(message, reporter) {
  563. var err = new TypeError(message);
  564. err.code = 'ERR_MOCHA_INVALID_REPORTER';
  565. err.reporter = reporter;
  566. return err;
  567. }
  568. /**
  569. * Creates an error object to be thrown when the interface specified in the options was not found.
  570. *
  571. * @public
  572. * @param {string} message - Error message to be displayed.
  573. * @param {string} ui - User-specified interface value.
  574. * @returns {Error} instance detailing the error condition
  575. */
  576. function createInvalidInterfaceError(message, ui) {
  577. var err = new Error(message);
  578. err.code = 'ERR_MOCHA_INVALID_INTERFACE';
  579. err.interface = ui;
  580. return err;
  581. }
  582. /**
  583. * Creates an error object to be thrown when a behavior, option, or parameter is unsupported.
  584. *
  585. * @public
  586. * @param {string} message - Error message to be displayed.
  587. * @returns {Error} instance detailing the error condition
  588. */
  589. function createUnsupportedError(message) {
  590. var err = new Error(message);
  591. err.code = 'ERR_MOCHA_UNSUPPORTED';
  592. return err;
  593. }
  594. /**
  595. * Creates an error object to be thrown when an argument is missing.
  596. *
  597. * @public
  598. * @param {string} message - Error message to be displayed.
  599. * @param {string} argument - Argument name.
  600. * @param {string} expected - Expected argument datatype.
  601. * @returns {Error} instance detailing the error condition
  602. */
  603. function createMissingArgumentError(message, argument, expected) {
  604. return createInvalidArgumentTypeError(message, argument, expected);
  605. }
  606. /**
  607. * Creates an error object to be thrown when an argument did not use the supported type
  608. *
  609. * @public
  610. * @param {string} message - Error message to be displayed.
  611. * @param {string} argument - Argument name.
  612. * @param {string} expected - Expected argument datatype.
  613. * @returns {Error} instance detailing the error condition
  614. */
  615. function createInvalidArgumentTypeError(message, argument, expected) {
  616. var err = new TypeError(message);
  617. err.code = 'ERR_MOCHA_INVALID_ARG_TYPE';
  618. err.argument = argument;
  619. err.expected = expected;
  620. err.actual = typeof argument;
  621. return err;
  622. }
  623. /**
  624. * Creates an error object to be thrown when an argument did not use the supported value
  625. *
  626. * @public
  627. * @param {string} message - Error message to be displayed.
  628. * @param {string} argument - Argument name.
  629. * @param {string} value - Argument value.
  630. * @param {string} [reason] - Why value is invalid.
  631. * @returns {Error} instance detailing the error condition
  632. */
  633. function createInvalidArgumentValueError(message, argument, value, reason) {
  634. var err = new TypeError(message);
  635. err.code = 'ERR_MOCHA_INVALID_ARG_VALUE';
  636. err.argument = argument;
  637. err.value = value;
  638. err.reason = typeof reason !== 'undefined' ? reason : 'is invalid';
  639. return err;
  640. }
  641. /**
  642. * Creates an error object to be thrown when an exception was caught, but the `Error` is falsy or undefined.
  643. *
  644. * @public
  645. * @param {string} message - Error message to be displayed.
  646. * @returns {Error} instance detailing the error condition
  647. */
  648. function createInvalidExceptionError(message, value) {
  649. var err = new Error(message);
  650. err.code = 'ERR_MOCHA_INVALID_EXCEPTION';
  651. err.valueType = typeof value;
  652. err.value = value;
  653. return err;
  654. }
  655. module.exports = {
  656. createInvalidArgumentTypeError: createInvalidArgumentTypeError,
  657. createInvalidArgumentValueError: createInvalidArgumentValueError,
  658. createInvalidExceptionError: createInvalidExceptionError,
  659. createInvalidInterfaceError: createInvalidInterfaceError,
  660. createInvalidReporterError: createInvalidReporterError,
  661. createMissingArgumentError: createMissingArgumentError,
  662. createNoFilesMatchPatternError: createNoFilesMatchPatternError,
  663. createUnsupportedError: createUnsupportedError
  664. };
  665. },{}],7:[function(require,module,exports){
  666. 'use strict';
  667. var Runnable = require('./runnable');
  668. var inherits = require('./utils').inherits;
  669. /**
  670. * Expose `Hook`.
  671. */
  672. module.exports = Hook;
  673. /**
  674. * Initialize a new `Hook` with the given `title` and callback `fn`
  675. *
  676. * @class
  677. * @extends Runnable
  678. * @param {String} title
  679. * @param {Function} fn
  680. */
  681. function Hook(title, fn) {
  682. Runnable.call(this, title, fn);
  683. this.type = 'hook';
  684. }
  685. /**
  686. * Inherit from `Runnable.prototype`.
  687. */
  688. inherits(Hook, Runnable);
  689. /**
  690. * Get or set the test `err`.
  691. *
  692. * @memberof Hook
  693. * @public
  694. * @param {Error} err
  695. * @return {Error}
  696. */
  697. Hook.prototype.error = function(err) {
  698. if (!arguments.length) {
  699. err = this._error;
  700. this._error = null;
  701. return err;
  702. }
  703. this._error = err;
  704. };
  705. },{"./runnable":33,"./utils":38}],8:[function(require,module,exports){
  706. 'use strict';
  707. var Test = require('../test');
  708. var EVENT_FILE_PRE_REQUIRE = require('../suite').constants
  709. .EVENT_FILE_PRE_REQUIRE;
  710. /**
  711. * BDD-style interface:
  712. *
  713. * describe('Array', function() {
  714. * describe('#indexOf()', function() {
  715. * it('should return -1 when not present', function() {
  716. * // ...
  717. * });
  718. *
  719. * it('should return the index when present', function() {
  720. * // ...
  721. * });
  722. * });
  723. * });
  724. *
  725. * @param {Suite} suite Root suite.
  726. */
  727. module.exports = function bddInterface(suite) {
  728. var suites = [suite];
  729. suite.on(EVENT_FILE_PRE_REQUIRE, function(context, file, mocha) {
  730. var common = require('./common')(suites, context, mocha);
  731. context.before = common.before;
  732. context.after = common.after;
  733. context.beforeEach = common.beforeEach;
  734. context.afterEach = common.afterEach;
  735. context.run = mocha.options.delay && common.runWithSuite(suite);
  736. /**
  737. * Describe a "suite" with the given `title`
  738. * and callback `fn` containing nested suites
  739. * and/or tests.
  740. */
  741. context.describe = context.context = function(title, fn) {
  742. return common.suite.create({
  743. title: title,
  744. file: file,
  745. fn: fn
  746. });
  747. };
  748. /**
  749. * Pending describe.
  750. */
  751. context.xdescribe = context.xcontext = context.describe.skip = function(
  752. title,
  753. fn
  754. ) {
  755. return common.suite.skip({
  756. title: title,
  757. file: file,
  758. fn: fn
  759. });
  760. };
  761. /**
  762. * Exclusive suite.
  763. */
  764. context.describe.only = function(title, fn) {
  765. return common.suite.only({
  766. title: title,
  767. file: file,
  768. fn: fn
  769. });
  770. };
  771. /**
  772. * Describe a specification or test-case
  773. * with the given `title` and callback `fn`
  774. * acting as a thunk.
  775. */
  776. context.it = context.specify = function(title, fn) {
  777. var suite = suites[0];
  778. if (suite.isPending()) {
  779. fn = null;
  780. }
  781. var test = new Test(title, fn);
  782. test.file = file;
  783. suite.addTest(test);
  784. return test;
  785. };
  786. /**
  787. * Exclusive test-case.
  788. */
  789. context.it.only = function(title, fn) {
  790. return common.test.only(mocha, context.it(title, fn));
  791. };
  792. /**
  793. * Pending test case.
  794. */
  795. context.xit = context.xspecify = context.it.skip = function(title) {
  796. return context.it(title);
  797. };
  798. /**
  799. * Number of attempts to retry.
  800. */
  801. context.it.retries = function(n) {
  802. context.retries(n);
  803. };
  804. });
  805. };
  806. module.exports.description = 'BDD or RSpec style [default]';
  807. },{"../suite":36,"../test":37,"./common":9}],9:[function(require,module,exports){
  808. 'use strict';
  809. var Suite = require('../suite');
  810. var errors = require('../errors');
  811. var createMissingArgumentError = errors.createMissingArgumentError;
  812. /**
  813. * Functions common to more than one interface.
  814. *
  815. * @param {Suite[]} suites
  816. * @param {Context} context
  817. * @param {Mocha} mocha
  818. * @return {Object} An object containing common functions.
  819. */
  820. module.exports = function(suites, context, mocha) {
  821. /**
  822. * Check if the suite should be tested.
  823. *
  824. * @private
  825. * @param {Suite} suite - suite to check
  826. * @returns {boolean}
  827. */
  828. function shouldBeTested(suite) {
  829. return (
  830. !mocha.options.grep ||
  831. (mocha.options.grep &&
  832. mocha.options.grep.test(suite.fullTitle()) &&
  833. !mocha.options.invert)
  834. );
  835. }
  836. return {
  837. /**
  838. * This is only present if flag --delay is passed into Mocha. It triggers
  839. * root suite execution.
  840. *
  841. * @param {Suite} suite The root suite.
  842. * @return {Function} A function which runs the root suite
  843. */
  844. runWithSuite: function runWithSuite(suite) {
  845. return function run() {
  846. suite.run();
  847. };
  848. },
  849. /**
  850. * Execute before running tests.
  851. *
  852. * @param {string} name
  853. * @param {Function} fn
  854. */
  855. before: function(name, fn) {
  856. suites[0].beforeAll(name, fn);
  857. },
  858. /**
  859. * Execute after running tests.
  860. *
  861. * @param {string} name
  862. * @param {Function} fn
  863. */
  864. after: function(name, fn) {
  865. suites[0].afterAll(name, fn);
  866. },
  867. /**
  868. * Execute before each test case.
  869. *
  870. * @param {string} name
  871. * @param {Function} fn
  872. */
  873. beforeEach: function(name, fn) {
  874. suites[0].beforeEach(name, fn);
  875. },
  876. /**
  877. * Execute after each test case.
  878. *
  879. * @param {string} name
  880. * @param {Function} fn
  881. */
  882. afterEach: function(name, fn) {
  883. suites[0].afterEach(name, fn);
  884. },
  885. suite: {
  886. /**
  887. * Create an exclusive Suite; convenience function
  888. * See docstring for create() below.
  889. *
  890. * @param {Object} opts
  891. * @returns {Suite}
  892. */
  893. only: function only(opts) {
  894. opts.isOnly = true;
  895. return this.create(opts);
  896. },
  897. /**
  898. * Create a Suite, but skip it; convenience function
  899. * See docstring for create() below.
  900. *
  901. * @param {Object} opts
  902. * @returns {Suite}
  903. */
  904. skip: function skip(opts) {
  905. opts.pending = true;
  906. return this.create(opts);
  907. },
  908. /**
  909. * Creates a suite.
  910. *
  911. * @param {Object} opts Options
  912. * @param {string} opts.title Title of Suite
  913. * @param {Function} [opts.fn] Suite Function (not always applicable)
  914. * @param {boolean} [opts.pending] Is Suite pending?
  915. * @param {string} [opts.file] Filepath where this Suite resides
  916. * @param {boolean} [opts.isOnly] Is Suite exclusive?
  917. * @returns {Suite}
  918. */
  919. create: function create(opts) {
  920. var suite = Suite.create(suites[0], opts.title);
  921. suite.pending = Boolean(opts.pending);
  922. suite.file = opts.file;
  923. suites.unshift(suite);
  924. if (opts.isOnly) {
  925. if (mocha.options.forbidOnly && shouldBeTested(suite)) {
  926. throw new Error('`.only` forbidden');
  927. }
  928. suite.parent.appendOnlySuite(suite);
  929. }
  930. if (suite.pending) {
  931. if (mocha.options.forbidPending && shouldBeTested(suite)) {
  932. throw new Error('Pending test forbidden');
  933. }
  934. }
  935. if (typeof opts.fn === 'function') {
  936. opts.fn.call(suite);
  937. suites.shift();
  938. } else if (typeof opts.fn === 'undefined' && !suite.pending) {
  939. throw createMissingArgumentError(
  940. 'Suite "' +
  941. suite.fullTitle() +
  942. '" was defined but no callback was supplied. ' +
  943. 'Supply a callback or explicitly skip the suite.',
  944. 'callback',
  945. 'function'
  946. );
  947. } else if (!opts.fn && suite.pending) {
  948. suites.shift();
  949. }
  950. return suite;
  951. }
  952. },
  953. test: {
  954. /**
  955. * Exclusive test-case.
  956. *
  957. * @param {Object} mocha
  958. * @param {Function} test
  959. * @returns {*}
  960. */
  961. only: function(mocha, test) {
  962. test.parent.appendOnlyTest(test);
  963. return test;
  964. },
  965. /**
  966. * Pending test case.
  967. *
  968. * @param {string} title
  969. */
  970. skip: function(title) {
  971. context.test(title);
  972. },
  973. /**
  974. * Number of retry attempts
  975. *
  976. * @param {number} n
  977. */
  978. retries: function(n) {
  979. context.retries(n);
  980. }
  981. }
  982. };
  983. };
  984. },{"../errors":6,"../suite":36}],10:[function(require,module,exports){
  985. 'use strict';
  986. var Suite = require('../suite');
  987. var Test = require('../test');
  988. /**
  989. * Exports-style (as Node.js module) interface:
  990. *
  991. * exports.Array = {
  992. * '#indexOf()': {
  993. * 'should return -1 when the value is not present': function() {
  994. *
  995. * },
  996. *
  997. * 'should return the correct index when the value is present': function() {
  998. *
  999. * }
  1000. * }
  1001. * };
  1002. *
  1003. * @param {Suite} suite Root suite.
  1004. */
  1005. module.exports = function(suite) {
  1006. var suites = [suite];
  1007. suite.on(Suite.constants.EVENT_FILE_REQUIRE, visit);
  1008. function visit(obj, file) {
  1009. var suite;
  1010. for (var key in obj) {
  1011. if (typeof obj[key] === 'function') {
  1012. var fn = obj[key];
  1013. switch (key) {
  1014. case 'before':
  1015. suites[0].beforeAll(fn);
  1016. break;
  1017. case 'after':
  1018. suites[0].afterAll(fn);
  1019. break;
  1020. case 'beforeEach':
  1021. suites[0].beforeEach(fn);
  1022. break;
  1023. case 'afterEach':
  1024. suites[0].afterEach(fn);
  1025. break;
  1026. default:
  1027. var test = new Test(key, fn);
  1028. test.file = file;
  1029. suites[0].addTest(test);
  1030. }
  1031. } else {
  1032. suite = Suite.create(suites[0], key);
  1033. suites.unshift(suite);
  1034. visit(obj[key], file);
  1035. suites.shift();
  1036. }
  1037. }
  1038. }
  1039. };
  1040. module.exports.description = 'Node.js module ("exports") style';
  1041. },{"../suite":36,"../test":37}],11:[function(require,module,exports){
  1042. 'use strict';
  1043. exports.bdd = require('./bdd');
  1044. exports.tdd = require('./tdd');
  1045. exports.qunit = require('./qunit');
  1046. exports.exports = require('./exports');
  1047. },{"./bdd":8,"./exports":10,"./qunit":12,"./tdd":13}],12:[function(require,module,exports){
  1048. 'use strict';
  1049. var Test = require('../test');
  1050. var EVENT_FILE_PRE_REQUIRE = require('../suite').constants
  1051. .EVENT_FILE_PRE_REQUIRE;
  1052. /**
  1053. * QUnit-style interface:
  1054. *
  1055. * suite('Array');
  1056. *
  1057. * test('#length', function() {
  1058. * var arr = [1,2,3];
  1059. * ok(arr.length == 3);
  1060. * });
  1061. *
  1062. * test('#indexOf()', function() {
  1063. * var arr = [1,2,3];
  1064. * ok(arr.indexOf(1) == 0);
  1065. * ok(arr.indexOf(2) == 1);
  1066. * ok(arr.indexOf(3) == 2);
  1067. * });
  1068. *
  1069. * suite('String');
  1070. *
  1071. * test('#length', function() {
  1072. * ok('foo'.length == 3);
  1073. * });
  1074. *
  1075. * @param {Suite} suite Root suite.
  1076. */
  1077. module.exports = function qUnitInterface(suite) {
  1078. var suites = [suite];
  1079. suite.on(EVENT_FILE_PRE_REQUIRE, function(context, file, mocha) {
  1080. var common = require('./common')(suites, context, mocha);
  1081. context.before = common.before;
  1082. context.after = common.after;
  1083. context.beforeEach = common.beforeEach;
  1084. context.afterEach = common.afterEach;
  1085. context.run = mocha.options.delay && common.runWithSuite(suite);
  1086. /**
  1087. * Describe a "suite" with the given `title`.
  1088. */
  1089. context.suite = function(title) {
  1090. if (suites.length > 1) {
  1091. suites.shift();
  1092. }
  1093. return common.suite.create({
  1094. title: title,
  1095. file: file,
  1096. fn: false
  1097. });
  1098. };
  1099. /**
  1100. * Exclusive Suite.
  1101. */
  1102. context.suite.only = function(title) {
  1103. if (suites.length > 1) {
  1104. suites.shift();
  1105. }
  1106. return common.suite.only({
  1107. title: title,
  1108. file: file,
  1109. fn: false
  1110. });
  1111. };
  1112. /**
  1113. * Describe a specification or test-case
  1114. * with the given `title` and callback `fn`
  1115. * acting as a thunk.
  1116. */
  1117. context.test = function(title, fn) {
  1118. var test = new Test(title, fn);
  1119. test.file = file;
  1120. suites[0].addTest(test);
  1121. return test;
  1122. };
  1123. /**
  1124. * Exclusive test-case.
  1125. */
  1126. context.test.only = function(title, fn) {
  1127. return common.test.only(mocha, context.test(title, fn));
  1128. };
  1129. context.test.skip = common.test.skip;
  1130. context.test.retries = common.test.retries;
  1131. });
  1132. };
  1133. module.exports.description = 'QUnit style';
  1134. },{"../suite":36,"../test":37,"./common":9}],13:[function(require,module,exports){
  1135. 'use strict';
  1136. var Test = require('../test');
  1137. var EVENT_FILE_PRE_REQUIRE = require('../suite').constants
  1138. .EVENT_FILE_PRE_REQUIRE;
  1139. /**
  1140. * TDD-style interface:
  1141. *
  1142. * suite('Array', function() {
  1143. * suite('#indexOf()', function() {
  1144. * suiteSetup(function() {
  1145. *
  1146. * });
  1147. *
  1148. * test('should return -1 when not present', function() {
  1149. *
  1150. * });
  1151. *
  1152. * test('should return the index when present', function() {
  1153. *
  1154. * });
  1155. *
  1156. * suiteTeardown(function() {
  1157. *
  1158. * });
  1159. * });
  1160. * });
  1161. *
  1162. * @param {Suite} suite Root suite.
  1163. */
  1164. module.exports = function(suite) {
  1165. var suites = [suite];
  1166. suite.on(EVENT_FILE_PRE_REQUIRE, function(context, file, mocha) {
  1167. var common = require('./common')(suites, context, mocha);
  1168. context.setup = common.beforeEach;
  1169. context.teardown = common.afterEach;
  1170. context.suiteSetup = common.before;
  1171. context.suiteTeardown = common.after;
  1172. context.run = mocha.options.delay && common.runWithSuite(suite);
  1173. /**
  1174. * Describe a "suite" with the given `title` and callback `fn` containing
  1175. * nested suites and/or tests.
  1176. */
  1177. context.suite = function(title, fn) {
  1178. return common.suite.create({
  1179. title: title,
  1180. file: file,
  1181. fn: fn
  1182. });
  1183. };
  1184. /**
  1185. * Pending suite.
  1186. */
  1187. context.suite.skip = function(title, fn) {
  1188. return common.suite.skip({
  1189. title: title,
  1190. file: file,
  1191. fn: fn
  1192. });
  1193. };
  1194. /**
  1195. * Exclusive test-case.
  1196. */
  1197. context.suite.only = function(title, fn) {
  1198. return common.suite.only({
  1199. title: title,
  1200. file: file,
  1201. fn: fn
  1202. });
  1203. };
  1204. /**
  1205. * Describe a specification or test-case with the given `title` and
  1206. * callback `fn` acting as a thunk.
  1207. */
  1208. context.test = function(title, fn) {
  1209. var suite = suites[0];
  1210. if (suite.isPending()) {
  1211. fn = null;
  1212. }
  1213. var test = new Test(title, fn);
  1214. test.file = file;
  1215. suite.addTest(test);
  1216. return test;
  1217. };
  1218. /**
  1219. * Exclusive test-case.
  1220. */
  1221. context.test.only = function(title, fn) {
  1222. return common.test.only(mocha, context.test(title, fn));
  1223. };
  1224. context.test.skip = common.test.skip;
  1225. context.test.retries = common.test.retries;
  1226. });
  1227. };
  1228. module.exports.description =
  1229. 'traditional "suite"/"test" instead of BDD\'s "describe"/"it"';
  1230. },{"../suite":36,"../test":37,"./common":9}],14:[function(require,module,exports){
  1231. (function (process,global){
  1232. 'use strict';
  1233. /*!
  1234. * mocha
  1235. * Copyright(c) 2011 TJ Holowaychuk <tj@vision-media.ca>
  1236. * MIT Licensed
  1237. */
  1238. var escapeRe = require('escape-string-regexp');
  1239. var path = require('path');
  1240. var builtinReporters = require('./reporters');
  1241. var growl = require('./growl');
  1242. var utils = require('./utils');
  1243. var mocharc = require('./mocharc.json');
  1244. var errors = require('./errors');
  1245. var Suite = require('./suite');
  1246. var createStatsCollector = require('./stats-collector');
  1247. var createInvalidReporterError = errors.createInvalidReporterError;
  1248. var createInvalidInterfaceError = errors.createInvalidInterfaceError;
  1249. var EVENT_FILE_PRE_REQUIRE = Suite.constants.EVENT_FILE_PRE_REQUIRE;
  1250. var EVENT_FILE_POST_REQUIRE = Suite.constants.EVENT_FILE_POST_REQUIRE;
  1251. var EVENT_FILE_REQUIRE = Suite.constants.EVENT_FILE_REQUIRE;
  1252. var sQuote = utils.sQuote;
  1253. exports = module.exports = Mocha;
  1254. /**
  1255. * To require local UIs and reporters when running in node.
  1256. */
  1257. if (!process.browser) {
  1258. var cwd = process.cwd();
  1259. module.paths.push(cwd, path.join(cwd, 'node_modules'));
  1260. }
  1261. /**
  1262. * Expose internals.
  1263. */
  1264. /**
  1265. * @public
  1266. * @class utils
  1267. * @memberof Mocha
  1268. */
  1269. exports.utils = utils;
  1270. exports.interfaces = require('./interfaces');
  1271. /**
  1272. * @public
  1273. * @memberof Mocha
  1274. */
  1275. exports.reporters = builtinReporters;
  1276. exports.Runnable = require('./runnable');
  1277. exports.Context = require('./context');
  1278. /**
  1279. *
  1280. * @memberof Mocha
  1281. */
  1282. exports.Runner = require('./runner');
  1283. exports.Suite = Suite;
  1284. exports.Hook = require('./hook');
  1285. exports.Test = require('./test');
  1286. /**
  1287. * Constructs a new Mocha instance with `options`.
  1288. *
  1289. * @public
  1290. * @class Mocha
  1291. * @param {Object} [options] - Settings object.
  1292. * @param {boolean} [options.allowUncaught] - Propagate uncaught errors?
  1293. * @param {boolean} [options.asyncOnly] - Force `done` callback or promise?
  1294. * @param {boolean} [options.bail] - Bail after first test failure?
  1295. * @param {boolean} [options.checkLeaks] - If true, check leaks.
  1296. * @param {boolean} [options.delay] - Delay root suite execution?
  1297. * @param {boolean} [options.enableTimeouts] - Enable timeouts?
  1298. * @param {string} [options.fgrep] - Test filter given string.
  1299. * @param {boolean} [options.forbidOnly] - Tests marked `only` fail the suite?
  1300. * @param {boolean} [options.forbidPending] - Pending tests fail the suite?
  1301. * @param {boolean} [options.fullStackTrace] - Full stacktrace upon failure?
  1302. * @param {string[]} [options.global] - Variables expected in global scope.
  1303. * @param {RegExp|string} [options.grep] - Test filter given regular expression.
  1304. * @param {boolean} [options.growl] - Enable desktop notifications?
  1305. * @param {boolean} [options.hideDiff] - Suppress diffs from failures?
  1306. * @param {boolean} [options.ignoreLeaks] - Ignore global leaks?
  1307. * @param {boolean} [options.invert] - Invert test filter matches?
  1308. * @param {boolean} [options.noHighlighting] - Disable syntax highlighting?
  1309. * @param {string} [options.reporter] - Reporter name.
  1310. * @param {Object} [options.reporterOption] - Reporter settings object.
  1311. * @param {number} [options.retries] - Number of times to retry failed tests.
  1312. * @param {number} [options.slow] - Slow threshold value.
  1313. * @param {number|string} [options.timeout] - Timeout threshold value.
  1314. * @param {string} [options.ui] - Interface name.
  1315. * @param {boolean} [options.color] - Color TTY output from reporter?
  1316. * @param {boolean} [options.useInlineDiffs] - Use inline diffs?
  1317. */
  1318. function Mocha(options) {
  1319. options = utils.assign({}, mocharc, options || {});
  1320. this.files = [];
  1321. this.options = options;
  1322. // root suite
  1323. this.suite = new exports.Suite('', new exports.Context(), true);
  1324. if ('useColors' in options) {
  1325. utils.deprecate(
  1326. 'useColors is DEPRECATED and will be removed from a future version of Mocha. Instead, use the "color" option'
  1327. );
  1328. options.color = 'color' in options ? options.color : options.useColors;
  1329. }
  1330. this.grep(options.grep)
  1331. .fgrep(options.fgrep)
  1332. .ui(options.ui)
  1333. .bail(options.bail)
  1334. .reporter(options.reporter, options.reporterOptions)
  1335. .useColors(options.color)
  1336. .slow(options.slow)
  1337. .useInlineDiffs(options.inlineDiffs)
  1338. .globals(options.globals);
  1339. if ('enableTimeouts' in options) {
  1340. utils.deprecate(
  1341. 'enableTimeouts is DEPRECATED and will be removed from a future version of Mocha. Instead, use "timeout: false" to disable timeouts.'
  1342. );
  1343. }
  1344. this.timeout(
  1345. options.enableTimeouts === false || options.timeout === false
  1346. ? 0
  1347. : options.timeout
  1348. );
  1349. if ('retries' in options) {
  1350. this.retries(options.retries);
  1351. }
  1352. if ('diff' in options) {
  1353. this.hideDiff(!options.diff);
  1354. }
  1355. [
  1356. 'allowUncaught',
  1357. 'asyncOnly',
  1358. 'checkLeaks',
  1359. 'delay',
  1360. 'forbidOnly',
  1361. 'forbidPending',
  1362. 'fullTrace',
  1363. 'growl',
  1364. 'invert'
  1365. ].forEach(function(opt) {
  1366. if (options[opt]) {
  1367. this[opt]();
  1368. }
  1369. }, this);
  1370. }
  1371. /**
  1372. * Enables or disables bailing on the first failure.
  1373. *
  1374. * @public
  1375. * @see {@link https://mochajs.org/#-b---bail|CLI option}
  1376. * @param {boolean} [bail=true] - Whether to bail on first error.
  1377. * @returns {Mocha} this
  1378. * @chainable
  1379. */
  1380. Mocha.prototype.bail = function(bail) {
  1381. if (!arguments.length) {
  1382. bail = true;
  1383. }
  1384. this.suite.bail(bail);
  1385. return this;
  1386. };
  1387. /**
  1388. * @summary
  1389. * Adds `file` to be loaded for execution.
  1390. *
  1391. * @description
  1392. * Useful for generic setup code that must be included within test suite.
  1393. *
  1394. * @public
  1395. * @see {@link https://mochajs.org/#--file-file|CLI option}
  1396. * @param {string} file - Pathname of file to be loaded.
  1397. * @returns {Mocha} this
  1398. * @chainable
  1399. */
  1400. Mocha.prototype.addFile = function(file) {
  1401. this.files.push(file);
  1402. return this;
  1403. };
  1404. /**
  1405. * Sets reporter to `reporter`, defaults to "spec".
  1406. *
  1407. * @public
  1408. * @see {@link https://mochajs.org/#-r---reporter-name|CLI option}
  1409. * @see {@link https://mochajs.org/#reporters|Reporters}
  1410. * @param {String|Function} reporter - Reporter name or constructor.
  1411. * @param {Object} [reporterOptions] - Options used to configure the reporter.
  1412. * @returns {Mocha} this
  1413. * @chainable
  1414. * @throws {Error} if requested reporter cannot be loaded
  1415. * @example
  1416. *
  1417. * // Use XUnit reporter and direct its output to file
  1418. * mocha.reporter('xunit', { output: '/path/to/testspec.xunit.xml' });
  1419. */
  1420. Mocha.prototype.reporter = function(reporter, reporterOptions) {
  1421. if (typeof reporter === 'function') {
  1422. this._reporter = reporter;
  1423. } else {
  1424. reporter = reporter || 'spec';
  1425. var _reporter;
  1426. // Try to load a built-in reporter.
  1427. if (builtinReporters[reporter]) {
  1428. _reporter = builtinReporters[reporter];
  1429. }
  1430. // Try to load reporters from process.cwd() and node_modules
  1431. if (!_reporter) {
  1432. try {
  1433. _reporter = require(reporter);
  1434. } catch (err) {
  1435. if (
  1436. err.code !== 'MODULE_NOT_FOUND' ||
  1437. err.message.indexOf('Cannot find module') !== -1
  1438. ) {
  1439. // Try to load reporters from a path (absolute or relative)
  1440. try {
  1441. _reporter = require(path.resolve(process.cwd(), reporter));
  1442. } catch (_err) {
  1443. _err.code !== 'MODULE_NOT_FOUND' ||
  1444. _err.message.indexOf('Cannot find module') !== -1
  1445. ? console.warn(sQuote(reporter) + ' reporter not found')
  1446. : console.warn(
  1447. sQuote(reporter) +
  1448. ' reporter blew up with error:\n' +
  1449. err.stack
  1450. );
  1451. }
  1452. } else {
  1453. console.warn(
  1454. sQuote(reporter) + ' reporter blew up with error:\n' + err.stack
  1455. );
  1456. }
  1457. }
  1458. }
  1459. if (!_reporter) {
  1460. throw createInvalidReporterError(
  1461. 'invalid reporter ' + sQuote(reporter),
  1462. reporter
  1463. );
  1464. }
  1465. this._reporter = _reporter;
  1466. }
  1467. this.options.reporterOptions = reporterOptions;
  1468. return this;
  1469. };
  1470. /**
  1471. * Sets test UI `name`, defaults to "bdd".
  1472. *
  1473. * @public
  1474. * @see {@link https://mochajs.org/#-u---ui-name|CLI option}
  1475. * @see {@link https://mochajs.org/#interfaces|Interface DSLs}
  1476. * @param {string|Function} [ui=bdd] - Interface name or class.
  1477. * @returns {Mocha} this
  1478. * @chainable
  1479. * @throws {Error} if requested interface cannot be loaded
  1480. */
  1481. Mocha.prototype.ui = function(ui) {
  1482. var bindInterface;
  1483. if (typeof ui === 'function') {
  1484. bindInterface = ui;
  1485. } else {
  1486. ui = ui || 'bdd';
  1487. bindInterface = exports.interfaces[ui];
  1488. if (!bindInterface) {
  1489. try {
  1490. bindInterface = require(ui);
  1491. } catch (err) {
  1492. throw createInvalidInterfaceError(
  1493. 'invalid interface ' + sQuote(ui),
  1494. ui
  1495. );
  1496. }
  1497. }
  1498. }
  1499. bindInterface(this.suite);
  1500. this.suite.on(EVENT_FILE_PRE_REQUIRE, function(context) {
  1501. exports.afterEach = context.afterEach || context.teardown;
  1502. exports.after = context.after || context.suiteTeardown;
  1503. exports.beforeEach = context.beforeEach || context.setup;
  1504. exports.before = context.before || context.suiteSetup;
  1505. exports.describe = context.describe || context.suite;
  1506. exports.it = context.it || context.test;
  1507. exports.xit = context.xit || (context.test && context.test.skip);
  1508. exports.setup = context.setup || context.beforeEach;
  1509. exports.suiteSetup = context.suiteSetup || context.before;
  1510. exports.suiteTeardown = context.suiteTeardown || context.after;
  1511. exports.suite = context.suite || context.describe;
  1512. exports.teardown = context.teardown || context.afterEach;
  1513. exports.test = context.test || context.it;
  1514. exports.run = context.run;
  1515. });
  1516. return this;
  1517. };
  1518. /**
  1519. * Loads `files` prior to execution.
  1520. *
  1521. * @description
  1522. * The implementation relies on Node's `require` to execute
  1523. * the test interface functions and will be subject to its cache.
  1524. *
  1525. * @private
  1526. * @see {@link Mocha#addFile}
  1527. * @see {@link Mocha#run}
  1528. * @see {@link Mocha#unloadFiles}
  1529. * @param {Function} [fn] - Callback invoked upon completion.
  1530. */
  1531. Mocha.prototype.loadFiles = function(fn) {
  1532. var self = this;
  1533. var suite = this.suite;
  1534. this.files.forEach(function(file) {
  1535. file = path.resolve(file);
  1536. suite.emit(EVENT_FILE_PRE_REQUIRE, global, file, self);
  1537. suite.emit(EVENT_FILE_REQUIRE, require(file), file, self);
  1538. suite.emit(EVENT_FILE_POST_REQUIRE, global, file, self);
  1539. });
  1540. fn && fn();
  1541. };
  1542. /**
  1543. * Removes a previously loaded file from Node's `require` cache.
  1544. *
  1545. * @private
  1546. * @static
  1547. * @see {@link Mocha#unloadFiles}
  1548. * @param {string} file - Pathname of file to be unloaded.
  1549. */
  1550. Mocha.unloadFile = function(file) {
  1551. delete require.cache[require.resolve(file)];
  1552. };
  1553. /**
  1554. * Unloads `files` from Node's `require` cache.
  1555. *
  1556. * @description
  1557. * This allows files to be "freshly" reloaded, providing the ability
  1558. * to reuse a Mocha instance programmatically.
  1559. *
  1560. * <strong>Intended for consumers &mdash; not used internally</strong>
  1561. *
  1562. * @public
  1563. * @see {@link Mocha.unloadFile}
  1564. * @see {@link Mocha#loadFiles}
  1565. * @see {@link Mocha#run}
  1566. * @returns {Mocha} this
  1567. * @chainable
  1568. */
  1569. Mocha.prototype.unloadFiles = function() {
  1570. this.files.forEach(Mocha.unloadFile);
  1571. return this;
  1572. };
  1573. /**
  1574. * Sets `grep` filter after escaping RegExp special characters.
  1575. *
  1576. * @public
  1577. * @see {@link Mocha#grep}
  1578. * @param {string} str - Value to be converted to a regexp.
  1579. * @returns {Mocha} this
  1580. * @chainable
  1581. * @example
  1582. *
  1583. * // Select tests whose full title begins with `"foo"` followed by a period
  1584. * mocha.fgrep('foo.');
  1585. */
  1586. Mocha.prototype.fgrep = function(str) {
  1587. if (!str) {
  1588. return this;
  1589. }
  1590. return this.grep(new RegExp(escapeRe(str)));
  1591. };
  1592. /**
  1593. * @summary
  1594. * Sets `grep` filter used to select specific tests for execution.
  1595. *
  1596. * @description
  1597. * If `re` is a regexp-like string, it will be converted to regexp.
  1598. * The regexp is tested against the full title of each test (i.e., the
  1599. * name of the test preceded by titles of each its ancestral suites).
  1600. * As such, using an <em>exact-match</em> fixed pattern against the
  1601. * test name itself will not yield any matches.
  1602. * <br>
  1603. * <strong>Previous filter value will be overwritten on each call!</strong>
  1604. *
  1605. * @public
  1606. * @see {@link https://mochajs.org/#-g---grep-pattern|CLI option}
  1607. * @see {@link Mocha#fgrep}
  1608. * @see {@link Mocha#invert}
  1609. * @param {RegExp|String} re - Regular expression used to select tests.
  1610. * @return {Mocha} this
  1611. * @chainable
  1612. * @example
  1613. *
  1614. * // Select tests whose full title contains `"match"`, ignoring case
  1615. * mocha.grep(/match/i);
  1616. * @example
  1617. *
  1618. * // Same as above but with regexp-like string argument
  1619. * mocha.grep('/match/i');
  1620. * @example
  1621. *
  1622. * // ## Anti-example
  1623. * // Given embedded test `it('only-this-test')`...
  1624. * mocha.grep('/^only-this-test$/'); // NO! Use `.only()` to do this!
  1625. */
  1626. Mocha.prototype.grep = function(re) {
  1627. if (utils.isString(re)) {
  1628. // extract args if it's regex-like, i.e: [string, pattern, flag]
  1629. var arg = re.match(/^\/(.*)\/(g|i|)$|.*/);
  1630. this.options.grep = new RegExp(arg[1] || arg[0], arg[2]);
  1631. } else {
  1632. this.options.grep = re;
  1633. }
  1634. return this;
  1635. };
  1636. /**
  1637. * Inverts `grep` matches.
  1638. *
  1639. * @public
  1640. * @see {@link Mocha#grep}
  1641. * @return {Mocha} this
  1642. * @chainable
  1643. * @example
  1644. *
  1645. * // Select tests whose full title does *not* contain `"match"`, ignoring case
  1646. * mocha.grep(/match/i).invert();
  1647. */
  1648. Mocha.prototype.invert = function() {
  1649. this.options.invert = true;
  1650. return this;
  1651. };
  1652. /**
  1653. * Enables or disables ignoring global leaks.
  1654. *
  1655. * @public
  1656. * @see {@link Mocha#checkLeaks}
  1657. * @param {boolean} ignoreLeaks - Whether to ignore global leaks.
  1658. * @return {Mocha} this
  1659. * @chainable
  1660. * @example
  1661. *
  1662. * // Ignore global leaks
  1663. * mocha.ignoreLeaks(true);
  1664. */
  1665. Mocha.prototype.ignoreLeaks = function(ignoreLeaks) {
  1666. this.options.ignoreLeaks = Boolean(ignoreLeaks);
  1667. return this;
  1668. };
  1669. /**
  1670. * Enables checking for global variables leaked while running tests.
  1671. *
  1672. * @public
  1673. * @see {@link https://mochajs.org/#--check-leaks|CLI option}
  1674. * @see {@link Mocha#ignoreLeaks}
  1675. * @return {Mocha} this
  1676. * @chainable
  1677. */
  1678. Mocha.prototype.checkLeaks = function() {
  1679. this.options.ignoreLeaks = false;
  1680. return this;
  1681. };
  1682. /**
  1683. * Displays full stack trace upon test failure.
  1684. *
  1685. * @public
  1686. * @return {Mocha} this
  1687. * @chainable
  1688. */
  1689. Mocha.prototype.fullTrace = function() {
  1690. this.options.fullStackTrace = true;
  1691. return this;
  1692. };
  1693. /**
  1694. * Enables desktop notification support if prerequisite software installed.
  1695. *
  1696. * @public
  1697. * @see {@link Mocha#isGrowlCapable}
  1698. * @see {@link Mocha#_growl}
  1699. * @return {Mocha} this
  1700. * @chainable
  1701. */
  1702. Mocha.prototype.growl = function() {
  1703. this.options.growl = this.isGrowlCapable();
  1704. if (!this.options.growl) {
  1705. var detail = process.browser
  1706. ? 'notification support not available in this browser...'
  1707. : 'notification support prerequisites not installed...';
  1708. console.error(detail + ' cannot enable!');
  1709. }
  1710. return this;
  1711. };
  1712. /**
  1713. * @summary
  1714. * Determines if Growl support seems likely.
  1715. *
  1716. * @description
  1717. * <strong>Not available when run in browser.</strong>
  1718. *
  1719. * @private
  1720. * @see {@link Growl#isCapable}
  1721. * @see {@link Mocha#growl}
  1722. * @return {boolean} whether Growl support can be expected
  1723. */
  1724. Mocha.prototype.isGrowlCapable = growl.isCapable;
  1725. /**
  1726. * Implements desktop notifications using a pseudo-reporter.
  1727. *
  1728. * @private
  1729. * @see {@link Mocha#growl}
  1730. * @see {@link Growl#notify}
  1731. * @param {Runner} runner - Runner instance.
  1732. */
  1733. Mocha.prototype._growl = growl.notify;
  1734. /**
  1735. * Specifies whitelist of variable names to be expected in global scope.
  1736. *
  1737. * @public
  1738. * @see {@link https://mochajs.org/#--globals-names|CLI option}
  1739. * @see {@link Mocha#checkLeaks}
  1740. * @param {String[]|String} globals - Accepted global variable name(s).
  1741. * @return {Mocha} this
  1742. * @chainable
  1743. * @example
  1744. *
  1745. * // Specify variables to be expected in global scope
  1746. * mocha.globals(['jQuery', 'MyLib']);
  1747. */
  1748. Mocha.prototype.globals = function(globals) {
  1749. this.options.globals = (this.options.globals || [])
  1750. .concat(globals)
  1751. .filter(Boolean);
  1752. return this;
  1753. };
  1754. /**
  1755. * Enables or disables TTY color output by screen-oriented reporters.
  1756. *
  1757. * @public
  1758. * @param {boolean} colors - Whether to enable color output.
  1759. * @return {Mocha} this
  1760. * @chainable
  1761. */
  1762. Mocha.prototype.useColors = function(colors) {
  1763. if (colors !== undefined) {
  1764. this.options.useColors = colors;
  1765. }
  1766. return this;
  1767. };
  1768. /**
  1769. * Determines if reporter should use inline diffs (rather than +/-)
  1770. * in test failure output.
  1771. *
  1772. * @public
  1773. * @param {boolean} inlineDiffs - Whether to use inline diffs.
  1774. * @return {Mocha} this
  1775. * @chainable
  1776. */
  1777. Mocha.prototype.useInlineDiffs = function(inlineDiffs) {
  1778. this.options.useInlineDiffs = inlineDiffs !== undefined && inlineDiffs;
  1779. return this;
  1780. };
  1781. /**
  1782. * Determines if reporter should include diffs in test failure output.
  1783. *
  1784. * @public
  1785. * @param {boolean} hideDiff - Whether to hide diffs.
  1786. * @return {Mocha} this
  1787. * @chainable
  1788. */
  1789. Mocha.prototype.hideDiff = function(hideDiff) {
  1790. this.options.hideDiff = hideDiff !== undefined && hideDiff;
  1791. return this;
  1792. };
  1793. /**
  1794. * @summary
  1795. * Sets timeout threshold value.
  1796. *
  1797. * @description
  1798. * A string argument can use shorthand (such as "2s") and will be converted.
  1799. * If the value is `0`, timeouts will be disabled.
  1800. *
  1801. * @public
  1802. * @see {@link https://mochajs.org/#-t---timeout-ms|CLI option}
  1803. * @see {@link https://mochajs.org/#--no-timeouts|CLI option}
  1804. * @see {@link https://mochajs.org/#timeouts|Timeouts}
  1805. * @see {@link Mocha#enableTimeouts}
  1806. * @param {number|string} msecs - Timeout threshold value.
  1807. * @return {Mocha} this
  1808. * @chainable
  1809. * @example
  1810. *
  1811. * // Sets timeout to one second
  1812. * mocha.timeout(1000);
  1813. * @example
  1814. *
  1815. * // Same as above but using string argument
  1816. * mocha.timeout('1s');
  1817. */
  1818. Mocha.prototype.timeout = function(msecs) {
  1819. this.suite.timeout(msecs);
  1820. return this;
  1821. };
  1822. /**
  1823. * Sets the number of times to retry failed tests.
  1824. *
  1825. * @public
  1826. * @see {@link https://mochajs.org/#retry-tests|Retry Tests}
  1827. * @param {number} retry - Number of times to retry failed tests.
  1828. * @return {Mocha} this
  1829. * @chainable
  1830. * @example
  1831. *
  1832. * // Allow any failed test to retry one more time
  1833. * mocha.retries(1);
  1834. */
  1835. Mocha.prototype.retries = function(n) {
  1836. this.suite.retries(n);
  1837. return this;
  1838. };
  1839. /**
  1840. * Sets slowness threshold value.
  1841. *
  1842. * @public
  1843. * @see {@link https://mochajs.org/#-s---slow-ms|CLI option}
  1844. * @param {number} msecs - Slowness threshold value.
  1845. * @return {Mocha} this
  1846. * @chainable
  1847. * @example
  1848. *
  1849. * // Sets "slow" threshold to half a second
  1850. * mocha.slow(500);
  1851. * @example
  1852. *
  1853. * // Same as above but using string argument
  1854. * mocha.slow('0.5s');
  1855. */
  1856. Mocha.prototype.slow = function(msecs) {
  1857. this.suite.slow(msecs);
  1858. return this;
  1859. };
  1860. /**
  1861. * Enables or disables timeouts.
  1862. *
  1863. * @public
  1864. * @see {@link https://mochajs.org/#-t---timeout-ms|CLI option}
  1865. * @see {@link https://mochajs.org/#--no-timeouts|CLI option}
  1866. * @param {boolean} enableTimeouts - Whether to enable timeouts.
  1867. * @return {Mocha} this
  1868. * @chainable
  1869. */
  1870. Mocha.prototype.enableTimeouts = function(enableTimeouts) {
  1871. this.suite.enableTimeouts(
  1872. arguments.length && enableTimeouts !== undefined ? enableTimeouts : true
  1873. );
  1874. return this;
  1875. };
  1876. /**
  1877. * Forces all tests to either accept a `done` callback or return a promise.
  1878. *
  1879. * @public
  1880. * @return {Mocha} this
  1881. * @chainable
  1882. */
  1883. Mocha.prototype.asyncOnly = function() {
  1884. this.options.asyncOnly = true;
  1885. return this;
  1886. };
  1887. /**
  1888. * Disables syntax highlighting (in browser).
  1889. *
  1890. * @public
  1891. * @return {Mocha} this
  1892. * @chainable
  1893. */
  1894. Mocha.prototype.noHighlighting = function() {
  1895. this.options.noHighlighting = true;
  1896. return this;
  1897. };
  1898. /**
  1899. * Enables uncaught errors to propagate (in browser).
  1900. *
  1901. * @public
  1902. * @return {Mocha} this
  1903. * @chainable
  1904. */
  1905. Mocha.prototype.allowUncaught = function() {
  1906. this.options.allowUncaught = true;
  1907. return this;
  1908. };
  1909. /**
  1910. * @summary
  1911. * Delays root suite execution.
  1912. *
  1913. * @description
  1914. * Used to perform asynch operations before any suites are run.
  1915. *
  1916. * @public
  1917. * @see {@link https://mochajs.org/#delayed-root-suite|delayed root suite}
  1918. * @returns {Mocha} this
  1919. * @chainable
  1920. */
  1921. Mocha.prototype.delay = function delay() {
  1922. this.options.delay = true;
  1923. return this;
  1924. };
  1925. /**
  1926. * Causes tests marked `only` to fail the suite.
  1927. *
  1928. * @public
  1929. * @returns {Mocha} this
  1930. * @chainable
  1931. */
  1932. Mocha.prototype.forbidOnly = function() {
  1933. this.options.forbidOnly = true;
  1934. return this;
  1935. };
  1936. /**
  1937. * Causes pending tests and tests marked `skip` to fail the suite.
  1938. *
  1939. * @public
  1940. * @returns {Mocha} this
  1941. * @chainable
  1942. */
  1943. Mocha.prototype.forbidPending = function() {
  1944. this.options.forbidPending = true;
  1945. return this;
  1946. };
  1947. /**
  1948. * Mocha version as specified by "package.json".
  1949. *
  1950. * @name Mocha#version
  1951. * @type string
  1952. * @readonly
  1953. */
  1954. Object.defineProperty(Mocha.prototype, 'version', {
  1955. value: require('../package.json').version,
  1956. configurable: false,
  1957. enumerable: true,
  1958. writable: false
  1959. });
  1960. /**
  1961. * Callback to be invoked when test execution is complete.
  1962. *
  1963. * @callback DoneCB
  1964. * @param {number} failures - Number of failures that occurred.
  1965. */
  1966. /**
  1967. * Runs root suite and invokes `fn()` when complete.
  1968. *
  1969. * @description
  1970. * To run tests multiple times (or to run tests in files that are
  1971. * already in the `require` cache), make sure to clear them from
  1972. * the cache first!
  1973. *
  1974. * @public
  1975. * @see {@link Mocha#loadFiles}
  1976. * @see {@link Mocha#unloadFiles}
  1977. * @see {@link Runner#run}
  1978. * @param {DoneCB} [fn] - Callback invoked when test execution completed.
  1979. * @return {Runner} runner instance
  1980. */
  1981. Mocha.prototype.run = function(fn) {
  1982. if (this.files.length) {
  1983. this.loadFiles();
  1984. }
  1985. var suite = this.suite;
  1986. var options = this.options;
  1987. options.files = this.files;
  1988. var runner = new exports.Runner(suite, options.delay);
  1989. createStatsCollector(runner);
  1990. var reporter = new this._reporter(runner, options);
  1991. runner.ignoreLeaks = options.ignoreLeaks !== false;
  1992. runner.fullStackTrace = options.fullStackTrace;
  1993. runner.asyncOnly = options.asyncOnly;
  1994. runner.allowUncaught = options.allowUncaught;
  1995. runner.forbidOnly = options.forbidOnly;
  1996. runner.forbidPending = options.forbidPending;
  1997. if (options.grep) {
  1998. runner.grep(options.grep, options.invert);
  1999. }
  2000. if (options.globals) {
  2001. runner.globals(options.globals);
  2002. }
  2003. if (options.growl) {
  2004. this._growl(runner);
  2005. }
  2006. if (options.useColors !== undefined) {
  2007. exports.reporters.Base.useColors = options.useColors;
  2008. }
  2009. exports.reporters.Base.inlineDiffs = options.useInlineDiffs;
  2010. exports.reporters.Base.hideDiff = options.hideDiff;
  2011. function done(failures) {
  2012. fn = fn || utils.noop;
  2013. if (reporter.done) {
  2014. reporter.done(failures, fn);
  2015. } else {
  2016. fn(failures);
  2017. }
  2018. }
  2019. return runner.run(done);
  2020. };
  2021. }).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
  2022. },{"../package.json":89,"./context":5,"./errors":6,"./growl":2,"./hook":7,"./interfaces":11,"./mocharc.json":15,"./reporters":21,"./runnable":33,"./runner":34,"./stats-collector":35,"./suite":36,"./test":37,"./utils":38,"_process":68,"escape-string-regexp":49,"path":42}],15:[function(require,module,exports){
  2023. module.exports={
  2024. "diff": true,
  2025. "extension": ["js"],
  2026. "opts": "./test/mocha.opts",
  2027. "package": "./package.json",
  2028. "reporter": "spec",
  2029. "slow": 75,
  2030. "timeout": 2000,
  2031. "ui": "bdd"
  2032. }
  2033. },{}],16:[function(require,module,exports){
  2034. 'use strict';
  2035. module.exports = Pending;
  2036. /**
  2037. * Initialize a new `Pending` error with the given message.
  2038. *
  2039. * @param {string} message
  2040. */
  2041. function Pending(message) {
  2042. this.message = message;
  2043. }
  2044. },{}],17:[function(require,module,exports){
  2045. (function (process){
  2046. 'use strict';
  2047. /**
  2048. * @module Base
  2049. */
  2050. /**
  2051. * Module dependencies.
  2052. */
  2053. var tty = require('tty');
  2054. var diff = require('diff');
  2055. var milliseconds = require('ms');
  2056. var utils = require('../utils');
  2057. var supportsColor = process.browser ? null : require('supports-color');
  2058. var constants = require('../runner').constants;
  2059. var EVENT_TEST_PASS = constants.EVENT_TEST_PASS;
  2060. var EVENT_TEST_FAIL = constants.EVENT_TEST_FAIL;
  2061. /**
  2062. * Expose `Base`.
  2063. */
  2064. exports = module.exports = Base;
  2065. /**
  2066. * Check if both stdio streams are associated with a tty.
  2067. */
  2068. var isatty = tty.isatty(1) && tty.isatty(2);
  2069. /**
  2070. * Enable coloring by default, except in the browser interface.
  2071. */
  2072. exports.useColors =
  2073. !process.browser &&
  2074. (supportsColor.stdout || process.env.MOCHA_COLORS !== undefined);
  2075. /**
  2076. * Inline diffs instead of +/-
  2077. */
  2078. exports.inlineDiffs = false;
  2079. /**
  2080. * Default color map.
  2081. */
  2082. exports.colors = {
  2083. pass: 90,
  2084. fail: 31,
  2085. 'bright pass': 92,
  2086. 'bright fail': 91,
  2087. 'bright yellow': 93,
  2088. pending: 36,
  2089. suite: 0,
  2090. 'error title': 0,
  2091. 'error message': 31,
  2092. 'error stack': 90,
  2093. checkmark: 32,
  2094. fast: 90,
  2095. medium: 33,
  2096. slow: 31,
  2097. green: 32,
  2098. light: 90,
  2099. 'diff gutter': 90,
  2100. 'diff added': 32,
  2101. 'diff removed': 31
  2102. };
  2103. /**
  2104. * Default symbol map.
  2105. */
  2106. exports.symbols = {
  2107. ok: '✓',
  2108. err: '✖',
  2109. dot: '․',
  2110. comma: ',',
  2111. bang: '!'
  2112. };
  2113. // With node.js on Windows: use symbols available in terminal default fonts
  2114. if (process.platform === 'win32') {
  2115. exports.symbols.ok = '\u221A';
  2116. exports.symbols.err = '\u00D7';
  2117. exports.symbols.dot = '.';
  2118. }
  2119. /**
  2120. * Color `str` with the given `type`,
  2121. * allowing colors to be disabled,
  2122. * as well as user-defined color
  2123. * schemes.
  2124. *
  2125. * @param {string} type
  2126. * @param {string} str
  2127. * @return {string}
  2128. * @private
  2129. */
  2130. var color = (exports.color = function(type, str) {
  2131. if (!exports.useColors) {
  2132. return String(str);
  2133. }
  2134. return '\u001b[' + exports.colors[type] + 'm' + str + '\u001b[0m';
  2135. });
  2136. /**
  2137. * Expose term window size, with some defaults for when stderr is not a tty.
  2138. */
  2139. exports.window = {
  2140. width: 75
  2141. };
  2142. if (isatty) {
  2143. exports.window.width = process.stdout.getWindowSize
  2144. ? process.stdout.getWindowSize(1)[0]
  2145. : tty.getWindowSize()[1];
  2146. }
  2147. /**
  2148. * Expose some basic cursor interactions that are common among reporters.
  2149. */
  2150. exports.cursor = {
  2151. hide: function() {
  2152. isatty && process.stdout.write('\u001b[?25l');
  2153. },
  2154. show: function() {
  2155. isatty && process.stdout.write('\u001b[?25h');
  2156. },
  2157. deleteLine: function() {
  2158. isatty && process.stdout.write('\u001b[2K');
  2159. },
  2160. beginningOfLine: function() {
  2161. isatty && process.stdout.write('\u001b[0G');
  2162. },
  2163. CR: function() {
  2164. if (isatty) {
  2165. exports.cursor.deleteLine();
  2166. exports.cursor.beginningOfLine();
  2167. } else {
  2168. process.stdout.write('\r');
  2169. }
  2170. }
  2171. };
  2172. function showDiff(err) {
  2173. return (
  2174. err &&
  2175. err.showDiff !== false &&
  2176. sameType(err.actual, err.expected) &&
  2177. err.expected !== undefined
  2178. );
  2179. }
  2180. function stringifyDiffObjs(err) {
  2181. if (!utils.isString(err.actual) || !utils.isString(err.expected)) {
  2182. err.actual = utils.stringify(err.actual);
  2183. err.expected = utils.stringify(err.expected);
  2184. }
  2185. }
  2186. /**
  2187. * Returns a diff between 2 strings with coloured ANSI output.
  2188. *
  2189. * The diff will be either inline or unified dependant on the value
  2190. * of `Base.inlineDiff`.
  2191. *
  2192. * @param {string} actual
  2193. * @param {string} expected
  2194. * @return {string} Diff
  2195. */
  2196. var generateDiff = (exports.generateDiff = function(actual, expected) {
  2197. return exports.inlineDiffs
  2198. ? inlineDiff(actual, expected)
  2199. : unifiedDiff(actual, expected);
  2200. });
  2201. /**
  2202. * Output the given `failures` as a list.
  2203. *
  2204. * @public
  2205. * @memberof Mocha.reporters.Base
  2206. * @variation 1
  2207. * @param {Array} failures
  2208. */
  2209. exports.list = function(failures) {
  2210. console.log();
  2211. failures.forEach(function(test, i) {
  2212. // format
  2213. var fmt =
  2214. color('error title', ' %s) %s:\n') +
  2215. color('error message', ' %s') +
  2216. color('error stack', '\n%s\n');
  2217. // msg
  2218. var msg;
  2219. var err = test.err;
  2220. var message;
  2221. if (err.message && typeof err.message.toString === 'function') {
  2222. message = err.message + '';
  2223. } else if (typeof err.inspect === 'function') {
  2224. message = err.inspect() + '';
  2225. } else {
  2226. message = '';
  2227. }
  2228. var stack = err.stack || message;
  2229. var index = message ? stack.indexOf(message) : -1;
  2230. if (index === -1) {
  2231. msg = message;
  2232. } else {
  2233. index += message.length;
  2234. msg = stack.slice(0, index);
  2235. // remove msg from stack
  2236. stack = stack.slice(index + 1);
  2237. }
  2238. // uncaught
  2239. if (err.uncaught) {
  2240. msg = 'Uncaught ' + msg;
  2241. }
  2242. // explicitly show diff
  2243. if (!exports.hideDiff && showDiff(err)) {
  2244. stringifyDiffObjs(err);
  2245. fmt =
  2246. color('error title', ' %s) %s:\n%s') + color('error stack', '\n%s\n');
  2247. var match = message.match(/^([^:]+): expected/);
  2248. msg = '\n ' + color('error message', match ? match[1] : msg);
  2249. msg += generateDiff(err.actual, err.expected);
  2250. }
  2251. // indent stack trace
  2252. stack = stack.replace(/^/gm, ' ');
  2253. // indented test title
  2254. var testTitle = '';
  2255. test.titlePath().forEach(function(str, index) {
  2256. if (index !== 0) {
  2257. testTitle += '\n ';
  2258. }
  2259. for (var i = 0; i < index; i++) {
  2260. testTitle += ' ';
  2261. }
  2262. testTitle += str;
  2263. });
  2264. console.log(fmt, i + 1, testTitle, msg, stack);
  2265. });
  2266. };
  2267. /**
  2268. * Initialize a new `Base` reporter.
  2269. *
  2270. * All other reporters generally
  2271. * inherit from this reporter.
  2272. *
  2273. * @memberof Mocha.reporters
  2274. * @public
  2275. * @class
  2276. * @param {Runner} runner
  2277. */
  2278. function Base(runner) {
  2279. var failures = (this.failures = []);
  2280. if (!runner) {
  2281. throw new TypeError('Missing runner argument');
  2282. }
  2283. this.stats = runner.stats; // assigned so Reporters keep a closer reference
  2284. this.runner = runner;
  2285. runner.on(EVENT_TEST_PASS, function(test) {
  2286. if (test.duration > test.slow()) {
  2287. test.speed = 'slow';
  2288. } else if (test.duration > test.slow() / 2) {
  2289. test.speed = 'medium';
  2290. } else {
  2291. test.speed = 'fast';
  2292. }
  2293. });
  2294. runner.on(EVENT_TEST_FAIL, function(test, err) {
  2295. if (showDiff(err)) {
  2296. stringifyDiffObjs(err);
  2297. }
  2298. test.err = err;
  2299. failures.push(test);
  2300. });
  2301. }
  2302. /**
  2303. * Output common epilogue used by many of
  2304. * the bundled reporters.
  2305. *
  2306. * @memberof Mocha.reporters.Base
  2307. * @public
  2308. */
  2309. Base.prototype.epilogue = function() {
  2310. var stats = this.stats;
  2311. var fmt;
  2312. console.log();
  2313. // passes
  2314. fmt =
  2315. color('bright pass', ' ') +
  2316. color('green', ' %d passing') +
  2317. color('light', ' (%s)');
  2318. console.log(fmt, stats.passes || 0, milliseconds(stats.duration));
  2319. // pending
  2320. if (stats.pending) {
  2321. fmt = color('pending', ' ') + color('pending', ' %d pending');
  2322. console.log(fmt, stats.pending);
  2323. }
  2324. // failures
  2325. if (stats.failures) {
  2326. fmt = color('fail', ' %d failing');
  2327. console.log(fmt, stats.failures);
  2328. Base.list(this.failures);
  2329. console.log();
  2330. }
  2331. console.log();
  2332. };
  2333. /**
  2334. * Pad the given `str` to `len`.
  2335. *
  2336. * @private
  2337. * @param {string} str
  2338. * @param {string} len
  2339. * @return {string}
  2340. */
  2341. function pad(str, len) {
  2342. str = String(str);
  2343. return Array(len - str.length + 1).join(' ') + str;
  2344. }
  2345. /**
  2346. * Returns an inline diff between 2 strings with coloured ANSI output.
  2347. *
  2348. * @private
  2349. * @param {String} actual
  2350. * @param {String} expected
  2351. * @return {string} Diff
  2352. */
  2353. function inlineDiff(actual, expected) {
  2354. var msg = errorDiff(actual, expected);
  2355. // linenos
  2356. var lines = msg.split('\n');
  2357. if (lines.length > 4) {
  2358. var width = String(lines.length).length;
  2359. msg = lines
  2360. .map(function(str, i) {
  2361. return pad(++i, width) + ' |' + ' ' + str;
  2362. })
  2363. .join('\n');
  2364. }
  2365. // legend
  2366. msg =
  2367. '\n' +
  2368. color('diff removed', 'actual') +
  2369. ' ' +
  2370. color('diff added', 'expected') +
  2371. '\n\n' +
  2372. msg +
  2373. '\n';
  2374. // indent
  2375. msg = msg.replace(/^/gm, ' ');
  2376. return msg;
  2377. }
  2378. /**
  2379. * Returns a unified diff between two strings with coloured ANSI output.
  2380. *
  2381. * @private
  2382. * @param {String} actual
  2383. * @param {String} expected
  2384. * @return {string} The diff.
  2385. */
  2386. function unifiedDiff(actual, expected) {
  2387. var indent = ' ';
  2388. function cleanUp(line) {
  2389. if (line[0] === '+') {
  2390. return indent + colorLines('diff added', line);
  2391. }
  2392. if (line[0] === '-') {
  2393. return indent + colorLines('diff removed', line);
  2394. }
  2395. if (line.match(/@@/)) {
  2396. return '--';
  2397. }
  2398. if (line.match(/\\ No newline/)) {
  2399. return null;
  2400. }
  2401. return indent + line;
  2402. }
  2403. function notBlank(line) {
  2404. return typeof line !== 'undefined' && line !== null;
  2405. }
  2406. var msg = diff.createPatch('string', actual, expected);
  2407. var lines = msg.split('\n').splice(5);
  2408. return (
  2409. '\n ' +
  2410. colorLines('diff added', '+ expected') +
  2411. ' ' +
  2412. colorLines('diff removed', '- actual') +
  2413. '\n\n' +
  2414. lines
  2415. .map(cleanUp)
  2416. .filter(notBlank)
  2417. .join('\n')
  2418. );
  2419. }
  2420. /**
  2421. * Return a character diff for `err`.
  2422. *
  2423. * @private
  2424. * @param {String} actual
  2425. * @param {String} expected
  2426. * @return {string} the diff
  2427. */
  2428. function errorDiff(actual, expected) {
  2429. return diff
  2430. .diffWordsWithSpace(actual, expected)
  2431. .map(function(str) {
  2432. if (str.added) {
  2433. return colorLines('diff added', str.value);
  2434. }
  2435. if (str.removed) {
  2436. return colorLines('diff removed', str.value);
  2437. }
  2438. return str.value;
  2439. })
  2440. .join('');
  2441. }
  2442. /**
  2443. * Color lines for `str`, using the color `name`.
  2444. *
  2445. * @private
  2446. * @param {string} name
  2447. * @param {string} str
  2448. * @return {string}
  2449. */
  2450. function colorLines(name, str) {
  2451. return str
  2452. .split('\n')
  2453. .map(function(str) {
  2454. return color(name, str);
  2455. })
  2456. .join('\n');
  2457. }
  2458. /**
  2459. * Object#toString reference.
  2460. */
  2461. var objToString = Object.prototype.toString;
  2462. /**
  2463. * Check that a / b have the same type.
  2464. *
  2465. * @private
  2466. * @param {Object} a
  2467. * @param {Object} b
  2468. * @return {boolean}
  2469. */
  2470. function sameType(a, b) {
  2471. return objToString.call(a) === objToString.call(b);
  2472. }
  2473. Base.abstract = true;
  2474. }).call(this,require('_process'))
  2475. },{"../runner":34,"../utils":38,"_process":68,"diff":48,"ms":60,"supports-color":42,"tty":4}],18:[function(require,module,exports){
  2476. 'use strict';
  2477. /**
  2478. * @module Doc
  2479. */
  2480. /**
  2481. * Module dependencies.
  2482. */
  2483. var Base = require('./base');
  2484. var utils = require('../utils');
  2485. var constants = require('../runner').constants;
  2486. var EVENT_TEST_PASS = constants.EVENT_TEST_PASS;
  2487. var EVENT_TEST_FAIL = constants.EVENT_TEST_FAIL;
  2488. var EVENT_SUITE_BEGIN = constants.EVENT_SUITE_BEGIN;
  2489. var EVENT_SUITE_END = constants.EVENT_SUITE_END;
  2490. /**
  2491. * Expose `Doc`.
  2492. */
  2493. exports = module.exports = Doc;
  2494. /**
  2495. * Initialize a new `Doc` reporter.
  2496. *
  2497. * @class
  2498. * @memberof Mocha.reporters
  2499. * @extends {Base}
  2500. * @public
  2501. * @param {Runner} runner
  2502. */
  2503. function Doc(runner) {
  2504. Base.call(this, runner);
  2505. var indents = 2;
  2506. function indent() {
  2507. return Array(indents).join(' ');
  2508. }
  2509. runner.on(EVENT_SUITE_BEGIN, function(suite) {
  2510. if (suite.root) {
  2511. return;
  2512. }
  2513. ++indents;
  2514. console.log('%s<section class="suite">', indent());
  2515. ++indents;
  2516. console.log('%s<h1>%s</h1>', indent(), utils.escape(suite.title));
  2517. console.log('%s<dl>', indent());
  2518. });
  2519. runner.on(EVENT_SUITE_END, function(suite) {
  2520. if (suite.root) {
  2521. return;
  2522. }
  2523. console.log('%s</dl>', indent());
  2524. --indents;
  2525. console.log('%s</section>', indent());
  2526. --indents;
  2527. });
  2528. runner.on(EVENT_TEST_PASS, function(test) {
  2529. console.log('%s <dt>%s</dt>', indent(), utils.escape(test.title));
  2530. var code = utils.escape(utils.clean(test.body));
  2531. console.log('%s <dd><pre><code>%s</code></pre></dd>', indent(), code);
  2532. });
  2533. runner.on(EVENT_TEST_FAIL, function(test, err) {
  2534. console.log(
  2535. '%s <dt class="error">%s</dt>',
  2536. indent(),
  2537. utils.escape(test.title)
  2538. );
  2539. var code = utils.escape(utils.clean(test.body));
  2540. console.log(
  2541. '%s <dd class="error"><pre><code>%s</code></pre></dd>',
  2542. indent(),
  2543. code
  2544. );
  2545. console.log('%s <dd class="error">%s</dd>', indent(), utils.escape(err));
  2546. });
  2547. }
  2548. Doc.description = 'HTML documentation';
  2549. },{"../runner":34,"../utils":38,"./base":17}],19:[function(require,module,exports){
  2550. (function (process){
  2551. 'use strict';
  2552. /**
  2553. * @module Dot
  2554. */
  2555. /**
  2556. * Module dependencies.
  2557. */
  2558. var Base = require('./base');
  2559. var inherits = require('../utils').inherits;
  2560. var constants = require('../runner').constants;
  2561. var EVENT_TEST_PASS = constants.EVENT_TEST_PASS;
  2562. var EVENT_TEST_FAIL = constants.EVENT_TEST_FAIL;
  2563. var EVENT_RUN_BEGIN = constants.EVENT_RUN_BEGIN;
  2564. var EVENT_TEST_PENDING = constants.EVENT_TEST_PENDING;
  2565. var EVENT_RUN_END = constants.EVENT_RUN_END;
  2566. /**
  2567. * Expose `Dot`.
  2568. */
  2569. exports = module.exports = Dot;
  2570. /**
  2571. * Initialize a new `Dot` matrix test reporter.
  2572. *
  2573. * @class
  2574. * @memberof Mocha.reporters
  2575. * @extends Mocha.reporters.Base
  2576. * @public
  2577. * @param {Runner} runner
  2578. */
  2579. function Dot(runner) {
  2580. Base.call(this, runner);
  2581. var self = this;
  2582. var width = (Base.window.width * 0.75) | 0;
  2583. var n = -1;
  2584. runner.on(EVENT_RUN_BEGIN, function() {
  2585. process.stdout.write('\n');
  2586. });
  2587. runner.on(EVENT_TEST_PENDING, function() {
  2588. if (++n % width === 0) {
  2589. process.stdout.write('\n ');
  2590. }
  2591. process.stdout.write(Base.color('pending', Base.symbols.comma));
  2592. });
  2593. runner.on(EVENT_TEST_PASS, function(test) {
  2594. if (++n % width === 0) {
  2595. process.stdout.write('\n ');
  2596. }
  2597. if (test.speed === 'slow') {
  2598. process.stdout.write(Base.color('bright yellow', Base.symbols.dot));
  2599. } else {
  2600. process.stdout.write(Base.color(test.speed, Base.symbols.dot));
  2601. }
  2602. });
  2603. runner.on(EVENT_TEST_FAIL, function() {
  2604. if (++n % width === 0) {
  2605. process.stdout.write('\n ');
  2606. }
  2607. process.stdout.write(Base.color('fail', Base.symbols.bang));
  2608. });
  2609. runner.once(EVENT_RUN_END, function() {
  2610. console.log();
  2611. self.epilogue();
  2612. });
  2613. }
  2614. /**
  2615. * Inherit from `Base.prototype`.
  2616. */
  2617. inherits(Dot, Base);
  2618. Dot.description = 'dot matrix representation';
  2619. }).call(this,require('_process'))
  2620. },{"../runner":34,"../utils":38,"./base":17,"_process":68}],20:[function(require,module,exports){
  2621. (function (global){
  2622. 'use strict';
  2623. /* eslint-env browser */
  2624. /**
  2625. * @module HTML
  2626. */
  2627. /**
  2628. * Module dependencies.
  2629. */
  2630. var Base = require('./base');
  2631. var utils = require('../utils');
  2632. var Progress = require('../browser/progress');
  2633. var escapeRe = require('escape-string-regexp');
  2634. var constants = require('../runner').constants;
  2635. var EVENT_TEST_PASS = constants.EVENT_TEST_PASS;
  2636. var EVENT_TEST_FAIL = constants.EVENT_TEST_FAIL;
  2637. var EVENT_SUITE_BEGIN = constants.EVENT_SUITE_BEGIN;
  2638. var EVENT_SUITE_END = constants.EVENT_SUITE_END;
  2639. var EVENT_TEST_PENDING = constants.EVENT_TEST_PENDING;
  2640. var escape = utils.escape;
  2641. /**
  2642. * Save timer references to avoid Sinon interfering (see GH-237).
  2643. */
  2644. var Date = global.Date;
  2645. /**
  2646. * Expose `HTML`.
  2647. */
  2648. exports = module.exports = HTML;
  2649. /**
  2650. * Stats template.
  2651. */
  2652. var statsTemplate =
  2653. '<ul id="mocha-stats">' +
  2654. '<li class="progress"><canvas width="40" height="40"></canvas></li>' +
  2655. '<li class="passes"><a href="javascript:void(0);">passes:</a> <em>0</em></li>' +
  2656. '<li class="failures"><a href="javascript:void(0);">failures:</a> <em>0</em></li>' +
  2657. '<li class="duration">duration: <em>0</em>s</li>' +
  2658. '</ul>';
  2659. var playIcon = '&#x2023;';
  2660. /**
  2661. * Initialize a new `HTML` reporter.
  2662. *
  2663. * @public
  2664. * @class
  2665. * @memberof Mocha.reporters
  2666. * @extends Mocha.reporters.Base
  2667. * @param {Runner} runner
  2668. */
  2669. function HTML(runner) {
  2670. Base.call(this, runner);
  2671. var self = this;
  2672. var stats = this.stats;
  2673. var stat = fragment(statsTemplate);
  2674. var items = stat.getElementsByTagName('li');
  2675. var passes = items[1].getElementsByTagName('em')[0];
  2676. var passesLink = items[1].getElementsByTagName('a')[0];
  2677. var failures = items[2].getElementsByTagName('em')[0];
  2678. var failuresLink = items[2].getElementsByTagName('a')[0];
  2679. var duration = items[3].getElementsByTagName('em')[0];
  2680. var canvas = stat.getElementsByTagName('canvas')[0];
  2681. var report = fragment('<ul id="mocha-report"></ul>');
  2682. var stack = [report];
  2683. var progress;
  2684. var ctx;
  2685. var root = document.getElementById('mocha');
  2686. if (canvas.getContext) {
  2687. var ratio = window.devicePixelRatio || 1;
  2688. canvas.style.width = canvas.width;
  2689. canvas.style.height = canvas.height;
  2690. canvas.width *= ratio;
  2691. canvas.height *= ratio;
  2692. ctx = canvas.getContext('2d');
  2693. ctx.scale(ratio, ratio);
  2694. progress = new Progress();
  2695. }
  2696. if (!root) {
  2697. return error('#mocha div missing, add it to your document');
  2698. }
  2699. // pass toggle
  2700. on(passesLink, 'click', function(evt) {
  2701. evt.preventDefault();
  2702. unhide();
  2703. var name = /pass/.test(report.className) ? '' : ' pass';
  2704. report.className = report.className.replace(/fail|pass/g, '') + name;
  2705. if (report.className.trim()) {
  2706. hideSuitesWithout('test pass');
  2707. }
  2708. });
  2709. // failure toggle
  2710. on(failuresLink, 'click', function(evt) {
  2711. evt.preventDefault();
  2712. unhide();
  2713. var name = /fail/.test(report.className) ? '' : ' fail';
  2714. report.className = report.className.replace(/fail|pass/g, '') + name;
  2715. if (report.className.trim()) {
  2716. hideSuitesWithout('test fail');
  2717. }
  2718. });
  2719. root.appendChild(stat);
  2720. root.appendChild(report);
  2721. if (progress) {
  2722. progress.size(40);
  2723. }
  2724. runner.on(EVENT_SUITE_BEGIN, function(suite) {
  2725. if (suite.root) {
  2726. return;
  2727. }
  2728. // suite
  2729. var url = self.suiteURL(suite);
  2730. var el = fragment(
  2731. '<li class="suite"><h1><a href="%s">%s</a></h1></li>',
  2732. url,
  2733. escape(suite.title)
  2734. );
  2735. // container
  2736. stack[0].appendChild(el);
  2737. stack.unshift(document.createElement('ul'));
  2738. el.appendChild(stack[0]);
  2739. });
  2740. runner.on(EVENT_SUITE_END, function(suite) {
  2741. if (suite.root) {
  2742. updateStats();
  2743. return;
  2744. }
  2745. stack.shift();
  2746. });
  2747. runner.on(EVENT_TEST_PASS, function(test) {
  2748. var url = self.testURL(test);
  2749. var markup =
  2750. '<li class="test pass %e"><h2>%e<span class="duration">%ems</span> ' +
  2751. '<a href="%s" class="replay">' +
  2752. playIcon +
  2753. '</a></h2></li>';
  2754. var el = fragment(markup, test.speed, test.title, test.duration, url);
  2755. self.addCodeToggle(el, test.body);
  2756. appendToStack(el);
  2757. updateStats();
  2758. });
  2759. runner.on(EVENT_TEST_FAIL, function(test) {
  2760. var el = fragment(
  2761. '<li class="test fail"><h2>%e <a href="%e" class="replay">' +
  2762. playIcon +
  2763. '</a></h2></li>',
  2764. test.title,
  2765. self.testURL(test)
  2766. );
  2767. var stackString; // Note: Includes leading newline
  2768. var message = test.err.toString();
  2769. // <=IE7 stringifies to [Object Error]. Since it can be overloaded, we
  2770. // check for the result of the stringifying.
  2771. if (message === '[object Error]') {
  2772. message = test.err.message;
  2773. }
  2774. if (test.err.stack) {
  2775. var indexOfMessage = test.err.stack.indexOf(test.err.message);
  2776. if (indexOfMessage === -1) {
  2777. stackString = test.err.stack;
  2778. } else {
  2779. stackString = test.err.stack.substr(
  2780. test.err.message.length + indexOfMessage
  2781. );
  2782. }
  2783. } else if (test.err.sourceURL && test.err.line !== undefined) {
  2784. // Safari doesn't give you a stack. Let's at least provide a source line.
  2785. stackString = '\n(' + test.err.sourceURL + ':' + test.err.line + ')';
  2786. }
  2787. stackString = stackString || '';
  2788. if (test.err.htmlMessage && stackString) {
  2789. el.appendChild(
  2790. fragment(
  2791. '<div class="html-error">%s\n<pre class="error">%e</pre></div>',
  2792. test.err.htmlMessage,
  2793. stackString
  2794. )
  2795. );
  2796. } else if (test.err.htmlMessage) {
  2797. el.appendChild(
  2798. fragment('<div class="html-error">%s</div>', test.err.htmlMessage)
  2799. );
  2800. } else {
  2801. el.appendChild(
  2802. fragment('<pre class="error">%e%e</pre>', message, stackString)
  2803. );
  2804. }
  2805. self.addCodeToggle(el, test.body);
  2806. appendToStack(el);
  2807. updateStats();
  2808. });
  2809. runner.on(EVENT_TEST_PENDING, function(test) {
  2810. var el = fragment(
  2811. '<li class="test pass pending"><h2>%e</h2></li>',
  2812. test.title
  2813. );
  2814. appendToStack(el);
  2815. updateStats();
  2816. });
  2817. function appendToStack(el) {
  2818. // Don't call .appendChild if #mocha-report was already .shift()'ed off the stack.
  2819. if (stack[0]) {
  2820. stack[0].appendChild(el);
  2821. }
  2822. }
  2823. function updateStats() {
  2824. // TODO: add to stats
  2825. var percent = ((stats.tests / runner.total) * 100) | 0;
  2826. if (progress) {
  2827. progress.update(percent).draw(ctx);
  2828. }
  2829. // update stats
  2830. var ms = new Date() - stats.start;
  2831. text(passes, stats.passes);
  2832. text(failures, stats.failures);
  2833. text(duration, (ms / 1000).toFixed(2));
  2834. }
  2835. }
  2836. /**
  2837. * Makes a URL, preserving querystring ("search") parameters.
  2838. *
  2839. * @param {string} s
  2840. * @return {string} A new URL.
  2841. */
  2842. function makeUrl(s) {
  2843. var search = window.location.search;
  2844. // Remove previous grep query parameter if present
  2845. if (search) {
  2846. search = search.replace(/[?&]grep=[^&\s]*/g, '').replace(/^&/, '?');
  2847. }
  2848. return (
  2849. window.location.pathname +
  2850. (search ? search + '&' : '?') +
  2851. 'grep=' +
  2852. encodeURIComponent(escapeRe(s))
  2853. );
  2854. }
  2855. /**
  2856. * Provide suite URL.
  2857. *
  2858. * @param {Object} [suite]
  2859. */
  2860. HTML.prototype.suiteURL = function(suite) {
  2861. return makeUrl(suite.fullTitle());
  2862. };
  2863. /**
  2864. * Provide test URL.
  2865. *
  2866. * @param {Object} [test]
  2867. */
  2868. HTML.prototype.testURL = function(test) {
  2869. return makeUrl(test.fullTitle());
  2870. };
  2871. /**
  2872. * Adds code toggle functionality for the provided test's list element.
  2873. *
  2874. * @param {HTMLLIElement} el
  2875. * @param {string} contents
  2876. */
  2877. HTML.prototype.addCodeToggle = function(el, contents) {
  2878. var h2 = el.getElementsByTagName('h2')[0];
  2879. on(h2, 'click', function() {
  2880. pre.style.display = pre.style.display === 'none' ? 'block' : 'none';
  2881. });
  2882. var pre = fragment('<pre><code>%e</code></pre>', utils.clean(contents));
  2883. el.appendChild(pre);
  2884. pre.style.display = 'none';
  2885. };
  2886. /**
  2887. * Display error `msg`.
  2888. *
  2889. * @param {string} msg
  2890. */
  2891. function error(msg) {
  2892. document.body.appendChild(fragment('<div id="mocha-error">%s</div>', msg));
  2893. }
  2894. /**
  2895. * Return a DOM fragment from `html`.
  2896. *
  2897. * @param {string} html
  2898. */
  2899. function fragment(html) {
  2900. var args = arguments;
  2901. var div = document.createElement('div');
  2902. var i = 1;
  2903. div.innerHTML = html.replace(/%([se])/g, function(_, type) {
  2904. switch (type) {
  2905. case 's':
  2906. return String(args[i++]);
  2907. case 'e':
  2908. return escape(args[i++]);
  2909. // no default
  2910. }
  2911. });
  2912. return div.firstChild;
  2913. }
  2914. /**
  2915. * Check for suites that do not have elements
  2916. * with `classname`, and hide them.
  2917. *
  2918. * @param {text} classname
  2919. */
  2920. function hideSuitesWithout(classname) {
  2921. var suites = document.getElementsByClassName('suite');
  2922. for (var i = 0; i < suites.length; i++) {
  2923. var els = suites[i].getElementsByClassName(classname);
  2924. if (!els.length) {
  2925. suites[i].className += ' hidden';
  2926. }
  2927. }
  2928. }
  2929. /**
  2930. * Unhide .hidden suites.
  2931. */
  2932. function unhide() {
  2933. var els = document.getElementsByClassName('suite hidden');
  2934. for (var i = 0; i < els.length; ++i) {
  2935. els[i].className = els[i].className.replace('suite hidden', 'suite');
  2936. }
  2937. }
  2938. /**
  2939. * Set an element's text contents.
  2940. *
  2941. * @param {HTMLElement} el
  2942. * @param {string} contents
  2943. */
  2944. function text(el, contents) {
  2945. if (el.textContent) {
  2946. el.textContent = contents;
  2947. } else {
  2948. el.innerText = contents;
  2949. }
  2950. }
  2951. /**
  2952. * Listen on `event` with callback `fn`.
  2953. */
  2954. function on(el, event, fn) {
  2955. if (el.addEventListener) {
  2956. el.addEventListener(event, fn, false);
  2957. } else {
  2958. el.attachEvent('on' + event, fn);
  2959. }
  2960. }
  2961. HTML.browserOnly = true;
  2962. }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
  2963. },{"../browser/progress":3,"../runner":34,"../utils":38,"./base":17,"escape-string-regexp":49}],21:[function(require,module,exports){
  2964. 'use strict';
  2965. // Alias exports to a their normalized format Mocha#reporter to prevent a need
  2966. // for dynamic (try/catch) requires, which Browserify doesn't handle.
  2967. exports.Base = exports.base = require('./base');
  2968. exports.Dot = exports.dot = require('./dot');
  2969. exports.Doc = exports.doc = require('./doc');
  2970. exports.TAP = exports.tap = require('./tap');
  2971. exports.JSON = exports.json = require('./json');
  2972. exports.HTML = exports.html = require('./html');
  2973. exports.List = exports.list = require('./list');
  2974. exports.Min = exports.min = require('./min');
  2975. exports.Spec = exports.spec = require('./spec');
  2976. exports.Nyan = exports.nyan = require('./nyan');
  2977. exports.XUnit = exports.xunit = require('./xunit');
  2978. exports.Markdown = exports.markdown = require('./markdown');
  2979. exports.Progress = exports.progress = require('./progress');
  2980. exports.Landing = exports.landing = require('./landing');
  2981. exports.JSONStream = exports['json-stream'] = require('./json-stream');
  2982. },{"./base":17,"./doc":18,"./dot":19,"./html":20,"./json":23,"./json-stream":22,"./landing":24,"./list":25,"./markdown":26,"./min":27,"./nyan":28,"./progress":29,"./spec":30,"./tap":31,"./xunit":32}],22:[function(require,module,exports){
  2983. (function (process){
  2984. 'use strict';
  2985. /**
  2986. * @module JSONStream
  2987. */
  2988. /**
  2989. * Module dependencies.
  2990. */
  2991. var Base = require('./base');
  2992. var constants = require('../runner').constants;
  2993. var EVENT_TEST_PASS = constants.EVENT_TEST_PASS;
  2994. var EVENT_TEST_FAIL = constants.EVENT_TEST_FAIL;
  2995. var EVENT_RUN_BEGIN = constants.EVENT_RUN_BEGIN;
  2996. var EVENT_RUN_END = constants.EVENT_RUN_END;
  2997. /**
  2998. * Expose `JSONStream`.
  2999. */
  3000. exports = module.exports = JSONStream;
  3001. /**
  3002. * Constructs a new `JSONStream` reporter instance.
  3003. *
  3004. * @public
  3005. * @class
  3006. * @extends Mocha.reporters.Base
  3007. * @memberof Mocha.reporters
  3008. * @param {Runner} runner - Instance triggers reporter actions.
  3009. */
  3010. function JSONStream(runner) {
  3011. Base.call(this, runner);
  3012. var self = this;
  3013. var total = runner.total;
  3014. runner.once(EVENT_RUN_BEGIN, function() {
  3015. writeEvent(['start', {total: total}]);
  3016. });
  3017. runner.on(EVENT_TEST_PASS, function(test) {
  3018. writeEvent(['pass', clean(test)]);
  3019. });
  3020. runner.on(EVENT_TEST_FAIL, function(test, err) {
  3021. test = clean(test);
  3022. test.err = err.message;
  3023. test.stack = err.stack || null;
  3024. writeEvent(['fail', test]);
  3025. });
  3026. runner.once(EVENT_RUN_END, function() {
  3027. writeEvent(['end', self.stats]);
  3028. });
  3029. }
  3030. /**
  3031. * Mocha event to be written to the output stream.
  3032. * @typedef {Array} JSONStream~MochaEvent
  3033. */
  3034. /**
  3035. * Writes Mocha event to reporter output stream.
  3036. *
  3037. * @private
  3038. * @param {JSONStream~MochaEvent} event - Mocha event to be output.
  3039. */
  3040. function writeEvent(event) {
  3041. process.stdout.write(JSON.stringify(event) + '\n');
  3042. }
  3043. /**
  3044. * Returns an object literal representation of `test`
  3045. * free of cyclic properties, etc.
  3046. *
  3047. * @private
  3048. * @param {Test} test - Instance used as data source.
  3049. * @return {Object} object containing pared-down test instance data
  3050. */
  3051. function clean(test) {
  3052. return {
  3053. title: test.title,
  3054. fullTitle: test.fullTitle(),
  3055. duration: test.duration,
  3056. currentRetry: test.currentRetry()
  3057. };
  3058. }
  3059. JSONStream.description = 'newline delimited JSON events';
  3060. }).call(this,require('_process'))
  3061. },{"../runner":34,"./base":17,"_process":68}],23:[function(require,module,exports){
  3062. (function (process){
  3063. 'use strict';
  3064. /**
  3065. * @module JSON
  3066. */
  3067. /**
  3068. * Module dependencies.
  3069. */
  3070. var Base = require('./base');
  3071. var constants = require('../runner').constants;
  3072. var EVENT_TEST_PASS = constants.EVENT_TEST_PASS;
  3073. var EVENT_TEST_FAIL = constants.EVENT_TEST_FAIL;
  3074. var EVENT_TEST_END = constants.EVENT_TEST_END;
  3075. var EVENT_RUN_END = constants.EVENT_RUN_END;
  3076. var EVENT_TEST_PENDING = constants.EVENT_TEST_PENDING;
  3077. /**
  3078. * Expose `JSON`.
  3079. */
  3080. exports = module.exports = JSONReporter;
  3081. /**
  3082. * Initialize a new `JSON` reporter.
  3083. *
  3084. * @public
  3085. * @class JSON
  3086. * @memberof Mocha.reporters
  3087. * @extends Mocha.reporters.Base
  3088. * @param {Runner} runner
  3089. */
  3090. function JSONReporter(runner) {
  3091. Base.call(this, runner);
  3092. var self = this;
  3093. var tests = [];
  3094. var pending = [];
  3095. var failures = [];
  3096. var passes = [];
  3097. runner.on(EVENT_TEST_END, function(test) {
  3098. tests.push(test);
  3099. });
  3100. runner.on(EVENT_TEST_PASS, function(test) {
  3101. passes.push(test);
  3102. });
  3103. runner.on(EVENT_TEST_FAIL, function(test) {
  3104. failures.push(test);
  3105. });
  3106. runner.on(EVENT_TEST_PENDING, function(test) {
  3107. pending.push(test);
  3108. });
  3109. runner.once(EVENT_RUN_END, function() {
  3110. var obj = {
  3111. stats: self.stats,
  3112. tests: tests.map(clean),
  3113. pending: pending.map(clean),
  3114. failures: failures.map(clean),
  3115. passes: passes.map(clean)
  3116. };
  3117. runner.testResults = obj;
  3118. process.stdout.write(JSON.stringify(obj, null, 2));
  3119. });
  3120. }
  3121. /**
  3122. * Return a plain-object representation of `test`
  3123. * free of cyclic properties etc.
  3124. *
  3125. * @private
  3126. * @param {Object} test
  3127. * @return {Object}
  3128. */
  3129. function clean(test) {
  3130. var err = test.err || {};
  3131. if (err instanceof Error) {
  3132. err = errorJSON(err);
  3133. }
  3134. return {
  3135. title: test.title,
  3136. fullTitle: test.fullTitle(),
  3137. duration: test.duration,
  3138. currentRetry: test.currentRetry(),
  3139. err: cleanCycles(err)
  3140. };
  3141. }
  3142. /**
  3143. * Replaces any circular references inside `obj` with '[object Object]'
  3144. *
  3145. * @private
  3146. * @param {Object} obj
  3147. * @return {Object}
  3148. */
  3149. function cleanCycles(obj) {
  3150. var cache = [];
  3151. return JSON.parse(
  3152. JSON.stringify(obj, function(key, value) {
  3153. if (typeof value === 'object' && value !== null) {
  3154. if (cache.indexOf(value) !== -1) {
  3155. // Instead of going in a circle, we'll print [object Object]
  3156. return '' + value;
  3157. }
  3158. cache.push(value);
  3159. }
  3160. return value;
  3161. })
  3162. );
  3163. }
  3164. /**
  3165. * Transform an Error object into a JSON object.
  3166. *
  3167. * @private
  3168. * @param {Error} err
  3169. * @return {Object}
  3170. */
  3171. function errorJSON(err) {
  3172. var res = {};
  3173. Object.getOwnPropertyNames(err).forEach(function(key) {
  3174. res[key] = err[key];
  3175. }, err);
  3176. return res;
  3177. }
  3178. JSONReporter.description = 'single JSON object';
  3179. }).call(this,require('_process'))
  3180. },{"../runner":34,"./base":17,"_process":68}],24:[function(require,module,exports){
  3181. (function (process){
  3182. 'use strict';
  3183. /**
  3184. * @module Landing
  3185. */
  3186. /**
  3187. * Module dependencies.
  3188. */
  3189. var Base = require('./base');
  3190. var inherits = require('../utils').inherits;
  3191. var constants = require('../runner').constants;
  3192. var EVENT_RUN_BEGIN = constants.EVENT_RUN_BEGIN;
  3193. var EVENT_RUN_END = constants.EVENT_RUN_END;
  3194. var EVENT_TEST_END = constants.EVENT_TEST_END;
  3195. var STATE_FAILED = require('../runnable').constants.STATE_FAILED;
  3196. var cursor = Base.cursor;
  3197. var color = Base.color;
  3198. /**
  3199. * Expose `Landing`.
  3200. */
  3201. exports = module.exports = Landing;
  3202. /**
  3203. * Airplane color.
  3204. */
  3205. Base.colors.plane = 0;
  3206. /**
  3207. * Airplane crash color.
  3208. */
  3209. Base.colors['plane crash'] = 31;
  3210. /**
  3211. * Runway color.
  3212. */
  3213. Base.colors.runway = 90;
  3214. /**
  3215. * Initialize a new `Landing` reporter.
  3216. *
  3217. * @public
  3218. * @class
  3219. * @memberof Mocha.reporters
  3220. * @extends Mocha.reporters.Base
  3221. * @param {Runner} runner
  3222. */
  3223. function Landing(runner) {
  3224. Base.call(this, runner);
  3225. var self = this;
  3226. var width = (Base.window.width * 0.75) | 0;
  3227. var total = runner.total;
  3228. var stream = process.stdout;
  3229. var plane = color('plane', '✈');
  3230. var crashed = -1;
  3231. var n = 0;
  3232. function runway() {
  3233. var buf = Array(width).join('-');
  3234. return ' ' + color('runway', buf);
  3235. }
  3236. runner.on(EVENT_RUN_BEGIN, function() {
  3237. stream.write('\n\n\n ');
  3238. cursor.hide();
  3239. });
  3240. runner.on(EVENT_TEST_END, function(test) {
  3241. // check if the plane crashed
  3242. var col = crashed === -1 ? ((width * ++n) / total) | 0 : crashed;
  3243. // show the crash
  3244. if (test.state === STATE_FAILED) {
  3245. plane = color('plane crash', '✈');
  3246. crashed = col;
  3247. }
  3248. // render landing strip
  3249. stream.write('\u001b[' + (width + 1) + 'D\u001b[2A');
  3250. stream.write(runway());
  3251. stream.write('\n ');
  3252. stream.write(color('runway', Array(col).join('⋅')));
  3253. stream.write(plane);
  3254. stream.write(color('runway', Array(width - col).join('⋅') + '\n'));
  3255. stream.write(runway());
  3256. stream.write('\u001b[0m');
  3257. });
  3258. runner.once(EVENT_RUN_END, function() {
  3259. cursor.show();
  3260. console.log();
  3261. self.epilogue();
  3262. });
  3263. }
  3264. /**
  3265. * Inherit from `Base.prototype`.
  3266. */
  3267. inherits(Landing, Base);
  3268. Landing.description = 'Unicode landing strip';
  3269. }).call(this,require('_process'))
  3270. },{"../runnable":33,"../runner":34,"../utils":38,"./base":17,"_process":68}],25:[function(require,module,exports){
  3271. (function (process){
  3272. 'use strict';
  3273. /**
  3274. * @module List
  3275. */
  3276. /**
  3277. * Module dependencies.
  3278. */
  3279. var Base = require('./base');
  3280. var inherits = require('../utils').inherits;
  3281. var constants = require('../runner').constants;
  3282. var EVENT_RUN_BEGIN = constants.EVENT_RUN_BEGIN;
  3283. var EVENT_RUN_END = constants.EVENT_RUN_END;
  3284. var EVENT_TEST_BEGIN = constants.EVENT_TEST_BEGIN;
  3285. var EVENT_TEST_FAIL = constants.EVENT_TEST_FAIL;
  3286. var EVENT_TEST_PASS = constants.EVENT_TEST_PASS;
  3287. var EVENT_TEST_PENDING = constants.EVENT_TEST_PENDING;
  3288. var color = Base.color;
  3289. var cursor = Base.cursor;
  3290. /**
  3291. * Expose `List`.
  3292. */
  3293. exports = module.exports = List;
  3294. /**
  3295. * Initialize a new `List` test reporter.
  3296. *
  3297. * @public
  3298. * @class
  3299. * @memberof Mocha.reporters
  3300. * @extends Mocha.reporters.Base
  3301. * @param {Runner} runner
  3302. */
  3303. function List(runner) {
  3304. Base.call(this, runner);
  3305. var self = this;
  3306. var n = 0;
  3307. runner.on(EVENT_RUN_BEGIN, function() {
  3308. console.log();
  3309. });
  3310. runner.on(EVENT_TEST_BEGIN, function(test) {
  3311. process.stdout.write(color('pass', ' ' + test.fullTitle() + ': '));
  3312. });
  3313. runner.on(EVENT_TEST_PENDING, function(test) {
  3314. var fmt = color('checkmark', ' -') + color('pending', ' %s');
  3315. console.log(fmt, test.fullTitle());
  3316. });
  3317. runner.on(EVENT_TEST_PASS, function(test) {
  3318. var fmt =
  3319. color('checkmark', ' ' + Base.symbols.ok) +
  3320. color('pass', ' %s: ') +
  3321. color(test.speed, '%dms');
  3322. cursor.CR();
  3323. console.log(fmt, test.fullTitle(), test.duration);
  3324. });
  3325. runner.on(EVENT_TEST_FAIL, function(test) {
  3326. cursor.CR();
  3327. console.log(color('fail', ' %d) %s'), ++n, test.fullTitle());
  3328. });
  3329. runner.once(EVENT_RUN_END, self.epilogue.bind(self));
  3330. }
  3331. /**
  3332. * Inherit from `Base.prototype`.
  3333. */
  3334. inherits(List, Base);
  3335. List.description = 'like "spec" reporter but flat';
  3336. }).call(this,require('_process'))
  3337. },{"../runner":34,"../utils":38,"./base":17,"_process":68}],26:[function(require,module,exports){
  3338. (function (process){
  3339. 'use strict';
  3340. /**
  3341. * @module Markdown
  3342. */
  3343. /**
  3344. * Module dependencies.
  3345. */
  3346. var Base = require('./base');
  3347. var utils = require('../utils');
  3348. var constants = require('../runner').constants;
  3349. var EVENT_RUN_END = constants.EVENT_RUN_END;
  3350. var EVENT_SUITE_BEGIN = constants.EVENT_SUITE_BEGIN;
  3351. var EVENT_SUITE_END = constants.EVENT_SUITE_END;
  3352. var EVENT_TEST_PASS = constants.EVENT_TEST_PASS;
  3353. /**
  3354. * Constants
  3355. */
  3356. var SUITE_PREFIX = '$';
  3357. /**
  3358. * Expose `Markdown`.
  3359. */
  3360. exports = module.exports = Markdown;
  3361. /**
  3362. * Initialize a new `Markdown` reporter.
  3363. *
  3364. * @public
  3365. * @class
  3366. * @memberof Mocha.reporters
  3367. * @extends Mocha.reporters.Base
  3368. * @param {Runner} runner
  3369. */
  3370. function Markdown(runner) {
  3371. Base.call(this, runner);
  3372. var level = 0;
  3373. var buf = '';
  3374. function title(str) {
  3375. return Array(level).join('#') + ' ' + str;
  3376. }
  3377. function mapTOC(suite, obj) {
  3378. var ret = obj;
  3379. var key = SUITE_PREFIX + suite.title;
  3380. obj = obj[key] = obj[key] || {suite: suite};
  3381. suite.suites.forEach(function(suite) {
  3382. mapTOC(suite, obj);
  3383. });
  3384. return ret;
  3385. }
  3386. function stringifyTOC(obj, level) {
  3387. ++level;
  3388. var buf = '';
  3389. var link;
  3390. for (var key in obj) {
  3391. if (key === 'suite') {
  3392. continue;
  3393. }
  3394. if (key !== SUITE_PREFIX) {
  3395. link = ' - [' + key.substring(1) + ']';
  3396. link += '(#' + utils.slug(obj[key].suite.fullTitle()) + ')\n';
  3397. buf += Array(level).join(' ') + link;
  3398. }
  3399. buf += stringifyTOC(obj[key], level);
  3400. }
  3401. return buf;
  3402. }
  3403. function generateTOC(suite) {
  3404. var obj = mapTOC(suite, {});
  3405. return stringifyTOC(obj, 0);
  3406. }
  3407. generateTOC(runner.suite);
  3408. runner.on(EVENT_SUITE_BEGIN, function(suite) {
  3409. ++level;
  3410. var slug = utils.slug(suite.fullTitle());
  3411. buf += '<a name="' + slug + '"></a>' + '\n';
  3412. buf += title(suite.title) + '\n';
  3413. });
  3414. runner.on(EVENT_SUITE_END, function() {
  3415. --level;
  3416. });
  3417. runner.on(EVENT_TEST_PASS, function(test) {
  3418. var code = utils.clean(test.body);
  3419. buf += test.title + '.\n';
  3420. buf += '\n```js\n';
  3421. buf += code + '\n';
  3422. buf += '```\n\n';
  3423. });
  3424. runner.once(EVENT_RUN_END, function() {
  3425. process.stdout.write('# TOC\n');
  3426. process.stdout.write(generateTOC(runner.suite));
  3427. process.stdout.write(buf);
  3428. });
  3429. }
  3430. Markdown.description = 'GitHub Flavored Markdown';
  3431. }).call(this,require('_process'))
  3432. },{"../runner":34,"../utils":38,"./base":17,"_process":68}],27:[function(require,module,exports){
  3433. (function (process){
  3434. 'use strict';
  3435. /**
  3436. * @module Min
  3437. */
  3438. /**
  3439. * Module dependencies.
  3440. */
  3441. var Base = require('./base');
  3442. var inherits = require('../utils').inherits;
  3443. var constants = require('../runner').constants;
  3444. var EVENT_RUN_END = constants.EVENT_RUN_END;
  3445. var EVENT_RUN_BEGIN = constants.EVENT_RUN_BEGIN;
  3446. /**
  3447. * Expose `Min`.
  3448. */
  3449. exports = module.exports = Min;
  3450. /**
  3451. * Initialize a new `Min` minimal test reporter (best used with --watch).
  3452. *
  3453. * @public
  3454. * @class
  3455. * @memberof Mocha.reporters
  3456. * @extends Mocha.reporters.Base
  3457. * @param {Runner} runner
  3458. */
  3459. function Min(runner) {
  3460. Base.call(this, runner);
  3461. runner.on(EVENT_RUN_BEGIN, function() {
  3462. // clear screen
  3463. process.stdout.write('\u001b[2J');
  3464. // set cursor position
  3465. process.stdout.write('\u001b[1;3H');
  3466. });
  3467. runner.once(EVENT_RUN_END, this.epilogue.bind(this));
  3468. }
  3469. /**
  3470. * Inherit from `Base.prototype`.
  3471. */
  3472. inherits(Min, Base);
  3473. Min.description = 'essentially just a summary';
  3474. }).call(this,require('_process'))
  3475. },{"../runner":34,"../utils":38,"./base":17,"_process":68}],28:[function(require,module,exports){
  3476. (function (process){
  3477. 'use strict';
  3478. /**
  3479. * @module Nyan
  3480. */
  3481. /**
  3482. * Module dependencies.
  3483. */
  3484. var Base = require('./base');
  3485. var constants = require('../runner').constants;
  3486. var inherits = require('../utils').inherits;
  3487. var EVENT_RUN_BEGIN = constants.EVENT_RUN_BEGIN;
  3488. var EVENT_TEST_PENDING = constants.EVENT_TEST_PENDING;
  3489. var EVENT_TEST_PASS = constants.EVENT_TEST_PASS;
  3490. var EVENT_RUN_END = constants.EVENT_RUN_END;
  3491. var EVENT_TEST_FAIL = constants.EVENT_TEST_FAIL;
  3492. /**
  3493. * Expose `Dot`.
  3494. */
  3495. exports = module.exports = NyanCat;
  3496. /**
  3497. * Initialize a new `Dot` matrix test reporter.
  3498. *
  3499. * @param {Runner} runner
  3500. * @public
  3501. * @class Nyan
  3502. * @memberof Mocha.reporters
  3503. * @extends Mocha.reporters.Base
  3504. */
  3505. function NyanCat(runner) {
  3506. Base.call(this, runner);
  3507. var self = this;
  3508. var width = (Base.window.width * 0.75) | 0;
  3509. var nyanCatWidth = (this.nyanCatWidth = 11);
  3510. this.colorIndex = 0;
  3511. this.numberOfLines = 4;
  3512. this.rainbowColors = self.generateColors();
  3513. this.scoreboardWidth = 5;
  3514. this.tick = 0;
  3515. this.trajectories = [[], [], [], []];
  3516. this.trajectoryWidthMax = width - nyanCatWidth;
  3517. runner.on(EVENT_RUN_BEGIN, function() {
  3518. Base.cursor.hide();
  3519. self.draw();
  3520. });
  3521. runner.on(EVENT_TEST_PENDING, function() {
  3522. self.draw();
  3523. });
  3524. runner.on(EVENT_TEST_PASS, function() {
  3525. self.draw();
  3526. });
  3527. runner.on(EVENT_TEST_FAIL, function() {
  3528. self.draw();
  3529. });
  3530. runner.once(EVENT_RUN_END, function() {
  3531. Base.cursor.show();
  3532. for (var i = 0; i < self.numberOfLines; i++) {
  3533. write('\n');
  3534. }
  3535. self.epilogue();
  3536. });
  3537. }
  3538. /**
  3539. * Inherit from `Base.prototype`.
  3540. */
  3541. inherits(NyanCat, Base);
  3542. /**
  3543. * Draw the nyan cat
  3544. *
  3545. * @private
  3546. */
  3547. NyanCat.prototype.draw = function() {
  3548. this.appendRainbow();
  3549. this.drawScoreboard();
  3550. this.drawRainbow();
  3551. this.drawNyanCat();
  3552. this.tick = !this.tick;
  3553. };
  3554. /**
  3555. * Draw the "scoreboard" showing the number
  3556. * of passes, failures and pending tests.
  3557. *
  3558. * @private
  3559. */
  3560. NyanCat.prototype.drawScoreboard = function() {
  3561. var stats = this.stats;
  3562. function draw(type, n) {
  3563. write(' ');
  3564. write(Base.color(type, n));
  3565. write('\n');
  3566. }
  3567. draw('green', stats.passes);
  3568. draw('fail', stats.failures);
  3569. draw('pending', stats.pending);
  3570. write('\n');
  3571. this.cursorUp(this.numberOfLines);
  3572. };
  3573. /**
  3574. * Append the rainbow.
  3575. *
  3576. * @private
  3577. */
  3578. NyanCat.prototype.appendRainbow = function() {
  3579. var segment = this.tick ? '_' : '-';
  3580. var rainbowified = this.rainbowify(segment);
  3581. for (var index = 0; index < this.numberOfLines; index++) {
  3582. var trajectory = this.trajectories[index];
  3583. if (trajectory.length >= this.trajectoryWidthMax) {
  3584. trajectory.shift();
  3585. }
  3586. trajectory.push(rainbowified);
  3587. }
  3588. };
  3589. /**
  3590. * Draw the rainbow.
  3591. *
  3592. * @private
  3593. */
  3594. NyanCat.prototype.drawRainbow = function() {
  3595. var self = this;
  3596. this.trajectories.forEach(function(line) {
  3597. write('\u001b[' + self.scoreboardWidth + 'C');
  3598. write(line.join(''));
  3599. write('\n');
  3600. });
  3601. this.cursorUp(this.numberOfLines);
  3602. };
  3603. /**
  3604. * Draw the nyan cat
  3605. *
  3606. * @private
  3607. */
  3608. NyanCat.prototype.drawNyanCat = function() {
  3609. var self = this;
  3610. var startWidth = this.scoreboardWidth + this.trajectories[0].length;
  3611. var dist = '\u001b[' + startWidth + 'C';
  3612. var padding = '';
  3613. write(dist);
  3614. write('_,------,');
  3615. write('\n');
  3616. write(dist);
  3617. padding = self.tick ? ' ' : ' ';
  3618. write('_|' + padding + '/\\_/\\ ');
  3619. write('\n');
  3620. write(dist);
  3621. padding = self.tick ? '_' : '__';
  3622. var tail = self.tick ? '~' : '^';
  3623. write(tail + '|' + padding + this.face() + ' ');
  3624. write('\n');
  3625. write(dist);
  3626. padding = self.tick ? ' ' : ' ';
  3627. write(padding + '"" "" ');
  3628. write('\n');
  3629. this.cursorUp(this.numberOfLines);
  3630. };
  3631. /**
  3632. * Draw nyan cat face.
  3633. *
  3634. * @private
  3635. * @return {string}
  3636. */
  3637. NyanCat.prototype.face = function() {
  3638. var stats = this.stats;
  3639. if (stats.failures) {
  3640. return '( x .x)';
  3641. } else if (stats.pending) {
  3642. return '( o .o)';
  3643. } else if (stats.passes) {
  3644. return '( ^ .^)';
  3645. }
  3646. return '( - .-)';
  3647. };
  3648. /**
  3649. * Move cursor up `n`.
  3650. *
  3651. * @private
  3652. * @param {number} n
  3653. */
  3654. NyanCat.prototype.cursorUp = function(n) {
  3655. write('\u001b[' + n + 'A');
  3656. };
  3657. /**
  3658. * Move cursor down `n`.
  3659. *
  3660. * @private
  3661. * @param {number} n
  3662. */
  3663. NyanCat.prototype.cursorDown = function(n) {
  3664. write('\u001b[' + n + 'B');
  3665. };
  3666. /**
  3667. * Generate rainbow colors.
  3668. *
  3669. * @private
  3670. * @return {Array}
  3671. */
  3672. NyanCat.prototype.generateColors = function() {
  3673. var colors = [];
  3674. for (var i = 0; i < 6 * 7; i++) {
  3675. var pi3 = Math.floor(Math.PI / 3);
  3676. var n = i * (1.0 / 6);
  3677. var r = Math.floor(3 * Math.sin(n) + 3);
  3678. var g = Math.floor(3 * Math.sin(n + 2 * pi3) + 3);
  3679. var b = Math.floor(3 * Math.sin(n + 4 * pi3) + 3);
  3680. colors.push(36 * r + 6 * g + b + 16);
  3681. }
  3682. return colors;
  3683. };
  3684. /**
  3685. * Apply rainbow to the given `str`.
  3686. *
  3687. * @private
  3688. * @param {string} str
  3689. * @return {string}
  3690. */
  3691. NyanCat.prototype.rainbowify = function(str) {
  3692. if (!Base.useColors) {
  3693. return str;
  3694. }
  3695. var color = this.rainbowColors[this.colorIndex % this.rainbowColors.length];
  3696. this.colorIndex += 1;
  3697. return '\u001b[38;5;' + color + 'm' + str + '\u001b[0m';
  3698. };
  3699. /**
  3700. * Stdout helper.
  3701. *
  3702. * @param {string} string A message to write to stdout.
  3703. */
  3704. function write(string) {
  3705. process.stdout.write(string);
  3706. }
  3707. NyanCat.description = '"nyan cat"';
  3708. }).call(this,require('_process'))
  3709. },{"../runner":34,"../utils":38,"./base":17,"_process":68}],29:[function(require,module,exports){
  3710. (function (process){
  3711. 'use strict';
  3712. /**
  3713. * @module Progress
  3714. */
  3715. /**
  3716. * Module dependencies.
  3717. */
  3718. var Base = require('./base');
  3719. var constants = require('../runner').constants;
  3720. var EVENT_RUN_BEGIN = constants.EVENT_RUN_BEGIN;
  3721. var EVENT_TEST_END = constants.EVENT_TEST_END;
  3722. var EVENT_RUN_END = constants.EVENT_RUN_END;
  3723. var inherits = require('../utils').inherits;
  3724. var color = Base.color;
  3725. var cursor = Base.cursor;
  3726. /**
  3727. * Expose `Progress`.
  3728. */
  3729. exports = module.exports = Progress;
  3730. /**
  3731. * General progress bar color.
  3732. */
  3733. Base.colors.progress = 90;
  3734. /**
  3735. * Initialize a new `Progress` bar test reporter.
  3736. *
  3737. * @public
  3738. * @class
  3739. * @memberof Mocha.reporters
  3740. * @extends Mocha.reporters.Base
  3741. * @param {Runner} runner
  3742. * @param {Object} options
  3743. */
  3744. function Progress(runner, options) {
  3745. Base.call(this, runner);
  3746. var self = this;
  3747. var width = (Base.window.width * 0.5) | 0;
  3748. var total = runner.total;
  3749. var complete = 0;
  3750. var lastN = -1;
  3751. // default chars
  3752. options = options || {};
  3753. var reporterOptions = options.reporterOptions || {};
  3754. options.open = reporterOptions.open || '[';
  3755. options.complete = reporterOptions.complete || '▬';
  3756. options.incomplete = reporterOptions.incomplete || Base.symbols.dot;
  3757. options.close = reporterOptions.close || ']';
  3758. options.verbose = reporterOptions.verbose || false;
  3759. // tests started
  3760. runner.on(EVENT_RUN_BEGIN, function() {
  3761. console.log();
  3762. cursor.hide();
  3763. });
  3764. // tests complete
  3765. runner.on(EVENT_TEST_END, function() {
  3766. complete++;
  3767. var percent = complete / total;
  3768. var n = (width * percent) | 0;
  3769. var i = width - n;
  3770. if (n === lastN && !options.verbose) {
  3771. // Don't re-render the line if it hasn't changed
  3772. return;
  3773. }
  3774. lastN = n;
  3775. cursor.CR();
  3776. process.stdout.write('\u001b[J');
  3777. process.stdout.write(color('progress', ' ' + options.open));
  3778. process.stdout.write(Array(n).join(options.complete));
  3779. process.stdout.write(Array(i).join(options.incomplete));
  3780. process.stdout.write(color('progress', options.close));
  3781. if (options.verbose) {
  3782. process.stdout.write(color('progress', ' ' + complete + ' of ' + total));
  3783. }
  3784. });
  3785. // tests are complete, output some stats
  3786. // and the failures if any
  3787. runner.once(EVENT_RUN_END, function() {
  3788. cursor.show();
  3789. console.log();
  3790. self.epilogue();
  3791. });
  3792. }
  3793. /**
  3794. * Inherit from `Base.prototype`.
  3795. */
  3796. inherits(Progress, Base);
  3797. Progress.description = 'a progress bar';
  3798. }).call(this,require('_process'))
  3799. },{"../runner":34,"../utils":38,"./base":17,"_process":68}],30:[function(require,module,exports){
  3800. 'use strict';
  3801. /**
  3802. * @module Spec
  3803. */
  3804. /**
  3805. * Module dependencies.
  3806. */
  3807. var Base = require('./base');
  3808. var constants = require('../runner').constants;
  3809. var EVENT_RUN_BEGIN = constants.EVENT_RUN_BEGIN;
  3810. var EVENT_RUN_END = constants.EVENT_RUN_END;
  3811. var EVENT_SUITE_BEGIN = constants.EVENT_SUITE_BEGIN;
  3812. var EVENT_SUITE_END = constants.EVENT_SUITE_END;
  3813. var EVENT_TEST_FAIL = constants.EVENT_TEST_FAIL;
  3814. var EVENT_TEST_PASS = constants.EVENT_TEST_PASS;
  3815. var EVENT_TEST_PENDING = constants.EVENT_TEST_PENDING;
  3816. var inherits = require('../utils').inherits;
  3817. var color = Base.color;
  3818. /**
  3819. * Expose `Spec`.
  3820. */
  3821. exports = module.exports = Spec;
  3822. /**
  3823. * Initialize a new `Spec` test reporter.
  3824. *
  3825. * @public
  3826. * @class
  3827. * @memberof Mocha.reporters
  3828. * @extends Mocha.reporters.Base
  3829. * @param {Runner} runner
  3830. */
  3831. function Spec(runner) {
  3832. Base.call(this, runner);
  3833. var self = this;
  3834. var indents = 0;
  3835. var n = 0;
  3836. function indent() {
  3837. return Array(indents).join(' ');
  3838. }
  3839. runner.on(EVENT_RUN_BEGIN, function() {
  3840. console.log();
  3841. });
  3842. runner.on(EVENT_SUITE_BEGIN, function(suite) {
  3843. ++indents;
  3844. console.log(color('suite', '%s%s'), indent(), suite.title);
  3845. });
  3846. runner.on(EVENT_SUITE_END, function() {
  3847. --indents;
  3848. if (indents === 1) {
  3849. console.log();
  3850. }
  3851. });
  3852. runner.on(EVENT_TEST_PENDING, function(test) {
  3853. var fmt = indent() + color('pending', ' - %s');
  3854. console.log(fmt, test.title);
  3855. });
  3856. runner.on(EVENT_TEST_PASS, function(test) {
  3857. var fmt;
  3858. if (test.speed === 'fast') {
  3859. fmt =
  3860. indent() +
  3861. color('checkmark', ' ' + Base.symbols.ok) +
  3862. color('pass', ' %s');
  3863. console.log(fmt, test.title);
  3864. } else {
  3865. fmt =
  3866. indent() +
  3867. color('checkmark', ' ' + Base.symbols.ok) +
  3868. color('pass', ' %s') +
  3869. color(test.speed, ' (%dms)');
  3870. console.log(fmt, test.title, test.duration);
  3871. }
  3872. });
  3873. runner.on(EVENT_TEST_FAIL, function(test) {
  3874. console.log(indent() + color('fail', ' %d) %s'), ++n, test.title);
  3875. });
  3876. runner.once(EVENT_RUN_END, self.epilogue.bind(self));
  3877. }
  3878. /**
  3879. * Inherit from `Base.prototype`.
  3880. */
  3881. inherits(Spec, Base);
  3882. Spec.description = 'hierarchical & verbose [default]';
  3883. },{"../runner":34,"../utils":38,"./base":17}],31:[function(require,module,exports){
  3884. (function (process){
  3885. 'use strict';
  3886. /**
  3887. * @module TAP
  3888. */
  3889. /**
  3890. * Module dependencies.
  3891. */
  3892. var util = require('util');
  3893. var Base = require('./base');
  3894. var constants = require('../runner').constants;
  3895. var EVENT_TEST_PASS = constants.EVENT_TEST_PASS;
  3896. var EVENT_TEST_FAIL = constants.EVENT_TEST_FAIL;
  3897. var EVENT_RUN_BEGIN = constants.EVENT_RUN_BEGIN;
  3898. var EVENT_RUN_END = constants.EVENT_RUN_END;
  3899. var EVENT_TEST_PENDING = constants.EVENT_TEST_PENDING;
  3900. var EVENT_TEST_END = constants.EVENT_TEST_END;
  3901. var inherits = require('../utils').inherits;
  3902. var sprintf = util.format;
  3903. /**
  3904. * Expose `TAP`.
  3905. */
  3906. exports = module.exports = TAP;
  3907. /**
  3908. * Constructs a new TAP reporter with runner instance and reporter options.
  3909. *
  3910. * @public
  3911. * @class
  3912. * @extends Mocha.reporters.Base
  3913. * @memberof Mocha.reporters
  3914. * @param {Runner} runner - Instance triggers reporter actions.
  3915. * @param {Object} [options] - runner options
  3916. */
  3917. function TAP(runner, options) {
  3918. Base.call(this, runner, options);
  3919. var self = this;
  3920. var n = 1;
  3921. var tapVersion = '12';
  3922. if (options && options.reporterOptions) {
  3923. if (options.reporterOptions.tapVersion) {
  3924. tapVersion = options.reporterOptions.tapVersion.toString();
  3925. }
  3926. }
  3927. this._producer = createProducer(tapVersion);
  3928. runner.once(EVENT_RUN_BEGIN, function() {
  3929. var ntests = runner.grepTotal(runner.suite);
  3930. self._producer.writeVersion();
  3931. self._producer.writePlan(ntests);
  3932. });
  3933. runner.on(EVENT_TEST_END, function() {
  3934. ++n;
  3935. });
  3936. runner.on(EVENT_TEST_PENDING, function(test) {
  3937. self._producer.writePending(n, test);
  3938. });
  3939. runner.on(EVENT_TEST_PASS, function(test) {
  3940. self._producer.writePass(n, test);
  3941. });
  3942. runner.on(EVENT_TEST_FAIL, function(test, err) {
  3943. self._producer.writeFail(n, test, err);
  3944. });
  3945. runner.once(EVENT_RUN_END, function() {
  3946. self._producer.writeEpilogue(runner.stats);
  3947. });
  3948. }
  3949. /**
  3950. * Inherit from `Base.prototype`.
  3951. */
  3952. inherits(TAP, Base);
  3953. /**
  3954. * Returns a TAP-safe title of `test`.
  3955. *
  3956. * @private
  3957. * @param {Test} test - Test instance.
  3958. * @return {String} title with any hash character removed
  3959. */
  3960. function title(test) {
  3961. return test.fullTitle().replace(/#/g, '');
  3962. }
  3963. /**
  3964. * Writes newline-terminated formatted string to reporter output stream.
  3965. *
  3966. * @private
  3967. * @param {string} format - `printf`-like format string
  3968. * @param {...*} [varArgs] - Format string arguments
  3969. */
  3970. function println(format, varArgs) {
  3971. var vargs = Array.from(arguments);
  3972. vargs[0] += '\n';
  3973. process.stdout.write(sprintf.apply(null, vargs));
  3974. }
  3975. /**
  3976. * Returns a `tapVersion`-appropriate TAP producer instance, if possible.
  3977. *
  3978. * @private
  3979. * @param {string} tapVersion - Version of TAP specification to produce.
  3980. * @returns {TAPProducer} specification-appropriate instance
  3981. * @throws {Error} if specification version has no associated producer.
  3982. */
  3983. function createProducer(tapVersion) {
  3984. var producers = {
  3985. '12': new TAP12Producer(),
  3986. '13': new TAP13Producer()
  3987. };
  3988. var producer = producers[tapVersion];
  3989. if (!producer) {
  3990. throw new Error(
  3991. 'invalid or unsupported TAP version: ' + JSON.stringify(tapVersion)
  3992. );
  3993. }
  3994. return producer;
  3995. }
  3996. /**
  3997. * @summary
  3998. * Constructs a new TAPProducer.
  3999. *
  4000. * @description
  4001. * <em>Only</em> to be used as an abstract base class.
  4002. *
  4003. * @private
  4004. * @constructor
  4005. */
  4006. function TAPProducer() {}
  4007. /**
  4008. * Writes the TAP version to reporter output stream.
  4009. *
  4010. * @abstract
  4011. */
  4012. TAPProducer.prototype.writeVersion = function() {};
  4013. /**
  4014. * Writes the plan to reporter output stream.
  4015. *
  4016. * @abstract
  4017. * @param {number} ntests - Number of tests that are planned to run.
  4018. */
  4019. TAPProducer.prototype.writePlan = function(ntests) {
  4020. println('%d..%d', 1, ntests);
  4021. };
  4022. /**
  4023. * Writes that test passed to reporter output stream.
  4024. *
  4025. * @abstract
  4026. * @param {number} n - Index of test that passed.
  4027. * @param {Test} test - Instance containing test information.
  4028. */
  4029. TAPProducer.prototype.writePass = function(n, test) {
  4030. println('ok %d %s', n, title(test));
  4031. };
  4032. /**
  4033. * Writes that test was skipped to reporter output stream.
  4034. *
  4035. * @abstract
  4036. * @param {number} n - Index of test that was skipped.
  4037. * @param {Test} test - Instance containing test information.
  4038. */
  4039. TAPProducer.prototype.writePending = function(n, test) {
  4040. println('ok %d %s # SKIP -', n, title(test));
  4041. };
  4042. /**
  4043. * Writes that test failed to reporter output stream.
  4044. *
  4045. * @abstract
  4046. * @param {number} n - Index of test that failed.
  4047. * @param {Test} test - Instance containing test information.
  4048. * @param {Error} err - Reason the test failed.
  4049. */
  4050. TAPProducer.prototype.writeFail = function(n, test, err) {
  4051. println('not ok %d %s', n, title(test));
  4052. };
  4053. /**
  4054. * Writes the summary epilogue to reporter output stream.
  4055. *
  4056. * @abstract
  4057. * @param {Object} stats - Object containing run statistics.
  4058. */
  4059. TAPProducer.prototype.writeEpilogue = function(stats) {
  4060. // :TBD: Why is this not counting pending tests?
  4061. println('# tests ' + (stats.passes + stats.failures));
  4062. println('# pass ' + stats.passes);
  4063. // :TBD: Why are we not showing pending results?
  4064. println('# fail ' + stats.failures);
  4065. };
  4066. /**
  4067. * @summary
  4068. * Constructs a new TAP12Producer.
  4069. *
  4070. * @description
  4071. * Produces output conforming to the TAP12 specification.
  4072. *
  4073. * @private
  4074. * @constructor
  4075. * @extends TAPProducer
  4076. * @see {@link https://testanything.org/tap-specification.html|Specification}
  4077. */
  4078. function TAP12Producer() {
  4079. /**
  4080. * Writes that test failed to reporter output stream, with error formatting.
  4081. * @override
  4082. */
  4083. this.writeFail = function(n, test, err) {
  4084. TAPProducer.prototype.writeFail.call(this, n, test, err);
  4085. if (err.message) {
  4086. println(err.message.replace(/^/gm, ' '));
  4087. }
  4088. if (err.stack) {
  4089. println(err.stack.replace(/^/gm, ' '));
  4090. }
  4091. };
  4092. }
  4093. /**
  4094. * Inherit from `TAPProducer.prototype`.
  4095. */
  4096. inherits(TAP12Producer, TAPProducer);
  4097. /**
  4098. * @summary
  4099. * Constructs a new TAP13Producer.
  4100. *
  4101. * @description
  4102. * Produces output conforming to the TAP13 specification.
  4103. *
  4104. * @private
  4105. * @constructor
  4106. * @extends TAPProducer
  4107. * @see {@link https://testanything.org/tap-version-13-specification.html|Specification}
  4108. */
  4109. function TAP13Producer() {
  4110. /**
  4111. * Writes the TAP version to reporter output stream.
  4112. * @override
  4113. */
  4114. this.writeVersion = function() {
  4115. println('TAP version 13');
  4116. };
  4117. /**
  4118. * Writes that test failed to reporter output stream, with error formatting.
  4119. * @override
  4120. */
  4121. this.writeFail = function(n, test, err) {
  4122. TAPProducer.prototype.writeFail.call(this, n, test, err);
  4123. var emitYamlBlock = err.message != null || err.stack != null;
  4124. if (emitYamlBlock) {
  4125. println(indent(1) + '---');
  4126. if (err.message) {
  4127. println(indent(2) + 'message: |-');
  4128. println(err.message.replace(/^/gm, indent(3)));
  4129. }
  4130. if (err.stack) {
  4131. println(indent(2) + 'stack: |-');
  4132. println(err.stack.replace(/^/gm, indent(3)));
  4133. }
  4134. println(indent(1) + '...');
  4135. }
  4136. };
  4137. function indent(level) {
  4138. return Array(level + 1).join(' ');
  4139. }
  4140. }
  4141. /**
  4142. * Inherit from `TAPProducer.prototype`.
  4143. */
  4144. inherits(TAP13Producer, TAPProducer);
  4145. TAP.description = 'TAP-compatible output';
  4146. }).call(this,require('_process'))
  4147. },{"../runner":34,"../utils":38,"./base":17,"_process":68,"util":88}],32:[function(require,module,exports){
  4148. (function (process,global){
  4149. 'use strict';
  4150. /**
  4151. * @module XUnit
  4152. */
  4153. /**
  4154. * Module dependencies.
  4155. */
  4156. var Base = require('./base');
  4157. var utils = require('../utils');
  4158. var fs = require('fs');
  4159. var mkdirp = require('mkdirp');
  4160. var path = require('path');
  4161. var errors = require('../errors');
  4162. var createUnsupportedError = errors.createUnsupportedError;
  4163. var constants = require('../runner').constants;
  4164. var EVENT_TEST_PASS = constants.EVENT_TEST_PASS;
  4165. var EVENT_TEST_FAIL = constants.EVENT_TEST_FAIL;
  4166. var EVENT_RUN_END = constants.EVENT_RUN_END;
  4167. var EVENT_TEST_PENDING = constants.EVENT_TEST_PENDING;
  4168. var STATE_FAILED = require('../runnable').constants.STATE_FAILED;
  4169. var inherits = utils.inherits;
  4170. var escape = utils.escape;
  4171. /**
  4172. * Save timer references to avoid Sinon interfering (see GH-237).
  4173. */
  4174. var Date = global.Date;
  4175. /**
  4176. * Expose `XUnit`.
  4177. */
  4178. exports = module.exports = XUnit;
  4179. /**
  4180. * Initialize a new `XUnit` reporter.
  4181. *
  4182. * @public
  4183. * @class
  4184. * @memberof Mocha.reporters
  4185. * @extends Mocha.reporters.Base
  4186. * @param {Runner} runner
  4187. */
  4188. function XUnit(runner, options) {
  4189. Base.call(this, runner);
  4190. var stats = this.stats;
  4191. var tests = [];
  4192. var self = this;
  4193. // the name of the test suite, as it will appear in the resulting XML file
  4194. var suiteName;
  4195. // the default name of the test suite if none is provided
  4196. var DEFAULT_SUITE_NAME = 'Mocha Tests';
  4197. if (options && options.reporterOptions) {
  4198. if (options.reporterOptions.output) {
  4199. if (!fs.createWriteStream) {
  4200. throw createUnsupportedError('file output not supported in browser');
  4201. }
  4202. mkdirp.sync(path.dirname(options.reporterOptions.output));
  4203. self.fileStream = fs.createWriteStream(options.reporterOptions.output);
  4204. }
  4205. // get the suite name from the reporter options (if provided)
  4206. suiteName = options.reporterOptions.suiteName;
  4207. }
  4208. // fall back to the default suite name
  4209. suiteName = suiteName || DEFAULT_SUITE_NAME;
  4210. runner.on(EVENT_TEST_PENDING, function(test) {
  4211. tests.push(test);
  4212. });
  4213. runner.on(EVENT_TEST_PASS, function(test) {
  4214. tests.push(test);
  4215. });
  4216. runner.on(EVENT_TEST_FAIL, function(test) {
  4217. tests.push(test);
  4218. });
  4219. runner.once(EVENT_RUN_END, function() {
  4220. self.write(
  4221. tag(
  4222. 'testsuite',
  4223. {
  4224. name: suiteName,
  4225. tests: stats.tests,
  4226. failures: 0,
  4227. errors: stats.failures,
  4228. skipped: stats.tests - stats.failures - stats.passes,
  4229. timestamp: new Date().toUTCString(),
  4230. time: stats.duration / 1000 || 0
  4231. },
  4232. false
  4233. )
  4234. );
  4235. tests.forEach(function(t) {
  4236. self.test(t);
  4237. });
  4238. self.write('</testsuite>');
  4239. });
  4240. }
  4241. /**
  4242. * Inherit from `Base.prototype`.
  4243. */
  4244. inherits(XUnit, Base);
  4245. /**
  4246. * Override done to close the stream (if it's a file).
  4247. *
  4248. * @param failures
  4249. * @param {Function} fn
  4250. */
  4251. XUnit.prototype.done = function(failures, fn) {
  4252. if (this.fileStream) {
  4253. this.fileStream.end(function() {
  4254. fn(failures);
  4255. });
  4256. } else {
  4257. fn(failures);
  4258. }
  4259. };
  4260. /**
  4261. * Write out the given line.
  4262. *
  4263. * @param {string} line
  4264. */
  4265. XUnit.prototype.write = function(line) {
  4266. if (this.fileStream) {
  4267. this.fileStream.write(line + '\n');
  4268. } else if (typeof process === 'object' && process.stdout) {
  4269. process.stdout.write(line + '\n');
  4270. } else {
  4271. console.log(line);
  4272. }
  4273. };
  4274. /**
  4275. * Output tag for the given `test.`
  4276. *
  4277. * @param {Test} test
  4278. */
  4279. XUnit.prototype.test = function(test) {
  4280. Base.useColors = false;
  4281. var attrs = {
  4282. classname: test.parent.fullTitle(),
  4283. name: test.title,
  4284. time: test.duration / 1000 || 0
  4285. };
  4286. if (test.state === STATE_FAILED) {
  4287. var err = test.err;
  4288. var diff =
  4289. Base.hideDiff || !err.actual || !err.expected
  4290. ? ''
  4291. : '\n' + Base.generateDiff(err.actual, err.expected);
  4292. this.write(
  4293. tag(
  4294. 'testcase',
  4295. attrs,
  4296. false,
  4297. tag(
  4298. 'failure',
  4299. {},
  4300. false,
  4301. escape(err.message) + escape(diff) + '\n' + escape(err.stack)
  4302. )
  4303. )
  4304. );
  4305. } else if (test.isPending()) {
  4306. this.write(tag('testcase', attrs, false, tag('skipped', {}, true)));
  4307. } else {
  4308. this.write(tag('testcase', attrs, true));
  4309. }
  4310. };
  4311. /**
  4312. * HTML tag helper.
  4313. *
  4314. * @param name
  4315. * @param attrs
  4316. * @param close
  4317. * @param content
  4318. * @return {string}
  4319. */
  4320. function tag(name, attrs, close, content) {
  4321. var end = close ? '/>' : '>';
  4322. var pairs = [];
  4323. var tag;
  4324. for (var key in attrs) {
  4325. if (Object.prototype.hasOwnProperty.call(attrs, key)) {
  4326. pairs.push(key + '="' + escape(attrs[key]) + '"');
  4327. }
  4328. }
  4329. tag = '<' + name + (pairs.length ? ' ' + pairs.join(' ') : '') + end;
  4330. if (content) {
  4331. tag += content + '</' + name + end;
  4332. }
  4333. return tag;
  4334. }
  4335. XUnit.description = 'XUnit-compatible XML output';
  4336. }).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
  4337. },{"../errors":6,"../runnable":33,"../runner":34,"../utils":38,"./base":17,"_process":68,"fs":42,"mkdirp":59,"path":42}],33:[function(require,module,exports){
  4338. (function (global){
  4339. 'use strict';
  4340. var EventEmitter = require('events').EventEmitter;
  4341. var Pending = require('./pending');
  4342. var debug = require('debug')('mocha:runnable');
  4343. var milliseconds = require('ms');
  4344. var utils = require('./utils');
  4345. var createInvalidExceptionError = require('./errors')
  4346. .createInvalidExceptionError;
  4347. /**
  4348. * Save timer references to avoid Sinon interfering (see GH-237).
  4349. */
  4350. var Date = global.Date;
  4351. var setTimeout = global.setTimeout;
  4352. var clearTimeout = global.clearTimeout;
  4353. var toString = Object.prototype.toString;
  4354. module.exports = Runnable;
  4355. /**
  4356. * Initialize a new `Runnable` with the given `title` and callback `fn`.
  4357. *
  4358. * @class
  4359. * @extends external:EventEmitter
  4360. * @public
  4361. * @param {String} title
  4362. * @param {Function} fn
  4363. */
  4364. function Runnable(title, fn) {
  4365. this.title = title;
  4366. this.fn = fn;
  4367. this.body = (fn || '').toString();
  4368. this.async = fn && fn.length;
  4369. this.sync = !this.async;
  4370. this._timeout = 2000;
  4371. this._slow = 75;
  4372. this._enableTimeouts = true;
  4373. this.timedOut = false;
  4374. this._retries = -1;
  4375. this._currentRetry = 0;
  4376. this.pending = false;
  4377. }
  4378. /**
  4379. * Inherit from `EventEmitter.prototype`.
  4380. */
  4381. utils.inherits(Runnable, EventEmitter);
  4382. /**
  4383. * Get current timeout value in msecs.
  4384. *
  4385. * @private
  4386. * @returns {number} current timeout threshold value
  4387. */
  4388. /**
  4389. * @summary
  4390. * Set timeout threshold value (msecs).
  4391. *
  4392. * @description
  4393. * A string argument can use shorthand (e.g., "2s") and will be converted.
  4394. * The value will be clamped to range [<code>0</code>, <code>2^<sup>31</sup>-1</code>].
  4395. * If clamped value matches either range endpoint, timeouts will be disabled.
  4396. *
  4397. * @private
  4398. * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/setTimeout#Maximum_delay_value}
  4399. * @param {number|string} ms - Timeout threshold value.
  4400. * @returns {Runnable} this
  4401. * @chainable
  4402. */
  4403. Runnable.prototype.timeout = function(ms) {
  4404. if (!arguments.length) {
  4405. return this._timeout;
  4406. }
  4407. if (typeof ms === 'string') {
  4408. ms = milliseconds(ms);
  4409. }
  4410. // Clamp to range
  4411. var INT_MAX = Math.pow(2, 31) - 1;
  4412. var range = [0, INT_MAX];
  4413. ms = utils.clamp(ms, range);
  4414. // see #1652 for reasoning
  4415. if (ms === range[0] || ms === range[1]) {
  4416. this._enableTimeouts = false;
  4417. }
  4418. debug('timeout %d', ms);
  4419. this._timeout = ms;
  4420. if (this.timer) {
  4421. this.resetTimeout();
  4422. }
  4423. return this;
  4424. };
  4425. /**
  4426. * Set or get slow `ms`.
  4427. *
  4428. * @private
  4429. * @param {number|string} ms
  4430. * @return {Runnable|number} ms or Runnable instance.
  4431. */
  4432. Runnable.prototype.slow = function(ms) {
  4433. if (!arguments.length || typeof ms === 'undefined') {
  4434. return this._slow;
  4435. }
  4436. if (typeof ms === 'string') {
  4437. ms = milliseconds(ms);
  4438. }
  4439. debug('slow %d', ms);
  4440. this._slow = ms;
  4441. return this;
  4442. };
  4443. /**
  4444. * Set and get whether timeout is `enabled`.
  4445. *
  4446. * @private
  4447. * @param {boolean} enabled
  4448. * @return {Runnable|boolean} enabled or Runnable instance.
  4449. */
  4450. Runnable.prototype.enableTimeouts = function(enabled) {
  4451. if (!arguments.length) {
  4452. return this._enableTimeouts;
  4453. }
  4454. debug('enableTimeouts %s', enabled);
  4455. this._enableTimeouts = enabled;
  4456. return this;
  4457. };
  4458. /**
  4459. * Halt and mark as pending.
  4460. *
  4461. * @memberof Mocha.Runnable
  4462. * @public
  4463. */
  4464. Runnable.prototype.skip = function() {
  4465. throw new Pending('sync skip');
  4466. };
  4467. /**
  4468. * Check if this runnable or its parent suite is marked as pending.
  4469. *
  4470. * @private
  4471. */
  4472. Runnable.prototype.isPending = function() {
  4473. return this.pending || (this.parent && this.parent.isPending());
  4474. };
  4475. /**
  4476. * Return `true` if this Runnable has failed.
  4477. * @return {boolean}
  4478. * @private
  4479. */
  4480. Runnable.prototype.isFailed = function() {
  4481. return !this.isPending() && this.state === constants.STATE_FAILED;
  4482. };
  4483. /**
  4484. * Return `true` if this Runnable has passed.
  4485. * @return {boolean}
  4486. * @private
  4487. */
  4488. Runnable.prototype.isPassed = function() {
  4489. return !this.isPending() && this.state === constants.STATE_PASSED;
  4490. };
  4491. /**
  4492. * Set or get number of retries.
  4493. *
  4494. * @private
  4495. */
  4496. Runnable.prototype.retries = function(n) {
  4497. if (!arguments.length) {
  4498. return this._retries;
  4499. }
  4500. this._retries = n;
  4501. };
  4502. /**
  4503. * Set or get current retry
  4504. *
  4505. * @private
  4506. */
  4507. Runnable.prototype.currentRetry = function(n) {
  4508. if (!arguments.length) {
  4509. return this._currentRetry;
  4510. }
  4511. this._currentRetry = n;
  4512. };
  4513. /**
  4514. * Return the full title generated by recursively concatenating the parent's
  4515. * full title.
  4516. *
  4517. * @memberof Mocha.Runnable
  4518. * @public
  4519. * @return {string}
  4520. */
  4521. Runnable.prototype.fullTitle = function() {
  4522. return this.titlePath().join(' ');
  4523. };
  4524. /**
  4525. * Return the title path generated by concatenating the parent's title path with the title.
  4526. *
  4527. * @memberof Mocha.Runnable
  4528. * @public
  4529. * @return {string}
  4530. */
  4531. Runnable.prototype.titlePath = function() {
  4532. return this.parent.titlePath().concat([this.title]);
  4533. };
  4534. /**
  4535. * Clear the timeout.
  4536. *
  4537. * @private
  4538. */
  4539. Runnable.prototype.clearTimeout = function() {
  4540. clearTimeout(this.timer);
  4541. };
  4542. /**
  4543. * Inspect the runnable void of private properties.
  4544. *
  4545. * @private
  4546. * @return {string}
  4547. */
  4548. Runnable.prototype.inspect = function() {
  4549. return JSON.stringify(
  4550. this,
  4551. function(key, val) {
  4552. if (key[0] === '_') {
  4553. return;
  4554. }
  4555. if (key === 'parent') {
  4556. return '#<Suite>';
  4557. }
  4558. if (key === 'ctx') {
  4559. return '#<Context>';
  4560. }
  4561. return val;
  4562. },
  4563. 2
  4564. );
  4565. };
  4566. /**
  4567. * Reset the timeout.
  4568. *
  4569. * @private
  4570. */
  4571. Runnable.prototype.resetTimeout = function() {
  4572. var self = this;
  4573. var ms = this.timeout() || 1e9;
  4574. if (!this._enableTimeouts) {
  4575. return;
  4576. }
  4577. this.clearTimeout();
  4578. this.timer = setTimeout(function() {
  4579. if (!self._enableTimeouts) {
  4580. return;
  4581. }
  4582. self.callback(self._timeoutError(ms));
  4583. self.timedOut = true;
  4584. }, ms);
  4585. };
  4586. /**
  4587. * Set or get a list of whitelisted globals for this test run.
  4588. *
  4589. * @private
  4590. * @param {string[]} globals
  4591. */
  4592. Runnable.prototype.globals = function(globals) {
  4593. if (!arguments.length) {
  4594. return this._allowedGlobals;
  4595. }
  4596. this._allowedGlobals = globals;
  4597. };
  4598. /**
  4599. * Run the test and invoke `fn(err)`.
  4600. *
  4601. * @param {Function} fn
  4602. * @private
  4603. */
  4604. Runnable.prototype.run = function(fn) {
  4605. var self = this;
  4606. var start = new Date();
  4607. var ctx = this.ctx;
  4608. var finished;
  4609. var emitted;
  4610. // Sometimes the ctx exists, but it is not runnable
  4611. if (ctx && ctx.runnable) {
  4612. ctx.runnable(this);
  4613. }
  4614. // called multiple times
  4615. function multiple(err) {
  4616. if (emitted) {
  4617. return;
  4618. }
  4619. emitted = true;
  4620. var msg = 'done() called multiple times';
  4621. if (err && err.message) {
  4622. err.message += " (and Mocha's " + msg + ')';
  4623. self.emit('error', err);
  4624. } else {
  4625. self.emit('error', new Error(msg));
  4626. }
  4627. }
  4628. // finished
  4629. function done(err) {
  4630. var ms = self.timeout();
  4631. if (self.timedOut) {
  4632. return;
  4633. }
  4634. if (finished) {
  4635. return multiple(err);
  4636. }
  4637. self.clearTimeout();
  4638. self.duration = new Date() - start;
  4639. finished = true;
  4640. if (!err && self.duration > ms && self._enableTimeouts) {
  4641. err = self._timeoutError(ms);
  4642. }
  4643. fn(err);
  4644. }
  4645. // for .resetTimeout()
  4646. this.callback = done;
  4647. // explicit async with `done` argument
  4648. if (this.async) {
  4649. this.resetTimeout();
  4650. // allows skip() to be used in an explicit async context
  4651. this.skip = function asyncSkip() {
  4652. done(new Pending('async skip call'));
  4653. // halt execution. the Runnable will be marked pending
  4654. // by the previous call, and the uncaught handler will ignore
  4655. // the failure.
  4656. throw new Pending('async skip; aborting execution');
  4657. };
  4658. if (this.allowUncaught) {
  4659. return callFnAsync(this.fn);
  4660. }
  4661. try {
  4662. callFnAsync(this.fn);
  4663. } catch (err) {
  4664. emitted = true;
  4665. done(Runnable.toValueOrError(err));
  4666. }
  4667. return;
  4668. }
  4669. if (this.allowUncaught) {
  4670. if (this.isPending()) {
  4671. done();
  4672. } else {
  4673. callFn(this.fn);
  4674. }
  4675. return;
  4676. }
  4677. // sync or promise-returning
  4678. try {
  4679. if (this.isPending()) {
  4680. done();
  4681. } else {
  4682. callFn(this.fn);
  4683. }
  4684. } catch (err) {
  4685. emitted = true;
  4686. done(Runnable.toValueOrError(err));
  4687. }
  4688. function callFn(fn) {
  4689. var result = fn.call(ctx);
  4690. if (result && typeof result.then === 'function') {
  4691. self.resetTimeout();
  4692. result.then(
  4693. function() {
  4694. done();
  4695. // Return null so libraries like bluebird do not warn about
  4696. // subsequently constructed Promises.
  4697. return null;
  4698. },
  4699. function(reason) {
  4700. done(reason || new Error('Promise rejected with no or falsy reason'));
  4701. }
  4702. );
  4703. } else {
  4704. if (self.asyncOnly) {
  4705. return done(
  4706. new Error(
  4707. '--async-only option in use without declaring `done()` or returning a promise'
  4708. )
  4709. );
  4710. }
  4711. done();
  4712. }
  4713. }
  4714. function callFnAsync(fn) {
  4715. var result = fn.call(ctx, function(err) {
  4716. if (err instanceof Error || toString.call(err) === '[object Error]') {
  4717. return done(err);
  4718. }
  4719. if (err) {
  4720. if (Object.prototype.toString.call(err) === '[object Object]') {
  4721. return done(
  4722. new Error('done() invoked with non-Error: ' + JSON.stringify(err))
  4723. );
  4724. }
  4725. return done(new Error('done() invoked with non-Error: ' + err));
  4726. }
  4727. if (result && utils.isPromise(result)) {
  4728. return done(
  4729. new Error(
  4730. 'Resolution method is overspecified. Specify a callback *or* return a Promise; not both.'
  4731. )
  4732. );
  4733. }
  4734. done();
  4735. });
  4736. }
  4737. };
  4738. /**
  4739. * Instantiates a "timeout" error
  4740. *
  4741. * @param {number} ms - Timeout (in milliseconds)
  4742. * @returns {Error} a "timeout" error
  4743. * @private
  4744. */
  4745. Runnable.prototype._timeoutError = function(ms) {
  4746. var msg =
  4747. 'Timeout of ' +
  4748. ms +
  4749. 'ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves.';
  4750. if (this.file) {
  4751. msg += ' (' + this.file + ')';
  4752. }
  4753. return new Error(msg);
  4754. };
  4755. var constants = utils.defineConstants(
  4756. /**
  4757. * {@link Runnable}-related constants.
  4758. * @public
  4759. * @memberof Runnable
  4760. * @readonly
  4761. * @static
  4762. * @alias constants
  4763. * @enum {string}
  4764. */
  4765. {
  4766. /**
  4767. * Value of `state` prop when a `Runnable` has failed
  4768. */
  4769. STATE_FAILED: 'failed',
  4770. /**
  4771. * Value of `state` prop when a `Runnable` has passed
  4772. */
  4773. STATE_PASSED: 'passed'
  4774. }
  4775. );
  4776. /**
  4777. * Given `value`, return identity if truthy, otherwise create an "invalid exception" error and return that.
  4778. * @param {*} [value] - Value to return, if present
  4779. * @returns {*|Error} `value`, otherwise an `Error`
  4780. * @private
  4781. */
  4782. Runnable.toValueOrError = function(value) {
  4783. return (
  4784. value ||
  4785. createInvalidExceptionError(
  4786. 'Runnable failed with falsy or undefined exception. Please throw an Error instead.',
  4787. value
  4788. )
  4789. );
  4790. };
  4791. Runnable.constants = constants;
  4792. }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
  4793. },{"./errors":6,"./pending":16,"./utils":38,"debug":45,"events":50,"ms":60}],34:[function(require,module,exports){
  4794. (function (process,global){
  4795. 'use strict';
  4796. /**
  4797. * Module dependencies.
  4798. */
  4799. var util = require('util');
  4800. var EventEmitter = require('events').EventEmitter;
  4801. var Pending = require('./pending');
  4802. var utils = require('./utils');
  4803. var inherits = utils.inherits;
  4804. var debug = require('debug')('mocha:runner');
  4805. var Runnable = require('./runnable');
  4806. var Suite = require('./suite');
  4807. var HOOK_TYPE_BEFORE_EACH = Suite.constants.HOOK_TYPE_BEFORE_EACH;
  4808. var HOOK_TYPE_AFTER_EACH = Suite.constants.HOOK_TYPE_AFTER_EACH;
  4809. var HOOK_TYPE_AFTER_ALL = Suite.constants.HOOK_TYPE_AFTER_ALL;
  4810. var HOOK_TYPE_BEFORE_ALL = Suite.constants.HOOK_TYPE_BEFORE_ALL;
  4811. var EVENT_ROOT_SUITE_RUN = Suite.constants.EVENT_ROOT_SUITE_RUN;
  4812. var STATE_FAILED = Runnable.constants.STATE_FAILED;
  4813. var STATE_PASSED = Runnable.constants.STATE_PASSED;
  4814. var dQuote = utils.dQuote;
  4815. var ngettext = utils.ngettext;
  4816. var sQuote = utils.sQuote;
  4817. var stackFilter = utils.stackTraceFilter();
  4818. var stringify = utils.stringify;
  4819. var type = utils.type;
  4820. var createInvalidExceptionError = require('./errors')
  4821. .createInvalidExceptionError;
  4822. /**
  4823. * Non-enumerable globals.
  4824. * @readonly
  4825. */
  4826. var globals = [
  4827. 'setTimeout',
  4828. 'clearTimeout',
  4829. 'setInterval',
  4830. 'clearInterval',
  4831. 'XMLHttpRequest',
  4832. 'Date',
  4833. 'setImmediate',
  4834. 'clearImmediate'
  4835. ];
  4836. var constants = utils.defineConstants(
  4837. /**
  4838. * {@link Runner}-related constants.
  4839. * @public
  4840. * @memberof Runner
  4841. * @readonly
  4842. * @alias constants
  4843. * @static
  4844. * @enum {string}
  4845. */
  4846. {
  4847. /**
  4848. * Emitted when {@link Hook} execution begins
  4849. */
  4850. EVENT_HOOK_BEGIN: 'hook',
  4851. /**
  4852. * Emitted when {@link Hook} execution ends
  4853. */
  4854. EVENT_HOOK_END: 'hook end',
  4855. /**
  4856. * Emitted when Root {@link Suite} execution begins (all files have been parsed and hooks/tests are ready for execution)
  4857. */
  4858. EVENT_RUN_BEGIN: 'start',
  4859. /**
  4860. * Emitted when Root {@link Suite} execution has been delayed via `delay` option
  4861. */
  4862. EVENT_DELAY_BEGIN: 'waiting',
  4863. /**
  4864. * Emitted when delayed Root {@link Suite} execution is triggered by user via `global.run()`
  4865. */
  4866. EVENT_DELAY_END: 'ready',
  4867. /**
  4868. * Emitted when Root {@link Suite} execution ends
  4869. */
  4870. EVENT_RUN_END: 'end',
  4871. /**
  4872. * Emitted when {@link Suite} execution begins
  4873. */
  4874. EVENT_SUITE_BEGIN: 'suite',
  4875. /**
  4876. * Emitted when {@link Suite} execution ends
  4877. */
  4878. EVENT_SUITE_END: 'suite end',
  4879. /**
  4880. * Emitted when {@link Test} execution begins
  4881. */
  4882. EVENT_TEST_BEGIN: 'test',
  4883. /**
  4884. * Emitted when {@link Test} execution ends
  4885. */
  4886. EVENT_TEST_END: 'test end',
  4887. /**
  4888. * Emitted when {@link Test} execution fails
  4889. */
  4890. EVENT_TEST_FAIL: 'fail',
  4891. /**
  4892. * Emitted when {@link Test} execution succeeds
  4893. */
  4894. EVENT_TEST_PASS: 'pass',
  4895. /**
  4896. * Emitted when {@link Test} becomes pending
  4897. */
  4898. EVENT_TEST_PENDING: 'pending',
  4899. /**
  4900. * Emitted when {@link Test} execution has failed, but will retry
  4901. */
  4902. EVENT_TEST_RETRY: 'retry'
  4903. }
  4904. );
  4905. module.exports = Runner;
  4906. /**
  4907. * Initialize a `Runner` at the Root {@link Suite}, which represents a hierarchy of {@link Suite|Suites} and {@link Test|Tests}.
  4908. *
  4909. * @extends external:EventEmitter
  4910. * @public
  4911. * @class
  4912. * @param {Suite} suite Root suite
  4913. * @param {boolean} [delay] Whether or not to delay execution of root suite
  4914. * until ready.
  4915. */
  4916. function Runner(suite, delay) {
  4917. var self = this;
  4918. this._globals = [];
  4919. this._abort = false;
  4920. this._delay = delay;
  4921. this.suite = suite;
  4922. this.started = false;
  4923. this.total = suite.total();
  4924. this.failures = 0;
  4925. this.on(constants.EVENT_TEST_END, function(test) {
  4926. self.checkGlobals(test);
  4927. });
  4928. this.on(constants.EVENT_HOOK_END, function(hook) {
  4929. self.checkGlobals(hook);
  4930. });
  4931. this._defaultGrep = /.*/;
  4932. this.grep(this._defaultGrep);
  4933. this.globals(this.globalProps().concat(extraGlobals()));
  4934. }
  4935. /**
  4936. * Wrapper for setImmediate, process.nextTick, or browser polyfill.
  4937. *
  4938. * @param {Function} fn
  4939. * @private
  4940. */
  4941. Runner.immediately = global.setImmediate || process.nextTick;
  4942. /**
  4943. * Inherit from `EventEmitter.prototype`.
  4944. */
  4945. inherits(Runner, EventEmitter);
  4946. /**
  4947. * Run tests with full titles matching `re`. Updates runner.total
  4948. * with number of tests matched.
  4949. *
  4950. * @public
  4951. * @memberof Runner
  4952. * @param {RegExp} re
  4953. * @param {boolean} invert
  4954. * @return {Runner} Runner instance.
  4955. */
  4956. Runner.prototype.grep = function(re, invert) {
  4957. debug('grep %s', re);
  4958. this._grep = re;
  4959. this._invert = invert;
  4960. this.total = this.grepTotal(this.suite);
  4961. return this;
  4962. };
  4963. /**
  4964. * Returns the number of tests matching the grep search for the
  4965. * given suite.
  4966. *
  4967. * @memberof Runner
  4968. * @public
  4969. * @param {Suite} suite
  4970. * @return {number}
  4971. */
  4972. Runner.prototype.grepTotal = function(suite) {
  4973. var self = this;
  4974. var total = 0;
  4975. suite.eachTest(function(test) {
  4976. var match = self._grep.test(test.fullTitle());
  4977. if (self._invert) {
  4978. match = !match;
  4979. }
  4980. if (match) {
  4981. total++;
  4982. }
  4983. });
  4984. return total;
  4985. };
  4986. /**
  4987. * Return a list of global properties.
  4988. *
  4989. * @return {Array}
  4990. * @private
  4991. */
  4992. Runner.prototype.globalProps = function() {
  4993. var props = Object.keys(global);
  4994. // non-enumerables
  4995. for (var i = 0; i < globals.length; ++i) {
  4996. if (~props.indexOf(globals[i])) {
  4997. continue;
  4998. }
  4999. props.push(globals[i]);
  5000. }
  5001. return props;
  5002. };
  5003. /**
  5004. * Allow the given `arr` of globals.
  5005. *
  5006. * @public
  5007. * @memberof Runner
  5008. * @param {Array} arr
  5009. * @return {Runner} Runner instance.
  5010. */
  5011. Runner.prototype.globals = function(arr) {
  5012. if (!arguments.length) {
  5013. return this._globals;
  5014. }
  5015. debug('globals %j', arr);
  5016. this._globals = this._globals.concat(arr);
  5017. return this;
  5018. };
  5019. /**
  5020. * Check for global variable leaks.
  5021. *
  5022. * @private
  5023. */
  5024. Runner.prototype.checkGlobals = function(test) {
  5025. if (this.ignoreLeaks) {
  5026. return;
  5027. }
  5028. var ok = this._globals;
  5029. var globals = this.globalProps();
  5030. var leaks;
  5031. if (test) {
  5032. ok = ok.concat(test._allowedGlobals || []);
  5033. }
  5034. if (this.prevGlobalsLength === globals.length) {
  5035. return;
  5036. }
  5037. this.prevGlobalsLength = globals.length;
  5038. leaks = filterLeaks(ok, globals);
  5039. this._globals = this._globals.concat(leaks);
  5040. if (leaks.length) {
  5041. var format = ngettext(
  5042. leaks.length,
  5043. 'global leak detected: %s',
  5044. 'global leaks detected: %s'
  5045. );
  5046. var error = new Error(util.format(format, leaks.map(sQuote).join(', ')));
  5047. this.fail(test, error);
  5048. }
  5049. };
  5050. /**
  5051. * Fail the given `test`.
  5052. *
  5053. * @private
  5054. * @param {Test} test
  5055. * @param {Error} err
  5056. */
  5057. Runner.prototype.fail = function(test, err) {
  5058. if (test.isPending()) {
  5059. return;
  5060. }
  5061. ++this.failures;
  5062. test.state = STATE_FAILED;
  5063. if (!isError(err)) {
  5064. err = thrown2Error(err);
  5065. }
  5066. try {
  5067. err.stack =
  5068. this.fullStackTrace || !err.stack ? err.stack : stackFilter(err.stack);
  5069. } catch (ignore) {
  5070. // some environments do not take kindly to monkeying with the stack
  5071. }
  5072. this.emit(constants.EVENT_TEST_FAIL, test, err);
  5073. };
  5074. /**
  5075. * Fail the given `hook` with `err`.
  5076. *
  5077. * Hook failures work in the following pattern:
  5078. * - If bail, run corresponding `after each` and `after` hooks,
  5079. * then exit
  5080. * - Failed `before` hook skips all tests in a suite and subsuites,
  5081. * but jumps to corresponding `after` hook
  5082. * - Failed `before each` hook skips remaining tests in a
  5083. * suite and jumps to corresponding `after each` hook,
  5084. * which is run only once
  5085. * - Failed `after` hook does not alter
  5086. * execution order
  5087. * - Failed `after each` hook skips remaining tests in a
  5088. * suite and subsuites, but executes other `after each`
  5089. * hooks
  5090. *
  5091. * @private
  5092. * @param {Hook} hook
  5093. * @param {Error} err
  5094. */
  5095. Runner.prototype.failHook = function(hook, err) {
  5096. hook.originalTitle = hook.originalTitle || hook.title;
  5097. if (hook.ctx && hook.ctx.currentTest) {
  5098. hook.title =
  5099. hook.originalTitle + ' for ' + dQuote(hook.ctx.currentTest.title);
  5100. } else {
  5101. var parentTitle;
  5102. if (hook.parent.title) {
  5103. parentTitle = hook.parent.title;
  5104. } else {
  5105. parentTitle = hook.parent.root ? '{root}' : '';
  5106. }
  5107. hook.title = hook.originalTitle + ' in ' + dQuote(parentTitle);
  5108. }
  5109. this.fail(hook, err);
  5110. };
  5111. /**
  5112. * Run hook `name` callbacks and then invoke `fn()`.
  5113. *
  5114. * @private
  5115. * @param {string} name
  5116. * @param {Function} fn
  5117. */
  5118. Runner.prototype.hook = function(name, fn) {
  5119. var suite = this.suite;
  5120. var hooks = suite.getHooks(name);
  5121. var self = this;
  5122. function next(i) {
  5123. var hook = hooks[i];
  5124. if (!hook) {
  5125. return fn();
  5126. }
  5127. self.currentRunnable = hook;
  5128. if (name === 'beforeAll') {
  5129. hook.ctx.currentTest = hook.parent.tests[0];
  5130. } else if (name === 'afterAll') {
  5131. hook.ctx.currentTest = hook.parent.tests[hook.parent.tests.length - 1];
  5132. } else {
  5133. hook.ctx.currentTest = self.test;
  5134. }
  5135. self.emit(constants.EVENT_HOOK_BEGIN, hook);
  5136. if (!hook.listeners('error').length) {
  5137. hook.on('error', function(err) {
  5138. self.failHook(hook, err);
  5139. });
  5140. }
  5141. hook.run(function(err) {
  5142. var testError = hook.error();
  5143. if (testError) {
  5144. self.fail(self.test, testError);
  5145. }
  5146. if (err) {
  5147. if (err instanceof Pending) {
  5148. if (name === HOOK_TYPE_BEFORE_EACH || name === HOOK_TYPE_AFTER_EACH) {
  5149. self.test.pending = true;
  5150. } else {
  5151. suite.tests.forEach(function(test) {
  5152. test.pending = true;
  5153. });
  5154. suite.suites.forEach(function(suite) {
  5155. suite.pending = true;
  5156. });
  5157. // a pending hook won't be executed twice.
  5158. hook.pending = true;
  5159. }
  5160. } else {
  5161. self.failHook(hook, err);
  5162. // stop executing hooks, notify callee of hook err
  5163. return fn(err);
  5164. }
  5165. }
  5166. self.emit(constants.EVENT_HOOK_END, hook);
  5167. delete hook.ctx.currentTest;
  5168. next(++i);
  5169. });
  5170. }
  5171. Runner.immediately(function() {
  5172. next(0);
  5173. });
  5174. };
  5175. /**
  5176. * Run hook `name` for the given array of `suites`
  5177. * in order, and callback `fn(err, errSuite)`.
  5178. *
  5179. * @private
  5180. * @param {string} name
  5181. * @param {Array} suites
  5182. * @param {Function} fn
  5183. */
  5184. Runner.prototype.hooks = function(name, suites, fn) {
  5185. var self = this;
  5186. var orig = this.suite;
  5187. function next(suite) {
  5188. self.suite = suite;
  5189. if (!suite) {
  5190. self.suite = orig;
  5191. return fn();
  5192. }
  5193. self.hook(name, function(err) {
  5194. if (err) {
  5195. var errSuite = self.suite;
  5196. self.suite = orig;
  5197. return fn(err, errSuite);
  5198. }
  5199. next(suites.pop());
  5200. });
  5201. }
  5202. next(suites.pop());
  5203. };
  5204. /**
  5205. * Run hooks from the top level down.
  5206. *
  5207. * @param {String} name
  5208. * @param {Function} fn
  5209. * @private
  5210. */
  5211. Runner.prototype.hookUp = function(name, fn) {
  5212. var suites = [this.suite].concat(this.parents()).reverse();
  5213. this.hooks(name, suites, fn);
  5214. };
  5215. /**
  5216. * Run hooks from the bottom up.
  5217. *
  5218. * @param {String} name
  5219. * @param {Function} fn
  5220. * @private
  5221. */
  5222. Runner.prototype.hookDown = function(name, fn) {
  5223. var suites = [this.suite].concat(this.parents());
  5224. this.hooks(name, suites, fn);
  5225. };
  5226. /**
  5227. * Return an array of parent Suites from
  5228. * closest to furthest.
  5229. *
  5230. * @return {Array}
  5231. * @private
  5232. */
  5233. Runner.prototype.parents = function() {
  5234. var suite = this.suite;
  5235. var suites = [];
  5236. while (suite.parent) {
  5237. suite = suite.parent;
  5238. suites.push(suite);
  5239. }
  5240. return suites;
  5241. };
  5242. /**
  5243. * Run the current test and callback `fn(err)`.
  5244. *
  5245. * @param {Function} fn
  5246. * @private
  5247. */
  5248. Runner.prototype.runTest = function(fn) {
  5249. var self = this;
  5250. var test = this.test;
  5251. if (!test) {
  5252. return;
  5253. }
  5254. var suite = this.parents().reverse()[0] || this.suite;
  5255. if (this.forbidOnly && suite.hasOnly()) {
  5256. fn(new Error('`.only` forbidden'));
  5257. return;
  5258. }
  5259. if (this.asyncOnly) {
  5260. test.asyncOnly = true;
  5261. }
  5262. test.on('error', function(err) {
  5263. self.fail(test, err);
  5264. });
  5265. if (this.allowUncaught) {
  5266. test.allowUncaught = true;
  5267. return test.run(fn);
  5268. }
  5269. try {
  5270. test.run(fn);
  5271. } catch (err) {
  5272. fn(err);
  5273. }
  5274. };
  5275. /**
  5276. * Run tests in the given `suite` and invoke the callback `fn()` when complete.
  5277. *
  5278. * @private
  5279. * @param {Suite} suite
  5280. * @param {Function} fn
  5281. */
  5282. Runner.prototype.runTests = function(suite, fn) {
  5283. var self = this;
  5284. var tests = suite.tests.slice();
  5285. var test;
  5286. function hookErr(_, errSuite, after) {
  5287. // before/after Each hook for errSuite failed:
  5288. var orig = self.suite;
  5289. // for failed 'after each' hook start from errSuite parent,
  5290. // otherwise start from errSuite itself
  5291. self.suite = after ? errSuite.parent : errSuite;
  5292. if (self.suite) {
  5293. // call hookUp afterEach
  5294. self.hookUp(HOOK_TYPE_AFTER_EACH, function(err2, errSuite2) {
  5295. self.suite = orig;
  5296. // some hooks may fail even now
  5297. if (err2) {
  5298. return hookErr(err2, errSuite2, true);
  5299. }
  5300. // report error suite
  5301. fn(errSuite);
  5302. });
  5303. } else {
  5304. // there is no need calling other 'after each' hooks
  5305. self.suite = orig;
  5306. fn(errSuite);
  5307. }
  5308. }
  5309. function next(err, errSuite) {
  5310. // if we bail after first err
  5311. if (self.failures && suite._bail) {
  5312. tests = [];
  5313. }
  5314. if (self._abort) {
  5315. return fn();
  5316. }
  5317. if (err) {
  5318. return hookErr(err, errSuite, true);
  5319. }
  5320. // next test
  5321. test = tests.shift();
  5322. // all done
  5323. if (!test) {
  5324. return fn();
  5325. }
  5326. // grep
  5327. var match = self._grep.test(test.fullTitle());
  5328. if (self._invert) {
  5329. match = !match;
  5330. }
  5331. if (!match) {
  5332. // Run immediately only if we have defined a grep. When we
  5333. // define a grep — It can cause maximum callstack error if
  5334. // the grep is doing a large recursive loop by neglecting
  5335. // all tests. The run immediately function also comes with
  5336. // a performance cost. So we don't want to run immediately
  5337. // if we run the whole test suite, because running the whole
  5338. // test suite don't do any immediate recursive loops. Thus,
  5339. // allowing a JS runtime to breathe.
  5340. if (self._grep !== self._defaultGrep) {
  5341. Runner.immediately(next);
  5342. } else {
  5343. next();
  5344. }
  5345. return;
  5346. }
  5347. if (test.isPending()) {
  5348. if (self.forbidPending) {
  5349. test.isPending = alwaysFalse;
  5350. self.fail(test, new Error('Pending test forbidden'));
  5351. delete test.isPending;
  5352. } else {
  5353. self.emit(constants.EVENT_TEST_PENDING, test);
  5354. }
  5355. self.emit(constants.EVENT_TEST_END, test);
  5356. return next();
  5357. }
  5358. // execute test and hook(s)
  5359. self.emit(constants.EVENT_TEST_BEGIN, (self.test = test));
  5360. self.hookDown(HOOK_TYPE_BEFORE_EACH, function(err, errSuite) {
  5361. if (test.isPending()) {
  5362. if (self.forbidPending) {
  5363. test.isPending = alwaysFalse;
  5364. self.fail(test, new Error('Pending test forbidden'));
  5365. delete test.isPending;
  5366. } else {
  5367. self.emit(constants.EVENT_TEST_PENDING, test);
  5368. }
  5369. self.emit(constants.EVENT_TEST_END, test);
  5370. return next();
  5371. }
  5372. if (err) {
  5373. return hookErr(err, errSuite, false);
  5374. }
  5375. self.currentRunnable = self.test;
  5376. self.runTest(function(err) {
  5377. test = self.test;
  5378. if (err) {
  5379. var retry = test.currentRetry();
  5380. if (err instanceof Pending && self.forbidPending) {
  5381. self.fail(test, new Error('Pending test forbidden'));
  5382. } else if (err instanceof Pending) {
  5383. test.pending = true;
  5384. self.emit(constants.EVENT_TEST_PENDING, test);
  5385. } else if (retry < test.retries()) {
  5386. var clonedTest = test.clone();
  5387. clonedTest.currentRetry(retry + 1);
  5388. tests.unshift(clonedTest);
  5389. self.emit(constants.EVENT_TEST_RETRY, test, err);
  5390. // Early return + hook trigger so that it doesn't
  5391. // increment the count wrong
  5392. return self.hookUp(HOOK_TYPE_AFTER_EACH, next);
  5393. } else {
  5394. self.fail(test, err);
  5395. }
  5396. self.emit(constants.EVENT_TEST_END, test);
  5397. if (err instanceof Pending) {
  5398. return next();
  5399. }
  5400. return self.hookUp(HOOK_TYPE_AFTER_EACH, next);
  5401. }
  5402. test.state = STATE_PASSED;
  5403. self.emit(constants.EVENT_TEST_PASS, test);
  5404. self.emit(constants.EVENT_TEST_END, test);
  5405. self.hookUp(HOOK_TYPE_AFTER_EACH, next);
  5406. });
  5407. });
  5408. }
  5409. this.next = next;
  5410. this.hookErr = hookErr;
  5411. next();
  5412. };
  5413. function alwaysFalse() {
  5414. return false;
  5415. }
  5416. /**
  5417. * Run the given `suite` and invoke the callback `fn()` when complete.
  5418. *
  5419. * @private
  5420. * @param {Suite} suite
  5421. * @param {Function} fn
  5422. */
  5423. Runner.prototype.runSuite = function(suite, fn) {
  5424. var i = 0;
  5425. var self = this;
  5426. var total = this.grepTotal(suite);
  5427. var afterAllHookCalled = false;
  5428. debug('run suite %s', suite.fullTitle());
  5429. if (!total || (self.failures && suite._bail)) {
  5430. return fn();
  5431. }
  5432. this.emit(constants.EVENT_SUITE_BEGIN, (this.suite = suite));
  5433. function next(errSuite) {
  5434. if (errSuite) {
  5435. // current suite failed on a hook from errSuite
  5436. if (errSuite === suite) {
  5437. // if errSuite is current suite
  5438. // continue to the next sibling suite
  5439. return done();
  5440. }
  5441. // errSuite is among the parents of current suite
  5442. // stop execution of errSuite and all sub-suites
  5443. return done(errSuite);
  5444. }
  5445. if (self._abort) {
  5446. return done();
  5447. }
  5448. var curr = suite.suites[i++];
  5449. if (!curr) {
  5450. return done();
  5451. }
  5452. // Avoid grep neglecting large number of tests causing a
  5453. // huge recursive loop and thus a maximum call stack error.
  5454. // See comment in `this.runTests()` for more information.
  5455. if (self._grep !== self._defaultGrep) {
  5456. Runner.immediately(function() {
  5457. self.runSuite(curr, next);
  5458. });
  5459. } else {
  5460. self.runSuite(curr, next);
  5461. }
  5462. }
  5463. function done(errSuite) {
  5464. self.suite = suite;
  5465. self.nextSuite = next;
  5466. if (afterAllHookCalled) {
  5467. fn(errSuite);
  5468. } else {
  5469. // mark that the afterAll block has been called once
  5470. // and so can be skipped if there is an error in it.
  5471. afterAllHookCalled = true;
  5472. // remove reference to test
  5473. delete self.test;
  5474. self.hook(HOOK_TYPE_AFTER_ALL, function() {
  5475. self.emit(constants.EVENT_SUITE_END, suite);
  5476. fn(errSuite);
  5477. });
  5478. }
  5479. }
  5480. this.nextSuite = next;
  5481. this.hook(HOOK_TYPE_BEFORE_ALL, function(err) {
  5482. if (err) {
  5483. return done();
  5484. }
  5485. self.runTests(suite, next);
  5486. });
  5487. };
  5488. /**
  5489. * Handle uncaught exceptions.
  5490. *
  5491. * @param {Error} err
  5492. * @private
  5493. */
  5494. Runner.prototype.uncaught = function(err) {
  5495. if (err) {
  5496. debug('uncaught exception %O', err);
  5497. } else {
  5498. debug('uncaught undefined/falsy exception');
  5499. err = createInvalidExceptionError(
  5500. 'Caught falsy/undefined exception which would otherwise be uncaught. No stack trace found; try a debugger',
  5501. err
  5502. );
  5503. }
  5504. if (!isError(err)) {
  5505. err = thrown2Error(err);
  5506. }
  5507. err.uncaught = true;
  5508. var runnable = this.currentRunnable;
  5509. if (!runnable) {
  5510. runnable = new Runnable('Uncaught error outside test suite');
  5511. runnable.parent = this.suite;
  5512. if (this.started) {
  5513. this.fail(runnable, err);
  5514. } else {
  5515. // Can't recover from this failure
  5516. this.emit(constants.EVENT_RUN_BEGIN);
  5517. this.fail(runnable, err);
  5518. this.emit(constants.EVENT_RUN_END);
  5519. }
  5520. return;
  5521. }
  5522. runnable.clearTimeout();
  5523. // Ignore errors if already failed or pending
  5524. // See #3226
  5525. if (runnable.isFailed() || runnable.isPending()) {
  5526. return;
  5527. }
  5528. // we cannot recover gracefully if a Runnable has already passed
  5529. // then fails asynchronously
  5530. var alreadyPassed = runnable.isPassed();
  5531. // this will change the state to "failed" regardless of the current value
  5532. this.fail(runnable, err);
  5533. if (!alreadyPassed) {
  5534. // recover from test
  5535. if (runnable.type === constants.EVENT_TEST_BEGIN) {
  5536. this.emit(constants.EVENT_TEST_END, runnable);
  5537. this.hookUp(HOOK_TYPE_AFTER_EACH, this.next);
  5538. return;
  5539. }
  5540. debug(runnable);
  5541. // recover from hooks
  5542. var errSuite = this.suite;
  5543. // XXX how about a less awful way to determine this?
  5544. // if hook failure is in afterEach block
  5545. if (runnable.fullTitle().indexOf('after each') > -1) {
  5546. return this.hookErr(err, errSuite, true);
  5547. }
  5548. // if hook failure is in beforeEach block
  5549. if (runnable.fullTitle().indexOf('before each') > -1) {
  5550. return this.hookErr(err, errSuite, false);
  5551. }
  5552. // if hook failure is in after or before blocks
  5553. return this.nextSuite(errSuite);
  5554. }
  5555. // bail
  5556. this.emit(constants.EVENT_RUN_END);
  5557. };
  5558. /**
  5559. * Run the root suite and invoke `fn(failures)`
  5560. * on completion.
  5561. *
  5562. * @public
  5563. * @memberof Runner
  5564. * @param {Function} fn
  5565. * @return {Runner} Runner instance.
  5566. */
  5567. Runner.prototype.run = function(fn) {
  5568. var self = this;
  5569. var rootSuite = this.suite;
  5570. fn = fn || function() {};
  5571. function uncaught(err) {
  5572. self.uncaught(err);
  5573. }
  5574. function start() {
  5575. // If there is an `only` filter
  5576. if (rootSuite.hasOnly()) {
  5577. rootSuite.filterOnly();
  5578. }
  5579. self.started = true;
  5580. if (self._delay) {
  5581. self.emit(constants.EVENT_DELAY_END);
  5582. }
  5583. self.emit(constants.EVENT_RUN_BEGIN);
  5584. self.runSuite(rootSuite, function() {
  5585. debug('finished running');
  5586. self.emit(constants.EVENT_RUN_END);
  5587. });
  5588. }
  5589. debug(constants.EVENT_RUN_BEGIN);
  5590. // references cleanup to avoid memory leaks
  5591. this.on(constants.EVENT_SUITE_END, function(suite) {
  5592. suite.cleanReferences();
  5593. });
  5594. // callback
  5595. this.on(constants.EVENT_RUN_END, function() {
  5596. debug(constants.EVENT_RUN_END);
  5597. process.removeListener('uncaughtException', uncaught);
  5598. fn(self.failures);
  5599. });
  5600. // uncaught exception
  5601. process.on('uncaughtException', uncaught);
  5602. if (this._delay) {
  5603. // for reporters, I guess.
  5604. // might be nice to debounce some dots while we wait.
  5605. this.emit(constants.EVENT_DELAY_BEGIN, rootSuite);
  5606. rootSuite.once(EVENT_ROOT_SUITE_RUN, start);
  5607. } else {
  5608. start();
  5609. }
  5610. return this;
  5611. };
  5612. /**
  5613. * Cleanly abort execution.
  5614. *
  5615. * @memberof Runner
  5616. * @public
  5617. * @return {Runner} Runner instance.
  5618. */
  5619. Runner.prototype.abort = function() {
  5620. debug('aborting');
  5621. this._abort = true;
  5622. return this;
  5623. };
  5624. /**
  5625. * Filter leaks with the given globals flagged as `ok`.
  5626. *
  5627. * @private
  5628. * @param {Array} ok
  5629. * @param {Array} globals
  5630. * @return {Array}
  5631. */
  5632. function filterLeaks(ok, globals) {
  5633. return globals.filter(function(key) {
  5634. // Firefox and Chrome exposes iframes as index inside the window object
  5635. if (/^\d+/.test(key)) {
  5636. return false;
  5637. }
  5638. // in firefox
  5639. // if runner runs in an iframe, this iframe's window.getInterface method
  5640. // not init at first it is assigned in some seconds
  5641. if (global.navigator && /^getInterface/.test(key)) {
  5642. return false;
  5643. }
  5644. // an iframe could be approached by window[iframeIndex]
  5645. // in ie6,7,8 and opera, iframeIndex is enumerable, this could cause leak
  5646. if (global.navigator && /^\d+/.test(key)) {
  5647. return false;
  5648. }
  5649. // Opera and IE expose global variables for HTML element IDs (issue #243)
  5650. if (/^mocha-/.test(key)) {
  5651. return false;
  5652. }
  5653. var matched = ok.filter(function(ok) {
  5654. if (~ok.indexOf('*')) {
  5655. return key.indexOf(ok.split('*')[0]) === 0;
  5656. }
  5657. return key === ok;
  5658. });
  5659. return !matched.length && (!global.navigator || key !== 'onerror');
  5660. });
  5661. }
  5662. /**
  5663. * Check if argument is an instance of Error object or a duck-typed equivalent.
  5664. *
  5665. * @private
  5666. * @param {Object} err - object to check
  5667. * @param {string} err.message - error message
  5668. * @returns {boolean}
  5669. */
  5670. function isError(err) {
  5671. return err instanceof Error || (err && typeof err.message === 'string');
  5672. }
  5673. /**
  5674. *
  5675. * Converts thrown non-extensible type into proper Error.
  5676. *
  5677. * @private
  5678. * @param {*} thrown - Non-extensible type thrown by code
  5679. * @return {Error}
  5680. */
  5681. function thrown2Error(err) {
  5682. return new Error(
  5683. 'the ' + type(err) + ' ' + stringify(err) + ' was thrown, throw an Error :)'
  5684. );
  5685. }
  5686. /**
  5687. * Array of globals dependent on the environment.
  5688. *
  5689. * @return {Array}
  5690. * @deprecated
  5691. * @todo remove; long since unsupported
  5692. * @private
  5693. */
  5694. function extraGlobals() {
  5695. if (typeof process === 'object' && typeof process.version === 'string') {
  5696. var parts = process.version.split('.');
  5697. var nodeVersion = parts.reduce(function(a, v) {
  5698. return (a << 8) | v;
  5699. });
  5700. // 'errno' was renamed to process._errno in v0.9.11.
  5701. if (nodeVersion < 0x00090b) {
  5702. return ['errno'];
  5703. }
  5704. }
  5705. return [];
  5706. }
  5707. Runner.constants = constants;
  5708. /**
  5709. * Node.js' `EventEmitter`
  5710. * @external EventEmitter
  5711. * @see {@link https://nodejs.org/api/events.html#events_class_eventemitter}
  5712. */
  5713. }).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
  5714. },{"./errors":6,"./pending":16,"./runnable":33,"./suite":36,"./utils":38,"_process":68,"debug":45,"events":50,"util":88}],35:[function(require,module,exports){
  5715. (function (global){
  5716. 'use strict';
  5717. /**
  5718. * Provides a factory function for a {@link StatsCollector} object.
  5719. * @module
  5720. */
  5721. var constants = require('./runner').constants;
  5722. var EVENT_TEST_PASS = constants.EVENT_TEST_PASS;
  5723. var EVENT_TEST_FAIL = constants.EVENT_TEST_FAIL;
  5724. var EVENT_SUITE_BEGIN = constants.EVENT_SUITE_BEGIN;
  5725. var EVENT_RUN_BEGIN = constants.EVENT_RUN_BEGIN;
  5726. var EVENT_TEST_PENDING = constants.EVENT_TEST_PENDING;
  5727. var EVENT_RUN_END = constants.EVENT_RUN_END;
  5728. var EVENT_TEST_END = constants.EVENT_TEST_END;
  5729. /**
  5730. * Test statistics collector.
  5731. *
  5732. * @public
  5733. * @typedef {Object} StatsCollector
  5734. * @property {number} suites - integer count of suites run.
  5735. * @property {number} tests - integer count of tests run.
  5736. * @property {number} passes - integer count of passing tests.
  5737. * @property {number} pending - integer count of pending tests.
  5738. * @property {number} failures - integer count of failed tests.
  5739. * @property {Date} start - time when testing began.
  5740. * @property {Date} end - time when testing concluded.
  5741. * @property {number} duration - number of msecs that testing took.
  5742. */
  5743. var Date = global.Date;
  5744. /**
  5745. * Provides stats such as test duration, number of tests passed / failed etc., by listening for events emitted by `runner`.
  5746. *
  5747. * @private
  5748. * @param {Runner} runner - Runner instance
  5749. * @throws {TypeError} If falsy `runner`
  5750. */
  5751. function createStatsCollector(runner) {
  5752. /**
  5753. * @type StatsCollector
  5754. */
  5755. var stats = {
  5756. suites: 0,
  5757. tests: 0,
  5758. passes: 0,
  5759. pending: 0,
  5760. failures: 0
  5761. };
  5762. if (!runner) {
  5763. throw new TypeError('Missing runner argument');
  5764. }
  5765. runner.stats = stats;
  5766. runner.once(EVENT_RUN_BEGIN, function() {
  5767. stats.start = new Date();
  5768. });
  5769. runner.on(EVENT_SUITE_BEGIN, function(suite) {
  5770. suite.root || stats.suites++;
  5771. });
  5772. runner.on(EVENT_TEST_PASS, function() {
  5773. stats.passes++;
  5774. });
  5775. runner.on(EVENT_TEST_FAIL, function() {
  5776. stats.failures++;
  5777. });
  5778. runner.on(EVENT_TEST_PENDING, function() {
  5779. stats.pending++;
  5780. });
  5781. runner.on(EVENT_TEST_END, function() {
  5782. stats.tests++;
  5783. });
  5784. runner.once(EVENT_RUN_END, function() {
  5785. stats.end = new Date();
  5786. stats.duration = stats.end - stats.start;
  5787. });
  5788. }
  5789. module.exports = createStatsCollector;
  5790. }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
  5791. },{"./runner":34}],36:[function(require,module,exports){
  5792. 'use strict';
  5793. /**
  5794. * Module dependencies.
  5795. */
  5796. var EventEmitter = require('events').EventEmitter;
  5797. var Hook = require('./hook');
  5798. var utils = require('./utils');
  5799. var inherits = utils.inherits;
  5800. var debug = require('debug')('mocha:suite');
  5801. var milliseconds = require('ms');
  5802. var errors = require('./errors');
  5803. var createInvalidArgumentTypeError = errors.createInvalidArgumentTypeError;
  5804. /**
  5805. * Expose `Suite`.
  5806. */
  5807. exports = module.exports = Suite;
  5808. /**
  5809. * Create a new `Suite` with the given `title` and parent `Suite`.
  5810. *
  5811. * @public
  5812. * @param {Suite} parent - Parent suite (required!)
  5813. * @param {string} title - Title
  5814. * @return {Suite}
  5815. */
  5816. Suite.create = function(parent, title) {
  5817. var suite = new Suite(title, parent.ctx);
  5818. suite.parent = parent;
  5819. title = suite.fullTitle();
  5820. parent.addSuite(suite);
  5821. return suite;
  5822. };
  5823. /**
  5824. * Constructs a new `Suite` instance with the given `title`, `ctx`, and `isRoot`.
  5825. *
  5826. * @public
  5827. * @class
  5828. * @extends EventEmitter
  5829. * @see {@link https://nodejs.org/api/events.html#events_class_eventemitter|EventEmitter}
  5830. * @param {string} title - Suite title.
  5831. * @param {Context} parentContext - Parent context instance.
  5832. * @param {boolean} [isRoot=false] - Whether this is the root suite.
  5833. */
  5834. function Suite(title, parentContext, isRoot) {
  5835. if (!utils.isString(title)) {
  5836. throw createInvalidArgumentTypeError(
  5837. 'Suite argument "title" must be a string. Received type "' +
  5838. typeof title +
  5839. '"',
  5840. 'title',
  5841. 'string'
  5842. );
  5843. }
  5844. this.title = title;
  5845. function Context() {}
  5846. Context.prototype = parentContext;
  5847. this.ctx = new Context();
  5848. this.suites = [];
  5849. this.tests = [];
  5850. this.pending = false;
  5851. this._beforeEach = [];
  5852. this._beforeAll = [];
  5853. this._afterEach = [];
  5854. this._afterAll = [];
  5855. this.root = isRoot === true;
  5856. this._timeout = 2000;
  5857. this._enableTimeouts = true;
  5858. this._slow = 75;
  5859. this._bail = false;
  5860. this._retries = -1;
  5861. this._onlyTests = [];
  5862. this._onlySuites = [];
  5863. this.delayed = false;
  5864. this.on('newListener', function(event) {
  5865. if (deprecatedEvents[event]) {
  5866. utils.deprecate(
  5867. 'Event "' +
  5868. event +
  5869. '" is deprecated. Please let the Mocha team know about your use case: https://git.io/v6Lwm'
  5870. );
  5871. }
  5872. });
  5873. }
  5874. /**
  5875. * Inherit from `EventEmitter.prototype`.
  5876. */
  5877. inherits(Suite, EventEmitter);
  5878. /**
  5879. * Return a clone of this `Suite`.
  5880. *
  5881. * @private
  5882. * @return {Suite}
  5883. */
  5884. Suite.prototype.clone = function() {
  5885. var suite = new Suite(this.title);
  5886. debug('clone');
  5887. suite.ctx = this.ctx;
  5888. suite.timeout(this.timeout());
  5889. suite.retries(this.retries());
  5890. suite.enableTimeouts(this.enableTimeouts());
  5891. suite.slow(this.slow());
  5892. suite.bail(this.bail());
  5893. return suite;
  5894. };
  5895. /**
  5896. * Set or get timeout `ms` or short-hand such as "2s".
  5897. *
  5898. * @private
  5899. * @param {number|string} ms
  5900. * @return {Suite|number} for chaining
  5901. */
  5902. Suite.prototype.timeout = function(ms) {
  5903. if (!arguments.length) {
  5904. return this._timeout;
  5905. }
  5906. if (ms.toString() === '0') {
  5907. this._enableTimeouts = false;
  5908. }
  5909. if (typeof ms === 'string') {
  5910. ms = milliseconds(ms);
  5911. }
  5912. debug('timeout %d', ms);
  5913. this._timeout = parseInt(ms, 10);
  5914. return this;
  5915. };
  5916. /**
  5917. * Set or get number of times to retry a failed test.
  5918. *
  5919. * @private
  5920. * @param {number|string} n
  5921. * @return {Suite|number} for chaining
  5922. */
  5923. Suite.prototype.retries = function(n) {
  5924. if (!arguments.length) {
  5925. return this._retries;
  5926. }
  5927. debug('retries %d', n);
  5928. this._retries = parseInt(n, 10) || 0;
  5929. return this;
  5930. };
  5931. /**
  5932. * Set or get timeout to `enabled`.
  5933. *
  5934. * @private
  5935. * @param {boolean} enabled
  5936. * @return {Suite|boolean} self or enabled
  5937. */
  5938. Suite.prototype.enableTimeouts = function(enabled) {
  5939. if (!arguments.length) {
  5940. return this._enableTimeouts;
  5941. }
  5942. debug('enableTimeouts %s', enabled);
  5943. this._enableTimeouts = enabled;
  5944. return this;
  5945. };
  5946. /**
  5947. * Set or get slow `ms` or short-hand such as "2s".
  5948. *
  5949. * @private
  5950. * @param {number|string} ms
  5951. * @return {Suite|number} for chaining
  5952. */
  5953. Suite.prototype.slow = function(ms) {
  5954. if (!arguments.length) {
  5955. return this._slow;
  5956. }
  5957. if (typeof ms === 'string') {
  5958. ms = milliseconds(ms);
  5959. }
  5960. debug('slow %d', ms);
  5961. this._slow = ms;
  5962. return this;
  5963. };
  5964. /**
  5965. * Set or get whether to bail after first error.
  5966. *
  5967. * @private
  5968. * @param {boolean} bail
  5969. * @return {Suite|number} for chaining
  5970. */
  5971. Suite.prototype.bail = function(bail) {
  5972. if (!arguments.length) {
  5973. return this._bail;
  5974. }
  5975. debug('bail %s', bail);
  5976. this._bail = bail;
  5977. return this;
  5978. };
  5979. /**
  5980. * Check if this suite or its parent suite is marked as pending.
  5981. *
  5982. * @private
  5983. */
  5984. Suite.prototype.isPending = function() {
  5985. return this.pending || (this.parent && this.parent.isPending());
  5986. };
  5987. /**
  5988. * Generic hook-creator.
  5989. * @private
  5990. * @param {string} title - Title of hook
  5991. * @param {Function} fn - Hook callback
  5992. * @returns {Hook} A new hook
  5993. */
  5994. Suite.prototype._createHook = function(title, fn) {
  5995. var hook = new Hook(title, fn);
  5996. hook.parent = this;
  5997. hook.timeout(this.timeout());
  5998. hook.retries(this.retries());
  5999. hook.enableTimeouts(this.enableTimeouts());
  6000. hook.slow(this.slow());
  6001. hook.ctx = this.ctx;
  6002. hook.file = this.file;
  6003. return hook;
  6004. };
  6005. /**
  6006. * Run `fn(test[, done])` before running tests.
  6007. *
  6008. * @private
  6009. * @param {string} title
  6010. * @param {Function} fn
  6011. * @return {Suite} for chaining
  6012. */
  6013. Suite.prototype.beforeAll = function(title, fn) {
  6014. if (this.isPending()) {
  6015. return this;
  6016. }
  6017. if (typeof title === 'function') {
  6018. fn = title;
  6019. title = fn.name;
  6020. }
  6021. title = '"before all" hook' + (title ? ': ' + title : '');
  6022. var hook = this._createHook(title, fn);
  6023. this._beforeAll.push(hook);
  6024. this.emit(constants.EVENT_SUITE_ADD_HOOK_BEFORE_ALL, hook);
  6025. return this;
  6026. };
  6027. /**
  6028. * Run `fn(test[, done])` after running tests.
  6029. *
  6030. * @private
  6031. * @param {string} title
  6032. * @param {Function} fn
  6033. * @return {Suite} for chaining
  6034. */
  6035. Suite.prototype.afterAll = function(title, fn) {
  6036. if (this.isPending()) {
  6037. return this;
  6038. }
  6039. if (typeof title === 'function') {
  6040. fn = title;
  6041. title = fn.name;
  6042. }
  6043. title = '"after all" hook' + (title ? ': ' + title : '');
  6044. var hook = this._createHook(title, fn);
  6045. this._afterAll.push(hook);
  6046. this.emit(constants.EVENT_SUITE_ADD_HOOK_AFTER_ALL, hook);
  6047. return this;
  6048. };
  6049. /**
  6050. * Run `fn(test[, done])` before each test case.
  6051. *
  6052. * @private
  6053. * @param {string} title
  6054. * @param {Function} fn
  6055. * @return {Suite} for chaining
  6056. */
  6057. Suite.prototype.beforeEach = function(title, fn) {
  6058. if (this.isPending()) {
  6059. return this;
  6060. }
  6061. if (typeof title === 'function') {
  6062. fn = title;
  6063. title = fn.name;
  6064. }
  6065. title = '"before each" hook' + (title ? ': ' + title : '');
  6066. var hook = this._createHook(title, fn);
  6067. this._beforeEach.push(hook);
  6068. this.emit(constants.EVENT_SUITE_ADD_HOOK_BEFORE_EACH, hook);
  6069. return this;
  6070. };
  6071. /**
  6072. * Run `fn(test[, done])` after each test case.
  6073. *
  6074. * @private
  6075. * @param {string} title
  6076. * @param {Function} fn
  6077. * @return {Suite} for chaining
  6078. */
  6079. Suite.prototype.afterEach = function(title, fn) {
  6080. if (this.isPending()) {
  6081. return this;
  6082. }
  6083. if (typeof title === 'function') {
  6084. fn = title;
  6085. title = fn.name;
  6086. }
  6087. title = '"after each" hook' + (title ? ': ' + title : '');
  6088. var hook = this._createHook(title, fn);
  6089. this._afterEach.push(hook);
  6090. this.emit(constants.EVENT_SUITE_ADD_HOOK_AFTER_EACH, hook);
  6091. return this;
  6092. };
  6093. /**
  6094. * Add a test `suite`.
  6095. *
  6096. * @private
  6097. * @param {Suite} suite
  6098. * @return {Suite} for chaining
  6099. */
  6100. Suite.prototype.addSuite = function(suite) {
  6101. suite.parent = this;
  6102. suite.root = false;
  6103. suite.timeout(this.timeout());
  6104. suite.retries(this.retries());
  6105. suite.enableTimeouts(this.enableTimeouts());
  6106. suite.slow(this.slow());
  6107. suite.bail(this.bail());
  6108. this.suites.push(suite);
  6109. this.emit(constants.EVENT_SUITE_ADD_SUITE, suite);
  6110. return this;
  6111. };
  6112. /**
  6113. * Add a `test` to this suite.
  6114. *
  6115. * @private
  6116. * @param {Test} test
  6117. * @return {Suite} for chaining
  6118. */
  6119. Suite.prototype.addTest = function(test) {
  6120. test.parent = this;
  6121. test.timeout(this.timeout());
  6122. test.retries(this.retries());
  6123. test.enableTimeouts(this.enableTimeouts());
  6124. test.slow(this.slow());
  6125. test.ctx = this.ctx;
  6126. this.tests.push(test);
  6127. this.emit(constants.EVENT_SUITE_ADD_TEST, test);
  6128. return this;
  6129. };
  6130. /**
  6131. * Return the full title generated by recursively concatenating the parent's
  6132. * full title.
  6133. *
  6134. * @memberof Suite
  6135. * @public
  6136. * @return {string}
  6137. */
  6138. Suite.prototype.fullTitle = function() {
  6139. return this.titlePath().join(' ');
  6140. };
  6141. /**
  6142. * Return the title path generated by recursively concatenating the parent's
  6143. * title path.
  6144. *
  6145. * @memberof Suite
  6146. * @public
  6147. * @return {string}
  6148. */
  6149. Suite.prototype.titlePath = function() {
  6150. var result = [];
  6151. if (this.parent) {
  6152. result = result.concat(this.parent.titlePath());
  6153. }
  6154. if (!this.root) {
  6155. result.push(this.title);
  6156. }
  6157. return result;
  6158. };
  6159. /**
  6160. * Return the total number of tests.
  6161. *
  6162. * @memberof Suite
  6163. * @public
  6164. * @return {number}
  6165. */
  6166. Suite.prototype.total = function() {
  6167. return (
  6168. this.suites.reduce(function(sum, suite) {
  6169. return sum + suite.total();
  6170. }, 0) + this.tests.length
  6171. );
  6172. };
  6173. /**
  6174. * Iterates through each suite recursively to find all tests. Applies a
  6175. * function in the format `fn(test)`.
  6176. *
  6177. * @private
  6178. * @param {Function} fn
  6179. * @return {Suite}
  6180. */
  6181. Suite.prototype.eachTest = function(fn) {
  6182. this.tests.forEach(fn);
  6183. this.suites.forEach(function(suite) {
  6184. suite.eachTest(fn);
  6185. });
  6186. return this;
  6187. };
  6188. /**
  6189. * This will run the root suite if we happen to be running in delayed mode.
  6190. * @private
  6191. */
  6192. Suite.prototype.run = function run() {
  6193. if (this.root) {
  6194. this.emit(constants.EVENT_ROOT_SUITE_RUN);
  6195. }
  6196. };
  6197. /**
  6198. * Determines whether a suite has an `only` test or suite as a descendant.
  6199. *
  6200. * @private
  6201. * @returns {Boolean}
  6202. */
  6203. Suite.prototype.hasOnly = function hasOnly() {
  6204. return (
  6205. this._onlyTests.length > 0 ||
  6206. this._onlySuites.length > 0 ||
  6207. this.suites.some(function(suite) {
  6208. return suite.hasOnly();
  6209. })
  6210. );
  6211. };
  6212. /**
  6213. * Filter suites based on `isOnly` logic.
  6214. *
  6215. * @private
  6216. * @returns {Boolean}
  6217. */
  6218. Suite.prototype.filterOnly = function filterOnly() {
  6219. if (this._onlyTests.length) {
  6220. // If the suite contains `only` tests, run those and ignore any nested suites.
  6221. this.tests = this._onlyTests;
  6222. this.suites = [];
  6223. } else {
  6224. // Otherwise, do not run any of the tests in this suite.
  6225. this.tests = [];
  6226. this._onlySuites.forEach(function(onlySuite) {
  6227. // If there are other `only` tests/suites nested in the current `only` suite, then filter that `only` suite.
  6228. // Otherwise, all of the tests on this `only` suite should be run, so don't filter it.
  6229. if (onlySuite.hasOnly()) {
  6230. onlySuite.filterOnly();
  6231. }
  6232. });
  6233. // Run the `only` suites, as well as any other suites that have `only` tests/suites as descendants.
  6234. var onlySuites = this._onlySuites;
  6235. this.suites = this.suites.filter(function(childSuite) {
  6236. return onlySuites.indexOf(childSuite) !== -1 || childSuite.filterOnly();
  6237. });
  6238. }
  6239. // Keep the suite only if there is something to run
  6240. return this.tests.length > 0 || this.suites.length > 0;
  6241. };
  6242. /**
  6243. * Adds a suite to the list of subsuites marked `only`.
  6244. *
  6245. * @private
  6246. * @param {Suite} suite
  6247. */
  6248. Suite.prototype.appendOnlySuite = function(suite) {
  6249. this._onlySuites.push(suite);
  6250. };
  6251. /**
  6252. * Adds a test to the list of tests marked `only`.
  6253. *
  6254. * @private
  6255. * @param {Test} test
  6256. */
  6257. Suite.prototype.appendOnlyTest = function(test) {
  6258. this._onlyTests.push(test);
  6259. };
  6260. /**
  6261. * Returns the array of hooks by hook name; see `HOOK_TYPE_*` constants.
  6262. * @private
  6263. */
  6264. Suite.prototype.getHooks = function getHooks(name) {
  6265. return this['_' + name];
  6266. };
  6267. /**
  6268. * Cleans up the references to all the deferred functions
  6269. * (before/after/beforeEach/afterEach) and tests of a Suite.
  6270. * These must be deleted otherwise a memory leak can happen,
  6271. * as those functions may reference variables from closures,
  6272. * thus those variables can never be garbage collected as long
  6273. * as the deferred functions exist.
  6274. *
  6275. * @private
  6276. */
  6277. Suite.prototype.cleanReferences = function cleanReferences() {
  6278. function cleanArrReferences(arr) {
  6279. for (var i = 0; i < arr.length; i++) {
  6280. delete arr[i].fn;
  6281. }
  6282. }
  6283. if (Array.isArray(this._beforeAll)) {
  6284. cleanArrReferences(this._beforeAll);
  6285. }
  6286. if (Array.isArray(this._beforeEach)) {
  6287. cleanArrReferences(this._beforeEach);
  6288. }
  6289. if (Array.isArray(this._afterAll)) {
  6290. cleanArrReferences(this._afterAll);
  6291. }
  6292. if (Array.isArray(this._afterEach)) {
  6293. cleanArrReferences(this._afterEach);
  6294. }
  6295. for (var i = 0; i < this.tests.length; i++) {
  6296. delete this.tests[i].fn;
  6297. }
  6298. };
  6299. var constants = utils.defineConstants(
  6300. /**
  6301. * {@link Suite}-related constants.
  6302. * @public
  6303. * @memberof Suite
  6304. * @alias constants
  6305. * @readonly
  6306. * @static
  6307. * @enum {string}
  6308. */
  6309. {
  6310. /**
  6311. * Event emitted after a test file has been loaded Not emitted in browser.
  6312. */
  6313. EVENT_FILE_POST_REQUIRE: 'post-require',
  6314. /**
  6315. * Event emitted before a test file has been loaded. In browser, this is emitted once an interface has been selected.
  6316. */
  6317. EVENT_FILE_PRE_REQUIRE: 'pre-require',
  6318. /**
  6319. * Event emitted immediately after a test file has been loaded. Not emitted in browser.
  6320. */
  6321. EVENT_FILE_REQUIRE: 'require',
  6322. /**
  6323. * Event emitted when `global.run()` is called (use with `delay` option)
  6324. */
  6325. EVENT_ROOT_SUITE_RUN: 'run',
  6326. /**
  6327. * Namespace for collection of a `Suite`'s "after all" hooks
  6328. */
  6329. HOOK_TYPE_AFTER_ALL: 'afterAll',
  6330. /**
  6331. * Namespace for collection of a `Suite`'s "after each" hooks
  6332. */
  6333. HOOK_TYPE_AFTER_EACH: 'afterEach',
  6334. /**
  6335. * Namespace for collection of a `Suite`'s "before all" hooks
  6336. */
  6337. HOOK_TYPE_BEFORE_ALL: 'beforeAll',
  6338. /**
  6339. * Namespace for collection of a `Suite`'s "before all" hooks
  6340. */
  6341. HOOK_TYPE_BEFORE_EACH: 'beforeEach',
  6342. // the following events are all deprecated
  6343. /**
  6344. * Emitted after an "after all" `Hook` has been added to a `Suite`. Deprecated
  6345. */
  6346. EVENT_SUITE_ADD_HOOK_AFTER_ALL: 'afterAll',
  6347. /**
  6348. * Emitted after an "after each" `Hook` has been added to a `Suite` Deprecated
  6349. */
  6350. EVENT_SUITE_ADD_HOOK_AFTER_EACH: 'afterEach',
  6351. /**
  6352. * Emitted after an "before all" `Hook` has been added to a `Suite` Deprecated
  6353. */
  6354. EVENT_SUITE_ADD_HOOK_BEFORE_ALL: 'beforeAll',
  6355. /**
  6356. * Emitted after an "before each" `Hook` has been added to a `Suite` Deprecated
  6357. */
  6358. EVENT_SUITE_ADD_HOOK_BEFORE_EACH: 'beforeEach',
  6359. /**
  6360. * Emitted after a child `Suite` has been added to a `Suite`. Deprecated
  6361. */
  6362. EVENT_SUITE_ADD_SUITE: 'suite',
  6363. /**
  6364. * Emitted after a `Test` has been added to a `Suite`. Deprecated
  6365. */
  6366. EVENT_SUITE_ADD_TEST: 'test'
  6367. }
  6368. );
  6369. /**
  6370. * @summary There are no known use cases for these events.
  6371. * @desc This is a `Set`-like object having all keys being the constant's string value and the value being `true`.
  6372. * @todo Remove eventually
  6373. * @type {Object<string,boolean>}
  6374. * @ignore
  6375. */
  6376. var deprecatedEvents = Object.keys(constants)
  6377. .filter(function(constant) {
  6378. return constant.substring(0, 15) === 'EVENT_SUITE_ADD';
  6379. })
  6380. .reduce(function(acc, constant) {
  6381. acc[constants[constant]] = true;
  6382. return acc;
  6383. }, utils.createMap());
  6384. Suite.constants = constants;
  6385. },{"./errors":6,"./hook":7,"./utils":38,"debug":45,"events":50,"ms":60}],37:[function(require,module,exports){
  6386. 'use strict';
  6387. var Runnable = require('./runnable');
  6388. var utils = require('./utils');
  6389. var errors = require('./errors');
  6390. var createInvalidArgumentTypeError = errors.createInvalidArgumentTypeError;
  6391. var isString = utils.isString;
  6392. module.exports = Test;
  6393. /**
  6394. * Initialize a new `Test` with the given `title` and callback `fn`.
  6395. *
  6396. * @public
  6397. * @class
  6398. * @extends Runnable
  6399. * @param {String} title - Test title (required)
  6400. * @param {Function} [fn] - Test callback. If omitted, the Test is considered "pending"
  6401. */
  6402. function Test(title, fn) {
  6403. if (!isString(title)) {
  6404. throw createInvalidArgumentTypeError(
  6405. 'Test argument "title" should be a string. Received type "' +
  6406. typeof title +
  6407. '"',
  6408. 'title',
  6409. 'string'
  6410. );
  6411. }
  6412. Runnable.call(this, title, fn);
  6413. this.pending = !fn;
  6414. this.type = 'test';
  6415. }
  6416. /**
  6417. * Inherit from `Runnable.prototype`.
  6418. */
  6419. utils.inherits(Test, Runnable);
  6420. Test.prototype.clone = function() {
  6421. var test = new Test(this.title, this.fn);
  6422. test.timeout(this.timeout());
  6423. test.slow(this.slow());
  6424. test.enableTimeouts(this.enableTimeouts());
  6425. test.retries(this.retries());
  6426. test.currentRetry(this.currentRetry());
  6427. test.globals(this.globals());
  6428. test.parent = this.parent;
  6429. test.file = this.file;
  6430. test.ctx = this.ctx;
  6431. return test;
  6432. };
  6433. },{"./errors":6,"./runnable":33,"./utils":38}],38:[function(require,module,exports){
  6434. (function (process,Buffer){
  6435. 'use strict';
  6436. /**
  6437. * Various utility functions used throughout Mocha's codebase.
  6438. * @module utils
  6439. */
  6440. /**
  6441. * Module dependencies.
  6442. */
  6443. var fs = require('fs');
  6444. var path = require('path');
  6445. var util = require('util');
  6446. var glob = require('glob');
  6447. var he = require('he');
  6448. var errors = require('./errors');
  6449. var createNoFilesMatchPatternError = errors.createNoFilesMatchPatternError;
  6450. var createMissingArgumentError = errors.createMissingArgumentError;
  6451. var assign = (exports.assign = require('object.assign').getPolyfill());
  6452. /**
  6453. * Inherit the prototype methods from one constructor into another.
  6454. *
  6455. * @param {function} ctor - Constructor function which needs to inherit the
  6456. * prototype.
  6457. * @param {function} superCtor - Constructor function to inherit prototype from.
  6458. * @throws {TypeError} if either constructor is null, or if super constructor
  6459. * lacks a prototype.
  6460. */
  6461. exports.inherits = util.inherits;
  6462. /**
  6463. * Escape special characters in the given string of html.
  6464. *
  6465. * @private
  6466. * @param {string} html
  6467. * @return {string}
  6468. */
  6469. exports.escape = function(html) {
  6470. return he.encode(String(html), {useNamedReferences: false});
  6471. };
  6472. /**
  6473. * Test if the given obj is type of string.
  6474. *
  6475. * @private
  6476. * @param {Object} obj
  6477. * @return {boolean}
  6478. */
  6479. exports.isString = function(obj) {
  6480. return typeof obj === 'string';
  6481. };
  6482. /**
  6483. * Watch the given `files` for changes
  6484. * and invoke `fn(file)` on modification.
  6485. *
  6486. * @private
  6487. * @param {Array} files
  6488. * @param {Function} fn
  6489. */
  6490. exports.watch = function(files, fn) {
  6491. var options = {interval: 100};
  6492. var debug = require('debug')('mocha:watch');
  6493. files.forEach(function(file) {
  6494. debug('file %s', file);
  6495. fs.watchFile(file, options, function(curr, prev) {
  6496. if (prev.mtime < curr.mtime) {
  6497. fn(file);
  6498. }
  6499. });
  6500. });
  6501. };
  6502. /**
  6503. * Predicate to screen `pathname` for further consideration.
  6504. *
  6505. * @description
  6506. * Returns <code>false</code> for pathname referencing:
  6507. * <ul>
  6508. * <li>'npm' package installation directory
  6509. * <li>'git' version control directory
  6510. * </ul>
  6511. *
  6512. * @private
  6513. * @param {string} pathname - File or directory name to screen
  6514. * @return {boolean} whether pathname should be further considered
  6515. * @example
  6516. * ['node_modules', 'test.js'].filter(considerFurther); // => ['test.js']
  6517. */
  6518. function considerFurther(pathname) {
  6519. var ignore = ['node_modules', '.git'];
  6520. return !~ignore.indexOf(pathname);
  6521. }
  6522. /**
  6523. * Lookup files in the given `dir`.
  6524. *
  6525. * @description
  6526. * Filenames are returned in _traversal_ order by the OS/filesystem.
  6527. * **Make no assumption that the names will be sorted in any fashion.**
  6528. *
  6529. * @private
  6530. * @param {string} dir
  6531. * @param {string[]} [exts=['js']]
  6532. * @param {Array} [ret=[]]
  6533. * @return {Array}
  6534. */
  6535. exports.files = function(dir, exts, ret) {
  6536. ret = ret || [];
  6537. exts = exts || ['js'];
  6538. fs.readdirSync(dir)
  6539. .filter(considerFurther)
  6540. .forEach(function(dirent) {
  6541. var pathname = path.join(dir, dirent);
  6542. if (fs.lstatSync(pathname).isDirectory()) {
  6543. exports.files(pathname, exts, ret);
  6544. } else if (hasMatchingExtname(pathname, exts)) {
  6545. ret.push(pathname);
  6546. }
  6547. });
  6548. return ret;
  6549. };
  6550. /**
  6551. * Compute a slug from the given `str`.
  6552. *
  6553. * @private
  6554. * @param {string} str
  6555. * @return {string}
  6556. */
  6557. exports.slug = function(str) {
  6558. return str
  6559. .toLowerCase()
  6560. .replace(/ +/g, '-')
  6561. .replace(/[^-\w]/g, '');
  6562. };
  6563. /**
  6564. * Strip the function definition from `str`, and re-indent for pre whitespace.
  6565. *
  6566. * @param {string} str
  6567. * @return {string}
  6568. */
  6569. exports.clean = function(str) {
  6570. str = str
  6571. .replace(/\r\n?|[\n\u2028\u2029]/g, '\n')
  6572. .replace(/^\uFEFF/, '')
  6573. // (traditional)-> space/name parameters body (lambda)-> parameters body multi-statement/single keep body content
  6574. .replace(
  6575. /^function(?:\s*|\s+[^(]*)\([^)]*\)\s*\{((?:.|\n)*?)\s*\}$|^\([^)]*\)\s*=>\s*(?:\{((?:.|\n)*?)\s*\}|((?:.|\n)*))$/,
  6576. '$1$2$3'
  6577. );
  6578. var spaces = str.match(/^\n?( *)/)[1].length;
  6579. var tabs = str.match(/^\n?(\t*)/)[1].length;
  6580. var re = new RegExp(
  6581. '^\n?' + (tabs ? '\t' : ' ') + '{' + (tabs || spaces) + '}',
  6582. 'gm'
  6583. );
  6584. str = str.replace(re, '');
  6585. return str.trim();
  6586. };
  6587. /**
  6588. * Parse the given `qs`.
  6589. *
  6590. * @private
  6591. * @param {string} qs
  6592. * @return {Object}
  6593. */
  6594. exports.parseQuery = function(qs) {
  6595. return qs
  6596. .replace('?', '')
  6597. .split('&')
  6598. .reduce(function(obj, pair) {
  6599. var i = pair.indexOf('=');
  6600. var key = pair.slice(0, i);
  6601. var val = pair.slice(++i);
  6602. // Due to how the URLSearchParams API treats spaces
  6603. obj[key] = decodeURIComponent(val.replace(/\+/g, '%20'));
  6604. return obj;
  6605. }, {});
  6606. };
  6607. /**
  6608. * Highlight the given string of `js`.
  6609. *
  6610. * @private
  6611. * @param {string} js
  6612. * @return {string}
  6613. */
  6614. function highlight(js) {
  6615. return js
  6616. .replace(/</g, '&lt;')
  6617. .replace(/>/g, '&gt;')
  6618. .replace(/\/\/(.*)/gm, '<span class="comment">//$1</span>')
  6619. .replace(/('.*?')/gm, '<span class="string">$1</span>')
  6620. .replace(/(\d+\.\d+)/gm, '<span class="number">$1</span>')
  6621. .replace(/(\d+)/gm, '<span class="number">$1</span>')
  6622. .replace(
  6623. /\bnew[ \t]+(\w+)/gm,
  6624. '<span class="keyword">new</span> <span class="init">$1</span>'
  6625. )
  6626. .replace(
  6627. /\b(function|new|throw|return|var|if|else)\b/gm,
  6628. '<span class="keyword">$1</span>'
  6629. );
  6630. }
  6631. /**
  6632. * Highlight the contents of tag `name`.
  6633. *
  6634. * @private
  6635. * @param {string} name
  6636. */
  6637. exports.highlightTags = function(name) {
  6638. var code = document.getElementById('mocha').getElementsByTagName(name);
  6639. for (var i = 0, len = code.length; i < len; ++i) {
  6640. code[i].innerHTML = highlight(code[i].innerHTML);
  6641. }
  6642. };
  6643. /**
  6644. * If a value could have properties, and has none, this function is called,
  6645. * which returns a string representation of the empty value.
  6646. *
  6647. * Functions w/ no properties return `'[Function]'`
  6648. * Arrays w/ length === 0 return `'[]'`
  6649. * Objects w/ no properties return `'{}'`
  6650. * All else: return result of `value.toString()`
  6651. *
  6652. * @private
  6653. * @param {*} value The value to inspect.
  6654. * @param {string} typeHint The type of the value
  6655. * @returns {string}
  6656. */
  6657. function emptyRepresentation(value, typeHint) {
  6658. switch (typeHint) {
  6659. case 'function':
  6660. return '[Function]';
  6661. case 'object':
  6662. return '{}';
  6663. case 'array':
  6664. return '[]';
  6665. default:
  6666. return value.toString();
  6667. }
  6668. }
  6669. /**
  6670. * Takes some variable and asks `Object.prototype.toString()` what it thinks it
  6671. * is.
  6672. *
  6673. * @private
  6674. * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/toString
  6675. * @param {*} value The value to test.
  6676. * @returns {string} Computed type
  6677. * @example
  6678. * type({}) // 'object'
  6679. * type([]) // 'array'
  6680. * type(1) // 'number'
  6681. * type(false) // 'boolean'
  6682. * type(Infinity) // 'number'
  6683. * type(null) // 'null'
  6684. * type(new Date()) // 'date'
  6685. * type(/foo/) // 'regexp'
  6686. * type('type') // 'string'
  6687. * type(global) // 'global'
  6688. * type(new String('foo') // 'object'
  6689. */
  6690. var type = (exports.type = function type(value) {
  6691. if (value === undefined) {
  6692. return 'undefined';
  6693. } else if (value === null) {
  6694. return 'null';
  6695. } else if (Buffer.isBuffer(value)) {
  6696. return 'buffer';
  6697. }
  6698. return Object.prototype.toString
  6699. .call(value)
  6700. .replace(/^\[.+\s(.+?)]$/, '$1')
  6701. .toLowerCase();
  6702. });
  6703. /**
  6704. * Stringify `value`. Different behavior depending on type of value:
  6705. *
  6706. * - If `value` is undefined or null, return `'[undefined]'` or `'[null]'`, respectively.
  6707. * - If `value` is not an object, function or array, return result of `value.toString()` wrapped in double-quotes.
  6708. * - If `value` is an *empty* object, function, or array, return result of function
  6709. * {@link emptyRepresentation}.
  6710. * - If `value` has properties, call {@link exports.canonicalize} on it, then return result of
  6711. * JSON.stringify().
  6712. *
  6713. * @private
  6714. * @see exports.type
  6715. * @param {*} value
  6716. * @return {string}
  6717. */
  6718. exports.stringify = function(value) {
  6719. var typeHint = type(value);
  6720. if (!~['object', 'array', 'function'].indexOf(typeHint)) {
  6721. if (typeHint === 'buffer') {
  6722. var json = Buffer.prototype.toJSON.call(value);
  6723. // Based on the toJSON result
  6724. return jsonStringify(
  6725. json.data && json.type ? json.data : json,
  6726. 2
  6727. ).replace(/,(\n|$)/g, '$1');
  6728. }
  6729. // IE7/IE8 has a bizarre String constructor; needs to be coerced
  6730. // into an array and back to obj.
  6731. if (typeHint === 'string' && typeof value === 'object') {
  6732. value = value.split('').reduce(function(acc, char, idx) {
  6733. acc[idx] = char;
  6734. return acc;
  6735. }, {});
  6736. typeHint = 'object';
  6737. } else {
  6738. return jsonStringify(value);
  6739. }
  6740. }
  6741. for (var prop in value) {
  6742. if (Object.prototype.hasOwnProperty.call(value, prop)) {
  6743. return jsonStringify(
  6744. exports.canonicalize(value, null, typeHint),
  6745. 2
  6746. ).replace(/,(\n|$)/g, '$1');
  6747. }
  6748. }
  6749. return emptyRepresentation(value, typeHint);
  6750. };
  6751. /**
  6752. * like JSON.stringify but more sense.
  6753. *
  6754. * @private
  6755. * @param {Object} object
  6756. * @param {number=} spaces
  6757. * @param {number=} depth
  6758. * @returns {*}
  6759. */
  6760. function jsonStringify(object, spaces, depth) {
  6761. if (typeof spaces === 'undefined') {
  6762. // primitive types
  6763. return _stringify(object);
  6764. }
  6765. depth = depth || 1;
  6766. var space = spaces * depth;
  6767. var str = Array.isArray(object) ? '[' : '{';
  6768. var end = Array.isArray(object) ? ']' : '}';
  6769. var length =
  6770. typeof object.length === 'number'
  6771. ? object.length
  6772. : Object.keys(object).length;
  6773. // `.repeat()` polyfill
  6774. function repeat(s, n) {
  6775. return new Array(n).join(s);
  6776. }
  6777. function _stringify(val) {
  6778. switch (type(val)) {
  6779. case 'null':
  6780. case 'undefined':
  6781. val = '[' + val + ']';
  6782. break;
  6783. case 'array':
  6784. case 'object':
  6785. val = jsonStringify(val, spaces, depth + 1);
  6786. break;
  6787. case 'boolean':
  6788. case 'regexp':
  6789. case 'symbol':
  6790. case 'number':
  6791. val =
  6792. val === 0 && 1 / val === -Infinity // `-0`
  6793. ? '-0'
  6794. : val.toString();
  6795. break;
  6796. case 'date':
  6797. var sDate = isNaN(val.getTime()) ? val.toString() : val.toISOString();
  6798. val = '[Date: ' + sDate + ']';
  6799. break;
  6800. case 'buffer':
  6801. var json = val.toJSON();
  6802. // Based on the toJSON result
  6803. json = json.data && json.type ? json.data : json;
  6804. val = '[Buffer: ' + jsonStringify(json, 2, depth + 1) + ']';
  6805. break;
  6806. default:
  6807. val =
  6808. val === '[Function]' || val === '[Circular]'
  6809. ? val
  6810. : JSON.stringify(val); // string
  6811. }
  6812. return val;
  6813. }
  6814. for (var i in object) {
  6815. if (!Object.prototype.hasOwnProperty.call(object, i)) {
  6816. continue; // not my business
  6817. }
  6818. --length;
  6819. str +=
  6820. '\n ' +
  6821. repeat(' ', space) +
  6822. (Array.isArray(object) ? '' : '"' + i + '": ') + // key
  6823. _stringify(object[i]) + // value
  6824. (length ? ',' : ''); // comma
  6825. }
  6826. return (
  6827. str +
  6828. // [], {}
  6829. (str.length !== 1 ? '\n' + repeat(' ', --space) + end : end)
  6830. );
  6831. }
  6832. /**
  6833. * Return a new Thing that has the keys in sorted order. Recursive.
  6834. *
  6835. * If the Thing...
  6836. * - has already been seen, return string `'[Circular]'`
  6837. * - is `undefined`, return string `'[undefined]'`
  6838. * - is `null`, return value `null`
  6839. * - is some other primitive, return the value
  6840. * - is not a primitive or an `Array`, `Object`, or `Function`, return the value of the Thing's `toString()` method
  6841. * - is a non-empty `Array`, `Object`, or `Function`, return the result of calling this function again.
  6842. * - is an empty `Array`, `Object`, or `Function`, return the result of calling `emptyRepresentation()`
  6843. *
  6844. * @private
  6845. * @see {@link exports.stringify}
  6846. * @param {*} value Thing to inspect. May or may not have properties.
  6847. * @param {Array} [stack=[]] Stack of seen values
  6848. * @param {string} [typeHint] Type hint
  6849. * @return {(Object|Array|Function|string|undefined)}
  6850. */
  6851. exports.canonicalize = function canonicalize(value, stack, typeHint) {
  6852. var canonicalizedObj;
  6853. /* eslint-disable no-unused-vars */
  6854. var prop;
  6855. /* eslint-enable no-unused-vars */
  6856. typeHint = typeHint || type(value);
  6857. function withStack(value, fn) {
  6858. stack.push(value);
  6859. fn();
  6860. stack.pop();
  6861. }
  6862. stack = stack || [];
  6863. if (stack.indexOf(value) !== -1) {
  6864. return '[Circular]';
  6865. }
  6866. switch (typeHint) {
  6867. case 'undefined':
  6868. case 'buffer':
  6869. case 'null':
  6870. canonicalizedObj = value;
  6871. break;
  6872. case 'array':
  6873. withStack(value, function() {
  6874. canonicalizedObj = value.map(function(item) {
  6875. return exports.canonicalize(item, stack);
  6876. });
  6877. });
  6878. break;
  6879. case 'function':
  6880. /* eslint-disable guard-for-in */
  6881. for (prop in value) {
  6882. canonicalizedObj = {};
  6883. break;
  6884. }
  6885. /* eslint-enable guard-for-in */
  6886. if (!canonicalizedObj) {
  6887. canonicalizedObj = emptyRepresentation(value, typeHint);
  6888. break;
  6889. }
  6890. /* falls through */
  6891. case 'object':
  6892. canonicalizedObj = canonicalizedObj || {};
  6893. withStack(value, function() {
  6894. Object.keys(value)
  6895. .sort()
  6896. .forEach(function(key) {
  6897. canonicalizedObj[key] = exports.canonicalize(value[key], stack);
  6898. });
  6899. });
  6900. break;
  6901. case 'date':
  6902. case 'number':
  6903. case 'regexp':
  6904. case 'boolean':
  6905. case 'symbol':
  6906. canonicalizedObj = value;
  6907. break;
  6908. default:
  6909. canonicalizedObj = value + '';
  6910. }
  6911. return canonicalizedObj;
  6912. };
  6913. /**
  6914. * Determines if pathname has a matching file extension.
  6915. *
  6916. * @private
  6917. * @param {string} pathname - Pathname to check for match.
  6918. * @param {string[]} exts - List of file extensions (sans period).
  6919. * @return {boolean} whether file extension matches.
  6920. * @example
  6921. * hasMatchingExtname('foo.html', ['js', 'css']); // => false
  6922. */
  6923. function hasMatchingExtname(pathname, exts) {
  6924. var suffix = path.extname(pathname).slice(1);
  6925. return exts.some(function(element) {
  6926. return suffix === element;
  6927. });
  6928. }
  6929. /**
  6930. * Determines if pathname would be a "hidden" file (or directory) on UN*X.
  6931. *
  6932. * @description
  6933. * On UN*X, pathnames beginning with a full stop (aka dot) are hidden during
  6934. * typical usage. Dotfiles, plain-text configuration files, are prime examples.
  6935. *
  6936. * @see {@link http://xahlee.info/UnixResource_dir/writ/unix_origin_of_dot_filename.html|Origin of Dot File Names}
  6937. *
  6938. * @private
  6939. * @param {string} pathname - Pathname to check for match.
  6940. * @return {boolean} whether pathname would be considered a hidden file.
  6941. * @example
  6942. * isHiddenOnUnix('.profile'); // => true
  6943. */
  6944. function isHiddenOnUnix(pathname) {
  6945. return path.basename(pathname)[0] === '.';
  6946. }
  6947. /**
  6948. * Lookup file names at the given `path`.
  6949. *
  6950. * @description
  6951. * Filenames are returned in _traversal_ order by the OS/filesystem.
  6952. * **Make no assumption that the names will be sorted in any fashion.**
  6953. *
  6954. * @public
  6955. * @memberof Mocha.utils
  6956. * @todo Fix extension handling
  6957. * @param {string} filepath - Base path to start searching from.
  6958. * @param {string[]} extensions - File extensions to look for.
  6959. * @param {boolean} recursive - Whether to recurse into subdirectories.
  6960. * @return {string[]} An array of paths.
  6961. * @throws {Error} if no files match pattern.
  6962. * @throws {TypeError} if `filepath` is directory and `extensions` not provided.
  6963. */
  6964. exports.lookupFiles = function lookupFiles(filepath, extensions, recursive) {
  6965. var files = [];
  6966. var stat;
  6967. if (!fs.existsSync(filepath)) {
  6968. if (fs.existsSync(filepath + '.js')) {
  6969. filepath += '.js';
  6970. } else {
  6971. // Handle glob
  6972. files = glob.sync(filepath);
  6973. if (!files.length) {
  6974. throw createNoFilesMatchPatternError(
  6975. 'Cannot find any files matching pattern ' + exports.dQuote(filepath),
  6976. filepath
  6977. );
  6978. }
  6979. return files;
  6980. }
  6981. }
  6982. // Handle file
  6983. try {
  6984. stat = fs.statSync(filepath);
  6985. if (stat.isFile()) {
  6986. return filepath;
  6987. }
  6988. } catch (err) {
  6989. // ignore error
  6990. return;
  6991. }
  6992. // Handle directory
  6993. fs.readdirSync(filepath).forEach(function(dirent) {
  6994. var pathname = path.join(filepath, dirent);
  6995. var stat;
  6996. try {
  6997. stat = fs.statSync(pathname);
  6998. if (stat.isDirectory()) {
  6999. if (recursive) {
  7000. files = files.concat(lookupFiles(pathname, extensions, recursive));
  7001. }
  7002. return;
  7003. }
  7004. } catch (err) {
  7005. // ignore error
  7006. return;
  7007. }
  7008. if (!extensions) {
  7009. throw createMissingArgumentError(
  7010. util.format(
  7011. 'Argument %s required when argument %s is a directory',
  7012. exports.sQuote('extensions'),
  7013. exports.sQuote('filepath')
  7014. ),
  7015. 'extensions',
  7016. 'array'
  7017. );
  7018. }
  7019. if (
  7020. !stat.isFile() ||
  7021. !hasMatchingExtname(pathname, extensions) ||
  7022. isHiddenOnUnix(pathname)
  7023. ) {
  7024. return;
  7025. }
  7026. files.push(pathname);
  7027. });
  7028. return files;
  7029. };
  7030. /**
  7031. * process.emitWarning or a polyfill
  7032. * @see https://nodejs.org/api/process.html#process_process_emitwarning_warning_options
  7033. * @ignore
  7034. */
  7035. function emitWarning(msg, type) {
  7036. if (process.emitWarning) {
  7037. process.emitWarning(msg, type);
  7038. } else {
  7039. process.nextTick(function() {
  7040. console.warn(type + ': ' + msg);
  7041. });
  7042. }
  7043. }
  7044. /**
  7045. * Show a deprecation warning. Each distinct message is only displayed once.
  7046. * Ignores empty messages.
  7047. *
  7048. * @param {string} [msg] - Warning to print
  7049. * @private
  7050. */
  7051. exports.deprecate = function deprecate(msg) {
  7052. msg = String(msg);
  7053. if (msg && !deprecate.cache[msg]) {
  7054. deprecate.cache[msg] = true;
  7055. emitWarning(msg, 'DeprecationWarning');
  7056. }
  7057. };
  7058. exports.deprecate.cache = {};
  7059. /**
  7060. * Show a generic warning.
  7061. * Ignores empty messages.
  7062. *
  7063. * @param {string} [msg] - Warning to print
  7064. * @private
  7065. */
  7066. exports.warn = function warn(msg) {
  7067. if (msg) {
  7068. emitWarning(msg);
  7069. }
  7070. };
  7071. /**
  7072. * @summary
  7073. * This Filter based on `mocha-clean` module.(see: `github.com/rstacruz/mocha-clean`)
  7074. * @description
  7075. * When invoking this function you get a filter function that get the Error.stack as an input,
  7076. * and return a prettify output.
  7077. * (i.e: strip Mocha and internal node functions from stack trace).
  7078. * @returns {Function}
  7079. */
  7080. exports.stackTraceFilter = function() {
  7081. // TODO: Replace with `process.browser`
  7082. var is = typeof document === 'undefined' ? {node: true} : {browser: true};
  7083. var slash = path.sep;
  7084. var cwd;
  7085. if (is.node) {
  7086. cwd = process.cwd() + slash;
  7087. } else {
  7088. cwd = (typeof location === 'undefined'
  7089. ? window.location
  7090. : location
  7091. ).href.replace(/\/[^/]*$/, '/');
  7092. slash = '/';
  7093. }
  7094. function isMochaInternal(line) {
  7095. return (
  7096. ~line.indexOf('node_modules' + slash + 'mocha' + slash) ||
  7097. ~line.indexOf(slash + 'mocha.js')
  7098. );
  7099. }
  7100. function isNodeInternal(line) {
  7101. return (
  7102. ~line.indexOf('(timers.js:') ||
  7103. ~line.indexOf('(events.js:') ||
  7104. ~line.indexOf('(node.js:') ||
  7105. ~line.indexOf('(module.js:') ||
  7106. ~line.indexOf('GeneratorFunctionPrototype.next (native)') ||
  7107. false
  7108. );
  7109. }
  7110. return function(stack) {
  7111. stack = stack.split('\n');
  7112. stack = stack.reduce(function(list, line) {
  7113. if (isMochaInternal(line)) {
  7114. return list;
  7115. }
  7116. if (is.node && isNodeInternal(line)) {
  7117. return list;
  7118. }
  7119. // Clean up cwd(absolute)
  7120. if (/:\d+:\d+\)?$/.test(line)) {
  7121. line = line.replace('(' + cwd, '(');
  7122. }
  7123. list.push(line);
  7124. return list;
  7125. }, []);
  7126. return stack.join('\n');
  7127. };
  7128. };
  7129. /**
  7130. * Crude, but effective.
  7131. * @public
  7132. * @param {*} value
  7133. * @returns {boolean} Whether or not `value` is a Promise
  7134. */
  7135. exports.isPromise = function isPromise(value) {
  7136. return (
  7137. typeof value === 'object' &&
  7138. value !== null &&
  7139. typeof value.then === 'function'
  7140. );
  7141. };
  7142. /**
  7143. * Clamps a numeric value to an inclusive range.
  7144. *
  7145. * @param {number} value - Value to be clamped.
  7146. * @param {numer[]} range - Two element array specifying [min, max] range.
  7147. * @returns {number} clamped value
  7148. */
  7149. exports.clamp = function clamp(value, range) {
  7150. return Math.min(Math.max(value, range[0]), range[1]);
  7151. };
  7152. /**
  7153. * Single quote text by combining with undirectional ASCII quotation marks.
  7154. *
  7155. * @description
  7156. * Provides a simple means of markup for quoting text to be used in output.
  7157. * Use this to quote names of variables, methods, and packages.
  7158. *
  7159. * <samp>package 'foo' cannot be found</samp>
  7160. *
  7161. * @private
  7162. * @param {string} str - Value to be quoted.
  7163. * @returns {string} quoted value
  7164. * @example
  7165. * sQuote('n') // => 'n'
  7166. */
  7167. exports.sQuote = function(str) {
  7168. return "'" + str + "'";
  7169. };
  7170. /**
  7171. * Double quote text by combining with undirectional ASCII quotation marks.
  7172. *
  7173. * @description
  7174. * Provides a simple means of markup for quoting text to be used in output.
  7175. * Use this to quote names of datatypes, classes, pathnames, and strings.
  7176. *
  7177. * <samp>argument 'value' must be "string" or "number"</samp>
  7178. *
  7179. * @private
  7180. * @param {string} str - Value to be quoted.
  7181. * @returns {string} quoted value
  7182. * @example
  7183. * dQuote('number') // => "number"
  7184. */
  7185. exports.dQuote = function(str) {
  7186. return '"' + str + '"';
  7187. };
  7188. /**
  7189. * Provides simplistic message translation for dealing with plurality.
  7190. *
  7191. * @description
  7192. * Use this to create messages which need to be singular or plural.
  7193. * Some languages have several plural forms, so _complete_ message clauses
  7194. * are preferable to generating the message on the fly.
  7195. *
  7196. * @private
  7197. * @param {number} n - Non-negative integer
  7198. * @param {string} msg1 - Message to be used in English for `n = 1`
  7199. * @param {string} msg2 - Message to be used in English for `n = 0, 2, 3, ...`
  7200. * @returns {string} message corresponding to value of `n`
  7201. * @example
  7202. * var sprintf = require('util').format;
  7203. * var pkgs = ['one', 'two'];
  7204. * var msg = sprintf(
  7205. * ngettext(
  7206. * pkgs.length,
  7207. * 'cannot load package: %s',
  7208. * 'cannot load packages: %s'
  7209. * ),
  7210. * pkgs.map(sQuote).join(', ')
  7211. * );
  7212. * console.log(msg); // => cannot load packages: 'one', 'two'
  7213. */
  7214. exports.ngettext = function(n, msg1, msg2) {
  7215. if (typeof n === 'number' && n >= 0) {
  7216. return n === 1 ? msg1 : msg2;
  7217. }
  7218. };
  7219. /**
  7220. * It's a noop.
  7221. * @public
  7222. */
  7223. exports.noop = function() {};
  7224. /**
  7225. * Creates a map-like object.
  7226. *
  7227. * @description
  7228. * A "map" is an object with no prototype, for our purposes. In some cases
  7229. * this would be more appropriate than a `Map`, especially if your environment
  7230. * doesn't support it. Recommended for use in Mocha's public APIs.
  7231. *
  7232. * @public
  7233. * @see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map|MDN:Map}
  7234. * @see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/create#Custom_and_Null_objects|MDN:Object.create - Custom objects}
  7235. * @see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign|MDN:Object.assign}
  7236. * @param {...*} [obj] - Arguments to `Object.assign()`.
  7237. * @returns {Object} An object with no prototype, having `...obj` properties
  7238. */
  7239. exports.createMap = function(obj) {
  7240. return assign.apply(
  7241. null,
  7242. [Object.create(null)].concat(Array.prototype.slice.call(arguments))
  7243. );
  7244. };
  7245. /**
  7246. * Creates a read-only map-like object.
  7247. *
  7248. * @description
  7249. * This differs from {@link module:utils.createMap createMap} only in that
  7250. * the argument must be non-empty, because the result is frozen.
  7251. *
  7252. * @see {@link module:utils.createMap createMap}
  7253. * @param {...*} [obj] - Arguments to `Object.assign()`.
  7254. * @returns {Object} A frozen object with no prototype, having `...obj` properties
  7255. * @throws {TypeError} if argument is not a non-empty object.
  7256. */
  7257. exports.defineConstants = function(obj) {
  7258. if (type(obj) !== 'object' || !Object.keys(obj).length) {
  7259. throw new TypeError('Invalid argument; expected a non-empty object');
  7260. }
  7261. return Object.freeze(exports.createMap(obj));
  7262. };
  7263. }).call(this,require('_process'),require("buffer").Buffer)
  7264. },{"./errors":6,"_process":68,"buffer":43,"debug":45,"fs":42,"glob":42,"he":54,"object.assign":64,"path":42,"util":88}],39:[function(require,module,exports){
  7265. 'use strict'
  7266. exports.byteLength = byteLength
  7267. exports.toByteArray = toByteArray
  7268. exports.fromByteArray = fromByteArray
  7269. var lookup = []
  7270. var revLookup = []
  7271. var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array
  7272. var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
  7273. for (var i = 0, len = code.length; i < len; ++i) {
  7274. lookup[i] = code[i]
  7275. revLookup[code.charCodeAt(i)] = i
  7276. }
  7277. // Support decoding URL-safe base64 strings, as Node.js does.
  7278. // See: https://en.wikipedia.org/wiki/Base64#URL_applications
  7279. revLookup['-'.charCodeAt(0)] = 62
  7280. revLookup['_'.charCodeAt(0)] = 63
  7281. function getLens (b64) {
  7282. var len = b64.length
  7283. if (len % 4 > 0) {
  7284. throw new Error('Invalid string. Length must be a multiple of 4')
  7285. }
  7286. // Trim off extra bytes after placeholder bytes are found
  7287. // See: https://github.com/beatgammit/base64-js/issues/42
  7288. var validLen = b64.indexOf('=')
  7289. if (validLen === -1) validLen = len
  7290. var placeHoldersLen = validLen === len
  7291. ? 0
  7292. : 4 - (validLen % 4)
  7293. return [validLen, placeHoldersLen]
  7294. }
  7295. // base64 is 4/3 + up to two characters of the original data
  7296. function byteLength (b64) {
  7297. var lens = getLens(b64)
  7298. var validLen = lens[0]
  7299. var placeHoldersLen = lens[1]
  7300. return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
  7301. }
  7302. function _byteLength (b64, validLen, placeHoldersLen) {
  7303. return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
  7304. }
  7305. function toByteArray (b64) {
  7306. var tmp
  7307. var lens = getLens(b64)
  7308. var validLen = lens[0]
  7309. var placeHoldersLen = lens[1]
  7310. var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen))
  7311. var curByte = 0
  7312. // if there are placeholders, only get up to the last complete 4 chars
  7313. var len = placeHoldersLen > 0
  7314. ? validLen - 4
  7315. : validLen
  7316. for (var i = 0; i < len; i += 4) {
  7317. tmp =
  7318. (revLookup[b64.charCodeAt(i)] << 18) |
  7319. (revLookup[b64.charCodeAt(i + 1)] << 12) |
  7320. (revLookup[b64.charCodeAt(i + 2)] << 6) |
  7321. revLookup[b64.charCodeAt(i + 3)]
  7322. arr[curByte++] = (tmp >> 16) & 0xFF
  7323. arr[curByte++] = (tmp >> 8) & 0xFF
  7324. arr[curByte++] = tmp & 0xFF
  7325. }
  7326. if (placeHoldersLen === 2) {
  7327. tmp =
  7328. (revLookup[b64.charCodeAt(i)] << 2) |
  7329. (revLookup[b64.charCodeAt(i + 1)] >> 4)
  7330. arr[curByte++] = tmp & 0xFF
  7331. }
  7332. if (placeHoldersLen === 1) {
  7333. tmp =
  7334. (revLookup[b64.charCodeAt(i)] << 10) |
  7335. (revLookup[b64.charCodeAt(i + 1)] << 4) |
  7336. (revLookup[b64.charCodeAt(i + 2)] >> 2)
  7337. arr[curByte++] = (tmp >> 8) & 0xFF
  7338. arr[curByte++] = tmp & 0xFF
  7339. }
  7340. return arr
  7341. }
  7342. function tripletToBase64 (num) {
  7343. return lookup[num >> 18 & 0x3F] +
  7344. lookup[num >> 12 & 0x3F] +
  7345. lookup[num >> 6 & 0x3F] +
  7346. lookup[num & 0x3F]
  7347. }
  7348. function encodeChunk (uint8, start, end) {
  7349. var tmp
  7350. var output = []
  7351. for (var i = start; i < end; i += 3) {
  7352. tmp =
  7353. ((uint8[i] << 16) & 0xFF0000) +
  7354. ((uint8[i + 1] << 8) & 0xFF00) +
  7355. (uint8[i + 2] & 0xFF)
  7356. output.push(tripletToBase64(tmp))
  7357. }
  7358. return output.join('')
  7359. }
  7360. function fromByteArray (uint8) {
  7361. var tmp
  7362. var len = uint8.length
  7363. var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes
  7364. var parts = []
  7365. var maxChunkLength = 16383 // must be multiple of 3
  7366. // go through the array every three bytes, we'll deal with trailing stuff later
  7367. for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {
  7368. parts.push(encodeChunk(
  7369. uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)
  7370. ))
  7371. }
  7372. // pad the end with zeros, but make sure to not forget the extra bytes
  7373. if (extraBytes === 1) {
  7374. tmp = uint8[len - 1]
  7375. parts.push(
  7376. lookup[tmp >> 2] +
  7377. lookup[(tmp << 4) & 0x3F] +
  7378. '=='
  7379. )
  7380. } else if (extraBytes === 2) {
  7381. tmp = (uint8[len - 2] << 8) + uint8[len - 1]
  7382. parts.push(
  7383. lookup[tmp >> 10] +
  7384. lookup[(tmp >> 4) & 0x3F] +
  7385. lookup[(tmp << 2) & 0x3F] +
  7386. '='
  7387. )
  7388. }
  7389. return parts.join('')
  7390. }
  7391. },{}],40:[function(require,module,exports){
  7392. },{}],41:[function(require,module,exports){
  7393. (function (process){
  7394. var WritableStream = require('stream').Writable
  7395. var inherits = require('util').inherits
  7396. module.exports = BrowserStdout
  7397. inherits(BrowserStdout, WritableStream)
  7398. function BrowserStdout(opts) {
  7399. if (!(this instanceof BrowserStdout)) return new BrowserStdout(opts)
  7400. opts = opts || {}
  7401. WritableStream.call(this, opts)
  7402. this.label = (opts.label !== undefined) ? opts.label : 'stdout'
  7403. }
  7404. BrowserStdout.prototype._write = function(chunks, encoding, cb) {
  7405. var output = chunks.toString ? chunks.toString() : chunks
  7406. if (this.label === false) {
  7407. console.log(output)
  7408. } else {
  7409. console.log(this.label+':', output)
  7410. }
  7411. process.nextTick(cb)
  7412. }
  7413. }).call(this,require('_process'))
  7414. },{"_process":68,"stream":83,"util":88}],42:[function(require,module,exports){
  7415. arguments[4][40][0].apply(exports,arguments)
  7416. },{"dup":40}],43:[function(require,module,exports){
  7417. /*!
  7418. * The buffer module from node.js, for the browser.
  7419. *
  7420. * @author Feross Aboukhadijeh <https://feross.org>
  7421. * @license MIT
  7422. */
  7423. /* eslint-disable no-proto */
  7424. 'use strict'
  7425. var base64 = require('base64-js')
  7426. var ieee754 = require('ieee754')
  7427. exports.Buffer = Buffer
  7428. exports.SlowBuffer = SlowBuffer
  7429. exports.INSPECT_MAX_BYTES = 50
  7430. var K_MAX_LENGTH = 0x7fffffff
  7431. exports.kMaxLength = K_MAX_LENGTH
  7432. /**
  7433. * If `Buffer.TYPED_ARRAY_SUPPORT`:
  7434. * === true Use Uint8Array implementation (fastest)
  7435. * === false Print warning and recommend using `buffer` v4.x which has an Object
  7436. * implementation (most compatible, even IE6)
  7437. *
  7438. * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,
  7439. * Opera 11.6+, iOS 4.2+.
  7440. *
  7441. * We report that the browser does not support typed arrays if the are not subclassable
  7442. * using __proto__. Firefox 4-29 lacks support for adding new properties to `Uint8Array`
  7443. * (See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438). IE 10 lacks support
  7444. * for __proto__ and has a buggy typed array implementation.
  7445. */
  7446. Buffer.TYPED_ARRAY_SUPPORT = typedArraySupport()
  7447. if (!Buffer.TYPED_ARRAY_SUPPORT && typeof console !== 'undefined' &&
  7448. typeof console.error === 'function') {
  7449. console.error(
  7450. 'This browser lacks typed array (Uint8Array) support which is required by ' +
  7451. '`buffer` v5.x. Use `buffer` v4.x if you require old browser support.'
  7452. )
  7453. }
  7454. function typedArraySupport () {
  7455. // Can typed array instances can be augmented?
  7456. try {
  7457. var arr = new Uint8Array(1)
  7458. arr.__proto__ = {__proto__: Uint8Array.prototype, foo: function () { return 42 }}
  7459. return arr.foo() === 42
  7460. } catch (e) {
  7461. return false
  7462. }
  7463. }
  7464. Object.defineProperty(Buffer.prototype, 'parent', {
  7465. get: function () {
  7466. if (!(this instanceof Buffer)) {
  7467. return undefined
  7468. }
  7469. return this.buffer
  7470. }
  7471. })
  7472. Object.defineProperty(Buffer.prototype, 'offset', {
  7473. get: function () {
  7474. if (!(this instanceof Buffer)) {
  7475. return undefined
  7476. }
  7477. return this.byteOffset
  7478. }
  7479. })
  7480. function createBuffer (length) {
  7481. if (length > K_MAX_LENGTH) {
  7482. throw new RangeError('Invalid typed array length')
  7483. }
  7484. // Return an augmented `Uint8Array` instance
  7485. var buf = new Uint8Array(length)
  7486. buf.__proto__ = Buffer.prototype
  7487. return buf
  7488. }
  7489. /**
  7490. * The Buffer constructor returns instances of `Uint8Array` that have their
  7491. * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of
  7492. * `Uint8Array`, so the returned instances will have all the node `Buffer` methods
  7493. * and the `Uint8Array` methods. Square bracket notation works as expected -- it
  7494. * returns a single octet.
  7495. *
  7496. * The `Uint8Array` prototype remains unmodified.
  7497. */
  7498. function Buffer (arg, encodingOrOffset, length) {
  7499. // Common case.
  7500. if (typeof arg === 'number') {
  7501. if (typeof encodingOrOffset === 'string') {
  7502. throw new Error(
  7503. 'If encoding is specified then the first argument must be a string'
  7504. )
  7505. }
  7506. return allocUnsafe(arg)
  7507. }
  7508. return from(arg, encodingOrOffset, length)
  7509. }
  7510. // Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97
  7511. if (typeof Symbol !== 'undefined' && Symbol.species &&
  7512. Buffer[Symbol.species] === Buffer) {
  7513. Object.defineProperty(Buffer, Symbol.species, {
  7514. value: null,
  7515. configurable: true,
  7516. enumerable: false,
  7517. writable: false
  7518. })
  7519. }
  7520. Buffer.poolSize = 8192 // not used by this implementation
  7521. function from (value, encodingOrOffset, length) {
  7522. if (typeof value === 'number') {
  7523. throw new TypeError('"value" argument must not be a number')
  7524. }
  7525. if (isArrayBuffer(value) || (value && isArrayBuffer(value.buffer))) {
  7526. return fromArrayBuffer(value, encodingOrOffset, length)
  7527. }
  7528. if (typeof value === 'string') {
  7529. return fromString(value, encodingOrOffset)
  7530. }
  7531. return fromObject(value)
  7532. }
  7533. /**
  7534. * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError
  7535. * if value is a number.
  7536. * Buffer.from(str[, encoding])
  7537. * Buffer.from(array)
  7538. * Buffer.from(buffer)
  7539. * Buffer.from(arrayBuffer[, byteOffset[, length]])
  7540. **/
  7541. Buffer.from = function (value, encodingOrOffset, length) {
  7542. return from(value, encodingOrOffset, length)
  7543. }
  7544. // Note: Change prototype *after* Buffer.from is defined to workaround Chrome bug:
  7545. // https://github.com/feross/buffer/pull/148
  7546. Buffer.prototype.__proto__ = Uint8Array.prototype
  7547. Buffer.__proto__ = Uint8Array
  7548. function assertSize (size) {
  7549. if (typeof size !== 'number') {
  7550. throw new TypeError('"size" argument must be of type number')
  7551. } else if (size < 0) {
  7552. throw new RangeError('"size" argument must not be negative')
  7553. }
  7554. }
  7555. function alloc (size, fill, encoding) {
  7556. assertSize(size)
  7557. if (size <= 0) {
  7558. return createBuffer(size)
  7559. }
  7560. if (fill !== undefined) {
  7561. // Only pay attention to encoding if it's a string. This
  7562. // prevents accidentally sending in a number that would
  7563. // be interpretted as a start offset.
  7564. return typeof encoding === 'string'
  7565. ? createBuffer(size).fill(fill, encoding)
  7566. : createBuffer(size).fill(fill)
  7567. }
  7568. return createBuffer(size)
  7569. }
  7570. /**
  7571. * Creates a new filled Buffer instance.
  7572. * alloc(size[, fill[, encoding]])
  7573. **/
  7574. Buffer.alloc = function (size, fill, encoding) {
  7575. return alloc(size, fill, encoding)
  7576. }
  7577. function allocUnsafe (size) {
  7578. assertSize(size)
  7579. return createBuffer(size < 0 ? 0 : checked(size) | 0)
  7580. }
  7581. /**
  7582. * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.
  7583. * */
  7584. Buffer.allocUnsafe = function (size) {
  7585. return allocUnsafe(size)
  7586. }
  7587. /**
  7588. * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
  7589. */
  7590. Buffer.allocUnsafeSlow = function (size) {
  7591. return allocUnsafe(size)
  7592. }
  7593. function fromString (string, encoding) {
  7594. if (typeof encoding !== 'string' || encoding === '') {
  7595. encoding = 'utf8'
  7596. }
  7597. if (!Buffer.isEncoding(encoding)) {
  7598. throw new TypeError('Unknown encoding: ' + encoding)
  7599. }
  7600. var length = byteLength(string, encoding) | 0
  7601. var buf = createBuffer(length)
  7602. var actual = buf.write(string, encoding)
  7603. if (actual !== length) {
  7604. // Writing a hex string, for example, that contains invalid characters will
  7605. // cause everything after the first invalid character to be ignored. (e.g.
  7606. // 'abxxcd' will be treated as 'ab')
  7607. buf = buf.slice(0, actual)
  7608. }
  7609. return buf
  7610. }
  7611. function fromArrayLike (array) {
  7612. var length = array.length < 0 ? 0 : checked(array.length) | 0
  7613. var buf = createBuffer(length)
  7614. for (var i = 0; i < length; i += 1) {
  7615. buf[i] = array[i] & 255
  7616. }
  7617. return buf
  7618. }
  7619. function fromArrayBuffer (array, byteOffset, length) {
  7620. if (byteOffset < 0 || array.byteLength < byteOffset) {
  7621. throw new RangeError('"offset" is outside of buffer bounds')
  7622. }
  7623. if (array.byteLength < byteOffset + (length || 0)) {
  7624. throw new RangeError('"length" is outside of buffer bounds')
  7625. }
  7626. var buf
  7627. if (byteOffset === undefined && length === undefined) {
  7628. buf = new Uint8Array(array)
  7629. } else if (length === undefined) {
  7630. buf = new Uint8Array(array, byteOffset)
  7631. } else {
  7632. buf = new Uint8Array(array, byteOffset, length)
  7633. }
  7634. // Return an augmented `Uint8Array` instance
  7635. buf.__proto__ = Buffer.prototype
  7636. return buf
  7637. }
  7638. function fromObject (obj) {
  7639. if (Buffer.isBuffer(obj)) {
  7640. var len = checked(obj.length) | 0
  7641. var buf = createBuffer(len)
  7642. if (buf.length === 0) {
  7643. return buf
  7644. }
  7645. obj.copy(buf, 0, 0, len)
  7646. return buf
  7647. }
  7648. if (obj) {
  7649. if (ArrayBuffer.isView(obj) || 'length' in obj) {
  7650. if (typeof obj.length !== 'number' || numberIsNaN(obj.length)) {
  7651. return createBuffer(0)
  7652. }
  7653. return fromArrayLike(obj)
  7654. }
  7655. if (obj.type === 'Buffer' && Array.isArray(obj.data)) {
  7656. return fromArrayLike(obj.data)
  7657. }
  7658. }
  7659. throw new TypeError('The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object.')
  7660. }
  7661. function checked (length) {
  7662. // Note: cannot use `length < K_MAX_LENGTH` here because that fails when
  7663. // length is NaN (which is otherwise coerced to zero.)
  7664. if (length >= K_MAX_LENGTH) {
  7665. throw new RangeError('Attempt to allocate Buffer larger than maximum ' +
  7666. 'size: 0x' + K_MAX_LENGTH.toString(16) + ' bytes')
  7667. }
  7668. return length | 0
  7669. }
  7670. function SlowBuffer (length) {
  7671. if (+length != length) { // eslint-disable-line eqeqeq
  7672. length = 0
  7673. }
  7674. return Buffer.alloc(+length)
  7675. }
  7676. Buffer.isBuffer = function isBuffer (b) {
  7677. return b != null && b._isBuffer === true
  7678. }
  7679. Buffer.compare = function compare (a, b) {
  7680. if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {
  7681. throw new TypeError('Arguments must be Buffers')
  7682. }
  7683. if (a === b) return 0
  7684. var x = a.length
  7685. var y = b.length
  7686. for (var i = 0, len = Math.min(x, y); i < len; ++i) {
  7687. if (a[i] !== b[i]) {
  7688. x = a[i]
  7689. y = b[i]
  7690. break
  7691. }
  7692. }
  7693. if (x < y) return -1
  7694. if (y < x) return 1
  7695. return 0
  7696. }
  7697. Buffer.isEncoding = function isEncoding (encoding) {
  7698. switch (String(encoding).toLowerCase()) {
  7699. case 'hex':
  7700. case 'utf8':
  7701. case 'utf-8':
  7702. case 'ascii':
  7703. case 'latin1':
  7704. case 'binary':
  7705. case 'base64':
  7706. case 'ucs2':
  7707. case 'ucs-2':
  7708. case 'utf16le':
  7709. case 'utf-16le':
  7710. return true
  7711. default:
  7712. return false
  7713. }
  7714. }
  7715. Buffer.concat = function concat (list, length) {
  7716. if (!Array.isArray(list)) {
  7717. throw new TypeError('"list" argument must be an Array of Buffers')
  7718. }
  7719. if (list.length === 0) {
  7720. return Buffer.alloc(0)
  7721. }
  7722. var i
  7723. if (length === undefined) {
  7724. length = 0
  7725. for (i = 0; i < list.length; ++i) {
  7726. length += list[i].length
  7727. }
  7728. }
  7729. var buffer = Buffer.allocUnsafe(length)
  7730. var pos = 0
  7731. for (i = 0; i < list.length; ++i) {
  7732. var buf = list[i]
  7733. if (ArrayBuffer.isView(buf)) {
  7734. buf = Buffer.from(buf)
  7735. }
  7736. if (!Buffer.isBuffer(buf)) {
  7737. throw new TypeError('"list" argument must be an Array of Buffers')
  7738. }
  7739. buf.copy(buffer, pos)
  7740. pos += buf.length
  7741. }
  7742. return buffer
  7743. }
  7744. function byteLength (string, encoding) {
  7745. if (Buffer.isBuffer(string)) {
  7746. return string.length
  7747. }
  7748. if (ArrayBuffer.isView(string) || isArrayBuffer(string)) {
  7749. return string.byteLength
  7750. }
  7751. if (typeof string !== 'string') {
  7752. string = '' + string
  7753. }
  7754. var len = string.length
  7755. if (len === 0) return 0
  7756. // Use a for loop to avoid recursion
  7757. var loweredCase = false
  7758. for (;;) {
  7759. switch (encoding) {
  7760. case 'ascii':
  7761. case 'latin1':
  7762. case 'binary':
  7763. return len
  7764. case 'utf8':
  7765. case 'utf-8':
  7766. case undefined:
  7767. return utf8ToBytes(string).length
  7768. case 'ucs2':
  7769. case 'ucs-2':
  7770. case 'utf16le':
  7771. case 'utf-16le':
  7772. return len * 2
  7773. case 'hex':
  7774. return len >>> 1
  7775. case 'base64':
  7776. return base64ToBytes(string).length
  7777. default:
  7778. if (loweredCase) return utf8ToBytes(string).length // assume utf8
  7779. encoding = ('' + encoding).toLowerCase()
  7780. loweredCase = true
  7781. }
  7782. }
  7783. }
  7784. Buffer.byteLength = byteLength
  7785. function slowToString (encoding, start, end) {
  7786. var loweredCase = false
  7787. // No need to verify that "this.length <= MAX_UINT32" since it's a read-only
  7788. // property of a typed array.
  7789. // This behaves neither like String nor Uint8Array in that we set start/end
  7790. // to their upper/lower bounds if the value passed is out of range.
  7791. // undefined is handled specially as per ECMA-262 6th Edition,
  7792. // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.
  7793. if (start === undefined || start < 0) {
  7794. start = 0
  7795. }
  7796. // Return early if start > this.length. Done here to prevent potential uint32
  7797. // coercion fail below.
  7798. if (start > this.length) {
  7799. return ''
  7800. }
  7801. if (end === undefined || end > this.length) {
  7802. end = this.length
  7803. }
  7804. if (end <= 0) {
  7805. return ''
  7806. }
  7807. // Force coersion to uint32. This will also coerce falsey/NaN values to 0.
  7808. end >>>= 0
  7809. start >>>= 0
  7810. if (end <= start) {
  7811. return ''
  7812. }
  7813. if (!encoding) encoding = 'utf8'
  7814. while (true) {
  7815. switch (encoding) {
  7816. case 'hex':
  7817. return hexSlice(this, start, end)
  7818. case 'utf8':
  7819. case 'utf-8':
  7820. return utf8Slice(this, start, end)
  7821. case 'ascii':
  7822. return asciiSlice(this, start, end)
  7823. case 'latin1':
  7824. case 'binary':
  7825. return latin1Slice(this, start, end)
  7826. case 'base64':
  7827. return base64Slice(this, start, end)
  7828. case 'ucs2':
  7829. case 'ucs-2':
  7830. case 'utf16le':
  7831. case 'utf-16le':
  7832. return utf16leSlice(this, start, end)
  7833. default:
  7834. if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
  7835. encoding = (encoding + '').toLowerCase()
  7836. loweredCase = true
  7837. }
  7838. }
  7839. }
  7840. // This property is used by `Buffer.isBuffer` (and the `is-buffer` npm package)
  7841. // to detect a Buffer instance. It's not possible to use `instanceof Buffer`
  7842. // reliably in a browserify context because there could be multiple different
  7843. // copies of the 'buffer' package in use. This method works even for Buffer
  7844. // instances that were created from another copy of the `buffer` package.
  7845. // See: https://github.com/feross/buffer/issues/154
  7846. Buffer.prototype._isBuffer = true
  7847. function swap (b, n, m) {
  7848. var i = b[n]
  7849. b[n] = b[m]
  7850. b[m] = i
  7851. }
  7852. Buffer.prototype.swap16 = function swap16 () {
  7853. var len = this.length
  7854. if (len % 2 !== 0) {
  7855. throw new RangeError('Buffer size must be a multiple of 16-bits')
  7856. }
  7857. for (var i = 0; i < len; i += 2) {
  7858. swap(this, i, i + 1)
  7859. }
  7860. return this
  7861. }
  7862. Buffer.prototype.swap32 = function swap32 () {
  7863. var len = this.length
  7864. if (len % 4 !== 0) {
  7865. throw new RangeError('Buffer size must be a multiple of 32-bits')
  7866. }
  7867. for (var i = 0; i < len; i += 4) {
  7868. swap(this, i, i + 3)
  7869. swap(this, i + 1, i + 2)
  7870. }
  7871. return this
  7872. }
  7873. Buffer.prototype.swap64 = function swap64 () {
  7874. var len = this.length
  7875. if (len % 8 !== 0) {
  7876. throw new RangeError('Buffer size must be a multiple of 64-bits')
  7877. }
  7878. for (var i = 0; i < len; i += 8) {
  7879. swap(this, i, i + 7)
  7880. swap(this, i + 1, i + 6)
  7881. swap(this, i + 2, i + 5)
  7882. swap(this, i + 3, i + 4)
  7883. }
  7884. return this
  7885. }
  7886. Buffer.prototype.toString = function toString () {
  7887. var length = this.length
  7888. if (length === 0) return ''
  7889. if (arguments.length === 0) return utf8Slice(this, 0, length)
  7890. return slowToString.apply(this, arguments)
  7891. }
  7892. Buffer.prototype.toLocaleString = Buffer.prototype.toString
  7893. Buffer.prototype.equals = function equals (b) {
  7894. if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')
  7895. if (this === b) return true
  7896. return Buffer.compare(this, b) === 0
  7897. }
  7898. Buffer.prototype.inspect = function inspect () {
  7899. var str = ''
  7900. var max = exports.INSPECT_MAX_BYTES
  7901. if (this.length > 0) {
  7902. str = this.toString('hex', 0, max).match(/.{2}/g).join(' ')
  7903. if (this.length > max) str += ' ... '
  7904. }
  7905. return '<Buffer ' + str + '>'
  7906. }
  7907. Buffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) {
  7908. if (!Buffer.isBuffer(target)) {
  7909. throw new TypeError('Argument must be a Buffer')
  7910. }
  7911. if (start === undefined) {
  7912. start = 0
  7913. }
  7914. if (end === undefined) {
  7915. end = target ? target.length : 0
  7916. }
  7917. if (thisStart === undefined) {
  7918. thisStart = 0
  7919. }
  7920. if (thisEnd === undefined) {
  7921. thisEnd = this.length
  7922. }
  7923. if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {
  7924. throw new RangeError('out of range index')
  7925. }
  7926. if (thisStart >= thisEnd && start >= end) {
  7927. return 0
  7928. }
  7929. if (thisStart >= thisEnd) {
  7930. return -1
  7931. }
  7932. if (start >= end) {
  7933. return 1
  7934. }
  7935. start >>>= 0
  7936. end >>>= 0
  7937. thisStart >>>= 0
  7938. thisEnd >>>= 0
  7939. if (this === target) return 0
  7940. var x = thisEnd - thisStart
  7941. var y = end - start
  7942. var len = Math.min(x, y)
  7943. var thisCopy = this.slice(thisStart, thisEnd)
  7944. var targetCopy = target.slice(start, end)
  7945. for (var i = 0; i < len; ++i) {
  7946. if (thisCopy[i] !== targetCopy[i]) {
  7947. x = thisCopy[i]
  7948. y = targetCopy[i]
  7949. break
  7950. }
  7951. }
  7952. if (x < y) return -1
  7953. if (y < x) return 1
  7954. return 0
  7955. }
  7956. // Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,
  7957. // OR the last index of `val` in `buffer` at offset <= `byteOffset`.
  7958. //
  7959. // Arguments:
  7960. // - buffer - a Buffer to search
  7961. // - val - a string, Buffer, or number
  7962. // - byteOffset - an index into `buffer`; will be clamped to an int32
  7963. // - encoding - an optional encoding, relevant is val is a string
  7964. // - dir - true for indexOf, false for lastIndexOf
  7965. function bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {
  7966. // Empty buffer means no match
  7967. if (buffer.length === 0) return -1
  7968. // Normalize byteOffset
  7969. if (typeof byteOffset === 'string') {
  7970. encoding = byteOffset
  7971. byteOffset = 0
  7972. } else if (byteOffset > 0x7fffffff) {
  7973. byteOffset = 0x7fffffff
  7974. } else if (byteOffset < -0x80000000) {
  7975. byteOffset = -0x80000000
  7976. }
  7977. byteOffset = +byteOffset // Coerce to Number.
  7978. if (numberIsNaN(byteOffset)) {
  7979. // byteOffset: it it's undefined, null, NaN, "foo", etc, search whole buffer
  7980. byteOffset = dir ? 0 : (buffer.length - 1)
  7981. }
  7982. // Normalize byteOffset: negative offsets start from the end of the buffer
  7983. if (byteOffset < 0) byteOffset = buffer.length + byteOffset
  7984. if (byteOffset >= buffer.length) {
  7985. if (dir) return -1
  7986. else byteOffset = buffer.length - 1
  7987. } else if (byteOffset < 0) {
  7988. if (dir) byteOffset = 0
  7989. else return -1
  7990. }
  7991. // Normalize val
  7992. if (typeof val === 'string') {
  7993. val = Buffer.from(val, encoding)
  7994. }
  7995. // Finally, search either indexOf (if dir is true) or lastIndexOf
  7996. if (Buffer.isBuffer(val)) {
  7997. // Special case: looking for empty string/buffer always fails
  7998. if (val.length === 0) {
  7999. return -1
  8000. }
  8001. return arrayIndexOf(buffer, val, byteOffset, encoding, dir)
  8002. } else if (typeof val === 'number') {
  8003. val = val & 0xFF // Search for a byte value [0-255]
  8004. if (typeof Uint8Array.prototype.indexOf === 'function') {
  8005. if (dir) {
  8006. return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset)
  8007. } else {
  8008. return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset)
  8009. }
  8010. }
  8011. return arrayIndexOf(buffer, [ val ], byteOffset, encoding, dir)
  8012. }
  8013. throw new TypeError('val must be string, number or Buffer')
  8014. }
  8015. function arrayIndexOf (arr, val, byteOffset, encoding, dir) {
  8016. var indexSize = 1
  8017. var arrLength = arr.length
  8018. var valLength = val.length
  8019. if (encoding !== undefined) {
  8020. encoding = String(encoding).toLowerCase()
  8021. if (encoding === 'ucs2' || encoding === 'ucs-2' ||
  8022. encoding === 'utf16le' || encoding === 'utf-16le') {
  8023. if (arr.length < 2 || val.length < 2) {
  8024. return -1
  8025. }
  8026. indexSize = 2
  8027. arrLength /= 2
  8028. valLength /= 2
  8029. byteOffset /= 2
  8030. }
  8031. }
  8032. function read (buf, i) {
  8033. if (indexSize === 1) {
  8034. return buf[i]
  8035. } else {
  8036. return buf.readUInt16BE(i * indexSize)
  8037. }
  8038. }
  8039. var i
  8040. if (dir) {
  8041. var foundIndex = -1
  8042. for (i = byteOffset; i < arrLength; i++) {
  8043. if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {
  8044. if (foundIndex === -1) foundIndex = i
  8045. if (i - foundIndex + 1 === valLength) return foundIndex * indexSize
  8046. } else {
  8047. if (foundIndex !== -1) i -= i - foundIndex
  8048. foundIndex = -1
  8049. }
  8050. }
  8051. } else {
  8052. if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength
  8053. for (i = byteOffset; i >= 0; i--) {
  8054. var found = true
  8055. for (var j = 0; j < valLength; j++) {
  8056. if (read(arr, i + j) !== read(val, j)) {
  8057. found = false
  8058. break
  8059. }
  8060. }
  8061. if (found) return i
  8062. }
  8063. }
  8064. return -1
  8065. }
  8066. Buffer.prototype.includes = function includes (val, byteOffset, encoding) {
  8067. return this.indexOf(val, byteOffset, encoding) !== -1
  8068. }
  8069. Buffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) {
  8070. return bidirectionalIndexOf(this, val, byteOffset, encoding, true)
  8071. }
  8072. Buffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) {
  8073. return bidirectionalIndexOf(this, val, byteOffset, encoding, false)
  8074. }
  8075. function hexWrite (buf, string, offset, length) {
  8076. offset = Number(offset) || 0
  8077. var remaining = buf.length - offset
  8078. if (!length) {
  8079. length = remaining
  8080. } else {
  8081. length = Number(length)
  8082. if (length > remaining) {
  8083. length = remaining
  8084. }
  8085. }
  8086. var strLen = string.length
  8087. if (length > strLen / 2) {
  8088. length = strLen / 2
  8089. }
  8090. for (var i = 0; i < length; ++i) {
  8091. var parsed = parseInt(string.substr(i * 2, 2), 16)
  8092. if (numberIsNaN(parsed)) return i
  8093. buf[offset + i] = parsed
  8094. }
  8095. return i
  8096. }
  8097. function utf8Write (buf, string, offset, length) {
  8098. return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)
  8099. }
  8100. function asciiWrite (buf, string, offset, length) {
  8101. return blitBuffer(asciiToBytes(string), buf, offset, length)
  8102. }
  8103. function latin1Write (buf, string, offset, length) {
  8104. return asciiWrite(buf, string, offset, length)
  8105. }
  8106. function base64Write (buf, string, offset, length) {
  8107. return blitBuffer(base64ToBytes(string), buf, offset, length)
  8108. }
  8109. function ucs2Write (buf, string, offset, length) {
  8110. return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)
  8111. }
  8112. Buffer.prototype.write = function write (string, offset, length, encoding) {
  8113. // Buffer#write(string)
  8114. if (offset === undefined) {
  8115. encoding = 'utf8'
  8116. length = this.length
  8117. offset = 0
  8118. // Buffer#write(string, encoding)
  8119. } else if (length === undefined && typeof offset === 'string') {
  8120. encoding = offset
  8121. length = this.length
  8122. offset = 0
  8123. // Buffer#write(string, offset[, length][, encoding])
  8124. } else if (isFinite(offset)) {
  8125. offset = offset >>> 0
  8126. if (isFinite(length)) {
  8127. length = length >>> 0
  8128. if (encoding === undefined) encoding = 'utf8'
  8129. } else {
  8130. encoding = length
  8131. length = undefined
  8132. }
  8133. } else {
  8134. throw new Error(
  8135. 'Buffer.write(string, encoding, offset[, length]) is no longer supported'
  8136. )
  8137. }
  8138. var remaining = this.length - offset
  8139. if (length === undefined || length > remaining) length = remaining
  8140. if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {
  8141. throw new RangeError('Attempt to write outside buffer bounds')
  8142. }
  8143. if (!encoding) encoding = 'utf8'
  8144. var loweredCase = false
  8145. for (;;) {
  8146. switch (encoding) {
  8147. case 'hex':
  8148. return hexWrite(this, string, offset, length)
  8149. case 'utf8':
  8150. case 'utf-8':
  8151. return utf8Write(this, string, offset, length)
  8152. case 'ascii':
  8153. return asciiWrite(this, string, offset, length)
  8154. case 'latin1':
  8155. case 'binary':
  8156. return latin1Write(this, string, offset, length)
  8157. case 'base64':
  8158. // Warning: maxLength not taken into account in base64Write
  8159. return base64Write(this, string, offset, length)
  8160. case 'ucs2':
  8161. case 'ucs-2':
  8162. case 'utf16le':
  8163. case 'utf-16le':
  8164. return ucs2Write(this, string, offset, length)
  8165. default:
  8166. if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
  8167. encoding = ('' + encoding).toLowerCase()
  8168. loweredCase = true
  8169. }
  8170. }
  8171. }
  8172. Buffer.prototype.toJSON = function toJSON () {
  8173. return {
  8174. type: 'Buffer',
  8175. data: Array.prototype.slice.call(this._arr || this, 0)
  8176. }
  8177. }
  8178. function base64Slice (buf, start, end) {
  8179. if (start === 0 && end === buf.length) {
  8180. return base64.fromByteArray(buf)
  8181. } else {
  8182. return base64.fromByteArray(buf.slice(start, end))
  8183. }
  8184. }
  8185. function utf8Slice (buf, start, end) {
  8186. end = Math.min(buf.length, end)
  8187. var res = []
  8188. var i = start
  8189. while (i < end) {
  8190. var firstByte = buf[i]
  8191. var codePoint = null
  8192. var bytesPerSequence = (firstByte > 0xEF) ? 4
  8193. : (firstByte > 0xDF) ? 3
  8194. : (firstByte > 0xBF) ? 2
  8195. : 1
  8196. if (i + bytesPerSequence <= end) {
  8197. var secondByte, thirdByte, fourthByte, tempCodePoint
  8198. switch (bytesPerSequence) {
  8199. case 1:
  8200. if (firstByte < 0x80) {
  8201. codePoint = firstByte
  8202. }
  8203. break
  8204. case 2:
  8205. secondByte = buf[i + 1]
  8206. if ((secondByte & 0xC0) === 0x80) {
  8207. tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F)
  8208. if (tempCodePoint > 0x7F) {
  8209. codePoint = tempCodePoint
  8210. }
  8211. }
  8212. break
  8213. case 3:
  8214. secondByte = buf[i + 1]
  8215. thirdByte = buf[i + 2]
  8216. if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {
  8217. tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F)
  8218. if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {
  8219. codePoint = tempCodePoint
  8220. }
  8221. }
  8222. break
  8223. case 4:
  8224. secondByte = buf[i + 1]
  8225. thirdByte = buf[i + 2]
  8226. fourthByte = buf[i + 3]
  8227. if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {
  8228. tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F)
  8229. if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {
  8230. codePoint = tempCodePoint
  8231. }
  8232. }
  8233. }
  8234. }
  8235. if (codePoint === null) {
  8236. // we did not generate a valid codePoint so insert a
  8237. // replacement char (U+FFFD) and advance only 1 byte
  8238. codePoint = 0xFFFD
  8239. bytesPerSequence = 1
  8240. } else if (codePoint > 0xFFFF) {
  8241. // encode to utf16 (surrogate pair dance)
  8242. codePoint -= 0x10000
  8243. res.push(codePoint >>> 10 & 0x3FF | 0xD800)
  8244. codePoint = 0xDC00 | codePoint & 0x3FF
  8245. }
  8246. res.push(codePoint)
  8247. i += bytesPerSequence
  8248. }
  8249. return decodeCodePointsArray(res)
  8250. }
  8251. // Based on http://stackoverflow.com/a/22747272/680742, the browser with
  8252. // the lowest limit is Chrome, with 0x10000 args.
  8253. // We go 1 magnitude less, for safety
  8254. var MAX_ARGUMENTS_LENGTH = 0x1000
  8255. function decodeCodePointsArray (codePoints) {
  8256. var len = codePoints.length
  8257. if (len <= MAX_ARGUMENTS_LENGTH) {
  8258. return String.fromCharCode.apply(String, codePoints) // avoid extra slice()
  8259. }
  8260. // Decode in chunks to avoid "call stack size exceeded".
  8261. var res = ''
  8262. var i = 0
  8263. while (i < len) {
  8264. res += String.fromCharCode.apply(
  8265. String,
  8266. codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)
  8267. )
  8268. }
  8269. return res
  8270. }
  8271. function asciiSlice (buf, start, end) {
  8272. var ret = ''
  8273. end = Math.min(buf.length, end)
  8274. for (var i = start; i < end; ++i) {
  8275. ret += String.fromCharCode(buf[i] & 0x7F)
  8276. }
  8277. return ret
  8278. }
  8279. function latin1Slice (buf, start, end) {
  8280. var ret = ''
  8281. end = Math.min(buf.length, end)
  8282. for (var i = start; i < end; ++i) {
  8283. ret += String.fromCharCode(buf[i])
  8284. }
  8285. return ret
  8286. }
  8287. function hexSlice (buf, start, end) {
  8288. var len = buf.length
  8289. if (!start || start < 0) start = 0
  8290. if (!end || end < 0 || end > len) end = len
  8291. var out = ''
  8292. for (var i = start; i < end; ++i) {
  8293. out += toHex(buf[i])
  8294. }
  8295. return out
  8296. }
  8297. function utf16leSlice (buf, start, end) {
  8298. var bytes = buf.slice(start, end)
  8299. var res = ''
  8300. for (var i = 0; i < bytes.length; i += 2) {
  8301. res += String.fromCharCode(bytes[i] + (bytes[i + 1] * 256))
  8302. }
  8303. return res
  8304. }
  8305. Buffer.prototype.slice = function slice (start, end) {
  8306. var len = this.length
  8307. start = ~~start
  8308. end = end === undefined ? len : ~~end
  8309. if (start < 0) {
  8310. start += len
  8311. if (start < 0) start = 0
  8312. } else if (start > len) {
  8313. start = len
  8314. }
  8315. if (end < 0) {
  8316. end += len
  8317. if (end < 0) end = 0
  8318. } else if (end > len) {
  8319. end = len
  8320. }
  8321. if (end < start) end = start
  8322. var newBuf = this.subarray(start, end)
  8323. // Return an augmented `Uint8Array` instance
  8324. newBuf.__proto__ = Buffer.prototype
  8325. return newBuf
  8326. }
  8327. /*
  8328. * Need to make sure that buffer isn't trying to write out of bounds.
  8329. */
  8330. function checkOffset (offset, ext, length) {
  8331. if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')
  8332. if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')
  8333. }
  8334. Buffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {
  8335. offset = offset >>> 0
  8336. byteLength = byteLength >>> 0
  8337. if (!noAssert) checkOffset(offset, byteLength, this.length)
  8338. var val = this[offset]
  8339. var mul = 1
  8340. var i = 0
  8341. while (++i < byteLength && (mul *= 0x100)) {
  8342. val += this[offset + i] * mul
  8343. }
  8344. return val
  8345. }
  8346. Buffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {
  8347. offset = offset >>> 0
  8348. byteLength = byteLength >>> 0
  8349. if (!noAssert) {
  8350. checkOffset(offset, byteLength, this.length)
  8351. }
  8352. var val = this[offset + --byteLength]
  8353. var mul = 1
  8354. while (byteLength > 0 && (mul *= 0x100)) {
  8355. val += this[offset + --byteLength] * mul
  8356. }
  8357. return val
  8358. }
  8359. Buffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {
  8360. offset = offset >>> 0
  8361. if (!noAssert) checkOffset(offset, 1, this.length)
  8362. return this[offset]
  8363. }
  8364. Buffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {
  8365. offset = offset >>> 0
  8366. if (!noAssert) checkOffset(offset, 2, this.length)
  8367. return this[offset] | (this[offset + 1] << 8)
  8368. }
  8369. Buffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {
  8370. offset = offset >>> 0
  8371. if (!noAssert) checkOffset(offset, 2, this.length)
  8372. return (this[offset] << 8) | this[offset + 1]
  8373. }
  8374. Buffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {
  8375. offset = offset >>> 0
  8376. if (!noAssert) checkOffset(offset, 4, this.length)
  8377. return ((this[offset]) |
  8378. (this[offset + 1] << 8) |
  8379. (this[offset + 2] << 16)) +
  8380. (this[offset + 3] * 0x1000000)
  8381. }
  8382. Buffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {
  8383. offset = offset >>> 0
  8384. if (!noAssert) checkOffset(offset, 4, this.length)
  8385. return (this[offset] * 0x1000000) +
  8386. ((this[offset + 1] << 16) |
  8387. (this[offset + 2] << 8) |
  8388. this[offset + 3])
  8389. }
  8390. Buffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {
  8391. offset = offset >>> 0
  8392. byteLength = byteLength >>> 0
  8393. if (!noAssert) checkOffset(offset, byteLength, this.length)
  8394. var val = this[offset]
  8395. var mul = 1
  8396. var i = 0
  8397. while (++i < byteLength && (mul *= 0x100)) {
  8398. val += this[offset + i] * mul
  8399. }
  8400. mul *= 0x80
  8401. if (val >= mul) val -= Math.pow(2, 8 * byteLength)
  8402. return val
  8403. }
  8404. Buffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {
  8405. offset = offset >>> 0
  8406. byteLength = byteLength >>> 0
  8407. if (!noAssert) checkOffset(offset, byteLength, this.length)
  8408. var i = byteLength
  8409. var mul = 1
  8410. var val = this[offset + --i]
  8411. while (i > 0 && (mul *= 0x100)) {
  8412. val += this[offset + --i] * mul
  8413. }
  8414. mul *= 0x80
  8415. if (val >= mul) val -= Math.pow(2, 8 * byteLength)
  8416. return val
  8417. }
  8418. Buffer.prototype.readInt8 = function readInt8 (offset, noAssert) {
  8419. offset = offset >>> 0
  8420. if (!noAssert) checkOffset(offset, 1, this.length)
  8421. if (!(this[offset] & 0x80)) return (this[offset])
  8422. return ((0xff - this[offset] + 1) * -1)
  8423. }
  8424. Buffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {
  8425. offset = offset >>> 0
  8426. if (!noAssert) checkOffset(offset, 2, this.length)
  8427. var val = this[offset] | (this[offset + 1] << 8)
  8428. return (val & 0x8000) ? val | 0xFFFF0000 : val
  8429. }
  8430. Buffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {
  8431. offset = offset >>> 0
  8432. if (!noAssert) checkOffset(offset, 2, this.length)
  8433. var val = this[offset + 1] | (this[offset] << 8)
  8434. return (val & 0x8000) ? val | 0xFFFF0000 : val
  8435. }
  8436. Buffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {
  8437. offset = offset >>> 0
  8438. if (!noAssert) checkOffset(offset, 4, this.length)
  8439. return (this[offset]) |
  8440. (this[offset + 1] << 8) |
  8441. (this[offset + 2] << 16) |
  8442. (this[offset + 3] << 24)
  8443. }
  8444. Buffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {
  8445. offset = offset >>> 0
  8446. if (!noAssert) checkOffset(offset, 4, this.length)
  8447. return (this[offset] << 24) |
  8448. (this[offset + 1] << 16) |
  8449. (this[offset + 2] << 8) |
  8450. (this[offset + 3])
  8451. }
  8452. Buffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {
  8453. offset = offset >>> 0
  8454. if (!noAssert) checkOffset(offset, 4, this.length)
  8455. return ieee754.read(this, offset, true, 23, 4)
  8456. }
  8457. Buffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {
  8458. offset = offset >>> 0
  8459. if (!noAssert) checkOffset(offset, 4, this.length)
  8460. return ieee754.read(this, offset, false, 23, 4)
  8461. }
  8462. Buffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {
  8463. offset = offset >>> 0
  8464. if (!noAssert) checkOffset(offset, 8, this.length)
  8465. return ieee754.read(this, offset, true, 52, 8)
  8466. }
  8467. Buffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {
  8468. offset = offset >>> 0
  8469. if (!noAssert) checkOffset(offset, 8, this.length)
  8470. return ieee754.read(this, offset, false, 52, 8)
  8471. }
  8472. function checkInt (buf, value, offset, ext, max, min) {
  8473. if (!Buffer.isBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance')
  8474. if (value > max || value < min) throw new RangeError('"value" argument is out of bounds')
  8475. if (offset + ext > buf.length) throw new RangeError('Index out of range')
  8476. }
  8477. Buffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {
  8478. value = +value
  8479. offset = offset >>> 0
  8480. byteLength = byteLength >>> 0
  8481. if (!noAssert) {
  8482. var maxBytes = Math.pow(2, 8 * byteLength) - 1
  8483. checkInt(this, value, offset, byteLength, maxBytes, 0)
  8484. }
  8485. var mul = 1
  8486. var i = 0
  8487. this[offset] = value & 0xFF
  8488. while (++i < byteLength && (mul *= 0x100)) {
  8489. this[offset + i] = (value / mul) & 0xFF
  8490. }
  8491. return offset + byteLength
  8492. }
  8493. Buffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {
  8494. value = +value
  8495. offset = offset >>> 0
  8496. byteLength = byteLength >>> 0
  8497. if (!noAssert) {
  8498. var maxBytes = Math.pow(2, 8 * byteLength) - 1
  8499. checkInt(this, value, offset, byteLength, maxBytes, 0)
  8500. }
  8501. var i = byteLength - 1
  8502. var mul = 1
  8503. this[offset + i] = value & 0xFF
  8504. while (--i >= 0 && (mul *= 0x100)) {
  8505. this[offset + i] = (value / mul) & 0xFF
  8506. }
  8507. return offset + byteLength
  8508. }
  8509. Buffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {
  8510. value = +value
  8511. offset = offset >>> 0
  8512. if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0)
  8513. this[offset] = (value & 0xff)
  8514. return offset + 1
  8515. }
  8516. Buffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {
  8517. value = +value
  8518. offset = offset >>> 0
  8519. if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
  8520. this[offset] = (value & 0xff)
  8521. this[offset + 1] = (value >>> 8)
  8522. return offset + 2
  8523. }
  8524. Buffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {
  8525. value = +value
  8526. offset = offset >>> 0
  8527. if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
  8528. this[offset] = (value >>> 8)
  8529. this[offset + 1] = (value & 0xff)
  8530. return offset + 2
  8531. }
  8532. Buffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {
  8533. value = +value
  8534. offset = offset >>> 0
  8535. if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
  8536. this[offset + 3] = (value >>> 24)
  8537. this[offset + 2] = (value >>> 16)
  8538. this[offset + 1] = (value >>> 8)
  8539. this[offset] = (value & 0xff)
  8540. return offset + 4
  8541. }
  8542. Buffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {
  8543. value = +value
  8544. offset = offset >>> 0
  8545. if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
  8546. this[offset] = (value >>> 24)
  8547. this[offset + 1] = (value >>> 16)
  8548. this[offset + 2] = (value >>> 8)
  8549. this[offset + 3] = (value & 0xff)
  8550. return offset + 4
  8551. }
  8552. Buffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {
  8553. value = +value
  8554. offset = offset >>> 0
  8555. if (!noAssert) {
  8556. var limit = Math.pow(2, (8 * byteLength) - 1)
  8557. checkInt(this, value, offset, byteLength, limit - 1, -limit)
  8558. }
  8559. var i = 0
  8560. var mul = 1
  8561. var sub = 0
  8562. this[offset] = value & 0xFF
  8563. while (++i < byteLength && (mul *= 0x100)) {
  8564. if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {
  8565. sub = 1
  8566. }
  8567. this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
  8568. }
  8569. return offset + byteLength
  8570. }
  8571. Buffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {
  8572. value = +value
  8573. offset = offset >>> 0
  8574. if (!noAssert) {
  8575. var limit = Math.pow(2, (8 * byteLength) - 1)
  8576. checkInt(this, value, offset, byteLength, limit - 1, -limit)
  8577. }
  8578. var i = byteLength - 1
  8579. var mul = 1
  8580. var sub = 0
  8581. this[offset + i] = value & 0xFF
  8582. while (--i >= 0 && (mul *= 0x100)) {
  8583. if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {
  8584. sub = 1
  8585. }
  8586. this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
  8587. }
  8588. return offset + byteLength
  8589. }
  8590. Buffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {
  8591. value = +value
  8592. offset = offset >>> 0
  8593. if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80)
  8594. if (value < 0) value = 0xff + value + 1
  8595. this[offset] = (value & 0xff)
  8596. return offset + 1
  8597. }
  8598. Buffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {
  8599. value = +value
  8600. offset = offset >>> 0
  8601. if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
  8602. this[offset] = (value & 0xff)
  8603. this[offset + 1] = (value >>> 8)
  8604. return offset + 2
  8605. }
  8606. Buffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {
  8607. value = +value
  8608. offset = offset >>> 0
  8609. if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
  8610. this[offset] = (value >>> 8)
  8611. this[offset + 1] = (value & 0xff)
  8612. return offset + 2
  8613. }
  8614. Buffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {
  8615. value = +value
  8616. offset = offset >>> 0
  8617. if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
  8618. this[offset] = (value & 0xff)
  8619. this[offset + 1] = (value >>> 8)
  8620. this[offset + 2] = (value >>> 16)
  8621. this[offset + 3] = (value >>> 24)
  8622. return offset + 4
  8623. }
  8624. Buffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {
  8625. value = +value
  8626. offset = offset >>> 0
  8627. if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
  8628. if (value < 0) value = 0xffffffff + value + 1
  8629. this[offset] = (value >>> 24)
  8630. this[offset + 1] = (value >>> 16)
  8631. this[offset + 2] = (value >>> 8)
  8632. this[offset + 3] = (value & 0xff)
  8633. return offset + 4
  8634. }
  8635. function checkIEEE754 (buf, value, offset, ext, max, min) {
  8636. if (offset + ext > buf.length) throw new RangeError('Index out of range')
  8637. if (offset < 0) throw new RangeError('Index out of range')
  8638. }
  8639. function writeFloat (buf, value, offset, littleEndian, noAssert) {
  8640. value = +value
  8641. offset = offset >>> 0
  8642. if (!noAssert) {
  8643. checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38)
  8644. }
  8645. ieee754.write(buf, value, offset, littleEndian, 23, 4)
  8646. return offset + 4
  8647. }
  8648. Buffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {
  8649. return writeFloat(this, value, offset, true, noAssert)
  8650. }
  8651. Buffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {
  8652. return writeFloat(this, value, offset, false, noAssert)
  8653. }
  8654. function writeDouble (buf, value, offset, littleEndian, noAssert) {
  8655. value = +value
  8656. offset = offset >>> 0
  8657. if (!noAssert) {
  8658. checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308)
  8659. }
  8660. ieee754.write(buf, value, offset, littleEndian, 52, 8)
  8661. return offset + 8
  8662. }
  8663. Buffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {
  8664. return writeDouble(this, value, offset, true, noAssert)
  8665. }
  8666. Buffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {
  8667. return writeDouble(this, value, offset, false, noAssert)
  8668. }
  8669. // copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)
  8670. Buffer.prototype.copy = function copy (target, targetStart, start, end) {
  8671. if (!Buffer.isBuffer(target)) throw new TypeError('argument should be a Buffer')
  8672. if (!start) start = 0
  8673. if (!end && end !== 0) end = this.length
  8674. if (targetStart >= target.length) targetStart = target.length
  8675. if (!targetStart) targetStart = 0
  8676. if (end > 0 && end < start) end = start
  8677. // Copy 0 bytes; we're done
  8678. if (end === start) return 0
  8679. if (target.length === 0 || this.length === 0) return 0
  8680. // Fatal error conditions
  8681. if (targetStart < 0) {
  8682. throw new RangeError('targetStart out of bounds')
  8683. }
  8684. if (start < 0 || start >= this.length) throw new RangeError('Index out of range')
  8685. if (end < 0) throw new RangeError('sourceEnd out of bounds')
  8686. // Are we oob?
  8687. if (end > this.length) end = this.length
  8688. if (target.length - targetStart < end - start) {
  8689. end = target.length - targetStart + start
  8690. }
  8691. var len = end - start
  8692. if (this === target && typeof Uint8Array.prototype.copyWithin === 'function') {
  8693. // Use built-in when available, missing from IE11
  8694. this.copyWithin(targetStart, start, end)
  8695. } else if (this === target && start < targetStart && targetStart < end) {
  8696. // descending copy from end
  8697. for (var i = len - 1; i >= 0; --i) {
  8698. target[i + targetStart] = this[i + start]
  8699. }
  8700. } else {
  8701. Uint8Array.prototype.set.call(
  8702. target,
  8703. this.subarray(start, end),
  8704. targetStart
  8705. )
  8706. }
  8707. return len
  8708. }
  8709. // Usage:
  8710. // buffer.fill(number[, offset[, end]])
  8711. // buffer.fill(buffer[, offset[, end]])
  8712. // buffer.fill(string[, offset[, end]][, encoding])
  8713. Buffer.prototype.fill = function fill (val, start, end, encoding) {
  8714. // Handle string cases:
  8715. if (typeof val === 'string') {
  8716. if (typeof start === 'string') {
  8717. encoding = start
  8718. start = 0
  8719. end = this.length
  8720. } else if (typeof end === 'string') {
  8721. encoding = end
  8722. end = this.length
  8723. }
  8724. if (encoding !== undefined && typeof encoding !== 'string') {
  8725. throw new TypeError('encoding must be a string')
  8726. }
  8727. if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {
  8728. throw new TypeError('Unknown encoding: ' + encoding)
  8729. }
  8730. if (val.length === 1) {
  8731. var code = val.charCodeAt(0)
  8732. if ((encoding === 'utf8' && code < 128) ||
  8733. encoding === 'latin1') {
  8734. // Fast path: If `val` fits into a single byte, use that numeric value.
  8735. val = code
  8736. }
  8737. }
  8738. } else if (typeof val === 'number') {
  8739. val = val & 255
  8740. }
  8741. // Invalid ranges are not set to a default, so can range check early.
  8742. if (start < 0 || this.length < start || this.length < end) {
  8743. throw new RangeError('Out of range index')
  8744. }
  8745. if (end <= start) {
  8746. return this
  8747. }
  8748. start = start >>> 0
  8749. end = end === undefined ? this.length : end >>> 0
  8750. if (!val) val = 0
  8751. var i
  8752. if (typeof val === 'number') {
  8753. for (i = start; i < end; ++i) {
  8754. this[i] = val
  8755. }
  8756. } else {
  8757. var bytes = Buffer.isBuffer(val)
  8758. ? val
  8759. : new Buffer(val, encoding)
  8760. var len = bytes.length
  8761. if (len === 0) {
  8762. throw new TypeError('The value "' + val +
  8763. '" is invalid for argument "value"')
  8764. }
  8765. for (i = 0; i < end - start; ++i) {
  8766. this[i + start] = bytes[i % len]
  8767. }
  8768. }
  8769. return this
  8770. }
  8771. // HELPER FUNCTIONS
  8772. // ================
  8773. var INVALID_BASE64_RE = /[^+/0-9A-Za-z-_]/g
  8774. function base64clean (str) {
  8775. // Node takes equal signs as end of the Base64 encoding
  8776. str = str.split('=')[0]
  8777. // Node strips out invalid characters like \n and \t from the string, base64-js does not
  8778. str = str.trim().replace(INVALID_BASE64_RE, '')
  8779. // Node converts strings with length < 2 to ''
  8780. if (str.length < 2) return ''
  8781. // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not
  8782. while (str.length % 4 !== 0) {
  8783. str = str + '='
  8784. }
  8785. return str
  8786. }
  8787. function toHex (n) {
  8788. if (n < 16) return '0' + n.toString(16)
  8789. return n.toString(16)
  8790. }
  8791. function utf8ToBytes (string, units) {
  8792. units = units || Infinity
  8793. var codePoint
  8794. var length = string.length
  8795. var leadSurrogate = null
  8796. var bytes = []
  8797. for (var i = 0; i < length; ++i) {
  8798. codePoint = string.charCodeAt(i)
  8799. // is surrogate component
  8800. if (codePoint > 0xD7FF && codePoint < 0xE000) {
  8801. // last char was a lead
  8802. if (!leadSurrogate) {
  8803. // no lead yet
  8804. if (codePoint > 0xDBFF) {
  8805. // unexpected trail
  8806. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  8807. continue
  8808. } else if (i + 1 === length) {
  8809. // unpaired lead
  8810. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  8811. continue
  8812. }
  8813. // valid lead
  8814. leadSurrogate = codePoint
  8815. continue
  8816. }
  8817. // 2 leads in a row
  8818. if (codePoint < 0xDC00) {
  8819. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  8820. leadSurrogate = codePoint
  8821. continue
  8822. }
  8823. // valid surrogate pair
  8824. codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000
  8825. } else if (leadSurrogate) {
  8826. // valid bmp char, but last char was a lead
  8827. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  8828. }
  8829. leadSurrogate = null
  8830. // encode utf8
  8831. if (codePoint < 0x80) {
  8832. if ((units -= 1) < 0) break
  8833. bytes.push(codePoint)
  8834. } else if (codePoint < 0x800) {
  8835. if ((units -= 2) < 0) break
  8836. bytes.push(
  8837. codePoint >> 0x6 | 0xC0,
  8838. codePoint & 0x3F | 0x80
  8839. )
  8840. } else if (codePoint < 0x10000) {
  8841. if ((units -= 3) < 0) break
  8842. bytes.push(
  8843. codePoint >> 0xC | 0xE0,
  8844. codePoint >> 0x6 & 0x3F | 0x80,
  8845. codePoint & 0x3F | 0x80
  8846. )
  8847. } else if (codePoint < 0x110000) {
  8848. if ((units -= 4) < 0) break
  8849. bytes.push(
  8850. codePoint >> 0x12 | 0xF0,
  8851. codePoint >> 0xC & 0x3F | 0x80,
  8852. codePoint >> 0x6 & 0x3F | 0x80,
  8853. codePoint & 0x3F | 0x80
  8854. )
  8855. } else {
  8856. throw new Error('Invalid code point')
  8857. }
  8858. }
  8859. return bytes
  8860. }
  8861. function asciiToBytes (str) {
  8862. var byteArray = []
  8863. for (var i = 0; i < str.length; ++i) {
  8864. // Node's code seems to be doing this and not & 0x7F..
  8865. byteArray.push(str.charCodeAt(i) & 0xFF)
  8866. }
  8867. return byteArray
  8868. }
  8869. function utf16leToBytes (str, units) {
  8870. var c, hi, lo
  8871. var byteArray = []
  8872. for (var i = 0; i < str.length; ++i) {
  8873. if ((units -= 2) < 0) break
  8874. c = str.charCodeAt(i)
  8875. hi = c >> 8
  8876. lo = c % 256
  8877. byteArray.push(lo)
  8878. byteArray.push(hi)
  8879. }
  8880. return byteArray
  8881. }
  8882. function base64ToBytes (str) {
  8883. return base64.toByteArray(base64clean(str))
  8884. }
  8885. function blitBuffer (src, dst, offset, length) {
  8886. for (var i = 0; i < length; ++i) {
  8887. if ((i + offset >= dst.length) || (i >= src.length)) break
  8888. dst[i + offset] = src[i]
  8889. }
  8890. return i
  8891. }
  8892. // ArrayBuffers from another context (i.e. an iframe) do not pass the `instanceof` check
  8893. // but they should be treated as valid. See: https://github.com/feross/buffer/issues/166
  8894. function isArrayBuffer (obj) {
  8895. return obj instanceof ArrayBuffer ||
  8896. (obj != null && obj.constructor != null && obj.constructor.name === 'ArrayBuffer' &&
  8897. typeof obj.byteLength === 'number')
  8898. }
  8899. function numberIsNaN (obj) {
  8900. return obj !== obj // eslint-disable-line no-self-compare
  8901. }
  8902. },{"base64-js":39,"ieee754":55}],44:[function(require,module,exports){
  8903. (function (Buffer){
  8904. // Copyright Joyent, Inc. and other Node contributors.
  8905. //
  8906. // Permission is hereby granted, free of charge, to any person obtaining a
  8907. // copy of this software and associated documentation files (the
  8908. // "Software"), to deal in the Software without restriction, including
  8909. // without limitation the rights to use, copy, modify, merge, publish,
  8910. // distribute, sublicense, and/or sell copies of the Software, and to permit
  8911. // persons to whom the Software is furnished to do so, subject to the
  8912. // following conditions:
  8913. //
  8914. // The above copyright notice and this permission notice shall be included
  8915. // in all copies or substantial portions of the Software.
  8916. //
  8917. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  8918. // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  8919. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  8920. // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  8921. // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  8922. // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  8923. // USE OR OTHER DEALINGS IN THE SOFTWARE.
  8924. // NOTE: These type checking functions intentionally don't use `instanceof`
  8925. // because it is fragile and can be easily faked with `Object.create()`.
  8926. function isArray(arg) {
  8927. if (Array.isArray) {
  8928. return Array.isArray(arg);
  8929. }
  8930. return objectToString(arg) === '[object Array]';
  8931. }
  8932. exports.isArray = isArray;
  8933. function isBoolean(arg) {
  8934. return typeof arg === 'boolean';
  8935. }
  8936. exports.isBoolean = isBoolean;
  8937. function isNull(arg) {
  8938. return arg === null;
  8939. }
  8940. exports.isNull = isNull;
  8941. function isNullOrUndefined(arg) {
  8942. return arg == null;
  8943. }
  8944. exports.isNullOrUndefined = isNullOrUndefined;
  8945. function isNumber(arg) {
  8946. return typeof arg === 'number';
  8947. }
  8948. exports.isNumber = isNumber;
  8949. function isString(arg) {
  8950. return typeof arg === 'string';
  8951. }
  8952. exports.isString = isString;
  8953. function isSymbol(arg) {
  8954. return typeof arg === 'symbol';
  8955. }
  8956. exports.isSymbol = isSymbol;
  8957. function isUndefined(arg) {
  8958. return arg === void 0;
  8959. }
  8960. exports.isUndefined = isUndefined;
  8961. function isRegExp(re) {
  8962. return objectToString(re) === '[object RegExp]';
  8963. }
  8964. exports.isRegExp = isRegExp;
  8965. function isObject(arg) {
  8966. return typeof arg === 'object' && arg !== null;
  8967. }
  8968. exports.isObject = isObject;
  8969. function isDate(d) {
  8970. return objectToString(d) === '[object Date]';
  8971. }
  8972. exports.isDate = isDate;
  8973. function isError(e) {
  8974. return (objectToString(e) === '[object Error]' || e instanceof Error);
  8975. }
  8976. exports.isError = isError;
  8977. function isFunction(arg) {
  8978. return typeof arg === 'function';
  8979. }
  8980. exports.isFunction = isFunction;
  8981. function isPrimitive(arg) {
  8982. return arg === null ||
  8983. typeof arg === 'boolean' ||
  8984. typeof arg === 'number' ||
  8985. typeof arg === 'string' ||
  8986. typeof arg === 'symbol' || // ES6 symbol
  8987. typeof arg === 'undefined';
  8988. }
  8989. exports.isPrimitive = isPrimitive;
  8990. exports.isBuffer = Buffer.isBuffer;
  8991. function objectToString(o) {
  8992. return Object.prototype.toString.call(o);
  8993. }
  8994. }).call(this,{"isBuffer":require("../../is-buffer/index.js")})
  8995. },{"../../is-buffer/index.js":57}],45:[function(require,module,exports){
  8996. (function (process){
  8997. "use strict";
  8998. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  8999. /* eslint-env browser */
  9000. /**
  9001. * This is the web browser implementation of `debug()`.
  9002. */
  9003. exports.log = log;
  9004. exports.formatArgs = formatArgs;
  9005. exports.save = save;
  9006. exports.load = load;
  9007. exports.useColors = useColors;
  9008. exports.storage = localstorage();
  9009. /**
  9010. * Colors.
  9011. */
  9012. exports.colors = ['#0000CC', '#0000FF', '#0033CC', '#0033FF', '#0066CC', '#0066FF', '#0099CC', '#0099FF', '#00CC00', '#00CC33', '#00CC66', '#00CC99', '#00CCCC', '#00CCFF', '#3300CC', '#3300FF', '#3333CC', '#3333FF', '#3366CC', '#3366FF', '#3399CC', '#3399FF', '#33CC00', '#33CC33', '#33CC66', '#33CC99', '#33CCCC', '#33CCFF', '#6600CC', '#6600FF', '#6633CC', '#6633FF', '#66CC00', '#66CC33', '#9900CC', '#9900FF', '#9933CC', '#9933FF', '#99CC00', '#99CC33', '#CC0000', '#CC0033', '#CC0066', '#CC0099', '#CC00CC', '#CC00FF', '#CC3300', '#CC3333', '#CC3366', '#CC3399', '#CC33CC', '#CC33FF', '#CC6600', '#CC6633', '#CC9900', '#CC9933', '#CCCC00', '#CCCC33', '#FF0000', '#FF0033', '#FF0066', '#FF0099', '#FF00CC', '#FF00FF', '#FF3300', '#FF3333', '#FF3366', '#FF3399', '#FF33CC', '#FF33FF', '#FF6600', '#FF6633', '#FF9900', '#FF9933', '#FFCC00', '#FFCC33'];
  9013. /**
  9014. * Currently only WebKit-based Web Inspectors, Firefox >= v31,
  9015. * and the Firebug extension (any Firefox version) are known
  9016. * to support "%c" CSS customizations.
  9017. *
  9018. * TODO: add a `localStorage` variable to explicitly enable/disable colors
  9019. */
  9020. // eslint-disable-next-line complexity
  9021. function useColors() {
  9022. // NB: In an Electron preload script, document will be defined but not fully
  9023. // initialized. Since we know we're in Chrome, we'll just detect this case
  9024. // explicitly
  9025. if (typeof window !== 'undefined' && window.process && (window.process.type === 'renderer' || window.process.__nwjs)) {
  9026. return true;
  9027. } // Internet Explorer and Edge do not support colors.
  9028. if (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) {
  9029. return false;
  9030. } // Is webkit? http://stackoverflow.com/a/16459606/376773
  9031. // document is undefined in react-native: https://github.com/facebook/react-native/pull/1632
  9032. return typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance || // Is firebug? http://stackoverflow.com/a/398120/376773
  9033. typeof window !== 'undefined' && window.console && (window.console.firebug || window.console.exception && window.console.table) || // Is firefox >= v31?
  9034. // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages
  9035. typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31 || // Double check webkit in userAgent just in case we are in a worker
  9036. typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/);
  9037. }
  9038. /**
  9039. * Colorize log arguments if enabled.
  9040. *
  9041. * @api public
  9042. */
  9043. function formatArgs(args) {
  9044. args[0] = (this.useColors ? '%c' : '') + this.namespace + (this.useColors ? ' %c' : ' ') + args[0] + (this.useColors ? '%c ' : ' ') + '+' + module.exports.humanize(this.diff);
  9045. if (!this.useColors) {
  9046. return;
  9047. }
  9048. var c = 'color: ' + this.color;
  9049. args.splice(1, 0, c, 'color: inherit'); // The final "%c" is somewhat tricky, because there could be other
  9050. // arguments passed either before or after the %c, so we need to
  9051. // figure out the correct index to insert the CSS into
  9052. var index = 0;
  9053. var lastC = 0;
  9054. args[0].replace(/%[a-zA-Z%]/g, function (match) {
  9055. if (match === '%%') {
  9056. return;
  9057. }
  9058. index++;
  9059. if (match === '%c') {
  9060. // We only are interested in the *last* %c
  9061. // (the user may have provided their own)
  9062. lastC = index;
  9063. }
  9064. });
  9065. args.splice(lastC, 0, c);
  9066. }
  9067. /**
  9068. * Invokes `console.log()` when available.
  9069. * No-op when `console.log` is not a "function".
  9070. *
  9071. * @api public
  9072. */
  9073. function log() {
  9074. var _console;
  9075. // This hackery is required for IE8/9, where
  9076. // the `console.log` function doesn't have 'apply'
  9077. return (typeof console === "undefined" ? "undefined" : _typeof(console)) === 'object' && console.log && (_console = console).log.apply(_console, arguments);
  9078. }
  9079. /**
  9080. * Save `namespaces`.
  9081. *
  9082. * @param {String} namespaces
  9083. * @api private
  9084. */
  9085. function save(namespaces) {
  9086. try {
  9087. if (namespaces) {
  9088. exports.storage.setItem('debug', namespaces);
  9089. } else {
  9090. exports.storage.removeItem('debug');
  9091. }
  9092. } catch (error) {// Swallow
  9093. // XXX (@Qix-) should we be logging these?
  9094. }
  9095. }
  9096. /**
  9097. * Load `namespaces`.
  9098. *
  9099. * @return {String} returns the previously persisted debug modes
  9100. * @api private
  9101. */
  9102. function load() {
  9103. var r;
  9104. try {
  9105. r = exports.storage.getItem('debug');
  9106. } catch (error) {} // Swallow
  9107. // XXX (@Qix-) should we be logging these?
  9108. // If debug isn't set in LS, and we're in Electron, try to load $DEBUG
  9109. if (!r && typeof process !== 'undefined' && 'env' in process) {
  9110. r = process.env.DEBUG;
  9111. }
  9112. return r;
  9113. }
  9114. /**
  9115. * Localstorage attempts to return the localstorage.
  9116. *
  9117. * This is necessary because safari throws
  9118. * when a user disables cookies/localstorage
  9119. * and you attempt to access it.
  9120. *
  9121. * @return {LocalStorage}
  9122. * @api private
  9123. */
  9124. function localstorage() {
  9125. try {
  9126. // TVMLKit (Apple TV JS Runtime) does not have a window object, just localStorage in the global context
  9127. // The Browser also has localStorage in the global context.
  9128. return localStorage;
  9129. } catch (error) {// Swallow
  9130. // XXX (@Qix-) should we be logging these?
  9131. }
  9132. }
  9133. module.exports = require('./common')(exports);
  9134. var formatters = module.exports.formatters;
  9135. /**
  9136. * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.
  9137. */
  9138. formatters.j = function (v) {
  9139. try {
  9140. return JSON.stringify(v);
  9141. } catch (error) {
  9142. return '[UnexpectedJSONParseError]: ' + error.message;
  9143. }
  9144. };
  9145. }).call(this,require('_process'))
  9146. },{"./common":46,"_process":68}],46:[function(require,module,exports){
  9147. "use strict";
  9148. /**
  9149. * This is the common logic for both the Node.js and web browser
  9150. * implementations of `debug()`.
  9151. */
  9152. function setup(env) {
  9153. createDebug.debug = createDebug;
  9154. createDebug.default = createDebug;
  9155. createDebug.coerce = coerce;
  9156. createDebug.disable = disable;
  9157. createDebug.enable = enable;
  9158. createDebug.enabled = enabled;
  9159. createDebug.humanize = require('ms');
  9160. Object.keys(env).forEach(function (key) {
  9161. createDebug[key] = env[key];
  9162. });
  9163. /**
  9164. * Active `debug` instances.
  9165. */
  9166. createDebug.instances = [];
  9167. /**
  9168. * The currently active debug mode names, and names to skip.
  9169. */
  9170. createDebug.names = [];
  9171. createDebug.skips = [];
  9172. /**
  9173. * Map of special "%n" handling functions, for the debug "format" argument.
  9174. *
  9175. * Valid key names are a single, lower or upper-case letter, i.e. "n" and "N".
  9176. */
  9177. createDebug.formatters = {};
  9178. /**
  9179. * Selects a color for a debug namespace
  9180. * @param {String} namespace The namespace string for the for the debug instance to be colored
  9181. * @return {Number|String} An ANSI color code for the given namespace
  9182. * @api private
  9183. */
  9184. function selectColor(namespace) {
  9185. var hash = 0;
  9186. for (var i = 0; i < namespace.length; i++) {
  9187. hash = (hash << 5) - hash + namespace.charCodeAt(i);
  9188. hash |= 0; // Convert to 32bit integer
  9189. }
  9190. return createDebug.colors[Math.abs(hash) % createDebug.colors.length];
  9191. }
  9192. createDebug.selectColor = selectColor;
  9193. /**
  9194. * Create a debugger with the given `namespace`.
  9195. *
  9196. * @param {String} namespace
  9197. * @return {Function}
  9198. * @api public
  9199. */
  9200. function createDebug(namespace) {
  9201. var prevTime;
  9202. function debug() {
  9203. // Disabled?
  9204. if (!debug.enabled) {
  9205. return;
  9206. }
  9207. for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
  9208. args[_key] = arguments[_key];
  9209. }
  9210. var self = debug; // Set `diff` timestamp
  9211. var curr = Number(new Date());
  9212. var ms = curr - (prevTime || curr);
  9213. self.diff = ms;
  9214. self.prev = prevTime;
  9215. self.curr = curr;
  9216. prevTime = curr;
  9217. args[0] = createDebug.coerce(args[0]);
  9218. if (typeof args[0] !== 'string') {
  9219. // Anything else let's inspect with %O
  9220. args.unshift('%O');
  9221. } // Apply any `formatters` transformations
  9222. var index = 0;
  9223. args[0] = args[0].replace(/%([a-zA-Z%])/g, function (match, format) {
  9224. // If we encounter an escaped % then don't increase the array index
  9225. if (match === '%%') {
  9226. return match;
  9227. }
  9228. index++;
  9229. var formatter = createDebug.formatters[format];
  9230. if (typeof formatter === 'function') {
  9231. var val = args[index];
  9232. match = formatter.call(self, val); // Now we need to remove `args[index]` since it's inlined in the `format`
  9233. args.splice(index, 1);
  9234. index--;
  9235. }
  9236. return match;
  9237. }); // Apply env-specific formatting (colors, etc.)
  9238. createDebug.formatArgs.call(self, args);
  9239. var logFn = self.log || createDebug.log;
  9240. logFn.apply(self, args);
  9241. }
  9242. debug.namespace = namespace;
  9243. debug.enabled = createDebug.enabled(namespace);
  9244. debug.useColors = createDebug.useColors();
  9245. debug.color = selectColor(namespace);
  9246. debug.destroy = destroy;
  9247. debug.extend = extend; // Debug.formatArgs = formatArgs;
  9248. // debug.rawLog = rawLog;
  9249. // env-specific initialization logic for debug instances
  9250. if (typeof createDebug.init === 'function') {
  9251. createDebug.init(debug);
  9252. }
  9253. createDebug.instances.push(debug);
  9254. return debug;
  9255. }
  9256. function destroy() {
  9257. var index = createDebug.instances.indexOf(this);
  9258. if (index !== -1) {
  9259. createDebug.instances.splice(index, 1);
  9260. return true;
  9261. }
  9262. return false;
  9263. }
  9264. function extend(namespace, delimiter) {
  9265. return createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace);
  9266. }
  9267. /**
  9268. * Enables a debug mode by namespaces. This can include modes
  9269. * separated by a colon and wildcards.
  9270. *
  9271. * @param {String} namespaces
  9272. * @api public
  9273. */
  9274. function enable(namespaces) {
  9275. createDebug.save(namespaces);
  9276. createDebug.names = [];
  9277. createDebug.skips = [];
  9278. var i;
  9279. var split = (typeof namespaces === 'string' ? namespaces : '').split(/[\s,]+/);
  9280. var len = split.length;
  9281. for (i = 0; i < len; i++) {
  9282. if (!split[i]) {
  9283. // ignore empty strings
  9284. continue;
  9285. }
  9286. namespaces = split[i].replace(/\*/g, '.*?');
  9287. if (namespaces[0] === '-') {
  9288. createDebug.skips.push(new RegExp('^' + namespaces.substr(1) + '$'));
  9289. } else {
  9290. createDebug.names.push(new RegExp('^' + namespaces + '$'));
  9291. }
  9292. }
  9293. for (i = 0; i < createDebug.instances.length; i++) {
  9294. var instance = createDebug.instances[i];
  9295. instance.enabled = createDebug.enabled(instance.namespace);
  9296. }
  9297. }
  9298. /**
  9299. * Disable debug output.
  9300. *
  9301. * @api public
  9302. */
  9303. function disable() {
  9304. createDebug.enable('');
  9305. }
  9306. /**
  9307. * Returns true if the given mode name is enabled, false otherwise.
  9308. *
  9309. * @param {String} name
  9310. * @return {Boolean}
  9311. * @api public
  9312. */
  9313. function enabled(name) {
  9314. if (name[name.length - 1] === '*') {
  9315. return true;
  9316. }
  9317. var i;
  9318. var len;
  9319. for (i = 0, len = createDebug.skips.length; i < len; i++) {
  9320. if (createDebug.skips[i].test(name)) {
  9321. return false;
  9322. }
  9323. }
  9324. for (i = 0, len = createDebug.names.length; i < len; i++) {
  9325. if (createDebug.names[i].test(name)) {
  9326. return true;
  9327. }
  9328. }
  9329. return false;
  9330. }
  9331. /**
  9332. * Coerce `val`.
  9333. *
  9334. * @param {Mixed} val
  9335. * @return {Mixed}
  9336. * @api private
  9337. */
  9338. function coerce(val) {
  9339. if (val instanceof Error) {
  9340. return val.stack || val.message;
  9341. }
  9342. return val;
  9343. }
  9344. createDebug.enable(createDebug.load());
  9345. return createDebug;
  9346. }
  9347. module.exports = setup;
  9348. },{"ms":60}],47:[function(require,module,exports){
  9349. 'use strict';
  9350. var keys = require('object-keys');
  9351. var hasSymbols = typeof Symbol === 'function' && typeof Symbol('foo') === 'symbol';
  9352. var toStr = Object.prototype.toString;
  9353. var concat = Array.prototype.concat;
  9354. var origDefineProperty = Object.defineProperty;
  9355. var isFunction = function (fn) {
  9356. return typeof fn === 'function' && toStr.call(fn) === '[object Function]';
  9357. };
  9358. var arePropertyDescriptorsSupported = function () {
  9359. var obj = {};
  9360. try {
  9361. origDefineProperty(obj, 'x', { enumerable: false, value: obj });
  9362. // eslint-disable-next-line no-unused-vars, no-restricted-syntax
  9363. for (var _ in obj) { // jscs:ignore disallowUnusedVariables
  9364. return false;
  9365. }
  9366. return obj.x === obj;
  9367. } catch (e) { /* this is IE 8. */
  9368. return false;
  9369. }
  9370. };
  9371. var supportsDescriptors = origDefineProperty && arePropertyDescriptorsSupported();
  9372. var defineProperty = function (object, name, value, predicate) {
  9373. if (name in object && (!isFunction(predicate) || !predicate())) {
  9374. return;
  9375. }
  9376. if (supportsDescriptors) {
  9377. origDefineProperty(object, name, {
  9378. configurable: true,
  9379. enumerable: false,
  9380. value: value,
  9381. writable: true
  9382. });
  9383. } else {
  9384. object[name] = value;
  9385. }
  9386. };
  9387. var defineProperties = function (object, map) {
  9388. var predicates = arguments.length > 2 ? arguments[2] : {};
  9389. var props = keys(map);
  9390. if (hasSymbols) {
  9391. props = concat.call(props, Object.getOwnPropertySymbols(map));
  9392. }
  9393. for (var i = 0; i < props.length; i += 1) {
  9394. defineProperty(object, props[i], map[props[i]], predicates[props[i]]);
  9395. }
  9396. };
  9397. defineProperties.supportsDescriptors = !!supportsDescriptors;
  9398. module.exports = defineProperties;
  9399. },{"object-keys":61}],48:[function(require,module,exports){
  9400. /*!
  9401. diff v3.5.0
  9402. Software License Agreement (BSD License)
  9403. Copyright (c) 2009-2015, Kevin Decker <kpdecker@gmail.com>
  9404. All rights reserved.
  9405. Redistribution and use of this software in source and binary forms, with or without modification,
  9406. are permitted provided that the following conditions are met:
  9407. * Redistributions of source code must retain the above
  9408. copyright notice, this list of conditions and the
  9409. following disclaimer.
  9410. * Redistributions in binary form must reproduce the above
  9411. copyright notice, this list of conditions and the
  9412. following disclaimer in the documentation and/or other
  9413. materials provided with the distribution.
  9414. * Neither the name of Kevin Decker nor the names of its
  9415. contributors may be used to endorse or promote products
  9416. derived from this software without specific prior
  9417. written permission.
  9418. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
  9419. IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
  9420. FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
  9421. CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  9422. DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  9423. DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
  9424. IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  9425. OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  9426. @license
  9427. */
  9428. (function webpackUniversalModuleDefinition(root, factory) {
  9429. if(typeof exports === 'object' && typeof module === 'object')
  9430. module.exports = factory();
  9431. else if(false)
  9432. define([], factory);
  9433. else if(typeof exports === 'object')
  9434. exports["JsDiff"] = factory();
  9435. else
  9436. root["JsDiff"] = factory();
  9437. })(this, function() {
  9438. return /******/ (function(modules) { // webpackBootstrap
  9439. /******/ // The module cache
  9440. /******/ var installedModules = {};
  9441. /******/ // The require function
  9442. /******/ function __webpack_require__(moduleId) {
  9443. /******/ // Check if module is in cache
  9444. /******/ if(installedModules[moduleId])
  9445. /******/ return installedModules[moduleId].exports;
  9446. /******/ // Create a new module (and put it into the cache)
  9447. /******/ var module = installedModules[moduleId] = {
  9448. /******/ exports: {},
  9449. /******/ id: moduleId,
  9450. /******/ loaded: false
  9451. /******/ };
  9452. /******/ // Execute the module function
  9453. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  9454. /******/ // Flag the module as loaded
  9455. /******/ module.loaded = true;
  9456. /******/ // Return the exports of the module
  9457. /******/ return module.exports;
  9458. /******/ }
  9459. /******/ // expose the modules object (__webpack_modules__)
  9460. /******/ __webpack_require__.m = modules;
  9461. /******/ // expose the module cache
  9462. /******/ __webpack_require__.c = installedModules;
  9463. /******/ // __webpack_public_path__
  9464. /******/ __webpack_require__.p = "";
  9465. /******/ // Load entry module and return exports
  9466. /******/ return __webpack_require__(0);
  9467. /******/ })
  9468. /************************************************************************/
  9469. /******/ ([
  9470. /* 0 */
  9471. /***/ (function(module, exports, __webpack_require__) {
  9472. /*istanbul ignore start*/'use strict';
  9473. exports.__esModule = true;
  9474. 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;
  9475. /*istanbul ignore end*/var /*istanbul ignore start*/_base = __webpack_require__(1) /*istanbul ignore end*/;
  9476. /*istanbul ignore start*/var _base2 = _interopRequireDefault(_base);
  9477. /*istanbul ignore end*/var /*istanbul ignore start*/_character = __webpack_require__(2) /*istanbul ignore end*/;
  9478. var /*istanbul ignore start*/_word = __webpack_require__(3) /*istanbul ignore end*/;
  9479. var /*istanbul ignore start*/_line = __webpack_require__(5) /*istanbul ignore end*/;
  9480. var /*istanbul ignore start*/_sentence = __webpack_require__(6) /*istanbul ignore end*/;
  9481. var /*istanbul ignore start*/_css = __webpack_require__(7) /*istanbul ignore end*/;
  9482. var /*istanbul ignore start*/_json = __webpack_require__(8) /*istanbul ignore end*/;
  9483. var /*istanbul ignore start*/_array = __webpack_require__(9) /*istanbul ignore end*/;
  9484. var /*istanbul ignore start*/_apply = __webpack_require__(10) /*istanbul ignore end*/;
  9485. var /*istanbul ignore start*/_parse = __webpack_require__(11) /*istanbul ignore end*/;
  9486. var /*istanbul ignore start*/_merge = __webpack_require__(13) /*istanbul ignore end*/;
  9487. var /*istanbul ignore start*/_create = __webpack_require__(14) /*istanbul ignore end*/;
  9488. var /*istanbul ignore start*/_dmp = __webpack_require__(16) /*istanbul ignore end*/;
  9489. var /*istanbul ignore start*/_xml = __webpack_require__(17) /*istanbul ignore end*/;
  9490. /*istanbul ignore start*/function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
  9491. /* See LICENSE file for terms of use */
  9492. /*
  9493. * Text diff implementation.
  9494. *
  9495. * This library supports the following APIS:
  9496. * JsDiff.diffChars: Character by character diff
  9497. * JsDiff.diffWords: Word (as defined by \b regex) diff which ignores whitespace
  9498. * JsDiff.diffLines: Line based diff
  9499. *
  9500. * JsDiff.diffCss: Diff targeted at CSS content
  9501. *
  9502. * These methods are based on the implementation proposed in
  9503. * "An O(ND) Difference Algorithm and its Variations" (Myers, 1986).
  9504. * http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.4.6927
  9505. */
  9506. exports. /*istanbul ignore end*/Diff = _base2['default'];
  9507. /*istanbul ignore start*/exports. /*istanbul ignore end*/diffChars = _character.diffChars;
  9508. /*istanbul ignore start*/exports. /*istanbul ignore end*/diffWords = _word.diffWords;
  9509. /*istanbul ignore start*/exports. /*istanbul ignore end*/diffWordsWithSpace = _word.diffWordsWithSpace;
  9510. /*istanbul ignore start*/exports. /*istanbul ignore end*/diffLines = _line.diffLines;
  9511. /*istanbul ignore start*/exports. /*istanbul ignore end*/diffTrimmedLines = _line.diffTrimmedLines;
  9512. /*istanbul ignore start*/exports. /*istanbul ignore end*/diffSentences = _sentence.diffSentences;
  9513. /*istanbul ignore start*/exports. /*istanbul ignore end*/diffCss = _css.diffCss;
  9514. /*istanbul ignore start*/exports. /*istanbul ignore end*/diffJson = _json.diffJson;
  9515. /*istanbul ignore start*/exports. /*istanbul ignore end*/diffArrays = _array.diffArrays;
  9516. /*istanbul ignore start*/exports. /*istanbul ignore end*/structuredPatch = _create.structuredPatch;
  9517. /*istanbul ignore start*/exports. /*istanbul ignore end*/createTwoFilesPatch = _create.createTwoFilesPatch;
  9518. /*istanbul ignore start*/exports. /*istanbul ignore end*/createPatch = _create.createPatch;
  9519. /*istanbul ignore start*/exports. /*istanbul ignore end*/applyPatch = _apply.applyPatch;
  9520. /*istanbul ignore start*/exports. /*istanbul ignore end*/applyPatches = _apply.applyPatches;
  9521. /*istanbul ignore start*/exports. /*istanbul ignore end*/parsePatch = _parse.parsePatch;
  9522. /*istanbul ignore start*/exports. /*istanbul ignore end*/merge = _merge.merge;
  9523. /*istanbul ignore start*/exports. /*istanbul ignore end*/convertChangesToDMP = _dmp.convertChangesToDMP;
  9524. /*istanbul ignore start*/exports. /*istanbul ignore end*/convertChangesToXML = _xml.convertChangesToXML;
  9525. /*istanbul ignore start*/exports. /*istanbul ignore end*/canonicalize = _json.canonicalize;
  9526. /***/ }),
  9527. /* 1 */
  9528. /***/ (function(module, exports) {
  9529. /*istanbul ignore start*/'use strict';
  9530. exports.__esModule = true;
  9531. exports['default'] = /*istanbul ignore end*/Diff;
  9532. function Diff() {}
  9533. Diff.prototype = {
  9534. /*istanbul ignore start*/ /*istanbul ignore end*/diff: function diff(oldString, newString) {
  9535. /*istanbul ignore start*/var /*istanbul ignore end*/options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  9536. var callback = options.callback;
  9537. if (typeof options === 'function') {
  9538. callback = options;
  9539. options = {};
  9540. }
  9541. this.options = options;
  9542. var self = this;
  9543. function done(value) {
  9544. if (callback) {
  9545. setTimeout(function () {
  9546. callback(undefined, value);
  9547. }, 0);
  9548. return true;
  9549. } else {
  9550. return value;
  9551. }
  9552. }
  9553. // Allow subclasses to massage the input prior to running
  9554. oldString = this.castInput(oldString);
  9555. newString = this.castInput(newString);
  9556. oldString = this.removeEmpty(this.tokenize(oldString));
  9557. newString = this.removeEmpty(this.tokenize(newString));
  9558. var newLen = newString.length,
  9559. oldLen = oldString.length;
  9560. var editLength = 1;
  9561. var maxEditLength = newLen + oldLen;
  9562. var bestPath = [{ newPos: -1, components: [] }];
  9563. // Seed editLength = 0, i.e. the content starts with the same values
  9564. var oldPos = this.extractCommon(bestPath[0], newString, oldString, 0);
  9565. if (bestPath[0].newPos + 1 >= newLen && oldPos + 1 >= oldLen) {
  9566. // Identity per the equality and tokenizer
  9567. return done([{ value: this.join(newString), count: newString.length }]);
  9568. }
  9569. // Main worker method. checks all permutations of a given edit length for acceptance.
  9570. function execEditLength() {
  9571. for (var diagonalPath = -1 * editLength; diagonalPath <= editLength; diagonalPath += 2) {
  9572. var basePath = /*istanbul ignore start*/void 0 /*istanbul ignore end*/;
  9573. var addPath = bestPath[diagonalPath - 1],
  9574. removePath = bestPath[diagonalPath + 1],
  9575. _oldPos = (removePath ? removePath.newPos : 0) - diagonalPath;
  9576. if (addPath) {
  9577. // No one else is going to attempt to use this value, clear it
  9578. bestPath[diagonalPath - 1] = undefined;
  9579. }
  9580. var canAdd = addPath && addPath.newPos + 1 < newLen,
  9581. canRemove = removePath && 0 <= _oldPos && _oldPos < oldLen;
  9582. if (!canAdd && !canRemove) {
  9583. // If this path is a terminal then prune
  9584. bestPath[diagonalPath] = undefined;
  9585. continue;
  9586. }
  9587. // Select the diagonal that we want to branch from. We select the prior
  9588. // path whose position in the new string is the farthest from the origin
  9589. // and does not pass the bounds of the diff graph
  9590. if (!canAdd || canRemove && addPath.newPos < removePath.newPos) {
  9591. basePath = clonePath(removePath);
  9592. self.pushComponent(basePath.components, undefined, true);
  9593. } else {
  9594. basePath = addPath; // No need to clone, we've pulled it from the list
  9595. basePath.newPos++;
  9596. self.pushComponent(basePath.components, true, undefined);
  9597. }
  9598. _oldPos = self.extractCommon(basePath, newString, oldString, diagonalPath);
  9599. // If we have hit the end of both strings, then we are done
  9600. if (basePath.newPos + 1 >= newLen && _oldPos + 1 >= oldLen) {
  9601. return done(buildValues(self, basePath.components, newString, oldString, self.useLongestToken));
  9602. } else {
  9603. // Otherwise track this path as a potential candidate and continue.
  9604. bestPath[diagonalPath] = basePath;
  9605. }
  9606. }
  9607. editLength++;
  9608. }
  9609. // Performs the length of edit iteration. Is a bit fugly as this has to support the
  9610. // sync and async mode which is never fun. Loops over execEditLength until a value
  9611. // is produced.
  9612. if (callback) {
  9613. (function exec() {
  9614. setTimeout(function () {
  9615. // This should not happen, but we want to be safe.
  9616. /* istanbul ignore next */
  9617. if (editLength > maxEditLength) {
  9618. return callback();
  9619. }
  9620. if (!execEditLength()) {
  9621. exec();
  9622. }
  9623. }, 0);
  9624. })();
  9625. } else {
  9626. while (editLength <= maxEditLength) {
  9627. var ret = execEditLength();
  9628. if (ret) {
  9629. return ret;
  9630. }
  9631. }
  9632. }
  9633. },
  9634. /*istanbul ignore start*/ /*istanbul ignore end*/pushComponent: function pushComponent(components, added, removed) {
  9635. var last = components[components.length - 1];
  9636. if (last && last.added === added && last.removed === removed) {
  9637. // We need to clone here as the component clone operation is just
  9638. // as shallow array clone
  9639. components[components.length - 1] = { count: last.count + 1, added: added, removed: removed };
  9640. } else {
  9641. components.push({ count: 1, added: added, removed: removed });
  9642. }
  9643. },
  9644. /*istanbul ignore start*/ /*istanbul ignore end*/extractCommon: function extractCommon(basePath, newString, oldString, diagonalPath) {
  9645. var newLen = newString.length,
  9646. oldLen = oldString.length,
  9647. newPos = basePath.newPos,
  9648. oldPos = newPos - diagonalPath,
  9649. commonCount = 0;
  9650. while (newPos + 1 < newLen && oldPos + 1 < oldLen && this.equals(newString[newPos + 1], oldString[oldPos + 1])) {
  9651. newPos++;
  9652. oldPos++;
  9653. commonCount++;
  9654. }
  9655. if (commonCount) {
  9656. basePath.components.push({ count: commonCount });
  9657. }
  9658. basePath.newPos = newPos;
  9659. return oldPos;
  9660. },
  9661. /*istanbul ignore start*/ /*istanbul ignore end*/equals: function equals(left, right) {
  9662. if (this.options.comparator) {
  9663. return this.options.comparator(left, right);
  9664. } else {
  9665. return left === right || this.options.ignoreCase && left.toLowerCase() === right.toLowerCase();
  9666. }
  9667. },
  9668. /*istanbul ignore start*/ /*istanbul ignore end*/removeEmpty: function removeEmpty(array) {
  9669. var ret = [];
  9670. for (var i = 0; i < array.length; i++) {
  9671. if (array[i]) {
  9672. ret.push(array[i]);
  9673. }
  9674. }
  9675. return ret;
  9676. },
  9677. /*istanbul ignore start*/ /*istanbul ignore end*/castInput: function castInput(value) {
  9678. return value;
  9679. },
  9680. /*istanbul ignore start*/ /*istanbul ignore end*/tokenize: function tokenize(value) {
  9681. return value.split('');
  9682. },
  9683. /*istanbul ignore start*/ /*istanbul ignore end*/join: function join(chars) {
  9684. return chars.join('');
  9685. }
  9686. };
  9687. function buildValues(diff, components, newString, oldString, useLongestToken) {
  9688. var componentPos = 0,
  9689. componentLen = components.length,
  9690. newPos = 0,
  9691. oldPos = 0;
  9692. for (; componentPos < componentLen; componentPos++) {
  9693. var component = components[componentPos];
  9694. if (!component.removed) {
  9695. if (!component.added && useLongestToken) {
  9696. var value = newString.slice(newPos, newPos + component.count);
  9697. value = value.map(function (value, i) {
  9698. var oldValue = oldString[oldPos + i];
  9699. return oldValue.length > value.length ? oldValue : value;
  9700. });
  9701. component.value = diff.join(value);
  9702. } else {
  9703. component.value = diff.join(newString.slice(newPos, newPos + component.count));
  9704. }
  9705. newPos += component.count;
  9706. // Common case
  9707. if (!component.added) {
  9708. oldPos += component.count;
  9709. }
  9710. } else {
  9711. component.value = diff.join(oldString.slice(oldPos, oldPos + component.count));
  9712. oldPos += component.count;
  9713. // Reverse add and remove so removes are output first to match common convention
  9714. // The diffing algorithm is tied to add then remove output and this is the simplest
  9715. // route to get the desired output with minimal overhead.
  9716. if (componentPos && components[componentPos - 1].added) {
  9717. var tmp = components[componentPos - 1];
  9718. components[componentPos - 1] = components[componentPos];
  9719. components[componentPos] = tmp;
  9720. }
  9721. }
  9722. }
  9723. // Special case handle for when one terminal is ignored (i.e. whitespace).
  9724. // For this case we merge the terminal into the prior string and drop the change.
  9725. // This is only available for string mode.
  9726. var lastComponent = components[componentLen - 1];
  9727. if (componentLen > 1 && typeof lastComponent.value === 'string' && (lastComponent.added || lastComponent.removed) && diff.equals('', lastComponent.value)) {
  9728. components[componentLen - 2].value += lastComponent.value;
  9729. components.pop();
  9730. }
  9731. return components;
  9732. }
  9733. function clonePath(path) {
  9734. return { newPos: path.newPos, components: path.components.slice(0) };
  9735. }
  9736. /***/ }),
  9737. /* 2 */
  9738. /***/ (function(module, exports, __webpack_require__) {
  9739. /*istanbul ignore start*/'use strict';
  9740. exports.__esModule = true;
  9741. exports.characterDiff = undefined;
  9742. exports. /*istanbul ignore end*/diffChars = diffChars;
  9743. var /*istanbul ignore start*/_base = __webpack_require__(1) /*istanbul ignore end*/;
  9744. /*istanbul ignore start*/var _base2 = _interopRequireDefault(_base);
  9745. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
  9746. /*istanbul ignore end*/var characterDiff = /*istanbul ignore start*/exports. /*istanbul ignore end*/characterDiff = new /*istanbul ignore start*/_base2['default'] /*istanbul ignore end*/();
  9747. function diffChars(oldStr, newStr, options) {
  9748. return characterDiff.diff(oldStr, newStr, options);
  9749. }
  9750. /***/ }),
  9751. /* 3 */
  9752. /***/ (function(module, exports, __webpack_require__) {
  9753. /*istanbul ignore start*/'use strict';
  9754. exports.__esModule = true;
  9755. exports.wordDiff = undefined;
  9756. exports. /*istanbul ignore end*/diffWords = diffWords;
  9757. /*istanbul ignore start*/exports. /*istanbul ignore end*/diffWordsWithSpace = diffWordsWithSpace;
  9758. var /*istanbul ignore start*/_base = __webpack_require__(1) /*istanbul ignore end*/;
  9759. /*istanbul ignore start*/var _base2 = _interopRequireDefault(_base);
  9760. /*istanbul ignore end*/var /*istanbul ignore start*/_params = __webpack_require__(4) /*istanbul ignore end*/;
  9761. /*istanbul ignore start*/function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
  9762. /*istanbul ignore end*/ // Based on https://en.wikipedia.org/wiki/Latin_script_in_Unicode
  9763. //
  9764. // Ranges and exceptions:
  9765. // Latin-1 Supplement, 0080–00FF
  9766. // - U+00D7 × Multiplication sign
  9767. // - U+00F7 ÷ Division sign
  9768. // Latin Extended-A, 0100–017F
  9769. // Latin Extended-B, 0180–024F
  9770. // IPA Extensions, 0250–02AF
  9771. // Spacing Modifier Letters, 02B0–02FF
  9772. // - U+02C7 ˇ &#711; Caron
  9773. // - U+02D8 ˘ &#728; Breve
  9774. // - U+02D9 ˙ &#729; Dot Above
  9775. // - U+02DA ˚ &#730; Ring Above
  9776. // - U+02DB ˛ &#731; Ogonek
  9777. // - U+02DC ˜ &#732; Small Tilde
  9778. // - U+02DD ˝ &#733; Double Acute Accent
  9779. // Latin Extended Additional, 1E00–1EFF
  9780. var extendedWordChars = /^[A-Za-z\xC0-\u02C6\u02C8-\u02D7\u02DE-\u02FF\u1E00-\u1EFF]+$/;
  9781. var reWhitespace = /\S/;
  9782. var wordDiff = /*istanbul ignore start*/exports. /*istanbul ignore end*/wordDiff = new /*istanbul ignore start*/_base2['default'] /*istanbul ignore end*/();
  9783. wordDiff.equals = function (left, right) {
  9784. if (this.options.ignoreCase) {
  9785. left = left.toLowerCase();
  9786. right = right.toLowerCase();
  9787. }
  9788. return left === right || this.options.ignoreWhitespace && !reWhitespace.test(left) && !reWhitespace.test(right);
  9789. };
  9790. wordDiff.tokenize = function (value) {
  9791. var tokens = value.split(/(\s+|\b)/);
  9792. // Join the boundary splits that we do not consider to be boundaries. This is primarily the extended Latin character set.
  9793. for (var i = 0; i < tokens.length - 1; i++) {
  9794. // If we have an empty string in the next field and we have only word chars before and after, merge
  9795. if (!tokens[i + 1] && tokens[i + 2] && extendedWordChars.test(tokens[i]) && extendedWordChars.test(tokens[i + 2])) {
  9796. tokens[i] += tokens[i + 2];
  9797. tokens.splice(i + 1, 2);
  9798. i--;
  9799. }
  9800. }
  9801. return tokens;
  9802. };
  9803. function diffWords(oldStr, newStr, options) {
  9804. options = /*istanbul ignore start*/(0, _params.generateOptions) /*istanbul ignore end*/(options, { ignoreWhitespace: true });
  9805. return wordDiff.diff(oldStr, newStr, options);
  9806. }
  9807. function diffWordsWithSpace(oldStr, newStr, options) {
  9808. return wordDiff.diff(oldStr, newStr, options);
  9809. }
  9810. /***/ }),
  9811. /* 4 */
  9812. /***/ (function(module, exports) {
  9813. /*istanbul ignore start*/'use strict';
  9814. exports.__esModule = true;
  9815. exports. /*istanbul ignore end*/generateOptions = generateOptions;
  9816. function generateOptions(options, defaults) {
  9817. if (typeof options === 'function') {
  9818. defaults.callback = options;
  9819. } else if (options) {
  9820. for (var name in options) {
  9821. /* istanbul ignore else */
  9822. if (options.hasOwnProperty(name)) {
  9823. defaults[name] = options[name];
  9824. }
  9825. }
  9826. }
  9827. return defaults;
  9828. }
  9829. /***/ }),
  9830. /* 5 */
  9831. /***/ (function(module, exports, __webpack_require__) {
  9832. /*istanbul ignore start*/'use strict';
  9833. exports.__esModule = true;
  9834. exports.lineDiff = undefined;
  9835. exports. /*istanbul ignore end*/diffLines = diffLines;
  9836. /*istanbul ignore start*/exports. /*istanbul ignore end*/diffTrimmedLines = diffTrimmedLines;
  9837. var /*istanbul ignore start*/_base = __webpack_require__(1) /*istanbul ignore end*/;
  9838. /*istanbul ignore start*/var _base2 = _interopRequireDefault(_base);
  9839. /*istanbul ignore end*/var /*istanbul ignore start*/_params = __webpack_require__(4) /*istanbul ignore end*/;
  9840. /*istanbul ignore start*/function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
  9841. /*istanbul ignore end*/var lineDiff = /*istanbul ignore start*/exports. /*istanbul ignore end*/lineDiff = new /*istanbul ignore start*/_base2['default'] /*istanbul ignore end*/();
  9842. lineDiff.tokenize = function (value) {
  9843. var retLines = [],
  9844. linesAndNewlines = value.split(/(\n|\r\n)/);
  9845. // Ignore the final empty token that occurs if the string ends with a new line
  9846. if (!linesAndNewlines[linesAndNewlines.length - 1]) {
  9847. linesAndNewlines.pop();
  9848. }
  9849. // Merge the content and line separators into single tokens
  9850. for (var i = 0; i < linesAndNewlines.length; i++) {
  9851. var line = linesAndNewlines[i];
  9852. if (i % 2 && !this.options.newlineIsToken) {
  9853. retLines[retLines.length - 1] += line;
  9854. } else {
  9855. if (this.options.ignoreWhitespace) {
  9856. line = line.trim();
  9857. }
  9858. retLines.push(line);
  9859. }
  9860. }
  9861. return retLines;
  9862. };
  9863. function diffLines(oldStr, newStr, callback) {
  9864. return lineDiff.diff(oldStr, newStr, callback);
  9865. }
  9866. function diffTrimmedLines(oldStr, newStr, callback) {
  9867. var options = /*istanbul ignore start*/(0, _params.generateOptions) /*istanbul ignore end*/(callback, { ignoreWhitespace: true });
  9868. return lineDiff.diff(oldStr, newStr, options);
  9869. }
  9870. /***/ }),
  9871. /* 6 */
  9872. /***/ (function(module, exports, __webpack_require__) {
  9873. /*istanbul ignore start*/'use strict';
  9874. exports.__esModule = true;
  9875. exports.sentenceDiff = undefined;
  9876. exports. /*istanbul ignore end*/diffSentences = diffSentences;
  9877. var /*istanbul ignore start*/_base = __webpack_require__(1) /*istanbul ignore end*/;
  9878. /*istanbul ignore start*/var _base2 = _interopRequireDefault(_base);
  9879. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
  9880. /*istanbul ignore end*/var sentenceDiff = /*istanbul ignore start*/exports. /*istanbul ignore end*/sentenceDiff = new /*istanbul ignore start*/_base2['default'] /*istanbul ignore end*/();
  9881. sentenceDiff.tokenize = function (value) {
  9882. return value.split(/(\S.+?[.!?])(?=\s+|$)/);
  9883. };
  9884. function diffSentences(oldStr, newStr, callback) {
  9885. return sentenceDiff.diff(oldStr, newStr, callback);
  9886. }
  9887. /***/ }),
  9888. /* 7 */
  9889. /***/ (function(module, exports, __webpack_require__) {
  9890. /*istanbul ignore start*/'use strict';
  9891. exports.__esModule = true;
  9892. exports.cssDiff = undefined;
  9893. exports. /*istanbul ignore end*/diffCss = diffCss;
  9894. var /*istanbul ignore start*/_base = __webpack_require__(1) /*istanbul ignore end*/;
  9895. /*istanbul ignore start*/var _base2 = _interopRequireDefault(_base);
  9896. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
  9897. /*istanbul ignore end*/var cssDiff = /*istanbul ignore start*/exports. /*istanbul ignore end*/cssDiff = new /*istanbul ignore start*/_base2['default'] /*istanbul ignore end*/();
  9898. cssDiff.tokenize = function (value) {
  9899. return value.split(/([{}:;,]|\s+)/);
  9900. };
  9901. function diffCss(oldStr, newStr, callback) {
  9902. return cssDiff.diff(oldStr, newStr, callback);
  9903. }
  9904. /***/ }),
  9905. /* 8 */
  9906. /***/ (function(module, exports, __webpack_require__) {
  9907. /*istanbul ignore start*/'use strict';
  9908. exports.__esModule = true;
  9909. exports.jsonDiff = undefined;
  9910. 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; };
  9911. exports. /*istanbul ignore end*/diffJson = diffJson;
  9912. /*istanbul ignore start*/exports. /*istanbul ignore end*/canonicalize = canonicalize;
  9913. var /*istanbul ignore start*/_base = __webpack_require__(1) /*istanbul ignore end*/;
  9914. /*istanbul ignore start*/var _base2 = _interopRequireDefault(_base);
  9915. /*istanbul ignore end*/var /*istanbul ignore start*/_line = __webpack_require__(5) /*istanbul ignore end*/;
  9916. /*istanbul ignore start*/function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
  9917. /*istanbul ignore end*/var objectPrototypeToString = Object.prototype.toString;
  9918. var jsonDiff = /*istanbul ignore start*/exports. /*istanbul ignore end*/jsonDiff = new /*istanbul ignore start*/_base2['default'] /*istanbul ignore end*/();
  9919. // Discriminate between two lines of pretty-printed, serialized JSON where one of them has a
  9920. // dangling comma and the other doesn't. Turns out including the dangling comma yields the nicest output:
  9921. jsonDiff.useLongestToken = true;
  9922. jsonDiff.tokenize = /*istanbul ignore start*/_line.lineDiff /*istanbul ignore end*/.tokenize;
  9923. jsonDiff.castInput = function (value) {
  9924. /*istanbul ignore start*/var _options = /*istanbul ignore end*/this.options,
  9925. undefinedReplacement = _options.undefinedReplacement,
  9926. _options$stringifyRep = _options.stringifyReplacer,
  9927. stringifyReplacer = _options$stringifyRep === undefined ? function (k, v) /*istanbul ignore start*/{
  9928. return (/*istanbul ignore end*/typeof v === 'undefined' ? undefinedReplacement : v
  9929. );
  9930. } : _options$stringifyRep;
  9931. return typeof value === 'string' ? value : JSON.stringify(canonicalize(value, null, null, stringifyReplacer), stringifyReplacer, ' ');
  9932. };
  9933. jsonDiff.equals = function (left, right) {
  9934. 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'))
  9935. );
  9936. };
  9937. function diffJson(oldObj, newObj, options) {
  9938. return jsonDiff.diff(oldObj, newObj, options);
  9939. }
  9940. // This function handles the presence of circular references by bailing out when encountering an
  9941. // object that is already on the "stack" of items being processed. Accepts an optional replacer
  9942. function canonicalize(obj, stack, replacementStack, replacer, key) {
  9943. stack = stack || [];
  9944. replacementStack = replacementStack || [];
  9945. if (replacer) {
  9946. obj = replacer(key, obj);
  9947. }
  9948. var i = /*istanbul ignore start*/void 0 /*istanbul ignore end*/;
  9949. for (i = 0; i < stack.length; i += 1) {
  9950. if (stack[i] === obj) {
  9951. return replacementStack[i];
  9952. }
  9953. }
  9954. var canonicalizedObj = /*istanbul ignore start*/void 0 /*istanbul ignore end*/;
  9955. if ('[object Array]' === objectPrototypeToString.call(obj)) {
  9956. stack.push(obj);
  9957. canonicalizedObj = new Array(obj.length);
  9958. replacementStack.push(canonicalizedObj);
  9959. for (i = 0; i < obj.length; i += 1) {
  9960. canonicalizedObj[i] = canonicalize(obj[i], stack, replacementStack, replacer, key);
  9961. }
  9962. stack.pop();
  9963. replacementStack.pop();
  9964. return canonicalizedObj;
  9965. }
  9966. if (obj && obj.toJSON) {
  9967. obj = obj.toJSON();
  9968. }
  9969. if ( /*istanbul ignore start*/(typeof /*istanbul ignore end*/obj === 'undefined' ? 'undefined' : _typeof(obj)) === 'object' && obj !== null) {
  9970. stack.push(obj);
  9971. canonicalizedObj = {};
  9972. replacementStack.push(canonicalizedObj);
  9973. var sortedKeys = [],
  9974. _key = /*istanbul ignore start*/void 0 /*istanbul ignore end*/;
  9975. for (_key in obj) {
  9976. /* istanbul ignore else */
  9977. if (obj.hasOwnProperty(_key)) {
  9978. sortedKeys.push(_key);
  9979. }
  9980. }
  9981. sortedKeys.sort();
  9982. for (i = 0; i < sortedKeys.length; i += 1) {
  9983. _key = sortedKeys[i];
  9984. canonicalizedObj[_key] = canonicalize(obj[_key], stack, replacementStack, replacer, _key);
  9985. }
  9986. stack.pop();
  9987. replacementStack.pop();
  9988. } else {
  9989. canonicalizedObj = obj;
  9990. }
  9991. return canonicalizedObj;
  9992. }
  9993. /***/ }),
  9994. /* 9 */
  9995. /***/ (function(module, exports, __webpack_require__) {
  9996. /*istanbul ignore start*/'use strict';
  9997. exports.__esModule = true;
  9998. exports.arrayDiff = undefined;
  9999. exports. /*istanbul ignore end*/diffArrays = diffArrays;
  10000. var /*istanbul ignore start*/_base = __webpack_require__(1) /*istanbul ignore end*/;
  10001. /*istanbul ignore start*/var _base2 = _interopRequireDefault(_base);
  10002. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
  10003. /*istanbul ignore end*/var arrayDiff = /*istanbul ignore start*/exports. /*istanbul ignore end*/arrayDiff = new /*istanbul ignore start*/_base2['default'] /*istanbul ignore end*/();
  10004. arrayDiff.tokenize = function (value) {
  10005. return value.slice();
  10006. };
  10007. arrayDiff.join = arrayDiff.removeEmpty = function (value) {
  10008. return value;
  10009. };
  10010. function diffArrays(oldArr, newArr, callback) {
  10011. return arrayDiff.diff(oldArr, newArr, callback);
  10012. }
  10013. /***/ }),
  10014. /* 10 */
  10015. /***/ (function(module, exports, __webpack_require__) {
  10016. /*istanbul ignore start*/'use strict';
  10017. exports.__esModule = true;
  10018. exports. /*istanbul ignore end*/applyPatch = applyPatch;
  10019. /*istanbul ignore start*/exports. /*istanbul ignore end*/applyPatches = applyPatches;
  10020. var /*istanbul ignore start*/_parse = __webpack_require__(11) /*istanbul ignore end*/;
  10021. var /*istanbul ignore start*/_distanceIterator = __webpack_require__(12) /*istanbul ignore end*/;
  10022. /*istanbul ignore start*/var _distanceIterator2 = _interopRequireDefault(_distanceIterator);
  10023. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
  10024. /*istanbul ignore end*/function applyPatch(source, uniDiff) {
  10025. /*istanbul ignore start*/var /*istanbul ignore end*/options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  10026. if (typeof uniDiff === 'string') {
  10027. uniDiff = /*istanbul ignore start*/(0, _parse.parsePatch) /*istanbul ignore end*/(uniDiff);
  10028. }
  10029. if (Array.isArray(uniDiff)) {
  10030. if (uniDiff.length > 1) {
  10031. throw new Error('applyPatch only works with a single input.');
  10032. }
  10033. uniDiff = uniDiff[0];
  10034. }
  10035. // Apply the diff to the input
  10036. var lines = source.split(/\r\n|[\n\v\f\r\x85]/),
  10037. delimiters = source.match(/\r\n|[\n\v\f\r\x85]/g) || [],
  10038. hunks = uniDiff.hunks,
  10039. compareLine = options.compareLine || function (lineNumber, line, operation, patchContent) /*istanbul ignore start*/{
  10040. return (/*istanbul ignore end*/line === patchContent
  10041. );
  10042. },
  10043. errorCount = 0,
  10044. fuzzFactor = options.fuzzFactor || 0,
  10045. minLine = 0,
  10046. offset = 0,
  10047. removeEOFNL = /*istanbul ignore start*/void 0 /*istanbul ignore end*/,
  10048. addEOFNL = /*istanbul ignore start*/void 0 /*istanbul ignore end*/;
  10049. /**
  10050. * Checks if the hunk exactly fits on the provided location
  10051. */
  10052. function hunkFits(hunk, toPos) {
  10053. for (var j = 0; j < hunk.lines.length; j++) {
  10054. var line = hunk.lines[j],
  10055. operation = line.length > 0 ? line[0] : ' ',
  10056. content = line.length > 0 ? line.substr(1) : line;
  10057. if (operation === ' ' || operation === '-') {
  10058. // Context sanity check
  10059. if (!compareLine(toPos + 1, lines[toPos], operation, content)) {
  10060. errorCount++;
  10061. if (errorCount > fuzzFactor) {
  10062. return false;
  10063. }
  10064. }
  10065. toPos++;
  10066. }
  10067. }
  10068. return true;
  10069. }
  10070. // Search best fit offsets for each hunk based on the previous ones
  10071. for (var i = 0; i < hunks.length; i++) {
  10072. var hunk = hunks[i],
  10073. maxLine = lines.length - hunk.oldLines,
  10074. localOffset = 0,
  10075. toPos = offset + hunk.oldStart - 1;
  10076. var iterator = /*istanbul ignore start*/(0, _distanceIterator2['default']) /*istanbul ignore end*/(toPos, minLine, maxLine);
  10077. for (; localOffset !== undefined; localOffset = iterator()) {
  10078. if (hunkFits(hunk, toPos + localOffset)) {
  10079. hunk.offset = offset += localOffset;
  10080. break;
  10081. }
  10082. }
  10083. if (localOffset === undefined) {
  10084. return false;
  10085. }
  10086. // Set lower text limit to end of the current hunk, so next ones don't try
  10087. // to fit over already patched text
  10088. minLine = hunk.offset + hunk.oldStart + hunk.oldLines;
  10089. }
  10090. // Apply patch hunks
  10091. var diffOffset = 0;
  10092. for (var _i = 0; _i < hunks.length; _i++) {
  10093. var _hunk = hunks[_i],
  10094. _toPos = _hunk.oldStart + _hunk.offset + diffOffset - 1;
  10095. diffOffset += _hunk.newLines - _hunk.oldLines;
  10096. if (_toPos < 0) {
  10097. // Creating a new file
  10098. _toPos = 0;
  10099. }
  10100. for (var j = 0; j < _hunk.lines.length; j++) {
  10101. var line = _hunk.lines[j],
  10102. operation = line.length > 0 ? line[0] : ' ',
  10103. content = line.length > 0 ? line.substr(1) : line,
  10104. delimiter = _hunk.linedelimiters[j];
  10105. if (operation === ' ') {
  10106. _toPos++;
  10107. } else if (operation === '-') {
  10108. lines.splice(_toPos, 1);
  10109. delimiters.splice(_toPos, 1);
  10110. /* istanbul ignore else */
  10111. } else if (operation === '+') {
  10112. lines.splice(_toPos, 0, content);
  10113. delimiters.splice(_toPos, 0, delimiter);
  10114. _toPos++;
  10115. } else if (operation === '\\') {
  10116. var previousOperation = _hunk.lines[j - 1] ? _hunk.lines[j - 1][0] : null;
  10117. if (previousOperation === '+') {
  10118. removeEOFNL = true;
  10119. } else if (previousOperation === '-') {
  10120. addEOFNL = true;
  10121. }
  10122. }
  10123. }
  10124. }
  10125. // Handle EOFNL insertion/removal
  10126. if (removeEOFNL) {
  10127. while (!lines[lines.length - 1]) {
  10128. lines.pop();
  10129. delimiters.pop();
  10130. }
  10131. } else if (addEOFNL) {
  10132. lines.push('');
  10133. delimiters.push('\n');
  10134. }
  10135. for (var _k = 0; _k < lines.length - 1; _k++) {
  10136. lines[_k] = lines[_k] + delimiters[_k];
  10137. }
  10138. return lines.join('');
  10139. }
  10140. // Wrapper that supports multiple file patches via callbacks.
  10141. function applyPatches(uniDiff, options) {
  10142. if (typeof uniDiff === 'string') {
  10143. uniDiff = /*istanbul ignore start*/(0, _parse.parsePatch) /*istanbul ignore end*/(uniDiff);
  10144. }
  10145. var currentIndex = 0;
  10146. function processIndex() {
  10147. var index = uniDiff[currentIndex++];
  10148. if (!index) {
  10149. return options.complete();
  10150. }
  10151. options.loadFile(index, function (err, data) {
  10152. if (err) {
  10153. return options.complete(err);
  10154. }
  10155. var updatedContent = applyPatch(data, index, options);
  10156. options.patched(index, updatedContent, function (err) {
  10157. if (err) {
  10158. return options.complete(err);
  10159. }
  10160. processIndex();
  10161. });
  10162. });
  10163. }
  10164. processIndex();
  10165. }
  10166. /***/ }),
  10167. /* 11 */
  10168. /***/ (function(module, exports) {
  10169. /*istanbul ignore start*/'use strict';
  10170. exports.__esModule = true;
  10171. exports. /*istanbul ignore end*/parsePatch = parsePatch;
  10172. function parsePatch(uniDiff) {
  10173. /*istanbul ignore start*/var /*istanbul ignore end*/options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  10174. var diffstr = uniDiff.split(/\r\n|[\n\v\f\r\x85]/),
  10175. delimiters = uniDiff.match(/\r\n|[\n\v\f\r\x85]/g) || [],
  10176. list = [],
  10177. i = 0;
  10178. function parseIndex() {
  10179. var index = {};
  10180. list.push(index);
  10181. // Parse diff metadata
  10182. while (i < diffstr.length) {
  10183. var line = diffstr[i];
  10184. // File header found, end parsing diff metadata
  10185. if (/^(\-\-\-|\+\+\+|@@)\s/.test(line)) {
  10186. break;
  10187. }
  10188. // Diff index
  10189. var header = /^(?:Index:|diff(?: -r \w+)+)\s+(.+?)\s*$/.exec(line);
  10190. if (header) {
  10191. index.index = header[1];
  10192. }
  10193. i++;
  10194. }
  10195. // Parse file headers if they are defined. Unified diff requires them, but
  10196. // there's no technical issues to have an isolated hunk without file header
  10197. parseFileHeader(index);
  10198. parseFileHeader(index);
  10199. // Parse hunks
  10200. index.hunks = [];
  10201. while (i < diffstr.length) {
  10202. var _line = diffstr[i];
  10203. if (/^(Index:|diff|\-\-\-|\+\+\+)\s/.test(_line)) {
  10204. break;
  10205. } else if (/^@@/.test(_line)) {
  10206. index.hunks.push(parseHunk());
  10207. } else if (_line && options.strict) {
  10208. // Ignore unexpected content unless in strict mode
  10209. throw new Error('Unknown line ' + (i + 1) + ' ' + JSON.stringify(_line));
  10210. } else {
  10211. i++;
  10212. }
  10213. }
  10214. }
  10215. // Parses the --- and +++ headers, if none are found, no lines
  10216. // are consumed.
  10217. function parseFileHeader(index) {
  10218. var fileHeader = /^(---|\+\+\+)\s+(.*)$/.exec(diffstr[i]);
  10219. if (fileHeader) {
  10220. var keyPrefix = fileHeader[1] === '---' ? 'old' : 'new';
  10221. var data = fileHeader[2].split('\t', 2);
  10222. var fileName = data[0].replace(/\\\\/g, '\\');
  10223. if (/^".*"$/.test(fileName)) {
  10224. fileName = fileName.substr(1, fileName.length - 2);
  10225. }
  10226. index[keyPrefix + 'FileName'] = fileName;
  10227. index[keyPrefix + 'Header'] = (data[1] || '').trim();
  10228. i++;
  10229. }
  10230. }
  10231. // Parses a hunk
  10232. // This assumes that we are at the start of a hunk.
  10233. function parseHunk() {
  10234. var chunkHeaderIndex = i,
  10235. chunkHeaderLine = diffstr[i++],
  10236. chunkHeader = chunkHeaderLine.split(/@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@/);
  10237. var hunk = {
  10238. oldStart: +chunkHeader[1],
  10239. oldLines: +chunkHeader[2] || 1,
  10240. newStart: +chunkHeader[3],
  10241. newLines: +chunkHeader[4] || 1,
  10242. lines: [],
  10243. linedelimiters: []
  10244. };
  10245. var addCount = 0,
  10246. removeCount = 0;
  10247. for (; i < diffstr.length; i++) {
  10248. // Lines starting with '---' could be mistaken for the "remove line" operation
  10249. // But they could be the header for the next file. Therefore prune such cases out.
  10250. if (diffstr[i].indexOf('--- ') === 0 && i + 2 < diffstr.length && diffstr[i + 1].indexOf('+++ ') === 0 && diffstr[i + 2].indexOf('@@') === 0) {
  10251. break;
  10252. }
  10253. var operation = diffstr[i].length == 0 && i != diffstr.length - 1 ? ' ' : diffstr[i][0];
  10254. if (operation === '+' || operation === '-' || operation === ' ' || operation === '\\') {
  10255. hunk.lines.push(diffstr[i]);
  10256. hunk.linedelimiters.push(delimiters[i] || '\n');
  10257. if (operation === '+') {
  10258. addCount++;
  10259. } else if (operation === '-') {
  10260. removeCount++;
  10261. } else if (operation === ' ') {
  10262. addCount++;
  10263. removeCount++;
  10264. }
  10265. } else {
  10266. break;
  10267. }
  10268. }
  10269. // Handle the empty block count case
  10270. if (!addCount && hunk.newLines === 1) {
  10271. hunk.newLines = 0;
  10272. }
  10273. if (!removeCount && hunk.oldLines === 1) {
  10274. hunk.oldLines = 0;
  10275. }
  10276. // Perform optional sanity checking
  10277. if (options.strict) {
  10278. if (addCount !== hunk.newLines) {
  10279. throw new Error('Added line count did not match for hunk at line ' + (chunkHeaderIndex + 1));
  10280. }
  10281. if (removeCount !== hunk.oldLines) {
  10282. throw new Error('Removed line count did not match for hunk at line ' + (chunkHeaderIndex + 1));
  10283. }
  10284. }
  10285. return hunk;
  10286. }
  10287. while (i < diffstr.length) {
  10288. parseIndex();
  10289. }
  10290. return list;
  10291. }
  10292. /***/ }),
  10293. /* 12 */
  10294. /***/ (function(module, exports) {
  10295. /*istanbul ignore start*/"use strict";
  10296. exports.__esModule = true;
  10297. exports["default"] = /*istanbul ignore end*/function (start, minLine, maxLine) {
  10298. var wantForward = true,
  10299. backwardExhausted = false,
  10300. forwardExhausted = false,
  10301. localOffset = 1;
  10302. return function iterator() {
  10303. if (wantForward && !forwardExhausted) {
  10304. if (backwardExhausted) {
  10305. localOffset++;
  10306. } else {
  10307. wantForward = false;
  10308. }
  10309. // Check if trying to fit beyond text length, and if not, check it fits
  10310. // after offset location (or desired location on first iteration)
  10311. if (start + localOffset <= maxLine) {
  10312. return localOffset;
  10313. }
  10314. forwardExhausted = true;
  10315. }
  10316. if (!backwardExhausted) {
  10317. if (!forwardExhausted) {
  10318. wantForward = true;
  10319. }
  10320. // Check if trying to fit before text beginning, and if not, check it fits
  10321. // before offset location
  10322. if (minLine <= start - localOffset) {
  10323. return -localOffset++;
  10324. }
  10325. backwardExhausted = true;
  10326. return iterator();
  10327. }
  10328. // We tried to fit hunk before text beginning and beyond text length, then
  10329. // hunk can't fit on the text. Return undefined
  10330. };
  10331. };
  10332. /***/ }),
  10333. /* 13 */
  10334. /***/ (function(module, exports, __webpack_require__) {
  10335. /*istanbul ignore start*/'use strict';
  10336. exports.__esModule = true;
  10337. exports. /*istanbul ignore end*/calcLineCount = calcLineCount;
  10338. /*istanbul ignore start*/exports. /*istanbul ignore end*/merge = merge;
  10339. var /*istanbul ignore start*/_create = __webpack_require__(14) /*istanbul ignore end*/;
  10340. var /*istanbul ignore start*/_parse = __webpack_require__(11) /*istanbul ignore end*/;
  10341. var /*istanbul ignore start*/_array = __webpack_require__(15) /*istanbul ignore end*/;
  10342. /*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); } }
  10343. /*istanbul ignore end*/function calcLineCount(hunk) {
  10344. /*istanbul ignore start*/var _calcOldNewLineCount = /*istanbul ignore end*/calcOldNewLineCount(hunk.lines),
  10345. oldLines = _calcOldNewLineCount.oldLines,
  10346. newLines = _calcOldNewLineCount.newLines;
  10347. if (oldLines !== undefined) {
  10348. hunk.oldLines = oldLines;
  10349. } else {
  10350. delete hunk.oldLines;
  10351. }
  10352. if (newLines !== undefined) {
  10353. hunk.newLines = newLines;
  10354. } else {
  10355. delete hunk.newLines;
  10356. }
  10357. }
  10358. function merge(mine, theirs, base) {
  10359. mine = loadPatch(mine, base);
  10360. theirs = loadPatch(theirs, base);
  10361. var ret = {};
  10362. // For index we just let it pass through as it doesn't have any necessary meaning.
  10363. // Leaving sanity checks on this to the API consumer that may know more about the
  10364. // meaning in their own context.
  10365. if (mine.index || theirs.index) {
  10366. ret.index = mine.index || theirs.index;
  10367. }
  10368. if (mine.newFileName || theirs.newFileName) {
  10369. if (!fileNameChanged(mine)) {
  10370. // No header or no change in ours, use theirs (and ours if theirs does not exist)
  10371. ret.oldFileName = theirs.oldFileName || mine.oldFileName;
  10372. ret.newFileName = theirs.newFileName || mine.newFileName;
  10373. ret.oldHeader = theirs.oldHeader || mine.oldHeader;
  10374. ret.newHeader = theirs.newHeader || mine.newHeader;
  10375. } else if (!fileNameChanged(theirs)) {
  10376. // No header or no change in theirs, use ours
  10377. ret.oldFileName = mine.oldFileName;
  10378. ret.newFileName = mine.newFileName;
  10379. ret.oldHeader = mine.oldHeader;
  10380. ret.newHeader = mine.newHeader;
  10381. } else {
  10382. // Both changed... figure it out
  10383. ret.oldFileName = selectField(ret, mine.oldFileName, theirs.oldFileName);
  10384. ret.newFileName = selectField(ret, mine.newFileName, theirs.newFileName);
  10385. ret.oldHeader = selectField(ret, mine.oldHeader, theirs.oldHeader);
  10386. ret.newHeader = selectField(ret, mine.newHeader, theirs.newHeader);
  10387. }
  10388. }
  10389. ret.hunks = [];
  10390. var mineIndex = 0,
  10391. theirsIndex = 0,
  10392. mineOffset = 0,
  10393. theirsOffset = 0;
  10394. while (mineIndex < mine.hunks.length || theirsIndex < theirs.hunks.length) {
  10395. var mineCurrent = mine.hunks[mineIndex] || { oldStart: Infinity },
  10396. theirsCurrent = theirs.hunks[theirsIndex] || { oldStart: Infinity };
  10397. if (hunkBefore(mineCurrent, theirsCurrent)) {
  10398. // This patch does not overlap with any of the others, yay.
  10399. ret.hunks.push(cloneHunk(mineCurrent, mineOffset));
  10400. mineIndex++;
  10401. theirsOffset += mineCurrent.newLines - mineCurrent.oldLines;
  10402. } else if (hunkBefore(theirsCurrent, mineCurrent)) {
  10403. // This patch does not overlap with any of the others, yay.
  10404. ret.hunks.push(cloneHunk(theirsCurrent, theirsOffset));
  10405. theirsIndex++;
  10406. mineOffset += theirsCurrent.newLines - theirsCurrent.oldLines;
  10407. } else {
  10408. // Overlap, merge as best we can
  10409. var mergedHunk = {
  10410. oldStart: Math.min(mineCurrent.oldStart, theirsCurrent.oldStart),
  10411. oldLines: 0,
  10412. newStart: Math.min(mineCurrent.newStart + mineOffset, theirsCurrent.oldStart + theirsOffset),
  10413. newLines: 0,
  10414. lines: []
  10415. };
  10416. mergeLines(mergedHunk, mineCurrent.oldStart, mineCurrent.lines, theirsCurrent.oldStart, theirsCurrent.lines);
  10417. theirsIndex++;
  10418. mineIndex++;
  10419. ret.hunks.push(mergedHunk);
  10420. }
  10421. }
  10422. return ret;
  10423. }
  10424. function loadPatch(param, base) {
  10425. if (typeof param === 'string') {
  10426. if (/^@@/m.test(param) || /^Index:/m.test(param)) {
  10427. return (/*istanbul ignore start*/(0, _parse.parsePatch) /*istanbul ignore end*/(param)[0]
  10428. );
  10429. }
  10430. if (!base) {
  10431. throw new Error('Must provide a base reference or pass in a patch');
  10432. }
  10433. return (/*istanbul ignore start*/(0, _create.structuredPatch) /*istanbul ignore end*/(undefined, undefined, base, param)
  10434. );
  10435. }
  10436. return param;
  10437. }
  10438. function fileNameChanged(patch) {
  10439. return patch.newFileName && patch.newFileName !== patch.oldFileName;
  10440. }
  10441. function selectField(index, mine, theirs) {
  10442. if (mine === theirs) {
  10443. return mine;
  10444. } else {
  10445. index.conflict = true;
  10446. return { mine: mine, theirs: theirs };
  10447. }
  10448. }
  10449. function hunkBefore(test, check) {
  10450. return test.oldStart < check.oldStart && test.oldStart + test.oldLines < check.oldStart;
  10451. }
  10452. function cloneHunk(hunk, offset) {
  10453. return {
  10454. oldStart: hunk.oldStart, oldLines: hunk.oldLines,
  10455. newStart: hunk.newStart + offset, newLines: hunk.newLines,
  10456. lines: hunk.lines
  10457. };
  10458. }
  10459. function mergeLines(hunk, mineOffset, mineLines, theirOffset, theirLines) {
  10460. // This will generally result in a conflicted hunk, but there are cases where the context
  10461. // is the only overlap where we can successfully merge the content here.
  10462. var mine = { offset: mineOffset, lines: mineLines, index: 0 },
  10463. their = { offset: theirOffset, lines: theirLines, index: 0 };
  10464. // Handle any leading content
  10465. insertLeading(hunk, mine, their);
  10466. insertLeading(hunk, their, mine);
  10467. // Now in the overlap content. Scan through and select the best changes from each.
  10468. while (mine.index < mine.lines.length && their.index < their.lines.length) {
  10469. var mineCurrent = mine.lines[mine.index],
  10470. theirCurrent = their.lines[their.index];
  10471. if ((mineCurrent[0] === '-' || mineCurrent[0] === '+') && (theirCurrent[0] === '-' || theirCurrent[0] === '+')) {
  10472. // Both modified ...
  10473. mutualChange(hunk, mine, their);
  10474. } else if (mineCurrent[0] === '+' && theirCurrent[0] === ' ') {
  10475. /*istanbul ignore start*/var _hunk$lines;
  10476. /*istanbul ignore end*/ // Mine inserted
  10477. /*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)));
  10478. } else if (theirCurrent[0] === '+' && mineCurrent[0] === ' ') {
  10479. /*istanbul ignore start*/var _hunk$lines2;
  10480. /*istanbul ignore end*/ // Theirs inserted
  10481. /*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)));
  10482. } else if (mineCurrent[0] === '-' && theirCurrent[0] === ' ') {
  10483. // Mine removed or edited
  10484. removal(hunk, mine, their);
  10485. } else if (theirCurrent[0] === '-' && mineCurrent[0] === ' ') {
  10486. // Their removed or edited
  10487. removal(hunk, their, mine, true);
  10488. } else if (mineCurrent === theirCurrent) {
  10489. // Context identity
  10490. hunk.lines.push(mineCurrent);
  10491. mine.index++;
  10492. their.index++;
  10493. } else {
  10494. // Context mismatch
  10495. conflict(hunk, collectChange(mine), collectChange(their));
  10496. }
  10497. }
  10498. // Now push anything that may be remaining
  10499. insertTrailing(hunk, mine);
  10500. insertTrailing(hunk, their);
  10501. calcLineCount(hunk);
  10502. }
  10503. function mutualChange(hunk, mine, their) {
  10504. var myChanges = collectChange(mine),
  10505. theirChanges = collectChange(their);
  10506. if (allRemoves(myChanges) && allRemoves(theirChanges)) {
  10507. // Special case for remove changes that are supersets of one another
  10508. if ( /*istanbul ignore start*/(0, _array.arrayStartsWith) /*istanbul ignore end*/(myChanges, theirChanges) && skipRemoveSuperset(their, myChanges, myChanges.length - theirChanges.length)) {
  10509. /*istanbul ignore start*/var _hunk$lines3;
  10510. /*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));
  10511. return;
  10512. } else if ( /*istanbul ignore start*/(0, _array.arrayStartsWith) /*istanbul ignore end*/(theirChanges, myChanges) && skipRemoveSuperset(mine, theirChanges, theirChanges.length - myChanges.length)) {
  10513. /*istanbul ignore start*/var _hunk$lines4;
  10514. /*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));
  10515. return;
  10516. }
  10517. } else if ( /*istanbul ignore start*/(0, _array.arrayEqual) /*istanbul ignore end*/(myChanges, theirChanges)) {
  10518. /*istanbul ignore start*/var _hunk$lines5;
  10519. /*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));
  10520. return;
  10521. }
  10522. conflict(hunk, myChanges, theirChanges);
  10523. }
  10524. function removal(hunk, mine, their, swap) {
  10525. var myChanges = collectChange(mine),
  10526. theirChanges = collectContext(their, myChanges);
  10527. if (theirChanges.merged) {
  10528. /*istanbul ignore start*/var _hunk$lines6;
  10529. /*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));
  10530. } else {
  10531. conflict(hunk, swap ? theirChanges : myChanges, swap ? myChanges : theirChanges);
  10532. }
  10533. }
  10534. function conflict(hunk, mine, their) {
  10535. hunk.conflict = true;
  10536. hunk.lines.push({
  10537. conflict: true,
  10538. mine: mine,
  10539. theirs: their
  10540. });
  10541. }
  10542. function insertLeading(hunk, insert, their) {
  10543. while (insert.offset < their.offset && insert.index < insert.lines.length) {
  10544. var line = insert.lines[insert.index++];
  10545. hunk.lines.push(line);
  10546. insert.offset++;
  10547. }
  10548. }
  10549. function insertTrailing(hunk, insert) {
  10550. while (insert.index < insert.lines.length) {
  10551. var line = insert.lines[insert.index++];
  10552. hunk.lines.push(line);
  10553. }
  10554. }
  10555. function collectChange(state) {
  10556. var ret = [],
  10557. operation = state.lines[state.index][0];
  10558. while (state.index < state.lines.length) {
  10559. var line = state.lines[state.index];
  10560. // Group additions that are immediately after subtractions and treat them as one "atomic" modify change.
  10561. if (operation === '-' && line[0] === '+') {
  10562. operation = '+';
  10563. }
  10564. if (operation === line[0]) {
  10565. ret.push(line);
  10566. state.index++;
  10567. } else {
  10568. break;
  10569. }
  10570. }
  10571. return ret;
  10572. }
  10573. function collectContext(state, matchChanges) {
  10574. var changes = [],
  10575. merged = [],
  10576. matchIndex = 0,
  10577. contextChanges = false,
  10578. conflicted = false;
  10579. while (matchIndex < matchChanges.length && state.index < state.lines.length) {
  10580. var change = state.lines[state.index],
  10581. match = matchChanges[matchIndex];
  10582. // Once we've hit our add, then we are done
  10583. if (match[0] === '+') {
  10584. break;
  10585. }
  10586. contextChanges = contextChanges || change[0] !== ' ';
  10587. merged.push(match);
  10588. matchIndex++;
  10589. // Consume any additions in the other block as a conflict to attempt
  10590. // to pull in the remaining context after this
  10591. if (change[0] === '+') {
  10592. conflicted = true;
  10593. while (change[0] === '+') {
  10594. changes.push(change);
  10595. change = state.lines[++state.index];
  10596. }
  10597. }
  10598. if (match.substr(1) === change.substr(1)) {
  10599. changes.push(change);
  10600. state.index++;
  10601. } else {
  10602. conflicted = true;
  10603. }
  10604. }
  10605. if ((matchChanges[matchIndex] || '')[0] === '+' && contextChanges) {
  10606. conflicted = true;
  10607. }
  10608. if (conflicted) {
  10609. return changes;
  10610. }
  10611. while (matchIndex < matchChanges.length) {
  10612. merged.push(matchChanges[matchIndex++]);
  10613. }
  10614. return {
  10615. merged: merged,
  10616. changes: changes
  10617. };
  10618. }
  10619. function allRemoves(changes) {
  10620. return changes.reduce(function (prev, change) {
  10621. return prev && change[0] === '-';
  10622. }, true);
  10623. }
  10624. function skipRemoveSuperset(state, removeChanges, delta) {
  10625. for (var i = 0; i < delta; i++) {
  10626. var changeContent = removeChanges[removeChanges.length - delta + i].substr(1);
  10627. if (state.lines[state.index + i] !== ' ' + changeContent) {
  10628. return false;
  10629. }
  10630. }
  10631. state.index += delta;
  10632. return true;
  10633. }
  10634. function calcOldNewLineCount(lines) {
  10635. var oldLines = 0;
  10636. var newLines = 0;
  10637. lines.forEach(function (line) {
  10638. if (typeof line !== 'string') {
  10639. var myCount = calcOldNewLineCount(line.mine);
  10640. var theirCount = calcOldNewLineCount(line.theirs);
  10641. if (oldLines !== undefined) {
  10642. if (myCount.oldLines === theirCount.oldLines) {
  10643. oldLines += myCount.oldLines;
  10644. } else {
  10645. oldLines = undefined;
  10646. }
  10647. }
  10648. if (newLines !== undefined) {
  10649. if (myCount.newLines === theirCount.newLines) {
  10650. newLines += myCount.newLines;
  10651. } else {
  10652. newLines = undefined;
  10653. }
  10654. }
  10655. } else {
  10656. if (newLines !== undefined && (line[0] === '+' || line[0] === ' ')) {
  10657. newLines++;
  10658. }
  10659. if (oldLines !== undefined && (line[0] === '-' || line[0] === ' ')) {
  10660. oldLines++;
  10661. }
  10662. }
  10663. });
  10664. return { oldLines: oldLines, newLines: newLines };
  10665. }
  10666. /***/ }),
  10667. /* 14 */
  10668. /***/ (function(module, exports, __webpack_require__) {
  10669. /*istanbul ignore start*/'use strict';
  10670. exports.__esModule = true;
  10671. exports. /*istanbul ignore end*/structuredPatch = structuredPatch;
  10672. /*istanbul ignore start*/exports. /*istanbul ignore end*/createTwoFilesPatch = createTwoFilesPatch;
  10673. /*istanbul ignore start*/exports. /*istanbul ignore end*/createPatch = createPatch;
  10674. var /*istanbul ignore start*/_line = __webpack_require__(5) /*istanbul ignore end*/;
  10675. /*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); } }
  10676. /*istanbul ignore end*/function structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options) {
  10677. if (!options) {
  10678. options = {};
  10679. }
  10680. if (typeof options.context === 'undefined') {
  10681. options.context = 4;
  10682. }
  10683. var diff = /*istanbul ignore start*/(0, _line.diffLines) /*istanbul ignore end*/(oldStr, newStr, options);
  10684. diff.push({ value: '', lines: [] }); // Append an empty value to make cleanup easier
  10685. function contextLines(lines) {
  10686. return lines.map(function (entry) {
  10687. return ' ' + entry;
  10688. });
  10689. }
  10690. var hunks = [];
  10691. var oldRangeStart = 0,
  10692. newRangeStart = 0,
  10693. curRange = [],
  10694. oldLine = 1,
  10695. newLine = 1;
  10696. /*istanbul ignore start*/var _loop = function _loop( /*istanbul ignore end*/i) {
  10697. var current = diff[i],
  10698. lines = current.lines || current.value.replace(/\n$/, '').split('\n');
  10699. current.lines = lines;
  10700. if (current.added || current.removed) {
  10701. /*istanbul ignore start*/var _curRange;
  10702. /*istanbul ignore end*/ // If we have previous context, start with that
  10703. if (!oldRangeStart) {
  10704. var prev = diff[i - 1];
  10705. oldRangeStart = oldLine;
  10706. newRangeStart = newLine;
  10707. if (prev) {
  10708. curRange = options.context > 0 ? contextLines(prev.lines.slice(-options.context)) : [];
  10709. oldRangeStart -= curRange.length;
  10710. newRangeStart -= curRange.length;
  10711. }
  10712. }
  10713. // Output our changes
  10714. /*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) {
  10715. return (current.added ? '+' : '-') + entry;
  10716. })));
  10717. // Track the updated file position
  10718. if (current.added) {
  10719. newLine += lines.length;
  10720. } else {
  10721. oldLine += lines.length;
  10722. }
  10723. } else {
  10724. // Identical context lines. Track line changes
  10725. if (oldRangeStart) {
  10726. // Close out any changes that have been output (or join overlapping)
  10727. if (lines.length <= options.context * 2 && i < diff.length - 2) {
  10728. /*istanbul ignore start*/var _curRange2;
  10729. /*istanbul ignore end*/ // Overlapping
  10730. /*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)));
  10731. } else {
  10732. /*istanbul ignore start*/var _curRange3;
  10733. /*istanbul ignore end*/ // end the range and output
  10734. var contextSize = Math.min(lines.length, options.context);
  10735. /*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))));
  10736. var hunk = {
  10737. oldStart: oldRangeStart,
  10738. oldLines: oldLine - oldRangeStart + contextSize,
  10739. newStart: newRangeStart,
  10740. newLines: newLine - newRangeStart + contextSize,
  10741. lines: curRange
  10742. };
  10743. if (i >= diff.length - 2 && lines.length <= options.context) {
  10744. // EOF is inside this hunk
  10745. var oldEOFNewline = /\n$/.test(oldStr);
  10746. var newEOFNewline = /\n$/.test(newStr);
  10747. if (lines.length == 0 && !oldEOFNewline) {
  10748. // special case: old has no eol and no trailing context; no-nl can end up before adds
  10749. curRange.splice(hunk.oldLines, 0, '\\ No newline at end of file');
  10750. } else if (!oldEOFNewline || !newEOFNewline) {
  10751. curRange.push('\\ No newline at end of file');
  10752. }
  10753. }
  10754. hunks.push(hunk);
  10755. oldRangeStart = 0;
  10756. newRangeStart = 0;
  10757. curRange = [];
  10758. }
  10759. }
  10760. oldLine += lines.length;
  10761. newLine += lines.length;
  10762. }
  10763. };
  10764. for (var i = 0; i < diff.length; i++) {
  10765. /*istanbul ignore start*/_loop( /*istanbul ignore end*/i);
  10766. }
  10767. return {
  10768. oldFileName: oldFileName, newFileName: newFileName,
  10769. oldHeader: oldHeader, newHeader: newHeader,
  10770. hunks: hunks
  10771. };
  10772. }
  10773. function createTwoFilesPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options) {
  10774. var diff = structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options);
  10775. var ret = [];
  10776. if (oldFileName == newFileName) {
  10777. ret.push('Index: ' + oldFileName);
  10778. }
  10779. ret.push('===================================================================');
  10780. ret.push('--- ' + diff.oldFileName + (typeof diff.oldHeader === 'undefined' ? '' : '\t' + diff.oldHeader));
  10781. ret.push('+++ ' + diff.newFileName + (typeof diff.newHeader === 'undefined' ? '' : '\t' + diff.newHeader));
  10782. for (var i = 0; i < diff.hunks.length; i++) {
  10783. var hunk = diff.hunks[i];
  10784. ret.push('@@ -' + hunk.oldStart + ',' + hunk.oldLines + ' +' + hunk.newStart + ',' + hunk.newLines + ' @@');
  10785. ret.push.apply(ret, hunk.lines);
  10786. }
  10787. return ret.join('\n') + '\n';
  10788. }
  10789. function createPatch(fileName, oldStr, newStr, oldHeader, newHeader, options) {
  10790. return createTwoFilesPatch(fileName, fileName, oldStr, newStr, oldHeader, newHeader, options);
  10791. }
  10792. /***/ }),
  10793. /* 15 */
  10794. /***/ (function(module, exports) {
  10795. /*istanbul ignore start*/"use strict";
  10796. exports.__esModule = true;
  10797. exports. /*istanbul ignore end*/arrayEqual = arrayEqual;
  10798. /*istanbul ignore start*/exports. /*istanbul ignore end*/arrayStartsWith = arrayStartsWith;
  10799. function arrayEqual(a, b) {
  10800. if (a.length !== b.length) {
  10801. return false;
  10802. }
  10803. return arrayStartsWith(a, b);
  10804. }
  10805. function arrayStartsWith(array, start) {
  10806. if (start.length > array.length) {
  10807. return false;
  10808. }
  10809. for (var i = 0; i < start.length; i++) {
  10810. if (start[i] !== array[i]) {
  10811. return false;
  10812. }
  10813. }
  10814. return true;
  10815. }
  10816. /***/ }),
  10817. /* 16 */
  10818. /***/ (function(module, exports) {
  10819. /*istanbul ignore start*/"use strict";
  10820. exports.__esModule = true;
  10821. exports. /*istanbul ignore end*/convertChangesToDMP = convertChangesToDMP;
  10822. // See: http://code.google.com/p/google-diff-match-patch/wiki/API
  10823. function convertChangesToDMP(changes) {
  10824. var ret = [],
  10825. change = /*istanbul ignore start*/void 0 /*istanbul ignore end*/,
  10826. operation = /*istanbul ignore start*/void 0 /*istanbul ignore end*/;
  10827. for (var i = 0; i < changes.length; i++) {
  10828. change = changes[i];
  10829. if (change.added) {
  10830. operation = 1;
  10831. } else if (change.removed) {
  10832. operation = -1;
  10833. } else {
  10834. operation = 0;
  10835. }
  10836. ret.push([operation, change.value]);
  10837. }
  10838. return ret;
  10839. }
  10840. /***/ }),
  10841. /* 17 */
  10842. /***/ (function(module, exports) {
  10843. /*istanbul ignore start*/'use strict';
  10844. exports.__esModule = true;
  10845. exports. /*istanbul ignore end*/convertChangesToXML = convertChangesToXML;
  10846. function convertChangesToXML(changes) {
  10847. var ret = [];
  10848. for (var i = 0; i < changes.length; i++) {
  10849. var change = changes[i];
  10850. if (change.added) {
  10851. ret.push('<ins>');
  10852. } else if (change.removed) {
  10853. ret.push('<del>');
  10854. }
  10855. ret.push(escapeHTML(change.value));
  10856. if (change.added) {
  10857. ret.push('</ins>');
  10858. } else if (change.removed) {
  10859. ret.push('</del>');
  10860. }
  10861. }
  10862. return ret.join('');
  10863. }
  10864. function escapeHTML(s) {
  10865. var n = s;
  10866. n = n.replace(/&/g, '&amp;');
  10867. n = n.replace(/</g, '&lt;');
  10868. n = n.replace(/>/g, '&gt;');
  10869. n = n.replace(/"/g, '&quot;');
  10870. return n;
  10871. }
  10872. /***/ })
  10873. /******/ ])
  10874. });
  10875. ;
  10876. },{}],49:[function(require,module,exports){
  10877. 'use strict';
  10878. var matchOperatorsRe = /[|\\{}()[\]^$+*?.]/g;
  10879. module.exports = function (str) {
  10880. if (typeof str !== 'string') {
  10881. throw new TypeError('Expected a string');
  10882. }
  10883. return str.replace(matchOperatorsRe, '\\$&');
  10884. };
  10885. },{}],50:[function(require,module,exports){
  10886. // Copyright Joyent, Inc. and other Node contributors.
  10887. //
  10888. // Permission is hereby granted, free of charge, to any person obtaining a
  10889. // copy of this software and associated documentation files (the
  10890. // "Software"), to deal in the Software without restriction, including
  10891. // without limitation the rights to use, copy, modify, merge, publish,
  10892. // distribute, sublicense, and/or sell copies of the Software, and to permit
  10893. // persons to whom the Software is furnished to do so, subject to the
  10894. // following conditions:
  10895. //
  10896. // The above copyright notice and this permission notice shall be included
  10897. // in all copies or substantial portions of the Software.
  10898. //
  10899. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  10900. // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  10901. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  10902. // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  10903. // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  10904. // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  10905. // USE OR OTHER DEALINGS IN THE SOFTWARE.
  10906. var objectCreate = Object.create || objectCreatePolyfill
  10907. var objectKeys = Object.keys || objectKeysPolyfill
  10908. var bind = Function.prototype.bind || functionBindPolyfill
  10909. function EventEmitter() {
  10910. if (!this._events || !Object.prototype.hasOwnProperty.call(this, '_events')) {
  10911. this._events = objectCreate(null);
  10912. this._eventsCount = 0;
  10913. }
  10914. this._maxListeners = this._maxListeners || undefined;
  10915. }
  10916. module.exports = EventEmitter;
  10917. // Backwards-compat with node 0.10.x
  10918. EventEmitter.EventEmitter = EventEmitter;
  10919. EventEmitter.prototype._events = undefined;
  10920. EventEmitter.prototype._maxListeners = undefined;
  10921. // By default EventEmitters will print a warning if more than 10 listeners are
  10922. // added to it. This is a useful default which helps finding memory leaks.
  10923. var defaultMaxListeners = 10;
  10924. var hasDefineProperty;
  10925. try {
  10926. var o = {};
  10927. if (Object.defineProperty) Object.defineProperty(o, 'x', { value: 0 });
  10928. hasDefineProperty = o.x === 0;
  10929. } catch (err) { hasDefineProperty = false }
  10930. if (hasDefineProperty) {
  10931. Object.defineProperty(EventEmitter, 'defaultMaxListeners', {
  10932. enumerable: true,
  10933. get: function() {
  10934. return defaultMaxListeners;
  10935. },
  10936. set: function(arg) {
  10937. // check whether the input is a positive number (whose value is zero or
  10938. // greater and not a NaN).
  10939. if (typeof arg !== 'number' || arg < 0 || arg !== arg)
  10940. throw new TypeError('"defaultMaxListeners" must be a positive number');
  10941. defaultMaxListeners = arg;
  10942. }
  10943. });
  10944. } else {
  10945. EventEmitter.defaultMaxListeners = defaultMaxListeners;
  10946. }
  10947. // Obviously not all Emitters should be limited to 10. This function allows
  10948. // that to be increased. Set to zero for unlimited.
  10949. EventEmitter.prototype.setMaxListeners = function setMaxListeners(n) {
  10950. if (typeof n !== 'number' || n < 0 || isNaN(n))
  10951. throw new TypeError('"n" argument must be a positive number');
  10952. this._maxListeners = n;
  10953. return this;
  10954. };
  10955. function $getMaxListeners(that) {
  10956. if (that._maxListeners === undefined)
  10957. return EventEmitter.defaultMaxListeners;
  10958. return that._maxListeners;
  10959. }
  10960. EventEmitter.prototype.getMaxListeners = function getMaxListeners() {
  10961. return $getMaxListeners(this);
  10962. };
  10963. // These standalone emit* functions are used to optimize calling of event
  10964. // handlers for fast cases because emit() itself often has a variable number of
  10965. // arguments and can be deoptimized because of that. These functions always have
  10966. // the same number of arguments and thus do not get deoptimized, so the code
  10967. // inside them can execute faster.
  10968. function emitNone(handler, isFn, self) {
  10969. if (isFn)
  10970. handler.call(self);
  10971. else {
  10972. var len = handler.length;
  10973. var listeners = arrayClone(handler, len);
  10974. for (var i = 0; i < len; ++i)
  10975. listeners[i].call(self);
  10976. }
  10977. }
  10978. function emitOne(handler, isFn, self, arg1) {
  10979. if (isFn)
  10980. handler.call(self, arg1);
  10981. else {
  10982. var len = handler.length;
  10983. var listeners = arrayClone(handler, len);
  10984. for (var i = 0; i < len; ++i)
  10985. listeners[i].call(self, arg1);
  10986. }
  10987. }
  10988. function emitTwo(handler, isFn, self, arg1, arg2) {
  10989. if (isFn)
  10990. handler.call(self, arg1, arg2);
  10991. else {
  10992. var len = handler.length;
  10993. var listeners = arrayClone(handler, len);
  10994. for (var i = 0; i < len; ++i)
  10995. listeners[i].call(self, arg1, arg2);
  10996. }
  10997. }
  10998. function emitThree(handler, isFn, self, arg1, arg2, arg3) {
  10999. if (isFn)
  11000. handler.call(self, arg1, arg2, arg3);
  11001. else {
  11002. var len = handler.length;
  11003. var listeners = arrayClone(handler, len);
  11004. for (var i = 0; i < len; ++i)
  11005. listeners[i].call(self, arg1, arg2, arg3);
  11006. }
  11007. }
  11008. function emitMany(handler, isFn, self, args) {
  11009. if (isFn)
  11010. handler.apply(self, args);
  11011. else {
  11012. var len = handler.length;
  11013. var listeners = arrayClone(handler, len);
  11014. for (var i = 0; i < len; ++i)
  11015. listeners[i].apply(self, args);
  11016. }
  11017. }
  11018. EventEmitter.prototype.emit = function emit(type) {
  11019. var er, handler, len, args, i, events;
  11020. var doError = (type === 'error');
  11021. events = this._events;
  11022. if (events)
  11023. doError = (doError && events.error == null);
  11024. else if (!doError)
  11025. return false;
  11026. // If there is no 'error' event listener then throw.
  11027. if (doError) {
  11028. if (arguments.length > 1)
  11029. er = arguments[1];
  11030. if (er instanceof Error) {
  11031. throw er; // Unhandled 'error' event
  11032. } else {
  11033. // At least give some kind of context to the user
  11034. var err = new Error('Unhandled "error" event. (' + er + ')');
  11035. err.context = er;
  11036. throw err;
  11037. }
  11038. return false;
  11039. }
  11040. handler = events[type];
  11041. if (!handler)
  11042. return false;
  11043. var isFn = typeof handler === 'function';
  11044. len = arguments.length;
  11045. switch (len) {
  11046. // fast cases
  11047. case 1:
  11048. emitNone(handler, isFn, this);
  11049. break;
  11050. case 2:
  11051. emitOne(handler, isFn, this, arguments[1]);
  11052. break;
  11053. case 3:
  11054. emitTwo(handler, isFn, this, arguments[1], arguments[2]);
  11055. break;
  11056. case 4:
  11057. emitThree(handler, isFn, this, arguments[1], arguments[2], arguments[3]);
  11058. break;
  11059. // slower
  11060. default:
  11061. args = new Array(len - 1);
  11062. for (i = 1; i < len; i++)
  11063. args[i - 1] = arguments[i];
  11064. emitMany(handler, isFn, this, args);
  11065. }
  11066. return true;
  11067. };
  11068. function _addListener(target, type, listener, prepend) {
  11069. var m;
  11070. var events;
  11071. var existing;
  11072. if (typeof listener !== 'function')
  11073. throw new TypeError('"listener" argument must be a function');
  11074. events = target._events;
  11075. if (!events) {
  11076. events = target._events = objectCreate(null);
  11077. target._eventsCount = 0;
  11078. } else {
  11079. // To avoid recursion in the case that type === "newListener"! Before
  11080. // adding it to the listeners, first emit "newListener".
  11081. if (events.newListener) {
  11082. target.emit('newListener', type,
  11083. listener.listener ? listener.listener : listener);
  11084. // Re-assign `events` because a newListener handler could have caused the
  11085. // this._events to be assigned to a new object
  11086. events = target._events;
  11087. }
  11088. existing = events[type];
  11089. }
  11090. if (!existing) {
  11091. // Optimize the case of one listener. Don't need the extra array object.
  11092. existing = events[type] = listener;
  11093. ++target._eventsCount;
  11094. } else {
  11095. if (typeof existing === 'function') {
  11096. // Adding the second element, need to change to array.
  11097. existing = events[type] =
  11098. prepend ? [listener, existing] : [existing, listener];
  11099. } else {
  11100. // If we've already got an array, just append.
  11101. if (prepend) {
  11102. existing.unshift(listener);
  11103. } else {
  11104. existing.push(listener);
  11105. }
  11106. }
  11107. // Check for listener leak
  11108. if (!existing.warned) {
  11109. m = $getMaxListeners(target);
  11110. if (m && m > 0 && existing.length > m) {
  11111. existing.warned = true;
  11112. var w = new Error('Possible EventEmitter memory leak detected. ' +
  11113. existing.length + ' "' + String(type) + '" listeners ' +
  11114. 'added. Use emitter.setMaxListeners() to ' +
  11115. 'increase limit.');
  11116. w.name = 'MaxListenersExceededWarning';
  11117. w.emitter = target;
  11118. w.type = type;
  11119. w.count = existing.length;
  11120. if (typeof console === 'object' && console.warn) {
  11121. console.warn('%s: %s', w.name, w.message);
  11122. }
  11123. }
  11124. }
  11125. }
  11126. return target;
  11127. }
  11128. EventEmitter.prototype.addListener = function addListener(type, listener) {
  11129. return _addListener(this, type, listener, false);
  11130. };
  11131. EventEmitter.prototype.on = EventEmitter.prototype.addListener;
  11132. EventEmitter.prototype.prependListener =
  11133. function prependListener(type, listener) {
  11134. return _addListener(this, type, listener, true);
  11135. };
  11136. function onceWrapper() {
  11137. if (!this.fired) {
  11138. this.target.removeListener(this.type, this.wrapFn);
  11139. this.fired = true;
  11140. switch (arguments.length) {
  11141. case 0:
  11142. return this.listener.call(this.target);
  11143. case 1:
  11144. return this.listener.call(this.target, arguments[0]);
  11145. case 2:
  11146. return this.listener.call(this.target, arguments[0], arguments[1]);
  11147. case 3:
  11148. return this.listener.call(this.target, arguments[0], arguments[1],
  11149. arguments[2]);
  11150. default:
  11151. var args = new Array(arguments.length);
  11152. for (var i = 0; i < args.length; ++i)
  11153. args[i] = arguments[i];
  11154. this.listener.apply(this.target, args);
  11155. }
  11156. }
  11157. }
  11158. function _onceWrap(target, type, listener) {
  11159. var state = { fired: false, wrapFn: undefined, target: target, type: type, listener: listener };
  11160. var wrapped = bind.call(onceWrapper, state);
  11161. wrapped.listener = listener;
  11162. state.wrapFn = wrapped;
  11163. return wrapped;
  11164. }
  11165. EventEmitter.prototype.once = function once(type, listener) {
  11166. if (typeof listener !== 'function')
  11167. throw new TypeError('"listener" argument must be a function');
  11168. this.on(type, _onceWrap(this, type, listener));
  11169. return this;
  11170. };
  11171. EventEmitter.prototype.prependOnceListener =
  11172. function prependOnceListener(type, listener) {
  11173. if (typeof listener !== 'function')
  11174. throw new TypeError('"listener" argument must be a function');
  11175. this.prependListener(type, _onceWrap(this, type, listener));
  11176. return this;
  11177. };
  11178. // Emits a 'removeListener' event if and only if the listener was removed.
  11179. EventEmitter.prototype.removeListener =
  11180. function removeListener(type, listener) {
  11181. var list, events, position, i, originalListener;
  11182. if (typeof listener !== 'function')
  11183. throw new TypeError('"listener" argument must be a function');
  11184. events = this._events;
  11185. if (!events)
  11186. return this;
  11187. list = events[type];
  11188. if (!list)
  11189. return this;
  11190. if (list === listener || list.listener === listener) {
  11191. if (--this._eventsCount === 0)
  11192. this._events = objectCreate(null);
  11193. else {
  11194. delete events[type];
  11195. if (events.removeListener)
  11196. this.emit('removeListener', type, list.listener || listener);
  11197. }
  11198. } else if (typeof list !== 'function') {
  11199. position = -1;
  11200. for (i = list.length - 1; i >= 0; i--) {
  11201. if (list[i] === listener || list[i].listener === listener) {
  11202. originalListener = list[i].listener;
  11203. position = i;
  11204. break;
  11205. }
  11206. }
  11207. if (position < 0)
  11208. return this;
  11209. if (position === 0)
  11210. list.shift();
  11211. else
  11212. spliceOne(list, position);
  11213. if (list.length === 1)
  11214. events[type] = list[0];
  11215. if (events.removeListener)
  11216. this.emit('removeListener', type, originalListener || listener);
  11217. }
  11218. return this;
  11219. };
  11220. EventEmitter.prototype.removeAllListeners =
  11221. function removeAllListeners(type) {
  11222. var listeners, events, i;
  11223. events = this._events;
  11224. if (!events)
  11225. return this;
  11226. // not listening for removeListener, no need to emit
  11227. if (!events.removeListener) {
  11228. if (arguments.length === 0) {
  11229. this._events = objectCreate(null);
  11230. this._eventsCount = 0;
  11231. } else if (events[type]) {
  11232. if (--this._eventsCount === 0)
  11233. this._events = objectCreate(null);
  11234. else
  11235. delete events[type];
  11236. }
  11237. return this;
  11238. }
  11239. // emit removeListener for all listeners on all events
  11240. if (arguments.length === 0) {
  11241. var keys = objectKeys(events);
  11242. var key;
  11243. for (i = 0; i < keys.length; ++i) {
  11244. key = keys[i];
  11245. if (key === 'removeListener') continue;
  11246. this.removeAllListeners(key);
  11247. }
  11248. this.removeAllListeners('removeListener');
  11249. this._events = objectCreate(null);
  11250. this._eventsCount = 0;
  11251. return this;
  11252. }
  11253. listeners = events[type];
  11254. if (typeof listeners === 'function') {
  11255. this.removeListener(type, listeners);
  11256. } else if (listeners) {
  11257. // LIFO order
  11258. for (i = listeners.length - 1; i >= 0; i--) {
  11259. this.removeListener(type, listeners[i]);
  11260. }
  11261. }
  11262. return this;
  11263. };
  11264. function _listeners(target, type, unwrap) {
  11265. var events = target._events;
  11266. if (!events)
  11267. return [];
  11268. var evlistener = events[type];
  11269. if (!evlistener)
  11270. return [];
  11271. if (typeof evlistener === 'function')
  11272. return unwrap ? [evlistener.listener || evlistener] : [evlistener];
  11273. return unwrap ? unwrapListeners(evlistener) : arrayClone(evlistener, evlistener.length);
  11274. }
  11275. EventEmitter.prototype.listeners = function listeners(type) {
  11276. return _listeners(this, type, true);
  11277. };
  11278. EventEmitter.prototype.rawListeners = function rawListeners(type) {
  11279. return _listeners(this, type, false);
  11280. };
  11281. EventEmitter.listenerCount = function(emitter, type) {
  11282. if (typeof emitter.listenerCount === 'function') {
  11283. return emitter.listenerCount(type);
  11284. } else {
  11285. return listenerCount.call(emitter, type);
  11286. }
  11287. };
  11288. EventEmitter.prototype.listenerCount = listenerCount;
  11289. function listenerCount(type) {
  11290. var events = this._events;
  11291. if (events) {
  11292. var evlistener = events[type];
  11293. if (typeof evlistener === 'function') {
  11294. return 1;
  11295. } else if (evlistener) {
  11296. return evlistener.length;
  11297. }
  11298. }
  11299. return 0;
  11300. }
  11301. EventEmitter.prototype.eventNames = function eventNames() {
  11302. return this._eventsCount > 0 ? Reflect.ownKeys(this._events) : [];
  11303. };
  11304. // About 1.5x faster than the two-arg version of Array#splice().
  11305. function spliceOne(list, index) {
  11306. for (var i = index, k = i + 1, n = list.length; k < n; i += 1, k += 1)
  11307. list[i] = list[k];
  11308. list.pop();
  11309. }
  11310. function arrayClone(arr, n) {
  11311. var copy = new Array(n);
  11312. for (var i = 0; i < n; ++i)
  11313. copy[i] = arr[i];
  11314. return copy;
  11315. }
  11316. function unwrapListeners(arr) {
  11317. var ret = new Array(arr.length);
  11318. for (var i = 0; i < ret.length; ++i) {
  11319. ret[i] = arr[i].listener || arr[i];
  11320. }
  11321. return ret;
  11322. }
  11323. function objectCreatePolyfill(proto) {
  11324. var F = function() {};
  11325. F.prototype = proto;
  11326. return new F;
  11327. }
  11328. function objectKeysPolyfill(obj) {
  11329. var keys = [];
  11330. for (var k in obj) if (Object.prototype.hasOwnProperty.call(obj, k)) {
  11331. keys.push(k);
  11332. }
  11333. return k;
  11334. }
  11335. function functionBindPolyfill(context) {
  11336. var fn = this;
  11337. return function () {
  11338. return fn.apply(context, arguments);
  11339. };
  11340. }
  11341. },{}],51:[function(require,module,exports){
  11342. 'use strict';
  11343. /* eslint no-invalid-this: 1 */
  11344. var ERROR_MESSAGE = 'Function.prototype.bind called on incompatible ';
  11345. var slice = Array.prototype.slice;
  11346. var toStr = Object.prototype.toString;
  11347. var funcType = '[object Function]';
  11348. module.exports = function bind(that) {
  11349. var target = this;
  11350. if (typeof target !== 'function' || toStr.call(target) !== funcType) {
  11351. throw new TypeError(ERROR_MESSAGE + target);
  11352. }
  11353. var args = slice.call(arguments, 1);
  11354. var bound;
  11355. var binder = function () {
  11356. if (this instanceof bound) {
  11357. var result = target.apply(
  11358. this,
  11359. args.concat(slice.call(arguments))
  11360. );
  11361. if (Object(result) === result) {
  11362. return result;
  11363. }
  11364. return this;
  11365. } else {
  11366. return target.apply(
  11367. that,
  11368. args.concat(slice.call(arguments))
  11369. );
  11370. }
  11371. };
  11372. var boundLength = Math.max(0, target.length - args.length);
  11373. var boundArgs = [];
  11374. for (var i = 0; i < boundLength; i++) {
  11375. boundArgs.push('$' + i);
  11376. }
  11377. bound = Function('binder', 'return function (' + boundArgs.join(',') + '){ return binder.apply(this,arguments); }')(binder);
  11378. if (target.prototype) {
  11379. var Empty = function Empty() {};
  11380. Empty.prototype = target.prototype;
  11381. bound.prototype = new Empty();
  11382. Empty.prototype = null;
  11383. }
  11384. return bound;
  11385. };
  11386. },{}],52:[function(require,module,exports){
  11387. 'use strict';
  11388. var implementation = require('./implementation');
  11389. module.exports = Function.prototype.bind || implementation;
  11390. },{"./implementation":51}],53:[function(require,module,exports){
  11391. 'use strict';
  11392. /* eslint complexity: [2, 17], max-statements: [2, 33] */
  11393. module.exports = function hasSymbols() {
  11394. if (typeof Symbol !== 'function' || typeof Object.getOwnPropertySymbols !== 'function') { return false; }
  11395. if (typeof Symbol.iterator === 'symbol') { return true; }
  11396. var obj = {};
  11397. var sym = Symbol('test');
  11398. var symObj = Object(sym);
  11399. if (typeof sym === 'string') { return false; }
  11400. if (Object.prototype.toString.call(sym) !== '[object Symbol]') { return false; }
  11401. if (Object.prototype.toString.call(symObj) !== '[object Symbol]') { return false; }
  11402. // temp disabled per https://github.com/ljharb/object.assign/issues/17
  11403. // if (sym instanceof Symbol) { return false; }
  11404. // temp disabled per https://github.com/WebReflection/get-own-property-symbols/issues/4
  11405. // if (!(symObj instanceof Symbol)) { return false; }
  11406. // if (typeof Symbol.prototype.toString !== 'function') { return false; }
  11407. // if (String(sym) !== Symbol.prototype.toString.call(sym)) { return false; }
  11408. var symVal = 42;
  11409. obj[sym] = symVal;
  11410. for (sym in obj) { return false; } // eslint-disable-line no-restricted-syntax
  11411. if (typeof Object.keys === 'function' && Object.keys(obj).length !== 0) { return false; }
  11412. if (typeof Object.getOwnPropertyNames === 'function' && Object.getOwnPropertyNames(obj).length !== 0) { return false; }
  11413. var syms = Object.getOwnPropertySymbols(obj);
  11414. if (syms.length !== 1 || syms[0] !== sym) { return false; }
  11415. if (!Object.prototype.propertyIsEnumerable.call(obj, sym)) { return false; }
  11416. if (typeof Object.getOwnPropertyDescriptor === 'function') {
  11417. var descriptor = Object.getOwnPropertyDescriptor(obj, sym);
  11418. if (descriptor.value !== symVal || descriptor.enumerable !== true) { return false; }
  11419. }
  11420. return true;
  11421. };
  11422. },{}],54:[function(require,module,exports){
  11423. (function (global){
  11424. /*! https://mths.be/he v1.2.0 by @mathias | MIT license */
  11425. ;(function(root) {
  11426. // Detect free variables `exports`.
  11427. var freeExports = typeof exports == 'object' && exports;
  11428. // Detect free variable `module`.
  11429. var freeModule = typeof module == 'object' && module &&
  11430. module.exports == freeExports && module;
  11431. // Detect free variable `global`, from Node.js or Browserified code,
  11432. // and use it as `root`.
  11433. var freeGlobal = typeof global == 'object' && global;
  11434. if (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal) {
  11435. root = freeGlobal;
  11436. }
  11437. /*--------------------------------------------------------------------------*/
  11438. // All astral symbols.
  11439. var regexAstralSymbols = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g;
  11440. // All ASCII symbols (not just printable ASCII) except those listed in the
  11441. // first column of the overrides table.
  11442. // https://html.spec.whatwg.org/multipage/syntax.html#table-charref-overrides
  11443. var regexAsciiWhitelist = /[\x01-\x7F]/g;
  11444. // All BMP symbols that are not ASCII newlines, printable ASCII symbols, or
  11445. // code points listed in the first column of the overrides table on
  11446. // https://html.spec.whatwg.org/multipage/syntax.html#table-charref-overrides.
  11447. var regexBmpWhitelist = /[\x01-\t\x0B\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g;
  11448. var regexEncodeNonAscii = /<\u20D2|=\u20E5|>\u20D2|\u205F\u200A|\u219D\u0338|\u2202\u0338|\u2220\u20D2|\u2229\uFE00|\u222A\uFE00|\u223C\u20D2|\u223D\u0331|\u223E\u0333|\u2242\u0338|\u224B\u0338|\u224D\u20D2|\u224E\u0338|\u224F\u0338|\u2250\u0338|\u2261\u20E5|\u2264\u20D2|\u2265\u20D2|\u2266\u0338|\u2267\u0338|\u2268\uFE00|\u2269\uFE00|\u226A\u0338|\u226A\u20D2|\u226B\u0338|\u226B\u20D2|\u227F\u0338|\u2282\u20D2|\u2283\u20D2|\u228A\uFE00|\u228B\uFE00|\u228F\u0338|\u2290\u0338|\u2293\uFE00|\u2294\uFE00|\u22B4\u20D2|\u22B5\u20D2|\u22D8\u0338|\u22D9\u0338|\u22DA\uFE00|\u22DB\uFE00|\u22F5\u0338|\u22F9\u0338|\u2933\u0338|\u29CF\u0338|\u29D0\u0338|\u2A6D\u0338|\u2A70\u0338|\u2A7D\u0338|\u2A7E\u0338|\u2AA1\u0338|\u2AA2\u0338|\u2AAC\uFE00|\u2AAD\uFE00|\u2AAF\u0338|\u2AB0\u0338|\u2AC5\u0338|\u2AC6\u0338|\u2ACB\uFE00|\u2ACC\uFE00|\u2AFD\u20E5|[\xA0-\u0113\u0116-\u0122\u0124-\u012B\u012E-\u014D\u0150-\u017E\u0192\u01B5\u01F5\u0237\u02C6\u02C7\u02D8-\u02DD\u0311\u0391-\u03A1\u03A3-\u03A9\u03B1-\u03C9\u03D1\u03D2\u03D5\u03D6\u03DC\u03DD\u03F0\u03F1\u03F5\u03F6\u0401-\u040C\u040E-\u044F\u0451-\u045C\u045E\u045F\u2002-\u2005\u2007-\u2010\u2013-\u2016\u2018-\u201A\u201C-\u201E\u2020-\u2022\u2025\u2026\u2030-\u2035\u2039\u203A\u203E\u2041\u2043\u2044\u204F\u2057\u205F-\u2063\u20AC\u20DB\u20DC\u2102\u2105\u210A-\u2113\u2115-\u211E\u2122\u2124\u2127-\u2129\u212C\u212D\u212F-\u2131\u2133-\u2138\u2145-\u2148\u2153-\u215E\u2190-\u219B\u219D-\u21A7\u21A9-\u21AE\u21B0-\u21B3\u21B5-\u21B7\u21BA-\u21DB\u21DD\u21E4\u21E5\u21F5\u21FD-\u2205\u2207-\u2209\u220B\u220C\u220F-\u2214\u2216-\u2218\u221A\u221D-\u2238\u223A-\u2257\u2259\u225A\u225C\u225F-\u2262\u2264-\u228B\u228D-\u229B\u229D-\u22A5\u22A7-\u22B0\u22B2-\u22BB\u22BD-\u22DB\u22DE-\u22E3\u22E6-\u22F7\u22F9-\u22FE\u2305\u2306\u2308-\u2310\u2312\u2313\u2315\u2316\u231C-\u231F\u2322\u2323\u232D\u232E\u2336\u233D\u233F\u237C\u23B0\u23B1\u23B4-\u23B6\u23DC-\u23DF\u23E2\u23E7\u2423\u24C8\u2500\u2502\u250C\u2510\u2514\u2518\u251C\u2524\u252C\u2534\u253C\u2550-\u256C\u2580\u2584\u2588\u2591-\u2593\u25A1\u25AA\u25AB\u25AD\u25AE\u25B1\u25B3-\u25B5\u25B8\u25B9\u25BD-\u25BF\u25C2\u25C3\u25CA\u25CB\u25EC\u25EF\u25F8-\u25FC\u2605\u2606\u260E\u2640\u2642\u2660\u2663\u2665\u2666\u266A\u266D-\u266F\u2713\u2717\u2720\u2736\u2758\u2772\u2773\u27C8\u27C9\u27E6-\u27ED\u27F5-\u27FA\u27FC\u27FF\u2902-\u2905\u290C-\u2913\u2916\u2919-\u2920\u2923-\u292A\u2933\u2935-\u2939\u293C\u293D\u2945\u2948-\u294B\u294E-\u2976\u2978\u2979\u297B-\u297F\u2985\u2986\u298B-\u2996\u299A\u299C\u299D\u29A4-\u29B7\u29B9\u29BB\u29BC\u29BE-\u29C5\u29C9\u29CD-\u29D0\u29DC-\u29DE\u29E3-\u29E5\u29EB\u29F4\u29F6\u2A00-\u2A02\u2A04\u2A06\u2A0C\u2A0D\u2A10-\u2A17\u2A22-\u2A27\u2A29\u2A2A\u2A2D-\u2A31\u2A33-\u2A3C\u2A3F\u2A40\u2A42-\u2A4D\u2A50\u2A53-\u2A58\u2A5A-\u2A5D\u2A5F\u2A66\u2A6A\u2A6D-\u2A75\u2A77-\u2A9A\u2A9D-\u2AA2\u2AA4-\u2AB0\u2AB3-\u2AC8\u2ACB\u2ACC\u2ACF-\u2ADB\u2AE4\u2AE6-\u2AE9\u2AEB-\u2AF3\u2AFD\uFB00-\uFB04]|\uD835[\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDCCF\uDD04\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDD6B]/g;
  11449. var encodeMap = {'\xAD':'shy','\u200C':'zwnj','\u200D':'zwj','\u200E':'lrm','\u2063':'ic','\u2062':'it','\u2061':'af','\u200F':'rlm','\u200B':'ZeroWidthSpace','\u2060':'NoBreak','\u0311':'DownBreve','\u20DB':'tdot','\u20DC':'DotDot','\t':'Tab','\n':'NewLine','\u2008':'puncsp','\u205F':'MediumSpace','\u2009':'thinsp','\u200A':'hairsp','\u2004':'emsp13','\u2002':'ensp','\u2005':'emsp14','\u2003':'emsp','\u2007':'numsp','\xA0':'nbsp','\u205F\u200A':'ThickSpace','\u203E':'oline','_':'lowbar','\u2010':'dash','\u2013':'ndash','\u2014':'mdash','\u2015':'horbar',',':'comma',';':'semi','\u204F':'bsemi',':':'colon','\u2A74':'Colone','!':'excl','\xA1':'iexcl','?':'quest','\xBF':'iquest','.':'period','\u2025':'nldr','\u2026':'mldr','\xB7':'middot','\'':'apos','\u2018':'lsquo','\u2019':'rsquo','\u201A':'sbquo','\u2039':'lsaquo','\u203A':'rsaquo','"':'quot','\u201C':'ldquo','\u201D':'rdquo','\u201E':'bdquo','\xAB':'laquo','\xBB':'raquo','(':'lpar',')':'rpar','[':'lsqb',']':'rsqb','{':'lcub','}':'rcub','\u2308':'lceil','\u2309':'rceil','\u230A':'lfloor','\u230B':'rfloor','\u2985':'lopar','\u2986':'ropar','\u298B':'lbrke','\u298C':'rbrke','\u298D':'lbrkslu','\u298E':'rbrksld','\u298F':'lbrksld','\u2990':'rbrkslu','\u2991':'langd','\u2992':'rangd','\u2993':'lparlt','\u2994':'rpargt','\u2995':'gtlPar','\u2996':'ltrPar','\u27E6':'lobrk','\u27E7':'robrk','\u27E8':'lang','\u27E9':'rang','\u27EA':'Lang','\u27EB':'Rang','\u27EC':'loang','\u27ED':'roang','\u2772':'lbbrk','\u2773':'rbbrk','\u2016':'Vert','\xA7':'sect','\xB6':'para','@':'commat','*':'ast','/':'sol','undefined':null,'&':'amp','#':'num','%':'percnt','\u2030':'permil','\u2031':'pertenk','\u2020':'dagger','\u2021':'Dagger','\u2022':'bull','\u2043':'hybull','\u2032':'prime','\u2033':'Prime','\u2034':'tprime','\u2057':'qprime','\u2035':'bprime','\u2041':'caret','`':'grave','\xB4':'acute','\u02DC':'tilde','^':'Hat','\xAF':'macr','\u02D8':'breve','\u02D9':'dot','\xA8':'die','\u02DA':'ring','\u02DD':'dblac','\xB8':'cedil','\u02DB':'ogon','\u02C6':'circ','\u02C7':'caron','\xB0':'deg','\xA9':'copy','\xAE':'reg','\u2117':'copysr','\u2118':'wp','\u211E':'rx','\u2127':'mho','\u2129':'iiota','\u2190':'larr','\u219A':'nlarr','\u2192':'rarr','\u219B':'nrarr','\u2191':'uarr','\u2193':'darr','\u2194':'harr','\u21AE':'nharr','\u2195':'varr','\u2196':'nwarr','\u2197':'nearr','\u2198':'searr','\u2199':'swarr','\u219D':'rarrw','\u219D\u0338':'nrarrw','\u219E':'Larr','\u219F':'Uarr','\u21A0':'Rarr','\u21A1':'Darr','\u21A2':'larrtl','\u21A3':'rarrtl','\u21A4':'mapstoleft','\u21A5':'mapstoup','\u21A6':'map','\u21A7':'mapstodown','\u21A9':'larrhk','\u21AA':'rarrhk','\u21AB':'larrlp','\u21AC':'rarrlp','\u21AD':'harrw','\u21B0':'lsh','\u21B1':'rsh','\u21B2':'ldsh','\u21B3':'rdsh','\u21B5':'crarr','\u21B6':'cularr','\u21B7':'curarr','\u21BA':'olarr','\u21BB':'orarr','\u21BC':'lharu','\u21BD':'lhard','\u21BE':'uharr','\u21BF':'uharl','\u21C0':'rharu','\u21C1':'rhard','\u21C2':'dharr','\u21C3':'dharl','\u21C4':'rlarr','\u21C5':'udarr','\u21C6':'lrarr','\u21C7':'llarr','\u21C8':'uuarr','\u21C9':'rrarr','\u21CA':'ddarr','\u21CB':'lrhar','\u21CC':'rlhar','\u21D0':'lArr','\u21CD':'nlArr','\u21D1':'uArr','\u21D2':'rArr','\u21CF':'nrArr','\u21D3':'dArr','\u21D4':'iff','\u21CE':'nhArr','\u21D5':'vArr','\u21D6':'nwArr','\u21D7':'neArr','\u21D8':'seArr','\u21D9':'swArr','\u21DA':'lAarr','\u21DB':'rAarr','\u21DD':'zigrarr','\u21E4':'larrb','\u21E5':'rarrb','\u21F5':'duarr','\u21FD':'loarr','\u21FE':'roarr','\u21FF':'hoarr','\u2200':'forall','\u2201':'comp','\u2202':'part','\u2202\u0338':'npart','\u2203':'exist','\u2204':'nexist','\u2205':'empty','\u2207':'Del','\u2208':'in','\u2209':'notin','\u220B':'ni','\u220C':'notni','\u03F6':'bepsi','\u220F':'prod','\u2210':'coprod','\u2211':'sum','+':'plus','\xB1':'pm','\xF7':'div','\xD7':'times','<':'lt','\u226E':'nlt','<\u20D2':'nvlt','=':'equals','\u2260':'ne','=\u20E5':'bne','\u2A75':'Equal','>':'gt','\u226F':'ngt','>\u20D2':'nvgt','\xAC':'not','|':'vert','\xA6':'brvbar','\u2212':'minus','\u2213':'mp','\u2214':'plusdo','\u2044':'frasl','\u2216':'setmn','\u2217':'lowast','\u2218':'compfn','\u221A':'Sqrt','\u221D':'prop','\u221E':'infin','\u221F':'angrt','\u2220':'ang','\u2220\u20D2':'nang','\u2221':'angmsd','\u2222':'angsph','\u2223':'mid','\u2224':'nmid','\u2225':'par','\u2226':'npar','\u2227':'and','\u2228':'or','\u2229':'cap','\u2229\uFE00':'caps','\u222A':'cup','\u222A\uFE00':'cups','\u222B':'int','\u222C':'Int','\u222D':'tint','\u2A0C':'qint','\u222E':'oint','\u222F':'Conint','\u2230':'Cconint','\u2231':'cwint','\u2232':'cwconint','\u2233':'awconint','\u2234':'there4','\u2235':'becaus','\u2236':'ratio','\u2237':'Colon','\u2238':'minusd','\u223A':'mDDot','\u223B':'homtht','\u223C':'sim','\u2241':'nsim','\u223C\u20D2':'nvsim','\u223D':'bsim','\u223D\u0331':'race','\u223E':'ac','\u223E\u0333':'acE','\u223F':'acd','\u2240':'wr','\u2242':'esim','\u2242\u0338':'nesim','\u2243':'sime','\u2244':'nsime','\u2245':'cong','\u2247':'ncong','\u2246':'simne','\u2248':'ap','\u2249':'nap','\u224A':'ape','\u224B':'apid','\u224B\u0338':'napid','\u224C':'bcong','\u224D':'CupCap','\u226D':'NotCupCap','\u224D\u20D2':'nvap','\u224E':'bump','\u224E\u0338':'nbump','\u224F':'bumpe','\u224F\u0338':'nbumpe','\u2250':'doteq','\u2250\u0338':'nedot','\u2251':'eDot','\u2252':'efDot','\u2253':'erDot','\u2254':'colone','\u2255':'ecolon','\u2256':'ecir','\u2257':'cire','\u2259':'wedgeq','\u225A':'veeeq','\u225C':'trie','\u225F':'equest','\u2261':'equiv','\u2262':'nequiv','\u2261\u20E5':'bnequiv','\u2264':'le','\u2270':'nle','\u2264\u20D2':'nvle','\u2265':'ge','\u2271':'nge','\u2265\u20D2':'nvge','\u2266':'lE','\u2266\u0338':'nlE','\u2267':'gE','\u2267\u0338':'ngE','\u2268\uFE00':'lvnE','\u2268':'lnE','\u2269':'gnE','\u2269\uFE00':'gvnE','\u226A':'ll','\u226A\u0338':'nLtv','\u226A\u20D2':'nLt','\u226B':'gg','\u226B\u0338':'nGtv','\u226B\u20D2':'nGt','\u226C':'twixt','\u2272':'lsim','\u2274':'nlsim','\u2273':'gsim','\u2275':'ngsim','\u2276':'lg','\u2278':'ntlg','\u2277':'gl','\u2279':'ntgl','\u227A':'pr','\u2280':'npr','\u227B':'sc','\u2281':'nsc','\u227C':'prcue','\u22E0':'nprcue','\u227D':'sccue','\u22E1':'nsccue','\u227E':'prsim','\u227F':'scsim','\u227F\u0338':'NotSucceedsTilde','\u2282':'sub','\u2284':'nsub','\u2282\u20D2':'vnsub','\u2283':'sup','\u2285':'nsup','\u2283\u20D2':'vnsup','\u2286':'sube','\u2288':'nsube','\u2287':'supe','\u2289':'nsupe','\u228A\uFE00':'vsubne','\u228A':'subne','\u228B\uFE00':'vsupne','\u228B':'supne','\u228D':'cupdot','\u228E':'uplus','\u228F':'sqsub','\u228F\u0338':'NotSquareSubset','\u2290':'sqsup','\u2290\u0338':'NotSquareSuperset','\u2291':'sqsube','\u22E2':'nsqsube','\u2292':'sqsupe','\u22E3':'nsqsupe','\u2293':'sqcap','\u2293\uFE00':'sqcaps','\u2294':'sqcup','\u2294\uFE00':'sqcups','\u2295':'oplus','\u2296':'ominus','\u2297':'otimes','\u2298':'osol','\u2299':'odot','\u229A':'ocir','\u229B':'oast','\u229D':'odash','\u229E':'plusb','\u229F':'minusb','\u22A0':'timesb','\u22A1':'sdotb','\u22A2':'vdash','\u22AC':'nvdash','\u22A3':'dashv','\u22A4':'top','\u22A5':'bot','\u22A7':'models','\u22A8':'vDash','\u22AD':'nvDash','\u22A9':'Vdash','\u22AE':'nVdash','\u22AA':'Vvdash','\u22AB':'VDash','\u22AF':'nVDash','\u22B0':'prurel','\u22B2':'vltri','\u22EA':'nltri','\u22B3':'vrtri','\u22EB':'nrtri','\u22B4':'ltrie','\u22EC':'nltrie','\u22B4\u20D2':'nvltrie','\u22B5':'rtrie','\u22ED':'nrtrie','\u22B5\u20D2':'nvrtrie','\u22B6':'origof','\u22B7':'imof','\u22B8':'mumap','\u22B9':'hercon','\u22BA':'intcal','\u22BB':'veebar','\u22BD':'barvee','\u22BE':'angrtvb','\u22BF':'lrtri','\u22C0':'Wedge','\u22C1':'Vee','\u22C2':'xcap','\u22C3':'xcup','\u22C4':'diam','\u22C5':'sdot','\u22C6':'Star','\u22C7':'divonx','\u22C8':'bowtie','\u22C9':'ltimes','\u22CA':'rtimes','\u22CB':'lthree','\u22CC':'rthree','\u22CD':'bsime','\u22CE':'cuvee','\u22CF':'cuwed','\u22D0':'Sub','\u22D1':'Sup','\u22D2':'Cap','\u22D3':'Cup','\u22D4':'fork','\u22D5':'epar','\u22D6':'ltdot','\u22D7':'gtdot','\u22D8':'Ll','\u22D8\u0338':'nLl','\u22D9':'Gg','\u22D9\u0338':'nGg','\u22DA\uFE00':'lesg','\u22DA':'leg','\u22DB':'gel','\u22DB\uFE00':'gesl','\u22DE':'cuepr','\u22DF':'cuesc','\u22E6':'lnsim','\u22E7':'gnsim','\u22E8':'prnsim','\u22E9':'scnsim','\u22EE':'vellip','\u22EF':'ctdot','\u22F0':'utdot','\u22F1':'dtdot','\u22F2':'disin','\u22F3':'isinsv','\u22F4':'isins','\u22F5':'isindot','\u22F5\u0338':'notindot','\u22F6':'notinvc','\u22F7':'notinvb','\u22F9':'isinE','\u22F9\u0338':'notinE','\u22FA':'nisd','\u22FB':'xnis','\u22FC':'nis','\u22FD':'notnivc','\u22FE':'notnivb','\u2305':'barwed','\u2306':'Barwed','\u230C':'drcrop','\u230D':'dlcrop','\u230E':'urcrop','\u230F':'ulcrop','\u2310':'bnot','\u2312':'profline','\u2313':'profsurf','\u2315':'telrec','\u2316':'target','\u231C':'ulcorn','\u231D':'urcorn','\u231E':'dlcorn','\u231F':'drcorn','\u2322':'frown','\u2323':'smile','\u232D':'cylcty','\u232E':'profalar','\u2336':'topbot','\u233D':'ovbar','\u233F':'solbar','\u237C':'angzarr','\u23B0':'lmoust','\u23B1':'rmoust','\u23B4':'tbrk','\u23B5':'bbrk','\u23B6':'bbrktbrk','\u23DC':'OverParenthesis','\u23DD':'UnderParenthesis','\u23DE':'OverBrace','\u23DF':'UnderBrace','\u23E2':'trpezium','\u23E7':'elinters','\u2423':'blank','\u2500':'boxh','\u2502':'boxv','\u250C':'boxdr','\u2510':'boxdl','\u2514':'boxur','\u2518':'boxul','\u251C':'boxvr','\u2524':'boxvl','\u252C':'boxhd','\u2534':'boxhu','\u253C':'boxvh','\u2550':'boxH','\u2551':'boxV','\u2552':'boxdR','\u2553':'boxDr','\u2554':'boxDR','\u2555':'boxdL','\u2556':'boxDl','\u2557':'boxDL','\u2558':'boxuR','\u2559':'boxUr','\u255A':'boxUR','\u255B':'boxuL','\u255C':'boxUl','\u255D':'boxUL','\u255E':'boxvR','\u255F':'boxVr','\u2560':'boxVR','\u2561':'boxvL','\u2562':'boxVl','\u2563':'boxVL','\u2564':'boxHd','\u2565':'boxhD','\u2566':'boxHD','\u2567':'boxHu','\u2568':'boxhU','\u2569':'boxHU','\u256A':'boxvH','\u256B':'boxVh','\u256C':'boxVH','\u2580':'uhblk','\u2584':'lhblk','\u2588':'block','\u2591':'blk14','\u2592':'blk12','\u2593':'blk34','\u25A1':'squ','\u25AA':'squf','\u25AB':'EmptyVerySmallSquare','\u25AD':'rect','\u25AE':'marker','\u25B1':'fltns','\u25B3':'xutri','\u25B4':'utrif','\u25B5':'utri','\u25B8':'rtrif','\u25B9':'rtri','\u25BD':'xdtri','\u25BE':'dtrif','\u25BF':'dtri','\u25C2':'ltrif','\u25C3':'ltri','\u25CA':'loz','\u25CB':'cir','\u25EC':'tridot','\u25EF':'xcirc','\u25F8':'ultri','\u25F9':'urtri','\u25FA':'lltri','\u25FB':'EmptySmallSquare','\u25FC':'FilledSmallSquare','\u2605':'starf','\u2606':'star','\u260E':'phone','\u2640':'female','\u2642':'male','\u2660':'spades','\u2663':'clubs','\u2665':'hearts','\u2666':'diams','\u266A':'sung','\u2713':'check','\u2717':'cross','\u2720':'malt','\u2736':'sext','\u2758':'VerticalSeparator','\u27C8':'bsolhsub','\u27C9':'suphsol','\u27F5':'xlarr','\u27F6':'xrarr','\u27F7':'xharr','\u27F8':'xlArr','\u27F9':'xrArr','\u27FA':'xhArr','\u27FC':'xmap','\u27FF':'dzigrarr','\u2902':'nvlArr','\u2903':'nvrArr','\u2904':'nvHarr','\u2905':'Map','\u290C':'lbarr','\u290D':'rbarr','\u290E':'lBarr','\u290F':'rBarr','\u2910':'RBarr','\u2911':'DDotrahd','\u2912':'UpArrowBar','\u2913':'DownArrowBar','\u2916':'Rarrtl','\u2919':'latail','\u291A':'ratail','\u291B':'lAtail','\u291C':'rAtail','\u291D':'larrfs','\u291E':'rarrfs','\u291F':'larrbfs','\u2920':'rarrbfs','\u2923':'nwarhk','\u2924':'nearhk','\u2925':'searhk','\u2926':'swarhk','\u2927':'nwnear','\u2928':'toea','\u2929':'tosa','\u292A':'swnwar','\u2933':'rarrc','\u2933\u0338':'nrarrc','\u2935':'cudarrr','\u2936':'ldca','\u2937':'rdca','\u2938':'cudarrl','\u2939':'larrpl','\u293C':'curarrm','\u293D':'cularrp','\u2945':'rarrpl','\u2948':'harrcir','\u2949':'Uarrocir','\u294A':'lurdshar','\u294B':'ldrushar','\u294E':'LeftRightVector','\u294F':'RightUpDownVector','\u2950':'DownLeftRightVector','\u2951':'LeftUpDownVector','\u2952':'LeftVectorBar','\u2953':'RightVectorBar','\u2954':'RightUpVectorBar','\u2955':'RightDownVectorBar','\u2956':'DownLeftVectorBar','\u2957':'DownRightVectorBar','\u2958':'LeftUpVectorBar','\u2959':'LeftDownVectorBar','\u295A':'LeftTeeVector','\u295B':'RightTeeVector','\u295C':'RightUpTeeVector','\u295D':'RightDownTeeVector','\u295E':'DownLeftTeeVector','\u295F':'DownRightTeeVector','\u2960':'LeftUpTeeVector','\u2961':'LeftDownTeeVector','\u2962':'lHar','\u2963':'uHar','\u2964':'rHar','\u2965':'dHar','\u2966':'luruhar','\u2967':'ldrdhar','\u2968':'ruluhar','\u2969':'rdldhar','\u296A':'lharul','\u296B':'llhard','\u296C':'rharul','\u296D':'lrhard','\u296E':'udhar','\u296F':'duhar','\u2970':'RoundImplies','\u2971':'erarr','\u2972':'simrarr','\u2973':'larrsim','\u2974':'rarrsim','\u2975':'rarrap','\u2976':'ltlarr','\u2978':'gtrarr','\u2979':'subrarr','\u297B':'suplarr','\u297C':'lfisht','\u297D':'rfisht','\u297E':'ufisht','\u297F':'dfisht','\u299A':'vzigzag','\u299C':'vangrt','\u299D':'angrtvbd','\u29A4':'ange','\u29A5':'range','\u29A6':'dwangle','\u29A7':'uwangle','\u29A8':'angmsdaa','\u29A9':'angmsdab','\u29AA':'angmsdac','\u29AB':'angmsdad','\u29AC':'angmsdae','\u29AD':'angmsdaf','\u29AE':'angmsdag','\u29AF':'angmsdah','\u29B0':'bemptyv','\u29B1':'demptyv','\u29B2':'cemptyv','\u29B3':'raemptyv','\u29B4':'laemptyv','\u29B5':'ohbar','\u29B6':'omid','\u29B7':'opar','\u29B9':'operp','\u29BB':'olcross','\u29BC':'odsold','\u29BE':'olcir','\u29BF':'ofcir','\u29C0':'olt','\u29C1':'ogt','\u29C2':'cirscir','\u29C3':'cirE','\u29C4':'solb','\u29C5':'bsolb','\u29C9':'boxbox','\u29CD':'trisb','\u29CE':'rtriltri','\u29CF':'LeftTriangleBar','\u29CF\u0338':'NotLeftTriangleBar','\u29D0':'RightTriangleBar','\u29D0\u0338':'NotRightTriangleBar','\u29DC':'iinfin','\u29DD':'infintie','\u29DE':'nvinfin','\u29E3':'eparsl','\u29E4':'smeparsl','\u29E5':'eqvparsl','\u29EB':'lozf','\u29F4':'RuleDelayed','\u29F6':'dsol','\u2A00':'xodot','\u2A01':'xoplus','\u2A02':'xotime','\u2A04':'xuplus','\u2A06':'xsqcup','\u2A0D':'fpartint','\u2A10':'cirfnint','\u2A11':'awint','\u2A12':'rppolint','\u2A13':'scpolint','\u2A14':'npolint','\u2A15':'pointint','\u2A16':'quatint','\u2A17':'intlarhk','\u2A22':'pluscir','\u2A23':'plusacir','\u2A24':'simplus','\u2A25':'plusdu','\u2A26':'plussim','\u2A27':'plustwo','\u2A29':'mcomma','\u2A2A':'minusdu','\u2A2D':'loplus','\u2A2E':'roplus','\u2A2F':'Cross','\u2A30':'timesd','\u2A31':'timesbar','\u2A33':'smashp','\u2A34':'lotimes','\u2A35':'rotimes','\u2A36':'otimesas','\u2A37':'Otimes','\u2A38':'odiv','\u2A39':'triplus','\u2A3A':'triminus','\u2A3B':'tritime','\u2A3C':'iprod','\u2A3F':'amalg','\u2A40':'capdot','\u2A42':'ncup','\u2A43':'ncap','\u2A44':'capand','\u2A45':'cupor','\u2A46':'cupcap','\u2A47':'capcup','\u2A48':'cupbrcap','\u2A49':'capbrcup','\u2A4A':'cupcup','\u2A4B':'capcap','\u2A4C':'ccups','\u2A4D':'ccaps','\u2A50':'ccupssm','\u2A53':'And','\u2A54':'Or','\u2A55':'andand','\u2A56':'oror','\u2A57':'orslope','\u2A58':'andslope','\u2A5A':'andv','\u2A5B':'orv','\u2A5C':'andd','\u2A5D':'ord','\u2A5F':'wedbar','\u2A66':'sdote','\u2A6A':'simdot','\u2A6D':'congdot','\u2A6D\u0338':'ncongdot','\u2A6E':'easter','\u2A6F':'apacir','\u2A70':'apE','\u2A70\u0338':'napE','\u2A71':'eplus','\u2A72':'pluse','\u2A73':'Esim','\u2A77':'eDDot','\u2A78':'equivDD','\u2A79':'ltcir','\u2A7A':'gtcir','\u2A7B':'ltquest','\u2A7C':'gtquest','\u2A7D':'les','\u2A7D\u0338':'nles','\u2A7E':'ges','\u2A7E\u0338':'nges','\u2A7F':'lesdot','\u2A80':'gesdot','\u2A81':'lesdoto','\u2A82':'gesdoto','\u2A83':'lesdotor','\u2A84':'gesdotol','\u2A85':'lap','\u2A86':'gap','\u2A87':'lne','\u2A88':'gne','\u2A89':'lnap','\u2A8A':'gnap','\u2A8B':'lEg','\u2A8C':'gEl','\u2A8D':'lsime','\u2A8E':'gsime','\u2A8F':'lsimg','\u2A90':'gsiml','\u2A91':'lgE','\u2A92':'glE','\u2A93':'lesges','\u2A94':'gesles','\u2A95':'els','\u2A96':'egs','\u2A97':'elsdot','\u2A98':'egsdot','\u2A99':'el','\u2A9A':'eg','\u2A9D':'siml','\u2A9E':'simg','\u2A9F':'simlE','\u2AA0':'simgE','\u2AA1':'LessLess','\u2AA1\u0338':'NotNestedLessLess','\u2AA2':'GreaterGreater','\u2AA2\u0338':'NotNestedGreaterGreater','\u2AA4':'glj','\u2AA5':'gla','\u2AA6':'ltcc','\u2AA7':'gtcc','\u2AA8':'lescc','\u2AA9':'gescc','\u2AAA':'smt','\u2AAB':'lat','\u2AAC':'smte','\u2AAC\uFE00':'smtes','\u2AAD':'late','\u2AAD\uFE00':'lates','\u2AAE':'bumpE','\u2AAF':'pre','\u2AAF\u0338':'npre','\u2AB0':'sce','\u2AB0\u0338':'nsce','\u2AB3':'prE','\u2AB4':'scE','\u2AB5':'prnE','\u2AB6':'scnE','\u2AB7':'prap','\u2AB8':'scap','\u2AB9':'prnap','\u2ABA':'scnap','\u2ABB':'Pr','\u2ABC':'Sc','\u2ABD':'subdot','\u2ABE':'supdot','\u2ABF':'subplus','\u2AC0':'supplus','\u2AC1':'submult','\u2AC2':'supmult','\u2AC3':'subedot','\u2AC4':'supedot','\u2AC5':'subE','\u2AC5\u0338':'nsubE','\u2AC6':'supE','\u2AC6\u0338':'nsupE','\u2AC7':'subsim','\u2AC8':'supsim','\u2ACB\uFE00':'vsubnE','\u2ACB':'subnE','\u2ACC\uFE00':'vsupnE','\u2ACC':'supnE','\u2ACF':'csub','\u2AD0':'csup','\u2AD1':'csube','\u2AD2':'csupe','\u2AD3':'subsup','\u2AD4':'supsub','\u2AD5':'subsub','\u2AD6':'supsup','\u2AD7':'suphsub','\u2AD8':'supdsub','\u2AD9':'forkv','\u2ADA':'topfork','\u2ADB':'mlcp','\u2AE4':'Dashv','\u2AE6':'Vdashl','\u2AE7':'Barv','\u2AE8':'vBar','\u2AE9':'vBarv','\u2AEB':'Vbar','\u2AEC':'Not','\u2AED':'bNot','\u2AEE':'rnmid','\u2AEF':'cirmid','\u2AF0':'midcir','\u2AF1':'topcir','\u2AF2':'nhpar','\u2AF3':'parsim','\u2AFD':'parsl','\u2AFD\u20E5':'nparsl','\u266D':'flat','\u266E':'natur','\u266F':'sharp','\xA4':'curren','\xA2':'cent','$':'dollar','\xA3':'pound','\xA5':'yen','\u20AC':'euro','\xB9':'sup1','\xBD':'half','\u2153':'frac13','\xBC':'frac14','\u2155':'frac15','\u2159':'frac16','\u215B':'frac18','\xB2':'sup2','\u2154':'frac23','\u2156':'frac25','\xB3':'sup3','\xBE':'frac34','\u2157':'frac35','\u215C':'frac38','\u2158':'frac45','\u215A':'frac56','\u215D':'frac58','\u215E':'frac78','\uD835\uDCB6':'ascr','\uD835\uDD52':'aopf','\uD835\uDD1E':'afr','\uD835\uDD38':'Aopf','\uD835\uDD04':'Afr','\uD835\uDC9C':'Ascr','\xAA':'ordf','\xE1':'aacute','\xC1':'Aacute','\xE0':'agrave','\xC0':'Agrave','\u0103':'abreve','\u0102':'Abreve','\xE2':'acirc','\xC2':'Acirc','\xE5':'aring','\xC5':'angst','\xE4':'auml','\xC4':'Auml','\xE3':'atilde','\xC3':'Atilde','\u0105':'aogon','\u0104':'Aogon','\u0101':'amacr','\u0100':'Amacr','\xE6':'aelig','\xC6':'AElig','\uD835\uDCB7':'bscr','\uD835\uDD53':'bopf','\uD835\uDD1F':'bfr','\uD835\uDD39':'Bopf','\u212C':'Bscr','\uD835\uDD05':'Bfr','\uD835\uDD20':'cfr','\uD835\uDCB8':'cscr','\uD835\uDD54':'copf','\u212D':'Cfr','\uD835\uDC9E':'Cscr','\u2102':'Copf','\u0107':'cacute','\u0106':'Cacute','\u0109':'ccirc','\u0108':'Ccirc','\u010D':'ccaron','\u010C':'Ccaron','\u010B':'cdot','\u010A':'Cdot','\xE7':'ccedil','\xC7':'Ccedil','\u2105':'incare','\uD835\uDD21':'dfr','\u2146':'dd','\uD835\uDD55':'dopf','\uD835\uDCB9':'dscr','\uD835\uDC9F':'Dscr','\uD835\uDD07':'Dfr','\u2145':'DD','\uD835\uDD3B':'Dopf','\u010F':'dcaron','\u010E':'Dcaron','\u0111':'dstrok','\u0110':'Dstrok','\xF0':'eth','\xD0':'ETH','\u2147':'ee','\u212F':'escr','\uD835\uDD22':'efr','\uD835\uDD56':'eopf','\u2130':'Escr','\uD835\uDD08':'Efr','\uD835\uDD3C':'Eopf','\xE9':'eacute','\xC9':'Eacute','\xE8':'egrave','\xC8':'Egrave','\xEA':'ecirc','\xCA':'Ecirc','\u011B':'ecaron','\u011A':'Ecaron','\xEB':'euml','\xCB':'Euml','\u0117':'edot','\u0116':'Edot','\u0119':'eogon','\u0118':'Eogon','\u0113':'emacr','\u0112':'Emacr','\uD835\uDD23':'ffr','\uD835\uDD57':'fopf','\uD835\uDCBB':'fscr','\uD835\uDD09':'Ffr','\uD835\uDD3D':'Fopf','\u2131':'Fscr','\uFB00':'fflig','\uFB03':'ffilig','\uFB04':'ffllig','\uFB01':'filig','fj':'fjlig','\uFB02':'fllig','\u0192':'fnof','\u210A':'gscr','\uD835\uDD58':'gopf','\uD835\uDD24':'gfr','\uD835\uDCA2':'Gscr','\uD835\uDD3E':'Gopf','\uD835\uDD0A':'Gfr','\u01F5':'gacute','\u011F':'gbreve','\u011E':'Gbreve','\u011D':'gcirc','\u011C':'Gcirc','\u0121':'gdot','\u0120':'Gdot','\u0122':'Gcedil','\uD835\uDD25':'hfr','\u210E':'planckh','\uD835\uDCBD':'hscr','\uD835\uDD59':'hopf','\u210B':'Hscr','\u210C':'Hfr','\u210D':'Hopf','\u0125':'hcirc','\u0124':'Hcirc','\u210F':'hbar','\u0127':'hstrok','\u0126':'Hstrok','\uD835\uDD5A':'iopf','\uD835\uDD26':'ifr','\uD835\uDCBE':'iscr','\u2148':'ii','\uD835\uDD40':'Iopf','\u2110':'Iscr','\u2111':'Im','\xED':'iacute','\xCD':'Iacute','\xEC':'igrave','\xCC':'Igrave','\xEE':'icirc','\xCE':'Icirc','\xEF':'iuml','\xCF':'Iuml','\u0129':'itilde','\u0128':'Itilde','\u0130':'Idot','\u012F':'iogon','\u012E':'Iogon','\u012B':'imacr','\u012A':'Imacr','\u0133':'ijlig','\u0132':'IJlig','\u0131':'imath','\uD835\uDCBF':'jscr','\uD835\uDD5B':'jopf','\uD835\uDD27':'jfr','\uD835\uDCA5':'Jscr','\uD835\uDD0D':'Jfr','\uD835\uDD41':'Jopf','\u0135':'jcirc','\u0134':'Jcirc','\u0237':'jmath','\uD835\uDD5C':'kopf','\uD835\uDCC0':'kscr','\uD835\uDD28':'kfr','\uD835\uDCA6':'Kscr','\uD835\uDD42':'Kopf','\uD835\uDD0E':'Kfr','\u0137':'kcedil','\u0136':'Kcedil','\uD835\uDD29':'lfr','\uD835\uDCC1':'lscr','\u2113':'ell','\uD835\uDD5D':'lopf','\u2112':'Lscr','\uD835\uDD0F':'Lfr','\uD835\uDD43':'Lopf','\u013A':'lacute','\u0139':'Lacute','\u013E':'lcaron','\u013D':'Lcaron','\u013C':'lcedil','\u013B':'Lcedil','\u0142':'lstrok','\u0141':'Lstrok','\u0140':'lmidot','\u013F':'Lmidot','\uD835\uDD2A':'mfr','\uD835\uDD5E':'mopf','\uD835\uDCC2':'mscr','\uD835\uDD10':'Mfr','\uD835\uDD44':'Mopf','\u2133':'Mscr','\uD835\uDD2B':'nfr','\uD835\uDD5F':'nopf','\uD835\uDCC3':'nscr','\u2115':'Nopf','\uD835\uDCA9':'Nscr','\uD835\uDD11':'Nfr','\u0144':'nacute','\u0143':'Nacute','\u0148':'ncaron','\u0147':'Ncaron','\xF1':'ntilde','\xD1':'Ntilde','\u0146':'ncedil','\u0145':'Ncedil','\u2116':'numero','\u014B':'eng','\u014A':'ENG','\uD835\uDD60':'oopf','\uD835\uDD2C':'ofr','\u2134':'oscr','\uD835\uDCAA':'Oscr','\uD835\uDD12':'Ofr','\uD835\uDD46':'Oopf','\xBA':'ordm','\xF3':'oacute','\xD3':'Oacute','\xF2':'ograve','\xD2':'Ograve','\xF4':'ocirc','\xD4':'Ocirc','\xF6':'ouml','\xD6':'Ouml','\u0151':'odblac','\u0150':'Odblac','\xF5':'otilde','\xD5':'Otilde','\xF8':'oslash','\xD8':'Oslash','\u014D':'omacr','\u014C':'Omacr','\u0153':'oelig','\u0152':'OElig','\uD835\uDD2D':'pfr','\uD835\uDCC5':'pscr','\uD835\uDD61':'popf','\u2119':'Popf','\uD835\uDD13':'Pfr','\uD835\uDCAB':'Pscr','\uD835\uDD62':'qopf','\uD835\uDD2E':'qfr','\uD835\uDCC6':'qscr','\uD835\uDCAC':'Qscr','\uD835\uDD14':'Qfr','\u211A':'Qopf','\u0138':'kgreen','\uD835\uDD2F':'rfr','\uD835\uDD63':'ropf','\uD835\uDCC7':'rscr','\u211B':'Rscr','\u211C':'Re','\u211D':'Ropf','\u0155':'racute','\u0154':'Racute','\u0159':'rcaron','\u0158':'Rcaron','\u0157':'rcedil','\u0156':'Rcedil','\uD835\uDD64':'sopf','\uD835\uDCC8':'sscr','\uD835\uDD30':'sfr','\uD835\uDD4A':'Sopf','\uD835\uDD16':'Sfr','\uD835\uDCAE':'Sscr','\u24C8':'oS','\u015B':'sacute','\u015A':'Sacute','\u015D':'scirc','\u015C':'Scirc','\u0161':'scaron','\u0160':'Scaron','\u015F':'scedil','\u015E':'Scedil','\xDF':'szlig','\uD835\uDD31':'tfr','\uD835\uDCC9':'tscr','\uD835\uDD65':'topf','\uD835\uDCAF':'Tscr','\uD835\uDD17':'Tfr','\uD835\uDD4B':'Topf','\u0165':'tcaron','\u0164':'Tcaron','\u0163':'tcedil','\u0162':'Tcedil','\u2122':'trade','\u0167':'tstrok','\u0166':'Tstrok','\uD835\uDCCA':'uscr','\uD835\uDD66':'uopf','\uD835\uDD32':'ufr','\uD835\uDD4C':'Uopf','\uD835\uDD18':'Ufr','\uD835\uDCB0':'Uscr','\xFA':'uacute','\xDA':'Uacute','\xF9':'ugrave','\xD9':'Ugrave','\u016D':'ubreve','\u016C':'Ubreve','\xFB':'ucirc','\xDB':'Ucirc','\u016F':'uring','\u016E':'Uring','\xFC':'uuml','\xDC':'Uuml','\u0171':'udblac','\u0170':'Udblac','\u0169':'utilde','\u0168':'Utilde','\u0173':'uogon','\u0172':'Uogon','\u016B':'umacr','\u016A':'Umacr','\uD835\uDD33':'vfr','\uD835\uDD67':'vopf','\uD835\uDCCB':'vscr','\uD835\uDD19':'Vfr','\uD835\uDD4D':'Vopf','\uD835\uDCB1':'Vscr','\uD835\uDD68':'wopf','\uD835\uDCCC':'wscr','\uD835\uDD34':'wfr','\uD835\uDCB2':'Wscr','\uD835\uDD4E':'Wopf','\uD835\uDD1A':'Wfr','\u0175':'wcirc','\u0174':'Wcirc','\uD835\uDD35':'xfr','\uD835\uDCCD':'xscr','\uD835\uDD69':'xopf','\uD835\uDD4F':'Xopf','\uD835\uDD1B':'Xfr','\uD835\uDCB3':'Xscr','\uD835\uDD36':'yfr','\uD835\uDCCE':'yscr','\uD835\uDD6A':'yopf','\uD835\uDCB4':'Yscr','\uD835\uDD1C':'Yfr','\uD835\uDD50':'Yopf','\xFD':'yacute','\xDD':'Yacute','\u0177':'ycirc','\u0176':'Ycirc','\xFF':'yuml','\u0178':'Yuml','\uD835\uDCCF':'zscr','\uD835\uDD37':'zfr','\uD835\uDD6B':'zopf','\u2128':'Zfr','\u2124':'Zopf','\uD835\uDCB5':'Zscr','\u017A':'zacute','\u0179':'Zacute','\u017E':'zcaron','\u017D':'Zcaron','\u017C':'zdot','\u017B':'Zdot','\u01B5':'imped','\xFE':'thorn','\xDE':'THORN','\u0149':'napos','\u03B1':'alpha','\u0391':'Alpha','\u03B2':'beta','\u0392':'Beta','\u03B3':'gamma','\u0393':'Gamma','\u03B4':'delta','\u0394':'Delta','\u03B5':'epsi','\u03F5':'epsiv','\u0395':'Epsilon','\u03DD':'gammad','\u03DC':'Gammad','\u03B6':'zeta','\u0396':'Zeta','\u03B7':'eta','\u0397':'Eta','\u03B8':'theta','\u03D1':'thetav','\u0398':'Theta','\u03B9':'iota','\u0399':'Iota','\u03BA':'kappa','\u03F0':'kappav','\u039A':'Kappa','\u03BB':'lambda','\u039B':'Lambda','\u03BC':'mu','\xB5':'micro','\u039C':'Mu','\u03BD':'nu','\u039D':'Nu','\u03BE':'xi','\u039E':'Xi','\u03BF':'omicron','\u039F':'Omicron','\u03C0':'pi','\u03D6':'piv','\u03A0':'Pi','\u03C1':'rho','\u03F1':'rhov','\u03A1':'Rho','\u03C3':'sigma','\u03A3':'Sigma','\u03C2':'sigmaf','\u03C4':'tau','\u03A4':'Tau','\u03C5':'upsi','\u03A5':'Upsilon','\u03D2':'Upsi','\u03C6':'phi','\u03D5':'phiv','\u03A6':'Phi','\u03C7':'chi','\u03A7':'Chi','\u03C8':'psi','\u03A8':'Psi','\u03C9':'omega','\u03A9':'ohm','\u0430':'acy','\u0410':'Acy','\u0431':'bcy','\u0411':'Bcy','\u0432':'vcy','\u0412':'Vcy','\u0433':'gcy','\u0413':'Gcy','\u0453':'gjcy','\u0403':'GJcy','\u0434':'dcy','\u0414':'Dcy','\u0452':'djcy','\u0402':'DJcy','\u0435':'iecy','\u0415':'IEcy','\u0451':'iocy','\u0401':'IOcy','\u0454':'jukcy','\u0404':'Jukcy','\u0436':'zhcy','\u0416':'ZHcy','\u0437':'zcy','\u0417':'Zcy','\u0455':'dscy','\u0405':'DScy','\u0438':'icy','\u0418':'Icy','\u0456':'iukcy','\u0406':'Iukcy','\u0457':'yicy','\u0407':'YIcy','\u0439':'jcy','\u0419':'Jcy','\u0458':'jsercy','\u0408':'Jsercy','\u043A':'kcy','\u041A':'Kcy','\u045C':'kjcy','\u040C':'KJcy','\u043B':'lcy','\u041B':'Lcy','\u0459':'ljcy','\u0409':'LJcy','\u043C':'mcy','\u041C':'Mcy','\u043D':'ncy','\u041D':'Ncy','\u045A':'njcy','\u040A':'NJcy','\u043E':'ocy','\u041E':'Ocy','\u043F':'pcy','\u041F':'Pcy','\u0440':'rcy','\u0420':'Rcy','\u0441':'scy','\u0421':'Scy','\u0442':'tcy','\u0422':'Tcy','\u045B':'tshcy','\u040B':'TSHcy','\u0443':'ucy','\u0423':'Ucy','\u045E':'ubrcy','\u040E':'Ubrcy','\u0444':'fcy','\u0424':'Fcy','\u0445':'khcy','\u0425':'KHcy','\u0446':'tscy','\u0426':'TScy','\u0447':'chcy','\u0427':'CHcy','\u045F':'dzcy','\u040F':'DZcy','\u0448':'shcy','\u0428':'SHcy','\u0449':'shchcy','\u0429':'SHCHcy','\u044A':'hardcy','\u042A':'HARDcy','\u044B':'ycy','\u042B':'Ycy','\u044C':'softcy','\u042C':'SOFTcy','\u044D':'ecy','\u042D':'Ecy','\u044E':'yucy','\u042E':'YUcy','\u044F':'yacy','\u042F':'YAcy','\u2135':'aleph','\u2136':'beth','\u2137':'gimel','\u2138':'daleth'};
  11450. var regexEscape = /["&'<>`]/g;
  11451. var escapeMap = {
  11452. '"': '&quot;',
  11453. '&': '&amp;',
  11454. '\'': '&#x27;',
  11455. '<': '&lt;',
  11456. // See https://mathiasbynens.be/notes/ambiguous-ampersands: in HTML, the
  11457. // following is not strictly necessary unless it’s part of a tag or an
  11458. // unquoted attribute value. We’re only escaping it to support those
  11459. // situations, and for XML support.
  11460. '>': '&gt;',
  11461. // In Internet Explorer ≤ 8, the backtick character can be used
  11462. // to break out of (un)quoted attribute values or HTML comments.
  11463. // See http://html5sec.org/#102, http://html5sec.org/#108, and
  11464. // http://html5sec.org/#133.
  11465. '`': '&#x60;'
  11466. };
  11467. var regexInvalidEntity = /&#(?:[xX][^a-fA-F0-9]|[^0-9xX])/;
  11468. var regexInvalidRawCodePoint = /[\0-\x08\x0B\x0E-\x1F\x7F-\x9F\uFDD0-\uFDEF\uFFFE\uFFFF]|[\uD83F\uD87F\uD8BF\uD8FF\uD93F\uD97F\uD9BF\uD9FF\uDA3F\uDA7F\uDABF\uDAFF\uDB3F\uDB7F\uDBBF\uDBFF][\uDFFE\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/;
  11469. var regexDecode = /&(CounterClockwiseContourIntegral|DoubleLongLeftRightArrow|ClockwiseContourIntegral|NotNestedGreaterGreater|NotSquareSupersetEqual|DiacriticalDoubleAcute|NotRightTriangleEqual|NotSucceedsSlantEqual|NotPrecedesSlantEqual|CloseCurlyDoubleQuote|NegativeVeryThinSpace|DoubleContourIntegral|FilledVerySmallSquare|CapitalDifferentialD|OpenCurlyDoubleQuote|EmptyVerySmallSquare|NestedGreaterGreater|DoubleLongRightArrow|NotLeftTriangleEqual|NotGreaterSlantEqual|ReverseUpEquilibrium|DoubleLeftRightArrow|NotSquareSubsetEqual|NotDoubleVerticalBar|RightArrowLeftArrow|NotGreaterFullEqual|NotRightTriangleBar|SquareSupersetEqual|DownLeftRightVector|DoubleLongLeftArrow|leftrightsquigarrow|LeftArrowRightArrow|NegativeMediumSpace|blacktriangleright|RightDownVectorBar|PrecedesSlantEqual|RightDoubleBracket|SucceedsSlantEqual|NotLeftTriangleBar|RightTriangleEqual|SquareIntersection|RightDownTeeVector|ReverseEquilibrium|NegativeThickSpace|longleftrightarrow|Longleftrightarrow|LongLeftRightArrow|DownRightTeeVector|DownRightVectorBar|GreaterSlantEqual|SquareSubsetEqual|LeftDownVectorBar|LeftDoubleBracket|VerticalSeparator|rightleftharpoons|NotGreaterGreater|NotSquareSuperset|blacktriangleleft|blacktriangledown|NegativeThinSpace|LeftDownTeeVector|NotLessSlantEqual|leftrightharpoons|DoubleUpDownArrow|DoubleVerticalBar|LeftTriangleEqual|FilledSmallSquare|twoheadrightarrow|NotNestedLessLess|DownLeftTeeVector|DownLeftVectorBar|RightAngleBracket|NotTildeFullEqual|NotReverseElement|RightUpDownVector|DiacriticalTilde|NotSucceedsTilde|circlearrowright|NotPrecedesEqual|rightharpoondown|DoubleRightArrow|NotSucceedsEqual|NonBreakingSpace|NotRightTriangle|LessEqualGreater|RightUpTeeVector|LeftAngleBracket|GreaterFullEqual|DownArrowUpArrow|RightUpVectorBar|twoheadleftarrow|GreaterEqualLess|downharpoonright|RightTriangleBar|ntrianglerighteq|NotSupersetEqual|LeftUpDownVector|DiacriticalAcute|rightrightarrows|vartriangleright|UpArrowDownArrow|DiacriticalGrave|UnderParenthesis|EmptySmallSquare|LeftUpVectorBar|leftrightarrows|DownRightVector|downharpoonleft|trianglerighteq|ShortRightArrow|OverParenthesis|DoubleLeftArrow|DoubleDownArrow|NotSquareSubset|bigtriangledown|ntrianglelefteq|UpperRightArrow|curvearrowright|vartriangleleft|NotLeftTriangle|nleftrightarrow|LowerRightArrow|NotHumpDownHump|NotGreaterTilde|rightthreetimes|LeftUpTeeVector|NotGreaterEqual|straightepsilon|LeftTriangleBar|rightsquigarrow|ContourIntegral|rightleftarrows|CloseCurlyQuote|RightDownVector|LeftRightVector|nLeftrightarrow|leftharpoondown|circlearrowleft|SquareSuperset|OpenCurlyQuote|hookrightarrow|HorizontalLine|DiacriticalDot|NotLessGreater|ntriangleright|DoubleRightTee|InvisibleComma|InvisibleTimes|LowerLeftArrow|DownLeftVector|NotSubsetEqual|curvearrowleft|trianglelefteq|NotVerticalBar|TildeFullEqual|downdownarrows|NotGreaterLess|RightTeeVector|ZeroWidthSpace|looparrowright|LongRightArrow|doublebarwedge|ShortLeftArrow|ShortDownArrow|RightVectorBar|GreaterGreater|ReverseElement|rightharpoonup|LessSlantEqual|leftthreetimes|upharpoonright|rightarrowtail|LeftDownVector|Longrightarrow|NestedLessLess|UpperLeftArrow|nshortparallel|leftleftarrows|leftrightarrow|Leftrightarrow|LeftRightArrow|longrightarrow|upharpoonleft|RightArrowBar|ApplyFunction|LeftTeeVector|leftarrowtail|NotEqualTilde|varsubsetneqq|varsupsetneqq|RightTeeArrow|SucceedsEqual|SucceedsTilde|LeftVectorBar|SupersetEqual|hookleftarrow|DifferentialD|VerticalTilde|VeryThinSpace|blacktriangle|bigtriangleup|LessFullEqual|divideontimes|leftharpoonup|UpEquilibrium|ntriangleleft|RightTriangle|measuredangle|shortparallel|longleftarrow|Longleftarrow|LongLeftArrow|DoubleLeftTee|Poincareplane|PrecedesEqual|triangleright|DoubleUpArrow|RightUpVector|fallingdotseq|looparrowleft|PrecedesTilde|NotTildeEqual|NotTildeTilde|smallsetminus|Proportional|triangleleft|triangledown|UnderBracket|NotHumpEqual|exponentiale|ExponentialE|NotLessTilde|HilbertSpace|RightCeiling|blacklozenge|varsupsetneq|HumpDownHump|GreaterEqual|VerticalLine|LeftTeeArrow|NotLessEqual|DownTeeArrow|LeftTriangle|varsubsetneq|Intersection|NotCongruent|DownArrowBar|LeftUpVector|LeftArrowBar|risingdotseq|GreaterTilde|RoundImplies|SquareSubset|ShortUpArrow|NotSuperset|quaternions|precnapprox|backepsilon|preccurlyeq|OverBracket|blacksquare|MediumSpace|VerticalBar|circledcirc|circleddash|CircleMinus|CircleTimes|LessGreater|curlyeqprec|curlyeqsucc|diamondsuit|UpDownArrow|Updownarrow|RuleDelayed|Rrightarrow|updownarrow|RightVector|nRightarrow|nrightarrow|eqslantless|LeftCeiling|Equilibrium|SmallCircle|expectation|NotSucceeds|thickapprox|GreaterLess|SquareUnion|NotPrecedes|NotLessLess|straightphi|succnapprox|succcurlyeq|SubsetEqual|sqsupseteq|Proportion|Laplacetrf|ImaginaryI|supsetneqq|NotGreater|gtreqqless|NotElement|ThickSpace|TildeEqual|TildeTilde|Fouriertrf|rmoustache|EqualTilde|eqslantgtr|UnderBrace|LeftVector|UpArrowBar|nLeftarrow|nsubseteqq|subsetneqq|nsupseteqq|nleftarrow|succapprox|lessapprox|UpTeeArrow|upuparrows|curlywedge|lesseqqgtr|varepsilon|varnothing|RightFloor|complement|CirclePlus|sqsubseteq|Lleftarrow|circledast|RightArrow|Rightarrow|rightarrow|lmoustache|Bernoullis|precapprox|mapstoleft|mapstodown|longmapsto|dotsquare|downarrow|DoubleDot|nsubseteq|supsetneq|leftarrow|nsupseteq|subsetneq|ThinSpace|ngeqslant|subseteqq|HumpEqual|NotSubset|triangleq|NotCupCap|lesseqgtr|heartsuit|TripleDot|Leftarrow|Coproduct|Congruent|varpropto|complexes|gvertneqq|LeftArrow|LessTilde|supseteqq|MinusPlus|CircleDot|nleqslant|NotExists|gtreqless|nparallel|UnionPlus|LeftFloor|checkmark|CenterDot|centerdot|Mellintrf|gtrapprox|bigotimes|OverBrace|spadesuit|therefore|pitchfork|rationals|PlusMinus|Backslash|Therefore|DownBreve|backsimeq|backprime|DownArrow|nshortmid|Downarrow|lvertneqq|eqvparsl|imagline|imagpart|infintie|integers|Integral|intercal|LessLess|Uarrocir|intlarhk|sqsupset|angmsdaf|sqsubset|llcorner|vartheta|cupbrcap|lnapprox|Superset|SuchThat|succnsim|succneqq|angmsdag|biguplus|curlyvee|trpezium|Succeeds|NotTilde|bigwedge|angmsdah|angrtvbd|triminus|cwconint|fpartint|lrcorner|smeparsl|subseteq|urcorner|lurdshar|laemptyv|DDotrahd|approxeq|ldrushar|awconint|mapstoup|backcong|shortmid|triangle|geqslant|gesdotol|timesbar|circledR|circledS|setminus|multimap|naturals|scpolint|ncongdot|RightTee|boxminus|gnapprox|boxtimes|andslope|thicksim|angmsdaa|varsigma|cirfnint|rtriltri|angmsdab|rppolint|angmsdac|barwedge|drbkarow|clubsuit|thetasym|bsolhsub|capbrcup|dzigrarr|doteqdot|DotEqual|dotminus|UnderBar|NotEqual|realpart|otimesas|ulcorner|hksearow|hkswarow|parallel|PartialD|elinters|emptyset|plusacir|bbrktbrk|angmsdad|pointint|bigoplus|angmsdae|Precedes|bigsqcup|varkappa|notindot|supseteq|precneqq|precnsim|profalar|profline|profsurf|leqslant|lesdotor|raemptyv|subplus|notnivb|notnivc|subrarr|zigrarr|vzigzag|submult|subedot|Element|between|cirscir|larrbfs|larrsim|lotimes|lbrksld|lbrkslu|lozenge|ldrdhar|dbkarow|bigcirc|epsilon|simrarr|simplus|ltquest|Epsilon|luruhar|gtquest|maltese|npolint|eqcolon|npreceq|bigodot|ddagger|gtrless|bnequiv|harrcir|ddotseq|equivDD|backsim|demptyv|nsqsube|nsqsupe|Upsilon|nsubset|upsilon|minusdu|nsucceq|swarrow|nsupset|coloneq|searrow|boxplus|napprox|natural|asympeq|alefsym|congdot|nearrow|bigstar|diamond|supplus|tritime|LeftTee|nvinfin|triplus|NewLine|nvltrie|nvrtrie|nwarrow|nexists|Diamond|ruluhar|Implies|supmult|angzarr|suplarr|suphsub|questeq|because|digamma|Because|olcross|bemptyv|omicron|Omicron|rotimes|NoBreak|intprod|angrtvb|orderof|uwangle|suphsol|lesdoto|orslope|DownTee|realine|cudarrl|rdldhar|OverBar|supedot|lessdot|supdsub|topfork|succsim|rbrkslu|rbrksld|pertenk|cudarrr|isindot|planckh|lessgtr|pluscir|gesdoto|plussim|plustwo|lesssim|cularrp|rarrsim|Cayleys|notinva|notinvb|notinvc|UpArrow|Uparrow|uparrow|NotLess|dwangle|precsim|Product|curarrm|Cconint|dotplus|rarrbfs|ccupssm|Cedilla|cemptyv|notniva|quatint|frac35|frac38|frac45|frac56|frac58|frac78|tridot|xoplus|gacute|gammad|Gammad|lfisht|lfloor|bigcup|sqsupe|gbreve|Gbreve|lharul|sqsube|sqcups|Gcedil|apacir|llhard|lmidot|Lmidot|lmoust|andand|sqcaps|approx|Abreve|spades|circeq|tprime|divide|topcir|Assign|topbot|gesdot|divonx|xuplus|timesd|gesles|atilde|solbar|SOFTcy|loplus|timesb|lowast|lowbar|dlcorn|dlcrop|softcy|dollar|lparlt|thksim|lrhard|Atilde|lsaquo|smashp|bigvee|thinsp|wreath|bkarow|lsquor|lstrok|Lstrok|lthree|ltimes|ltlarr|DotDot|simdot|ltrPar|weierp|xsqcup|angmsd|sigmav|sigmaf|zeetrf|Zcaron|zcaron|mapsto|vsupne|thetav|cirmid|marker|mcomma|Zacute|vsubnE|there4|gtlPar|vsubne|bottom|gtrarr|SHCHcy|shchcy|midast|midcir|middot|minusb|minusd|gtrdot|bowtie|sfrown|mnplus|models|colone|seswar|Colone|mstpos|searhk|gtrsim|nacute|Nacute|boxbox|telrec|hairsp|Tcedil|nbumpe|scnsim|ncaron|Ncaron|ncedil|Ncedil|hamilt|Scedil|nearhk|hardcy|HARDcy|tcedil|Tcaron|commat|nequiv|nesear|tcaron|target|hearts|nexist|varrho|scedil|Scaron|scaron|hellip|Sacute|sacute|hercon|swnwar|compfn|rtimes|rthree|rsquor|rsaquo|zacute|wedgeq|homtht|barvee|barwed|Barwed|rpargt|horbar|conint|swarhk|roplus|nltrie|hslash|hstrok|Hstrok|rmoust|Conint|bprime|hybull|hyphen|iacute|Iacute|supsup|supsub|supsim|varphi|coprod|brvbar|agrave|Supset|supset|igrave|Igrave|notinE|Agrave|iiiint|iinfin|copysr|wedbar|Verbar|vangrt|becaus|incare|verbar|inodot|bullet|drcorn|intcal|drcrop|cularr|vellip|Utilde|bumpeq|cupcap|dstrok|Dstrok|CupCap|cupcup|cupdot|eacute|Eacute|supdot|iquest|easter|ecaron|Ecaron|ecolon|isinsv|utilde|itilde|Itilde|curarr|succeq|Bumpeq|cacute|ulcrop|nparsl|Cacute|nprcue|egrave|Egrave|nrarrc|nrarrw|subsup|subsub|nrtrie|jsercy|nsccue|Jsercy|kappav|kcedil|Kcedil|subsim|ulcorn|nsimeq|egsdot|veebar|kgreen|capand|elsdot|Subset|subset|curren|aacute|lacute|Lacute|emptyv|ntilde|Ntilde|lagran|lambda|Lambda|capcap|Ugrave|langle|subdot|emsp13|numero|emsp14|nvdash|nvDash|nVdash|nVDash|ugrave|ufisht|nvHarr|larrfs|nvlArr|larrhk|larrlp|larrpl|nvrArr|Udblac|nwarhk|larrtl|nwnear|oacute|Oacute|latail|lAtail|sstarf|lbrace|odblac|Odblac|lbrack|udblac|odsold|eparsl|lcaron|Lcaron|ograve|Ograve|lcedil|Lcedil|Aacute|ssmile|ssetmn|squarf|ldquor|capcup|ominus|cylcty|rharul|eqcirc|dagger|rfloor|rfisht|Dagger|daleth|equals|origof|capdot|equest|dcaron|Dcaron|rdquor|oslash|Oslash|otilde|Otilde|otimes|Otimes|urcrop|Ubreve|ubreve|Yacute|Uacute|uacute|Rcedil|rcedil|urcorn|parsim|Rcaron|Vdashl|rcaron|Tstrok|percnt|period|permil|Exists|yacute|rbrack|rbrace|phmmat|ccaron|Ccaron|planck|ccedil|plankv|tstrok|female|plusdo|plusdu|ffilig|plusmn|ffllig|Ccedil|rAtail|dfisht|bernou|ratail|Rarrtl|rarrtl|angsph|rarrpl|rarrlp|rarrhk|xwedge|xotime|forall|ForAll|Vvdash|vsupnE|preceq|bigcap|frac12|frac13|frac14|primes|rarrfs|prnsim|frac15|Square|frac16|square|lesdot|frac18|frac23|propto|prurel|rarrap|rangle|puncsp|frac25|Racute|qprime|racute|lesges|frac34|abreve|AElig|eqsim|utdot|setmn|urtri|Equal|Uring|seArr|uring|searr|dashv|Dashv|mumap|nabla|iogon|Iogon|sdote|sdotb|scsim|napid|napos|equiv|natur|Acirc|dblac|erarr|nbump|iprod|erDot|ucirc|awint|esdot|angrt|ncong|isinE|scnap|Scirc|scirc|ndash|isins|Ubrcy|nearr|neArr|isinv|nedot|ubrcy|acute|Ycirc|iukcy|Iukcy|xutri|nesim|caret|jcirc|Jcirc|caron|twixt|ddarr|sccue|exist|jmath|sbquo|ngeqq|angst|ccaps|lceil|ngsim|UpTee|delta|Delta|rtrif|nharr|nhArr|nhpar|rtrie|jukcy|Jukcy|kappa|rsquo|Kappa|nlarr|nlArr|TSHcy|rrarr|aogon|Aogon|fflig|xrarr|tshcy|ccirc|nleqq|filig|upsih|nless|dharl|nlsim|fjlig|ropar|nltri|dharr|robrk|roarr|fllig|fltns|roang|rnmid|subnE|subne|lAarr|trisb|Ccirc|acirc|ccups|blank|VDash|forkv|Vdash|langd|cedil|blk12|blk14|laquo|strns|diams|notin|vDash|larrb|blk34|block|disin|uplus|vdash|vBarv|aelig|starf|Wedge|check|xrArr|lates|lbarr|lBarr|notni|lbbrk|bcong|frasl|lbrke|frown|vrtri|vprop|vnsup|gamma|Gamma|wedge|xodot|bdquo|srarr|doteq|ldquo|boxdl|boxdL|gcirc|Gcirc|boxDl|boxDL|boxdr|boxdR|boxDr|TRADE|trade|rlhar|boxDR|vnsub|npart|vltri|rlarr|boxhd|boxhD|nprec|gescc|nrarr|nrArr|boxHd|boxHD|boxhu|boxhU|nrtri|boxHu|clubs|boxHU|times|colon|Colon|gimel|xlArr|Tilde|nsime|tilde|nsmid|nspar|THORN|thorn|xlarr|nsube|nsubE|thkap|xhArr|comma|nsucc|boxul|boxuL|nsupe|nsupE|gneqq|gnsim|boxUl|boxUL|grave|boxur|boxuR|boxUr|boxUR|lescc|angle|bepsi|boxvh|varpi|boxvH|numsp|Theta|gsime|gsiml|theta|boxVh|boxVH|boxvl|gtcir|gtdot|boxvL|boxVl|boxVL|crarr|cross|Cross|nvsim|boxvr|nwarr|nwArr|sqsup|dtdot|Uogon|lhard|lharu|dtrif|ocirc|Ocirc|lhblk|duarr|odash|sqsub|Hacek|sqcup|llarr|duhar|oelig|OElig|ofcir|boxvR|uogon|lltri|boxVr|csube|uuarr|ohbar|csupe|ctdot|olarr|olcir|harrw|oline|sqcap|omacr|Omacr|omega|Omega|boxVR|aleph|lneqq|lnsim|loang|loarr|rharu|lobrk|hcirc|operp|oplus|rhard|Hcirc|orarr|Union|order|ecirc|Ecirc|cuepr|szlig|cuesc|breve|reals|eDDot|Breve|hoarr|lopar|utrif|rdquo|Umacr|umacr|efDot|swArr|ultri|alpha|rceil|ovbar|swarr|Wcirc|wcirc|smtes|smile|bsemi|lrarr|aring|parsl|lrhar|bsime|uhblk|lrtri|cupor|Aring|uharr|uharl|slarr|rbrke|bsolb|lsime|rbbrk|RBarr|lsimg|phone|rBarr|rbarr|icirc|lsquo|Icirc|emacr|Emacr|ratio|simne|plusb|simlE|simgE|simeq|pluse|ltcir|ltdot|empty|xharr|xdtri|iexcl|Alpha|ltrie|rarrw|pound|ltrif|xcirc|bumpe|prcue|bumpE|asymp|amacr|cuvee|Sigma|sigma|iiint|udhar|iiota|ijlig|IJlig|supnE|imacr|Imacr|prime|Prime|image|prnap|eogon|Eogon|rarrc|mdash|mDDot|cuwed|imath|supne|imped|Amacr|udarr|prsim|micro|rarrb|cwint|raquo|infin|eplus|range|rangd|Ucirc|radic|minus|amalg|veeeq|rAarr|epsiv|ycirc|quest|sharp|quot|zwnj|Qscr|race|qscr|Qopf|qopf|qint|rang|Rang|Zscr|zscr|Zopf|zopf|rarr|rArr|Rarr|Pscr|pscr|prop|prod|prnE|prec|ZHcy|zhcy|prap|Zeta|zeta|Popf|popf|Zdot|plus|zdot|Yuml|yuml|phiv|YUcy|yucy|Yscr|yscr|perp|Yopf|yopf|part|para|YIcy|Ouml|rcub|yicy|YAcy|rdca|ouml|osol|Oscr|rdsh|yacy|real|oscr|xvee|andd|rect|andv|Xscr|oror|ordm|ordf|xscr|ange|aopf|Aopf|rHar|Xopf|opar|Oopf|xopf|xnis|rhov|oopf|omid|xmap|oint|apid|apos|ogon|ascr|Ascr|odot|odiv|xcup|xcap|ocir|oast|nvlt|nvle|nvgt|nvge|nvap|Wscr|wscr|auml|ntlg|ntgl|nsup|nsub|nsim|Nscr|nscr|nsce|Wopf|ring|npre|wopf|npar|Auml|Barv|bbrk|Nopf|nopf|nmid|nLtv|beta|ropf|Ropf|Beta|beth|nles|rpar|nleq|bnot|bNot|nldr|NJcy|rscr|Rscr|Vscr|vscr|rsqb|njcy|bopf|nisd|Bopf|rtri|Vopf|nGtv|ngtr|vopf|boxh|boxH|boxv|nges|ngeq|boxV|bscr|scap|Bscr|bsim|Vert|vert|bsol|bull|bump|caps|cdot|ncup|scnE|ncap|nbsp|napE|Cdot|cent|sdot|Vbar|nang|vBar|chcy|Mscr|mscr|sect|semi|CHcy|Mopf|mopf|sext|circ|cire|mldr|mlcp|cirE|comp|shcy|SHcy|vArr|varr|cong|copf|Copf|copy|COPY|malt|male|macr|lvnE|cscr|ltri|sime|ltcc|simg|Cscr|siml|csub|Uuml|lsqb|lsim|uuml|csup|Lscr|lscr|utri|smid|lpar|cups|smte|lozf|darr|Lopf|Uscr|solb|lopf|sopf|Sopf|lneq|uscr|spar|dArr|lnap|Darr|dash|Sqrt|LJcy|ljcy|lHar|dHar|Upsi|upsi|diam|lesg|djcy|DJcy|leqq|dopf|Dopf|dscr|Dscr|dscy|ldsh|ldca|squf|DScy|sscr|Sscr|dsol|lcub|late|star|Star|Uopf|Larr|lArr|larr|uopf|dtri|dzcy|sube|subE|Lang|lang|Kscr|kscr|Kopf|kopf|KJcy|kjcy|KHcy|khcy|DZcy|ecir|edot|eDot|Jscr|jscr|succ|Jopf|jopf|Edot|uHar|emsp|ensp|Iuml|iuml|eopf|isin|Iscr|iscr|Eopf|epar|sung|epsi|escr|sup1|sup2|sup3|Iota|iota|supe|supE|Iopf|iopf|IOcy|iocy|Escr|esim|Esim|imof|Uarr|QUOT|uArr|uarr|euml|IEcy|iecy|Idot|Euml|euro|excl|Hscr|hscr|Hopf|hopf|TScy|tscy|Tscr|hbar|tscr|flat|tbrk|fnof|hArr|harr|half|fopf|Fopf|tdot|gvnE|fork|trie|gtcc|fscr|Fscr|gdot|gsim|Gscr|gscr|Gopf|gopf|gneq|Gdot|tosa|gnap|Topf|topf|geqq|toea|GJcy|gjcy|tint|gesl|mid|Sfr|ggg|top|ges|gla|glE|glj|geq|gne|gEl|gel|gnE|Gcy|gcy|gap|Tfr|tfr|Tcy|tcy|Hat|Tau|Ffr|tau|Tab|hfr|Hfr|ffr|Fcy|fcy|icy|Icy|iff|ETH|eth|ifr|Ifr|Eta|eta|int|Int|Sup|sup|ucy|Ucy|Sum|sum|jcy|ENG|ufr|Ufr|eng|Jcy|jfr|els|ell|egs|Efr|efr|Jfr|uml|kcy|Kcy|Ecy|ecy|kfr|Kfr|lap|Sub|sub|lat|lcy|Lcy|leg|Dot|dot|lEg|leq|les|squ|div|die|lfr|Lfr|lgE|Dfr|dfr|Del|deg|Dcy|dcy|lne|lnE|sol|loz|smt|Cup|lrm|cup|lsh|Lsh|sim|shy|map|Map|mcy|Mcy|mfr|Mfr|mho|gfr|Gfr|sfr|cir|Chi|chi|nap|Cfr|vcy|Vcy|cfr|Scy|scy|ncy|Ncy|vee|Vee|Cap|cap|nfr|scE|sce|Nfr|nge|ngE|nGg|vfr|Vfr|ngt|bot|nGt|nis|niv|Rsh|rsh|nle|nlE|bne|Bfr|bfr|nLl|nlt|nLt|Bcy|bcy|not|Not|rlm|wfr|Wfr|npr|nsc|num|ocy|ast|Ocy|ofr|xfr|Xfr|Ofr|ogt|ohm|apE|olt|Rho|ape|rho|Rfr|rfr|ord|REG|ang|reg|orv|And|and|AMP|Rcy|amp|Afr|ycy|Ycy|yen|yfr|Yfr|rcy|par|pcy|Pcy|pfr|Pfr|phi|Phi|afr|Acy|acy|zcy|Zcy|piv|acE|acd|zfr|Zfr|pre|prE|psi|Psi|qfr|Qfr|zwj|Or|ge|Gg|gt|gg|el|oS|lt|Lt|LT|Re|lg|gl|eg|ne|Im|it|le|DD|wp|wr|nu|Nu|dd|lE|Sc|sc|pi|Pi|ee|af|ll|Ll|rx|gE|xi|pm|Xi|ic|pr|Pr|in|ni|mp|mu|ac|Mu|or|ap|Gt|GT|ii);|&(Aacute|Agrave|Atilde|Ccedil|Eacute|Egrave|Iacute|Igrave|Ntilde|Oacute|Ograve|Oslash|Otilde|Uacute|Ugrave|Yacute|aacute|agrave|atilde|brvbar|ccedil|curren|divide|eacute|egrave|frac12|frac14|frac34|iacute|igrave|iquest|middot|ntilde|oacute|ograve|oslash|otilde|plusmn|uacute|ugrave|yacute|AElig|Acirc|Aring|Ecirc|Icirc|Ocirc|THORN|Ucirc|acirc|acute|aelig|aring|cedil|ecirc|icirc|iexcl|laquo|micro|ocirc|pound|raquo|szlig|thorn|times|ucirc|Auml|COPY|Euml|Iuml|Ouml|QUOT|Uuml|auml|cent|copy|euml|iuml|macr|nbsp|ordf|ordm|ouml|para|quot|sect|sup1|sup2|sup3|uuml|yuml|AMP|ETH|REG|amp|deg|eth|not|reg|shy|uml|yen|GT|LT|gt|lt)(?!;)([=a-zA-Z0-9]?)|&#([0-9]+)(;?)|&#[xX]([a-fA-F0-9]+)(;?)|&([0-9a-zA-Z]+)/g;
  11470. var decodeMap = {'aacute':'\xE1','Aacute':'\xC1','abreve':'\u0103','Abreve':'\u0102','ac':'\u223E','acd':'\u223F','acE':'\u223E\u0333','acirc':'\xE2','Acirc':'\xC2','acute':'\xB4','acy':'\u0430','Acy':'\u0410','aelig':'\xE6','AElig':'\xC6','af':'\u2061','afr':'\uD835\uDD1E','Afr':'\uD835\uDD04','agrave':'\xE0','Agrave':'\xC0','alefsym':'\u2135','aleph':'\u2135','alpha':'\u03B1','Alpha':'\u0391','amacr':'\u0101','Amacr':'\u0100','amalg':'\u2A3F','amp':'&','AMP':'&','and':'\u2227','And':'\u2A53','andand':'\u2A55','andd':'\u2A5C','andslope':'\u2A58','andv':'\u2A5A','ang':'\u2220','ange':'\u29A4','angle':'\u2220','angmsd':'\u2221','angmsdaa':'\u29A8','angmsdab':'\u29A9','angmsdac':'\u29AA','angmsdad':'\u29AB','angmsdae':'\u29AC','angmsdaf':'\u29AD','angmsdag':'\u29AE','angmsdah':'\u29AF','angrt':'\u221F','angrtvb':'\u22BE','angrtvbd':'\u299D','angsph':'\u2222','angst':'\xC5','angzarr':'\u237C','aogon':'\u0105','Aogon':'\u0104','aopf':'\uD835\uDD52','Aopf':'\uD835\uDD38','ap':'\u2248','apacir':'\u2A6F','ape':'\u224A','apE':'\u2A70','apid':'\u224B','apos':'\'','ApplyFunction':'\u2061','approx':'\u2248','approxeq':'\u224A','aring':'\xE5','Aring':'\xC5','ascr':'\uD835\uDCB6','Ascr':'\uD835\uDC9C','Assign':'\u2254','ast':'*','asymp':'\u2248','asympeq':'\u224D','atilde':'\xE3','Atilde':'\xC3','auml':'\xE4','Auml':'\xC4','awconint':'\u2233','awint':'\u2A11','backcong':'\u224C','backepsilon':'\u03F6','backprime':'\u2035','backsim':'\u223D','backsimeq':'\u22CD','Backslash':'\u2216','Barv':'\u2AE7','barvee':'\u22BD','barwed':'\u2305','Barwed':'\u2306','barwedge':'\u2305','bbrk':'\u23B5','bbrktbrk':'\u23B6','bcong':'\u224C','bcy':'\u0431','Bcy':'\u0411','bdquo':'\u201E','becaus':'\u2235','because':'\u2235','Because':'\u2235','bemptyv':'\u29B0','bepsi':'\u03F6','bernou':'\u212C','Bernoullis':'\u212C','beta':'\u03B2','Beta':'\u0392','beth':'\u2136','between':'\u226C','bfr':'\uD835\uDD1F','Bfr':'\uD835\uDD05','bigcap':'\u22C2','bigcirc':'\u25EF','bigcup':'\u22C3','bigodot':'\u2A00','bigoplus':'\u2A01','bigotimes':'\u2A02','bigsqcup':'\u2A06','bigstar':'\u2605','bigtriangledown':'\u25BD','bigtriangleup':'\u25B3','biguplus':'\u2A04','bigvee':'\u22C1','bigwedge':'\u22C0','bkarow':'\u290D','blacklozenge':'\u29EB','blacksquare':'\u25AA','blacktriangle':'\u25B4','blacktriangledown':'\u25BE','blacktriangleleft':'\u25C2','blacktriangleright':'\u25B8','blank':'\u2423','blk12':'\u2592','blk14':'\u2591','blk34':'\u2593','block':'\u2588','bne':'=\u20E5','bnequiv':'\u2261\u20E5','bnot':'\u2310','bNot':'\u2AED','bopf':'\uD835\uDD53','Bopf':'\uD835\uDD39','bot':'\u22A5','bottom':'\u22A5','bowtie':'\u22C8','boxbox':'\u29C9','boxdl':'\u2510','boxdL':'\u2555','boxDl':'\u2556','boxDL':'\u2557','boxdr':'\u250C','boxdR':'\u2552','boxDr':'\u2553','boxDR':'\u2554','boxh':'\u2500','boxH':'\u2550','boxhd':'\u252C','boxhD':'\u2565','boxHd':'\u2564','boxHD':'\u2566','boxhu':'\u2534','boxhU':'\u2568','boxHu':'\u2567','boxHU':'\u2569','boxminus':'\u229F','boxplus':'\u229E','boxtimes':'\u22A0','boxul':'\u2518','boxuL':'\u255B','boxUl':'\u255C','boxUL':'\u255D','boxur':'\u2514','boxuR':'\u2558','boxUr':'\u2559','boxUR':'\u255A','boxv':'\u2502','boxV':'\u2551','boxvh':'\u253C','boxvH':'\u256A','boxVh':'\u256B','boxVH':'\u256C','boxvl':'\u2524','boxvL':'\u2561','boxVl':'\u2562','boxVL':'\u2563','boxvr':'\u251C','boxvR':'\u255E','boxVr':'\u255F','boxVR':'\u2560','bprime':'\u2035','breve':'\u02D8','Breve':'\u02D8','brvbar':'\xA6','bscr':'\uD835\uDCB7','Bscr':'\u212C','bsemi':'\u204F','bsim':'\u223D','bsime':'\u22CD','bsol':'\\','bsolb':'\u29C5','bsolhsub':'\u27C8','bull':'\u2022','bullet':'\u2022','bump':'\u224E','bumpe':'\u224F','bumpE':'\u2AAE','bumpeq':'\u224F','Bumpeq':'\u224E','cacute':'\u0107','Cacute':'\u0106','cap':'\u2229','Cap':'\u22D2','capand':'\u2A44','capbrcup':'\u2A49','capcap':'\u2A4B','capcup':'\u2A47','capdot':'\u2A40','CapitalDifferentialD':'\u2145','caps':'\u2229\uFE00','caret':'\u2041','caron':'\u02C7','Cayleys':'\u212D','ccaps':'\u2A4D','ccaron':'\u010D','Ccaron':'\u010C','ccedil':'\xE7','Ccedil':'\xC7','ccirc':'\u0109','Ccirc':'\u0108','Cconint':'\u2230','ccups':'\u2A4C','ccupssm':'\u2A50','cdot':'\u010B','Cdot':'\u010A','cedil':'\xB8','Cedilla':'\xB8','cemptyv':'\u29B2','cent':'\xA2','centerdot':'\xB7','CenterDot':'\xB7','cfr':'\uD835\uDD20','Cfr':'\u212D','chcy':'\u0447','CHcy':'\u0427','check':'\u2713','checkmark':'\u2713','chi':'\u03C7','Chi':'\u03A7','cir':'\u25CB','circ':'\u02C6','circeq':'\u2257','circlearrowleft':'\u21BA','circlearrowright':'\u21BB','circledast':'\u229B','circledcirc':'\u229A','circleddash':'\u229D','CircleDot':'\u2299','circledR':'\xAE','circledS':'\u24C8','CircleMinus':'\u2296','CirclePlus':'\u2295','CircleTimes':'\u2297','cire':'\u2257','cirE':'\u29C3','cirfnint':'\u2A10','cirmid':'\u2AEF','cirscir':'\u29C2','ClockwiseContourIntegral':'\u2232','CloseCurlyDoubleQuote':'\u201D','CloseCurlyQuote':'\u2019','clubs':'\u2663','clubsuit':'\u2663','colon':':','Colon':'\u2237','colone':'\u2254','Colone':'\u2A74','coloneq':'\u2254','comma':',','commat':'@','comp':'\u2201','compfn':'\u2218','complement':'\u2201','complexes':'\u2102','cong':'\u2245','congdot':'\u2A6D','Congruent':'\u2261','conint':'\u222E','Conint':'\u222F','ContourIntegral':'\u222E','copf':'\uD835\uDD54','Copf':'\u2102','coprod':'\u2210','Coproduct':'\u2210','copy':'\xA9','COPY':'\xA9','copysr':'\u2117','CounterClockwiseContourIntegral':'\u2233','crarr':'\u21B5','cross':'\u2717','Cross':'\u2A2F','cscr':'\uD835\uDCB8','Cscr':'\uD835\uDC9E','csub':'\u2ACF','csube':'\u2AD1','csup':'\u2AD0','csupe':'\u2AD2','ctdot':'\u22EF','cudarrl':'\u2938','cudarrr':'\u2935','cuepr':'\u22DE','cuesc':'\u22DF','cularr':'\u21B6','cularrp':'\u293D','cup':'\u222A','Cup':'\u22D3','cupbrcap':'\u2A48','cupcap':'\u2A46','CupCap':'\u224D','cupcup':'\u2A4A','cupdot':'\u228D','cupor':'\u2A45','cups':'\u222A\uFE00','curarr':'\u21B7','curarrm':'\u293C','curlyeqprec':'\u22DE','curlyeqsucc':'\u22DF','curlyvee':'\u22CE','curlywedge':'\u22CF','curren':'\xA4','curvearrowleft':'\u21B6','curvearrowright':'\u21B7','cuvee':'\u22CE','cuwed':'\u22CF','cwconint':'\u2232','cwint':'\u2231','cylcty':'\u232D','dagger':'\u2020','Dagger':'\u2021','daleth':'\u2138','darr':'\u2193','dArr':'\u21D3','Darr':'\u21A1','dash':'\u2010','dashv':'\u22A3','Dashv':'\u2AE4','dbkarow':'\u290F','dblac':'\u02DD','dcaron':'\u010F','Dcaron':'\u010E','dcy':'\u0434','Dcy':'\u0414','dd':'\u2146','DD':'\u2145','ddagger':'\u2021','ddarr':'\u21CA','DDotrahd':'\u2911','ddotseq':'\u2A77','deg':'\xB0','Del':'\u2207','delta':'\u03B4','Delta':'\u0394','demptyv':'\u29B1','dfisht':'\u297F','dfr':'\uD835\uDD21','Dfr':'\uD835\uDD07','dHar':'\u2965','dharl':'\u21C3','dharr':'\u21C2','DiacriticalAcute':'\xB4','DiacriticalDot':'\u02D9','DiacriticalDoubleAcute':'\u02DD','DiacriticalGrave':'`','DiacriticalTilde':'\u02DC','diam':'\u22C4','diamond':'\u22C4','Diamond':'\u22C4','diamondsuit':'\u2666','diams':'\u2666','die':'\xA8','DifferentialD':'\u2146','digamma':'\u03DD','disin':'\u22F2','div':'\xF7','divide':'\xF7','divideontimes':'\u22C7','divonx':'\u22C7','djcy':'\u0452','DJcy':'\u0402','dlcorn':'\u231E','dlcrop':'\u230D','dollar':'$','dopf':'\uD835\uDD55','Dopf':'\uD835\uDD3B','dot':'\u02D9','Dot':'\xA8','DotDot':'\u20DC','doteq':'\u2250','doteqdot':'\u2251','DotEqual':'\u2250','dotminus':'\u2238','dotplus':'\u2214','dotsquare':'\u22A1','doublebarwedge':'\u2306','DoubleContourIntegral':'\u222F','DoubleDot':'\xA8','DoubleDownArrow':'\u21D3','DoubleLeftArrow':'\u21D0','DoubleLeftRightArrow':'\u21D4','DoubleLeftTee':'\u2AE4','DoubleLongLeftArrow':'\u27F8','DoubleLongLeftRightArrow':'\u27FA','DoubleLongRightArrow':'\u27F9','DoubleRightArrow':'\u21D2','DoubleRightTee':'\u22A8','DoubleUpArrow':'\u21D1','DoubleUpDownArrow':'\u21D5','DoubleVerticalBar':'\u2225','downarrow':'\u2193','Downarrow':'\u21D3','DownArrow':'\u2193','DownArrowBar':'\u2913','DownArrowUpArrow':'\u21F5','DownBreve':'\u0311','downdownarrows':'\u21CA','downharpoonleft':'\u21C3','downharpoonright':'\u21C2','DownLeftRightVector':'\u2950','DownLeftTeeVector':'\u295E','DownLeftVector':'\u21BD','DownLeftVectorBar':'\u2956','DownRightTeeVector':'\u295F','DownRightVector':'\u21C1','DownRightVectorBar':'\u2957','DownTee':'\u22A4','DownTeeArrow':'\u21A7','drbkarow':'\u2910','drcorn':'\u231F','drcrop':'\u230C','dscr':'\uD835\uDCB9','Dscr':'\uD835\uDC9F','dscy':'\u0455','DScy':'\u0405','dsol':'\u29F6','dstrok':'\u0111','Dstrok':'\u0110','dtdot':'\u22F1','dtri':'\u25BF','dtrif':'\u25BE','duarr':'\u21F5','duhar':'\u296F','dwangle':'\u29A6','dzcy':'\u045F','DZcy':'\u040F','dzigrarr':'\u27FF','eacute':'\xE9','Eacute':'\xC9','easter':'\u2A6E','ecaron':'\u011B','Ecaron':'\u011A','ecir':'\u2256','ecirc':'\xEA','Ecirc':'\xCA','ecolon':'\u2255','ecy':'\u044D','Ecy':'\u042D','eDDot':'\u2A77','edot':'\u0117','eDot':'\u2251','Edot':'\u0116','ee':'\u2147','efDot':'\u2252','efr':'\uD835\uDD22','Efr':'\uD835\uDD08','eg':'\u2A9A','egrave':'\xE8','Egrave':'\xC8','egs':'\u2A96','egsdot':'\u2A98','el':'\u2A99','Element':'\u2208','elinters':'\u23E7','ell':'\u2113','els':'\u2A95','elsdot':'\u2A97','emacr':'\u0113','Emacr':'\u0112','empty':'\u2205','emptyset':'\u2205','EmptySmallSquare':'\u25FB','emptyv':'\u2205','EmptyVerySmallSquare':'\u25AB','emsp':'\u2003','emsp13':'\u2004','emsp14':'\u2005','eng':'\u014B','ENG':'\u014A','ensp':'\u2002','eogon':'\u0119','Eogon':'\u0118','eopf':'\uD835\uDD56','Eopf':'\uD835\uDD3C','epar':'\u22D5','eparsl':'\u29E3','eplus':'\u2A71','epsi':'\u03B5','epsilon':'\u03B5','Epsilon':'\u0395','epsiv':'\u03F5','eqcirc':'\u2256','eqcolon':'\u2255','eqsim':'\u2242','eqslantgtr':'\u2A96','eqslantless':'\u2A95','Equal':'\u2A75','equals':'=','EqualTilde':'\u2242','equest':'\u225F','Equilibrium':'\u21CC','equiv':'\u2261','equivDD':'\u2A78','eqvparsl':'\u29E5','erarr':'\u2971','erDot':'\u2253','escr':'\u212F','Escr':'\u2130','esdot':'\u2250','esim':'\u2242','Esim':'\u2A73','eta':'\u03B7','Eta':'\u0397','eth':'\xF0','ETH':'\xD0','euml':'\xEB','Euml':'\xCB','euro':'\u20AC','excl':'!','exist':'\u2203','Exists':'\u2203','expectation':'\u2130','exponentiale':'\u2147','ExponentialE':'\u2147','fallingdotseq':'\u2252','fcy':'\u0444','Fcy':'\u0424','female':'\u2640','ffilig':'\uFB03','fflig':'\uFB00','ffllig':'\uFB04','ffr':'\uD835\uDD23','Ffr':'\uD835\uDD09','filig':'\uFB01','FilledSmallSquare':'\u25FC','FilledVerySmallSquare':'\u25AA','fjlig':'fj','flat':'\u266D','fllig':'\uFB02','fltns':'\u25B1','fnof':'\u0192','fopf':'\uD835\uDD57','Fopf':'\uD835\uDD3D','forall':'\u2200','ForAll':'\u2200','fork':'\u22D4','forkv':'\u2AD9','Fouriertrf':'\u2131','fpartint':'\u2A0D','frac12':'\xBD','frac13':'\u2153','frac14':'\xBC','frac15':'\u2155','frac16':'\u2159','frac18':'\u215B','frac23':'\u2154','frac25':'\u2156','frac34':'\xBE','frac35':'\u2157','frac38':'\u215C','frac45':'\u2158','frac56':'\u215A','frac58':'\u215D','frac78':'\u215E','frasl':'\u2044','frown':'\u2322','fscr':'\uD835\uDCBB','Fscr':'\u2131','gacute':'\u01F5','gamma':'\u03B3','Gamma':'\u0393','gammad':'\u03DD','Gammad':'\u03DC','gap':'\u2A86','gbreve':'\u011F','Gbreve':'\u011E','Gcedil':'\u0122','gcirc':'\u011D','Gcirc':'\u011C','gcy':'\u0433','Gcy':'\u0413','gdot':'\u0121','Gdot':'\u0120','ge':'\u2265','gE':'\u2267','gel':'\u22DB','gEl':'\u2A8C','geq':'\u2265','geqq':'\u2267','geqslant':'\u2A7E','ges':'\u2A7E','gescc':'\u2AA9','gesdot':'\u2A80','gesdoto':'\u2A82','gesdotol':'\u2A84','gesl':'\u22DB\uFE00','gesles':'\u2A94','gfr':'\uD835\uDD24','Gfr':'\uD835\uDD0A','gg':'\u226B','Gg':'\u22D9','ggg':'\u22D9','gimel':'\u2137','gjcy':'\u0453','GJcy':'\u0403','gl':'\u2277','gla':'\u2AA5','glE':'\u2A92','glj':'\u2AA4','gnap':'\u2A8A','gnapprox':'\u2A8A','gne':'\u2A88','gnE':'\u2269','gneq':'\u2A88','gneqq':'\u2269','gnsim':'\u22E7','gopf':'\uD835\uDD58','Gopf':'\uD835\uDD3E','grave':'`','GreaterEqual':'\u2265','GreaterEqualLess':'\u22DB','GreaterFullEqual':'\u2267','GreaterGreater':'\u2AA2','GreaterLess':'\u2277','GreaterSlantEqual':'\u2A7E','GreaterTilde':'\u2273','gscr':'\u210A','Gscr':'\uD835\uDCA2','gsim':'\u2273','gsime':'\u2A8E','gsiml':'\u2A90','gt':'>','Gt':'\u226B','GT':'>','gtcc':'\u2AA7','gtcir':'\u2A7A','gtdot':'\u22D7','gtlPar':'\u2995','gtquest':'\u2A7C','gtrapprox':'\u2A86','gtrarr':'\u2978','gtrdot':'\u22D7','gtreqless':'\u22DB','gtreqqless':'\u2A8C','gtrless':'\u2277','gtrsim':'\u2273','gvertneqq':'\u2269\uFE00','gvnE':'\u2269\uFE00','Hacek':'\u02C7','hairsp':'\u200A','half':'\xBD','hamilt':'\u210B','hardcy':'\u044A','HARDcy':'\u042A','harr':'\u2194','hArr':'\u21D4','harrcir':'\u2948','harrw':'\u21AD','Hat':'^','hbar':'\u210F','hcirc':'\u0125','Hcirc':'\u0124','hearts':'\u2665','heartsuit':'\u2665','hellip':'\u2026','hercon':'\u22B9','hfr':'\uD835\uDD25','Hfr':'\u210C','HilbertSpace':'\u210B','hksearow':'\u2925','hkswarow':'\u2926','hoarr':'\u21FF','homtht':'\u223B','hookleftarrow':'\u21A9','hookrightarrow':'\u21AA','hopf':'\uD835\uDD59','Hopf':'\u210D','horbar':'\u2015','HorizontalLine':'\u2500','hscr':'\uD835\uDCBD','Hscr':'\u210B','hslash':'\u210F','hstrok':'\u0127','Hstrok':'\u0126','HumpDownHump':'\u224E','HumpEqual':'\u224F','hybull':'\u2043','hyphen':'\u2010','iacute':'\xED','Iacute':'\xCD','ic':'\u2063','icirc':'\xEE','Icirc':'\xCE','icy':'\u0438','Icy':'\u0418','Idot':'\u0130','iecy':'\u0435','IEcy':'\u0415','iexcl':'\xA1','iff':'\u21D4','ifr':'\uD835\uDD26','Ifr':'\u2111','igrave':'\xEC','Igrave':'\xCC','ii':'\u2148','iiiint':'\u2A0C','iiint':'\u222D','iinfin':'\u29DC','iiota':'\u2129','ijlig':'\u0133','IJlig':'\u0132','Im':'\u2111','imacr':'\u012B','Imacr':'\u012A','image':'\u2111','ImaginaryI':'\u2148','imagline':'\u2110','imagpart':'\u2111','imath':'\u0131','imof':'\u22B7','imped':'\u01B5','Implies':'\u21D2','in':'\u2208','incare':'\u2105','infin':'\u221E','infintie':'\u29DD','inodot':'\u0131','int':'\u222B','Int':'\u222C','intcal':'\u22BA','integers':'\u2124','Integral':'\u222B','intercal':'\u22BA','Intersection':'\u22C2','intlarhk':'\u2A17','intprod':'\u2A3C','InvisibleComma':'\u2063','InvisibleTimes':'\u2062','iocy':'\u0451','IOcy':'\u0401','iogon':'\u012F','Iogon':'\u012E','iopf':'\uD835\uDD5A','Iopf':'\uD835\uDD40','iota':'\u03B9','Iota':'\u0399','iprod':'\u2A3C','iquest':'\xBF','iscr':'\uD835\uDCBE','Iscr':'\u2110','isin':'\u2208','isindot':'\u22F5','isinE':'\u22F9','isins':'\u22F4','isinsv':'\u22F3','isinv':'\u2208','it':'\u2062','itilde':'\u0129','Itilde':'\u0128','iukcy':'\u0456','Iukcy':'\u0406','iuml':'\xEF','Iuml':'\xCF','jcirc':'\u0135','Jcirc':'\u0134','jcy':'\u0439','Jcy':'\u0419','jfr':'\uD835\uDD27','Jfr':'\uD835\uDD0D','jmath':'\u0237','jopf':'\uD835\uDD5B','Jopf':'\uD835\uDD41','jscr':'\uD835\uDCBF','Jscr':'\uD835\uDCA5','jsercy':'\u0458','Jsercy':'\u0408','jukcy':'\u0454','Jukcy':'\u0404','kappa':'\u03BA','Kappa':'\u039A','kappav':'\u03F0','kcedil':'\u0137','Kcedil':'\u0136','kcy':'\u043A','Kcy':'\u041A','kfr':'\uD835\uDD28','Kfr':'\uD835\uDD0E','kgreen':'\u0138','khcy':'\u0445','KHcy':'\u0425','kjcy':'\u045C','KJcy':'\u040C','kopf':'\uD835\uDD5C','Kopf':'\uD835\uDD42','kscr':'\uD835\uDCC0','Kscr':'\uD835\uDCA6','lAarr':'\u21DA','lacute':'\u013A','Lacute':'\u0139','laemptyv':'\u29B4','lagran':'\u2112','lambda':'\u03BB','Lambda':'\u039B','lang':'\u27E8','Lang':'\u27EA','langd':'\u2991','langle':'\u27E8','lap':'\u2A85','Laplacetrf':'\u2112','laquo':'\xAB','larr':'\u2190','lArr':'\u21D0','Larr':'\u219E','larrb':'\u21E4','larrbfs':'\u291F','larrfs':'\u291D','larrhk':'\u21A9','larrlp':'\u21AB','larrpl':'\u2939','larrsim':'\u2973','larrtl':'\u21A2','lat':'\u2AAB','latail':'\u2919','lAtail':'\u291B','late':'\u2AAD','lates':'\u2AAD\uFE00','lbarr':'\u290C','lBarr':'\u290E','lbbrk':'\u2772','lbrace':'{','lbrack':'[','lbrke':'\u298B','lbrksld':'\u298F','lbrkslu':'\u298D','lcaron':'\u013E','Lcaron':'\u013D','lcedil':'\u013C','Lcedil':'\u013B','lceil':'\u2308','lcub':'{','lcy':'\u043B','Lcy':'\u041B','ldca':'\u2936','ldquo':'\u201C','ldquor':'\u201E','ldrdhar':'\u2967','ldrushar':'\u294B','ldsh':'\u21B2','le':'\u2264','lE':'\u2266','LeftAngleBracket':'\u27E8','leftarrow':'\u2190','Leftarrow':'\u21D0','LeftArrow':'\u2190','LeftArrowBar':'\u21E4','LeftArrowRightArrow':'\u21C6','leftarrowtail':'\u21A2','LeftCeiling':'\u2308','LeftDoubleBracket':'\u27E6','LeftDownTeeVector':'\u2961','LeftDownVector':'\u21C3','LeftDownVectorBar':'\u2959','LeftFloor':'\u230A','leftharpoondown':'\u21BD','leftharpoonup':'\u21BC','leftleftarrows':'\u21C7','leftrightarrow':'\u2194','Leftrightarrow':'\u21D4','LeftRightArrow':'\u2194','leftrightarrows':'\u21C6','leftrightharpoons':'\u21CB','leftrightsquigarrow':'\u21AD','LeftRightVector':'\u294E','LeftTee':'\u22A3','LeftTeeArrow':'\u21A4','LeftTeeVector':'\u295A','leftthreetimes':'\u22CB','LeftTriangle':'\u22B2','LeftTriangleBar':'\u29CF','LeftTriangleEqual':'\u22B4','LeftUpDownVector':'\u2951','LeftUpTeeVector':'\u2960','LeftUpVector':'\u21BF','LeftUpVectorBar':'\u2958','LeftVector':'\u21BC','LeftVectorBar':'\u2952','leg':'\u22DA','lEg':'\u2A8B','leq':'\u2264','leqq':'\u2266','leqslant':'\u2A7D','les':'\u2A7D','lescc':'\u2AA8','lesdot':'\u2A7F','lesdoto':'\u2A81','lesdotor':'\u2A83','lesg':'\u22DA\uFE00','lesges':'\u2A93','lessapprox':'\u2A85','lessdot':'\u22D6','lesseqgtr':'\u22DA','lesseqqgtr':'\u2A8B','LessEqualGreater':'\u22DA','LessFullEqual':'\u2266','LessGreater':'\u2276','lessgtr':'\u2276','LessLess':'\u2AA1','lesssim':'\u2272','LessSlantEqual':'\u2A7D','LessTilde':'\u2272','lfisht':'\u297C','lfloor':'\u230A','lfr':'\uD835\uDD29','Lfr':'\uD835\uDD0F','lg':'\u2276','lgE':'\u2A91','lHar':'\u2962','lhard':'\u21BD','lharu':'\u21BC','lharul':'\u296A','lhblk':'\u2584','ljcy':'\u0459','LJcy':'\u0409','ll':'\u226A','Ll':'\u22D8','llarr':'\u21C7','llcorner':'\u231E','Lleftarrow':'\u21DA','llhard':'\u296B','lltri':'\u25FA','lmidot':'\u0140','Lmidot':'\u013F','lmoust':'\u23B0','lmoustache':'\u23B0','lnap':'\u2A89','lnapprox':'\u2A89','lne':'\u2A87','lnE':'\u2268','lneq':'\u2A87','lneqq':'\u2268','lnsim':'\u22E6','loang':'\u27EC','loarr':'\u21FD','lobrk':'\u27E6','longleftarrow':'\u27F5','Longleftarrow':'\u27F8','LongLeftArrow':'\u27F5','longleftrightarrow':'\u27F7','Longleftrightarrow':'\u27FA','LongLeftRightArrow':'\u27F7','longmapsto':'\u27FC','longrightarrow':'\u27F6','Longrightarrow':'\u27F9','LongRightArrow':'\u27F6','looparrowleft':'\u21AB','looparrowright':'\u21AC','lopar':'\u2985','lopf':'\uD835\uDD5D','Lopf':'\uD835\uDD43','loplus':'\u2A2D','lotimes':'\u2A34','lowast':'\u2217','lowbar':'_','LowerLeftArrow':'\u2199','LowerRightArrow':'\u2198','loz':'\u25CA','lozenge':'\u25CA','lozf':'\u29EB','lpar':'(','lparlt':'\u2993','lrarr':'\u21C6','lrcorner':'\u231F','lrhar':'\u21CB','lrhard':'\u296D','lrm':'\u200E','lrtri':'\u22BF','lsaquo':'\u2039','lscr':'\uD835\uDCC1','Lscr':'\u2112','lsh':'\u21B0','Lsh':'\u21B0','lsim':'\u2272','lsime':'\u2A8D','lsimg':'\u2A8F','lsqb':'[','lsquo':'\u2018','lsquor':'\u201A','lstrok':'\u0142','Lstrok':'\u0141','lt':'<','Lt':'\u226A','LT':'<','ltcc':'\u2AA6','ltcir':'\u2A79','ltdot':'\u22D6','lthree':'\u22CB','ltimes':'\u22C9','ltlarr':'\u2976','ltquest':'\u2A7B','ltri':'\u25C3','ltrie':'\u22B4','ltrif':'\u25C2','ltrPar':'\u2996','lurdshar':'\u294A','luruhar':'\u2966','lvertneqq':'\u2268\uFE00','lvnE':'\u2268\uFE00','macr':'\xAF','male':'\u2642','malt':'\u2720','maltese':'\u2720','map':'\u21A6','Map':'\u2905','mapsto':'\u21A6','mapstodown':'\u21A7','mapstoleft':'\u21A4','mapstoup':'\u21A5','marker':'\u25AE','mcomma':'\u2A29','mcy':'\u043C','Mcy':'\u041C','mdash':'\u2014','mDDot':'\u223A','measuredangle':'\u2221','MediumSpace':'\u205F','Mellintrf':'\u2133','mfr':'\uD835\uDD2A','Mfr':'\uD835\uDD10','mho':'\u2127','micro':'\xB5','mid':'\u2223','midast':'*','midcir':'\u2AF0','middot':'\xB7','minus':'\u2212','minusb':'\u229F','minusd':'\u2238','minusdu':'\u2A2A','MinusPlus':'\u2213','mlcp':'\u2ADB','mldr':'\u2026','mnplus':'\u2213','models':'\u22A7','mopf':'\uD835\uDD5E','Mopf':'\uD835\uDD44','mp':'\u2213','mscr':'\uD835\uDCC2','Mscr':'\u2133','mstpos':'\u223E','mu':'\u03BC','Mu':'\u039C','multimap':'\u22B8','mumap':'\u22B8','nabla':'\u2207','nacute':'\u0144','Nacute':'\u0143','nang':'\u2220\u20D2','nap':'\u2249','napE':'\u2A70\u0338','napid':'\u224B\u0338','napos':'\u0149','napprox':'\u2249','natur':'\u266E','natural':'\u266E','naturals':'\u2115','nbsp':'\xA0','nbump':'\u224E\u0338','nbumpe':'\u224F\u0338','ncap':'\u2A43','ncaron':'\u0148','Ncaron':'\u0147','ncedil':'\u0146','Ncedil':'\u0145','ncong':'\u2247','ncongdot':'\u2A6D\u0338','ncup':'\u2A42','ncy':'\u043D','Ncy':'\u041D','ndash':'\u2013','ne':'\u2260','nearhk':'\u2924','nearr':'\u2197','neArr':'\u21D7','nearrow':'\u2197','nedot':'\u2250\u0338','NegativeMediumSpace':'\u200B','NegativeThickSpace':'\u200B','NegativeThinSpace':'\u200B','NegativeVeryThinSpace':'\u200B','nequiv':'\u2262','nesear':'\u2928','nesim':'\u2242\u0338','NestedGreaterGreater':'\u226B','NestedLessLess':'\u226A','NewLine':'\n','nexist':'\u2204','nexists':'\u2204','nfr':'\uD835\uDD2B','Nfr':'\uD835\uDD11','nge':'\u2271','ngE':'\u2267\u0338','ngeq':'\u2271','ngeqq':'\u2267\u0338','ngeqslant':'\u2A7E\u0338','nges':'\u2A7E\u0338','nGg':'\u22D9\u0338','ngsim':'\u2275','ngt':'\u226F','nGt':'\u226B\u20D2','ngtr':'\u226F','nGtv':'\u226B\u0338','nharr':'\u21AE','nhArr':'\u21CE','nhpar':'\u2AF2','ni':'\u220B','nis':'\u22FC','nisd':'\u22FA','niv':'\u220B','njcy':'\u045A','NJcy':'\u040A','nlarr':'\u219A','nlArr':'\u21CD','nldr':'\u2025','nle':'\u2270','nlE':'\u2266\u0338','nleftarrow':'\u219A','nLeftarrow':'\u21CD','nleftrightarrow':'\u21AE','nLeftrightarrow':'\u21CE','nleq':'\u2270','nleqq':'\u2266\u0338','nleqslant':'\u2A7D\u0338','nles':'\u2A7D\u0338','nless':'\u226E','nLl':'\u22D8\u0338','nlsim':'\u2274','nlt':'\u226E','nLt':'\u226A\u20D2','nltri':'\u22EA','nltrie':'\u22EC','nLtv':'\u226A\u0338','nmid':'\u2224','NoBreak':'\u2060','NonBreakingSpace':'\xA0','nopf':'\uD835\uDD5F','Nopf':'\u2115','not':'\xAC','Not':'\u2AEC','NotCongruent':'\u2262','NotCupCap':'\u226D','NotDoubleVerticalBar':'\u2226','NotElement':'\u2209','NotEqual':'\u2260','NotEqualTilde':'\u2242\u0338','NotExists':'\u2204','NotGreater':'\u226F','NotGreaterEqual':'\u2271','NotGreaterFullEqual':'\u2267\u0338','NotGreaterGreater':'\u226B\u0338','NotGreaterLess':'\u2279','NotGreaterSlantEqual':'\u2A7E\u0338','NotGreaterTilde':'\u2275','NotHumpDownHump':'\u224E\u0338','NotHumpEqual':'\u224F\u0338','notin':'\u2209','notindot':'\u22F5\u0338','notinE':'\u22F9\u0338','notinva':'\u2209','notinvb':'\u22F7','notinvc':'\u22F6','NotLeftTriangle':'\u22EA','NotLeftTriangleBar':'\u29CF\u0338','NotLeftTriangleEqual':'\u22EC','NotLess':'\u226E','NotLessEqual':'\u2270','NotLessGreater':'\u2278','NotLessLess':'\u226A\u0338','NotLessSlantEqual':'\u2A7D\u0338','NotLessTilde':'\u2274','NotNestedGreaterGreater':'\u2AA2\u0338','NotNestedLessLess':'\u2AA1\u0338','notni':'\u220C','notniva':'\u220C','notnivb':'\u22FE','notnivc':'\u22FD','NotPrecedes':'\u2280','NotPrecedesEqual':'\u2AAF\u0338','NotPrecedesSlantEqual':'\u22E0','NotReverseElement':'\u220C','NotRightTriangle':'\u22EB','NotRightTriangleBar':'\u29D0\u0338','NotRightTriangleEqual':'\u22ED','NotSquareSubset':'\u228F\u0338','NotSquareSubsetEqual':'\u22E2','NotSquareSuperset':'\u2290\u0338','NotSquareSupersetEqual':'\u22E3','NotSubset':'\u2282\u20D2','NotSubsetEqual':'\u2288','NotSucceeds':'\u2281','NotSucceedsEqual':'\u2AB0\u0338','NotSucceedsSlantEqual':'\u22E1','NotSucceedsTilde':'\u227F\u0338','NotSuperset':'\u2283\u20D2','NotSupersetEqual':'\u2289','NotTilde':'\u2241','NotTildeEqual':'\u2244','NotTildeFullEqual':'\u2247','NotTildeTilde':'\u2249','NotVerticalBar':'\u2224','npar':'\u2226','nparallel':'\u2226','nparsl':'\u2AFD\u20E5','npart':'\u2202\u0338','npolint':'\u2A14','npr':'\u2280','nprcue':'\u22E0','npre':'\u2AAF\u0338','nprec':'\u2280','npreceq':'\u2AAF\u0338','nrarr':'\u219B','nrArr':'\u21CF','nrarrc':'\u2933\u0338','nrarrw':'\u219D\u0338','nrightarrow':'\u219B','nRightarrow':'\u21CF','nrtri':'\u22EB','nrtrie':'\u22ED','nsc':'\u2281','nsccue':'\u22E1','nsce':'\u2AB0\u0338','nscr':'\uD835\uDCC3','Nscr':'\uD835\uDCA9','nshortmid':'\u2224','nshortparallel':'\u2226','nsim':'\u2241','nsime':'\u2244','nsimeq':'\u2244','nsmid':'\u2224','nspar':'\u2226','nsqsube':'\u22E2','nsqsupe':'\u22E3','nsub':'\u2284','nsube':'\u2288','nsubE':'\u2AC5\u0338','nsubset':'\u2282\u20D2','nsubseteq':'\u2288','nsubseteqq':'\u2AC5\u0338','nsucc':'\u2281','nsucceq':'\u2AB0\u0338','nsup':'\u2285','nsupe':'\u2289','nsupE':'\u2AC6\u0338','nsupset':'\u2283\u20D2','nsupseteq':'\u2289','nsupseteqq':'\u2AC6\u0338','ntgl':'\u2279','ntilde':'\xF1','Ntilde':'\xD1','ntlg':'\u2278','ntriangleleft':'\u22EA','ntrianglelefteq':'\u22EC','ntriangleright':'\u22EB','ntrianglerighteq':'\u22ED','nu':'\u03BD','Nu':'\u039D','num':'#','numero':'\u2116','numsp':'\u2007','nvap':'\u224D\u20D2','nvdash':'\u22AC','nvDash':'\u22AD','nVdash':'\u22AE','nVDash':'\u22AF','nvge':'\u2265\u20D2','nvgt':'>\u20D2','nvHarr':'\u2904','nvinfin':'\u29DE','nvlArr':'\u2902','nvle':'\u2264\u20D2','nvlt':'<\u20D2','nvltrie':'\u22B4\u20D2','nvrArr':'\u2903','nvrtrie':'\u22B5\u20D2','nvsim':'\u223C\u20D2','nwarhk':'\u2923','nwarr':'\u2196','nwArr':'\u21D6','nwarrow':'\u2196','nwnear':'\u2927','oacute':'\xF3','Oacute':'\xD3','oast':'\u229B','ocir':'\u229A','ocirc':'\xF4','Ocirc':'\xD4','ocy':'\u043E','Ocy':'\u041E','odash':'\u229D','odblac':'\u0151','Odblac':'\u0150','odiv':'\u2A38','odot':'\u2299','odsold':'\u29BC','oelig':'\u0153','OElig':'\u0152','ofcir':'\u29BF','ofr':'\uD835\uDD2C','Ofr':'\uD835\uDD12','ogon':'\u02DB','ograve':'\xF2','Ograve':'\xD2','ogt':'\u29C1','ohbar':'\u29B5','ohm':'\u03A9','oint':'\u222E','olarr':'\u21BA','olcir':'\u29BE','olcross':'\u29BB','oline':'\u203E','olt':'\u29C0','omacr':'\u014D','Omacr':'\u014C','omega':'\u03C9','Omega':'\u03A9','omicron':'\u03BF','Omicron':'\u039F','omid':'\u29B6','ominus':'\u2296','oopf':'\uD835\uDD60','Oopf':'\uD835\uDD46','opar':'\u29B7','OpenCurlyDoubleQuote':'\u201C','OpenCurlyQuote':'\u2018','operp':'\u29B9','oplus':'\u2295','or':'\u2228','Or':'\u2A54','orarr':'\u21BB','ord':'\u2A5D','order':'\u2134','orderof':'\u2134','ordf':'\xAA','ordm':'\xBA','origof':'\u22B6','oror':'\u2A56','orslope':'\u2A57','orv':'\u2A5B','oS':'\u24C8','oscr':'\u2134','Oscr':'\uD835\uDCAA','oslash':'\xF8','Oslash':'\xD8','osol':'\u2298','otilde':'\xF5','Otilde':'\xD5','otimes':'\u2297','Otimes':'\u2A37','otimesas':'\u2A36','ouml':'\xF6','Ouml':'\xD6','ovbar':'\u233D','OverBar':'\u203E','OverBrace':'\u23DE','OverBracket':'\u23B4','OverParenthesis':'\u23DC','par':'\u2225','para':'\xB6','parallel':'\u2225','parsim':'\u2AF3','parsl':'\u2AFD','part':'\u2202','PartialD':'\u2202','pcy':'\u043F','Pcy':'\u041F','percnt':'%','period':'.','permil':'\u2030','perp':'\u22A5','pertenk':'\u2031','pfr':'\uD835\uDD2D','Pfr':'\uD835\uDD13','phi':'\u03C6','Phi':'\u03A6','phiv':'\u03D5','phmmat':'\u2133','phone':'\u260E','pi':'\u03C0','Pi':'\u03A0','pitchfork':'\u22D4','piv':'\u03D6','planck':'\u210F','planckh':'\u210E','plankv':'\u210F','plus':'+','plusacir':'\u2A23','plusb':'\u229E','pluscir':'\u2A22','plusdo':'\u2214','plusdu':'\u2A25','pluse':'\u2A72','PlusMinus':'\xB1','plusmn':'\xB1','plussim':'\u2A26','plustwo':'\u2A27','pm':'\xB1','Poincareplane':'\u210C','pointint':'\u2A15','popf':'\uD835\uDD61','Popf':'\u2119','pound':'\xA3','pr':'\u227A','Pr':'\u2ABB','prap':'\u2AB7','prcue':'\u227C','pre':'\u2AAF','prE':'\u2AB3','prec':'\u227A','precapprox':'\u2AB7','preccurlyeq':'\u227C','Precedes':'\u227A','PrecedesEqual':'\u2AAF','PrecedesSlantEqual':'\u227C','PrecedesTilde':'\u227E','preceq':'\u2AAF','precnapprox':'\u2AB9','precneqq':'\u2AB5','precnsim':'\u22E8','precsim':'\u227E','prime':'\u2032','Prime':'\u2033','primes':'\u2119','prnap':'\u2AB9','prnE':'\u2AB5','prnsim':'\u22E8','prod':'\u220F','Product':'\u220F','profalar':'\u232E','profline':'\u2312','profsurf':'\u2313','prop':'\u221D','Proportion':'\u2237','Proportional':'\u221D','propto':'\u221D','prsim':'\u227E','prurel':'\u22B0','pscr':'\uD835\uDCC5','Pscr':'\uD835\uDCAB','psi':'\u03C8','Psi':'\u03A8','puncsp':'\u2008','qfr':'\uD835\uDD2E','Qfr':'\uD835\uDD14','qint':'\u2A0C','qopf':'\uD835\uDD62','Qopf':'\u211A','qprime':'\u2057','qscr':'\uD835\uDCC6','Qscr':'\uD835\uDCAC','quaternions':'\u210D','quatint':'\u2A16','quest':'?','questeq':'\u225F','quot':'"','QUOT':'"','rAarr':'\u21DB','race':'\u223D\u0331','racute':'\u0155','Racute':'\u0154','radic':'\u221A','raemptyv':'\u29B3','rang':'\u27E9','Rang':'\u27EB','rangd':'\u2992','range':'\u29A5','rangle':'\u27E9','raquo':'\xBB','rarr':'\u2192','rArr':'\u21D2','Rarr':'\u21A0','rarrap':'\u2975','rarrb':'\u21E5','rarrbfs':'\u2920','rarrc':'\u2933','rarrfs':'\u291E','rarrhk':'\u21AA','rarrlp':'\u21AC','rarrpl':'\u2945','rarrsim':'\u2974','rarrtl':'\u21A3','Rarrtl':'\u2916','rarrw':'\u219D','ratail':'\u291A','rAtail':'\u291C','ratio':'\u2236','rationals':'\u211A','rbarr':'\u290D','rBarr':'\u290F','RBarr':'\u2910','rbbrk':'\u2773','rbrace':'}','rbrack':']','rbrke':'\u298C','rbrksld':'\u298E','rbrkslu':'\u2990','rcaron':'\u0159','Rcaron':'\u0158','rcedil':'\u0157','Rcedil':'\u0156','rceil':'\u2309','rcub':'}','rcy':'\u0440','Rcy':'\u0420','rdca':'\u2937','rdldhar':'\u2969','rdquo':'\u201D','rdquor':'\u201D','rdsh':'\u21B3','Re':'\u211C','real':'\u211C','realine':'\u211B','realpart':'\u211C','reals':'\u211D','rect':'\u25AD','reg':'\xAE','REG':'\xAE','ReverseElement':'\u220B','ReverseEquilibrium':'\u21CB','ReverseUpEquilibrium':'\u296F','rfisht':'\u297D','rfloor':'\u230B','rfr':'\uD835\uDD2F','Rfr':'\u211C','rHar':'\u2964','rhard':'\u21C1','rharu':'\u21C0','rharul':'\u296C','rho':'\u03C1','Rho':'\u03A1','rhov':'\u03F1','RightAngleBracket':'\u27E9','rightarrow':'\u2192','Rightarrow':'\u21D2','RightArrow':'\u2192','RightArrowBar':'\u21E5','RightArrowLeftArrow':'\u21C4','rightarrowtail':'\u21A3','RightCeiling':'\u2309','RightDoubleBracket':'\u27E7','RightDownTeeVector':'\u295D','RightDownVector':'\u21C2','RightDownVectorBar':'\u2955','RightFloor':'\u230B','rightharpoondown':'\u21C1','rightharpoonup':'\u21C0','rightleftarrows':'\u21C4','rightleftharpoons':'\u21CC','rightrightarrows':'\u21C9','rightsquigarrow':'\u219D','RightTee':'\u22A2','RightTeeArrow':'\u21A6','RightTeeVector':'\u295B','rightthreetimes':'\u22CC','RightTriangle':'\u22B3','RightTriangleBar':'\u29D0','RightTriangleEqual':'\u22B5','RightUpDownVector':'\u294F','RightUpTeeVector':'\u295C','RightUpVector':'\u21BE','RightUpVectorBar':'\u2954','RightVector':'\u21C0','RightVectorBar':'\u2953','ring':'\u02DA','risingdotseq':'\u2253','rlarr':'\u21C4','rlhar':'\u21CC','rlm':'\u200F','rmoust':'\u23B1','rmoustache':'\u23B1','rnmid':'\u2AEE','roang':'\u27ED','roarr':'\u21FE','robrk':'\u27E7','ropar':'\u2986','ropf':'\uD835\uDD63','Ropf':'\u211D','roplus':'\u2A2E','rotimes':'\u2A35','RoundImplies':'\u2970','rpar':')','rpargt':'\u2994','rppolint':'\u2A12','rrarr':'\u21C9','Rrightarrow':'\u21DB','rsaquo':'\u203A','rscr':'\uD835\uDCC7','Rscr':'\u211B','rsh':'\u21B1','Rsh':'\u21B1','rsqb':']','rsquo':'\u2019','rsquor':'\u2019','rthree':'\u22CC','rtimes':'\u22CA','rtri':'\u25B9','rtrie':'\u22B5','rtrif':'\u25B8','rtriltri':'\u29CE','RuleDelayed':'\u29F4','ruluhar':'\u2968','rx':'\u211E','sacute':'\u015B','Sacute':'\u015A','sbquo':'\u201A','sc':'\u227B','Sc':'\u2ABC','scap':'\u2AB8','scaron':'\u0161','Scaron':'\u0160','sccue':'\u227D','sce':'\u2AB0','scE':'\u2AB4','scedil':'\u015F','Scedil':'\u015E','scirc':'\u015D','Scirc':'\u015C','scnap':'\u2ABA','scnE':'\u2AB6','scnsim':'\u22E9','scpolint':'\u2A13','scsim':'\u227F','scy':'\u0441','Scy':'\u0421','sdot':'\u22C5','sdotb':'\u22A1','sdote':'\u2A66','searhk':'\u2925','searr':'\u2198','seArr':'\u21D8','searrow':'\u2198','sect':'\xA7','semi':';','seswar':'\u2929','setminus':'\u2216','setmn':'\u2216','sext':'\u2736','sfr':'\uD835\uDD30','Sfr':'\uD835\uDD16','sfrown':'\u2322','sharp':'\u266F','shchcy':'\u0449','SHCHcy':'\u0429','shcy':'\u0448','SHcy':'\u0428','ShortDownArrow':'\u2193','ShortLeftArrow':'\u2190','shortmid':'\u2223','shortparallel':'\u2225','ShortRightArrow':'\u2192','ShortUpArrow':'\u2191','shy':'\xAD','sigma':'\u03C3','Sigma':'\u03A3','sigmaf':'\u03C2','sigmav':'\u03C2','sim':'\u223C','simdot':'\u2A6A','sime':'\u2243','simeq':'\u2243','simg':'\u2A9E','simgE':'\u2AA0','siml':'\u2A9D','simlE':'\u2A9F','simne':'\u2246','simplus':'\u2A24','simrarr':'\u2972','slarr':'\u2190','SmallCircle':'\u2218','smallsetminus':'\u2216','smashp':'\u2A33','smeparsl':'\u29E4','smid':'\u2223','smile':'\u2323','smt':'\u2AAA','smte':'\u2AAC','smtes':'\u2AAC\uFE00','softcy':'\u044C','SOFTcy':'\u042C','sol':'/','solb':'\u29C4','solbar':'\u233F','sopf':'\uD835\uDD64','Sopf':'\uD835\uDD4A','spades':'\u2660','spadesuit':'\u2660','spar':'\u2225','sqcap':'\u2293','sqcaps':'\u2293\uFE00','sqcup':'\u2294','sqcups':'\u2294\uFE00','Sqrt':'\u221A','sqsub':'\u228F','sqsube':'\u2291','sqsubset':'\u228F','sqsubseteq':'\u2291','sqsup':'\u2290','sqsupe':'\u2292','sqsupset':'\u2290','sqsupseteq':'\u2292','squ':'\u25A1','square':'\u25A1','Square':'\u25A1','SquareIntersection':'\u2293','SquareSubset':'\u228F','SquareSubsetEqual':'\u2291','SquareSuperset':'\u2290','SquareSupersetEqual':'\u2292','SquareUnion':'\u2294','squarf':'\u25AA','squf':'\u25AA','srarr':'\u2192','sscr':'\uD835\uDCC8','Sscr':'\uD835\uDCAE','ssetmn':'\u2216','ssmile':'\u2323','sstarf':'\u22C6','star':'\u2606','Star':'\u22C6','starf':'\u2605','straightepsilon':'\u03F5','straightphi':'\u03D5','strns':'\xAF','sub':'\u2282','Sub':'\u22D0','subdot':'\u2ABD','sube':'\u2286','subE':'\u2AC5','subedot':'\u2AC3','submult':'\u2AC1','subne':'\u228A','subnE':'\u2ACB','subplus':'\u2ABF','subrarr':'\u2979','subset':'\u2282','Subset':'\u22D0','subseteq':'\u2286','subseteqq':'\u2AC5','SubsetEqual':'\u2286','subsetneq':'\u228A','subsetneqq':'\u2ACB','subsim':'\u2AC7','subsub':'\u2AD5','subsup':'\u2AD3','succ':'\u227B','succapprox':'\u2AB8','succcurlyeq':'\u227D','Succeeds':'\u227B','SucceedsEqual':'\u2AB0','SucceedsSlantEqual':'\u227D','SucceedsTilde':'\u227F','succeq':'\u2AB0','succnapprox':'\u2ABA','succneqq':'\u2AB6','succnsim':'\u22E9','succsim':'\u227F','SuchThat':'\u220B','sum':'\u2211','Sum':'\u2211','sung':'\u266A','sup':'\u2283','Sup':'\u22D1','sup1':'\xB9','sup2':'\xB2','sup3':'\xB3','supdot':'\u2ABE','supdsub':'\u2AD8','supe':'\u2287','supE':'\u2AC6','supedot':'\u2AC4','Superset':'\u2283','SupersetEqual':'\u2287','suphsol':'\u27C9','suphsub':'\u2AD7','suplarr':'\u297B','supmult':'\u2AC2','supne':'\u228B','supnE':'\u2ACC','supplus':'\u2AC0','supset':'\u2283','Supset':'\u22D1','supseteq':'\u2287','supseteqq':'\u2AC6','supsetneq':'\u228B','supsetneqq':'\u2ACC','supsim':'\u2AC8','supsub':'\u2AD4','supsup':'\u2AD6','swarhk':'\u2926','swarr':'\u2199','swArr':'\u21D9','swarrow':'\u2199','swnwar':'\u292A','szlig':'\xDF','Tab':'\t','target':'\u2316','tau':'\u03C4','Tau':'\u03A4','tbrk':'\u23B4','tcaron':'\u0165','Tcaron':'\u0164','tcedil':'\u0163','Tcedil':'\u0162','tcy':'\u0442','Tcy':'\u0422','tdot':'\u20DB','telrec':'\u2315','tfr':'\uD835\uDD31','Tfr':'\uD835\uDD17','there4':'\u2234','therefore':'\u2234','Therefore':'\u2234','theta':'\u03B8','Theta':'\u0398','thetasym':'\u03D1','thetav':'\u03D1','thickapprox':'\u2248','thicksim':'\u223C','ThickSpace':'\u205F\u200A','thinsp':'\u2009','ThinSpace':'\u2009','thkap':'\u2248','thksim':'\u223C','thorn':'\xFE','THORN':'\xDE','tilde':'\u02DC','Tilde':'\u223C','TildeEqual':'\u2243','TildeFullEqual':'\u2245','TildeTilde':'\u2248','times':'\xD7','timesb':'\u22A0','timesbar':'\u2A31','timesd':'\u2A30','tint':'\u222D','toea':'\u2928','top':'\u22A4','topbot':'\u2336','topcir':'\u2AF1','topf':'\uD835\uDD65','Topf':'\uD835\uDD4B','topfork':'\u2ADA','tosa':'\u2929','tprime':'\u2034','trade':'\u2122','TRADE':'\u2122','triangle':'\u25B5','triangledown':'\u25BF','triangleleft':'\u25C3','trianglelefteq':'\u22B4','triangleq':'\u225C','triangleright':'\u25B9','trianglerighteq':'\u22B5','tridot':'\u25EC','trie':'\u225C','triminus':'\u2A3A','TripleDot':'\u20DB','triplus':'\u2A39','trisb':'\u29CD','tritime':'\u2A3B','trpezium':'\u23E2','tscr':'\uD835\uDCC9','Tscr':'\uD835\uDCAF','tscy':'\u0446','TScy':'\u0426','tshcy':'\u045B','TSHcy':'\u040B','tstrok':'\u0167','Tstrok':'\u0166','twixt':'\u226C','twoheadleftarrow':'\u219E','twoheadrightarrow':'\u21A0','uacute':'\xFA','Uacute':'\xDA','uarr':'\u2191','uArr':'\u21D1','Uarr':'\u219F','Uarrocir':'\u2949','ubrcy':'\u045E','Ubrcy':'\u040E','ubreve':'\u016D','Ubreve':'\u016C','ucirc':'\xFB','Ucirc':'\xDB','ucy':'\u0443','Ucy':'\u0423','udarr':'\u21C5','udblac':'\u0171','Udblac':'\u0170','udhar':'\u296E','ufisht':'\u297E','ufr':'\uD835\uDD32','Ufr':'\uD835\uDD18','ugrave':'\xF9','Ugrave':'\xD9','uHar':'\u2963','uharl':'\u21BF','uharr':'\u21BE','uhblk':'\u2580','ulcorn':'\u231C','ulcorner':'\u231C','ulcrop':'\u230F','ultri':'\u25F8','umacr':'\u016B','Umacr':'\u016A','uml':'\xA8','UnderBar':'_','UnderBrace':'\u23DF','UnderBracket':'\u23B5','UnderParenthesis':'\u23DD','Union':'\u22C3','UnionPlus':'\u228E','uogon':'\u0173','Uogon':'\u0172','uopf':'\uD835\uDD66','Uopf':'\uD835\uDD4C','uparrow':'\u2191','Uparrow':'\u21D1','UpArrow':'\u2191','UpArrowBar':'\u2912','UpArrowDownArrow':'\u21C5','updownarrow':'\u2195','Updownarrow':'\u21D5','UpDownArrow':'\u2195','UpEquilibrium':'\u296E','upharpoonleft':'\u21BF','upharpoonright':'\u21BE','uplus':'\u228E','UpperLeftArrow':'\u2196','UpperRightArrow':'\u2197','upsi':'\u03C5','Upsi':'\u03D2','upsih':'\u03D2','upsilon':'\u03C5','Upsilon':'\u03A5','UpTee':'\u22A5','UpTeeArrow':'\u21A5','upuparrows':'\u21C8','urcorn':'\u231D','urcorner':'\u231D','urcrop':'\u230E','uring':'\u016F','Uring':'\u016E','urtri':'\u25F9','uscr':'\uD835\uDCCA','Uscr':'\uD835\uDCB0','utdot':'\u22F0','utilde':'\u0169','Utilde':'\u0168','utri':'\u25B5','utrif':'\u25B4','uuarr':'\u21C8','uuml':'\xFC','Uuml':'\xDC','uwangle':'\u29A7','vangrt':'\u299C','varepsilon':'\u03F5','varkappa':'\u03F0','varnothing':'\u2205','varphi':'\u03D5','varpi':'\u03D6','varpropto':'\u221D','varr':'\u2195','vArr':'\u21D5','varrho':'\u03F1','varsigma':'\u03C2','varsubsetneq':'\u228A\uFE00','varsubsetneqq':'\u2ACB\uFE00','varsupsetneq':'\u228B\uFE00','varsupsetneqq':'\u2ACC\uFE00','vartheta':'\u03D1','vartriangleleft':'\u22B2','vartriangleright':'\u22B3','vBar':'\u2AE8','Vbar':'\u2AEB','vBarv':'\u2AE9','vcy':'\u0432','Vcy':'\u0412','vdash':'\u22A2','vDash':'\u22A8','Vdash':'\u22A9','VDash':'\u22AB','Vdashl':'\u2AE6','vee':'\u2228','Vee':'\u22C1','veebar':'\u22BB','veeeq':'\u225A','vellip':'\u22EE','verbar':'|','Verbar':'\u2016','vert':'|','Vert':'\u2016','VerticalBar':'\u2223','VerticalLine':'|','VerticalSeparator':'\u2758','VerticalTilde':'\u2240','VeryThinSpace':'\u200A','vfr':'\uD835\uDD33','Vfr':'\uD835\uDD19','vltri':'\u22B2','vnsub':'\u2282\u20D2','vnsup':'\u2283\u20D2','vopf':'\uD835\uDD67','Vopf':'\uD835\uDD4D','vprop':'\u221D','vrtri':'\u22B3','vscr':'\uD835\uDCCB','Vscr':'\uD835\uDCB1','vsubne':'\u228A\uFE00','vsubnE':'\u2ACB\uFE00','vsupne':'\u228B\uFE00','vsupnE':'\u2ACC\uFE00','Vvdash':'\u22AA','vzigzag':'\u299A','wcirc':'\u0175','Wcirc':'\u0174','wedbar':'\u2A5F','wedge':'\u2227','Wedge':'\u22C0','wedgeq':'\u2259','weierp':'\u2118','wfr':'\uD835\uDD34','Wfr':'\uD835\uDD1A','wopf':'\uD835\uDD68','Wopf':'\uD835\uDD4E','wp':'\u2118','wr':'\u2240','wreath':'\u2240','wscr':'\uD835\uDCCC','Wscr':'\uD835\uDCB2','xcap':'\u22C2','xcirc':'\u25EF','xcup':'\u22C3','xdtri':'\u25BD','xfr':'\uD835\uDD35','Xfr':'\uD835\uDD1B','xharr':'\u27F7','xhArr':'\u27FA','xi':'\u03BE','Xi':'\u039E','xlarr':'\u27F5','xlArr':'\u27F8','xmap':'\u27FC','xnis':'\u22FB','xodot':'\u2A00','xopf':'\uD835\uDD69','Xopf':'\uD835\uDD4F','xoplus':'\u2A01','xotime':'\u2A02','xrarr':'\u27F6','xrArr':'\u27F9','xscr':'\uD835\uDCCD','Xscr':'\uD835\uDCB3','xsqcup':'\u2A06','xuplus':'\u2A04','xutri':'\u25B3','xvee':'\u22C1','xwedge':'\u22C0','yacute':'\xFD','Yacute':'\xDD','yacy':'\u044F','YAcy':'\u042F','ycirc':'\u0177','Ycirc':'\u0176','ycy':'\u044B','Ycy':'\u042B','yen':'\xA5','yfr':'\uD835\uDD36','Yfr':'\uD835\uDD1C','yicy':'\u0457','YIcy':'\u0407','yopf':'\uD835\uDD6A','Yopf':'\uD835\uDD50','yscr':'\uD835\uDCCE','Yscr':'\uD835\uDCB4','yucy':'\u044E','YUcy':'\u042E','yuml':'\xFF','Yuml':'\u0178','zacute':'\u017A','Zacute':'\u0179','zcaron':'\u017E','Zcaron':'\u017D','zcy':'\u0437','Zcy':'\u0417','zdot':'\u017C','Zdot':'\u017B','zeetrf':'\u2128','ZeroWidthSpace':'\u200B','zeta':'\u03B6','Zeta':'\u0396','zfr':'\uD835\uDD37','Zfr':'\u2128','zhcy':'\u0436','ZHcy':'\u0416','zigrarr':'\u21DD','zopf':'\uD835\uDD6B','Zopf':'\u2124','zscr':'\uD835\uDCCF','Zscr':'\uD835\uDCB5','zwj':'\u200D','zwnj':'\u200C'};
  11471. var decodeMapLegacy = {'aacute':'\xE1','Aacute':'\xC1','acirc':'\xE2','Acirc':'\xC2','acute':'\xB4','aelig':'\xE6','AElig':'\xC6','agrave':'\xE0','Agrave':'\xC0','amp':'&','AMP':'&','aring':'\xE5','Aring':'\xC5','atilde':'\xE3','Atilde':'\xC3','auml':'\xE4','Auml':'\xC4','brvbar':'\xA6','ccedil':'\xE7','Ccedil':'\xC7','cedil':'\xB8','cent':'\xA2','copy':'\xA9','COPY':'\xA9','curren':'\xA4','deg':'\xB0','divide':'\xF7','eacute':'\xE9','Eacute':'\xC9','ecirc':'\xEA','Ecirc':'\xCA','egrave':'\xE8','Egrave':'\xC8','eth':'\xF0','ETH':'\xD0','euml':'\xEB','Euml':'\xCB','frac12':'\xBD','frac14':'\xBC','frac34':'\xBE','gt':'>','GT':'>','iacute':'\xED','Iacute':'\xCD','icirc':'\xEE','Icirc':'\xCE','iexcl':'\xA1','igrave':'\xEC','Igrave':'\xCC','iquest':'\xBF','iuml':'\xEF','Iuml':'\xCF','laquo':'\xAB','lt':'<','LT':'<','macr':'\xAF','micro':'\xB5','middot':'\xB7','nbsp':'\xA0','not':'\xAC','ntilde':'\xF1','Ntilde':'\xD1','oacute':'\xF3','Oacute':'\xD3','ocirc':'\xF4','Ocirc':'\xD4','ograve':'\xF2','Ograve':'\xD2','ordf':'\xAA','ordm':'\xBA','oslash':'\xF8','Oslash':'\xD8','otilde':'\xF5','Otilde':'\xD5','ouml':'\xF6','Ouml':'\xD6','para':'\xB6','plusmn':'\xB1','pound':'\xA3','quot':'"','QUOT':'"','raquo':'\xBB','reg':'\xAE','REG':'\xAE','sect':'\xA7','shy':'\xAD','sup1':'\xB9','sup2':'\xB2','sup3':'\xB3','szlig':'\xDF','thorn':'\xFE','THORN':'\xDE','times':'\xD7','uacute':'\xFA','Uacute':'\xDA','ucirc':'\xFB','Ucirc':'\xDB','ugrave':'\xF9','Ugrave':'\xD9','uml':'\xA8','uuml':'\xFC','Uuml':'\xDC','yacute':'\xFD','Yacute':'\xDD','yen':'\xA5','yuml':'\xFF'};
  11472. var decodeMapNumeric = {'0':'\uFFFD','128':'\u20AC','130':'\u201A','131':'\u0192','132':'\u201E','133':'\u2026','134':'\u2020','135':'\u2021','136':'\u02C6','137':'\u2030','138':'\u0160','139':'\u2039','140':'\u0152','142':'\u017D','145':'\u2018','146':'\u2019','147':'\u201C','148':'\u201D','149':'\u2022','150':'\u2013','151':'\u2014','152':'\u02DC','153':'\u2122','154':'\u0161','155':'\u203A','156':'\u0153','158':'\u017E','159':'\u0178'};
  11473. var invalidReferenceCodePoints = [1,2,3,4,5,6,7,8,11,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,64976,64977,64978,64979,64980,64981,64982,64983,64984,64985,64986,64987,64988,64989,64990,64991,64992,64993,64994,64995,64996,64997,64998,64999,65000,65001,65002,65003,65004,65005,65006,65007,65534,65535,131070,131071,196606,196607,262142,262143,327678,327679,393214,393215,458750,458751,524286,524287,589822,589823,655358,655359,720894,720895,786430,786431,851966,851967,917502,917503,983038,983039,1048574,1048575,1114110,1114111];
  11474. /*--------------------------------------------------------------------------*/
  11475. var stringFromCharCode = String.fromCharCode;
  11476. var object = {};
  11477. var hasOwnProperty = object.hasOwnProperty;
  11478. var has = function(object, propertyName) {
  11479. return hasOwnProperty.call(object, propertyName);
  11480. };
  11481. var contains = function(array, value) {
  11482. var index = -1;
  11483. var length = array.length;
  11484. while (++index < length) {
  11485. if (array[index] == value) {
  11486. return true;
  11487. }
  11488. }
  11489. return false;
  11490. };
  11491. var merge = function(options, defaults) {
  11492. if (!options) {
  11493. return defaults;
  11494. }
  11495. var result = {};
  11496. var key;
  11497. for (key in defaults) {
  11498. // A `hasOwnProperty` check is not needed here, since only recognized
  11499. // option names are used anyway. Any others are ignored.
  11500. result[key] = has(options, key) ? options[key] : defaults[key];
  11501. }
  11502. return result;
  11503. };
  11504. // Modified version of `ucs2encode`; see https://mths.be/punycode.
  11505. var codePointToSymbol = function(codePoint, strict) {
  11506. var output = '';
  11507. if ((codePoint >= 0xD800 && codePoint <= 0xDFFF) || codePoint > 0x10FFFF) {
  11508. // See issue #4:
  11509. // “Otherwise, if the number is in the range 0xD800 to 0xDFFF or is
  11510. // greater than 0x10FFFF, then this is a parse error. Return a U+FFFD
  11511. // REPLACEMENT CHARACTER.”
  11512. if (strict) {
  11513. parseError('character reference outside the permissible Unicode range');
  11514. }
  11515. return '\uFFFD';
  11516. }
  11517. if (has(decodeMapNumeric, codePoint)) {
  11518. if (strict) {
  11519. parseError('disallowed character reference');
  11520. }
  11521. return decodeMapNumeric[codePoint];
  11522. }
  11523. if (strict && contains(invalidReferenceCodePoints, codePoint)) {
  11524. parseError('disallowed character reference');
  11525. }
  11526. if (codePoint > 0xFFFF) {
  11527. codePoint -= 0x10000;
  11528. output += stringFromCharCode(codePoint >>> 10 & 0x3FF | 0xD800);
  11529. codePoint = 0xDC00 | codePoint & 0x3FF;
  11530. }
  11531. output += stringFromCharCode(codePoint);
  11532. return output;
  11533. };
  11534. var hexEscape = function(codePoint) {
  11535. return '&#x' + codePoint.toString(16).toUpperCase() + ';';
  11536. };
  11537. var decEscape = function(codePoint) {
  11538. return '&#' + codePoint + ';';
  11539. };
  11540. var parseError = function(message) {
  11541. throw Error('Parse error: ' + message);
  11542. };
  11543. /*--------------------------------------------------------------------------*/
  11544. var encode = function(string, options) {
  11545. options = merge(options, encode.options);
  11546. var strict = options.strict;
  11547. if (strict && regexInvalidRawCodePoint.test(string)) {
  11548. parseError('forbidden code point');
  11549. }
  11550. var encodeEverything = options.encodeEverything;
  11551. var useNamedReferences = options.useNamedReferences;
  11552. var allowUnsafeSymbols = options.allowUnsafeSymbols;
  11553. var escapeCodePoint = options.decimal ? decEscape : hexEscape;
  11554. var escapeBmpSymbol = function(symbol) {
  11555. return escapeCodePoint(symbol.charCodeAt(0));
  11556. };
  11557. if (encodeEverything) {
  11558. // Encode ASCII symbols.
  11559. string = string.replace(regexAsciiWhitelist, function(symbol) {
  11560. // Use named references if requested & possible.
  11561. if (useNamedReferences && has(encodeMap, symbol)) {
  11562. return '&' + encodeMap[symbol] + ';';
  11563. }
  11564. return escapeBmpSymbol(symbol);
  11565. });
  11566. // Shorten a few escapes that represent two symbols, of which at least one
  11567. // is within the ASCII range.
  11568. if (useNamedReferences) {
  11569. string = string
  11570. .replace(/&gt;\u20D2/g, '&nvgt;')
  11571. .replace(/&lt;\u20D2/g, '&nvlt;')
  11572. .replace(/&#x66;&#x6A;/g, '&fjlig;');
  11573. }
  11574. // Encode non-ASCII symbols.
  11575. if (useNamedReferences) {
  11576. // Encode non-ASCII symbols that can be replaced with a named reference.
  11577. string = string.replace(regexEncodeNonAscii, function(string) {
  11578. // Note: there is no need to check `has(encodeMap, string)` here.
  11579. return '&' + encodeMap[string] + ';';
  11580. });
  11581. }
  11582. // Note: any remaining non-ASCII symbols are handled outside of the `if`.
  11583. } else if (useNamedReferences) {
  11584. // Apply named character references.
  11585. // Encode `<>"'&` using named character references.
  11586. if (!allowUnsafeSymbols) {
  11587. string = string.replace(regexEscape, function(string) {
  11588. return '&' + encodeMap[string] + ';'; // no need to check `has()` here
  11589. });
  11590. }
  11591. // Shorten escapes that represent two symbols, of which at least one is
  11592. // `<>"'&`.
  11593. string = string
  11594. .replace(/&gt;\u20D2/g, '&nvgt;')
  11595. .replace(/&lt;\u20D2/g, '&nvlt;');
  11596. // Encode non-ASCII symbols that can be replaced with a named reference.
  11597. string = string.replace(regexEncodeNonAscii, function(string) {
  11598. // Note: there is no need to check `has(encodeMap, string)` here.
  11599. return '&' + encodeMap[string] + ';';
  11600. });
  11601. } else if (!allowUnsafeSymbols) {
  11602. // Encode `<>"'&` using hexadecimal escapes, now that they’re not handled
  11603. // using named character references.
  11604. string = string.replace(regexEscape, escapeBmpSymbol);
  11605. }
  11606. return string
  11607. // Encode astral symbols.
  11608. .replace(regexAstralSymbols, function($0) {
  11609. // https://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae
  11610. var high = $0.charCodeAt(0);
  11611. var low = $0.charCodeAt(1);
  11612. var codePoint = (high - 0xD800) * 0x400 + low - 0xDC00 + 0x10000;
  11613. return escapeCodePoint(codePoint);
  11614. })
  11615. // Encode any remaining BMP symbols that are not printable ASCII symbols
  11616. // using a hexadecimal escape.
  11617. .replace(regexBmpWhitelist, escapeBmpSymbol);
  11618. };
  11619. // Expose default options (so they can be overridden globally).
  11620. encode.options = {
  11621. 'allowUnsafeSymbols': false,
  11622. 'encodeEverything': false,
  11623. 'strict': false,
  11624. 'useNamedReferences': false,
  11625. 'decimal' : false
  11626. };
  11627. var decode = function(html, options) {
  11628. options = merge(options, decode.options);
  11629. var strict = options.strict;
  11630. if (strict && regexInvalidEntity.test(html)) {
  11631. parseError('malformed character reference');
  11632. }
  11633. return html.replace(regexDecode, function($0, $1, $2, $3, $4, $5, $6, $7, $8) {
  11634. var codePoint;
  11635. var semicolon;
  11636. var decDigits;
  11637. var hexDigits;
  11638. var reference;
  11639. var next;
  11640. if ($1) {
  11641. reference = $1;
  11642. // Note: there is no need to check `has(decodeMap, reference)`.
  11643. return decodeMap[reference];
  11644. }
  11645. if ($2) {
  11646. // Decode named character references without trailing `;`, e.g. `&amp`.
  11647. // This is only a parse error if it gets converted to `&`, or if it is
  11648. // followed by `=` in an attribute context.
  11649. reference = $2;
  11650. next = $3;
  11651. if (next && options.isAttributeValue) {
  11652. if (strict && next == '=') {
  11653. parseError('`&` did not start a character reference');
  11654. }
  11655. return $0;
  11656. } else {
  11657. if (strict) {
  11658. parseError(
  11659. 'named character reference was not terminated by a semicolon'
  11660. );
  11661. }
  11662. // Note: there is no need to check `has(decodeMapLegacy, reference)`.
  11663. return decodeMapLegacy[reference] + (next || '');
  11664. }
  11665. }
  11666. if ($4) {
  11667. // Decode decimal escapes, e.g. `&#119558;`.
  11668. decDigits = $4;
  11669. semicolon = $5;
  11670. if (strict && !semicolon) {
  11671. parseError('character reference was not terminated by a semicolon');
  11672. }
  11673. codePoint = parseInt(decDigits, 10);
  11674. return codePointToSymbol(codePoint, strict);
  11675. }
  11676. if ($6) {
  11677. // Decode hexadecimal escapes, e.g. `&#x1D306;`.
  11678. hexDigits = $6;
  11679. semicolon = $7;
  11680. if (strict && !semicolon) {
  11681. parseError('character reference was not terminated by a semicolon');
  11682. }
  11683. codePoint = parseInt(hexDigits, 16);
  11684. return codePointToSymbol(codePoint, strict);
  11685. }
  11686. // If we’re still here, `if ($7)` is implied; it’s an ambiguous
  11687. // ampersand for sure. https://mths.be/notes/ambiguous-ampersands
  11688. if (strict) {
  11689. parseError(
  11690. 'named character reference was not terminated by a semicolon'
  11691. );
  11692. }
  11693. return $0;
  11694. });
  11695. };
  11696. // Expose default options (so they can be overridden globally).
  11697. decode.options = {
  11698. 'isAttributeValue': false,
  11699. 'strict': false
  11700. };
  11701. var escape = function(string) {
  11702. return string.replace(regexEscape, function($0) {
  11703. // Note: there is no need to check `has(escapeMap, $0)` here.
  11704. return escapeMap[$0];
  11705. });
  11706. };
  11707. /*--------------------------------------------------------------------------*/
  11708. var he = {
  11709. 'version': '1.2.0',
  11710. 'encode': encode,
  11711. 'decode': decode,
  11712. 'escape': escape,
  11713. 'unescape': decode
  11714. };
  11715. // Some AMD build optimizers, like r.js, check for specific condition patterns
  11716. // like the following:
  11717. if (
  11718. false
  11719. ) {
  11720. define(function() {
  11721. return he;
  11722. });
  11723. } else if (freeExports && !freeExports.nodeType) {
  11724. if (freeModule) { // in Node.js, io.js, or RingoJS v0.8.0+
  11725. freeModule.exports = he;
  11726. } else { // in Narwhal or RingoJS v0.7.0-
  11727. for (var key in he) {
  11728. has(he, key) && (freeExports[key] = he[key]);
  11729. }
  11730. }
  11731. } else { // in Rhino or a web browser
  11732. root.he = he;
  11733. }
  11734. }(this));
  11735. }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
  11736. },{}],55:[function(require,module,exports){
  11737. exports.read = function (buffer, offset, isLE, mLen, nBytes) {
  11738. var e, m
  11739. var eLen = (nBytes * 8) - mLen - 1
  11740. var eMax = (1 << eLen) - 1
  11741. var eBias = eMax >> 1
  11742. var nBits = -7
  11743. var i = isLE ? (nBytes - 1) : 0
  11744. var d = isLE ? -1 : 1
  11745. var s = buffer[offset + i]
  11746. i += d
  11747. e = s & ((1 << (-nBits)) - 1)
  11748. s >>= (-nBits)
  11749. nBits += eLen
  11750. for (; nBits > 0; e = (e * 256) + buffer[offset + i], i += d, nBits -= 8) {}
  11751. m = e & ((1 << (-nBits)) - 1)
  11752. e >>= (-nBits)
  11753. nBits += mLen
  11754. for (; nBits > 0; m = (m * 256) + buffer[offset + i], i += d, nBits -= 8) {}
  11755. if (e === 0) {
  11756. e = 1 - eBias
  11757. } else if (e === eMax) {
  11758. return m ? NaN : ((s ? -1 : 1) * Infinity)
  11759. } else {
  11760. m = m + Math.pow(2, mLen)
  11761. e = e - eBias
  11762. }
  11763. return (s ? -1 : 1) * m * Math.pow(2, e - mLen)
  11764. }
  11765. exports.write = function (buffer, value, offset, isLE, mLen, nBytes) {
  11766. var e, m, c
  11767. var eLen = (nBytes * 8) - mLen - 1
  11768. var eMax = (1 << eLen) - 1
  11769. var eBias = eMax >> 1
  11770. var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0)
  11771. var i = isLE ? 0 : (nBytes - 1)
  11772. var d = isLE ? 1 : -1
  11773. var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0
  11774. value = Math.abs(value)
  11775. if (isNaN(value) || value === Infinity) {
  11776. m = isNaN(value) ? 1 : 0
  11777. e = eMax
  11778. } else {
  11779. e = Math.floor(Math.log(value) / Math.LN2)
  11780. if (value * (c = Math.pow(2, -e)) < 1) {
  11781. e--
  11782. c *= 2
  11783. }
  11784. if (e + eBias >= 1) {
  11785. value += rt / c
  11786. } else {
  11787. value += rt * Math.pow(2, 1 - eBias)
  11788. }
  11789. if (value * c >= 2) {
  11790. e++
  11791. c /= 2
  11792. }
  11793. if (e + eBias >= eMax) {
  11794. m = 0
  11795. e = eMax
  11796. } else if (e + eBias >= 1) {
  11797. m = ((value * c) - 1) * Math.pow(2, mLen)
  11798. e = e + eBias
  11799. } else {
  11800. m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen)
  11801. e = 0
  11802. }
  11803. }
  11804. for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}
  11805. e = (e << mLen) | m
  11806. eLen += mLen
  11807. for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}
  11808. buffer[offset + i - d] |= s * 128
  11809. }
  11810. },{}],56:[function(require,module,exports){
  11811. if (typeof Object.create === 'function') {
  11812. // implementation from standard node.js 'util' module
  11813. module.exports = function inherits(ctor, superCtor) {
  11814. ctor.super_ = superCtor
  11815. ctor.prototype = Object.create(superCtor.prototype, {
  11816. constructor: {
  11817. value: ctor,
  11818. enumerable: false,
  11819. writable: true,
  11820. configurable: true
  11821. }
  11822. });
  11823. };
  11824. } else {
  11825. // old school shim for old browsers
  11826. module.exports = function inherits(ctor, superCtor) {
  11827. ctor.super_ = superCtor
  11828. var TempCtor = function () {}
  11829. TempCtor.prototype = superCtor.prototype
  11830. ctor.prototype = new TempCtor()
  11831. ctor.prototype.constructor = ctor
  11832. }
  11833. }
  11834. },{}],57:[function(require,module,exports){
  11835. /*!
  11836. * Determine if an object is a Buffer
  11837. *
  11838. * @author Feross Aboukhadijeh <https://feross.org>
  11839. * @license MIT
  11840. */
  11841. // The _isBuffer check is for Safari 5-7 support, because it's missing
  11842. // Object.prototype.constructor. Remove this eventually
  11843. module.exports = function (obj) {
  11844. return obj != null && (isBuffer(obj) || isSlowBuffer(obj) || !!obj._isBuffer)
  11845. }
  11846. function isBuffer (obj) {
  11847. return !!obj.constructor && typeof obj.constructor.isBuffer === 'function' && obj.constructor.isBuffer(obj)
  11848. }
  11849. // For Node v0.10 support. Remove this eventually.
  11850. function isSlowBuffer (obj) {
  11851. return typeof obj.readFloatLE === 'function' && typeof obj.slice === 'function' && isBuffer(obj.slice(0, 0))
  11852. }
  11853. },{}],58:[function(require,module,exports){
  11854. var toString = {}.toString;
  11855. module.exports = Array.isArray || function (arr) {
  11856. return toString.call(arr) == '[object Array]';
  11857. };
  11858. },{}],59:[function(require,module,exports){
  11859. (function (process){
  11860. var path = require('path');
  11861. var fs = require('fs');
  11862. var _0777 = parseInt('0777', 8);
  11863. module.exports = mkdirP.mkdirp = mkdirP.mkdirP = mkdirP;
  11864. function mkdirP (p, opts, f, made) {
  11865. if (typeof opts === 'function') {
  11866. f = opts;
  11867. opts = {};
  11868. }
  11869. else if (!opts || typeof opts !== 'object') {
  11870. opts = { mode: opts };
  11871. }
  11872. var mode = opts.mode;
  11873. var xfs = opts.fs || fs;
  11874. if (mode === undefined) {
  11875. mode = _0777 & (~process.umask());
  11876. }
  11877. if (!made) made = null;
  11878. var cb = f || function () {};
  11879. p = path.resolve(p);
  11880. xfs.mkdir(p, mode, function (er) {
  11881. if (!er) {
  11882. made = made || p;
  11883. return cb(null, made);
  11884. }
  11885. switch (er.code) {
  11886. case 'ENOENT':
  11887. mkdirP(path.dirname(p), opts, function (er, made) {
  11888. if (er) cb(er, made);
  11889. else mkdirP(p, opts, cb, made);
  11890. });
  11891. break;
  11892. // In the case of any other error, just see if there's a dir
  11893. // there already. If so, then hooray! If not, then something
  11894. // is borked.
  11895. default:
  11896. xfs.stat(p, function (er2, stat) {
  11897. // if the stat fails, then that's super weird.
  11898. // let the original error be the failure reason.
  11899. if (er2 || !stat.isDirectory()) cb(er, made)
  11900. else cb(null, made);
  11901. });
  11902. break;
  11903. }
  11904. });
  11905. }
  11906. mkdirP.sync = function sync (p, opts, made) {
  11907. if (!opts || typeof opts !== 'object') {
  11908. opts = { mode: opts };
  11909. }
  11910. var mode = opts.mode;
  11911. var xfs = opts.fs || fs;
  11912. if (mode === undefined) {
  11913. mode = _0777 & (~process.umask());
  11914. }
  11915. if (!made) made = null;
  11916. p = path.resolve(p);
  11917. try {
  11918. xfs.mkdirSync(p, mode);
  11919. made = made || p;
  11920. }
  11921. catch (err0) {
  11922. switch (err0.code) {
  11923. case 'ENOENT' :
  11924. made = sync(path.dirname(p), opts, made);
  11925. sync(p, opts, made);
  11926. break;
  11927. // In the case of any other error, just see if there's a dir
  11928. // there already. If so, then hooray! If not, then something
  11929. // is borked.
  11930. default:
  11931. var stat;
  11932. try {
  11933. stat = xfs.statSync(p);
  11934. }
  11935. catch (err1) {
  11936. throw err0;
  11937. }
  11938. if (!stat.isDirectory()) throw err0;
  11939. break;
  11940. }
  11941. }
  11942. return made;
  11943. };
  11944. }).call(this,require('_process'))
  11945. },{"_process":68,"fs":42,"path":42}],60:[function(require,module,exports){
  11946. /**
  11947. * Helpers.
  11948. */
  11949. var s = 1000;
  11950. var m = s * 60;
  11951. var h = m * 60;
  11952. var d = h * 24;
  11953. var w = d * 7;
  11954. var y = d * 365.25;
  11955. /**
  11956. * Parse or format the given `val`.
  11957. *
  11958. * Options:
  11959. *
  11960. * - `long` verbose formatting [false]
  11961. *
  11962. * @param {String|Number} val
  11963. * @param {Object} [options]
  11964. * @throws {Error} throw an error if val is not a non-empty string or a number
  11965. * @return {String|Number}
  11966. * @api public
  11967. */
  11968. module.exports = function(val, options) {
  11969. options = options || {};
  11970. var type = typeof val;
  11971. if (type === 'string' && val.length > 0) {
  11972. return parse(val);
  11973. } else if (type === 'number' && isNaN(val) === false) {
  11974. return options.long ? fmtLong(val) : fmtShort(val);
  11975. }
  11976. throw new Error(
  11977. 'val is not a non-empty string or a valid number. val=' +
  11978. JSON.stringify(val)
  11979. );
  11980. };
  11981. /**
  11982. * Parse the given `str` and return milliseconds.
  11983. *
  11984. * @param {String} str
  11985. * @return {Number}
  11986. * @api private
  11987. */
  11988. function parse(str) {
  11989. str = String(str);
  11990. if (str.length > 100) {
  11991. return;
  11992. }
  11993. var match = /^((?:\d+)?\-?\d?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(
  11994. str
  11995. );
  11996. if (!match) {
  11997. return;
  11998. }
  11999. var n = parseFloat(match[1]);
  12000. var type = (match[2] || 'ms').toLowerCase();
  12001. switch (type) {
  12002. case 'years':
  12003. case 'year':
  12004. case 'yrs':
  12005. case 'yr':
  12006. case 'y':
  12007. return n * y;
  12008. case 'weeks':
  12009. case 'week':
  12010. case 'w':
  12011. return n * w;
  12012. case 'days':
  12013. case 'day':
  12014. case 'd':
  12015. return n * d;
  12016. case 'hours':
  12017. case 'hour':
  12018. case 'hrs':
  12019. case 'hr':
  12020. case 'h':
  12021. return n * h;
  12022. case 'minutes':
  12023. case 'minute':
  12024. case 'mins':
  12025. case 'min':
  12026. case 'm':
  12027. return n * m;
  12028. case 'seconds':
  12029. case 'second':
  12030. case 'secs':
  12031. case 'sec':
  12032. case 's':
  12033. return n * s;
  12034. case 'milliseconds':
  12035. case 'millisecond':
  12036. case 'msecs':
  12037. case 'msec':
  12038. case 'ms':
  12039. return n;
  12040. default:
  12041. return undefined;
  12042. }
  12043. }
  12044. /**
  12045. * Short format for `ms`.
  12046. *
  12047. * @param {Number} ms
  12048. * @return {String}
  12049. * @api private
  12050. */
  12051. function fmtShort(ms) {
  12052. var msAbs = Math.abs(ms);
  12053. if (msAbs >= d) {
  12054. return Math.round(ms / d) + 'd';
  12055. }
  12056. if (msAbs >= h) {
  12057. return Math.round(ms / h) + 'h';
  12058. }
  12059. if (msAbs >= m) {
  12060. return Math.round(ms / m) + 'm';
  12061. }
  12062. if (msAbs >= s) {
  12063. return Math.round(ms / s) + 's';
  12064. }
  12065. return ms + 'ms';
  12066. }
  12067. /**
  12068. * Long format for `ms`.
  12069. *
  12070. * @param {Number} ms
  12071. * @return {String}
  12072. * @api private
  12073. */
  12074. function fmtLong(ms) {
  12075. var msAbs = Math.abs(ms);
  12076. if (msAbs >= d) {
  12077. return plural(ms, msAbs, d, 'day');
  12078. }
  12079. if (msAbs >= h) {
  12080. return plural(ms, msAbs, h, 'hour');
  12081. }
  12082. if (msAbs >= m) {
  12083. return plural(ms, msAbs, m, 'minute');
  12084. }
  12085. if (msAbs >= s) {
  12086. return plural(ms, msAbs, s, 'second');
  12087. }
  12088. return ms + ' ms';
  12089. }
  12090. /**
  12091. * Pluralization helper.
  12092. */
  12093. function plural(ms, msAbs, n, name) {
  12094. var isPlural = msAbs >= n * 1.5;
  12095. return Math.round(ms / n) + ' ' + name + (isPlural ? 's' : '');
  12096. }
  12097. },{}],61:[function(require,module,exports){
  12098. 'use strict';
  12099. // modified from https://github.com/es-shims/es5-shim
  12100. var has = Object.prototype.hasOwnProperty;
  12101. var toStr = Object.prototype.toString;
  12102. var slice = Array.prototype.slice;
  12103. var isArgs = require('./isArguments');
  12104. var isEnumerable = Object.prototype.propertyIsEnumerable;
  12105. var hasDontEnumBug = !isEnumerable.call({ toString: null }, 'toString');
  12106. var hasProtoEnumBug = isEnumerable.call(function () {}, 'prototype');
  12107. var dontEnums = [
  12108. 'toString',
  12109. 'toLocaleString',
  12110. 'valueOf',
  12111. 'hasOwnProperty',
  12112. 'isPrototypeOf',
  12113. 'propertyIsEnumerable',
  12114. 'constructor'
  12115. ];
  12116. var equalsConstructorPrototype = function (o) {
  12117. var ctor = o.constructor;
  12118. return ctor && ctor.prototype === o;
  12119. };
  12120. var excludedKeys = {
  12121. $applicationCache: true,
  12122. $console: true,
  12123. $external: true,
  12124. $frame: true,
  12125. $frameElement: true,
  12126. $frames: true,
  12127. $innerHeight: true,
  12128. $innerWidth: true,
  12129. $outerHeight: true,
  12130. $outerWidth: true,
  12131. $pageXOffset: true,
  12132. $pageYOffset: true,
  12133. $parent: true,
  12134. $scrollLeft: true,
  12135. $scrollTop: true,
  12136. $scrollX: true,
  12137. $scrollY: true,
  12138. $self: true,
  12139. $webkitIndexedDB: true,
  12140. $webkitStorageInfo: true,
  12141. $window: true
  12142. };
  12143. var hasAutomationEqualityBug = (function () {
  12144. /* global window */
  12145. if (typeof window === 'undefined') { return false; }
  12146. for (var k in window) {
  12147. try {
  12148. if (!excludedKeys['$' + k] && has.call(window, k) && window[k] !== null && typeof window[k] === 'object') {
  12149. try {
  12150. equalsConstructorPrototype(window[k]);
  12151. } catch (e) {
  12152. return true;
  12153. }
  12154. }
  12155. } catch (e) {
  12156. return true;
  12157. }
  12158. }
  12159. return false;
  12160. }());
  12161. var equalsConstructorPrototypeIfNotBuggy = function (o) {
  12162. /* global window */
  12163. if (typeof window === 'undefined' || !hasAutomationEqualityBug) {
  12164. return equalsConstructorPrototype(o);
  12165. }
  12166. try {
  12167. return equalsConstructorPrototype(o);
  12168. } catch (e) {
  12169. return false;
  12170. }
  12171. };
  12172. var keysShim = function keys(object) {
  12173. var isObject = object !== null && typeof object === 'object';
  12174. var isFunction = toStr.call(object) === '[object Function]';
  12175. var isArguments = isArgs(object);
  12176. var isString = isObject && toStr.call(object) === '[object String]';
  12177. var theKeys = [];
  12178. if (!isObject && !isFunction && !isArguments) {
  12179. throw new TypeError('Object.keys called on a non-object');
  12180. }
  12181. var skipProto = hasProtoEnumBug && isFunction;
  12182. if (isString && object.length > 0 && !has.call(object, 0)) {
  12183. for (var i = 0; i < object.length; ++i) {
  12184. theKeys.push(String(i));
  12185. }
  12186. }
  12187. if (isArguments && object.length > 0) {
  12188. for (var j = 0; j < object.length; ++j) {
  12189. theKeys.push(String(j));
  12190. }
  12191. } else {
  12192. for (var name in object) {
  12193. if (!(skipProto && name === 'prototype') && has.call(object, name)) {
  12194. theKeys.push(String(name));
  12195. }
  12196. }
  12197. }
  12198. if (hasDontEnumBug) {
  12199. var skipConstructor = equalsConstructorPrototypeIfNotBuggy(object);
  12200. for (var k = 0; k < dontEnums.length; ++k) {
  12201. if (!(skipConstructor && dontEnums[k] === 'constructor') && has.call(object, dontEnums[k])) {
  12202. theKeys.push(dontEnums[k]);
  12203. }
  12204. }
  12205. }
  12206. return theKeys;
  12207. };
  12208. keysShim.shim = function shimObjectKeys() {
  12209. if (Object.keys) {
  12210. var keysWorksWithArguments = (function () {
  12211. // Safari 5.0 bug
  12212. return (Object.keys(arguments) || '').length === 2;
  12213. }(1, 2));
  12214. if (!keysWorksWithArguments) {
  12215. var originalKeys = Object.keys;
  12216. Object.keys = function keys(object) { // eslint-disable-line func-name-matching
  12217. if (isArgs(object)) {
  12218. return originalKeys(slice.call(object));
  12219. } else {
  12220. return originalKeys(object);
  12221. }
  12222. };
  12223. }
  12224. } else {
  12225. Object.keys = keysShim;
  12226. }
  12227. return Object.keys || keysShim;
  12228. };
  12229. module.exports = keysShim;
  12230. },{"./isArguments":62}],62:[function(require,module,exports){
  12231. 'use strict';
  12232. var toStr = Object.prototype.toString;
  12233. module.exports = function isArguments(value) {
  12234. var str = toStr.call(value);
  12235. var isArgs = str === '[object Arguments]';
  12236. if (!isArgs) {
  12237. isArgs = str !== '[object Array]' &&
  12238. value !== null &&
  12239. typeof value === 'object' &&
  12240. typeof value.length === 'number' &&
  12241. value.length >= 0 &&
  12242. toStr.call(value.callee) === '[object Function]';
  12243. }
  12244. return isArgs;
  12245. };
  12246. },{}],63:[function(require,module,exports){
  12247. 'use strict';
  12248. // modified from https://github.com/es-shims/es6-shim
  12249. var keys = require('object-keys');
  12250. var bind = require('function-bind');
  12251. var canBeObject = function (obj) {
  12252. return typeof obj !== 'undefined' && obj !== null;
  12253. };
  12254. var hasSymbols = require('has-symbols/shams')();
  12255. var toObject = Object;
  12256. var push = bind.call(Function.call, Array.prototype.push);
  12257. var propIsEnumerable = bind.call(Function.call, Object.prototype.propertyIsEnumerable);
  12258. var originalGetSymbols = hasSymbols ? Object.getOwnPropertySymbols : null;
  12259. module.exports = function assign(target, source1) {
  12260. if (!canBeObject(target)) { throw new TypeError('target must be an object'); }
  12261. var objTarget = toObject(target);
  12262. var s, source, i, props, syms, value, key;
  12263. for (s = 1; s < arguments.length; ++s) {
  12264. source = toObject(arguments[s]);
  12265. props = keys(source);
  12266. var getSymbols = hasSymbols && (Object.getOwnPropertySymbols || originalGetSymbols);
  12267. if (getSymbols) {
  12268. syms = getSymbols(source);
  12269. for (i = 0; i < syms.length; ++i) {
  12270. key = syms[i];
  12271. if (propIsEnumerable(source, key)) {
  12272. push(props, key);
  12273. }
  12274. }
  12275. }
  12276. for (i = 0; i < props.length; ++i) {
  12277. key = props[i];
  12278. value = source[key];
  12279. if (propIsEnumerable(source, key)) {
  12280. objTarget[key] = value;
  12281. }
  12282. }
  12283. }
  12284. return objTarget;
  12285. };
  12286. },{"function-bind":52,"has-symbols/shams":53,"object-keys":61}],64:[function(require,module,exports){
  12287. 'use strict';
  12288. var defineProperties = require('define-properties');
  12289. var implementation = require('./implementation');
  12290. var getPolyfill = require('./polyfill');
  12291. var shim = require('./shim');
  12292. var polyfill = getPolyfill();
  12293. defineProperties(polyfill, {
  12294. getPolyfill: getPolyfill,
  12295. implementation: implementation,
  12296. shim: shim
  12297. });
  12298. module.exports = polyfill;
  12299. },{"./implementation":63,"./polyfill":65,"./shim":66,"define-properties":47}],65:[function(require,module,exports){
  12300. 'use strict';
  12301. var implementation = require('./implementation');
  12302. var lacksProperEnumerationOrder = function () {
  12303. if (!Object.assign) {
  12304. return false;
  12305. }
  12306. // v8, specifically in node 4.x, has a bug with incorrect property enumeration order
  12307. // note: this does not detect the bug unless there's 20 characters
  12308. var str = 'abcdefghijklmnopqrst';
  12309. var letters = str.split('');
  12310. var map = {};
  12311. for (var i = 0; i < letters.length; ++i) {
  12312. map[letters[i]] = letters[i];
  12313. }
  12314. var obj = Object.assign({}, map);
  12315. var actual = '';
  12316. for (var k in obj) {
  12317. actual += k;
  12318. }
  12319. return str !== actual;
  12320. };
  12321. var assignHasPendingExceptions = function () {
  12322. if (!Object.assign || !Object.preventExtensions) {
  12323. return false;
  12324. }
  12325. // Firefox 37 still has "pending exception" logic in its Object.assign implementation,
  12326. // which is 72% slower than our shim, and Firefox 40's native implementation.
  12327. var thrower = Object.preventExtensions({ 1: 2 });
  12328. try {
  12329. Object.assign(thrower, 'xy');
  12330. } catch (e) {
  12331. return thrower[1] === 'y';
  12332. }
  12333. return false;
  12334. };
  12335. module.exports = function getPolyfill() {
  12336. if (!Object.assign) {
  12337. return implementation;
  12338. }
  12339. if (lacksProperEnumerationOrder()) {
  12340. return implementation;
  12341. }
  12342. if (assignHasPendingExceptions()) {
  12343. return implementation;
  12344. }
  12345. return Object.assign;
  12346. };
  12347. },{"./implementation":63}],66:[function(require,module,exports){
  12348. 'use strict';
  12349. var define = require('define-properties');
  12350. var getPolyfill = require('./polyfill');
  12351. module.exports = function shimAssign() {
  12352. var polyfill = getPolyfill();
  12353. define(
  12354. Object,
  12355. { assign: polyfill },
  12356. { assign: function () { return Object.assign !== polyfill; } }
  12357. );
  12358. return polyfill;
  12359. };
  12360. },{"./polyfill":65,"define-properties":47}],67:[function(require,module,exports){
  12361. (function (process){
  12362. 'use strict';
  12363. if (!process.version ||
  12364. process.version.indexOf('v0.') === 0 ||
  12365. process.version.indexOf('v1.') === 0 && process.version.indexOf('v1.8.') !== 0) {
  12366. module.exports = { nextTick: nextTick };
  12367. } else {
  12368. module.exports = process
  12369. }
  12370. function nextTick(fn, arg1, arg2, arg3) {
  12371. if (typeof fn !== 'function') {
  12372. throw new TypeError('"callback" argument must be a function');
  12373. }
  12374. var len = arguments.length;
  12375. var args, i;
  12376. switch (len) {
  12377. case 0:
  12378. case 1:
  12379. return process.nextTick(fn);
  12380. case 2:
  12381. return process.nextTick(function afterTickOne() {
  12382. fn.call(null, arg1);
  12383. });
  12384. case 3:
  12385. return process.nextTick(function afterTickTwo() {
  12386. fn.call(null, arg1, arg2);
  12387. });
  12388. case 4:
  12389. return process.nextTick(function afterTickThree() {
  12390. fn.call(null, arg1, arg2, arg3);
  12391. });
  12392. default:
  12393. args = new Array(len - 1);
  12394. i = 0;
  12395. while (i < args.length) {
  12396. args[i++] = arguments[i];
  12397. }
  12398. return process.nextTick(function afterTick() {
  12399. fn.apply(null, args);
  12400. });
  12401. }
  12402. }
  12403. }).call(this,require('_process'))
  12404. },{"_process":68}],68:[function(require,module,exports){
  12405. // shim for using process in browser
  12406. var process = module.exports = {};
  12407. // cached from whatever global is present so that test runners that stub it
  12408. // don't break things. But we need to wrap it in a try catch in case it is
  12409. // wrapped in strict mode code which doesn't define any globals. It's inside a
  12410. // function because try/catches deoptimize in certain engines.
  12411. var cachedSetTimeout;
  12412. var cachedClearTimeout;
  12413. function defaultSetTimout() {
  12414. throw new Error('setTimeout has not been defined');
  12415. }
  12416. function defaultClearTimeout () {
  12417. throw new Error('clearTimeout has not been defined');
  12418. }
  12419. (function () {
  12420. try {
  12421. if (typeof setTimeout === 'function') {
  12422. cachedSetTimeout = setTimeout;
  12423. } else {
  12424. cachedSetTimeout = defaultSetTimout;
  12425. }
  12426. } catch (e) {
  12427. cachedSetTimeout = defaultSetTimout;
  12428. }
  12429. try {
  12430. if (typeof clearTimeout === 'function') {
  12431. cachedClearTimeout = clearTimeout;
  12432. } else {
  12433. cachedClearTimeout = defaultClearTimeout;
  12434. }
  12435. } catch (e) {
  12436. cachedClearTimeout = defaultClearTimeout;
  12437. }
  12438. } ())
  12439. function runTimeout(fun) {
  12440. if (cachedSetTimeout === setTimeout) {
  12441. //normal enviroments in sane situations
  12442. return setTimeout(fun, 0);
  12443. }
  12444. // if setTimeout wasn't available but was latter defined
  12445. if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
  12446. cachedSetTimeout = setTimeout;
  12447. return setTimeout(fun, 0);
  12448. }
  12449. try {
  12450. // when when somebody has screwed with setTimeout but no I.E. maddness
  12451. return cachedSetTimeout(fun, 0);
  12452. } catch(e){
  12453. try {
  12454. // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
  12455. return cachedSetTimeout.call(null, fun, 0);
  12456. } catch(e){
  12457. // 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
  12458. return cachedSetTimeout.call(this, fun, 0);
  12459. }
  12460. }
  12461. }
  12462. function runClearTimeout(marker) {
  12463. if (cachedClearTimeout === clearTimeout) {
  12464. //normal enviroments in sane situations
  12465. return clearTimeout(marker);
  12466. }
  12467. // if clearTimeout wasn't available but was latter defined
  12468. if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
  12469. cachedClearTimeout = clearTimeout;
  12470. return clearTimeout(marker);
  12471. }
  12472. try {
  12473. // when when somebody has screwed with setTimeout but no I.E. maddness
  12474. return cachedClearTimeout(marker);
  12475. } catch (e){
  12476. try {
  12477. // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
  12478. return cachedClearTimeout.call(null, marker);
  12479. } catch (e){
  12480. // 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.
  12481. // Some versions of I.E. have different rules for clearTimeout vs setTimeout
  12482. return cachedClearTimeout.call(this, marker);
  12483. }
  12484. }
  12485. }
  12486. var queue = [];
  12487. var draining = false;
  12488. var currentQueue;
  12489. var queueIndex = -1;
  12490. function cleanUpNextTick() {
  12491. if (!draining || !currentQueue) {
  12492. return;
  12493. }
  12494. draining = false;
  12495. if (currentQueue.length) {
  12496. queue = currentQueue.concat(queue);
  12497. } else {
  12498. queueIndex = -1;
  12499. }
  12500. if (queue.length) {
  12501. drainQueue();
  12502. }
  12503. }
  12504. function drainQueue() {
  12505. if (draining) {
  12506. return;
  12507. }
  12508. var timeout = runTimeout(cleanUpNextTick);
  12509. draining = true;
  12510. var len = queue.length;
  12511. while(len) {
  12512. currentQueue = queue;
  12513. queue = [];
  12514. while (++queueIndex < len) {
  12515. if (currentQueue) {
  12516. currentQueue[queueIndex].run();
  12517. }
  12518. }
  12519. queueIndex = -1;
  12520. len = queue.length;
  12521. }
  12522. currentQueue = null;
  12523. draining = false;
  12524. runClearTimeout(timeout);
  12525. }
  12526. process.nextTick = function (fun) {
  12527. var args = new Array(arguments.length - 1);
  12528. if (arguments.length > 1) {
  12529. for (var i = 1; i < arguments.length; i++) {
  12530. args[i - 1] = arguments[i];
  12531. }
  12532. }
  12533. queue.push(new Item(fun, args));
  12534. if (queue.length === 1 && !draining) {
  12535. runTimeout(drainQueue);
  12536. }
  12537. };
  12538. // v8 likes predictible objects
  12539. function Item(fun, array) {
  12540. this.fun = fun;
  12541. this.array = array;
  12542. }
  12543. Item.prototype.run = function () {
  12544. this.fun.apply(null, this.array);
  12545. };
  12546. process.title = 'browser';
  12547. process.browser = true;
  12548. process.env = {};
  12549. process.argv = [];
  12550. process.version = ''; // empty string to avoid regexp issues
  12551. process.versions = {};
  12552. function noop() {}
  12553. process.on = noop;
  12554. process.addListener = noop;
  12555. process.once = noop;
  12556. process.off = noop;
  12557. process.removeListener = noop;
  12558. process.removeAllListeners = noop;
  12559. process.emit = noop;
  12560. process.prependListener = noop;
  12561. process.prependOnceListener = noop;
  12562. process.listeners = function (name) { return [] }
  12563. process.binding = function (name) {
  12564. throw new Error('process.binding is not supported');
  12565. };
  12566. process.cwd = function () { return '/' };
  12567. process.chdir = function (dir) {
  12568. throw new Error('process.chdir is not supported');
  12569. };
  12570. process.umask = function() { return 0; };
  12571. },{}],69:[function(require,module,exports){
  12572. module.exports = require('./lib/_stream_duplex.js');
  12573. },{"./lib/_stream_duplex.js":70}],70:[function(require,module,exports){
  12574. // Copyright Joyent, Inc. and other Node contributors.
  12575. //
  12576. // Permission is hereby granted, free of charge, to any person obtaining a
  12577. // copy of this software and associated documentation files (the
  12578. // "Software"), to deal in the Software without restriction, including
  12579. // without limitation the rights to use, copy, modify, merge, publish,
  12580. // distribute, sublicense, and/or sell copies of the Software, and to permit
  12581. // persons to whom the Software is furnished to do so, subject to the
  12582. // following conditions:
  12583. //
  12584. // The above copyright notice and this permission notice shall be included
  12585. // in all copies or substantial portions of the Software.
  12586. //
  12587. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  12588. // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  12589. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  12590. // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  12591. // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  12592. // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  12593. // USE OR OTHER DEALINGS IN THE SOFTWARE.
  12594. // a duplex stream is just a stream that is both readable and writable.
  12595. // Since JS doesn't have multiple prototypal inheritance, this class
  12596. // prototypally inherits from Readable, and then parasitically from
  12597. // Writable.
  12598. 'use strict';
  12599. /*<replacement>*/
  12600. var pna = require('process-nextick-args');
  12601. /*</replacement>*/
  12602. /*<replacement>*/
  12603. var objectKeys = Object.keys || function (obj) {
  12604. var keys = [];
  12605. for (var key in obj) {
  12606. keys.push(key);
  12607. }return keys;
  12608. };
  12609. /*</replacement>*/
  12610. module.exports = Duplex;
  12611. /*<replacement>*/
  12612. var util = require('core-util-is');
  12613. util.inherits = require('inherits');
  12614. /*</replacement>*/
  12615. var Readable = require('./_stream_readable');
  12616. var Writable = require('./_stream_writable');
  12617. util.inherits(Duplex, Readable);
  12618. {
  12619. // avoid scope creep, the keys array can then be collected
  12620. var keys = objectKeys(Writable.prototype);
  12621. for (var v = 0; v < keys.length; v++) {
  12622. var method = keys[v];
  12623. if (!Duplex.prototype[method]) Duplex.prototype[method] = Writable.prototype[method];
  12624. }
  12625. }
  12626. function Duplex(options) {
  12627. if (!(this instanceof Duplex)) return new Duplex(options);
  12628. Readable.call(this, options);
  12629. Writable.call(this, options);
  12630. if (options && options.readable === false) this.readable = false;
  12631. if (options && options.writable === false) this.writable = false;
  12632. this.allowHalfOpen = true;
  12633. if (options && options.allowHalfOpen === false) this.allowHalfOpen = false;
  12634. this.once('end', onend);
  12635. }
  12636. Object.defineProperty(Duplex.prototype, 'writableHighWaterMark', {
  12637. // making it explicit this property is not enumerable
  12638. // because otherwise some prototype manipulation in
  12639. // userland will fail
  12640. enumerable: false,
  12641. get: function () {
  12642. return this._writableState.highWaterMark;
  12643. }
  12644. });
  12645. // the no-half-open enforcer
  12646. function onend() {
  12647. // if we allow half-open state, or if the writable side ended,
  12648. // then we're ok.
  12649. if (this.allowHalfOpen || this._writableState.ended) return;
  12650. // no more data can be written.
  12651. // But allow more writes to happen in this tick.
  12652. pna.nextTick(onEndNT, this);
  12653. }
  12654. function onEndNT(self) {
  12655. self.end();
  12656. }
  12657. Object.defineProperty(Duplex.prototype, 'destroyed', {
  12658. get: function () {
  12659. if (this._readableState === undefined || this._writableState === undefined) {
  12660. return false;
  12661. }
  12662. return this._readableState.destroyed && this._writableState.destroyed;
  12663. },
  12664. set: function (value) {
  12665. // we ignore the value if the stream
  12666. // has not been initialized yet
  12667. if (this._readableState === undefined || this._writableState === undefined) {
  12668. return;
  12669. }
  12670. // backward compatibility, the user is explicitly
  12671. // managing destroyed
  12672. this._readableState.destroyed = value;
  12673. this._writableState.destroyed = value;
  12674. }
  12675. });
  12676. Duplex.prototype._destroy = function (err, cb) {
  12677. this.push(null);
  12678. this.end();
  12679. pna.nextTick(cb, err);
  12680. };
  12681. },{"./_stream_readable":72,"./_stream_writable":74,"core-util-is":44,"inherits":56,"process-nextick-args":67}],71:[function(require,module,exports){
  12682. // Copyright Joyent, Inc. and other Node contributors.
  12683. //
  12684. // Permission is hereby granted, free of charge, to any person obtaining a
  12685. // copy of this software and associated documentation files (the
  12686. // "Software"), to deal in the Software without restriction, including
  12687. // without limitation the rights to use, copy, modify, merge, publish,
  12688. // distribute, sublicense, and/or sell copies of the Software, and to permit
  12689. // persons to whom the Software is furnished to do so, subject to the
  12690. // following conditions:
  12691. //
  12692. // The above copyright notice and this permission notice shall be included
  12693. // in all copies or substantial portions of the Software.
  12694. //
  12695. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  12696. // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  12697. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  12698. // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  12699. // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  12700. // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  12701. // USE OR OTHER DEALINGS IN THE SOFTWARE.
  12702. // a passthrough stream.
  12703. // basically just the most minimal sort of Transform stream.
  12704. // Every written chunk gets output as-is.
  12705. 'use strict';
  12706. module.exports = PassThrough;
  12707. var Transform = require('./_stream_transform');
  12708. /*<replacement>*/
  12709. var util = require('core-util-is');
  12710. util.inherits = require('inherits');
  12711. /*</replacement>*/
  12712. util.inherits(PassThrough, Transform);
  12713. function PassThrough(options) {
  12714. if (!(this instanceof PassThrough)) return new PassThrough(options);
  12715. Transform.call(this, options);
  12716. }
  12717. PassThrough.prototype._transform = function (chunk, encoding, cb) {
  12718. cb(null, chunk);
  12719. };
  12720. },{"./_stream_transform":73,"core-util-is":44,"inherits":56}],72:[function(require,module,exports){
  12721. (function (process,global){
  12722. // Copyright Joyent, Inc. and other Node contributors.
  12723. //
  12724. // Permission is hereby granted, free of charge, to any person obtaining a
  12725. // copy of this software and associated documentation files (the
  12726. // "Software"), to deal in the Software without restriction, including
  12727. // without limitation the rights to use, copy, modify, merge, publish,
  12728. // distribute, sublicense, and/or sell copies of the Software, and to permit
  12729. // persons to whom the Software is furnished to do so, subject to the
  12730. // following conditions:
  12731. //
  12732. // The above copyright notice and this permission notice shall be included
  12733. // in all copies or substantial portions of the Software.
  12734. //
  12735. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  12736. // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  12737. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  12738. // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  12739. // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  12740. // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  12741. // USE OR OTHER DEALINGS IN THE SOFTWARE.
  12742. 'use strict';
  12743. /*<replacement>*/
  12744. var pna = require('process-nextick-args');
  12745. /*</replacement>*/
  12746. module.exports = Readable;
  12747. /*<replacement>*/
  12748. var isArray = require('isarray');
  12749. /*</replacement>*/
  12750. /*<replacement>*/
  12751. var Duplex;
  12752. /*</replacement>*/
  12753. Readable.ReadableState = ReadableState;
  12754. /*<replacement>*/
  12755. var EE = require('events').EventEmitter;
  12756. var EElistenerCount = function (emitter, type) {
  12757. return emitter.listeners(type).length;
  12758. };
  12759. /*</replacement>*/
  12760. /*<replacement>*/
  12761. var Stream = require('./internal/streams/stream');
  12762. /*</replacement>*/
  12763. /*<replacement>*/
  12764. var Buffer = require('safe-buffer').Buffer;
  12765. var OurUint8Array = global.Uint8Array || function () {};
  12766. function _uint8ArrayToBuffer(chunk) {
  12767. return Buffer.from(chunk);
  12768. }
  12769. function _isUint8Array(obj) {
  12770. return Buffer.isBuffer(obj) || obj instanceof OurUint8Array;
  12771. }
  12772. /*</replacement>*/
  12773. /*<replacement>*/
  12774. var util = require('core-util-is');
  12775. util.inherits = require('inherits');
  12776. /*</replacement>*/
  12777. /*<replacement>*/
  12778. var debugUtil = require('util');
  12779. var debug = void 0;
  12780. if (debugUtil && debugUtil.debuglog) {
  12781. debug = debugUtil.debuglog('stream');
  12782. } else {
  12783. debug = function () {};
  12784. }
  12785. /*</replacement>*/
  12786. var BufferList = require('./internal/streams/BufferList');
  12787. var destroyImpl = require('./internal/streams/destroy');
  12788. var StringDecoder;
  12789. util.inherits(Readable, Stream);
  12790. var kProxyEvents = ['error', 'close', 'destroy', 'pause', 'resume'];
  12791. function prependListener(emitter, event, fn) {
  12792. // Sadly this is not cacheable as some libraries bundle their own
  12793. // event emitter implementation with them.
  12794. if (typeof emitter.prependListener === 'function') return emitter.prependListener(event, fn);
  12795. // This is a hack to make sure that our error handler is attached before any
  12796. // userland ones. NEVER DO THIS. This is here only because this code needs
  12797. // to continue to work with older versions of Node.js that do not include
  12798. // the prependListener() method. The goal is to eventually remove this hack.
  12799. if (!emitter._events || !emitter._events[event]) emitter.on(event, fn);else if (isArray(emitter._events[event])) emitter._events[event].unshift(fn);else emitter._events[event] = [fn, emitter._events[event]];
  12800. }
  12801. function ReadableState(options, stream) {
  12802. Duplex = Duplex || require('./_stream_duplex');
  12803. options = options || {};
  12804. // Duplex streams are both readable and writable, but share
  12805. // the same options object.
  12806. // However, some cases require setting options to different
  12807. // values for the readable and the writable sides of the duplex stream.
  12808. // These options can be provided separately as readableXXX and writableXXX.
  12809. var isDuplex = stream instanceof Duplex;
  12810. // object stream flag. Used to make read(n) ignore n and to
  12811. // make all the buffer merging and length checks go away
  12812. this.objectMode = !!options.objectMode;
  12813. if (isDuplex) this.objectMode = this.objectMode || !!options.readableObjectMode;
  12814. // the point at which it stops calling _read() to fill the buffer
  12815. // Note: 0 is a valid value, means "don't call _read preemptively ever"
  12816. var hwm = options.highWaterMark;
  12817. var readableHwm = options.readableHighWaterMark;
  12818. var defaultHwm = this.objectMode ? 16 : 16 * 1024;
  12819. if (hwm || hwm === 0) this.highWaterMark = hwm;else if (isDuplex && (readableHwm || readableHwm === 0)) this.highWaterMark = readableHwm;else this.highWaterMark = defaultHwm;
  12820. // cast to ints.
  12821. this.highWaterMark = Math.floor(this.highWaterMark);
  12822. // A linked list is used to store data chunks instead of an array because the
  12823. // linked list can remove elements from the beginning faster than
  12824. // array.shift()
  12825. this.buffer = new BufferList();
  12826. this.length = 0;
  12827. this.pipes = null;
  12828. this.pipesCount = 0;
  12829. this.flowing = null;
  12830. this.ended = false;
  12831. this.endEmitted = false;
  12832. this.reading = false;
  12833. // a flag to be able to tell if the event 'readable'/'data' is emitted
  12834. // immediately, or on a later tick. We set this to true at first, because
  12835. // any actions that shouldn't happen until "later" should generally also
  12836. // not happen before the first read call.
  12837. this.sync = true;
  12838. // whenever we return null, then we set a flag to say
  12839. // that we're awaiting a 'readable' event emission.
  12840. this.needReadable = false;
  12841. this.emittedReadable = false;
  12842. this.readableListening = false;
  12843. this.resumeScheduled = false;
  12844. // has it been destroyed
  12845. this.destroyed = false;
  12846. // Crypto is kind of old and crusty. Historically, its default string
  12847. // encoding is 'binary' so we have to make this configurable.
  12848. // Everything else in the universe uses 'utf8', though.
  12849. this.defaultEncoding = options.defaultEncoding || 'utf8';
  12850. // the number of writers that are awaiting a drain event in .pipe()s
  12851. this.awaitDrain = 0;
  12852. // if true, a maybeReadMore has been scheduled
  12853. this.readingMore = false;
  12854. this.decoder = null;
  12855. this.encoding = null;
  12856. if (options.encoding) {
  12857. if (!StringDecoder) StringDecoder = require('string_decoder/').StringDecoder;
  12858. this.decoder = new StringDecoder(options.encoding);
  12859. this.encoding = options.encoding;
  12860. }
  12861. }
  12862. function Readable(options) {
  12863. Duplex = Duplex || require('./_stream_duplex');
  12864. if (!(this instanceof Readable)) return new Readable(options);
  12865. this._readableState = new ReadableState(options, this);
  12866. // legacy
  12867. this.readable = true;
  12868. if (options) {
  12869. if (typeof options.read === 'function') this._read = options.read;
  12870. if (typeof options.destroy === 'function') this._destroy = options.destroy;
  12871. }
  12872. Stream.call(this);
  12873. }
  12874. Object.defineProperty(Readable.prototype, 'destroyed', {
  12875. get: function () {
  12876. if (this._readableState === undefined) {
  12877. return false;
  12878. }
  12879. return this._readableState.destroyed;
  12880. },
  12881. set: function (value) {
  12882. // we ignore the value if the stream
  12883. // has not been initialized yet
  12884. if (!this._readableState) {
  12885. return;
  12886. }
  12887. // backward compatibility, the user is explicitly
  12888. // managing destroyed
  12889. this._readableState.destroyed = value;
  12890. }
  12891. });
  12892. Readable.prototype.destroy = destroyImpl.destroy;
  12893. Readable.prototype._undestroy = destroyImpl.undestroy;
  12894. Readable.prototype._destroy = function (err, cb) {
  12895. this.push(null);
  12896. cb(err);
  12897. };
  12898. // Manually shove something into the read() buffer.
  12899. // This returns true if the highWaterMark has not been hit yet,
  12900. // similar to how Writable.write() returns true if you should
  12901. // write() some more.
  12902. Readable.prototype.push = function (chunk, encoding) {
  12903. var state = this._readableState;
  12904. var skipChunkCheck;
  12905. if (!state.objectMode) {
  12906. if (typeof chunk === 'string') {
  12907. encoding = encoding || state.defaultEncoding;
  12908. if (encoding !== state.encoding) {
  12909. chunk = Buffer.from(chunk, encoding);
  12910. encoding = '';
  12911. }
  12912. skipChunkCheck = true;
  12913. }
  12914. } else {
  12915. skipChunkCheck = true;
  12916. }
  12917. return readableAddChunk(this, chunk, encoding, false, skipChunkCheck);
  12918. };
  12919. // Unshift should *always* be something directly out of read()
  12920. Readable.prototype.unshift = function (chunk) {
  12921. return readableAddChunk(this, chunk, null, true, false);
  12922. };
  12923. function readableAddChunk(stream, chunk, encoding, addToFront, skipChunkCheck) {
  12924. var state = stream._readableState;
  12925. if (chunk === null) {
  12926. state.reading = false;
  12927. onEofChunk(stream, state);
  12928. } else {
  12929. var er;
  12930. if (!skipChunkCheck) er = chunkInvalid(state, chunk);
  12931. if (er) {
  12932. stream.emit('error', er);
  12933. } else if (state.objectMode || chunk && chunk.length > 0) {
  12934. if (typeof chunk !== 'string' && !state.objectMode && Object.getPrototypeOf(chunk) !== Buffer.prototype) {
  12935. chunk = _uint8ArrayToBuffer(chunk);
  12936. }
  12937. if (addToFront) {
  12938. if (state.endEmitted) stream.emit('error', new Error('stream.unshift() after end event'));else addChunk(stream, state, chunk, true);
  12939. } else if (state.ended) {
  12940. stream.emit('error', new Error('stream.push() after EOF'));
  12941. } else {
  12942. state.reading = false;
  12943. if (state.decoder && !encoding) {
  12944. chunk = state.decoder.write(chunk);
  12945. if (state.objectMode || chunk.length !== 0) addChunk(stream, state, chunk, false);else maybeReadMore(stream, state);
  12946. } else {
  12947. addChunk(stream, state, chunk, false);
  12948. }
  12949. }
  12950. } else if (!addToFront) {
  12951. state.reading = false;
  12952. }
  12953. }
  12954. return needMoreData(state);
  12955. }
  12956. function addChunk(stream, state, chunk, addToFront) {
  12957. if (state.flowing && state.length === 0 && !state.sync) {
  12958. stream.emit('data', chunk);
  12959. stream.read(0);
  12960. } else {
  12961. // update the buffer info.
  12962. state.length += state.objectMode ? 1 : chunk.length;
  12963. if (addToFront) state.buffer.unshift(chunk);else state.buffer.push(chunk);
  12964. if (state.needReadable) emitReadable(stream);
  12965. }
  12966. maybeReadMore(stream, state);
  12967. }
  12968. function chunkInvalid(state, chunk) {
  12969. var er;
  12970. if (!_isUint8Array(chunk) && typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) {
  12971. er = new TypeError('Invalid non-string/buffer chunk');
  12972. }
  12973. return er;
  12974. }
  12975. // if it's past the high water mark, we can push in some more.
  12976. // Also, if we have no data yet, we can stand some
  12977. // more bytes. This is to work around cases where hwm=0,
  12978. // such as the repl. Also, if the push() triggered a
  12979. // readable event, and the user called read(largeNumber) such that
  12980. // needReadable was set, then we ought to push more, so that another
  12981. // 'readable' event will be triggered.
  12982. function needMoreData(state) {
  12983. return !state.ended && (state.needReadable || state.length < state.highWaterMark || state.length === 0);
  12984. }
  12985. Readable.prototype.isPaused = function () {
  12986. return this._readableState.flowing === false;
  12987. };
  12988. // backwards compatibility.
  12989. Readable.prototype.setEncoding = function (enc) {
  12990. if (!StringDecoder) StringDecoder = require('string_decoder/').StringDecoder;
  12991. this._readableState.decoder = new StringDecoder(enc);
  12992. this._readableState.encoding = enc;
  12993. return this;
  12994. };
  12995. // Don't raise the hwm > 8MB
  12996. var MAX_HWM = 0x800000;
  12997. function computeNewHighWaterMark(n) {
  12998. if (n >= MAX_HWM) {
  12999. n = MAX_HWM;
  13000. } else {
  13001. // Get the next highest power of 2 to prevent increasing hwm excessively in
  13002. // tiny amounts
  13003. n--;
  13004. n |= n >>> 1;
  13005. n |= n >>> 2;
  13006. n |= n >>> 4;
  13007. n |= n >>> 8;
  13008. n |= n >>> 16;
  13009. n++;
  13010. }
  13011. return n;
  13012. }
  13013. // This function is designed to be inlinable, so please take care when making
  13014. // changes to the function body.
  13015. function howMuchToRead(n, state) {
  13016. if (n <= 0 || state.length === 0 && state.ended) return 0;
  13017. if (state.objectMode) return 1;
  13018. if (n !== n) {
  13019. // Only flow one buffer at a time
  13020. if (state.flowing && state.length) return state.buffer.head.data.length;else return state.length;
  13021. }
  13022. // If we're asking for more than the current hwm, then raise the hwm.
  13023. if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n);
  13024. if (n <= state.length) return n;
  13025. // Don't have enough
  13026. if (!state.ended) {
  13027. state.needReadable = true;
  13028. return 0;
  13029. }
  13030. return state.length;
  13031. }
  13032. // you can override either this method, or the async _read(n) below.
  13033. Readable.prototype.read = function (n) {
  13034. debug('read', n);
  13035. n = parseInt(n, 10);
  13036. var state = this._readableState;
  13037. var nOrig = n;
  13038. if (n !== 0) state.emittedReadable = false;
  13039. // if we're doing read(0) to trigger a readable event, but we
  13040. // already have a bunch of data in the buffer, then just trigger
  13041. // the 'readable' event and move on.
  13042. if (n === 0 && state.needReadable && (state.length >= state.highWaterMark || state.ended)) {
  13043. debug('read: emitReadable', state.length, state.ended);
  13044. if (state.length === 0 && state.ended) endReadable(this);else emitReadable(this);
  13045. return null;
  13046. }
  13047. n = howMuchToRead(n, state);
  13048. // if we've ended, and we're now clear, then finish it up.
  13049. if (n === 0 && state.ended) {
  13050. if (state.length === 0) endReadable(this);
  13051. return null;
  13052. }
  13053. // All the actual chunk generation logic needs to be
  13054. // *below* the call to _read. The reason is that in certain
  13055. // synthetic stream cases, such as passthrough streams, _read
  13056. // may be a completely synchronous operation which may change
  13057. // the state of the read buffer, providing enough data when
  13058. // before there was *not* enough.
  13059. //
  13060. // So, the steps are:
  13061. // 1. Figure out what the state of things will be after we do
  13062. // a read from the buffer.
  13063. //
  13064. // 2. If that resulting state will trigger a _read, then call _read.
  13065. // Note that this may be asynchronous, or synchronous. Yes, it is
  13066. // deeply ugly to write APIs this way, but that still doesn't mean
  13067. // that the Readable class should behave improperly, as streams are
  13068. // designed to be sync/async agnostic.
  13069. // Take note if the _read call is sync or async (ie, if the read call
  13070. // has returned yet), so that we know whether or not it's safe to emit
  13071. // 'readable' etc.
  13072. //
  13073. // 3. Actually pull the requested chunks out of the buffer and return.
  13074. // if we need a readable event, then we need to do some reading.
  13075. var doRead = state.needReadable;
  13076. debug('need readable', doRead);
  13077. // if we currently have less than the highWaterMark, then also read some
  13078. if (state.length === 0 || state.length - n < state.highWaterMark) {
  13079. doRead = true;
  13080. debug('length less than watermark', doRead);
  13081. }
  13082. // however, if we've ended, then there's no point, and if we're already
  13083. // reading, then it's unnecessary.
  13084. if (state.ended || state.reading) {
  13085. doRead = false;
  13086. debug('reading or ended', doRead);
  13087. } else if (doRead) {
  13088. debug('do read');
  13089. state.reading = true;
  13090. state.sync = true;
  13091. // if the length is currently zero, then we *need* a readable event.
  13092. if (state.length === 0) state.needReadable = true;
  13093. // call internal read method
  13094. this._read(state.highWaterMark);
  13095. state.sync = false;
  13096. // If _read pushed data synchronously, then `reading` will be false,
  13097. // and we need to re-evaluate how much data we can return to the user.
  13098. if (!state.reading) n = howMuchToRead(nOrig, state);
  13099. }
  13100. var ret;
  13101. if (n > 0) ret = fromList(n, state);else ret = null;
  13102. if (ret === null) {
  13103. state.needReadable = true;
  13104. n = 0;
  13105. } else {
  13106. state.length -= n;
  13107. }
  13108. if (state.length === 0) {
  13109. // If we have nothing in the buffer, then we want to know
  13110. // as soon as we *do* get something into the buffer.
  13111. if (!state.ended) state.needReadable = true;
  13112. // If we tried to read() past the EOF, then emit end on the next tick.
  13113. if (nOrig !== n && state.ended) endReadable(this);
  13114. }
  13115. if (ret !== null) this.emit('data', ret);
  13116. return ret;
  13117. };
  13118. function onEofChunk(stream, state) {
  13119. if (state.ended) return;
  13120. if (state.decoder) {
  13121. var chunk = state.decoder.end();
  13122. if (chunk && chunk.length) {
  13123. state.buffer.push(chunk);
  13124. state.length += state.objectMode ? 1 : chunk.length;
  13125. }
  13126. }
  13127. state.ended = true;
  13128. // emit 'readable' now to make sure it gets picked up.
  13129. emitReadable(stream);
  13130. }
  13131. // Don't emit readable right away in sync mode, because this can trigger
  13132. // another read() call => stack overflow. This way, it might trigger
  13133. // a nextTick recursion warning, but that's not so bad.
  13134. function emitReadable(stream) {
  13135. var state = stream._readableState;
  13136. state.needReadable = false;
  13137. if (!state.emittedReadable) {
  13138. debug('emitReadable', state.flowing);
  13139. state.emittedReadable = true;
  13140. if (state.sync) pna.nextTick(emitReadable_, stream);else emitReadable_(stream);
  13141. }
  13142. }
  13143. function emitReadable_(stream) {
  13144. debug('emit readable');
  13145. stream.emit('readable');
  13146. flow(stream);
  13147. }
  13148. // at this point, the user has presumably seen the 'readable' event,
  13149. // and called read() to consume some data. that may have triggered
  13150. // in turn another _read(n) call, in which case reading = true if
  13151. // it's in progress.
  13152. // However, if we're not ended, or reading, and the length < hwm,
  13153. // then go ahead and try to read some more preemptively.
  13154. function maybeReadMore(stream, state) {
  13155. if (!state.readingMore) {
  13156. state.readingMore = true;
  13157. pna.nextTick(maybeReadMore_, stream, state);
  13158. }
  13159. }
  13160. function maybeReadMore_(stream, state) {
  13161. var len = state.length;
  13162. while (!state.reading && !state.flowing && !state.ended && state.length < state.highWaterMark) {
  13163. debug('maybeReadMore read 0');
  13164. stream.read(0);
  13165. if (len === state.length)
  13166. // didn't get any data, stop spinning.
  13167. break;else len = state.length;
  13168. }
  13169. state.readingMore = false;
  13170. }
  13171. // abstract method. to be overridden in specific implementation classes.
  13172. // call cb(er, data) where data is <= n in length.
  13173. // for virtual (non-string, non-buffer) streams, "length" is somewhat
  13174. // arbitrary, and perhaps not very meaningful.
  13175. Readable.prototype._read = function (n) {
  13176. this.emit('error', new Error('_read() is not implemented'));
  13177. };
  13178. Readable.prototype.pipe = function (dest, pipeOpts) {
  13179. var src = this;
  13180. var state = this._readableState;
  13181. switch (state.pipesCount) {
  13182. case 0:
  13183. state.pipes = dest;
  13184. break;
  13185. case 1:
  13186. state.pipes = [state.pipes, dest];
  13187. break;
  13188. default:
  13189. state.pipes.push(dest);
  13190. break;
  13191. }
  13192. state.pipesCount += 1;
  13193. debug('pipe count=%d opts=%j', state.pipesCount, pipeOpts);
  13194. var doEnd = (!pipeOpts || pipeOpts.end !== false) && dest !== process.stdout && dest !== process.stderr;
  13195. var endFn = doEnd ? onend : unpipe;
  13196. if (state.endEmitted) pna.nextTick(endFn);else src.once('end', endFn);
  13197. dest.on('unpipe', onunpipe);
  13198. function onunpipe(readable, unpipeInfo) {
  13199. debug('onunpipe');
  13200. if (readable === src) {
  13201. if (unpipeInfo && unpipeInfo.hasUnpiped === false) {
  13202. unpipeInfo.hasUnpiped = true;
  13203. cleanup();
  13204. }
  13205. }
  13206. }
  13207. function onend() {
  13208. debug('onend');
  13209. dest.end();
  13210. }
  13211. // when the dest drains, it reduces the awaitDrain counter
  13212. // on the source. This would be more elegant with a .once()
  13213. // handler in flow(), but adding and removing repeatedly is
  13214. // too slow.
  13215. var ondrain = pipeOnDrain(src);
  13216. dest.on('drain', ondrain);
  13217. var cleanedUp = false;
  13218. function cleanup() {
  13219. debug('cleanup');
  13220. // cleanup event handlers once the pipe is broken
  13221. dest.removeListener('close', onclose);
  13222. dest.removeListener('finish', onfinish);
  13223. dest.removeListener('drain', ondrain);
  13224. dest.removeListener('error', onerror);
  13225. dest.removeListener('unpipe', onunpipe);
  13226. src.removeListener('end', onend);
  13227. src.removeListener('end', unpipe);
  13228. src.removeListener('data', ondata);
  13229. cleanedUp = true;
  13230. // if the reader is waiting for a drain event from this
  13231. // specific writer, then it would cause it to never start
  13232. // flowing again.
  13233. // So, if this is awaiting a drain, then we just call it now.
  13234. // If we don't know, then assume that we are waiting for one.
  13235. if (state.awaitDrain && (!dest._writableState || dest._writableState.needDrain)) ondrain();
  13236. }
  13237. // If the user pushes more data while we're writing to dest then we'll end up
  13238. // in ondata again. However, we only want to increase awaitDrain once because
  13239. // dest will only emit one 'drain' event for the multiple writes.
  13240. // => Introduce a guard on increasing awaitDrain.
  13241. var increasedAwaitDrain = false;
  13242. src.on('data', ondata);
  13243. function ondata(chunk) {
  13244. debug('ondata');
  13245. increasedAwaitDrain = false;
  13246. var ret = dest.write(chunk);
  13247. if (false === ret && !increasedAwaitDrain) {
  13248. // If the user unpiped during `dest.write()`, it is possible
  13249. // to get stuck in a permanently paused state if that write
  13250. // also returned false.
  13251. // => Check whether `dest` is still a piping destination.
  13252. if ((state.pipesCount === 1 && state.pipes === dest || state.pipesCount > 1 && indexOf(state.pipes, dest) !== -1) && !cleanedUp) {
  13253. debug('false write response, pause', src._readableState.awaitDrain);
  13254. src._readableState.awaitDrain++;
  13255. increasedAwaitDrain = true;
  13256. }
  13257. src.pause();
  13258. }
  13259. }
  13260. // if the dest has an error, then stop piping into it.
  13261. // however, don't suppress the throwing behavior for this.
  13262. function onerror(er) {
  13263. debug('onerror', er);
  13264. unpipe();
  13265. dest.removeListener('error', onerror);
  13266. if (EElistenerCount(dest, 'error') === 0) dest.emit('error', er);
  13267. }
  13268. // Make sure our error handler is attached before userland ones.
  13269. prependListener(dest, 'error', onerror);
  13270. // Both close and finish should trigger unpipe, but only once.
  13271. function onclose() {
  13272. dest.removeListener('finish', onfinish);
  13273. unpipe();
  13274. }
  13275. dest.once('close', onclose);
  13276. function onfinish() {
  13277. debug('onfinish');
  13278. dest.removeListener('close', onclose);
  13279. unpipe();
  13280. }
  13281. dest.once('finish', onfinish);
  13282. function unpipe() {
  13283. debug('unpipe');
  13284. src.unpipe(dest);
  13285. }
  13286. // tell the dest that it's being piped to
  13287. dest.emit('pipe', src);
  13288. // start the flow if it hasn't been started already.
  13289. if (!state.flowing) {
  13290. debug('pipe resume');
  13291. src.resume();
  13292. }
  13293. return dest;
  13294. };
  13295. function pipeOnDrain(src) {
  13296. return function () {
  13297. var state = src._readableState;
  13298. debug('pipeOnDrain', state.awaitDrain);
  13299. if (state.awaitDrain) state.awaitDrain--;
  13300. if (state.awaitDrain === 0 && EElistenerCount(src, 'data')) {
  13301. state.flowing = true;
  13302. flow(src);
  13303. }
  13304. };
  13305. }
  13306. Readable.prototype.unpipe = function (dest) {
  13307. var state = this._readableState;
  13308. var unpipeInfo = { hasUnpiped: false };
  13309. // if we're not piping anywhere, then do nothing.
  13310. if (state.pipesCount === 0) return this;
  13311. // just one destination. most common case.
  13312. if (state.pipesCount === 1) {
  13313. // passed in one, but it's not the right one.
  13314. if (dest && dest !== state.pipes) return this;
  13315. if (!dest) dest = state.pipes;
  13316. // got a match.
  13317. state.pipes = null;
  13318. state.pipesCount = 0;
  13319. state.flowing = false;
  13320. if (dest) dest.emit('unpipe', this, unpipeInfo);
  13321. return this;
  13322. }
  13323. // slow case. multiple pipe destinations.
  13324. if (!dest) {
  13325. // remove all.
  13326. var dests = state.pipes;
  13327. var len = state.pipesCount;
  13328. state.pipes = null;
  13329. state.pipesCount = 0;
  13330. state.flowing = false;
  13331. for (var i = 0; i < len; i++) {
  13332. dests[i].emit('unpipe', this, unpipeInfo);
  13333. }return this;
  13334. }
  13335. // try to find the right one.
  13336. var index = indexOf(state.pipes, dest);
  13337. if (index === -1) return this;
  13338. state.pipes.splice(index, 1);
  13339. state.pipesCount -= 1;
  13340. if (state.pipesCount === 1) state.pipes = state.pipes[0];
  13341. dest.emit('unpipe', this, unpipeInfo);
  13342. return this;
  13343. };
  13344. // set up data events if they are asked for
  13345. // Ensure readable listeners eventually get something
  13346. Readable.prototype.on = function (ev, fn) {
  13347. var res = Stream.prototype.on.call(this, ev, fn);
  13348. if (ev === 'data') {
  13349. // Start flowing on next tick if stream isn't explicitly paused
  13350. if (this._readableState.flowing !== false) this.resume();
  13351. } else if (ev === 'readable') {
  13352. var state = this._readableState;
  13353. if (!state.endEmitted && !state.readableListening) {
  13354. state.readableListening = state.needReadable = true;
  13355. state.emittedReadable = false;
  13356. if (!state.reading) {
  13357. pna.nextTick(nReadingNextTick, this);
  13358. } else if (state.length) {
  13359. emitReadable(this);
  13360. }
  13361. }
  13362. }
  13363. return res;
  13364. };
  13365. Readable.prototype.addListener = Readable.prototype.on;
  13366. function nReadingNextTick(self) {
  13367. debug('readable nexttick read 0');
  13368. self.read(0);
  13369. }
  13370. // pause() and resume() are remnants of the legacy readable stream API
  13371. // If the user uses them, then switch into old mode.
  13372. Readable.prototype.resume = function () {
  13373. var state = this._readableState;
  13374. if (!state.flowing) {
  13375. debug('resume');
  13376. state.flowing = true;
  13377. resume(this, state);
  13378. }
  13379. return this;
  13380. };
  13381. function resume(stream, state) {
  13382. if (!state.resumeScheduled) {
  13383. state.resumeScheduled = true;
  13384. pna.nextTick(resume_, stream, state);
  13385. }
  13386. }
  13387. function resume_(stream, state) {
  13388. if (!state.reading) {
  13389. debug('resume read 0');
  13390. stream.read(0);
  13391. }
  13392. state.resumeScheduled = false;
  13393. state.awaitDrain = 0;
  13394. stream.emit('resume');
  13395. flow(stream);
  13396. if (state.flowing && !state.reading) stream.read(0);
  13397. }
  13398. Readable.prototype.pause = function () {
  13399. debug('call pause flowing=%j', this._readableState.flowing);
  13400. if (false !== this._readableState.flowing) {
  13401. debug('pause');
  13402. this._readableState.flowing = false;
  13403. this.emit('pause');
  13404. }
  13405. return this;
  13406. };
  13407. function flow(stream) {
  13408. var state = stream._readableState;
  13409. debug('flow', state.flowing);
  13410. while (state.flowing && stream.read() !== null) {}
  13411. }
  13412. // wrap an old-style stream as the async data source.
  13413. // This is *not* part of the readable stream interface.
  13414. // It is an ugly unfortunate mess of history.
  13415. Readable.prototype.wrap = function (stream) {
  13416. var _this = this;
  13417. var state = this._readableState;
  13418. var paused = false;
  13419. stream.on('end', function () {
  13420. debug('wrapped end');
  13421. if (state.decoder && !state.ended) {
  13422. var chunk = state.decoder.end();
  13423. if (chunk && chunk.length) _this.push(chunk);
  13424. }
  13425. _this.push(null);
  13426. });
  13427. stream.on('data', function (chunk) {
  13428. debug('wrapped data');
  13429. if (state.decoder) chunk = state.decoder.write(chunk);
  13430. // don't skip over falsy values in objectMode
  13431. if (state.objectMode && (chunk === null || chunk === undefined)) return;else if (!state.objectMode && (!chunk || !chunk.length)) return;
  13432. var ret = _this.push(chunk);
  13433. if (!ret) {
  13434. paused = true;
  13435. stream.pause();
  13436. }
  13437. });
  13438. // proxy all the other methods.
  13439. // important when wrapping filters and duplexes.
  13440. for (var i in stream) {
  13441. if (this[i] === undefined && typeof stream[i] === 'function') {
  13442. this[i] = function (method) {
  13443. return function () {
  13444. return stream[method].apply(stream, arguments);
  13445. };
  13446. }(i);
  13447. }
  13448. }
  13449. // proxy certain important events.
  13450. for (var n = 0; n < kProxyEvents.length; n++) {
  13451. stream.on(kProxyEvents[n], this.emit.bind(this, kProxyEvents[n]));
  13452. }
  13453. // when we try to consume some more bytes, simply unpause the
  13454. // underlying stream.
  13455. this._read = function (n) {
  13456. debug('wrapped _read', n);
  13457. if (paused) {
  13458. paused = false;
  13459. stream.resume();
  13460. }
  13461. };
  13462. return this;
  13463. };
  13464. Object.defineProperty(Readable.prototype, 'readableHighWaterMark', {
  13465. // making it explicit this property is not enumerable
  13466. // because otherwise some prototype manipulation in
  13467. // userland will fail
  13468. enumerable: false,
  13469. get: function () {
  13470. return this._readableState.highWaterMark;
  13471. }
  13472. });
  13473. // exposed for testing purposes only.
  13474. Readable._fromList = fromList;
  13475. // Pluck off n bytes from an array of buffers.
  13476. // Length is the combined lengths of all the buffers in the list.
  13477. // This function is designed to be inlinable, so please take care when making
  13478. // changes to the function body.
  13479. function fromList(n, state) {
  13480. // nothing buffered
  13481. if (state.length === 0) return null;
  13482. var ret;
  13483. if (state.objectMode) ret = state.buffer.shift();else if (!n || n >= state.length) {
  13484. // read it all, truncate the list
  13485. if (state.decoder) ret = state.buffer.join('');else if (state.buffer.length === 1) ret = state.buffer.head.data;else ret = state.buffer.concat(state.length);
  13486. state.buffer.clear();
  13487. } else {
  13488. // read part of list
  13489. ret = fromListPartial(n, state.buffer, state.decoder);
  13490. }
  13491. return ret;
  13492. }
  13493. // Extracts only enough buffered data to satisfy the amount requested.
  13494. // This function is designed to be inlinable, so please take care when making
  13495. // changes to the function body.
  13496. function fromListPartial(n, list, hasStrings) {
  13497. var ret;
  13498. if (n < list.head.data.length) {
  13499. // slice is the same for buffers and strings
  13500. ret = list.head.data.slice(0, n);
  13501. list.head.data = list.head.data.slice(n);
  13502. } else if (n === list.head.data.length) {
  13503. // first chunk is a perfect match
  13504. ret = list.shift();
  13505. } else {
  13506. // result spans more than one buffer
  13507. ret = hasStrings ? copyFromBufferString(n, list) : copyFromBuffer(n, list);
  13508. }
  13509. return ret;
  13510. }
  13511. // Copies a specified amount of characters from the list of buffered data
  13512. // chunks.
  13513. // This function is designed to be inlinable, so please take care when making
  13514. // changes to the function body.
  13515. function copyFromBufferString(n, list) {
  13516. var p = list.head;
  13517. var c = 1;
  13518. var ret = p.data;
  13519. n -= ret.length;
  13520. while (p = p.next) {
  13521. var str = p.data;
  13522. var nb = n > str.length ? str.length : n;
  13523. if (nb === str.length) ret += str;else ret += str.slice(0, n);
  13524. n -= nb;
  13525. if (n === 0) {
  13526. if (nb === str.length) {
  13527. ++c;
  13528. if (p.next) list.head = p.next;else list.head = list.tail = null;
  13529. } else {
  13530. list.head = p;
  13531. p.data = str.slice(nb);
  13532. }
  13533. break;
  13534. }
  13535. ++c;
  13536. }
  13537. list.length -= c;
  13538. return ret;
  13539. }
  13540. // Copies a specified amount of bytes from the list of buffered data chunks.
  13541. // This function is designed to be inlinable, so please take care when making
  13542. // changes to the function body.
  13543. function copyFromBuffer(n, list) {
  13544. var ret = Buffer.allocUnsafe(n);
  13545. var p = list.head;
  13546. var c = 1;
  13547. p.data.copy(ret);
  13548. n -= p.data.length;
  13549. while (p = p.next) {
  13550. var buf = p.data;
  13551. var nb = n > buf.length ? buf.length : n;
  13552. buf.copy(ret, ret.length - n, 0, nb);
  13553. n -= nb;
  13554. if (n === 0) {
  13555. if (nb === buf.length) {
  13556. ++c;
  13557. if (p.next) list.head = p.next;else list.head = list.tail = null;
  13558. } else {
  13559. list.head = p;
  13560. p.data = buf.slice(nb);
  13561. }
  13562. break;
  13563. }
  13564. ++c;
  13565. }
  13566. list.length -= c;
  13567. return ret;
  13568. }
  13569. function endReadable(stream) {
  13570. var state = stream._readableState;
  13571. // If we get here before consuming all the bytes, then that is a
  13572. // bug in node. Should never happen.
  13573. if (state.length > 0) throw new Error('"endReadable()" called on non-empty stream');
  13574. if (!state.endEmitted) {
  13575. state.ended = true;
  13576. pna.nextTick(endReadableNT, state, stream);
  13577. }
  13578. }
  13579. function endReadableNT(state, stream) {
  13580. // Check that we didn't get one last unshift.
  13581. if (!state.endEmitted && state.length === 0) {
  13582. state.endEmitted = true;
  13583. stream.readable = false;
  13584. stream.emit('end');
  13585. }
  13586. }
  13587. function indexOf(xs, x) {
  13588. for (var i = 0, l = xs.length; i < l; i++) {
  13589. if (xs[i] === x) return i;
  13590. }
  13591. return -1;
  13592. }
  13593. }).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
  13594. },{"./_stream_duplex":70,"./internal/streams/BufferList":75,"./internal/streams/destroy":76,"./internal/streams/stream":77,"_process":68,"core-util-is":44,"events":50,"inherits":56,"isarray":58,"process-nextick-args":67,"safe-buffer":82,"string_decoder/":84,"util":40}],73:[function(require,module,exports){
  13595. // Copyright Joyent, Inc. and other Node contributors.
  13596. //
  13597. // Permission is hereby granted, free of charge, to any person obtaining a
  13598. // copy of this software and associated documentation files (the
  13599. // "Software"), to deal in the Software without restriction, including
  13600. // without limitation the rights to use, copy, modify, merge, publish,
  13601. // distribute, sublicense, and/or sell copies of the Software, and to permit
  13602. // persons to whom the Software is furnished to do so, subject to the
  13603. // following conditions:
  13604. //
  13605. // The above copyright notice and this permission notice shall be included
  13606. // in all copies or substantial portions of the Software.
  13607. //
  13608. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  13609. // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  13610. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  13611. // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  13612. // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  13613. // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  13614. // USE OR OTHER DEALINGS IN THE SOFTWARE.
  13615. // a transform stream is a readable/writable stream where you do
  13616. // something with the data. Sometimes it's called a "filter",
  13617. // but that's not a great name for it, since that implies a thing where
  13618. // some bits pass through, and others are simply ignored. (That would
  13619. // be a valid example of a transform, of course.)
  13620. //
  13621. // While the output is causally related to the input, it's not a
  13622. // necessarily symmetric or synchronous transformation. For example,
  13623. // a zlib stream might take multiple plain-text writes(), and then
  13624. // emit a single compressed chunk some time in the future.
  13625. //
  13626. // Here's how this works:
  13627. //
  13628. // The Transform stream has all the aspects of the readable and writable
  13629. // stream classes. When you write(chunk), that calls _write(chunk,cb)
  13630. // internally, and returns false if there's a lot of pending writes
  13631. // buffered up. When you call read(), that calls _read(n) until
  13632. // there's enough pending readable data buffered up.
  13633. //
  13634. // In a transform stream, the written data is placed in a buffer. When
  13635. // _read(n) is called, it transforms the queued up data, calling the
  13636. // buffered _write cb's as it consumes chunks. If consuming a single
  13637. // written chunk would result in multiple output chunks, then the first
  13638. // outputted bit calls the readcb, and subsequent chunks just go into
  13639. // the read buffer, and will cause it to emit 'readable' if necessary.
  13640. //
  13641. // This way, back-pressure is actually determined by the reading side,
  13642. // since _read has to be called to start processing a new chunk. However,
  13643. // a pathological inflate type of transform can cause excessive buffering
  13644. // here. For example, imagine a stream where every byte of input is
  13645. // interpreted as an integer from 0-255, and then results in that many
  13646. // bytes of output. Writing the 4 bytes {ff,ff,ff,ff} would result in
  13647. // 1kb of data being output. In this case, you could write a very small
  13648. // amount of input, and end up with a very large amount of output. In
  13649. // such a pathological inflating mechanism, there'd be no way to tell
  13650. // the system to stop doing the transform. A single 4MB write could
  13651. // cause the system to run out of memory.
  13652. //
  13653. // However, even in such a pathological case, only a single written chunk
  13654. // would be consumed, and then the rest would wait (un-transformed) until
  13655. // the results of the previous transformed chunk were consumed.
  13656. 'use strict';
  13657. module.exports = Transform;
  13658. var Duplex = require('./_stream_duplex');
  13659. /*<replacement>*/
  13660. var util = require('core-util-is');
  13661. util.inherits = require('inherits');
  13662. /*</replacement>*/
  13663. util.inherits(Transform, Duplex);
  13664. function afterTransform(er, data) {
  13665. var ts = this._transformState;
  13666. ts.transforming = false;
  13667. var cb = ts.writecb;
  13668. if (!cb) {
  13669. return this.emit('error', new Error('write callback called multiple times'));
  13670. }
  13671. ts.writechunk = null;
  13672. ts.writecb = null;
  13673. if (data != null) // single equals check for both `null` and `undefined`
  13674. this.push(data);
  13675. cb(er);
  13676. var rs = this._readableState;
  13677. rs.reading = false;
  13678. if (rs.needReadable || rs.length < rs.highWaterMark) {
  13679. this._read(rs.highWaterMark);
  13680. }
  13681. }
  13682. function Transform(options) {
  13683. if (!(this instanceof Transform)) return new Transform(options);
  13684. Duplex.call(this, options);
  13685. this._transformState = {
  13686. afterTransform: afterTransform.bind(this),
  13687. needTransform: false,
  13688. transforming: false,
  13689. writecb: null,
  13690. writechunk: null,
  13691. writeencoding: null
  13692. };
  13693. // start out asking for a readable event once data is transformed.
  13694. this._readableState.needReadable = true;
  13695. // we have implemented the _read method, and done the other things
  13696. // that Readable wants before the first _read call, so unset the
  13697. // sync guard flag.
  13698. this._readableState.sync = false;
  13699. if (options) {
  13700. if (typeof options.transform === 'function') this._transform = options.transform;
  13701. if (typeof options.flush === 'function') this._flush = options.flush;
  13702. }
  13703. // When the writable side finishes, then flush out anything remaining.
  13704. this.on('prefinish', prefinish);
  13705. }
  13706. function prefinish() {
  13707. var _this = this;
  13708. if (typeof this._flush === 'function') {
  13709. this._flush(function (er, data) {
  13710. done(_this, er, data);
  13711. });
  13712. } else {
  13713. done(this, null, null);
  13714. }
  13715. }
  13716. Transform.prototype.push = function (chunk, encoding) {
  13717. this._transformState.needTransform = false;
  13718. return Duplex.prototype.push.call(this, chunk, encoding);
  13719. };
  13720. // This is the part where you do stuff!
  13721. // override this function in implementation classes.
  13722. // 'chunk' is an input chunk.
  13723. //
  13724. // Call `push(newChunk)` to pass along transformed output
  13725. // to the readable side. You may call 'push' zero or more times.
  13726. //
  13727. // Call `cb(err)` when you are done with this chunk. If you pass
  13728. // an error, then that'll put the hurt on the whole operation. If you
  13729. // never call cb(), then you'll never get another chunk.
  13730. Transform.prototype._transform = function (chunk, encoding, cb) {
  13731. throw new Error('_transform() is not implemented');
  13732. };
  13733. Transform.prototype._write = function (chunk, encoding, cb) {
  13734. var ts = this._transformState;
  13735. ts.writecb = cb;
  13736. ts.writechunk = chunk;
  13737. ts.writeencoding = encoding;
  13738. if (!ts.transforming) {
  13739. var rs = this._readableState;
  13740. if (ts.needTransform || rs.needReadable || rs.length < rs.highWaterMark) this._read(rs.highWaterMark);
  13741. }
  13742. };
  13743. // Doesn't matter what the args are here.
  13744. // _transform does all the work.
  13745. // That we got here means that the readable side wants more data.
  13746. Transform.prototype._read = function (n) {
  13747. var ts = this._transformState;
  13748. if (ts.writechunk !== null && ts.writecb && !ts.transforming) {
  13749. ts.transforming = true;
  13750. this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform);
  13751. } else {
  13752. // mark that we need a transform, so that any data that comes in
  13753. // will get processed, now that we've asked for it.
  13754. ts.needTransform = true;
  13755. }
  13756. };
  13757. Transform.prototype._destroy = function (err, cb) {
  13758. var _this2 = this;
  13759. Duplex.prototype._destroy.call(this, err, function (err2) {
  13760. cb(err2);
  13761. _this2.emit('close');
  13762. });
  13763. };
  13764. function done(stream, er, data) {
  13765. if (er) return stream.emit('error', er);
  13766. if (data != null) // single equals check for both `null` and `undefined`
  13767. stream.push(data);
  13768. // if there's nothing in the write buffer, then that means
  13769. // that nothing more will ever be provided
  13770. if (stream._writableState.length) throw new Error('Calling transform done when ws.length != 0');
  13771. if (stream._transformState.transforming) throw new Error('Calling transform done when still transforming');
  13772. return stream.push(null);
  13773. }
  13774. },{"./_stream_duplex":70,"core-util-is":44,"inherits":56}],74:[function(require,module,exports){
  13775. (function (process,global){
  13776. // Copyright Joyent, Inc. and other Node contributors.
  13777. //
  13778. // Permission is hereby granted, free of charge, to any person obtaining a
  13779. // copy of this software and associated documentation files (the
  13780. // "Software"), to deal in the Software without restriction, including
  13781. // without limitation the rights to use, copy, modify, merge, publish,
  13782. // distribute, sublicense, and/or sell copies of the Software, and to permit
  13783. // persons to whom the Software is furnished to do so, subject to the
  13784. // following conditions:
  13785. //
  13786. // The above copyright notice and this permission notice shall be included
  13787. // in all copies or substantial portions of the Software.
  13788. //
  13789. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  13790. // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  13791. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  13792. // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  13793. // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  13794. // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  13795. // USE OR OTHER DEALINGS IN THE SOFTWARE.
  13796. // A bit simpler than readable streams.
  13797. // Implement an async ._write(chunk, encoding, cb), and it'll handle all
  13798. // the drain event emission and buffering.
  13799. 'use strict';
  13800. /*<replacement>*/
  13801. var pna = require('process-nextick-args');
  13802. /*</replacement>*/
  13803. module.exports = Writable;
  13804. /* <replacement> */
  13805. function WriteReq(chunk, encoding, cb) {
  13806. this.chunk = chunk;
  13807. this.encoding = encoding;
  13808. this.callback = cb;
  13809. this.next = null;
  13810. }
  13811. // It seems a linked list but it is not
  13812. // there will be only 2 of these for each stream
  13813. function CorkedRequest(state) {
  13814. var _this = this;
  13815. this.next = null;
  13816. this.entry = null;
  13817. this.finish = function () {
  13818. onCorkedFinish(_this, state);
  13819. };
  13820. }
  13821. /* </replacement> */
  13822. /*<replacement>*/
  13823. var asyncWrite = !process.browser && ['v0.10', 'v0.9.'].indexOf(process.version.slice(0, 5)) > -1 ? setImmediate : pna.nextTick;
  13824. /*</replacement>*/
  13825. /*<replacement>*/
  13826. var Duplex;
  13827. /*</replacement>*/
  13828. Writable.WritableState = WritableState;
  13829. /*<replacement>*/
  13830. var util = require('core-util-is');
  13831. util.inherits = require('inherits');
  13832. /*</replacement>*/
  13833. /*<replacement>*/
  13834. var internalUtil = {
  13835. deprecate: require('util-deprecate')
  13836. };
  13837. /*</replacement>*/
  13838. /*<replacement>*/
  13839. var Stream = require('./internal/streams/stream');
  13840. /*</replacement>*/
  13841. /*<replacement>*/
  13842. var Buffer = require('safe-buffer').Buffer;
  13843. var OurUint8Array = global.Uint8Array || function () {};
  13844. function _uint8ArrayToBuffer(chunk) {
  13845. return Buffer.from(chunk);
  13846. }
  13847. function _isUint8Array(obj) {
  13848. return Buffer.isBuffer(obj) || obj instanceof OurUint8Array;
  13849. }
  13850. /*</replacement>*/
  13851. var destroyImpl = require('./internal/streams/destroy');
  13852. util.inherits(Writable, Stream);
  13853. function nop() {}
  13854. function WritableState(options, stream) {
  13855. Duplex = Duplex || require('./_stream_duplex');
  13856. options = options || {};
  13857. // Duplex streams are both readable and writable, but share
  13858. // the same options object.
  13859. // However, some cases require setting options to different
  13860. // values for the readable and the writable sides of the duplex stream.
  13861. // These options can be provided separately as readableXXX and writableXXX.
  13862. var isDuplex = stream instanceof Duplex;
  13863. // object stream flag to indicate whether or not this stream
  13864. // contains buffers or objects.
  13865. this.objectMode = !!options.objectMode;
  13866. if (isDuplex) this.objectMode = this.objectMode || !!options.writableObjectMode;
  13867. // the point at which write() starts returning false
  13868. // Note: 0 is a valid value, means that we always return false if
  13869. // the entire buffer is not flushed immediately on write()
  13870. var hwm = options.highWaterMark;
  13871. var writableHwm = options.writableHighWaterMark;
  13872. var defaultHwm = this.objectMode ? 16 : 16 * 1024;
  13873. if (hwm || hwm === 0) this.highWaterMark = hwm;else if (isDuplex && (writableHwm || writableHwm === 0)) this.highWaterMark = writableHwm;else this.highWaterMark = defaultHwm;
  13874. // cast to ints.
  13875. this.highWaterMark = Math.floor(this.highWaterMark);
  13876. // if _final has been called
  13877. this.finalCalled = false;
  13878. // drain event flag.
  13879. this.needDrain = false;
  13880. // at the start of calling end()
  13881. this.ending = false;
  13882. // when end() has been called, and returned
  13883. this.ended = false;
  13884. // when 'finish' is emitted
  13885. this.finished = false;
  13886. // has it been destroyed
  13887. this.destroyed = false;
  13888. // should we decode strings into buffers before passing to _write?
  13889. // this is here so that some node-core streams can optimize string
  13890. // handling at a lower level.
  13891. var noDecode = options.decodeStrings === false;
  13892. this.decodeStrings = !noDecode;
  13893. // Crypto is kind of old and crusty. Historically, its default string
  13894. // encoding is 'binary' so we have to make this configurable.
  13895. // Everything else in the universe uses 'utf8', though.
  13896. this.defaultEncoding = options.defaultEncoding || 'utf8';
  13897. // not an actual buffer we keep track of, but a measurement
  13898. // of how much we're waiting to get pushed to some underlying
  13899. // socket or file.
  13900. this.length = 0;
  13901. // a flag to see when we're in the middle of a write.
  13902. this.writing = false;
  13903. // when true all writes will be buffered until .uncork() call
  13904. this.corked = 0;
  13905. // a flag to be able to tell if the onwrite cb is called immediately,
  13906. // or on a later tick. We set this to true at first, because any
  13907. // actions that shouldn't happen until "later" should generally also
  13908. // not happen before the first write call.
  13909. this.sync = true;
  13910. // a flag to know if we're processing previously buffered items, which
  13911. // may call the _write() callback in the same tick, so that we don't
  13912. // end up in an overlapped onwrite situation.
  13913. this.bufferProcessing = false;
  13914. // the callback that's passed to _write(chunk,cb)
  13915. this.onwrite = function (er) {
  13916. onwrite(stream, er);
  13917. };
  13918. // the callback that the user supplies to write(chunk,encoding,cb)
  13919. this.writecb = null;
  13920. // the amount that is being written when _write is called.
  13921. this.writelen = 0;
  13922. this.bufferedRequest = null;
  13923. this.lastBufferedRequest = null;
  13924. // number of pending user-supplied write callbacks
  13925. // this must be 0 before 'finish' can be emitted
  13926. this.pendingcb = 0;
  13927. // emit prefinish if the only thing we're waiting for is _write cbs
  13928. // This is relevant for synchronous Transform streams
  13929. this.prefinished = false;
  13930. // True if the error was already emitted and should not be thrown again
  13931. this.errorEmitted = false;
  13932. // count buffered requests
  13933. this.bufferedRequestCount = 0;
  13934. // allocate the first CorkedRequest, there is always
  13935. // one allocated and free to use, and we maintain at most two
  13936. this.corkedRequestsFree = new CorkedRequest(this);
  13937. }
  13938. WritableState.prototype.getBuffer = function getBuffer() {
  13939. var current = this.bufferedRequest;
  13940. var out = [];
  13941. while (current) {
  13942. out.push(current);
  13943. current = current.next;
  13944. }
  13945. return out;
  13946. };
  13947. (function () {
  13948. try {
  13949. Object.defineProperty(WritableState.prototype, 'buffer', {
  13950. get: internalUtil.deprecate(function () {
  13951. return this.getBuffer();
  13952. }, '_writableState.buffer is deprecated. Use _writableState.getBuffer ' + 'instead.', 'DEP0003')
  13953. });
  13954. } catch (_) {}
  13955. })();
  13956. // Test _writableState for inheritance to account for Duplex streams,
  13957. // whose prototype chain only points to Readable.
  13958. var realHasInstance;
  13959. if (typeof Symbol === 'function' && Symbol.hasInstance && typeof Function.prototype[Symbol.hasInstance] === 'function') {
  13960. realHasInstance = Function.prototype[Symbol.hasInstance];
  13961. Object.defineProperty(Writable, Symbol.hasInstance, {
  13962. value: function (object) {
  13963. if (realHasInstance.call(this, object)) return true;
  13964. if (this !== Writable) return false;
  13965. return object && object._writableState instanceof WritableState;
  13966. }
  13967. });
  13968. } else {
  13969. realHasInstance = function (object) {
  13970. return object instanceof this;
  13971. };
  13972. }
  13973. function Writable(options) {
  13974. Duplex = Duplex || require('./_stream_duplex');
  13975. // Writable ctor is applied to Duplexes, too.
  13976. // `realHasInstance` is necessary because using plain `instanceof`
  13977. // would return false, as no `_writableState` property is attached.
  13978. // Trying to use the custom `instanceof` for Writable here will also break the
  13979. // Node.js LazyTransform implementation, which has a non-trivial getter for
  13980. // `_writableState` that would lead to infinite recursion.
  13981. if (!realHasInstance.call(Writable, this) && !(this instanceof Duplex)) {
  13982. return new Writable(options);
  13983. }
  13984. this._writableState = new WritableState(options, this);
  13985. // legacy.
  13986. this.writable = true;
  13987. if (options) {
  13988. if (typeof options.write === 'function') this._write = options.write;
  13989. if (typeof options.writev === 'function') this._writev = options.writev;
  13990. if (typeof options.destroy === 'function') this._destroy = options.destroy;
  13991. if (typeof options.final === 'function') this._final = options.final;
  13992. }
  13993. Stream.call(this);
  13994. }
  13995. // Otherwise people can pipe Writable streams, which is just wrong.
  13996. Writable.prototype.pipe = function () {
  13997. this.emit('error', new Error('Cannot pipe, not readable'));
  13998. };
  13999. function writeAfterEnd(stream, cb) {
  14000. var er = new Error('write after end');
  14001. // TODO: defer error events consistently everywhere, not just the cb
  14002. stream.emit('error', er);
  14003. pna.nextTick(cb, er);
  14004. }
  14005. // Checks that a user-supplied chunk is valid, especially for the particular
  14006. // mode the stream is in. Currently this means that `null` is never accepted
  14007. // and undefined/non-string values are only allowed in object mode.
  14008. function validChunk(stream, state, chunk, cb) {
  14009. var valid = true;
  14010. var er = false;
  14011. if (chunk === null) {
  14012. er = new TypeError('May not write null values to stream');
  14013. } else if (typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) {
  14014. er = new TypeError('Invalid non-string/buffer chunk');
  14015. }
  14016. if (er) {
  14017. stream.emit('error', er);
  14018. pna.nextTick(cb, er);
  14019. valid = false;
  14020. }
  14021. return valid;
  14022. }
  14023. Writable.prototype.write = function (chunk, encoding, cb) {
  14024. var state = this._writableState;
  14025. var ret = false;
  14026. var isBuf = !state.objectMode && _isUint8Array(chunk);
  14027. if (isBuf && !Buffer.isBuffer(chunk)) {
  14028. chunk = _uint8ArrayToBuffer(chunk);
  14029. }
  14030. if (typeof encoding === 'function') {
  14031. cb = encoding;
  14032. encoding = null;
  14033. }
  14034. if (isBuf) encoding = 'buffer';else if (!encoding) encoding = state.defaultEncoding;
  14035. if (typeof cb !== 'function') cb = nop;
  14036. if (state.ended) writeAfterEnd(this, cb);else if (isBuf || validChunk(this, state, chunk, cb)) {
  14037. state.pendingcb++;
  14038. ret = writeOrBuffer(this, state, isBuf, chunk, encoding, cb);
  14039. }
  14040. return ret;
  14041. };
  14042. Writable.prototype.cork = function () {
  14043. var state = this._writableState;
  14044. state.corked++;
  14045. };
  14046. Writable.prototype.uncork = function () {
  14047. var state = this._writableState;
  14048. if (state.corked) {
  14049. state.corked--;
  14050. if (!state.writing && !state.corked && !state.finished && !state.bufferProcessing && state.bufferedRequest) clearBuffer(this, state);
  14051. }
  14052. };
  14053. Writable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) {
  14054. // node::ParseEncoding() requires lower case.
  14055. if (typeof encoding === 'string') encoding = encoding.toLowerCase();
  14056. if (!(['hex', 'utf8', 'utf-8', 'ascii', 'binary', 'base64', 'ucs2', 'ucs-2', 'utf16le', 'utf-16le', 'raw'].indexOf((encoding + '').toLowerCase()) > -1)) throw new TypeError('Unknown encoding: ' + encoding);
  14057. this._writableState.defaultEncoding = encoding;
  14058. return this;
  14059. };
  14060. function decodeChunk(state, chunk, encoding) {
  14061. if (!state.objectMode && state.decodeStrings !== false && typeof chunk === 'string') {
  14062. chunk = Buffer.from(chunk, encoding);
  14063. }
  14064. return chunk;
  14065. }
  14066. Object.defineProperty(Writable.prototype, 'writableHighWaterMark', {
  14067. // making it explicit this property is not enumerable
  14068. // because otherwise some prototype manipulation in
  14069. // userland will fail
  14070. enumerable: false,
  14071. get: function () {
  14072. return this._writableState.highWaterMark;
  14073. }
  14074. });
  14075. // if we're already writing something, then just put this
  14076. // in the queue, and wait our turn. Otherwise, call _write
  14077. // If we return false, then we need a drain event, so set that flag.
  14078. function writeOrBuffer(stream, state, isBuf, chunk, encoding, cb) {
  14079. if (!isBuf) {
  14080. var newChunk = decodeChunk(state, chunk, encoding);
  14081. if (chunk !== newChunk) {
  14082. isBuf = true;
  14083. encoding = 'buffer';
  14084. chunk = newChunk;
  14085. }
  14086. }
  14087. var len = state.objectMode ? 1 : chunk.length;
  14088. state.length += len;
  14089. var ret = state.length < state.highWaterMark;
  14090. // we must ensure that previous needDrain will not be reset to false.
  14091. if (!ret) state.needDrain = true;
  14092. if (state.writing || state.corked) {
  14093. var last = state.lastBufferedRequest;
  14094. state.lastBufferedRequest = {
  14095. chunk: chunk,
  14096. encoding: encoding,
  14097. isBuf: isBuf,
  14098. callback: cb,
  14099. next: null
  14100. };
  14101. if (last) {
  14102. last.next = state.lastBufferedRequest;
  14103. } else {
  14104. state.bufferedRequest = state.lastBufferedRequest;
  14105. }
  14106. state.bufferedRequestCount += 1;
  14107. } else {
  14108. doWrite(stream, state, false, len, chunk, encoding, cb);
  14109. }
  14110. return ret;
  14111. }
  14112. function doWrite(stream, state, writev, len, chunk, encoding, cb) {
  14113. state.writelen = len;
  14114. state.writecb = cb;
  14115. state.writing = true;
  14116. state.sync = true;
  14117. if (writev) stream._writev(chunk, state.onwrite);else stream._write(chunk, encoding, state.onwrite);
  14118. state.sync = false;
  14119. }
  14120. function onwriteError(stream, state, sync, er, cb) {
  14121. --state.pendingcb;
  14122. if (sync) {
  14123. // defer the callback if we are being called synchronously
  14124. // to avoid piling up things on the stack
  14125. pna.nextTick(cb, er);
  14126. // this can emit finish, and it will always happen
  14127. // after error
  14128. pna.nextTick(finishMaybe, stream, state);
  14129. stream._writableState.errorEmitted = true;
  14130. stream.emit('error', er);
  14131. } else {
  14132. // the caller expect this to happen before if
  14133. // it is async
  14134. cb(er);
  14135. stream._writableState.errorEmitted = true;
  14136. stream.emit('error', er);
  14137. // this can emit finish, but finish must
  14138. // always follow error
  14139. finishMaybe(stream, state);
  14140. }
  14141. }
  14142. function onwriteStateUpdate(state) {
  14143. state.writing = false;
  14144. state.writecb = null;
  14145. state.length -= state.writelen;
  14146. state.writelen = 0;
  14147. }
  14148. function onwrite(stream, er) {
  14149. var state = stream._writableState;
  14150. var sync = state.sync;
  14151. var cb = state.writecb;
  14152. onwriteStateUpdate(state);
  14153. if (er) onwriteError(stream, state, sync, er, cb);else {
  14154. // Check if we're actually ready to finish, but don't emit yet
  14155. var finished = needFinish(state);
  14156. if (!finished && !state.corked && !state.bufferProcessing && state.bufferedRequest) {
  14157. clearBuffer(stream, state);
  14158. }
  14159. if (sync) {
  14160. /*<replacement>*/
  14161. asyncWrite(afterWrite, stream, state, finished, cb);
  14162. /*</replacement>*/
  14163. } else {
  14164. afterWrite(stream, state, finished, cb);
  14165. }
  14166. }
  14167. }
  14168. function afterWrite(stream, state, finished, cb) {
  14169. if (!finished) onwriteDrain(stream, state);
  14170. state.pendingcb--;
  14171. cb();
  14172. finishMaybe(stream, state);
  14173. }
  14174. // Must force callback to be called on nextTick, so that we don't
  14175. // emit 'drain' before the write() consumer gets the 'false' return
  14176. // value, and has a chance to attach a 'drain' listener.
  14177. function onwriteDrain(stream, state) {
  14178. if (state.length === 0 && state.needDrain) {
  14179. state.needDrain = false;
  14180. stream.emit('drain');
  14181. }
  14182. }
  14183. // if there's something in the buffer waiting, then process it
  14184. function clearBuffer(stream, state) {
  14185. state.bufferProcessing = true;
  14186. var entry = state.bufferedRequest;
  14187. if (stream._writev && entry && entry.next) {
  14188. // Fast case, write everything using _writev()
  14189. var l = state.bufferedRequestCount;
  14190. var buffer = new Array(l);
  14191. var holder = state.corkedRequestsFree;
  14192. holder.entry = entry;
  14193. var count = 0;
  14194. var allBuffers = true;
  14195. while (entry) {
  14196. buffer[count] = entry;
  14197. if (!entry.isBuf) allBuffers = false;
  14198. entry = entry.next;
  14199. count += 1;
  14200. }
  14201. buffer.allBuffers = allBuffers;
  14202. doWrite(stream, state, true, state.length, buffer, '', holder.finish);
  14203. // doWrite is almost always async, defer these to save a bit of time
  14204. // as the hot path ends with doWrite
  14205. state.pendingcb++;
  14206. state.lastBufferedRequest = null;
  14207. if (holder.next) {
  14208. state.corkedRequestsFree = holder.next;
  14209. holder.next = null;
  14210. } else {
  14211. state.corkedRequestsFree = new CorkedRequest(state);
  14212. }
  14213. state.bufferedRequestCount = 0;
  14214. } else {
  14215. // Slow case, write chunks one-by-one
  14216. while (entry) {
  14217. var chunk = entry.chunk;
  14218. var encoding = entry.encoding;
  14219. var cb = entry.callback;
  14220. var len = state.objectMode ? 1 : chunk.length;
  14221. doWrite(stream, state, false, len, chunk, encoding, cb);
  14222. entry = entry.next;
  14223. state.bufferedRequestCount--;
  14224. // if we didn't call the onwrite immediately, then
  14225. // it means that we need to wait until it does.
  14226. // also, that means that the chunk and cb are currently
  14227. // being processed, so move the buffer counter past them.
  14228. if (state.writing) {
  14229. break;
  14230. }
  14231. }
  14232. if (entry === null) state.lastBufferedRequest = null;
  14233. }
  14234. state.bufferedRequest = entry;
  14235. state.bufferProcessing = false;
  14236. }
  14237. Writable.prototype._write = function (chunk, encoding, cb) {
  14238. cb(new Error('_write() is not implemented'));
  14239. };
  14240. Writable.prototype._writev = null;
  14241. Writable.prototype.end = function (chunk, encoding, cb) {
  14242. var state = this._writableState;
  14243. if (typeof chunk === 'function') {
  14244. cb = chunk;
  14245. chunk = null;
  14246. encoding = null;
  14247. } else if (typeof encoding === 'function') {
  14248. cb = encoding;
  14249. encoding = null;
  14250. }
  14251. if (chunk !== null && chunk !== undefined) this.write(chunk, encoding);
  14252. // .end() fully uncorks
  14253. if (state.corked) {
  14254. state.corked = 1;
  14255. this.uncork();
  14256. }
  14257. // ignore unnecessary end() calls.
  14258. if (!state.ending && !state.finished) endWritable(this, state, cb);
  14259. };
  14260. function needFinish(state) {
  14261. return state.ending && state.length === 0 && state.bufferedRequest === null && !state.finished && !state.writing;
  14262. }
  14263. function callFinal(stream, state) {
  14264. stream._final(function (err) {
  14265. state.pendingcb--;
  14266. if (err) {
  14267. stream.emit('error', err);
  14268. }
  14269. state.prefinished = true;
  14270. stream.emit('prefinish');
  14271. finishMaybe(stream, state);
  14272. });
  14273. }
  14274. function prefinish(stream, state) {
  14275. if (!state.prefinished && !state.finalCalled) {
  14276. if (typeof stream._final === 'function') {
  14277. state.pendingcb++;
  14278. state.finalCalled = true;
  14279. pna.nextTick(callFinal, stream, state);
  14280. } else {
  14281. state.prefinished = true;
  14282. stream.emit('prefinish');
  14283. }
  14284. }
  14285. }
  14286. function finishMaybe(stream, state) {
  14287. var need = needFinish(state);
  14288. if (need) {
  14289. prefinish(stream, state);
  14290. if (state.pendingcb === 0) {
  14291. state.finished = true;
  14292. stream.emit('finish');
  14293. }
  14294. }
  14295. return need;
  14296. }
  14297. function endWritable(stream, state, cb) {
  14298. state.ending = true;
  14299. finishMaybe(stream, state);
  14300. if (cb) {
  14301. if (state.finished) pna.nextTick(cb);else stream.once('finish', cb);
  14302. }
  14303. state.ended = true;
  14304. stream.writable = false;
  14305. }
  14306. function onCorkedFinish(corkReq, state, err) {
  14307. var entry = corkReq.entry;
  14308. corkReq.entry = null;
  14309. while (entry) {
  14310. var cb = entry.callback;
  14311. state.pendingcb--;
  14312. cb(err);
  14313. entry = entry.next;
  14314. }
  14315. if (state.corkedRequestsFree) {
  14316. state.corkedRequestsFree.next = corkReq;
  14317. } else {
  14318. state.corkedRequestsFree = corkReq;
  14319. }
  14320. }
  14321. Object.defineProperty(Writable.prototype, 'destroyed', {
  14322. get: function () {
  14323. if (this._writableState === undefined) {
  14324. return false;
  14325. }
  14326. return this._writableState.destroyed;
  14327. },
  14328. set: function (value) {
  14329. // we ignore the value if the stream
  14330. // has not been initialized yet
  14331. if (!this._writableState) {
  14332. return;
  14333. }
  14334. // backward compatibility, the user is explicitly
  14335. // managing destroyed
  14336. this._writableState.destroyed = value;
  14337. }
  14338. });
  14339. Writable.prototype.destroy = destroyImpl.destroy;
  14340. Writable.prototype._undestroy = destroyImpl.undestroy;
  14341. Writable.prototype._destroy = function (err, cb) {
  14342. this.end();
  14343. cb(err);
  14344. };
  14345. }).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
  14346. },{"./_stream_duplex":70,"./internal/streams/destroy":76,"./internal/streams/stream":77,"_process":68,"core-util-is":44,"inherits":56,"process-nextick-args":67,"safe-buffer":82,"util-deprecate":85}],75:[function(require,module,exports){
  14347. 'use strict';
  14348. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  14349. var Buffer = require('safe-buffer').Buffer;
  14350. var util = require('util');
  14351. function copyBuffer(src, target, offset) {
  14352. src.copy(target, offset);
  14353. }
  14354. module.exports = function () {
  14355. function BufferList() {
  14356. _classCallCheck(this, BufferList);
  14357. this.head = null;
  14358. this.tail = null;
  14359. this.length = 0;
  14360. }
  14361. BufferList.prototype.push = function push(v) {
  14362. var entry = { data: v, next: null };
  14363. if (this.length > 0) this.tail.next = entry;else this.head = entry;
  14364. this.tail = entry;
  14365. ++this.length;
  14366. };
  14367. BufferList.prototype.unshift = function unshift(v) {
  14368. var entry = { data: v, next: this.head };
  14369. if (this.length === 0) this.tail = entry;
  14370. this.head = entry;
  14371. ++this.length;
  14372. };
  14373. BufferList.prototype.shift = function shift() {
  14374. if (this.length === 0) return;
  14375. var ret = this.head.data;
  14376. if (this.length === 1) this.head = this.tail = null;else this.head = this.head.next;
  14377. --this.length;
  14378. return ret;
  14379. };
  14380. BufferList.prototype.clear = function clear() {
  14381. this.head = this.tail = null;
  14382. this.length = 0;
  14383. };
  14384. BufferList.prototype.join = function join(s) {
  14385. if (this.length === 0) return '';
  14386. var p = this.head;
  14387. var ret = '' + p.data;
  14388. while (p = p.next) {
  14389. ret += s + p.data;
  14390. }return ret;
  14391. };
  14392. BufferList.prototype.concat = function concat(n) {
  14393. if (this.length === 0) return Buffer.alloc(0);
  14394. if (this.length === 1) return this.head.data;
  14395. var ret = Buffer.allocUnsafe(n >>> 0);
  14396. var p = this.head;
  14397. var i = 0;
  14398. while (p) {
  14399. copyBuffer(p.data, ret, i);
  14400. i += p.data.length;
  14401. p = p.next;
  14402. }
  14403. return ret;
  14404. };
  14405. return BufferList;
  14406. }();
  14407. if (util && util.inspect && util.inspect.custom) {
  14408. module.exports.prototype[util.inspect.custom] = function () {
  14409. var obj = util.inspect({ length: this.length });
  14410. return this.constructor.name + ' ' + obj;
  14411. };
  14412. }
  14413. },{"safe-buffer":82,"util":40}],76:[function(require,module,exports){
  14414. 'use strict';
  14415. /*<replacement>*/
  14416. var pna = require('process-nextick-args');
  14417. /*</replacement>*/
  14418. // undocumented cb() API, needed for core, not for public API
  14419. function destroy(err, cb) {
  14420. var _this = this;
  14421. var readableDestroyed = this._readableState && this._readableState.destroyed;
  14422. var writableDestroyed = this._writableState && this._writableState.destroyed;
  14423. if (readableDestroyed || writableDestroyed) {
  14424. if (cb) {
  14425. cb(err);
  14426. } else if (err && (!this._writableState || !this._writableState.errorEmitted)) {
  14427. pna.nextTick(emitErrorNT, this, err);
  14428. }
  14429. return this;
  14430. }
  14431. // we set destroyed to true before firing error callbacks in order
  14432. // to make it re-entrance safe in case destroy() is called within callbacks
  14433. if (this._readableState) {
  14434. this._readableState.destroyed = true;
  14435. }
  14436. // if this is a duplex stream mark the writable part as destroyed as well
  14437. if (this._writableState) {
  14438. this._writableState.destroyed = true;
  14439. }
  14440. this._destroy(err || null, function (err) {
  14441. if (!cb && err) {
  14442. pna.nextTick(emitErrorNT, _this, err);
  14443. if (_this._writableState) {
  14444. _this._writableState.errorEmitted = true;
  14445. }
  14446. } else if (cb) {
  14447. cb(err);
  14448. }
  14449. });
  14450. return this;
  14451. }
  14452. function undestroy() {
  14453. if (this._readableState) {
  14454. this._readableState.destroyed = false;
  14455. this._readableState.reading = false;
  14456. this._readableState.ended = false;
  14457. this._readableState.endEmitted = false;
  14458. }
  14459. if (this._writableState) {
  14460. this._writableState.destroyed = false;
  14461. this._writableState.ended = false;
  14462. this._writableState.ending = false;
  14463. this._writableState.finished = false;
  14464. this._writableState.errorEmitted = false;
  14465. }
  14466. }
  14467. function emitErrorNT(self, err) {
  14468. self.emit('error', err);
  14469. }
  14470. module.exports = {
  14471. destroy: destroy,
  14472. undestroy: undestroy
  14473. };
  14474. },{"process-nextick-args":67}],77:[function(require,module,exports){
  14475. module.exports = require('events').EventEmitter;
  14476. },{"events":50}],78:[function(require,module,exports){
  14477. module.exports = require('./readable').PassThrough
  14478. },{"./readable":79}],79:[function(require,module,exports){
  14479. exports = module.exports = require('./lib/_stream_readable.js');
  14480. exports.Stream = exports;
  14481. exports.Readable = exports;
  14482. exports.Writable = require('./lib/_stream_writable.js');
  14483. exports.Duplex = require('./lib/_stream_duplex.js');
  14484. exports.Transform = require('./lib/_stream_transform.js');
  14485. exports.PassThrough = require('./lib/_stream_passthrough.js');
  14486. },{"./lib/_stream_duplex.js":70,"./lib/_stream_passthrough.js":71,"./lib/_stream_readable.js":72,"./lib/_stream_transform.js":73,"./lib/_stream_writable.js":74}],80:[function(require,module,exports){
  14487. module.exports = require('./readable').Transform
  14488. },{"./readable":79}],81:[function(require,module,exports){
  14489. module.exports = require('./lib/_stream_writable.js');
  14490. },{"./lib/_stream_writable.js":74}],82:[function(require,module,exports){
  14491. /* eslint-disable node/no-deprecated-api */
  14492. var buffer = require('buffer')
  14493. var Buffer = buffer.Buffer
  14494. // alternative to using Object.keys for old browsers
  14495. function copyProps (src, dst) {
  14496. for (var key in src) {
  14497. dst[key] = src[key]
  14498. }
  14499. }
  14500. if (Buffer.from && Buffer.alloc && Buffer.allocUnsafe && Buffer.allocUnsafeSlow) {
  14501. module.exports = buffer
  14502. } else {
  14503. // Copy properties from require('buffer')
  14504. copyProps(buffer, exports)
  14505. exports.Buffer = SafeBuffer
  14506. }
  14507. function SafeBuffer (arg, encodingOrOffset, length) {
  14508. return Buffer(arg, encodingOrOffset, length)
  14509. }
  14510. // Copy static methods from Buffer
  14511. copyProps(Buffer, SafeBuffer)
  14512. SafeBuffer.from = function (arg, encodingOrOffset, length) {
  14513. if (typeof arg === 'number') {
  14514. throw new TypeError('Argument must not be a number')
  14515. }
  14516. return Buffer(arg, encodingOrOffset, length)
  14517. }
  14518. SafeBuffer.alloc = function (size, fill, encoding) {
  14519. if (typeof size !== 'number') {
  14520. throw new TypeError('Argument must be a number')
  14521. }
  14522. var buf = Buffer(size)
  14523. if (fill !== undefined) {
  14524. if (typeof encoding === 'string') {
  14525. buf.fill(fill, encoding)
  14526. } else {
  14527. buf.fill(fill)
  14528. }
  14529. } else {
  14530. buf.fill(0)
  14531. }
  14532. return buf
  14533. }
  14534. SafeBuffer.allocUnsafe = function (size) {
  14535. if (typeof size !== 'number') {
  14536. throw new TypeError('Argument must be a number')
  14537. }
  14538. return Buffer(size)
  14539. }
  14540. SafeBuffer.allocUnsafeSlow = function (size) {
  14541. if (typeof size !== 'number') {
  14542. throw new TypeError('Argument must be a number')
  14543. }
  14544. return buffer.SlowBuffer(size)
  14545. }
  14546. },{"buffer":43}],83:[function(require,module,exports){
  14547. // Copyright Joyent, Inc. and other Node contributors.
  14548. //
  14549. // Permission is hereby granted, free of charge, to any person obtaining a
  14550. // copy of this software and associated documentation files (the
  14551. // "Software"), to deal in the Software without restriction, including
  14552. // without limitation the rights to use, copy, modify, merge, publish,
  14553. // distribute, sublicense, and/or sell copies of the Software, and to permit
  14554. // persons to whom the Software is furnished to do so, subject to the
  14555. // following conditions:
  14556. //
  14557. // The above copyright notice and this permission notice shall be included
  14558. // in all copies or substantial portions of the Software.
  14559. //
  14560. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  14561. // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  14562. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  14563. // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  14564. // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  14565. // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  14566. // USE OR OTHER DEALINGS IN THE SOFTWARE.
  14567. module.exports = Stream;
  14568. var EE = require('events').EventEmitter;
  14569. var inherits = require('inherits');
  14570. inherits(Stream, EE);
  14571. Stream.Readable = require('readable-stream/readable.js');
  14572. Stream.Writable = require('readable-stream/writable.js');
  14573. Stream.Duplex = require('readable-stream/duplex.js');
  14574. Stream.Transform = require('readable-stream/transform.js');
  14575. Stream.PassThrough = require('readable-stream/passthrough.js');
  14576. // Backwards-compat with node 0.4.x
  14577. Stream.Stream = Stream;
  14578. // old-style streams. Note that the pipe method (the only relevant
  14579. // part of this class) is overridden in the Readable class.
  14580. function Stream() {
  14581. EE.call(this);
  14582. }
  14583. Stream.prototype.pipe = function(dest, options) {
  14584. var source = this;
  14585. function ondata(chunk) {
  14586. if (dest.writable) {
  14587. if (false === dest.write(chunk) && source.pause) {
  14588. source.pause();
  14589. }
  14590. }
  14591. }
  14592. source.on('data', ondata);
  14593. function ondrain() {
  14594. if (source.readable && source.resume) {
  14595. source.resume();
  14596. }
  14597. }
  14598. dest.on('drain', ondrain);
  14599. // If the 'end' option is not supplied, dest.end() will be called when
  14600. // source gets the 'end' or 'close' events. Only dest.end() once.
  14601. if (!dest._isStdio && (!options || options.end !== false)) {
  14602. source.on('end', onend);
  14603. source.on('close', onclose);
  14604. }
  14605. var didOnEnd = false;
  14606. function onend() {
  14607. if (didOnEnd) return;
  14608. didOnEnd = true;
  14609. dest.end();
  14610. }
  14611. function onclose() {
  14612. if (didOnEnd) return;
  14613. didOnEnd = true;
  14614. if (typeof dest.destroy === 'function') dest.destroy();
  14615. }
  14616. // don't leave dangling pipes when there are errors.
  14617. function onerror(er) {
  14618. cleanup();
  14619. if (EE.listenerCount(this, 'error') === 0) {
  14620. throw er; // Unhandled stream error in pipe.
  14621. }
  14622. }
  14623. source.on('error', onerror);
  14624. dest.on('error', onerror);
  14625. // remove all the event listeners that were added.
  14626. function cleanup() {
  14627. source.removeListener('data', ondata);
  14628. dest.removeListener('drain', ondrain);
  14629. source.removeListener('end', onend);
  14630. source.removeListener('close', onclose);
  14631. source.removeListener('error', onerror);
  14632. dest.removeListener('error', onerror);
  14633. source.removeListener('end', cleanup);
  14634. source.removeListener('close', cleanup);
  14635. dest.removeListener('close', cleanup);
  14636. }
  14637. source.on('end', cleanup);
  14638. source.on('close', cleanup);
  14639. dest.on('close', cleanup);
  14640. dest.emit('pipe', source);
  14641. // Allow for unix-like usage: A.pipe(B).pipe(C)
  14642. return dest;
  14643. };
  14644. },{"events":50,"inherits":56,"readable-stream/duplex.js":69,"readable-stream/passthrough.js":78,"readable-stream/readable.js":79,"readable-stream/transform.js":80,"readable-stream/writable.js":81}],84:[function(require,module,exports){
  14645. // Copyright Joyent, Inc. and other Node contributors.
  14646. //
  14647. // Permission is hereby granted, free of charge, to any person obtaining a
  14648. // copy of this software and associated documentation files (the
  14649. // "Software"), to deal in the Software without restriction, including
  14650. // without limitation the rights to use, copy, modify, merge, publish,
  14651. // distribute, sublicense, and/or sell copies of the Software, and to permit
  14652. // persons to whom the Software is furnished to do so, subject to the
  14653. // following conditions:
  14654. //
  14655. // The above copyright notice and this permission notice shall be included
  14656. // in all copies or substantial portions of the Software.
  14657. //
  14658. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  14659. // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  14660. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  14661. // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  14662. // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  14663. // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  14664. // USE OR OTHER DEALINGS IN THE SOFTWARE.
  14665. 'use strict';
  14666. /*<replacement>*/
  14667. var Buffer = require('safe-buffer').Buffer;
  14668. /*</replacement>*/
  14669. var isEncoding = Buffer.isEncoding || function (encoding) {
  14670. encoding = '' + encoding;
  14671. switch (encoding && encoding.toLowerCase()) {
  14672. case 'hex':case 'utf8':case 'utf-8':case 'ascii':case 'binary':case 'base64':case 'ucs2':case 'ucs-2':case 'utf16le':case 'utf-16le':case 'raw':
  14673. return true;
  14674. default:
  14675. return false;
  14676. }
  14677. };
  14678. function _normalizeEncoding(enc) {
  14679. if (!enc) return 'utf8';
  14680. var retried;
  14681. while (true) {
  14682. switch (enc) {
  14683. case 'utf8':
  14684. case 'utf-8':
  14685. return 'utf8';
  14686. case 'ucs2':
  14687. case 'ucs-2':
  14688. case 'utf16le':
  14689. case 'utf-16le':
  14690. return 'utf16le';
  14691. case 'latin1':
  14692. case 'binary':
  14693. return 'latin1';
  14694. case 'base64':
  14695. case 'ascii':
  14696. case 'hex':
  14697. return enc;
  14698. default:
  14699. if (retried) return; // undefined
  14700. enc = ('' + enc).toLowerCase();
  14701. retried = true;
  14702. }
  14703. }
  14704. };
  14705. // Do not cache `Buffer.isEncoding` when checking encoding names as some
  14706. // modules monkey-patch it to support additional encodings
  14707. function normalizeEncoding(enc) {
  14708. var nenc = _normalizeEncoding(enc);
  14709. if (typeof nenc !== 'string' && (Buffer.isEncoding === isEncoding || !isEncoding(enc))) throw new Error('Unknown encoding: ' + enc);
  14710. return nenc || enc;
  14711. }
  14712. // StringDecoder provides an interface for efficiently splitting a series of
  14713. // buffers into a series of JS strings without breaking apart multi-byte
  14714. // characters.
  14715. exports.StringDecoder = StringDecoder;
  14716. function StringDecoder(encoding) {
  14717. this.encoding = normalizeEncoding(encoding);
  14718. var nb;
  14719. switch (this.encoding) {
  14720. case 'utf16le':
  14721. this.text = utf16Text;
  14722. this.end = utf16End;
  14723. nb = 4;
  14724. break;
  14725. case 'utf8':
  14726. this.fillLast = utf8FillLast;
  14727. nb = 4;
  14728. break;
  14729. case 'base64':
  14730. this.text = base64Text;
  14731. this.end = base64End;
  14732. nb = 3;
  14733. break;
  14734. default:
  14735. this.write = simpleWrite;
  14736. this.end = simpleEnd;
  14737. return;
  14738. }
  14739. this.lastNeed = 0;
  14740. this.lastTotal = 0;
  14741. this.lastChar = Buffer.allocUnsafe(nb);
  14742. }
  14743. StringDecoder.prototype.write = function (buf) {
  14744. if (buf.length === 0) return '';
  14745. var r;
  14746. var i;
  14747. if (this.lastNeed) {
  14748. r = this.fillLast(buf);
  14749. if (r === undefined) return '';
  14750. i = this.lastNeed;
  14751. this.lastNeed = 0;
  14752. } else {
  14753. i = 0;
  14754. }
  14755. if (i < buf.length) return r ? r + this.text(buf, i) : this.text(buf, i);
  14756. return r || '';
  14757. };
  14758. StringDecoder.prototype.end = utf8End;
  14759. // Returns only complete characters in a Buffer
  14760. StringDecoder.prototype.text = utf8Text;
  14761. // Attempts to complete a partial non-UTF-8 character using bytes from a Buffer
  14762. StringDecoder.prototype.fillLast = function (buf) {
  14763. if (this.lastNeed <= buf.length) {
  14764. buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, this.lastNeed);
  14765. return this.lastChar.toString(this.encoding, 0, this.lastTotal);
  14766. }
  14767. buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, buf.length);
  14768. this.lastNeed -= buf.length;
  14769. };
  14770. // Checks the type of a UTF-8 byte, whether it's ASCII, a leading byte, or a
  14771. // continuation byte. If an invalid byte is detected, -2 is returned.
  14772. function utf8CheckByte(byte) {
  14773. if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;
  14774. return byte >> 6 === 0x02 ? -1 : -2;
  14775. }
  14776. // Checks at most 3 bytes at the end of a Buffer in order to detect an
  14777. // incomplete multi-byte UTF-8 character. The total number of bytes (2, 3, or 4)
  14778. // needed to complete the UTF-8 character (if applicable) are returned.
  14779. function utf8CheckIncomplete(self, buf, i) {
  14780. var j = buf.length - 1;
  14781. if (j < i) return 0;
  14782. var nb = utf8CheckByte(buf[j]);
  14783. if (nb >= 0) {
  14784. if (nb > 0) self.lastNeed = nb - 1;
  14785. return nb;
  14786. }
  14787. if (--j < i || nb === -2) return 0;
  14788. nb = utf8CheckByte(buf[j]);
  14789. if (nb >= 0) {
  14790. if (nb > 0) self.lastNeed = nb - 2;
  14791. return nb;
  14792. }
  14793. if (--j < i || nb === -2) return 0;
  14794. nb = utf8CheckByte(buf[j]);
  14795. if (nb >= 0) {
  14796. if (nb > 0) {
  14797. if (nb === 2) nb = 0;else self.lastNeed = nb - 3;
  14798. }
  14799. return nb;
  14800. }
  14801. return 0;
  14802. }
  14803. // Validates as many continuation bytes for a multi-byte UTF-8 character as
  14804. // needed or are available. If we see a non-continuation byte where we expect
  14805. // one, we "replace" the validated continuation bytes we've seen so far with
  14806. // a single UTF-8 replacement character ('\ufffd'), to match v8's UTF-8 decoding
  14807. // behavior. The continuation byte check is included three times in the case
  14808. // where all of the continuation bytes for a character exist in the same buffer.
  14809. // It is also done this way as a slight performance increase instead of using a
  14810. // loop.
  14811. function utf8CheckExtraBytes(self, buf, p) {
  14812. if ((buf[0] & 0xC0) !== 0x80) {
  14813. self.lastNeed = 0;
  14814. return '\ufffd';
  14815. }
  14816. if (self.lastNeed > 1 && buf.length > 1) {
  14817. if ((buf[1] & 0xC0) !== 0x80) {
  14818. self.lastNeed = 1;
  14819. return '\ufffd';
  14820. }
  14821. if (self.lastNeed > 2 && buf.length > 2) {
  14822. if ((buf[2] & 0xC0) !== 0x80) {
  14823. self.lastNeed = 2;
  14824. return '\ufffd';
  14825. }
  14826. }
  14827. }
  14828. }
  14829. // Attempts to complete a multi-byte UTF-8 character using bytes from a Buffer.
  14830. function utf8FillLast(buf) {
  14831. var p = this.lastTotal - this.lastNeed;
  14832. var r = utf8CheckExtraBytes(this, buf, p);
  14833. if (r !== undefined) return r;
  14834. if (this.lastNeed <= buf.length) {
  14835. buf.copy(this.lastChar, p, 0, this.lastNeed);
  14836. return this.lastChar.toString(this.encoding, 0, this.lastTotal);
  14837. }
  14838. buf.copy(this.lastChar, p, 0, buf.length);
  14839. this.lastNeed -= buf.length;
  14840. }
  14841. // Returns all complete UTF-8 characters in a Buffer. If the Buffer ended on a
  14842. // partial character, the character's bytes are buffered until the required
  14843. // number of bytes are available.
  14844. function utf8Text(buf, i) {
  14845. var total = utf8CheckIncomplete(this, buf, i);
  14846. if (!this.lastNeed) return buf.toString('utf8', i);
  14847. this.lastTotal = total;
  14848. var end = buf.length - (total - this.lastNeed);
  14849. buf.copy(this.lastChar, 0, end);
  14850. return buf.toString('utf8', i, end);
  14851. }
  14852. // For UTF-8, a replacement character is added when ending on a partial
  14853. // character.
  14854. function utf8End(buf) {
  14855. var r = buf && buf.length ? this.write(buf) : '';
  14856. if (this.lastNeed) return r + '\ufffd';
  14857. return r;
  14858. }
  14859. // UTF-16LE typically needs two bytes per character, but even if we have an even
  14860. // number of bytes available, we need to check if we end on a leading/high
  14861. // surrogate. In that case, we need to wait for the next two bytes in order to
  14862. // decode the last character properly.
  14863. function utf16Text(buf, i) {
  14864. if ((buf.length - i) % 2 === 0) {
  14865. var r = buf.toString('utf16le', i);
  14866. if (r) {
  14867. var c = r.charCodeAt(r.length - 1);
  14868. if (c >= 0xD800 && c <= 0xDBFF) {
  14869. this.lastNeed = 2;
  14870. this.lastTotal = 4;
  14871. this.lastChar[0] = buf[buf.length - 2];
  14872. this.lastChar[1] = buf[buf.length - 1];
  14873. return r.slice(0, -1);
  14874. }
  14875. }
  14876. return r;
  14877. }
  14878. this.lastNeed = 1;
  14879. this.lastTotal = 2;
  14880. this.lastChar[0] = buf[buf.length - 1];
  14881. return buf.toString('utf16le', i, buf.length - 1);
  14882. }
  14883. // For UTF-16LE we do not explicitly append special replacement characters if we
  14884. // end on a partial character, we simply let v8 handle that.
  14885. function utf16End(buf) {
  14886. var r = buf && buf.length ? this.write(buf) : '';
  14887. if (this.lastNeed) {
  14888. var end = this.lastTotal - this.lastNeed;
  14889. return r + this.lastChar.toString('utf16le', 0, end);
  14890. }
  14891. return r;
  14892. }
  14893. function base64Text(buf, i) {
  14894. var n = (buf.length - i) % 3;
  14895. if (n === 0) return buf.toString('base64', i);
  14896. this.lastNeed = 3 - n;
  14897. this.lastTotal = 3;
  14898. if (n === 1) {
  14899. this.lastChar[0] = buf[buf.length - 1];
  14900. } else {
  14901. this.lastChar[0] = buf[buf.length - 2];
  14902. this.lastChar[1] = buf[buf.length - 1];
  14903. }
  14904. return buf.toString('base64', i, buf.length - n);
  14905. }
  14906. function base64End(buf) {
  14907. var r = buf && buf.length ? this.write(buf) : '';
  14908. if (this.lastNeed) return r + this.lastChar.toString('base64', 0, 3 - this.lastNeed);
  14909. return r;
  14910. }
  14911. // Pass bytes on through for single-byte encodings (e.g. ascii, latin1, hex)
  14912. function simpleWrite(buf) {
  14913. return buf.toString(this.encoding);
  14914. }
  14915. function simpleEnd(buf) {
  14916. return buf && buf.length ? this.write(buf) : '';
  14917. }
  14918. },{"safe-buffer":82}],85:[function(require,module,exports){
  14919. (function (global){
  14920. /**
  14921. * Module exports.
  14922. */
  14923. module.exports = deprecate;
  14924. /**
  14925. * Mark that a method should not be used.
  14926. * Returns a modified function which warns once by default.
  14927. *
  14928. * If `localStorage.noDeprecation = true` is set, then it is a no-op.
  14929. *
  14930. * If `localStorage.throwDeprecation = true` is set, then deprecated functions
  14931. * will throw an Error when invoked.
  14932. *
  14933. * If `localStorage.traceDeprecation = true` is set, then deprecated functions
  14934. * will invoke `console.trace()` instead of `console.error()`.
  14935. *
  14936. * @param {Function} fn - the function to deprecate
  14937. * @param {String} msg - the string to print to the console when `fn` is invoked
  14938. * @returns {Function} a new "deprecated" version of `fn`
  14939. * @api public
  14940. */
  14941. function deprecate (fn, msg) {
  14942. if (config('noDeprecation')) {
  14943. return fn;
  14944. }
  14945. var warned = false;
  14946. function deprecated() {
  14947. if (!warned) {
  14948. if (config('throwDeprecation')) {
  14949. throw new Error(msg);
  14950. } else if (config('traceDeprecation')) {
  14951. console.trace(msg);
  14952. } else {
  14953. console.warn(msg);
  14954. }
  14955. warned = true;
  14956. }
  14957. return fn.apply(this, arguments);
  14958. }
  14959. return deprecated;
  14960. }
  14961. /**
  14962. * Checks `localStorage` for boolean values for the given `name`.
  14963. *
  14964. * @param {String} name
  14965. * @returns {Boolean}
  14966. * @api private
  14967. */
  14968. function config (name) {
  14969. // accessing global.localStorage can trigger a DOMException in sandboxed iframes
  14970. try {
  14971. if (!global.localStorage) return false;
  14972. } catch (_) {
  14973. return false;
  14974. }
  14975. var val = global.localStorage[name];
  14976. if (null == val) return false;
  14977. return String(val).toLowerCase() === 'true';
  14978. }
  14979. }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
  14980. },{}],86:[function(require,module,exports){
  14981. arguments[4][56][0].apply(exports,arguments)
  14982. },{"dup":56}],87:[function(require,module,exports){
  14983. module.exports = function isBuffer(arg) {
  14984. return arg && typeof arg === 'object'
  14985. && typeof arg.copy === 'function'
  14986. && typeof arg.fill === 'function'
  14987. && typeof arg.readUInt8 === 'function';
  14988. }
  14989. },{}],88:[function(require,module,exports){
  14990. (function (process,global){
  14991. // Copyright Joyent, Inc. and other Node contributors.
  14992. //
  14993. // Permission is hereby granted, free of charge, to any person obtaining a
  14994. // copy of this software and associated documentation files (the
  14995. // "Software"), to deal in the Software without restriction, including
  14996. // without limitation the rights to use, copy, modify, merge, publish,
  14997. // distribute, sublicense, and/or sell copies of the Software, and to permit
  14998. // persons to whom the Software is furnished to do so, subject to the
  14999. // following conditions:
  15000. //
  15001. // The above copyright notice and this permission notice shall be included
  15002. // in all copies or substantial portions of the Software.
  15003. //
  15004. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  15005. // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  15006. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  15007. // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  15008. // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  15009. // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  15010. // USE OR OTHER DEALINGS IN THE SOFTWARE.
  15011. var formatRegExp = /%[sdj%]/g;
  15012. exports.format = function(f) {
  15013. if (!isString(f)) {
  15014. var objects = [];
  15015. for (var i = 0; i < arguments.length; i++) {
  15016. objects.push(inspect(arguments[i]));
  15017. }
  15018. return objects.join(' ');
  15019. }
  15020. var i = 1;
  15021. var args = arguments;
  15022. var len = args.length;
  15023. var str = String(f).replace(formatRegExp, function(x) {
  15024. if (x === '%%') return '%';
  15025. if (i >= len) return x;
  15026. switch (x) {
  15027. case '%s': return String(args[i++]);
  15028. case '%d': return Number(args[i++]);
  15029. case '%j':
  15030. try {
  15031. return JSON.stringify(args[i++]);
  15032. } catch (_) {
  15033. return '[Circular]';
  15034. }
  15035. default:
  15036. return x;
  15037. }
  15038. });
  15039. for (var x = args[i]; i < len; x = args[++i]) {
  15040. if (isNull(x) || !isObject(x)) {
  15041. str += ' ' + x;
  15042. } else {
  15043. str += ' ' + inspect(x);
  15044. }
  15045. }
  15046. return str;
  15047. };
  15048. // Mark that a method should not be used.
  15049. // Returns a modified function which warns once by default.
  15050. // If --no-deprecation is set, then it is a no-op.
  15051. exports.deprecate = function(fn, msg) {
  15052. // Allow for deprecating things in the process of starting up.
  15053. if (isUndefined(global.process)) {
  15054. return function() {
  15055. return exports.deprecate(fn, msg).apply(this, arguments);
  15056. };
  15057. }
  15058. if (process.noDeprecation === true) {
  15059. return fn;
  15060. }
  15061. var warned = false;
  15062. function deprecated() {
  15063. if (!warned) {
  15064. if (process.throwDeprecation) {
  15065. throw new Error(msg);
  15066. } else if (process.traceDeprecation) {
  15067. console.trace(msg);
  15068. } else {
  15069. console.error(msg);
  15070. }
  15071. warned = true;
  15072. }
  15073. return fn.apply(this, arguments);
  15074. }
  15075. return deprecated;
  15076. };
  15077. var debugs = {};
  15078. var debugEnviron;
  15079. exports.debuglog = function(set) {
  15080. if (isUndefined(debugEnviron))
  15081. debugEnviron = process.env.NODE_DEBUG || '';
  15082. set = set.toUpperCase();
  15083. if (!debugs[set]) {
  15084. if (new RegExp('\\b' + set + '\\b', 'i').test(debugEnviron)) {
  15085. var pid = process.pid;
  15086. debugs[set] = function() {
  15087. var msg = exports.format.apply(exports, arguments);
  15088. console.error('%s %d: %s', set, pid, msg);
  15089. };
  15090. } else {
  15091. debugs[set] = function() {};
  15092. }
  15093. }
  15094. return debugs[set];
  15095. };
  15096. /**
  15097. * Echos the value of a value. Trys to print the value out
  15098. * in the best way possible given the different types.
  15099. *
  15100. * @param {Object} obj The object to print out.
  15101. * @param {Object} opts Optional options object that alters the output.
  15102. */
  15103. /* legacy: obj, showHidden, depth, colors*/
  15104. function inspect(obj, opts) {
  15105. // default options
  15106. var ctx = {
  15107. seen: [],
  15108. stylize: stylizeNoColor
  15109. };
  15110. // legacy...
  15111. if (arguments.length >= 3) ctx.depth = arguments[2];
  15112. if (arguments.length >= 4) ctx.colors = arguments[3];
  15113. if (isBoolean(opts)) {
  15114. // legacy...
  15115. ctx.showHidden = opts;
  15116. } else if (opts) {
  15117. // got an "options" object
  15118. exports._extend(ctx, opts);
  15119. }
  15120. // set default options
  15121. if (isUndefined(ctx.showHidden)) ctx.showHidden = false;
  15122. if (isUndefined(ctx.depth)) ctx.depth = 2;
  15123. if (isUndefined(ctx.colors)) ctx.colors = false;
  15124. if (isUndefined(ctx.customInspect)) ctx.customInspect = true;
  15125. if (ctx.colors) ctx.stylize = stylizeWithColor;
  15126. return formatValue(ctx, obj, ctx.depth);
  15127. }
  15128. exports.inspect = inspect;
  15129. // http://en.wikipedia.org/wiki/ANSI_escape_code#graphics
  15130. inspect.colors = {
  15131. 'bold' : [1, 22],
  15132. 'italic' : [3, 23],
  15133. 'underline' : [4, 24],
  15134. 'inverse' : [7, 27],
  15135. 'white' : [37, 39],
  15136. 'grey' : [90, 39],
  15137. 'black' : [30, 39],
  15138. 'blue' : [34, 39],
  15139. 'cyan' : [36, 39],
  15140. 'green' : [32, 39],
  15141. 'magenta' : [35, 39],
  15142. 'red' : [31, 39],
  15143. 'yellow' : [33, 39]
  15144. };
  15145. // Don't use 'blue' not visible on cmd.exe
  15146. inspect.styles = {
  15147. 'special': 'cyan',
  15148. 'number': 'yellow',
  15149. 'boolean': 'yellow',
  15150. 'undefined': 'grey',
  15151. 'null': 'bold',
  15152. 'string': 'green',
  15153. 'date': 'magenta',
  15154. // "name": intentionally not styling
  15155. 'regexp': 'red'
  15156. };
  15157. function stylizeWithColor(str, styleType) {
  15158. var style = inspect.styles[styleType];
  15159. if (style) {
  15160. return '\u001b[' + inspect.colors[style][0] + 'm' + str +
  15161. '\u001b[' + inspect.colors[style][1] + 'm';
  15162. } else {
  15163. return str;
  15164. }
  15165. }
  15166. function stylizeNoColor(str, styleType) {
  15167. return str;
  15168. }
  15169. function arrayToHash(array) {
  15170. var hash = {};
  15171. array.forEach(function(val, idx) {
  15172. hash[val] = true;
  15173. });
  15174. return hash;
  15175. }
  15176. function formatValue(ctx, value, recurseTimes) {
  15177. // Provide a hook for user-specified inspect functions.
  15178. // Check that value is an object with an inspect function on it
  15179. if (ctx.customInspect &&
  15180. value &&
  15181. isFunction(value.inspect) &&
  15182. // Filter out the util module, it's inspect function is special
  15183. value.inspect !== exports.inspect &&
  15184. // Also filter out any prototype objects using the circular check.
  15185. !(value.constructor && value.constructor.prototype === value)) {
  15186. var ret = value.inspect(recurseTimes, ctx);
  15187. if (!isString(ret)) {
  15188. ret = formatValue(ctx, ret, recurseTimes);
  15189. }
  15190. return ret;
  15191. }
  15192. // Primitive types cannot have properties
  15193. var primitive = formatPrimitive(ctx, value);
  15194. if (primitive) {
  15195. return primitive;
  15196. }
  15197. // Look up the keys of the object.
  15198. var keys = Object.keys(value);
  15199. var visibleKeys = arrayToHash(keys);
  15200. if (ctx.showHidden) {
  15201. keys = Object.getOwnPropertyNames(value);
  15202. }
  15203. // IE doesn't make error fields non-enumerable
  15204. // http://msdn.microsoft.com/en-us/library/ie/dww52sbt(v=vs.94).aspx
  15205. if (isError(value)
  15206. && (keys.indexOf('message') >= 0 || keys.indexOf('description') >= 0)) {
  15207. return formatError(value);
  15208. }
  15209. // Some type of object without properties can be shortcutted.
  15210. if (keys.length === 0) {
  15211. if (isFunction(value)) {
  15212. var name = value.name ? ': ' + value.name : '';
  15213. return ctx.stylize('[Function' + name + ']', 'special');
  15214. }
  15215. if (isRegExp(value)) {
  15216. return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');
  15217. }
  15218. if (isDate(value)) {
  15219. return ctx.stylize(Date.prototype.toString.call(value), 'date');
  15220. }
  15221. if (isError(value)) {
  15222. return formatError(value);
  15223. }
  15224. }
  15225. var base = '', array = false, braces = ['{', '}'];
  15226. // Make Array say that they are Array
  15227. if (isArray(value)) {
  15228. array = true;
  15229. braces = ['[', ']'];
  15230. }
  15231. // Make functions say that they are functions
  15232. if (isFunction(value)) {
  15233. var n = value.name ? ': ' + value.name : '';
  15234. base = ' [Function' + n + ']';
  15235. }
  15236. // Make RegExps say that they are RegExps
  15237. if (isRegExp(value)) {
  15238. base = ' ' + RegExp.prototype.toString.call(value);
  15239. }
  15240. // Make dates with properties first say the date
  15241. if (isDate(value)) {
  15242. base = ' ' + Date.prototype.toUTCString.call(value);
  15243. }
  15244. // Make error with message first say the error
  15245. if (isError(value)) {
  15246. base = ' ' + formatError(value);
  15247. }
  15248. if (keys.length === 0 && (!array || value.length == 0)) {
  15249. return braces[0] + base + braces[1];
  15250. }
  15251. if (recurseTimes < 0) {
  15252. if (isRegExp(value)) {
  15253. return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');
  15254. } else {
  15255. return ctx.stylize('[Object]', 'special');
  15256. }
  15257. }
  15258. ctx.seen.push(value);
  15259. var output;
  15260. if (array) {
  15261. output = formatArray(ctx, value, recurseTimes, visibleKeys, keys);
  15262. } else {
  15263. output = keys.map(function(key) {
  15264. return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array);
  15265. });
  15266. }
  15267. ctx.seen.pop();
  15268. return reduceToSingleString(output, base, braces);
  15269. }
  15270. function formatPrimitive(ctx, value) {
  15271. if (isUndefined(value))
  15272. return ctx.stylize('undefined', 'undefined');
  15273. if (isString(value)) {
  15274. var simple = '\'' + JSON.stringify(value).replace(/^"|"$/g, '')
  15275. .replace(/'/g, "\\'")
  15276. .replace(/\\"/g, '"') + '\'';
  15277. return ctx.stylize(simple, 'string');
  15278. }
  15279. if (isNumber(value))
  15280. return ctx.stylize('' + value, 'number');
  15281. if (isBoolean(value))
  15282. return ctx.stylize('' + value, 'boolean');
  15283. // For some reason typeof null is "object", so special case here.
  15284. if (isNull(value))
  15285. return ctx.stylize('null', 'null');
  15286. }
  15287. function formatError(value) {
  15288. return '[' + Error.prototype.toString.call(value) + ']';
  15289. }
  15290. function formatArray(ctx, value, recurseTimes, visibleKeys, keys) {
  15291. var output = [];
  15292. for (var i = 0, l = value.length; i < l; ++i) {
  15293. if (hasOwnProperty(value, String(i))) {
  15294. output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,
  15295. String(i), true));
  15296. } else {
  15297. output.push('');
  15298. }
  15299. }
  15300. keys.forEach(function(key) {
  15301. if (!key.match(/^\d+$/)) {
  15302. output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,
  15303. key, true));
  15304. }
  15305. });
  15306. return output;
  15307. }
  15308. function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) {
  15309. var name, str, desc;
  15310. desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] };
  15311. if (desc.get) {
  15312. if (desc.set) {
  15313. str = ctx.stylize('[Getter/Setter]', 'special');
  15314. } else {
  15315. str = ctx.stylize('[Getter]', 'special');
  15316. }
  15317. } else {
  15318. if (desc.set) {
  15319. str = ctx.stylize('[Setter]', 'special');
  15320. }
  15321. }
  15322. if (!hasOwnProperty(visibleKeys, key)) {
  15323. name = '[' + key + ']';
  15324. }
  15325. if (!str) {
  15326. if (ctx.seen.indexOf(desc.value) < 0) {
  15327. if (isNull(recurseTimes)) {
  15328. str = formatValue(ctx, desc.value, null);
  15329. } else {
  15330. str = formatValue(ctx, desc.value, recurseTimes - 1);
  15331. }
  15332. if (str.indexOf('\n') > -1) {
  15333. if (array) {
  15334. str = str.split('\n').map(function(line) {
  15335. return ' ' + line;
  15336. }).join('\n').substr(2);
  15337. } else {
  15338. str = '\n' + str.split('\n').map(function(line) {
  15339. return ' ' + line;
  15340. }).join('\n');
  15341. }
  15342. }
  15343. } else {
  15344. str = ctx.stylize('[Circular]', 'special');
  15345. }
  15346. }
  15347. if (isUndefined(name)) {
  15348. if (array && key.match(/^\d+$/)) {
  15349. return str;
  15350. }
  15351. name = JSON.stringify('' + key);
  15352. if (name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)) {
  15353. name = name.substr(1, name.length - 2);
  15354. name = ctx.stylize(name, 'name');
  15355. } else {
  15356. name = name.replace(/'/g, "\\'")
  15357. .replace(/\\"/g, '"')
  15358. .replace(/(^"|"$)/g, "'");
  15359. name = ctx.stylize(name, 'string');
  15360. }
  15361. }
  15362. return name + ': ' + str;
  15363. }
  15364. function reduceToSingleString(output, base, braces) {
  15365. var numLinesEst = 0;
  15366. var length = output.reduce(function(prev, cur) {
  15367. numLinesEst++;
  15368. if (cur.indexOf('\n') >= 0) numLinesEst++;
  15369. return prev + cur.replace(/\u001b\[\d\d?m/g, '').length + 1;
  15370. }, 0);
  15371. if (length > 60) {
  15372. return braces[0] +
  15373. (base === '' ? '' : base + '\n ') +
  15374. ' ' +
  15375. output.join(',\n ') +
  15376. ' ' +
  15377. braces[1];
  15378. }
  15379. return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1];
  15380. }
  15381. // NOTE: These type checking functions intentionally don't use `instanceof`
  15382. // because it is fragile and can be easily faked with `Object.create()`.
  15383. function isArray(ar) {
  15384. return Array.isArray(ar);
  15385. }
  15386. exports.isArray = isArray;
  15387. function isBoolean(arg) {
  15388. return typeof arg === 'boolean';
  15389. }
  15390. exports.isBoolean = isBoolean;
  15391. function isNull(arg) {
  15392. return arg === null;
  15393. }
  15394. exports.isNull = isNull;
  15395. function isNullOrUndefined(arg) {
  15396. return arg == null;
  15397. }
  15398. exports.isNullOrUndefined = isNullOrUndefined;
  15399. function isNumber(arg) {
  15400. return typeof arg === 'number';
  15401. }
  15402. exports.isNumber = isNumber;
  15403. function isString(arg) {
  15404. return typeof arg === 'string';
  15405. }
  15406. exports.isString = isString;
  15407. function isSymbol(arg) {
  15408. return typeof arg === 'symbol';
  15409. }
  15410. exports.isSymbol = isSymbol;
  15411. function isUndefined(arg) {
  15412. return arg === void 0;
  15413. }
  15414. exports.isUndefined = isUndefined;
  15415. function isRegExp(re) {
  15416. return isObject(re) && objectToString(re) === '[object RegExp]';
  15417. }
  15418. exports.isRegExp = isRegExp;
  15419. function isObject(arg) {
  15420. return typeof arg === 'object' && arg !== null;
  15421. }
  15422. exports.isObject = isObject;
  15423. function isDate(d) {
  15424. return isObject(d) && objectToString(d) === '[object Date]';
  15425. }
  15426. exports.isDate = isDate;
  15427. function isError(e) {
  15428. return isObject(e) &&
  15429. (objectToString(e) === '[object Error]' || e instanceof Error);
  15430. }
  15431. exports.isError = isError;
  15432. function isFunction(arg) {
  15433. return typeof arg === 'function';
  15434. }
  15435. exports.isFunction = isFunction;
  15436. function isPrimitive(arg) {
  15437. return arg === null ||
  15438. typeof arg === 'boolean' ||
  15439. typeof arg === 'number' ||
  15440. typeof arg === 'string' ||
  15441. typeof arg === 'symbol' || // ES6 symbol
  15442. typeof arg === 'undefined';
  15443. }
  15444. exports.isPrimitive = isPrimitive;
  15445. exports.isBuffer = require('./support/isBuffer');
  15446. function objectToString(o) {
  15447. return Object.prototype.toString.call(o);
  15448. }
  15449. function pad(n) {
  15450. return n < 10 ? '0' + n.toString(10) : n.toString(10);
  15451. }
  15452. var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep',
  15453. 'Oct', 'Nov', 'Dec'];
  15454. // 26 Feb 16:19:34
  15455. function timestamp() {
  15456. var d = new Date();
  15457. var time = [pad(d.getHours()),
  15458. pad(d.getMinutes()),
  15459. pad(d.getSeconds())].join(':');
  15460. return [d.getDate(), months[d.getMonth()], time].join(' ');
  15461. }
  15462. // log is just a thin wrapper to console.log that prepends a timestamp
  15463. exports.log = function() {
  15464. console.log('%s - %s', timestamp(), exports.format.apply(exports, arguments));
  15465. };
  15466. /**
  15467. * Inherit the prototype methods from one constructor into another.
  15468. *
  15469. * The Function.prototype.inherits from lang.js rewritten as a standalone
  15470. * function (not on Function.prototype). NOTE: If this file is to be loaded
  15471. * during bootstrapping this function needs to be rewritten using some native
  15472. * functions as prototype setup using normal JavaScript does not work as
  15473. * expected during bootstrapping (see mirror.js in r114903).
  15474. *
  15475. * @param {function} ctor Constructor function which needs to inherit the
  15476. * prototype.
  15477. * @param {function} superCtor Constructor function to inherit prototype from.
  15478. */
  15479. exports.inherits = require('inherits');
  15480. exports._extend = function(origin, add) {
  15481. // Don't do anything if add isn't an object
  15482. if (!add || !isObject(add)) return origin;
  15483. var keys = Object.keys(add);
  15484. var i = keys.length;
  15485. while (i--) {
  15486. origin[keys[i]] = add[keys[i]];
  15487. }
  15488. return origin;
  15489. };
  15490. function hasOwnProperty(obj, prop) {
  15491. return Object.prototype.hasOwnProperty.call(obj, prop);
  15492. }
  15493. }).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
  15494. },{"./support/isBuffer":87,"_process":68,"inherits":86}],89:[function(require,module,exports){
  15495. module.exports={
  15496. "name": "mocha",
  15497. "version": "6.0.1",
  15498. "homepage": "https://mochajs.org/",
  15499. "notifyLogo": "https://ibin.co/4QuRuGjXvl36.png"
  15500. }
  15501. },{}]},{},[1]);