aliyun-oss-sdk.js 1.1 MB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279152801528115282152831528415285152861528715288152891529015291152921529315294152951529615297152981529915300153011530215303153041530515306153071530815309153101531115312153131531415315153161531715318153191532015321153221532315324153251532615327153281532915330153311533215333153341533515336153371533815339153401534115342153431534415345153461534715348153491535015351153521535315354153551535615357153581535915360153611536215363153641536515366153671536815369153701537115372153731537415375153761537715378153791538015381153821538315384153851538615387153881538915390153911539215393153941539515396153971539815399154001540115402154031540415405154061540715408154091541015411154121541315414154151541615417154181541915420154211542215423154241542515426154271542815429154301543115432154331543415435154361543715438154391544015441154421544315444154451544615447154481544915450154511545215453154541545515456154571545815459154601546115462154631546415465154661546715468154691547015471154721547315474154751547615477154781547915480154811548215483154841548515486154871548815489154901549115492154931549415495154961549715498154991550015501155021550315504155051550615507155081550915510155111551215513155141551515516155171551815519155201552115522155231552415525155261552715528155291553015531155321553315534155351553615537155381553915540155411554215543155441554515546155471554815549155501555115552155531555415555155561555715558155591556015561155621556315564155651556615567155681556915570155711557215573155741557515576155771557815579155801558115582155831558415585155861558715588155891559015591155921559315594155951559615597155981559915600156011560215603156041560515606156071560815609156101561115612156131561415615156161561715618156191562015621156221562315624156251562615627156281562915630156311563215633156341563515636156371563815639156401564115642156431564415645156461564715648156491565015651156521565315654156551565615657156581565915660156611566215663156641566515666156671566815669156701567115672156731567415675156761567715678156791568015681156821568315684156851568615687156881568915690156911569215693156941569515696156971569815699157001570115702157031570415705157061570715708157091571015711157121571315714157151571615717157181571915720157211572215723157241572515726157271572815729157301573115732157331573415735157361573715738157391574015741157421574315744157451574615747157481574915750157511575215753157541575515756157571575815759157601576115762157631576415765157661576715768157691577015771157721577315774157751577615777157781577915780157811578215783157841578515786157871578815789157901579115792157931579415795157961579715798157991580015801158021580315804158051580615807158081580915810158111581215813158141581515816158171581815819158201582115822158231582415825158261582715828158291583015831158321583315834158351583615837158381583915840158411584215843158441584515846158471584815849158501585115852158531585415855158561585715858158591586015861158621586315864158651586615867158681586915870158711587215873158741587515876158771587815879158801588115882158831588415885158861588715888158891589015891158921589315894158951589615897158981589915900159011590215903159041590515906159071590815909159101591115912159131591415915159161591715918159191592015921159221592315924159251592615927159281592915930159311593215933159341593515936159371593815939159401594115942159431594415945159461594715948159491595015951159521595315954159551595615957159581595915960159611596215963159641596515966159671596815969159701597115972159731597415975159761597715978159791598015981159821598315984159851598615987159881598915990159911599215993159941599515996159971599815999160001600116002160031600416005160061600716008160091601016011160121601316014160151601616017160181601916020160211602216023160241602516026160271602816029160301603116032160331603416035160361603716038160391604016041160421604316044160451604616047160481604916050160511605216053160541605516056160571605816059160601606116062160631606416065160661606716068160691607016071160721607316074160751607616077160781607916080160811608216083160841608516086160871608816089160901609116092160931609416095160961609716098160991610016101161021610316104161051610616107161081610916110161111611216113161141611516116161171611816119161201612116122161231612416125161261612716128161291613016131161321613316134161351613616137161381613916140161411614216143161441614516146161471614816149161501615116152161531615416155161561615716158161591616016161161621616316164161651616616167161681616916170161711617216173161741617516176161771617816179161801618116182161831618416185161861618716188161891619016191161921619316194161951619616197161981619916200162011620216203162041620516206162071620816209162101621116212162131621416215162161621716218162191622016221162221622316224162251622616227162281622916230162311623216233162341623516236162371623816239162401624116242162431624416245162461624716248162491625016251162521625316254162551625616257162581625916260162611626216263162641626516266162671626816269162701627116272162731627416275162761627716278162791628016281162821628316284162851628616287162881628916290162911629216293162941629516296162971629816299163001630116302163031630416305163061630716308163091631016311163121631316314163151631616317163181631916320163211632216323163241632516326163271632816329163301633116332163331633416335163361633716338163391634016341163421634316344163451634616347163481634916350163511635216353163541635516356163571635816359163601636116362163631636416365163661636716368163691637016371163721637316374163751637616377163781637916380163811638216383163841638516386163871638816389163901639116392163931639416395163961639716398163991640016401164021640316404164051640616407164081640916410164111641216413164141641516416164171641816419164201642116422164231642416425164261642716428164291643016431164321643316434164351643616437164381643916440164411644216443164441644516446164471644816449164501645116452164531645416455164561645716458164591646016461164621646316464164651646616467164681646916470164711647216473164741647516476164771647816479164801648116482164831648416485164861648716488164891649016491164921649316494164951649616497164981649916500165011650216503165041650516506165071650816509165101651116512165131651416515165161651716518165191652016521165221652316524165251652616527165281652916530165311653216533165341653516536165371653816539165401654116542165431654416545165461654716548165491655016551165521655316554165551655616557165581655916560165611656216563165641656516566165671656816569165701657116572165731657416575165761657716578165791658016581165821658316584165851658616587165881658916590165911659216593165941659516596165971659816599166001660116602166031660416605166061660716608166091661016611166121661316614166151661616617166181661916620166211662216623166241662516626166271662816629166301663116632166331663416635166361663716638166391664016641166421664316644166451664616647166481664916650166511665216653166541665516656166571665816659166601666116662166631666416665166661666716668166691667016671166721667316674166751667616677166781667916680166811668216683166841668516686166871668816689166901669116692166931669416695166961669716698166991670016701167021670316704167051670616707167081670916710167111671216713167141671516716167171671816719167201672116722167231672416725167261672716728167291673016731167321673316734167351673616737167381673916740167411674216743167441674516746167471674816749167501675116752167531675416755167561675716758167591676016761167621676316764167651676616767167681676916770167711677216773167741677516776167771677816779167801678116782167831678416785167861678716788167891679016791167921679316794167951679616797167981679916800168011680216803168041680516806168071680816809168101681116812168131681416815168161681716818168191682016821168221682316824168251682616827168281682916830168311683216833168341683516836168371683816839168401684116842168431684416845168461684716848168491685016851168521685316854168551685616857168581685916860168611686216863168641686516866168671686816869168701687116872168731687416875168761687716878168791688016881168821688316884168851688616887168881688916890168911689216893168941689516896168971689816899169001690116902169031690416905169061690716908169091691016911169121691316914169151691616917169181691916920169211692216923169241692516926169271692816929169301693116932169331693416935169361693716938169391694016941169421694316944169451694616947169481694916950169511695216953169541695516956169571695816959169601696116962169631696416965169661696716968169691697016971169721697316974169751697616977169781697916980169811698216983169841698516986169871698816989169901699116992169931699416995169961699716998169991700017001170021700317004170051700617007170081700917010170111701217013170141701517016170171701817019170201702117022170231702417025170261702717028170291703017031170321703317034170351703617037170381703917040170411704217043170441704517046170471704817049170501705117052170531705417055170561705717058170591706017061170621706317064170651706617067170681706917070170711707217073170741707517076170771707817079170801708117082170831708417085170861708717088170891709017091170921709317094170951709617097170981709917100171011710217103171041710517106171071710817109171101711117112171131711417115171161711717118171191712017121171221712317124171251712617127171281712917130171311713217133171341713517136171371713817139171401714117142171431714417145171461714717148171491715017151171521715317154171551715617157171581715917160171611716217163171641716517166171671716817169171701717117172171731717417175171761717717178171791718017181171821718317184171851718617187171881718917190171911719217193171941719517196171971719817199172001720117202172031720417205172061720717208172091721017211172121721317214172151721617217172181721917220172211722217223172241722517226172271722817229172301723117232172331723417235172361723717238172391724017241172421724317244172451724617247172481724917250172511725217253172541725517256172571725817259172601726117262172631726417265172661726717268172691727017271172721727317274172751727617277172781727917280172811728217283172841728517286172871728817289172901729117292172931729417295172961729717298172991730017301173021730317304173051730617307173081730917310173111731217313173141731517316173171731817319173201732117322173231732417325173261732717328173291733017331173321733317334173351733617337173381733917340173411734217343173441734517346173471734817349173501735117352173531735417355173561735717358173591736017361173621736317364173651736617367173681736917370173711737217373173741737517376173771737817379173801738117382173831738417385173861738717388173891739017391173921739317394173951739617397173981739917400174011740217403174041740517406174071740817409174101741117412174131741417415174161741717418174191742017421174221742317424174251742617427174281742917430174311743217433174341743517436174371743817439174401744117442174431744417445174461744717448174491745017451174521745317454174551745617457174581745917460174611746217463174641746517466174671746817469174701747117472174731747417475174761747717478174791748017481174821748317484174851748617487174881748917490174911749217493174941749517496174971749817499175001750117502175031750417505175061750717508175091751017511175121751317514175151751617517175181751917520175211752217523175241752517526175271752817529175301753117532175331753417535175361753717538175391754017541175421754317544175451754617547175481754917550175511755217553175541755517556175571755817559175601756117562175631756417565175661756717568175691757017571175721757317574175751757617577175781757917580175811758217583175841758517586175871758817589175901759117592175931759417595175961759717598175991760017601176021760317604176051760617607176081760917610176111761217613176141761517616176171761817619176201762117622176231762417625176261762717628176291763017631176321763317634176351763617637176381763917640176411764217643176441764517646176471764817649176501765117652176531765417655176561765717658176591766017661176621766317664176651766617667176681766917670176711767217673176741767517676176771767817679176801768117682176831768417685176861768717688176891769017691176921769317694176951769617697176981769917700177011770217703177041770517706177071770817709177101771117712177131771417715177161771717718177191772017721177221772317724177251772617727177281772917730177311773217733177341773517736177371773817739177401774117742177431774417745177461774717748177491775017751177521775317754177551775617757177581775917760177611776217763177641776517766177671776817769177701777117772177731777417775177761777717778177791778017781177821778317784177851778617787177881778917790177911779217793177941779517796177971779817799178001780117802178031780417805178061780717808178091781017811178121781317814178151781617817178181781917820178211782217823178241782517826178271782817829178301783117832178331783417835178361783717838178391784017841178421784317844178451784617847178481784917850178511785217853178541785517856178571785817859178601786117862178631786417865178661786717868178691787017871178721787317874178751787617877178781787917880178811788217883178841788517886178871788817889178901789117892178931789417895178961789717898178991790017901179021790317904179051790617907179081790917910179111791217913179141791517916179171791817919179201792117922179231792417925179261792717928179291793017931179321793317934179351793617937179381793917940179411794217943179441794517946179471794817949179501795117952179531795417955179561795717958179591796017961179621796317964179651796617967179681796917970179711797217973179741797517976179771797817979179801798117982179831798417985179861798717988179891799017991179921799317994179951799617997179981799918000180011800218003180041800518006180071800818009180101801118012180131801418015180161801718018180191802018021180221802318024180251802618027180281802918030180311803218033180341803518036180371803818039180401804118042180431804418045180461804718048180491805018051180521805318054180551805618057180581805918060180611806218063180641806518066180671806818069180701807118072180731807418075180761807718078180791808018081180821808318084180851808618087180881808918090180911809218093180941809518096180971809818099181001810118102181031810418105181061810718108181091811018111181121811318114181151811618117181181811918120181211812218123181241812518126181271812818129181301813118132181331813418135181361813718138181391814018141181421814318144181451814618147181481814918150181511815218153181541815518156181571815818159181601816118162181631816418165181661816718168181691817018171181721817318174181751817618177181781817918180181811818218183181841818518186181871818818189181901819118192181931819418195181961819718198181991820018201182021820318204182051820618207182081820918210182111821218213182141821518216182171821818219182201822118222182231822418225182261822718228182291823018231182321823318234182351823618237182381823918240182411824218243182441824518246182471824818249182501825118252182531825418255182561825718258182591826018261182621826318264182651826618267182681826918270182711827218273182741827518276182771827818279182801828118282182831828418285182861828718288182891829018291182921829318294182951829618297182981829918300183011830218303183041830518306183071830818309183101831118312183131831418315183161831718318183191832018321183221832318324183251832618327183281832918330183311833218333183341833518336183371833818339183401834118342183431834418345183461834718348183491835018351183521835318354183551835618357183581835918360183611836218363183641836518366183671836818369183701837118372183731837418375183761837718378183791838018381183821838318384183851838618387183881838918390183911839218393183941839518396183971839818399184001840118402184031840418405184061840718408184091841018411184121841318414184151841618417184181841918420184211842218423184241842518426184271842818429184301843118432184331843418435184361843718438184391844018441184421844318444184451844618447184481844918450184511845218453184541845518456184571845818459184601846118462184631846418465184661846718468184691847018471184721847318474184751847618477184781847918480184811848218483184841848518486184871848818489184901849118492184931849418495184961849718498184991850018501185021850318504185051850618507185081850918510185111851218513185141851518516185171851818519185201852118522185231852418525185261852718528185291853018531185321853318534185351853618537185381853918540185411854218543185441854518546185471854818549185501855118552185531855418555185561855718558185591856018561185621856318564185651856618567185681856918570185711857218573185741857518576185771857818579185801858118582185831858418585185861858718588185891859018591185921859318594185951859618597185981859918600186011860218603186041860518606186071860818609186101861118612186131861418615186161861718618186191862018621186221862318624186251862618627186281862918630186311863218633186341863518636186371863818639186401864118642186431864418645186461864718648186491865018651186521865318654186551865618657186581865918660186611866218663186641866518666186671866818669186701867118672186731867418675186761867718678186791868018681186821868318684186851868618687186881868918690186911869218693186941869518696186971869818699187001870118702187031870418705187061870718708187091871018711187121871318714187151871618717187181871918720187211872218723187241872518726187271872818729187301873118732187331873418735187361873718738187391874018741187421874318744187451874618747187481874918750187511875218753187541875518756187571875818759187601876118762187631876418765187661876718768187691877018771187721877318774187751877618777187781877918780187811878218783187841878518786187871878818789187901879118792187931879418795187961879718798187991880018801188021880318804188051880618807188081880918810188111881218813188141881518816188171881818819188201882118822188231882418825188261882718828188291883018831188321883318834188351883618837188381883918840188411884218843188441884518846188471884818849188501885118852188531885418855188561885718858188591886018861188621886318864188651886618867188681886918870188711887218873188741887518876188771887818879188801888118882188831888418885188861888718888188891889018891188921889318894188951889618897188981889918900189011890218903189041890518906189071890818909189101891118912189131891418915189161891718918189191892018921189221892318924189251892618927189281892918930189311893218933189341893518936189371893818939189401894118942189431894418945189461894718948189491895018951189521895318954189551895618957189581895918960189611896218963189641896518966189671896818969189701897118972189731897418975189761897718978189791898018981189821898318984189851898618987189881898918990189911899218993189941899518996189971899818999190001900119002190031900419005190061900719008190091901019011190121901319014190151901619017190181901919020190211902219023190241902519026190271902819029190301903119032190331903419035190361903719038190391904019041190421904319044190451904619047190481904919050190511905219053190541905519056190571905819059190601906119062190631906419065190661906719068190691907019071190721907319074190751907619077190781907919080190811908219083190841908519086190871908819089190901909119092190931909419095190961909719098190991910019101191021910319104191051910619107191081910919110191111911219113191141911519116191171911819119191201912119122191231912419125191261912719128191291913019131191321913319134191351913619137191381913919140191411914219143191441914519146191471914819149191501915119152191531915419155191561915719158191591916019161191621916319164191651916619167191681916919170191711917219173191741917519176191771917819179191801918119182191831918419185191861918719188191891919019191191921919319194191951919619197191981919919200192011920219203192041920519206192071920819209192101921119212192131921419215192161921719218192191922019221192221922319224192251922619227192281922919230192311923219233192341923519236192371923819239192401924119242192431924419245192461924719248192491925019251192521925319254192551925619257192581925919260192611926219263192641926519266192671926819269192701927119272192731927419275192761927719278192791928019281192821928319284192851928619287192881928919290192911929219293192941929519296192971929819299193001930119302193031930419305193061930719308193091931019311193121931319314193151931619317193181931919320193211932219323193241932519326193271932819329193301933119332193331933419335193361933719338193391934019341193421934319344193451934619347193481934919350193511935219353193541935519356193571935819359193601936119362193631936419365193661936719368193691937019371193721937319374193751937619377193781937919380193811938219383193841938519386193871938819389193901939119392193931939419395193961939719398193991940019401194021940319404194051940619407194081940919410194111941219413194141941519416194171941819419194201942119422194231942419425194261942719428194291943019431194321943319434194351943619437194381943919440194411944219443194441944519446194471944819449194501945119452194531945419455194561945719458194591946019461194621946319464194651946619467194681946919470194711947219473194741947519476194771947819479194801948119482194831948419485194861948719488194891949019491194921949319494194951949619497194981949919500195011950219503195041950519506195071950819509195101951119512195131951419515195161951719518195191952019521195221952319524195251952619527195281952919530195311953219533195341953519536195371953819539195401954119542195431954419545195461954719548195491955019551195521955319554195551955619557195581955919560195611956219563195641956519566195671956819569195701957119572195731957419575195761957719578195791958019581195821958319584195851958619587195881958919590195911959219593195941959519596195971959819599196001960119602196031960419605196061960719608196091961019611196121961319614196151961619617196181961919620196211962219623196241962519626196271962819629196301963119632196331963419635196361963719638196391964019641196421964319644196451964619647196481964919650196511965219653196541965519656196571965819659196601966119662196631966419665196661966719668196691967019671196721967319674196751967619677196781967919680196811968219683196841968519686196871968819689196901969119692196931969419695196961969719698196991970019701197021970319704197051970619707197081970919710197111971219713197141971519716197171971819719197201972119722197231972419725197261972719728197291973019731197321973319734197351973619737197381973919740197411974219743197441974519746197471974819749197501975119752197531975419755197561975719758197591976019761197621976319764197651976619767197681976919770197711977219773197741977519776197771977819779197801978119782197831978419785197861978719788197891979019791197921979319794197951979619797197981979919800198011980219803198041980519806198071980819809198101981119812198131981419815198161981719818198191982019821198221982319824198251982619827198281982919830198311983219833198341983519836198371983819839198401984119842198431984419845198461984719848198491985019851198521985319854198551985619857198581985919860198611986219863198641986519866198671986819869198701987119872198731987419875198761987719878198791988019881198821988319884198851988619887198881988919890198911989219893198941989519896198971989819899199001990119902199031990419905199061990719908199091991019911199121991319914199151991619917199181991919920199211992219923199241992519926199271992819929199301993119932199331993419935199361993719938199391994019941199421994319944199451994619947199481994919950199511995219953199541995519956199571995819959199601996119962199631996419965199661996719968199691997019971199721997319974199751997619977199781997919980199811998219983199841998519986199871998819989199901999119992199931999419995199961999719998199992000020001200022000320004200052000620007200082000920010200112001220013200142001520016200172001820019200202002120022200232002420025200262002720028200292003020031200322003320034200352003620037200382003920040200412004220043200442004520046200472004820049200502005120052200532005420055200562005720058200592006020061200622006320064200652006620067200682006920070200712007220073200742007520076200772007820079200802008120082200832008420085200862008720088200892009020091200922009320094200952009620097200982009920100201012010220103201042010520106201072010820109201102011120112201132011420115201162011720118201192012020121201222012320124201252012620127201282012920130201312013220133201342013520136201372013820139201402014120142201432014420145201462014720148201492015020151201522015320154201552015620157201582015920160201612016220163201642016520166201672016820169201702017120172201732017420175201762017720178201792018020181201822018320184201852018620187201882018920190201912019220193201942019520196201972019820199202002020120202202032020420205202062020720208202092021020211202122021320214202152021620217202182021920220202212022220223202242022520226202272022820229202302023120232202332023420235202362023720238202392024020241202422024320244202452024620247202482024920250202512025220253202542025520256202572025820259202602026120262202632026420265202662026720268202692027020271202722027320274202752027620277202782027920280202812028220283202842028520286202872028820289202902029120292202932029420295202962029720298202992030020301203022030320304203052030620307203082030920310203112031220313203142031520316203172031820319203202032120322203232032420325203262032720328203292033020331203322033320334203352033620337203382033920340203412034220343203442034520346203472034820349203502035120352203532035420355203562035720358203592036020361203622036320364203652036620367203682036920370203712037220373203742037520376203772037820379203802038120382203832038420385203862038720388203892039020391203922039320394203952039620397203982039920400204012040220403204042040520406204072040820409204102041120412204132041420415204162041720418204192042020421204222042320424204252042620427204282042920430204312043220433204342043520436204372043820439204402044120442204432044420445204462044720448204492045020451204522045320454204552045620457204582045920460204612046220463204642046520466204672046820469204702047120472204732047420475204762047720478204792048020481204822048320484204852048620487204882048920490204912049220493204942049520496204972049820499205002050120502205032050420505205062050720508205092051020511205122051320514205152051620517205182051920520205212052220523205242052520526205272052820529205302053120532205332053420535205362053720538205392054020541205422054320544205452054620547205482054920550205512055220553205542055520556205572055820559205602056120562205632056420565205662056720568205692057020571205722057320574205752057620577205782057920580205812058220583205842058520586205872058820589205902059120592205932059420595205962059720598205992060020601206022060320604206052060620607206082060920610206112061220613206142061520616206172061820619206202062120622206232062420625206262062720628206292063020631206322063320634206352063620637206382063920640206412064220643206442064520646206472064820649206502065120652206532065420655206562065720658206592066020661206622066320664206652066620667206682066920670206712067220673206742067520676206772067820679206802068120682206832068420685206862068720688206892069020691206922069320694206952069620697206982069920700207012070220703207042070520706207072070820709207102071120712207132071420715207162071720718207192072020721207222072320724207252072620727207282072920730207312073220733207342073520736207372073820739207402074120742207432074420745207462074720748207492075020751207522075320754207552075620757207582075920760207612076220763207642076520766207672076820769207702077120772207732077420775207762077720778207792078020781207822078320784207852078620787207882078920790207912079220793207942079520796207972079820799208002080120802208032080420805208062080720808208092081020811208122081320814208152081620817208182081920820208212082220823208242082520826208272082820829208302083120832208332083420835208362083720838208392084020841208422084320844208452084620847208482084920850208512085220853208542085520856208572085820859208602086120862208632086420865208662086720868208692087020871208722087320874208752087620877208782087920880208812088220883208842088520886208872088820889208902089120892208932089420895208962089720898208992090020901209022090320904209052090620907209082090920910209112091220913209142091520916209172091820919209202092120922209232092420925209262092720928209292093020931209322093320934209352093620937209382093920940209412094220943209442094520946209472094820949209502095120952209532095420955209562095720958209592096020961209622096320964209652096620967209682096920970209712097220973209742097520976209772097820979209802098120982209832098420985209862098720988209892099020991209922099320994209952099620997209982099921000210012100221003210042100521006210072100821009210102101121012210132101421015210162101721018210192102021021210222102321024210252102621027210282102921030210312103221033210342103521036210372103821039210402104121042210432104421045210462104721048210492105021051210522105321054210552105621057210582105921060210612106221063210642106521066210672106821069210702107121072210732107421075210762107721078210792108021081210822108321084210852108621087210882108921090210912109221093210942109521096210972109821099211002110121102211032110421105211062110721108211092111021111211122111321114211152111621117211182111921120211212112221123211242112521126211272112821129211302113121132211332113421135211362113721138211392114021141211422114321144211452114621147211482114921150211512115221153211542115521156211572115821159211602116121162211632116421165211662116721168211692117021171211722117321174211752117621177211782117921180211812118221183211842118521186211872118821189211902119121192211932119421195211962119721198211992120021201212022120321204212052120621207212082120921210212112121221213212142121521216212172121821219212202122121222212232122421225212262122721228212292123021231212322123321234212352123621237212382123921240212412124221243212442124521246212472124821249212502125121252212532125421255212562125721258212592126021261212622126321264212652126621267212682126921270212712127221273212742127521276212772127821279212802128121282212832128421285212862128721288212892129021291212922129321294212952129621297212982129921300213012130221303213042130521306213072130821309213102131121312213132131421315213162131721318213192132021321213222132321324213252132621327213282132921330213312133221333213342133521336213372133821339213402134121342213432134421345213462134721348213492135021351213522135321354213552135621357213582135921360213612136221363213642136521366213672136821369213702137121372213732137421375213762137721378213792138021381213822138321384213852138621387213882138921390213912139221393213942139521396213972139821399214002140121402214032140421405214062140721408214092141021411214122141321414214152141621417214182141921420214212142221423214242142521426214272142821429214302143121432214332143421435214362143721438214392144021441214422144321444214452144621447214482144921450214512145221453214542145521456214572145821459214602146121462214632146421465214662146721468214692147021471214722147321474214752147621477214782147921480214812148221483214842148521486214872148821489214902149121492214932149421495214962149721498214992150021501215022150321504215052150621507215082150921510215112151221513215142151521516215172151821519215202152121522215232152421525215262152721528215292153021531215322153321534215352153621537215382153921540215412154221543215442154521546215472154821549215502155121552215532155421555215562155721558215592156021561215622156321564215652156621567215682156921570215712157221573215742157521576215772157821579215802158121582215832158421585215862158721588215892159021591215922159321594215952159621597215982159921600216012160221603216042160521606216072160821609216102161121612216132161421615216162161721618216192162021621216222162321624216252162621627216282162921630216312163221633216342163521636216372163821639216402164121642216432164421645216462164721648216492165021651216522165321654216552165621657216582165921660216612166221663216642166521666216672166821669216702167121672216732167421675216762167721678216792168021681216822168321684216852168621687216882168921690216912169221693216942169521696216972169821699217002170121702217032170421705217062170721708217092171021711217122171321714217152171621717217182171921720217212172221723217242172521726217272172821729217302173121732217332173421735217362173721738217392174021741217422174321744217452174621747217482174921750217512175221753217542175521756217572175821759217602176121762217632176421765217662176721768217692177021771217722177321774217752177621777217782177921780217812178221783217842178521786217872178821789217902179121792217932179421795217962179721798217992180021801218022180321804218052180621807218082180921810218112181221813218142181521816218172181821819218202182121822218232182421825218262182721828218292183021831218322183321834218352183621837218382183921840218412184221843218442184521846218472184821849218502185121852218532185421855218562185721858218592186021861218622186321864218652186621867218682186921870218712187221873218742187521876218772187821879218802188121882218832188421885218862188721888218892189021891218922189321894218952189621897218982189921900219012190221903219042190521906219072190821909219102191121912219132191421915219162191721918219192192021921219222192321924219252192621927219282192921930219312193221933219342193521936219372193821939219402194121942219432194421945219462194721948219492195021951219522195321954219552195621957219582195921960219612196221963219642196521966219672196821969219702197121972219732197421975219762197721978219792198021981219822198321984219852198621987219882198921990219912199221993219942199521996219972199821999220002200122002220032200422005220062200722008220092201022011220122201322014220152201622017220182201922020220212202222023220242202522026220272202822029220302203122032220332203422035220362203722038220392204022041220422204322044220452204622047220482204922050220512205222053220542205522056220572205822059220602206122062220632206422065220662206722068220692207022071220722207322074220752207622077220782207922080220812208222083220842208522086220872208822089220902209122092220932209422095220962209722098220992210022101221022210322104221052210622107221082210922110221112211222113221142211522116221172211822119221202212122122221232212422125221262212722128221292213022131221322213322134221352213622137221382213922140221412214222143221442214522146221472214822149221502215122152221532215422155221562215722158221592216022161221622216322164221652216622167221682216922170221712217222173221742217522176221772217822179221802218122182221832218422185221862218722188221892219022191221922219322194221952219622197221982219922200222012220222203222042220522206222072220822209222102221122212222132221422215222162221722218222192222022221222222222322224222252222622227222282222922230222312223222233222342223522236222372223822239222402224122242222432224422245222462224722248222492225022251222522225322254222552225622257222582225922260222612226222263222642226522266222672226822269222702227122272222732227422275222762227722278222792228022281222822228322284222852228622287222882228922290222912229222293222942229522296222972229822299223002230122302223032230422305223062230722308223092231022311223122231322314223152231622317223182231922320223212232222323223242232522326223272232822329223302233122332223332233422335223362233722338223392234022341223422234322344223452234622347223482234922350223512235222353223542235522356223572235822359223602236122362223632236422365223662236722368223692237022371223722237322374223752237622377223782237922380223812238222383223842238522386223872238822389223902239122392223932239422395223962239722398223992240022401224022240322404224052240622407224082240922410224112241222413224142241522416224172241822419224202242122422224232242422425224262242722428224292243022431224322243322434224352243622437224382243922440224412244222443224442244522446224472244822449224502245122452224532245422455224562245722458224592246022461224622246322464224652246622467224682246922470224712247222473224742247522476224772247822479224802248122482224832248422485224862248722488224892249022491224922249322494224952249622497224982249922500225012250222503225042250522506225072250822509225102251122512225132251422515225162251722518225192252022521225222252322524225252252622527225282252922530225312253222533225342253522536225372253822539225402254122542225432254422545225462254722548225492255022551225522255322554225552255622557225582255922560225612256222563225642256522566225672256822569225702257122572225732257422575225762257722578225792258022581225822258322584225852258622587225882258922590225912259222593225942259522596225972259822599226002260122602226032260422605226062260722608226092261022611226122261322614226152261622617226182261922620226212262222623226242262522626226272262822629226302263122632226332263422635226362263722638226392264022641226422264322644226452264622647226482264922650226512265222653226542265522656226572265822659226602266122662226632266422665226662266722668226692267022671226722267322674226752267622677226782267922680226812268222683226842268522686226872268822689226902269122692226932269422695226962269722698226992270022701227022270322704227052270622707227082270922710227112271222713227142271522716227172271822719227202272122722227232272422725227262272722728227292273022731227322273322734227352273622737227382273922740227412274222743227442274522746227472274822749227502275122752227532275422755227562275722758227592276022761227622276322764227652276622767227682276922770227712277222773227742277522776227772277822779227802278122782227832278422785227862278722788227892279022791227922279322794227952279622797227982279922800228012280222803228042280522806228072280822809228102281122812228132281422815228162281722818228192282022821228222282322824228252282622827228282282922830228312283222833228342283522836228372283822839228402284122842228432284422845228462284722848228492285022851228522285322854228552285622857228582285922860228612286222863228642286522866228672286822869228702287122872228732287422875228762287722878228792288022881228822288322884228852288622887228882288922890228912289222893228942289522896228972289822899229002290122902229032290422905229062290722908229092291022911229122291322914229152291622917229182291922920229212292222923229242292522926229272292822929229302293122932229332293422935229362293722938229392294022941229422294322944229452294622947229482294922950229512295222953229542295522956229572295822959229602296122962229632296422965229662296722968229692297022971229722297322974229752297622977229782297922980229812298222983229842298522986229872298822989229902299122992229932299422995229962299722998229992300023001230022300323004230052300623007230082300923010230112301223013230142301523016230172301823019230202302123022230232302423025230262302723028230292303023031230322303323034230352303623037230382303923040230412304223043230442304523046230472304823049230502305123052230532305423055230562305723058230592306023061230622306323064230652306623067230682306923070230712307223073230742307523076230772307823079230802308123082230832308423085230862308723088230892309023091230922309323094230952309623097230982309923100231012310223103231042310523106231072310823109231102311123112231132311423115231162311723118231192312023121231222312323124231252312623127231282312923130231312313223133231342313523136231372313823139231402314123142231432314423145231462314723148231492315023151231522315323154231552315623157231582315923160231612316223163231642316523166231672316823169231702317123172231732317423175231762317723178231792318023181231822318323184231852318623187231882318923190231912319223193231942319523196231972319823199232002320123202232032320423205232062320723208232092321023211232122321323214232152321623217232182321923220232212322223223232242322523226232272322823229232302323123232232332323423235232362323723238232392324023241232422324323244232452324623247232482324923250232512325223253232542325523256232572325823259232602326123262232632326423265232662326723268232692327023271232722327323274232752327623277232782327923280232812328223283232842328523286232872328823289232902329123292232932329423295232962329723298232992330023301233022330323304233052330623307233082330923310233112331223313233142331523316233172331823319233202332123322233232332423325233262332723328233292333023331233322333323334233352333623337233382333923340233412334223343233442334523346233472334823349233502335123352233532335423355233562335723358233592336023361233622336323364233652336623367233682336923370233712337223373233742337523376233772337823379233802338123382233832338423385233862338723388233892339023391233922339323394233952339623397233982339923400234012340223403234042340523406234072340823409234102341123412234132341423415234162341723418234192342023421234222342323424234252342623427234282342923430234312343223433234342343523436234372343823439234402344123442234432344423445234462344723448234492345023451234522345323454234552345623457234582345923460234612346223463234642346523466234672346823469234702347123472234732347423475234762347723478234792348023481234822348323484234852348623487234882348923490234912349223493234942349523496234972349823499235002350123502235032350423505235062350723508235092351023511235122351323514235152351623517235182351923520235212352223523235242352523526235272352823529235302353123532235332353423535235362353723538235392354023541235422354323544235452354623547235482354923550235512355223553235542355523556235572355823559235602356123562235632356423565235662356723568235692357023571235722357323574235752357623577235782357923580235812358223583235842358523586235872358823589235902359123592235932359423595235962359723598235992360023601236022360323604236052360623607236082360923610236112361223613236142361523616236172361823619236202362123622236232362423625236262362723628236292363023631236322363323634236352363623637236382363923640236412364223643236442364523646236472364823649236502365123652236532365423655236562365723658236592366023661236622366323664236652366623667236682366923670236712367223673236742367523676236772367823679236802368123682236832368423685236862368723688236892369023691236922369323694236952369623697236982369923700237012370223703237042370523706237072370823709237102371123712237132371423715237162371723718237192372023721237222372323724237252372623727237282372923730237312373223733237342373523736237372373823739237402374123742237432374423745237462374723748237492375023751237522375323754237552375623757237582375923760237612376223763237642376523766237672376823769237702377123772237732377423775237762377723778237792378023781237822378323784237852378623787237882378923790237912379223793237942379523796237972379823799238002380123802238032380423805238062380723808238092381023811238122381323814238152381623817238182381923820238212382223823238242382523826238272382823829238302383123832238332383423835238362383723838238392384023841238422384323844238452384623847238482384923850238512385223853238542385523856238572385823859238602386123862238632386423865238662386723868238692387023871238722387323874238752387623877238782387923880238812388223883238842388523886238872388823889238902389123892238932389423895238962389723898238992390023901239022390323904239052390623907239082390923910239112391223913239142391523916239172391823919239202392123922239232392423925239262392723928239292393023931239322393323934239352393623937239382393923940239412394223943239442394523946239472394823949239502395123952239532395423955239562395723958239592396023961239622396323964239652396623967239682396923970239712397223973239742397523976239772397823979239802398123982239832398423985239862398723988239892399023991239922399323994239952399623997239982399924000240012400224003240042400524006240072400824009240102401124012240132401424015240162401724018240192402024021240222402324024240252402624027240282402924030240312403224033240342403524036240372403824039240402404124042240432404424045240462404724048240492405024051240522405324054240552405624057240582405924060240612406224063240642406524066240672406824069240702407124072240732407424075240762407724078240792408024081240822408324084240852408624087240882408924090240912409224093240942409524096240972409824099241002410124102241032410424105241062410724108241092411024111241122411324114241152411624117241182411924120241212412224123241242412524126241272412824129241302413124132241332413424135241362413724138241392414024141241422414324144241452414624147241482414924150241512415224153241542415524156241572415824159241602416124162241632416424165241662416724168241692417024171241722417324174241752417624177241782417924180241812418224183241842418524186241872418824189241902419124192241932419424195241962419724198241992420024201242022420324204242052420624207242082420924210242112421224213242142421524216242172421824219242202422124222242232422424225242262422724228242292423024231242322423324234242352423624237242382423924240242412424224243242442424524246242472424824249242502425124252242532425424255242562425724258242592426024261242622426324264242652426624267242682426924270242712427224273242742427524276242772427824279242802428124282242832428424285242862428724288242892429024291242922429324294242952429624297242982429924300243012430224303243042430524306243072430824309243102431124312243132431424315243162431724318243192432024321243222432324324243252432624327243282432924330243312433224333243342433524336243372433824339243402434124342243432434424345243462434724348243492435024351243522435324354243552435624357243582435924360243612436224363243642436524366243672436824369243702437124372243732437424375243762437724378243792438024381243822438324384243852438624387243882438924390243912439224393243942439524396243972439824399244002440124402244032440424405244062440724408244092441024411244122441324414244152441624417244182441924420244212442224423244242442524426244272442824429244302443124432244332443424435244362443724438244392444024441244422444324444244452444624447244482444924450244512445224453244542445524456244572445824459244602446124462244632446424465244662446724468244692447024471244722447324474244752447624477244782447924480244812448224483244842448524486244872448824489244902449124492244932449424495244962449724498244992450024501245022450324504245052450624507245082450924510245112451224513245142451524516245172451824519245202452124522245232452424525245262452724528245292453024531245322453324534245352453624537245382453924540245412454224543245442454524546245472454824549245502455124552245532455424555245562455724558245592456024561245622456324564245652456624567245682456924570245712457224573245742457524576245772457824579245802458124582245832458424585245862458724588245892459024591245922459324594245952459624597245982459924600246012460224603246042460524606246072460824609246102461124612246132461424615246162461724618246192462024621246222462324624246252462624627246282462924630246312463224633246342463524636246372463824639246402464124642246432464424645246462464724648246492465024651246522465324654246552465624657246582465924660246612466224663246642466524666246672466824669246702467124672246732467424675246762467724678246792468024681246822468324684246852468624687246882468924690246912469224693246942469524696246972469824699247002470124702247032470424705247062470724708247092471024711247122471324714247152471624717247182471924720247212472224723247242472524726247272472824729247302473124732247332473424735247362473724738247392474024741247422474324744247452474624747247482474924750247512475224753247542475524756247572475824759247602476124762247632476424765247662476724768247692477024771247722477324774247752477624777247782477924780247812478224783247842478524786247872478824789247902479124792247932479424795247962479724798247992480024801248022480324804248052480624807248082480924810248112481224813248142481524816248172481824819248202482124822248232482424825248262482724828248292483024831248322483324834248352483624837248382483924840248412484224843248442484524846248472484824849248502485124852248532485424855248562485724858248592486024861248622486324864248652486624867248682486924870248712487224873248742487524876248772487824879248802488124882248832488424885248862488724888248892489024891248922489324894248952489624897248982489924900249012490224903249042490524906249072490824909249102491124912249132491424915249162491724918249192492024921249222492324924249252492624927249282492924930249312493224933249342493524936249372493824939249402494124942249432494424945249462494724948249492495024951249522495324954249552495624957249582495924960249612496224963249642496524966249672496824969249702497124972249732497424975249762497724978249792498024981249822498324984249852498624987249882498924990249912499224993249942499524996249972499824999250002500125002250032500425005250062500725008250092501025011250122501325014250152501625017250182501925020250212502225023250242502525026250272502825029250302503125032250332503425035250362503725038250392504025041250422504325044250452504625047250482504925050250512505225053250542505525056250572505825059250602506125062250632506425065250662506725068250692507025071250722507325074250752507625077250782507925080250812508225083250842508525086250872508825089250902509125092250932509425095250962509725098250992510025101251022510325104251052510625107251082510925110251112511225113251142511525116251172511825119251202512125122251232512425125251262512725128251292513025131251322513325134251352513625137251382513925140251412514225143251442514525146251472514825149251502515125152251532515425155251562515725158251592516025161251622516325164251652516625167251682516925170251712517225173251742517525176251772517825179251802518125182251832518425185251862518725188251892519025191251922519325194251952519625197251982519925200252012520225203252042520525206252072520825209252102521125212252132521425215252162521725218252192522025221252222522325224252252522625227252282522925230252312523225233252342523525236252372523825239252402524125242252432524425245252462524725248252492525025251252522525325254252552525625257252582525925260252612526225263252642526525266252672526825269252702527125272252732527425275252762527725278252792528025281252822528325284252852528625287252882528925290252912529225293252942529525296252972529825299253002530125302253032530425305253062530725308253092531025311253122531325314253152531625317253182531925320253212532225323253242532525326253272532825329253302533125332253332533425335253362533725338253392534025341253422534325344253452534625347253482534925350253512535225353253542535525356253572535825359253602536125362253632536425365253662536725368253692537025371253722537325374253752537625377253782537925380253812538225383253842538525386253872538825389253902539125392253932539425395253962539725398253992540025401254022540325404254052540625407254082540925410254112541225413254142541525416254172541825419254202542125422254232542425425254262542725428254292543025431254322543325434254352543625437254382543925440254412544225443254442544525446254472544825449254502545125452254532545425455254562545725458254592546025461254622546325464254652546625467254682546925470254712547225473254742547525476254772547825479254802548125482254832548425485254862548725488254892549025491254922549325494254952549625497254982549925500255012550225503255042550525506255072550825509255102551125512255132551425515255162551725518255192552025521255222552325524255252552625527255282552925530255312553225533255342553525536255372553825539255402554125542255432554425545255462554725548255492555025551255522555325554255552555625557255582555925560255612556225563255642556525566255672556825569255702557125572255732557425575255762557725578255792558025581255822558325584255852558625587255882558925590255912559225593255942559525596255972559825599256002560125602256032560425605256062560725608256092561025611256122561325614256152561625617256182561925620256212562225623256242562525626256272562825629256302563125632256332563425635256362563725638256392564025641256422564325644256452564625647256482564925650256512565225653256542565525656256572565825659256602566125662256632566425665256662566725668256692567025671256722567325674256752567625677256782567925680256812568225683256842568525686256872568825689256902569125692256932569425695256962569725698256992570025701257022570325704257052570625707257082570925710257112571225713257142571525716257172571825719257202572125722257232572425725257262572725728257292573025731257322573325734257352573625737257382573925740257412574225743257442574525746257472574825749257502575125752257532575425755257562575725758257592576025761257622576325764257652576625767257682576925770257712577225773257742577525776257772577825779257802578125782257832578425785257862578725788257892579025791257922579325794257952579625797257982579925800258012580225803258042580525806258072580825809258102581125812258132581425815258162581725818258192582025821258222582325824258252582625827258282582925830258312583225833258342583525836258372583825839258402584125842258432584425845258462584725848258492585025851258522585325854258552585625857258582585925860258612586225863258642586525866258672586825869258702587125872258732587425875258762587725878258792588025881258822588325884258852588625887258882588925890258912589225893258942589525896258972589825899259002590125902259032590425905259062590725908259092591025911259122591325914259152591625917259182591925920259212592225923259242592525926259272592825929259302593125932259332593425935259362593725938259392594025941259422594325944259452594625947259482594925950259512595225953259542595525956259572595825959259602596125962259632596425965259662596725968259692597025971259722597325974259752597625977259782597925980259812598225983259842598525986259872598825989259902599125992259932599425995259962599725998259992600026001260022600326004260052600626007260082600926010260112601226013260142601526016260172601826019260202602126022260232602426025260262602726028260292603026031260322603326034260352603626037260382603926040260412604226043260442604526046260472604826049260502605126052260532605426055260562605726058260592606026061260622606326064260652606626067260682606926070260712607226073260742607526076260772607826079260802608126082260832608426085260862608726088260892609026091260922609326094260952609626097260982609926100261012610226103261042610526106261072610826109261102611126112261132611426115261162611726118261192612026121261222612326124261252612626127261282612926130261312613226133261342613526136261372613826139261402614126142261432614426145261462614726148261492615026151261522615326154261552615626157261582615926160261612616226163261642616526166261672616826169261702617126172261732617426175261762617726178261792618026181261822618326184261852618626187261882618926190261912619226193261942619526196261972619826199262002620126202262032620426205262062620726208262092621026211262122621326214262152621626217262182621926220262212622226223262242622526226262272622826229262302623126232262332623426235262362623726238262392624026241262422624326244262452624626247262482624926250262512625226253262542625526256262572625826259262602626126262262632626426265262662626726268262692627026271262722627326274262752627626277262782627926280262812628226283262842628526286262872628826289262902629126292262932629426295262962629726298262992630026301263022630326304263052630626307263082630926310263112631226313263142631526316263172631826319263202632126322263232632426325263262632726328263292633026331263322633326334263352633626337263382633926340263412634226343263442634526346263472634826349263502635126352263532635426355263562635726358263592636026361263622636326364263652636626367263682636926370263712637226373263742637526376263772637826379263802638126382263832638426385263862638726388263892639026391263922639326394263952639626397263982639926400264012640226403264042640526406264072640826409264102641126412264132641426415264162641726418264192642026421264222642326424264252642626427264282642926430264312643226433264342643526436264372643826439264402644126442264432644426445264462644726448264492645026451264522645326454264552645626457264582645926460264612646226463264642646526466264672646826469264702647126472264732647426475264762647726478264792648026481264822648326484264852648626487264882648926490264912649226493264942649526496264972649826499265002650126502265032650426505265062650726508265092651026511265122651326514265152651626517265182651926520265212652226523265242652526526265272652826529265302653126532265332653426535265362653726538265392654026541265422654326544265452654626547265482654926550265512655226553265542655526556265572655826559265602656126562265632656426565265662656726568265692657026571265722657326574265752657626577265782657926580265812658226583265842658526586265872658826589265902659126592265932659426595265962659726598265992660026601266022660326604266052660626607266082660926610266112661226613266142661526616266172661826619266202662126622266232662426625266262662726628266292663026631266322663326634266352663626637266382663926640266412664226643266442664526646266472664826649266502665126652266532665426655266562665726658266592666026661266622666326664266652666626667266682666926670266712667226673266742667526676266772667826679266802668126682266832668426685266862668726688266892669026691266922669326694266952669626697266982669926700267012670226703267042670526706267072670826709267102671126712267132671426715267162671726718267192672026721267222672326724267252672626727267282672926730267312673226733267342673526736267372673826739267402674126742267432674426745267462674726748267492675026751267522675326754267552675626757267582675926760267612676226763267642676526766267672676826769267702677126772267732677426775267762677726778267792678026781267822678326784267852678626787267882678926790267912679226793267942679526796267972679826799268002680126802268032680426805268062680726808268092681026811268122681326814268152681626817268182681926820268212682226823268242682526826268272682826829268302683126832268332683426835268362683726838268392684026841268422684326844268452684626847268482684926850268512685226853268542685526856268572685826859268602686126862268632686426865268662686726868268692687026871268722687326874268752687626877268782687926880268812688226883268842688526886268872688826889268902689126892268932689426895268962689726898268992690026901269022690326904269052690626907269082690926910269112691226913269142691526916269172691826919269202692126922269232692426925269262692726928269292693026931269322693326934269352693626937269382693926940269412694226943269442694526946269472694826949269502695126952269532695426955269562695726958269592696026961269622696326964269652696626967269682696926970269712697226973269742697526976269772697826979269802698126982269832698426985269862698726988269892699026991269922699326994269952699626997269982699927000270012700227003270042700527006270072700827009270102701127012270132701427015270162701727018270192702027021270222702327024270252702627027270282702927030270312703227033270342703527036270372703827039270402704127042270432704427045270462704727048270492705027051270522705327054270552705627057270582705927060270612706227063270642706527066270672706827069270702707127072270732707427075270762707727078270792708027081270822708327084270852708627087270882708927090270912709227093270942709527096270972709827099271002710127102271032710427105271062710727108271092711027111271122711327114271152711627117271182711927120271212712227123271242712527126271272712827129271302713127132271332713427135271362713727138271392714027141271422714327144271452714627147271482714927150271512715227153271542715527156271572715827159271602716127162271632716427165271662716727168271692717027171271722717327174271752717627177271782717927180271812718227183271842718527186271872718827189271902719127192271932719427195271962719727198271992720027201272022720327204272052720627207272082720927210272112721227213272142721527216272172721827219272202722127222272232722427225272262722727228272292723027231272322723327234272352723627237272382723927240272412724227243272442724527246272472724827249272502725127252272532725427255272562725727258272592726027261272622726327264272652726627267272682726927270272712727227273272742727527276272772727827279272802728127282272832728427285272862728727288272892729027291272922729327294272952729627297272982729927300273012730227303273042730527306273072730827309273102731127312273132731427315273162731727318273192732027321273222732327324273252732627327273282732927330273312733227333273342733527336273372733827339273402734127342273432734427345273462734727348273492735027351273522735327354273552735627357273582735927360273612736227363273642736527366273672736827369273702737127372273732737427375273762737727378273792738027381273822738327384273852738627387273882738927390273912739227393273942739527396273972739827399274002740127402274032740427405274062740727408274092741027411274122741327414274152741627417274182741927420274212742227423274242742527426274272742827429274302743127432274332743427435274362743727438274392744027441274422744327444274452744627447274482744927450274512745227453274542745527456274572745827459274602746127462274632746427465274662746727468274692747027471274722747327474274752747627477274782747927480274812748227483274842748527486274872748827489274902749127492274932749427495274962749727498274992750027501275022750327504275052750627507275082750927510275112751227513275142751527516275172751827519275202752127522275232752427525275262752727528275292753027531275322753327534275352753627537275382753927540275412754227543275442754527546275472754827549275502755127552275532755427555275562755727558275592756027561275622756327564275652756627567275682756927570275712757227573275742757527576275772757827579275802758127582275832758427585275862758727588275892759027591275922759327594275952759627597275982759927600276012760227603276042760527606276072760827609276102761127612276132761427615276162761727618276192762027621276222762327624276252762627627276282762927630276312763227633276342763527636276372763827639276402764127642276432764427645276462764727648276492765027651276522765327654276552765627657276582765927660276612766227663276642766527666276672766827669276702767127672276732767427675276762767727678276792768027681276822768327684276852768627687276882768927690276912769227693276942769527696276972769827699277002770127702277032770427705277062770727708277092771027711277122771327714277152771627717277182771927720277212772227723277242772527726277272772827729277302773127732277332773427735277362773727738277392774027741277422774327744277452774627747277482774927750277512775227753277542775527756277572775827759277602776127762277632776427765277662776727768277692777027771277722777327774277752777627777277782777927780277812778227783277842778527786277872778827789277902779127792277932779427795277962779727798277992780027801278022780327804278052780627807278082780927810278112781227813278142781527816278172781827819278202782127822278232782427825278262782727828278292783027831278322783327834278352783627837278382783927840278412784227843278442784527846278472784827849278502785127852278532785427855278562785727858278592786027861278622786327864278652786627867278682786927870278712787227873278742787527876278772787827879278802788127882278832788427885278862788727888278892789027891278922789327894278952789627897278982789927900279012790227903279042790527906279072790827909279102791127912279132791427915279162791727918279192792027921279222792327924279252792627927279282792927930279312793227933279342793527936279372793827939279402794127942279432794427945279462794727948279492795027951279522795327954279552795627957279582795927960279612796227963279642796527966279672796827969279702797127972279732797427975279762797727978279792798027981279822798327984279852798627987279882798927990279912799227993279942799527996279972799827999280002800128002280032800428005280062800728008280092801028011280122801328014280152801628017280182801928020280212802228023280242802528026280272802828029280302803128032280332803428035280362803728038280392804028041280422804328044280452804628047280482804928050280512805228053280542805528056280572805828059280602806128062280632806428065280662806728068280692807028071280722807328074280752807628077280782807928080280812808228083280842808528086280872808828089280902809128092280932809428095280962809728098280992810028101281022810328104281052810628107281082810928110281112811228113281142811528116281172811828119281202812128122281232812428125281262812728128281292813028131281322813328134281352813628137281382813928140281412814228143281442814528146281472814828149281502815128152281532815428155281562815728158281592816028161281622816328164281652816628167281682816928170281712817228173281742817528176281772817828179281802818128182281832818428185281862818728188281892819028191281922819328194281952819628197281982819928200282012820228203282042820528206282072820828209282102821128212282132821428215282162821728218282192822028221282222822328224282252822628227282282822928230282312823228233282342823528236282372823828239282402824128242282432824428245282462824728248282492825028251282522825328254282552825628257282582825928260282612826228263282642826528266282672826828269282702827128272282732827428275282762827728278282792828028281282822828328284282852828628287282882828928290282912829228293282942829528296282972829828299283002830128302283032830428305283062830728308283092831028311283122831328314283152831628317283182831928320283212832228323283242832528326283272832828329283302833128332283332833428335283362833728338283392834028341283422834328344283452834628347283482834928350283512835228353283542835528356283572835828359283602836128362283632836428365283662836728368283692837028371283722837328374283752837628377283782837928380283812838228383283842838528386283872838828389283902839128392283932839428395283962839728398283992840028401284022840328404284052840628407284082840928410284112841228413284142841528416284172841828419284202842128422284232842428425284262842728428284292843028431284322843328434284352843628437284382843928440284412844228443284442844528446284472844828449284502845128452284532845428455284562845728458284592846028461284622846328464284652846628467284682846928470284712847228473284742847528476284772847828479284802848128482284832848428485284862848728488284892849028491284922849328494284952849628497284982849928500285012850228503285042850528506285072850828509285102851128512285132851428515285162851728518285192852028521285222852328524285252852628527285282852928530285312853228533285342853528536285372853828539285402854128542285432854428545285462854728548285492855028551285522855328554285552855628557285582855928560285612856228563285642856528566285672856828569285702857128572285732857428575285762857728578285792858028581285822858328584285852858628587285882858928590285912859228593285942859528596285972859828599286002860128602286032860428605286062860728608286092861028611286122861328614286152861628617286182861928620286212862228623286242862528626286272862828629286302863128632286332863428635286362863728638286392864028641286422864328644286452864628647286482864928650286512865228653286542865528656286572865828659286602866128662286632866428665286662866728668286692867028671286722867328674286752867628677286782867928680286812868228683286842868528686286872868828689286902869128692286932869428695286962869728698286992870028701287022870328704287052870628707287082870928710287112871228713287142871528716287172871828719287202872128722287232872428725287262872728728287292873028731287322873328734287352873628737287382873928740287412874228743287442874528746287472874828749287502875128752287532875428755287562875728758287592876028761287622876328764287652876628767287682876928770287712877228773287742877528776287772877828779287802878128782287832878428785287862878728788287892879028791287922879328794287952879628797287982879928800288012880228803288042880528806288072880828809288102881128812288132881428815288162881728818288192882028821288222882328824288252882628827288282882928830288312883228833288342883528836288372883828839288402884128842288432884428845288462884728848288492885028851288522885328854288552885628857288582885928860288612886228863288642886528866288672886828869288702887128872288732887428875288762887728878288792888028881288822888328884288852888628887288882888928890288912889228893288942889528896288972889828899289002890128902289032890428905289062890728908289092891028911289122891328914289152891628917289182891928920289212892228923289242892528926289272892828929289302893128932289332893428935289362893728938289392894028941289422894328944289452894628947289482894928950289512895228953289542895528956289572895828959289602896128962289632896428965289662896728968289692897028971289722897328974289752897628977289782897928980289812898228983289842898528986289872898828989289902899128992289932899428995289962899728998289992900029001290022900329004290052900629007290082900929010290112901229013290142901529016290172901829019290202902129022290232902429025290262902729028290292903029031290322903329034290352903629037290382903929040290412904229043290442904529046290472904829049290502905129052290532905429055290562905729058290592906029061290622906329064290652906629067290682906929070290712907229073290742907529076290772907829079290802908129082290832908429085290862908729088290892909029091290922909329094290952909629097290982909929100291012910229103291042910529106291072910829109291102911129112291132911429115291162911729118291192912029121291222912329124291252912629127291282912929130291312913229133291342913529136291372913829139291402914129142291432914429145291462914729148291492915029151291522915329154291552915629157291582915929160291612916229163291642916529166291672916829169291702917129172291732917429175291762917729178291792918029181291822918329184291852918629187291882918929190291912919229193291942919529196291972919829199292002920129202292032920429205292062920729208292092921029211292122921329214292152921629217292182921929220292212922229223292242922529226292272922829229292302923129232292332923429235292362923729238292392924029241292422924329244292452924629247292482924929250292512925229253292542925529256292572925829259292602926129262292632926429265292662926729268292692927029271292722927329274292752927629277292782927929280292812928229283292842928529286292872928829289292902929129292292932929429295292962929729298292992930029301293022930329304293052930629307293082930929310293112931229313293142931529316293172931829319293202932129322293232932429325293262932729328293292933029331293322933329334293352933629337293382933929340293412934229343293442934529346293472934829349293502935129352293532935429355293562935729358293592936029361293622936329364293652936629367293682936929370293712937229373293742937529376293772937829379293802938129382293832938429385293862938729388293892939029391293922939329394293952939629397293982939929400294012940229403294042940529406294072940829409294102941129412294132941429415294162941729418294192942029421294222942329424294252942629427294282942929430294312943229433294342943529436294372943829439294402944129442294432944429445294462944729448294492945029451294522945329454294552945629457294582945929460294612946229463294642946529466294672946829469294702947129472294732947429475294762947729478294792948029481294822948329484294852948629487294882948929490294912949229493294942949529496294972949829499295002950129502295032950429505295062950729508295092951029511295122951329514295152951629517295182951929520295212952229523295242952529526295272952829529295302953129532295332953429535295362953729538295392954029541295422954329544295452954629547295482954929550295512955229553295542955529556295572955829559295602956129562295632956429565295662956729568295692957029571295722957329574295752957629577295782957929580295812958229583295842958529586295872958829589295902959129592295932959429595295962959729598295992960029601296022960329604296052960629607296082960929610296112961229613296142961529616296172961829619296202962129622296232962429625296262962729628296292963029631296322963329634296352963629637296382963929640296412964229643296442964529646296472964829649296502965129652296532965429655296562965729658296592966029661296622966329664296652966629667296682966929670296712967229673296742967529676296772967829679296802968129682296832968429685296862968729688296892969029691296922969329694296952969629697296982969929700297012970229703297042970529706297072970829709297102971129712297132971429715297162971729718297192972029721297222972329724297252972629727297282972929730297312973229733297342973529736297372973829739297402974129742297432974429745297462974729748297492975029751297522975329754297552975629757297582975929760297612976229763297642976529766297672976829769297702977129772297732977429775297762977729778297792978029781297822978329784297852978629787297882978929790297912979229793297942979529796297972979829799298002980129802298032980429805298062980729808298092981029811298122981329814298152981629817298182981929820298212982229823298242982529826298272982829829298302983129832298332983429835298362983729838298392984029841298422984329844298452984629847298482984929850298512985229853298542985529856298572985829859298602986129862298632986429865298662986729868298692987029871298722987329874298752987629877298782987929880298812988229883298842988529886298872988829889298902989129892298932989429895298962989729898298992990029901299022990329904299052990629907299082990929910299112991229913299142991529916299172991829919299202992129922299232992429925299262992729928299292993029931299322993329934299352993629937299382993929940299412994229943299442994529946299472994829949299502995129952299532995429955299562995729958299592996029961299622996329964299652996629967299682996929970299712997229973299742997529976299772997829979299802998129982299832998429985299862998729988299892999029991299922999329994299952999629997299982999930000300013000230003300043000530006300073000830009300103001130012300133001430015300163001730018300193002030021300223002330024300253002630027300283002930030300313003230033300343003530036300373003830039300403004130042300433004430045300463004730048300493005030051300523005330054300553005630057300583005930060300613006230063300643006530066300673006830069300703007130072300733007430075300763007730078300793008030081300823008330084300853008630087300883008930090300913009230093300943009530096300973009830099301003010130102301033010430105301063010730108301093011030111301123011330114301153011630117301183011930120301213012230123301243012530126301273012830129301303013130132301333013430135301363013730138301393014030141301423014330144301453014630147301483014930150301513015230153301543015530156301573015830159301603016130162301633016430165301663016730168301693017030171301723017330174301753017630177301783017930180301813018230183301843018530186301873018830189301903019130192301933019430195301963019730198301993020030201302023020330204302053020630207302083020930210302113021230213302143021530216302173021830219302203022130222302233022430225302263022730228302293023030231302323023330234302353023630237302383023930240302413024230243302443024530246302473024830249302503025130252302533025430255302563025730258302593026030261302623026330264302653026630267302683026930270302713027230273302743027530276302773027830279302803028130282302833028430285302863028730288302893029030291302923029330294302953029630297302983029930300303013030230303303043030530306303073030830309303103031130312303133031430315303163031730318303193032030321303223032330324303253032630327303283032930330303313033230333303343033530336303373033830339303403034130342303433034430345303463034730348303493035030351303523035330354303553035630357303583035930360303613036230363303643036530366303673036830369303703037130372303733037430375303763037730378303793038030381303823038330384303853038630387303883038930390303913039230393303943039530396303973039830399304003040130402304033040430405304063040730408304093041030411304123041330414304153041630417304183041930420304213042230423304243042530426304273042830429304303043130432304333043430435304363043730438304393044030441304423044330444304453044630447304483044930450304513045230453304543045530456304573045830459304603046130462304633046430465304663046730468304693047030471304723047330474304753047630477304783047930480304813048230483304843048530486304873048830489304903049130492304933049430495304963049730498304993050030501305023050330504305053050630507305083050930510305113051230513305143051530516305173051830519305203052130522305233052430525305263052730528305293053030531305323053330534305353053630537305383053930540305413054230543305443054530546305473054830549305503055130552305533055430555305563055730558305593056030561305623056330564305653056630567305683056930570305713057230573305743057530576305773057830579305803058130582305833058430585305863058730588305893059030591305923059330594305953059630597305983059930600306013060230603306043060530606306073060830609306103061130612306133061430615306163061730618306193062030621306223062330624306253062630627306283062930630306313063230633306343063530636306373063830639306403064130642306433064430645306463064730648306493065030651306523065330654306553065630657306583065930660306613066230663306643066530666306673066830669306703067130672306733067430675306763067730678306793068030681306823068330684306853068630687306883068930690306913069230693306943069530696306973069830699307003070130702307033070430705307063070730708307093071030711307123071330714307153071630717307183071930720307213072230723307243072530726307273072830729307303073130732307333073430735307363073730738307393074030741307423074330744307453074630747307483074930750307513075230753307543075530756307573075830759307603076130762307633076430765307663076730768307693077030771307723077330774307753077630777307783077930780307813078230783307843078530786307873078830789307903079130792307933079430795307963079730798307993080030801308023080330804308053080630807308083080930810308113081230813308143081530816308173081830819308203082130822308233082430825308263082730828308293083030831308323083330834308353083630837308383083930840308413084230843308443084530846308473084830849308503085130852308533085430855308563085730858308593086030861308623086330864308653086630867308683086930870308713087230873308743087530876308773087830879308803088130882308833088430885308863088730888308893089030891308923089330894308953089630897308983089930900309013090230903309043090530906309073090830909309103091130912309133091430915309163091730918309193092030921309223092330924309253092630927309283092930930309313093230933309343093530936309373093830939309403094130942309433094430945309463094730948309493095030951309523095330954309553095630957309583095930960309613096230963309643096530966309673096830969309703097130972309733097430975309763097730978309793098030981309823098330984309853098630987309883098930990309913099230993309943099530996309973099830999310003100131002310033100431005310063100731008310093101031011310123101331014310153101631017310183101931020310213102231023310243102531026310273102831029310303103131032310333103431035310363103731038310393104031041310423104331044310453104631047310483104931050310513105231053310543105531056310573105831059310603106131062310633106431065310663106731068310693107031071310723107331074310753107631077310783107931080310813108231083310843108531086310873108831089310903109131092310933109431095310963109731098310993110031101311023110331104311053110631107311083110931110311113111231113311143111531116311173111831119311203112131122311233112431125311263112731128311293113031131311323113331134311353113631137311383113931140311413114231143311443114531146311473114831149311503115131152311533115431155311563115731158311593116031161311623116331164311653116631167311683116931170311713117231173311743117531176311773117831179311803118131182311833118431185311863118731188311893119031191311923119331194311953119631197311983119931200312013120231203312043120531206312073120831209312103121131212312133121431215312163121731218312193122031221312223122331224312253122631227312283122931230312313123231233312343123531236312373123831239312403124131242312433124431245312463124731248312493125031251312523125331254312553125631257312583125931260312613126231263312643126531266312673126831269312703127131272312733127431275312763127731278312793128031281312823128331284312853128631287312883128931290312913129231293312943129531296312973129831299313003130131302313033130431305313063130731308313093131031311313123131331314313153131631317313183131931320313213132231323313243132531326313273132831329313303133131332313333133431335313363133731338313393134031341313423134331344313453134631347313483134931350313513135231353313543135531356313573135831359313603136131362313633136431365313663136731368313693137031371313723137331374313753137631377313783137931380313813138231383313843138531386313873138831389313903139131392313933139431395313963139731398313993140031401314023140331404314053140631407314083140931410314113141231413314143141531416314173141831419314203142131422314233142431425314263142731428314293143031431314323143331434314353143631437314383143931440314413144231443314443144531446314473144831449314503145131452314533145431455314563145731458314593146031461314623146331464314653146631467314683146931470314713147231473314743147531476314773147831479314803148131482314833148431485314863148731488314893149031491314923149331494314953149631497314983149931500315013150231503315043150531506315073150831509315103151131512315133151431515315163151731518315193152031521315223152331524315253152631527315283152931530315313153231533315343153531536315373153831539315403154131542315433154431545315463154731548315493155031551315523155331554315553155631557315583155931560315613156231563315643156531566315673156831569315703157131572315733157431575315763157731578315793158031581315823158331584315853158631587315883158931590315913159231593315943159531596315973159831599316003160131602316033160431605316063160731608316093161031611316123161331614316153161631617316183161931620316213162231623316243162531626316273162831629316303163131632316333163431635316363163731638316393164031641316423164331644316453164631647316483164931650316513165231653316543165531656316573165831659316603166131662316633166431665316663166731668316693167031671316723167331674316753167631677316783167931680316813168231683316843168531686316873168831689316903169131692316933169431695316963169731698316993170031701317023170331704317053170631707317083170931710317113171231713317143171531716317173171831719317203172131722317233172431725317263172731728317293173031731317323173331734317353173631737317383173931740317413174231743317443174531746317473174831749317503175131752317533175431755317563175731758317593176031761317623176331764317653176631767317683176931770317713177231773317743177531776317773177831779317803178131782317833178431785317863178731788317893179031791317923179331794317953179631797317983179931800318013180231803318043180531806318073180831809318103181131812318133181431815318163181731818318193182031821318223182331824318253182631827318283182931830318313183231833318343183531836318373183831839318403184131842318433184431845318463184731848318493185031851318523185331854318553185631857318583185931860318613186231863318643186531866318673186831869318703187131872318733187431875318763187731878318793188031881318823188331884318853188631887318883188931890318913189231893318943189531896318973189831899319003190131902319033190431905319063190731908319093191031911319123191331914319153191631917319183191931920319213192231923319243192531926319273192831929319303193131932319333193431935319363193731938319393194031941319423194331944319453194631947319483194931950319513195231953319543195531956319573195831959319603196131962319633196431965319663196731968319693197031971319723197331974319753197631977319783197931980319813198231983319843198531986319873198831989319903199131992319933199431995319963199731998319993200032001320023200332004320053200632007320083200932010320113201232013320143201532016320173201832019320203202132022320233202432025320263202732028320293203032031320323203332034320353203632037320383203932040320413204232043320443204532046320473204832049320503205132052320533205432055320563205732058320593206032061320623206332064320653206632067320683206932070320713207232073320743207532076320773207832079320803208132082320833208432085320863208732088320893209032091320923209332094320953209632097320983209932100321013210232103321043210532106321073210832109321103211132112321133211432115321163211732118321193212032121321223212332124321253212632127321283212932130321313213232133321343213532136321373213832139321403214132142321433214432145321463214732148321493215032151321523215332154321553215632157321583215932160321613216232163321643216532166321673216832169321703217132172321733217432175321763217732178321793218032181321823218332184321853218632187321883218932190321913219232193321943219532196321973219832199322003220132202322033220432205322063220732208322093221032211322123221332214322153221632217322183221932220322213222232223322243222532226322273222832229322303223132232322333223432235322363223732238322393224032241322423224332244322453224632247322483224932250322513225232253322543225532256322573225832259322603226132262322633226432265322663226732268322693227032271322723227332274322753227632277322783227932280322813228232283322843228532286322873228832289322903229132292322933229432295322963229732298322993230032301323023230332304323053230632307323083230932310323113231232313323143231532316323173231832319323203232132322323233232432325323263232732328323293233032331323323233332334323353233632337323383233932340323413234232343323443234532346323473234832349323503235132352323533235432355323563235732358323593236032361323623236332364323653236632367323683236932370323713237232373323743237532376323773237832379323803238132382323833238432385323863238732388323893239032391323923239332394323953239632397323983239932400324013240232403324043240532406324073240832409324103241132412324133241432415324163241732418324193242032421324223242332424324253242632427324283242932430324313243232433324343243532436324373243832439324403244132442324433244432445324463244732448324493245032451324523245332454324553245632457324583245932460324613246232463324643246532466324673246832469324703247132472324733247432475324763247732478324793248032481324823248332484324853248632487324883248932490324913249232493324943249532496324973249832499325003250132502325033250432505325063250732508325093251032511325123251332514325153251632517325183251932520325213252232523325243252532526325273252832529325303253132532325333253432535325363253732538325393254032541325423254332544325453254632547325483254932550325513255232553325543255532556325573255832559325603256132562325633256432565325663256732568325693257032571325723257332574325753257632577325783257932580325813258232583325843258532586325873258832589325903259132592325933259432595325963259732598325993260032601326023260332604326053260632607326083260932610326113261232613326143261532616326173261832619326203262132622326233262432625326263262732628326293263032631326323263332634326353263632637326383263932640326413264232643326443264532646326473264832649326503265132652326533265432655326563265732658326593266032661326623266332664326653266632667326683266932670326713267232673326743267532676326773267832679326803268132682326833268432685326863268732688326893269032691326923269332694326953269632697326983269932700327013270232703327043270532706327073270832709327103271132712327133271432715327163271732718327193272032721327223272332724327253272632727327283272932730327313273232733327343273532736327373273832739327403274132742327433274432745327463274732748327493275032751327523275332754327553275632757327583275932760327613276232763327643276532766327673276832769327703277132772327733277432775327763277732778327793278032781327823278332784327853278632787327883278932790327913279232793327943279532796327973279832799328003280132802328033280432805328063280732808328093281032811328123281332814328153281632817328183281932820328213282232823328243282532826328273282832829328303283132832328333283432835328363283732838328393284032841328423284332844328453284632847328483284932850328513285232853328543285532856328573285832859328603286132862328633286432865328663286732868328693287032871328723287332874328753287632877328783287932880328813288232883328843288532886328873288832889328903289132892328933289432895328963289732898328993290032901329023290332904329053290632907329083290932910329113291232913329143291532916329173291832919329203292132922329233292432925329263292732928329293293032931329323293332934329353293632937329383293932940329413294232943329443294532946329473294832949329503295132952329533295432955329563295732958329593296032961329623296332964329653296632967329683296932970329713297232973329743297532976329773297832979329803298132982329833298432985329863298732988329893299032991329923299332994329953299632997329983299933000330013300233003330043300533006330073300833009330103301133012330133301433015330163301733018330193302033021330223302333024330253302633027330283302933030330313303233033330343303533036330373303833039330403304133042330433304433045330463304733048330493305033051330523305333054330553305633057330583305933060330613306233063330643306533066330673306833069330703307133072330733307433075330763307733078330793308033081330823308333084330853308633087330883308933090330913309233093330943309533096330973309833099331003310133102331033310433105331063310733108331093311033111331123311333114331153311633117331183311933120331213312233123331243312533126331273312833129331303313133132331333313433135331363313733138331393314033141331423314333144331453314633147331483314933150331513315233153331543315533156331573315833159331603316133162331633316433165331663316733168331693317033171331723317333174331753317633177331783317933180331813318233183331843318533186331873318833189331903319133192331933319433195331963319733198331993320033201332023320333204332053320633207332083320933210332113321233213332143321533216332173321833219332203322133222332233322433225332263322733228332293323033231332323323333234332353323633237332383323933240332413324233243332443324533246332473324833249332503325133252332533325433255332563325733258332593326033261332623326333264332653326633267332683326933270332713327233273332743327533276332773327833279332803328133282332833328433285332863328733288332893329033291332923329333294332953329633297332983329933300333013330233303333043330533306333073330833309333103331133312333133331433315333163331733318333193332033321333223332333324333253332633327333283332933330333313333233333333343333533336333373333833339333403334133342333433334433345333463334733348333493335033351333523335333354333553335633357333583335933360333613336233363333643336533366333673336833369333703337133372333733337433375333763337733378333793338033381333823338333384333853338633387333883338933390333913339233393333943339533396333973339833399334003340133402334033340433405334063340733408334093341033411334123341333414334153341633417334183341933420334213342233423334243342533426334273342833429334303343133432334333343433435334363343733438334393344033441334423344333444334453344633447334483344933450334513345233453334543345533456334573345833459334603346133462334633346433465334663346733468334693347033471334723347333474334753347633477334783347933480334813348233483334843348533486334873348833489334903349133492334933349433495334963349733498334993350033501335023350333504335053350633507335083350933510335113351233513335143351533516335173351833519335203352133522335233352433525335263352733528335293353033531335323353333534335353353633537335383353933540335413354233543335443354533546335473354833549335503355133552335533355433555335563355733558335593356033561335623356333564335653356633567335683356933570335713357233573335743357533576335773357833579335803358133582335833358433585335863358733588335893359033591335923359333594335953359633597335983359933600336013360233603336043360533606336073360833609336103361133612336133361433615336163361733618336193362033621336223362333624336253362633627336283362933630336313363233633336343363533636336373363833639336403364133642336433364433645336463364733648336493365033651336523365333654336553365633657336583365933660336613366233663336643366533666336673366833669336703367133672336733367433675336763367733678336793368033681336823368333684336853368633687336883368933690336913369233693336943369533696336973369833699337003370133702337033370433705337063370733708337093371033711337123371333714337153371633717337183371933720337213372233723337243372533726337273372833729337303373133732337333373433735337363373733738337393374033741337423374333744337453374633747337483374933750337513375233753337543375533756337573375833759337603376133762337633376433765337663376733768337693377033771337723377333774337753377633777337783377933780337813378233783337843378533786337873378833789337903379133792337933379433795337963379733798337993380033801338023380333804338053380633807338083380933810338113381233813338143381533816338173381833819338203382133822338233382433825338263382733828338293383033831338323383333834338353383633837338383383933840338413384233843338443384533846338473384833849338503385133852338533385433855338563385733858338593386033861338623386333864338653386633867338683386933870338713387233873338743387533876338773387833879338803388133882338833388433885338863388733888338893389033891338923389333894338953389633897338983389933900339013390233903339043390533906339073390833909339103391133912339133391433915339163391733918339193392033921339223392333924339253392633927339283392933930339313393233933339343393533936339373393833939339403394133942339433394433945339463394733948339493395033951339523395333954339553395633957339583395933960339613396233963339643396533966339673396833969339703397133972339733397433975339763397733978339793398033981339823398333984339853398633987339883398933990339913399233993339943399533996339973399833999340003400134002340033400434005340063400734008340093401034011340123401334014340153401634017340183401934020340213402234023340243402534026340273402834029340303403134032340333403434035340363403734038340393404034041340423404334044340453404634047340483404934050340513405234053340543405534056340573405834059340603406134062340633406434065340663406734068340693407034071340723407334074340753407634077340783407934080340813408234083340843408534086340873408834089340903409134092340933409434095340963409734098340993410034101341023410334104341053410634107341083410934110341113411234113341143411534116341173411834119341203412134122341233412434125341263412734128341293413034131341323413334134341353413634137341383413934140341413414234143341443414534146341473414834149341503415134152341533415434155341563415734158341593416034161341623416334164341653416634167341683416934170341713417234173341743417534176341773417834179341803418134182341833418434185341863418734188341893419034191341923419334194341953419634197341983419934200342013420234203342043420534206342073420834209342103421134212342133421434215342163421734218342193422034221342223422334224342253422634227342283422934230342313423234233342343423534236342373423834239342403424134242342433424434245342463424734248342493425034251342523425334254342553425634257342583425934260342613426234263342643426534266342673426834269342703427134272342733427434275342763427734278342793428034281342823428334284342853428634287342883428934290342913429234293342943429534296342973429834299343003430134302343033430434305343063430734308343093431034311343123431334314343153431634317343183431934320343213432234323343243432534326343273432834329343303433134332343333433434335343363433734338343393434034341343423434334344343453434634347343483434934350343513435234353343543435534356343573435834359343603436134362343633436434365343663436734368343693437034371343723437334374343753437634377343783437934380343813438234383343843438534386343873438834389343903439134392343933439434395343963439734398343993440034401344023440334404344053440634407344083440934410344113441234413344143441534416344173441834419344203442134422344233442434425344263442734428344293443034431344323443334434344353443634437344383443934440344413444234443344443444534446344473444834449344503445134452344533445434455344563445734458344593446034461344623446334464344653446634467344683446934470344713447234473344743447534476344773447834479344803448134482344833448434485344863448734488344893449034491344923449334494344953449634497344983449934500345013450234503345043450534506345073450834509345103451134512345133451434515345163451734518345193452034521345223452334524345253452634527345283452934530345313453234533345343453534536345373453834539345403454134542345433454434545345463454734548345493455034551345523455334554345553455634557345583455934560345613456234563345643456534566345673456834569345703457134572345733457434575345763457734578345793458034581345823458334584345853458634587345883458934590345913459234593345943459534596345973459834599346003460134602346033460434605346063460734608346093461034611346123461334614346153461634617346183461934620346213462234623346243462534626346273462834629346303463134632346333463434635346363463734638346393464034641346423464334644346453464634647346483464934650346513465234653346543465534656346573465834659346603466134662346633466434665346663466734668346693467034671346723467334674346753467634677346783467934680346813468234683346843468534686346873468834689346903469134692346933469434695346963469734698346993470034701347023470334704347053470634707347083470934710347113471234713347143471534716347173471834719347203472134722347233472434725347263472734728347293473034731347323473334734347353473634737347383473934740347413474234743347443474534746347473474834749347503475134752347533475434755347563475734758347593476034761347623476334764347653476634767347683476934770347713477234773347743477534776347773477834779347803478134782347833478434785347863478734788347893479034791347923479334794347953479634797347983479934800348013480234803348043480534806348073480834809348103481134812348133481434815348163481734818348193482034821348223482334824348253482634827348283482934830348313483234833348343483534836348373483834839348403484134842348433484434845348463484734848348493485034851348523485334854348553485634857348583485934860348613486234863348643486534866348673486834869348703487134872348733487434875348763487734878348793488034881348823488334884348853488634887348883488934890348913489234893348943489534896348973489834899349003490134902349033490434905349063490734908349093491034911349123491334914349153491634917349183491934920349213492234923349243492534926349273492834929349303493134932349333493434935349363493734938349393494034941349423494334944349453494634947349483494934950349513495234953349543495534956349573495834959349603496134962349633496434965349663496734968349693497034971349723497334974349753497634977349783497934980349813498234983349843498534986349873498834989349903499134992349933499434995349963499734998349993500035001350023500335004350053500635007350083500935010350113501235013350143501535016350173501835019350203502135022350233502435025350263502735028350293503035031350323503335034350353503635037350383503935040350413504235043350443504535046350473504835049350503505135052350533505435055350563505735058350593506035061350623506335064350653506635067350683506935070350713507235073350743507535076350773507835079350803508135082350833508435085350863508735088350893509035091350923509335094350953509635097350983509935100351013510235103351043510535106351073510835109351103511135112351133511435115351163511735118351193512035121351223512335124351253512635127351283512935130351313513235133351343513535136351373513835139351403514135142351433514435145351463514735148351493515035151351523515335154351553515635157351583515935160351613516235163351643516535166351673516835169351703517135172351733517435175351763517735178351793518035181351823518335184351853518635187351883518935190351913519235193351943519535196351973519835199352003520135202352033520435205352063520735208352093521035211352123521335214352153521635217352183521935220352213522235223352243522535226352273522835229352303523135232352333523435235352363523735238352393524035241352423524335244352453524635247352483524935250352513525235253352543525535256352573525835259352603526135262352633526435265352663526735268352693527035271352723527335274352753527635277352783527935280352813528235283352843528535286352873528835289352903529135292352933529435295352963529735298352993530035301353023530335304353053530635307353083530935310353113531235313353143531535316353173531835319353203532135322353233532435325353263532735328353293533035331353323533335334353353533635337353383533935340353413534235343353443534535346353473534835349353503535135352353533535435355353563535735358353593536035361353623536335364353653536635367353683536935370353713537235373353743537535376353773537835379353803538135382353833538435385353863538735388353893539035391353923539335394353953539635397353983539935400354013540235403354043540535406354073540835409354103541135412354133541435415354163541735418354193542035421354223542335424354253542635427354283542935430354313543235433354343543535436354373543835439354403544135442354433544435445354463544735448354493545035451354523545335454354553545635457354583545935460354613546235463354643546535466354673546835469354703547135472354733547435475354763547735478354793548035481354823548335484354853548635487354883548935490354913549235493354943549535496354973549835499355003550135502355033550435505355063550735508355093551035511355123551335514355153551635517355183551935520355213552235523355243552535526355273552835529355303553135532355333553435535355363553735538355393554035541355423554335544355453554635547355483554935550355513555235553355543555535556355573555835559355603556135562355633556435565355663556735568355693557035571355723557335574355753557635577355783557935580355813558235583355843558535586355873558835589355903559135592355933559435595355963559735598355993560035601356023560335604356053560635607356083560935610356113561235613356143561535616356173561835619356203562135622356233562435625356263562735628356293563035631356323563335634356353563635637356383563935640356413564235643356443564535646356473564835649356503565135652356533565435655356563565735658356593566035661356623566335664356653566635667356683566935670356713567235673356743567535676356773567835679356803568135682356833568435685356863568735688356893569035691356923569335694356953569635697356983569935700357013570235703357043570535706357073570835709357103571135712357133571435715357163571735718357193572035721357223572335724357253572635727357283572935730357313573235733357343573535736357373573835739357403574135742357433574435745357463574735748357493575035751357523575335754357553575635757357583575935760357613576235763357643576535766357673576835769357703577135772357733577435775357763577735778357793578035781357823578335784357853578635787357883578935790357913579235793357943579535796357973579835799358003580135802358033580435805358063580735808358093581035811358123581335814358153581635817358183581935820358213582235823358243582535826358273582835829358303583135832358333583435835358363583735838358393584035841358423584335844358453584635847358483584935850358513585235853358543585535856358573585835859358603586135862358633586435865358663586735868358693587035871358723587335874358753587635877358783587935880358813588235883358843588535886358873588835889358903589135892358933589435895358963589735898358993590035901359023590335904359053590635907359083590935910359113591235913359143591535916359173591835919359203592135922359233592435925359263592735928359293593035931359323593335934359353593635937359383593935940359413594235943359443594535946359473594835949359503595135952359533595435955359563595735958359593596035961359623596335964359653596635967359683596935970359713597235973359743597535976359773597835979359803598135982359833598435985359863598735988359893599035991359923599335994359953599635997359983599936000360013600236003360043600536006360073600836009360103601136012360133601436015360163601736018360193602036021360223602336024360253602636027360283602936030360313603236033360343603536036360373603836039360403604136042360433604436045360463604736048360493605036051360523605336054360553605636057360583605936060360613606236063360643606536066360673606836069360703607136072360733607436075360763607736078360793608036081360823608336084360853608636087360883608936090360913609236093360943609536096360973609836099361003610136102361033610436105361063610736108361093611036111361123611336114361153611636117361183611936120361213612236123361243612536126361273612836129361303613136132361333613436135361363613736138361393614036141361423614336144361453614636147361483614936150361513615236153361543615536156361573615836159361603616136162361633616436165361663616736168361693617036171361723617336174361753617636177361783617936180361813618236183361843618536186361873618836189361903619136192361933619436195361963619736198361993620036201362023620336204362053620636207362083620936210362113621236213362143621536216362173621836219362203622136222362233622436225362263622736228362293623036231362323623336234362353623636237362383623936240362413624236243362443624536246362473624836249362503625136252362533625436255362563625736258362593626036261362623626336264362653626636267362683626936270362713627236273362743627536276362773627836279362803628136282362833628436285362863628736288362893629036291362923629336294362953629636297362983629936300363013630236303363043630536306363073630836309363103631136312363133631436315363163631736318363193632036321363223632336324363253632636327363283632936330363313633236333363343633536336363373633836339363403634136342363433634436345363463634736348363493635036351363523635336354363553635636357363583635936360363613636236363363643636536366363673636836369363703637136372363733637436375363763637736378363793638036381363823638336384363853638636387363883638936390363913639236393363943639536396363973639836399364003640136402364033640436405364063640736408364093641036411364123641336414364153641636417364183641936420364213642236423
  1. // Aliyun OSS SDK for JavaScript v6.17.1
  2. // Copyright Aliyun.com, Inc. or its affiliates. All Rights Reserved.
  3. // License at https://github.com/ali-sdk/ali-oss/blob/master/LICENSE
  4. (function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.OSS = f()}})(function(){var define,module,exports;return (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){
  5. "use strict";
  6. var OSS = require('./browser/client');
  7. OSS.Buffer = require('buffer').Buffer;
  8. OSS.urllib = require('../shims/xhr');
  9. OSS.version = require('./browser/version').version;
  10. module.exports = OSS;
  11. },{"../shims/xhr":407,"./browser/client":3,"./browser/version":6,"buffer":85}],2:[function(require,module,exports){
  12. "use strict";
  13. var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
  14. var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
  15. var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
  16. require("core-js/modules/es.object.to-string.js");
  17. require("core-js/modules/web.dom-collections.for-each.js");
  18. require("core-js/modules/es.object.keys.js");
  19. require("core-js/modules/es.array.slice.js");
  20. var assert = require('assert');
  21. var _require = require('../common/utils/checkBucketName'),
  22. _checkBucketName = _require.checkBucketName;
  23. var proto = exports;
  24. function isArray(arr) {
  25. if (Array.isArray) return Array.isArray(arr);
  26. return Object.prototype.toString.call(arr) === '[object Array]';
  27. }
  28. function toArray(obj) {
  29. if (!obj) return [];
  30. if (isArray(obj)) return obj;
  31. return [obj];
  32. }
  33. /**
  34. * Bucket opertaions
  35. */
  36. // TODO: OSS server currently do not support CORS requests for bucket operations
  37. // proto.listBuckets = function* listBuckets(query, options) {
  38. // // prefix, marker, max-keys
  39. // var result = yield this.request({
  40. // method: 'GET',
  41. // query: query,
  42. // timeout: options && options.timeout,
  43. // ctx: options && options.ctx,
  44. // });
  45. //
  46. // if (result.status === 200) {
  47. // var data = yield this.parseXML(result.data);
  48. // var buckets = data.Buckets || null;
  49. // if (buckets) {
  50. // if (buckets.Bucket) {
  51. // buckets = buckets.Bucket;
  52. // }
  53. // if (!isArray(buckets)) {
  54. // buckets = [buckets];
  55. // }
  56. // buckets = buckets.map(function (item) {
  57. // return {
  58. // name: item.Name,
  59. // region: item.Location,
  60. // creationDate: item.CreationDate,
  61. // };
  62. // });
  63. // }
  64. // return {
  65. // buckets: buckets,
  66. // owner: {
  67. // id: data.Owner.ID,
  68. // displayName: data.Owner.DisplayName,
  69. // },
  70. // isTruncated: data.IsTruncated === 'true',
  71. // nextMarker: data.NextMarker || null,
  72. // res: result.res
  73. // };
  74. // }
  75. //
  76. // throw yield this.requestError(result);
  77. // };
  78. proto.useBucket = function useBucket(name) {
  79. _checkBucketName(name);
  80. this.options.bucket = name;
  81. return this;
  82. };
  83. proto.setBucket = function useBucket(name) {
  84. _checkBucketName(name);
  85. this.options.bucket = name;
  86. return this;
  87. };
  88. proto.getBucket = function getBucket() {
  89. return this.options.bucket;
  90. };
  91. proto.deleteBucket = /*#__PURE__*/function () {
  92. var _deleteBucket = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(name, options) {
  93. var params, result;
  94. return _regenerator.default.wrap(function _callee$(_context) {
  95. while (1) {
  96. switch (_context.prev = _context.next) {
  97. case 0:
  98. params = this._bucketRequestParams('DELETE', name, '', options);
  99. _context.next = 3;
  100. return this.request(params);
  101. case 3:
  102. result = _context.sent;
  103. if (!(result.status === 200 || result.status === 204)) {
  104. _context.next = 6;
  105. break;
  106. }
  107. return _context.abrupt("return", {
  108. res: result.res
  109. });
  110. case 6:
  111. _context.next = 8;
  112. return this.requestError(result);
  113. case 8:
  114. throw _context.sent;
  115. case 9:
  116. case "end":
  117. return _context.stop();
  118. }
  119. }
  120. }, _callee, this);
  121. }));
  122. function deleteBucket(_x, _x2) {
  123. return _deleteBucket.apply(this, arguments);
  124. }
  125. return deleteBucket;
  126. }(); // acl
  127. proto.putBucketACL = /*#__PURE__*/function () {
  128. var _putBucketACL = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(name, acl, options) {
  129. var params, result;
  130. return _regenerator.default.wrap(function _callee2$(_context2) {
  131. while (1) {
  132. switch (_context2.prev = _context2.next) {
  133. case 0:
  134. params = this._bucketRequestParams('PUT', name, 'acl', options);
  135. params.headers = {
  136. 'x-oss-acl': acl
  137. };
  138. params.successStatuses = [200];
  139. _context2.next = 5;
  140. return this.request(params);
  141. case 5:
  142. result = _context2.sent;
  143. return _context2.abrupt("return", {
  144. bucket: result.headers.location && result.headers.location.substring(1) || null,
  145. res: result.res
  146. });
  147. case 7:
  148. case "end":
  149. return _context2.stop();
  150. }
  151. }
  152. }, _callee2, this);
  153. }));
  154. function putBucketACL(_x3, _x4, _x5) {
  155. return _putBucketACL.apply(this, arguments);
  156. }
  157. return putBucketACL;
  158. }();
  159. proto.getBucketACL = /*#__PURE__*/function () {
  160. var _getBucketACL = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3(name, options) {
  161. var params, result;
  162. return _regenerator.default.wrap(function _callee3$(_context3) {
  163. while (1) {
  164. switch (_context3.prev = _context3.next) {
  165. case 0:
  166. params = this._bucketRequestParams('GET', name, 'acl', options);
  167. params.successStatuses = [200];
  168. params.xmlResponse = true;
  169. _context3.next = 5;
  170. return this.request(params);
  171. case 5:
  172. result = _context3.sent;
  173. return _context3.abrupt("return", {
  174. acl: result.data.AccessControlList.Grant,
  175. owner: {
  176. id: result.data.Owner.ID,
  177. displayName: result.data.Owner.DisplayName
  178. },
  179. res: result.res
  180. });
  181. case 7:
  182. case "end":
  183. return _context3.stop();
  184. }
  185. }
  186. }, _callee3, this);
  187. }));
  188. function getBucketACL(_x6, _x7) {
  189. return _getBucketACL.apply(this, arguments);
  190. }
  191. return getBucketACL;
  192. }(); // logging
  193. proto.putBucketLogging = /*#__PURE__*/function () {
  194. var _putBucketLogging = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4(name, prefix, options) {
  195. var params, xml, result;
  196. return _regenerator.default.wrap(function _callee4$(_context4) {
  197. while (1) {
  198. switch (_context4.prev = _context4.next) {
  199. case 0:
  200. params = this._bucketRequestParams('PUT', name, 'logging', options);
  201. xml = "".concat('<?xml version="1.0" encoding="UTF-8"?>\n<BucketLoggingStatus>\n' + '<LoggingEnabled>\n<TargetBucket>').concat(name, "</TargetBucket>\n");
  202. if (prefix) {
  203. xml += "<TargetPrefix>".concat(prefix, "</TargetPrefix>\n");
  204. }
  205. xml += '</LoggingEnabled>\n</BucketLoggingStatus>';
  206. params.content = xml;
  207. params.mime = 'xml';
  208. params.successStatuses = [200];
  209. _context4.next = 9;
  210. return this.request(params);
  211. case 9:
  212. result = _context4.sent;
  213. return _context4.abrupt("return", {
  214. res: result.res
  215. });
  216. case 11:
  217. case "end":
  218. return _context4.stop();
  219. }
  220. }
  221. }, _callee4, this);
  222. }));
  223. function putBucketLogging(_x8, _x9, _x10) {
  224. return _putBucketLogging.apply(this, arguments);
  225. }
  226. return putBucketLogging;
  227. }();
  228. proto.getBucketLogging = /*#__PURE__*/function () {
  229. var _getBucketLogging = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5(name, options) {
  230. var params, result, enable;
  231. return _regenerator.default.wrap(function _callee5$(_context5) {
  232. while (1) {
  233. switch (_context5.prev = _context5.next) {
  234. case 0:
  235. params = this._bucketRequestParams('GET', name, 'logging', options);
  236. params.successStatuses = [200];
  237. params.xmlResponse = true;
  238. _context5.next = 5;
  239. return this.request(params);
  240. case 5:
  241. result = _context5.sent;
  242. enable = result.data.LoggingEnabled;
  243. return _context5.abrupt("return", {
  244. enable: !!enable,
  245. prefix: enable && enable.TargetPrefix || null,
  246. res: result.res
  247. });
  248. case 8:
  249. case "end":
  250. return _context5.stop();
  251. }
  252. }
  253. }, _callee5, this);
  254. }));
  255. function getBucketLogging(_x11, _x12) {
  256. return _getBucketLogging.apply(this, arguments);
  257. }
  258. return getBucketLogging;
  259. }();
  260. proto.deleteBucketLogging = /*#__PURE__*/function () {
  261. var _deleteBucketLogging = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6(name, options) {
  262. var params, result;
  263. return _regenerator.default.wrap(function _callee6$(_context6) {
  264. while (1) {
  265. switch (_context6.prev = _context6.next) {
  266. case 0:
  267. params = this._bucketRequestParams('DELETE', name, 'logging', options);
  268. params.successStatuses = [204, 200];
  269. _context6.next = 4;
  270. return this.request(params);
  271. case 4:
  272. result = _context6.sent;
  273. return _context6.abrupt("return", {
  274. res: result.res
  275. });
  276. case 6:
  277. case "end":
  278. return _context6.stop();
  279. }
  280. }
  281. }, _callee6, this);
  282. }));
  283. function deleteBucketLogging(_x13, _x14) {
  284. return _deleteBucketLogging.apply(this, arguments);
  285. }
  286. return deleteBucketLogging;
  287. }();
  288. proto.putBucketCORS = /*#__PURE__*/function () {
  289. var _putBucketCORS = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee7(name, rules, options) {
  290. var params, xml, parseOrigin, parseMethod, parseHeader, parseExposeHeader, i, l, rule, result;
  291. return _regenerator.default.wrap(function _callee7$(_context7) {
  292. while (1) {
  293. switch (_context7.prev = _context7.next) {
  294. case 0:
  295. rules = rules || [];
  296. assert(rules.length, 'rules is required');
  297. rules.forEach(function (rule) {
  298. assert(rule.allowedOrigin, 'allowedOrigin is required');
  299. assert(rule.allowedMethod, 'allowedMethod is required');
  300. });
  301. params = this._bucketRequestParams('PUT', name, 'cors', options);
  302. xml = '<?xml version="1.0" encoding="UTF-8"?>\n<CORSConfiguration>';
  303. parseOrigin = function parseOrigin(val) {
  304. xml += "<AllowedOrigin>".concat(val, "</AllowedOrigin>");
  305. };
  306. parseMethod = function parseMethod(val) {
  307. xml += "<AllowedMethod>".concat(val, "</AllowedMethod>");
  308. };
  309. parseHeader = function parseHeader(val) {
  310. xml += "<AllowedHeader>".concat(val, "</AllowedHeader>");
  311. };
  312. parseExposeHeader = function parseExposeHeader(val) {
  313. xml += "<ExposeHeader>".concat(val, "</ExposeHeader>");
  314. };
  315. for (i = 0, l = rules.length; i < l; i++) {
  316. rule = rules[i];
  317. xml += '<CORSRule>';
  318. toArray(rule.allowedOrigin).forEach(parseOrigin);
  319. toArray(rule.allowedMethod).forEach(parseMethod);
  320. toArray(rule.allowedHeader).forEach(parseHeader);
  321. toArray(rule.exposeHeader).forEach(parseExposeHeader);
  322. if (rule.maxAgeSeconds) {
  323. xml += "<MaxAgeSeconds>".concat(rule.maxAgeSeconds, "</MaxAgeSeconds>");
  324. }
  325. xml += '</CORSRule>';
  326. }
  327. xml += '</CORSConfiguration>';
  328. params.content = xml;
  329. params.mime = 'xml';
  330. params.successStatuses = [200];
  331. _context7.next = 16;
  332. return this.request(params);
  333. case 16:
  334. result = _context7.sent;
  335. return _context7.abrupt("return", {
  336. res: result.res
  337. });
  338. case 18:
  339. case "end":
  340. return _context7.stop();
  341. }
  342. }
  343. }, _callee7, this);
  344. }));
  345. function putBucketCORS(_x15, _x16, _x17) {
  346. return _putBucketCORS.apply(this, arguments);
  347. }
  348. return putBucketCORS;
  349. }();
  350. proto.getBucketCORS = /*#__PURE__*/function () {
  351. var _getBucketCORS = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee8(name, options) {
  352. var params, result, rules, CORSRule;
  353. return _regenerator.default.wrap(function _callee8$(_context8) {
  354. while (1) {
  355. switch (_context8.prev = _context8.next) {
  356. case 0:
  357. params = this._bucketRequestParams('GET', name, 'cors', options);
  358. params.successStatuses = [200];
  359. params.xmlResponse = true;
  360. _context8.next = 5;
  361. return this.request(params);
  362. case 5:
  363. result = _context8.sent;
  364. rules = [];
  365. if (result.data && result.data.CORSRule) {
  366. CORSRule = result.data.CORSRule;
  367. if (!isArray(CORSRule)) CORSRule = [CORSRule];
  368. CORSRule.forEach(function (rule) {
  369. var r = {};
  370. Object.keys(rule).forEach(function (key) {
  371. r[key.slice(0, 1).toLowerCase() + key.slice(1, key.length)] = rule[key];
  372. });
  373. rules.push(r);
  374. });
  375. }
  376. return _context8.abrupt("return", {
  377. rules: rules,
  378. res: result.res
  379. });
  380. case 9:
  381. case "end":
  382. return _context8.stop();
  383. }
  384. }
  385. }, _callee8, this);
  386. }));
  387. function getBucketCORS(_x18, _x19) {
  388. return _getBucketCORS.apply(this, arguments);
  389. }
  390. return getBucketCORS;
  391. }();
  392. proto.deleteBucketCORS = /*#__PURE__*/function () {
  393. var _deleteBucketCORS = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee9(name, options) {
  394. var params, result;
  395. return _regenerator.default.wrap(function _callee9$(_context9) {
  396. while (1) {
  397. switch (_context9.prev = _context9.next) {
  398. case 0:
  399. params = this._bucketRequestParams('DELETE', name, 'cors', options);
  400. params.successStatuses = [204];
  401. _context9.next = 4;
  402. return this.request(params);
  403. case 4:
  404. result = _context9.sent;
  405. return _context9.abrupt("return", {
  406. res: result.res
  407. });
  408. case 6:
  409. case "end":
  410. return _context9.stop();
  411. }
  412. }
  413. }, _callee9, this);
  414. }));
  415. function deleteBucketCORS(_x20, _x21) {
  416. return _deleteBucketCORS.apply(this, arguments);
  417. }
  418. return deleteBucketCORS;
  419. }(); // referer
  420. proto.putBucketReferer = /*#__PURE__*/function () {
  421. var _putBucketReferer = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee10(name, allowEmpty, referers, options) {
  422. var params, xml, i, result;
  423. return _regenerator.default.wrap(function _callee10$(_context10) {
  424. while (1) {
  425. switch (_context10.prev = _context10.next) {
  426. case 0:
  427. params = this._bucketRequestParams('PUT', name, 'referer', options);
  428. xml = '<?xml version="1.0" encoding="UTF-8"?>\n<RefererConfiguration>\n';
  429. xml += " <AllowEmptyReferer>".concat(allowEmpty ? 'true' : 'false', "</AllowEmptyReferer>\n");
  430. if (referers && referers.length > 0) {
  431. xml += ' <RefererList>\n';
  432. for (i = 0; i < referers.length; i++) {
  433. xml += " <Referer>".concat(referers[i], "</Referer>\n");
  434. }
  435. xml += ' </RefererList>\n';
  436. } else {
  437. xml += ' <RefererList />\n';
  438. }
  439. xml += '</RefererConfiguration>';
  440. params.content = xml;
  441. params.mime = 'xml';
  442. params.successStatuses = [200];
  443. _context10.next = 10;
  444. return this.request(params);
  445. case 10:
  446. result = _context10.sent;
  447. return _context10.abrupt("return", {
  448. res: result.res
  449. });
  450. case 12:
  451. case "end":
  452. return _context10.stop();
  453. }
  454. }
  455. }, _callee10, this);
  456. }));
  457. function putBucketReferer(_x22, _x23, _x24, _x25) {
  458. return _putBucketReferer.apply(this, arguments);
  459. }
  460. return putBucketReferer;
  461. }();
  462. proto.getBucketReferer = /*#__PURE__*/function () {
  463. var _getBucketReferer = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee11(name, options) {
  464. var params, result, referers;
  465. return _regenerator.default.wrap(function _callee11$(_context11) {
  466. while (1) {
  467. switch (_context11.prev = _context11.next) {
  468. case 0:
  469. params = this._bucketRequestParams('GET', name, 'referer', options);
  470. params.successStatuses = [200];
  471. params.xmlResponse = true;
  472. _context11.next = 5;
  473. return this.request(params);
  474. case 5:
  475. result = _context11.sent;
  476. referers = result.data.RefererList.Referer || null;
  477. if (referers) {
  478. if (!isArray(referers)) {
  479. referers = [referers];
  480. }
  481. }
  482. return _context11.abrupt("return", {
  483. allowEmpty: result.data.AllowEmptyReferer === 'true',
  484. referers: referers,
  485. res: result.res
  486. });
  487. case 9:
  488. case "end":
  489. return _context11.stop();
  490. }
  491. }
  492. }, _callee11, this);
  493. }));
  494. function getBucketReferer(_x26, _x27) {
  495. return _getBucketReferer.apply(this, arguments);
  496. }
  497. return getBucketReferer;
  498. }();
  499. proto.deleteBucketReferer = /*#__PURE__*/function () {
  500. var _deleteBucketReferer = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee12(name, options) {
  501. return _regenerator.default.wrap(function _callee12$(_context12) {
  502. while (1) {
  503. switch (_context12.prev = _context12.next) {
  504. case 0:
  505. _context12.next = 2;
  506. return this.putBucketReferer(name, true, null, options);
  507. case 2:
  508. return _context12.abrupt("return", _context12.sent);
  509. case 3:
  510. case "end":
  511. return _context12.stop();
  512. }
  513. }
  514. }, _callee12, this);
  515. }));
  516. function deleteBucketReferer(_x28, _x29) {
  517. return _deleteBucketReferer.apply(this, arguments);
  518. }
  519. return deleteBucketReferer;
  520. }(); // private apis
  521. proto._bucketRequestParams = function _bucketRequestParams(method, bucket, subres, options) {
  522. return {
  523. method: method,
  524. bucket: bucket,
  525. subres: subres,
  526. timeout: options && options.timeout,
  527. ctx: options && options.ctx
  528. };
  529. };
  530. },{"../common/utils/checkBucketName":50,"@babel/runtime/helpers/asyncToGenerator":73,"@babel/runtime/helpers/interopRequireDefault":74,"@babel/runtime/regenerator":76,"assert":78,"core-js/modules/es.array.slice.js":250,"core-js/modules/es.object.keys.js":257,"core-js/modules/es.object.to-string.js":258,"core-js/modules/web.dom-collections.for-each.js":296}],3:[function(require,module,exports){
  531. (function (Buffer,process){(function (){
  532. "use strict";
  533. var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
  534. var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
  535. var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
  536. require("core-js/modules/es.function.name.js");
  537. require("core-js/modules/es.regexp.exec.js");
  538. require("core-js/modules/es.string.split.js");
  539. require("core-js/modules/es.object.assign.js");
  540. require("core-js/modules/es.array.includes.js");
  541. require("core-js/modules/es.string.replace.js");
  542. require("core-js/modules/es.array.concat.js");
  543. require("core-js/modules/es.symbol.js");
  544. require("core-js/modules/es.symbol.description.js");
  545. require("core-js/modules/es.array.slice.js");
  546. require("core-js/modules/es.object.to-string.js");
  547. require("core-js/modules/es.promise.js");
  548. require("core-js/modules/es.regexp.to-string.js");
  549. var debug = require('debug')('ali-oss');
  550. var xml = require('xml2js');
  551. var AgentKeepalive = require('agentkeepalive');
  552. var merge = require('merge-descriptors');
  553. var platform = require('platform');
  554. var utility = require('utility');
  555. var urllib = require('urllib');
  556. var pkg = require('./version');
  557. var bowser = require('bowser');
  558. var signUtils = require('../common/signUtils');
  559. var _initOptions = require('../common/client/initOptions');
  560. var _require = require('../common/utils/createRequest'),
  561. createRequest = _require.createRequest;
  562. var _require2 = require('../common/utils/encoder'),
  563. encoder = _require2.encoder;
  564. var _require3 = require('../common/client/getReqUrl'),
  565. getReqUrl = _require3.getReqUrl;
  566. var _require4 = require('../common/utils/setSTSToken'),
  567. setSTSToken = _require4.setSTSToken;
  568. var _require5 = require('../common/utils/retry'),
  569. retry = _require5.retry;
  570. var _require6 = require('../common/utils/isFunction'),
  571. isFunction = _require6.isFunction;
  572. var globalHttpAgent = new AgentKeepalive();
  573. function _unSupportBrowserTip() {
  574. var name = platform.name,
  575. version = platform.version;
  576. if (name && name.toLowerCase && name.toLowerCase() === 'ie' && version.split('.')[0] < 10) {
  577. // eslint-disable-next-line no-console
  578. console.warn('ali-oss does not support the current browser');
  579. }
  580. } // check local web protocol,if https secure default set true , if http secure default set false
  581. function isHttpsWebProtocol() {
  582. // for web worker not use window.location.
  583. // eslint-disable-next-line no-restricted-globals
  584. return location && location.protocol === 'https:';
  585. }
  586. function Client(options, ctx) {
  587. _unSupportBrowserTip();
  588. if (!(this instanceof Client)) {
  589. return new Client(options, ctx);
  590. }
  591. if (options && options.inited) {
  592. this.options = options;
  593. } else {
  594. this.options = Client.initOptions(options);
  595. }
  596. this.options.cancelFlag = false; // cancel flag: if true need to be cancelled, default false
  597. // support custom agent and urllib client
  598. if (this.options.urllib) {
  599. this.urllib = this.options.urllib;
  600. } else {
  601. this.urllib = urllib;
  602. this.agent = this.options.agent || globalHttpAgent;
  603. }
  604. this.ctx = ctx;
  605. this.userAgent = this._getUserAgent();
  606. this.stsTokenFreshTime = new Date(); // record the time difference between client and server
  607. this.options.amendTimeSkewed = 0;
  608. }
  609. /**
  610. * Expose `Client`
  611. */
  612. module.exports = Client;
  613. Client.initOptions = function initOptions(options) {
  614. if (!options.stsToken) {
  615. console.warn('Please use STS Token for safety, see more details at https://help.aliyun.com/document_detail/32077.html');
  616. }
  617. var opts = Object.assign({
  618. secure: isHttpsWebProtocol(),
  619. // for browser compatibility disable fetch.
  620. useFetch: false
  621. }, options);
  622. return _initOptions(opts);
  623. };
  624. /**
  625. * prototype
  626. */
  627. var proto = Client.prototype; // mount debug on proto
  628. proto.debug = debug;
  629. /**
  630. * Object operations
  631. */
  632. merge(proto, require('./object'));
  633. /**
  634. * Bucket operations
  635. */
  636. merge(proto, require('./bucket'));
  637. merge(proto, require('../common/bucket/getBucketWebsite'));
  638. merge(proto, require('../common/bucket/putBucketWebsite'));
  639. merge(proto, require('../common/bucket/deleteBucketWebsite')); // lifecycle
  640. merge(proto, require('../common/bucket/getBucketLifecycle'));
  641. merge(proto, require('../common/bucket/putBucketLifecycle'));
  642. merge(proto, require('../common/bucket/deleteBucketLifecycle')); // multiversion
  643. merge(proto, require('../common/bucket/putBucketVersioning'));
  644. merge(proto, require('../common/bucket/getBucketVersioning')); // inventory
  645. merge(proto, require('../common/bucket/getBucketInventory'));
  646. merge(proto, require('../common/bucket/deleteBucketInventory'));
  647. merge(proto, require('../common/bucket/listBucketInventory'));
  648. merge(proto, require('../common/bucket/putBucketInventory')); // worm
  649. merge(proto, require('../common/bucket/abortBucketWorm'));
  650. merge(proto, require('../common/bucket/completeBucketWorm'));
  651. merge(proto, require('../common/bucket/extendBucketWorm'));
  652. merge(proto, require('../common/bucket/getBucketWorm'));
  653. merge(proto, require('../common/bucket/initiateBucketWorm')); // multipart upload
  654. merge(proto, require('./managed-upload'));
  655. /**
  656. * common multipart-copy support node and browser
  657. */
  658. merge(proto, require('../common/multipart-copy'));
  659. /**
  660. * Multipart operations
  661. */
  662. merge(proto, require('../common/multipart'));
  663. /**
  664. * Common module parallel
  665. */
  666. merge(proto, require('../common/parallel'));
  667. /**
  668. * get OSS signature
  669. * @param {String} stringToSign
  670. * @return {String} the signature
  671. */
  672. proto.signature = function signature(stringToSign) {
  673. this.debug('authorization stringToSign: %s', stringToSign, 'info');
  674. return signUtils.computeSignature(this.options.accessKeySecret, stringToSign, this.options.headerEncoding);
  675. };
  676. proto._getReqUrl = getReqUrl;
  677. /**
  678. * get author header
  679. *
  680. * "Authorization: OSS " + Access Key Id + ":" + Signature
  681. *
  682. * Signature = base64(hmac-sha1(Access Key Secret + "\n"
  683. * + VERB + "\n"
  684. * + CONTENT-MD5 + "\n"
  685. * + CONTENT-TYPE + "\n"
  686. * + DATE + "\n"
  687. * + CanonicalizedOSSHeaders
  688. * + CanonicalizedResource))
  689. *
  690. * @param {String} method
  691. * @param {String} resource
  692. * @param {Object} header
  693. * @return {String}
  694. *
  695. * @api private
  696. */
  697. proto.authorization = function authorization(method, resource, subres, headers) {
  698. var stringToSign = signUtils.buildCanonicalString(method.toUpperCase(), resource, {
  699. headers: headers,
  700. parameters: subres
  701. });
  702. return signUtils.authorization(this.options.accessKeyId, this.options.accessKeySecret, stringToSign, this.options.headerEncoding);
  703. };
  704. /**
  705. * request oss server
  706. * @param {Object} params
  707. * - {String} object
  708. * - {String} bucket
  709. * - {Object} [headers]
  710. * - {Object} [query]
  711. * - {Buffer} [content]
  712. * - {Stream} [stream]
  713. * - {Stream} [writeStream]
  714. * - {String} [mime]
  715. * - {Boolean} [xmlResponse]
  716. * - {Boolean} [customResponse]
  717. * - {Number} [timeout]
  718. * - {Object} [ctx] request context, default is `this.ctx`
  719. *
  720. * @api private
  721. */
  722. proto.request = /*#__PURE__*/function () {
  723. var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(params) {
  724. var _this = this;
  725. return _regenerator.default.wrap(function _callee$(_context) {
  726. while (1) {
  727. switch (_context.prev = _context.next) {
  728. case 0:
  729. if (!this.options.retryMax) {
  730. _context.next = 6;
  731. break;
  732. }
  733. _context.next = 3;
  734. return retry(request.bind(this), this.options.retryMax, {
  735. errorHandler: function errorHandler(err) {
  736. var _errHandle = function _errHandle(_err) {
  737. if (params.stream) return false;
  738. var statusErr = [-1, -2].includes(_err.status);
  739. var requestErrorRetryHandle = _this.options.requestErrorRetryHandle || function () {
  740. return true;
  741. };
  742. return statusErr && requestErrorRetryHandle(_err);
  743. };
  744. if (_errHandle(err)) return true;
  745. return false;
  746. }
  747. })(params);
  748. case 3:
  749. return _context.abrupt("return", _context.sent);
  750. case 6:
  751. return _context.abrupt("return", request.call(this, params));
  752. case 7:
  753. case "end":
  754. return _context.stop();
  755. }
  756. }
  757. }, _callee, this);
  758. }));
  759. return function (_x) {
  760. return _ref.apply(this, arguments);
  761. };
  762. }();
  763. function request(_x2) {
  764. return _request.apply(this, arguments);
  765. }
  766. function _request() {
  767. _request = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3(params) {
  768. var reqParams, result, reqErr, useStream, err, parseData;
  769. return _regenerator.default.wrap(function _callee3$(_context3) {
  770. while (1) {
  771. switch (_context3.prev = _context3.next) {
  772. case 0:
  773. if (!(this.options.stsToken && isFunction(this.options.refreshSTSToken))) {
  774. _context3.next = 3;
  775. break;
  776. }
  777. _context3.next = 3;
  778. return setSTSToken.call(this);
  779. case 3:
  780. reqParams = createRequest.call(this, params);
  781. if (!this.options.useFetch) {
  782. reqParams.params.mode = 'disable-fetch';
  783. }
  784. useStream = !!params.stream;
  785. _context3.prev = 6;
  786. _context3.next = 9;
  787. return this.urllib.request(reqParams.url, reqParams.params);
  788. case 9:
  789. result = _context3.sent;
  790. this.debug('response %s %s, got %s, headers: %j', params.method, reqParams.url, result.status, result.headers, 'info');
  791. _context3.next = 16;
  792. break;
  793. case 13:
  794. _context3.prev = 13;
  795. _context3.t0 = _context3["catch"](6);
  796. reqErr = _context3.t0;
  797. case 16:
  798. if (!(result && params.successStatuses && params.successStatuses.indexOf(result.status) === -1)) {
  799. _context3.next = 28;
  800. break;
  801. }
  802. _context3.next = 19;
  803. return this.requestError(result);
  804. case 19:
  805. err = _context3.sent;
  806. if (!(err.code === 'RequestTimeTooSkewed' && !useStream)) {
  807. _context3.next = 25;
  808. break;
  809. }
  810. this.options.amendTimeSkewed = +new Date(err.serverTime) - new Date();
  811. _context3.next = 24;
  812. return this.request(params);
  813. case 24:
  814. return _context3.abrupt("return", _context3.sent);
  815. case 25:
  816. err.params = params;
  817. _context3.next = 32;
  818. break;
  819. case 28:
  820. if (!reqErr) {
  821. _context3.next = 32;
  822. break;
  823. }
  824. _context3.next = 31;
  825. return this.requestError(reqErr);
  826. case 31:
  827. err = _context3.sent;
  828. case 32:
  829. if (!err) {
  830. _context3.next = 34;
  831. break;
  832. }
  833. throw err;
  834. case 34:
  835. if (!params.xmlResponse) {
  836. _context3.next = 39;
  837. break;
  838. }
  839. _context3.next = 37;
  840. return this.parseXML(result.data);
  841. case 37:
  842. parseData = _context3.sent;
  843. result.data = parseData;
  844. case 39:
  845. return _context3.abrupt("return", result);
  846. case 40:
  847. case "end":
  848. return _context3.stop();
  849. }
  850. }
  851. }, _callee3, this, [[6, 13]]);
  852. }));
  853. return _request.apply(this, arguments);
  854. }
  855. proto._getResource = function _getResource(params) {
  856. var resource = '/';
  857. if (params.bucket) resource += "".concat(params.bucket, "/");
  858. if (params.object) resource += encoder(params.object, this.options.headerEncoding);
  859. return resource;
  860. };
  861. proto._escape = function _escape(name) {
  862. return utility.encodeURIComponent(name).replace(/%2F/g, '/');
  863. };
  864. /*
  865. * Get User-Agent for browser & node.js
  866. * @example
  867. * aliyun-sdk-nodejs/4.1.2 Node.js 5.3.0 on Darwin 64-bit
  868. * aliyun-sdk-js/4.1.2 Safari 9.0 on Apple iPhone(iOS 9.2.1)
  869. * aliyun-sdk-js/4.1.2 Chrome 43.0.2357.134 32-bit on Windows Server 2008 R2 / 7 64-bit
  870. */
  871. proto._getUserAgent = function _getUserAgent() {
  872. var agent = process && process.browser ? 'js' : 'nodejs';
  873. var sdk = "aliyun-sdk-".concat(agent, "/").concat(pkg.version);
  874. var plat = platform.description;
  875. if (!plat && process) {
  876. plat = "Node.js ".concat(process.version.slice(1), " on ").concat(process.platform, " ").concat(process.arch);
  877. }
  878. return this._checkUserAgent("".concat(sdk, " ").concat(plat));
  879. };
  880. proto._checkUserAgent = function _checkUserAgent(ua) {
  881. var userAgent = ua.replace(/\u03b1/, 'alpha').replace(/\u03b2/, 'beta');
  882. return userAgent;
  883. };
  884. /*
  885. * Check Browser And Version
  886. * @param {String} [name] browser name: like IE, Chrome, Firefox
  887. * @param {String} [version] browser major version: like 10(IE 10.x), 55(Chrome 55.x), 50(Firefox 50.x)
  888. * @return {Bool} true or false
  889. * @api private
  890. */
  891. proto.checkBrowserAndVersion = function checkBrowserAndVersion(name, version) {
  892. return bowser.name === name && bowser.version.split('.')[0] === version;
  893. };
  894. /**
  895. * thunkify xml.parseString
  896. * @param {String|Buffer} str
  897. *
  898. * @api private
  899. */
  900. proto.parseXML = function parseXMLThunk(str) {
  901. return new Promise(function (resolve, reject) {
  902. if (Buffer.isBuffer(str)) {
  903. str = str.toString();
  904. }
  905. xml.parseString(str, {
  906. explicitRoot: false,
  907. explicitArray: false
  908. }, function (err, result) {
  909. if (err) {
  910. reject(err);
  911. } else {
  912. resolve(result);
  913. }
  914. });
  915. });
  916. };
  917. /**
  918. * generater a request error with request response
  919. * @param {Object} result
  920. *
  921. * @api private
  922. */
  923. proto.requestError = /*#__PURE__*/function () {
  924. var _requestError = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(result) {
  925. var err, message, info, msg;
  926. return _regenerator.default.wrap(function _callee2$(_context2) {
  927. while (1) {
  928. switch (_context2.prev = _context2.next) {
  929. case 0:
  930. err = null;
  931. if (!(!result.data || !result.data.length)) {
  932. _context2.next = 5;
  933. break;
  934. }
  935. if (result.status === -1 || result.status === -2) {
  936. // -1 is net error , -2 is timeout
  937. err = new Error(result.message);
  938. err.name = result.name;
  939. err.status = result.status;
  940. err.code = result.name;
  941. } else {
  942. // HEAD not exists resource
  943. if (result.status === 404) {
  944. err = new Error('Object not exists');
  945. err.name = 'NoSuchKeyError';
  946. err.status = 404;
  947. err.code = 'NoSuchKey';
  948. } else if (result.status === 412) {
  949. err = new Error('Pre condition failed');
  950. err.name = 'PreconditionFailedError';
  951. err.status = 412;
  952. err.code = 'PreconditionFailed';
  953. } else {
  954. err = new Error("Unknow error, status: ".concat(result.status));
  955. err.name = 'UnknowError';
  956. err.status = result.status;
  957. }
  958. err.requestId = result.headers['x-oss-request-id'];
  959. err.host = '';
  960. }
  961. _context2.next = 32;
  962. break;
  963. case 5:
  964. message = String(result.data);
  965. this.debug('request response error data: %s', message, 'error');
  966. _context2.prev = 7;
  967. _context2.next = 10;
  968. return this.parseXML(message);
  969. case 10:
  970. _context2.t0 = _context2.sent;
  971. if (_context2.t0) {
  972. _context2.next = 13;
  973. break;
  974. }
  975. _context2.t0 = {};
  976. case 13:
  977. info = _context2.t0;
  978. _context2.next = 23;
  979. break;
  980. case 16:
  981. _context2.prev = 16;
  982. _context2.t1 = _context2["catch"](7);
  983. this.debug(message, 'error');
  984. _context2.t1.message += "\nraw xml: ".concat(message);
  985. _context2.t1.status = result.status;
  986. _context2.t1.requestId = result.headers['x-oss-request-id'];
  987. return _context2.abrupt("return", _context2.t1);
  988. case 23:
  989. msg = info.Message || "unknow request error, status: ".concat(result.status);
  990. if (info.Condition) {
  991. msg += " (condition: ".concat(info.Condition, ")");
  992. }
  993. err = new Error(msg);
  994. err.name = info.Code ? "".concat(info.Code, "Error") : 'UnknowError';
  995. err.status = result.status;
  996. err.code = info.Code;
  997. err.requestId = info.RequestId;
  998. err.hostId = info.HostId;
  999. err.serverTime = info.ServerTime;
  1000. case 32:
  1001. this.debug('generate error %j', err, 'error');
  1002. return _context2.abrupt("return", err);
  1003. case 34:
  1004. case "end":
  1005. return _context2.stop();
  1006. }
  1007. }
  1008. }, _callee2, this, [[7, 16]]);
  1009. }));
  1010. function requestError(_x3) {
  1011. return _requestError.apply(this, arguments);
  1012. }
  1013. return requestError;
  1014. }();
  1015. }).call(this)}).call(this,{"isBuffer":require("../../node_modules/is-buffer/index.js")},require('_process'))
  1016. },{"../../node_modules/is-buffer/index.js":312,"../common/bucket/abortBucketWorm":7,"../common/bucket/completeBucketWorm":8,"../common/bucket/deleteBucketInventory":9,"../common/bucket/deleteBucketLifecycle":10,"../common/bucket/deleteBucketWebsite":11,"../common/bucket/extendBucketWorm":12,"../common/bucket/getBucketInventory":13,"../common/bucket/getBucketLifecycle":14,"../common/bucket/getBucketVersioning":15,"../common/bucket/getBucketWebsite":16,"../common/bucket/getBucketWorm":17,"../common/bucket/initiateBucketWorm":18,"../common/bucket/listBucketInventory":19,"../common/bucket/putBucketInventory":20,"../common/bucket/putBucketLifecycle":21,"../common/bucket/putBucketVersioning":22,"../common/bucket/putBucketWebsite":23,"../common/client/getReqUrl":25,"../common/client/initOptions":26,"../common/multipart":30,"../common/multipart-copy":29,"../common/parallel":48,"../common/signUtils":49,"../common/utils/createRequest":54,"../common/utils/encoder":57,"../common/utils/isFunction":65,"../common/utils/retry":70,"../common/utils/setSTSToken":72,"./bucket":2,"./managed-upload":4,"./object":5,"./version":6,"@babel/runtime/helpers/asyncToGenerator":73,"@babel/runtime/helpers/interopRequireDefault":74,"@babel/runtime/regenerator":76,"_process":399,"agentkeepalive":77,"bowser":83,"core-js/modules/es.array.concat.js":241,"core-js/modules/es.array.includes.js":246,"core-js/modules/es.array.slice.js":250,"core-js/modules/es.function.name.js":253,"core-js/modules/es.object.assign.js":255,"core-js/modules/es.object.to-string.js":258,"core-js/modules/es.promise.js":259,"core-js/modules/es.regexp.exec.js":261,"core-js/modules/es.regexp.to-string.js":262,"core-js/modules/es.string.replace.js":266,"core-js/modules/es.string.split.js":268,"core-js/modules/es.symbol.description.js":270,"core-js/modules/es.symbol.js":271,"debug":397,"merge-descriptors":315,"platform":322,"urllib":407,"utility":406,"xml2js":358}],4:[function(require,module,exports){
  1017. (function (Buffer){(function (){
  1018. "use strict";
  1019. var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
  1020. var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
  1021. require("core-js/modules/es.function.name.js");
  1022. require("core-js/modules/es.object.to-string.js");
  1023. require("core-js/modules/es.promise.js");
  1024. require("core-js/modules/es.array.from.js");
  1025. require("core-js/modules/es.string.iterator.js");
  1026. require("core-js/modules/es.array.map.js");
  1027. require("core-js/modules/es.array.filter.js");
  1028. require("core-js/modules/es.array.find.js");
  1029. require("core-js/modules/es.array.concat.js");
  1030. require("core-js/modules/es.regexp.to-string.js");
  1031. require("core-js/modules/es.array.slice.js");
  1032. require("core-js/modules/es.array.iterator.js");
  1033. require("core-js/modules/es.array-buffer.slice.js");
  1034. require("core-js/modules/es.typed-array.uint8-array.js");
  1035. require("core-js/modules/es.typed-array.copy-within.js");
  1036. require("core-js/modules/es.typed-array.every.js");
  1037. require("core-js/modules/es.typed-array.fill.js");
  1038. require("core-js/modules/es.typed-array.filter.js");
  1039. require("core-js/modules/es.typed-array.find.js");
  1040. require("core-js/modules/es.typed-array.find-index.js");
  1041. require("core-js/modules/es.typed-array.for-each.js");
  1042. require("core-js/modules/es.typed-array.includes.js");
  1043. require("core-js/modules/es.typed-array.index-of.js");
  1044. require("core-js/modules/es.typed-array.iterator.js");
  1045. require("core-js/modules/es.typed-array.join.js");
  1046. require("core-js/modules/es.typed-array.last-index-of.js");
  1047. require("core-js/modules/es.typed-array.map.js");
  1048. require("core-js/modules/es.typed-array.reduce.js");
  1049. require("core-js/modules/es.typed-array.reduce-right.js");
  1050. require("core-js/modules/es.typed-array.reverse.js");
  1051. require("core-js/modules/es.typed-array.set.js");
  1052. require("core-js/modules/es.typed-array.slice.js");
  1053. require("core-js/modules/es.typed-array.some.js");
  1054. require("core-js/modules/es.typed-array.sort.js");
  1055. require("core-js/modules/es.typed-array.subarray.js");
  1056. require("core-js/modules/es.typed-array.to-locale-string.js");
  1057. require("core-js/modules/es.typed-array.to-string.js");
  1058. var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
  1059. // var debug = require('debug')('ali-oss:multipart');
  1060. var util = require('util');
  1061. var path = require('path');
  1062. var mime = require('mime');
  1063. var copy = require('copy-to');
  1064. var _require = require('../common/utils/isBlob'),
  1065. isBlob = _require.isBlob;
  1066. var _require2 = require('../common/utils/isFile'),
  1067. isFile = _require2.isFile;
  1068. var _require3 = require('../common/utils/isArray'),
  1069. isArray = _require3.isArray;
  1070. var _require4 = require('../common/utils/isBuffer'),
  1071. isBuffer = _require4.isBuffer;
  1072. var _require5 = require('../common/utils/retry'),
  1073. retry = _require5.retry;
  1074. var proto = exports;
  1075. /**
  1076. * Multipart operations
  1077. */
  1078. /**
  1079. * Upload a file to OSS using multipart uploads
  1080. * @param {String} name
  1081. * @param {String|File|Buffer} file
  1082. * @param {Object} options
  1083. * {Object} options.callback The callback parameter is composed of a JSON string encoded in Base64
  1084. * {String} options.callback.url the OSS sends a callback request to this URL
  1085. * {String} options.callback.host The host header value for initiating callback requests
  1086. * {String} options.callback.body The value of the request body when a callback is initiated
  1087. * {String} options.callback.contentType The Content-Type of the callback requests initiatiated
  1088. * {Object} options.callback.customValue Custom parameters are a map of key-values, e.g:
  1089. * customValue = {
  1090. * key1: 'value1',
  1091. * key2: 'value2'
  1092. * }
  1093. */
  1094. proto.multipartUpload = /*#__PURE__*/function () {
  1095. var _multipartUpload = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(name, file) {
  1096. var options,
  1097. minPartSize,
  1098. fileSize,
  1099. result,
  1100. ret,
  1101. initResult,
  1102. uploadId,
  1103. partSize,
  1104. checkpoint,
  1105. _args = arguments;
  1106. return _regenerator.default.wrap(function _callee$(_context) {
  1107. while (1) {
  1108. switch (_context.prev = _context.next) {
  1109. case 0:
  1110. options = _args.length > 2 && _args[2] !== undefined ? _args[2] : {};
  1111. this.resetCancelFlag();
  1112. options.disabledMD5 = options.disabledMD5 === undefined ? true : !!options.disabledMD5;
  1113. if (!(options.checkpoint && options.checkpoint.uploadId)) {
  1114. _context.next = 8;
  1115. break;
  1116. }
  1117. if (file && isFile(file)) options.checkpoint.file = file;
  1118. _context.next = 7;
  1119. return this._resumeMultipart(options.checkpoint, options);
  1120. case 7:
  1121. return _context.abrupt("return", _context.sent);
  1122. case 8:
  1123. minPartSize = 100 * 1024;
  1124. if (!options.mime) {
  1125. if (isFile(file)) {
  1126. options.mime = mime.getType(path.extname(file.name));
  1127. } else if (isBlob(file)) {
  1128. options.mime = file.type;
  1129. } else if (isBuffer(file)) {
  1130. options.mime = '';
  1131. } else {
  1132. options.mime = mime.getType(path.extname(file));
  1133. }
  1134. }
  1135. options.headers = options.headers || {};
  1136. this._convertMetaToHeaders(options.meta, options.headers);
  1137. _context.next = 14;
  1138. return this._getFileSize(file);
  1139. case 14:
  1140. fileSize = _context.sent;
  1141. if (!(fileSize < minPartSize)) {
  1142. _context.next = 26;
  1143. break;
  1144. }
  1145. options.contentLength = fileSize;
  1146. _context.next = 19;
  1147. return this.put(name, file, options);
  1148. case 19:
  1149. result = _context.sent;
  1150. if (!(options && options.progress)) {
  1151. _context.next = 23;
  1152. break;
  1153. }
  1154. _context.next = 23;
  1155. return options.progress(1);
  1156. case 23:
  1157. ret = {
  1158. res: result.res,
  1159. bucket: this.options.bucket,
  1160. name: name,
  1161. etag: result.res.headers.etag
  1162. };
  1163. if (options.headers && options.headers['x-oss-callback'] || options.callback) {
  1164. ret.data = result.data;
  1165. }
  1166. return _context.abrupt("return", ret);
  1167. case 26:
  1168. if (!(options.partSize && !(parseInt(options.partSize, 10) === options.partSize))) {
  1169. _context.next = 28;
  1170. break;
  1171. }
  1172. throw new Error('partSize must be int number');
  1173. case 28:
  1174. if (!(options.partSize && options.partSize < minPartSize)) {
  1175. _context.next = 30;
  1176. break;
  1177. }
  1178. throw new Error("partSize must not be smaller than ".concat(minPartSize));
  1179. case 30:
  1180. _context.next = 32;
  1181. return this.initMultipartUpload(name, options);
  1182. case 32:
  1183. initResult = _context.sent;
  1184. uploadId = initResult.uploadId;
  1185. partSize = this._getPartSize(fileSize, options.partSize);
  1186. checkpoint = {
  1187. file: file,
  1188. name: name,
  1189. fileSize: fileSize,
  1190. partSize: partSize,
  1191. uploadId: uploadId,
  1192. doneParts: []
  1193. };
  1194. if (!(options && options.progress)) {
  1195. _context.next = 39;
  1196. break;
  1197. }
  1198. _context.next = 39;
  1199. return options.progress(0, checkpoint, initResult.res);
  1200. case 39:
  1201. _context.next = 41;
  1202. return this._resumeMultipart(checkpoint, options);
  1203. case 41:
  1204. return _context.abrupt("return", _context.sent);
  1205. case 42:
  1206. case "end":
  1207. return _context.stop();
  1208. }
  1209. }
  1210. }, _callee, this);
  1211. }));
  1212. function multipartUpload(_x, _x2) {
  1213. return _multipartUpload.apply(this, arguments);
  1214. }
  1215. return multipartUpload;
  1216. }();
  1217. /*
  1218. * Resume multipart upload from checkpoint. The checkpoint will be
  1219. * updated after each successful part upload.
  1220. * @param {Object} checkpoint the checkpoint
  1221. * @param {Object} options
  1222. */
  1223. proto._resumeMultipart = /*#__PURE__*/function () {
  1224. var _resumeMultipart2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3(checkpoint, options) {
  1225. var that, file, fileSize, partSize, uploadId, doneParts, name, internalDoneParts, partOffs, numParts, multipartFinish, uploadPartJob, all, done, todo, defaultParallel, parallel, jobErr, abortEvent;
  1226. return _regenerator.default.wrap(function _callee3$(_context3) {
  1227. while (1) {
  1228. switch (_context3.prev = _context3.next) {
  1229. case 0:
  1230. that = this;
  1231. if (!this.isCancel()) {
  1232. _context3.next = 3;
  1233. break;
  1234. }
  1235. throw this._makeCancelEvent();
  1236. case 3:
  1237. file = checkpoint.file, fileSize = checkpoint.fileSize, partSize = checkpoint.partSize, uploadId = checkpoint.uploadId, doneParts = checkpoint.doneParts, name = checkpoint.name;
  1238. internalDoneParts = [];
  1239. if (doneParts.length > 0) {
  1240. copy(doneParts).to(internalDoneParts);
  1241. }
  1242. partOffs = this._divideParts(fileSize, partSize);
  1243. numParts = partOffs.length;
  1244. multipartFinish = false;
  1245. uploadPartJob = function uploadPartJob(self, partNo) {
  1246. // eslint-disable-next-line no-async-promise-executor
  1247. return new Promise( /*#__PURE__*/function () {
  1248. var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(resolve, reject) {
  1249. var pi, content, data, result, tempErr;
  1250. return _regenerator.default.wrap(function _callee2$(_context2) {
  1251. while (1) {
  1252. switch (_context2.prev = _context2.next) {
  1253. case 0:
  1254. _context2.prev = 0;
  1255. if (self.isCancel()) {
  1256. _context2.next = 29;
  1257. break;
  1258. }
  1259. pi = partOffs[partNo - 1];
  1260. _context2.next = 5;
  1261. return self._createBuffer(file, pi.start, pi.end);
  1262. case 5:
  1263. content = _context2.sent;
  1264. data = {
  1265. content: content,
  1266. size: pi.end - pi.start
  1267. };
  1268. _context2.prev = 7;
  1269. _context2.next = 10;
  1270. return self._uploadPart(name, uploadId, partNo, data, {
  1271. timeout: options.timeout,
  1272. disabledMD5: options.disabledMD5
  1273. });
  1274. case 10:
  1275. result = _context2.sent;
  1276. _context2.next = 18;
  1277. break;
  1278. case 13:
  1279. _context2.prev = 13;
  1280. _context2.t0 = _context2["catch"](7);
  1281. if (!(_context2.t0.status === 404)) {
  1282. _context2.next = 17;
  1283. break;
  1284. }
  1285. throw self._makeAbortEvent();
  1286. case 17:
  1287. throw _context2.t0;
  1288. case 18:
  1289. if (!(!self.isCancel() && !multipartFinish)) {
  1290. _context2.next = 26;
  1291. break;
  1292. }
  1293. checkpoint.doneParts.push({
  1294. number: partNo,
  1295. etag: result.res.headers.etag
  1296. });
  1297. if (!options.progress) {
  1298. _context2.next = 23;
  1299. break;
  1300. }
  1301. _context2.next = 23;
  1302. return options.progress(doneParts.length / numParts, checkpoint, result.res);
  1303. case 23:
  1304. resolve({
  1305. number: partNo,
  1306. etag: result.res.headers.etag
  1307. });
  1308. _context2.next = 27;
  1309. break;
  1310. case 26:
  1311. resolve();
  1312. case 27:
  1313. _context2.next = 30;
  1314. break;
  1315. case 29:
  1316. resolve();
  1317. case 30:
  1318. _context2.next = 41;
  1319. break;
  1320. case 32:
  1321. _context2.prev = 32;
  1322. _context2.t1 = _context2["catch"](0);
  1323. tempErr = new Error();
  1324. tempErr.name = _context2.t1.name;
  1325. tempErr.message = _context2.t1.message;
  1326. tempErr.stack = _context2.t1.stack;
  1327. tempErr.partNum = partNo;
  1328. copy(_context2.t1).to(tempErr);
  1329. reject(tempErr);
  1330. case 41:
  1331. case "end":
  1332. return _context2.stop();
  1333. }
  1334. }
  1335. }, _callee2, null, [[0, 32], [7, 13]]);
  1336. }));
  1337. return function (_x5, _x6) {
  1338. return _ref.apply(this, arguments);
  1339. };
  1340. }());
  1341. };
  1342. all = Array.from(new Array(numParts), function (x, i) {
  1343. return i + 1;
  1344. });
  1345. done = internalDoneParts.map(function (p) {
  1346. return p.number;
  1347. });
  1348. todo = all.filter(function (p) {
  1349. return done.indexOf(p) < 0;
  1350. });
  1351. defaultParallel = 5;
  1352. parallel = options.parallel || defaultParallel; // upload in parallel
  1353. _context3.next = 17;
  1354. return this._parallel(todo, parallel, function (value) {
  1355. return new Promise(function (resolve, reject) {
  1356. uploadPartJob(that, value).then(function (result) {
  1357. if (result) {
  1358. internalDoneParts.push(result);
  1359. }
  1360. resolve();
  1361. }).catch(function (err) {
  1362. reject(err);
  1363. });
  1364. });
  1365. });
  1366. case 17:
  1367. jobErr = _context3.sent;
  1368. multipartFinish = true;
  1369. abortEvent = jobErr.find(function (err) {
  1370. return err.name === 'abort';
  1371. });
  1372. if (!abortEvent) {
  1373. _context3.next = 22;
  1374. break;
  1375. }
  1376. throw abortEvent;
  1377. case 22:
  1378. if (!this.isCancel()) {
  1379. _context3.next = 25;
  1380. break;
  1381. }
  1382. uploadPartJob = null;
  1383. throw this._makeCancelEvent();
  1384. case 25:
  1385. if (!(jobErr && jobErr.length > 0)) {
  1386. _context3.next = 28;
  1387. break;
  1388. }
  1389. jobErr[0].message = "Failed to upload some parts with error: ".concat(jobErr[0].toString(), " part_num: ").concat(jobErr[0].partNum);
  1390. throw jobErr[0];
  1391. case 28:
  1392. _context3.next = 30;
  1393. return this.completeMultipartUpload(name, uploadId, internalDoneParts, options);
  1394. case 30:
  1395. return _context3.abrupt("return", _context3.sent);
  1396. case 31:
  1397. case "end":
  1398. return _context3.stop();
  1399. }
  1400. }
  1401. }, _callee3, this);
  1402. }));
  1403. function _resumeMultipart(_x3, _x4) {
  1404. return _resumeMultipart2.apply(this, arguments);
  1405. }
  1406. return _resumeMultipart;
  1407. }();
  1408. /**
  1409. * Get file size
  1410. */
  1411. proto._getFileSize = /*#__PURE__*/function () {
  1412. var _getFileSize2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4(file) {
  1413. return _regenerator.default.wrap(function _callee4$(_context4) {
  1414. while (1) {
  1415. switch (_context4.prev = _context4.next) {
  1416. case 0:
  1417. if (!isBuffer(file)) {
  1418. _context4.next = 4;
  1419. break;
  1420. }
  1421. return _context4.abrupt("return", file.length);
  1422. case 4:
  1423. if (!(isBlob(file) || isFile(file))) {
  1424. _context4.next = 6;
  1425. break;
  1426. }
  1427. return _context4.abrupt("return", file.size);
  1428. case 6:
  1429. throw new Error('_getFileSize requires Buffer/File/Blob.');
  1430. case 7:
  1431. case "end":
  1432. return _context4.stop();
  1433. }
  1434. }
  1435. }, _callee4);
  1436. }));
  1437. function _getFileSize(_x7) {
  1438. return _getFileSize2.apply(this, arguments);
  1439. }
  1440. return _getFileSize;
  1441. }();
  1442. /*
  1443. * Readable stream for Web File
  1444. */
  1445. var _require6 = require('stream'),
  1446. Readable = _require6.Readable;
  1447. function WebFileReadStream(file, options) {
  1448. if (!(this instanceof WebFileReadStream)) {
  1449. return new WebFileReadStream(file, options);
  1450. }
  1451. Readable.call(this, options);
  1452. this.file = file;
  1453. this.reader = new FileReader();
  1454. this.start = 0;
  1455. this.finish = false;
  1456. this.fileBuffer = null;
  1457. }
  1458. util.inherits(WebFileReadStream, Readable);
  1459. WebFileReadStream.prototype.readFileAndPush = function readFileAndPush(size) {
  1460. if (this.fileBuffer) {
  1461. var pushRet = true;
  1462. while (pushRet && this.fileBuffer && this.start < this.fileBuffer.length) {
  1463. var start = this.start;
  1464. var end = start + size;
  1465. end = end > this.fileBuffer.length ? this.fileBuffer.length : end;
  1466. this.start = end;
  1467. pushRet = this.push(this.fileBuffer.slice(start, end));
  1468. }
  1469. }
  1470. };
  1471. WebFileReadStream.prototype._read = function _read(size) {
  1472. if (this.file && this.start >= this.file.size || this.fileBuffer && this.start >= this.fileBuffer.length || this.finish || this.start === 0 && !this.file) {
  1473. if (!this.finish) {
  1474. this.fileBuffer = null;
  1475. this.finish = true;
  1476. }
  1477. this.push(null);
  1478. return;
  1479. }
  1480. var defaultReadSize = 16 * 1024;
  1481. size = size || defaultReadSize;
  1482. var that = this;
  1483. this.reader.onload = function onload(e) {
  1484. that.fileBuffer = Buffer.from(new Uint8Array(e.target.result));
  1485. that.file = null;
  1486. that.readFileAndPush(size);
  1487. };
  1488. if (this.start === 0) {
  1489. this.reader.readAsArrayBuffer(this.file);
  1490. } else {
  1491. this.readFileAndPush(size);
  1492. }
  1493. };
  1494. function getBuffer(file) {
  1495. // Some browsers do not support Blob.prototype.arrayBuffer, such as IE
  1496. if (file.arrayBuffer) return file.arrayBuffer();
  1497. return new Promise(function (resolve, reject) {
  1498. var reader = new FileReader();
  1499. reader.onload = function (e) {
  1500. resolve(e.target.result);
  1501. };
  1502. reader.onerror = function (e) {
  1503. reject(e);
  1504. };
  1505. reader.readAsArrayBuffer(file);
  1506. });
  1507. }
  1508. proto._createBuffer = /*#__PURE__*/function () {
  1509. var _createBuffer2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5(file, start, end) {
  1510. var _file, fileContent;
  1511. return _regenerator.default.wrap(function _callee5$(_context5) {
  1512. while (1) {
  1513. switch (_context5.prev = _context5.next) {
  1514. case 0:
  1515. if (!(isBlob(file) || isFile(file))) {
  1516. _context5.next = 8;
  1517. break;
  1518. }
  1519. _file = file.slice(start, end);
  1520. _context5.next = 4;
  1521. return getBuffer(_file);
  1522. case 4:
  1523. fileContent = _context5.sent;
  1524. return _context5.abrupt("return", Buffer.from(fileContent));
  1525. case 8:
  1526. if (!isBuffer(file)) {
  1527. _context5.next = 12;
  1528. break;
  1529. }
  1530. return _context5.abrupt("return", file.subarray(start, end));
  1531. case 12:
  1532. throw new Error('_createBuffer requires File/Blob/Buffer.');
  1533. case 13:
  1534. case "end":
  1535. return _context5.stop();
  1536. }
  1537. }
  1538. }, _callee5);
  1539. }));
  1540. function _createBuffer(_x8, _x9, _x10) {
  1541. return _createBuffer2.apply(this, arguments);
  1542. }
  1543. return _createBuffer;
  1544. }();
  1545. proto._getPartSize = function _getPartSize(fileSize, partSize) {
  1546. var maxNumParts = 10 * 1000;
  1547. var defaultPartSize = 1 * 1024 * 1024;
  1548. if (!partSize) partSize = defaultPartSize;
  1549. var safeSize = Math.ceil(fileSize / maxNumParts);
  1550. if (partSize < safeSize) {
  1551. partSize = safeSize;
  1552. console.warn("partSize has been set to ".concat(partSize, ", because the partSize you provided causes partNumber to be greater than 10,000"));
  1553. }
  1554. return partSize;
  1555. };
  1556. proto._divideParts = function _divideParts(fileSize, partSize) {
  1557. var numParts = Math.ceil(fileSize / partSize);
  1558. var partOffs = [];
  1559. for (var i = 0; i < numParts; i++) {
  1560. var start = partSize * i;
  1561. var end = Math.min(start + partSize, fileSize);
  1562. partOffs.push({
  1563. start: start,
  1564. end: end
  1565. });
  1566. }
  1567. return partOffs;
  1568. };
  1569. }).call(this)}).call(this,require("buffer").Buffer)
  1570. },{"../common/utils/isArray":61,"../common/utils/isBlob":62,"../common/utils/isBuffer":63,"../common/utils/isFile":64,"../common/utils/retry":70,"@babel/runtime/helpers/asyncToGenerator":73,"@babel/runtime/helpers/interopRequireDefault":74,"@babel/runtime/regenerator":76,"buffer":85,"copy-to":88,"core-js/modules/es.array-buffer.slice.js":240,"core-js/modules/es.array.concat.js":241,"core-js/modules/es.array.filter.js":243,"core-js/modules/es.array.find.js":244,"core-js/modules/es.array.from.js":245,"core-js/modules/es.array.iterator.js":247,"core-js/modules/es.array.map.js":249,"core-js/modules/es.array.slice.js":250,"core-js/modules/es.function.name.js":253,"core-js/modules/es.object.to-string.js":258,"core-js/modules/es.promise.js":259,"core-js/modules/es.regexp.to-string.js":262,"core-js/modules/es.string.iterator.js":264,"core-js/modules/es.typed-array.copy-within.js":272,"core-js/modules/es.typed-array.every.js":273,"core-js/modules/es.typed-array.fill.js":274,"core-js/modules/es.typed-array.filter.js":275,"core-js/modules/es.typed-array.find-index.js":276,"core-js/modules/es.typed-array.find.js":277,"core-js/modules/es.typed-array.for-each.js":278,"core-js/modules/es.typed-array.includes.js":279,"core-js/modules/es.typed-array.index-of.js":280,"core-js/modules/es.typed-array.iterator.js":281,"core-js/modules/es.typed-array.join.js":282,"core-js/modules/es.typed-array.last-index-of.js":283,"core-js/modules/es.typed-array.map.js":284,"core-js/modules/es.typed-array.reduce-right.js":285,"core-js/modules/es.typed-array.reduce.js":286,"core-js/modules/es.typed-array.reverse.js":287,"core-js/modules/es.typed-array.set.js":288,"core-js/modules/es.typed-array.slice.js":289,"core-js/modules/es.typed-array.some.js":290,"core-js/modules/es.typed-array.sort.js":291,"core-js/modules/es.typed-array.subarray.js":292,"core-js/modules/es.typed-array.to-locale-string.js":293,"core-js/modules/es.typed-array.to-string.js":294,"core-js/modules/es.typed-array.uint8-array.js":295,"mime":317,"path":321,"stream":345,"util":352}],5:[function(require,module,exports){
  1571. "use strict";
  1572. var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
  1573. require("core-js/modules/es.function.name.js");
  1574. require("core-js/modules/es.object.to-string.js");
  1575. require("core-js/modules/es.regexp.to-string.js");
  1576. require("core-js/modules/es.array.map.js");
  1577. require("core-js/modules/es.number.constructor.js");
  1578. require("core-js/modules/es.object.assign.js");
  1579. require("core-js/modules/es.regexp.exec.js");
  1580. require("core-js/modules/es.string.replace.js");
  1581. require("core-js/modules/web.dom-collections.for-each.js");
  1582. require("core-js/modules/es.object.keys.js");
  1583. require("core-js/modules/es.promise.js");
  1584. var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
  1585. var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
  1586. // const debug = require('debug')('ali-oss:object');
  1587. var fs = require('fs');
  1588. var copy = require('copy-to');
  1589. var path = require('path');
  1590. var mime = require('mime');
  1591. var callback = require('../common/callback');
  1592. var merge = require('merge-descriptors');
  1593. var _require = require('../common/utils/isBlob'),
  1594. isBlob = _require.isBlob;
  1595. var _require2 = require('../common/utils/isFile'),
  1596. isFile = _require2.isFile;
  1597. var _require3 = require('../common/utils/isBuffer'),
  1598. isBuffer = _require3.isBuffer;
  1599. var _require4 = require('../common/utils/obj2xml'),
  1600. obj2xml = _require4.obj2xml; // var assert = require('assert');
  1601. var proto = exports;
  1602. /**
  1603. * Object operations
  1604. */
  1605. /**
  1606. * append an object from String(file path)/Buffer/ReadableStream
  1607. * @param {String} name the object key
  1608. * @param {Mixed} file String(file path)/Buffer/ReadableStream
  1609. * @param {Object} options
  1610. * @return {Object}
  1611. */
  1612. proto.append = /*#__PURE__*/function () {
  1613. var _append = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(name, file, options) {
  1614. var result;
  1615. return _regenerator.default.wrap(function _callee$(_context) {
  1616. while (1) {
  1617. switch (_context.prev = _context.next) {
  1618. case 0:
  1619. options = options || {};
  1620. if (options.position === undefined) options.position = '0';
  1621. options.subres = {
  1622. append: '',
  1623. position: options.position
  1624. };
  1625. options.method = 'POST';
  1626. _context.next = 6;
  1627. return this.put(name, file, options);
  1628. case 6:
  1629. result = _context.sent;
  1630. result.nextAppendPosition = result.res.headers['x-oss-next-append-position'];
  1631. return _context.abrupt("return", result);
  1632. case 9:
  1633. case "end":
  1634. return _context.stop();
  1635. }
  1636. }
  1637. }, _callee, this);
  1638. }));
  1639. function append(_x, _x2, _x3) {
  1640. return _append.apply(this, arguments);
  1641. }
  1642. return append;
  1643. }();
  1644. /**
  1645. * put an object from String(file path)/Buffer/ReadableStream
  1646. * @param {String} name the object key
  1647. * @param {Mixed} file String(file path)/Buffer/ReadableStream
  1648. * @param {Object} options
  1649. * {Object} options.callback The callback parameter is composed of a JSON string encoded in Base64
  1650. * {String} options.callback.url the OSS sends a callback request to this URL
  1651. * {String} options.callback.host The host header value for initiating callback requests
  1652. * {String} options.callback.body The value of the request body when a callback is initiated
  1653. * {String} options.callback.contentType The Content-Type of the callback requests initiatiated
  1654. * {Object} options.callback.customValue Custom parameters are a map of key-values, e.g:
  1655. * customValue = {
  1656. * key1: 'value1',
  1657. * key2: 'value2'
  1658. * }
  1659. * @return {Object}
  1660. */
  1661. proto.put = /*#__PURE__*/function () {
  1662. var _put = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(name, file, options) {
  1663. var content, method, params, result, ret;
  1664. return _regenerator.default.wrap(function _callee2$(_context2) {
  1665. while (1) {
  1666. switch (_context2.prev = _context2.next) {
  1667. case 0:
  1668. options = options || {};
  1669. options.disabledMD5 = options.disabledMD5 === undefined ? true : !!options.disabledMD5;
  1670. options.headers = options.headers || {};
  1671. name = this._objectName(name);
  1672. if (!isBuffer(file)) {
  1673. _context2.next = 8;
  1674. break;
  1675. }
  1676. content = file;
  1677. _context2.next = 19;
  1678. break;
  1679. case 8:
  1680. if (!(isBlob(file) || isFile(file))) {
  1681. _context2.next = 18;
  1682. break;
  1683. }
  1684. if (!options.mime) {
  1685. if (isFile(file)) {
  1686. options.mime = mime.getType(path.extname(file.name));
  1687. } else {
  1688. options.mime = file.type;
  1689. }
  1690. }
  1691. _context2.next = 12;
  1692. return this._createBuffer(file, 0, file.size);
  1693. case 12:
  1694. content = _context2.sent;
  1695. _context2.next = 15;
  1696. return this._getFileSize(file);
  1697. case 15:
  1698. options.contentLength = _context2.sent;
  1699. _context2.next = 19;
  1700. break;
  1701. case 18:
  1702. throw new TypeError('Must provide Buffer/Blob/File for put.');
  1703. case 19:
  1704. this._convertMetaToHeaders(options.meta, options.headers);
  1705. method = options.method || 'PUT';
  1706. params = this._objectRequestParams(method, name, options);
  1707. callback.encodeCallback(params, options);
  1708. params.mime = options.mime;
  1709. params.disabledMD5 = options.disabledMD5;
  1710. params.content = content;
  1711. params.successStatuses = [200];
  1712. _context2.next = 29;
  1713. return this.request(params);
  1714. case 29:
  1715. result = _context2.sent;
  1716. ret = {
  1717. name: name,
  1718. url: this._objectUrl(name),
  1719. res: result.res
  1720. };
  1721. if (params.headers && params.headers['x-oss-callback']) {
  1722. ret.data = JSON.parse(result.data.toString());
  1723. }
  1724. return _context2.abrupt("return", ret);
  1725. case 33:
  1726. case "end":
  1727. return _context2.stop();
  1728. }
  1729. }
  1730. }, _callee2, this);
  1731. }));
  1732. function put(_x4, _x5, _x6) {
  1733. return _put.apply(this, arguments);
  1734. }
  1735. return put;
  1736. }();
  1737. /**
  1738. * put an object from ReadableStream. If `options.contentLength` is
  1739. * not provided, chunked encoding is used.
  1740. * @param {String} name the object key
  1741. * @param {Readable} stream the ReadableStream
  1742. * @param {Object} options
  1743. * @return {Object}
  1744. */
  1745. proto.putStream = /*#__PURE__*/function () {
  1746. var _putStream = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3(name, stream, options) {
  1747. var method, params, result, ret;
  1748. return _regenerator.default.wrap(function _callee3$(_context3) {
  1749. while (1) {
  1750. switch (_context3.prev = _context3.next) {
  1751. case 0:
  1752. options = options || {};
  1753. options.headers = options.headers || {};
  1754. name = this._objectName(name);
  1755. if (options.contentLength) {
  1756. options.headers['Content-Length'] = options.contentLength;
  1757. } else {
  1758. options.headers['Transfer-Encoding'] = 'chunked';
  1759. }
  1760. this._convertMetaToHeaders(options.meta, options.headers);
  1761. method = options.method || 'PUT';
  1762. params = this._objectRequestParams(method, name, options);
  1763. callback.encodeCallback(params, options);
  1764. params.mime = options.mime;
  1765. params.stream = stream;
  1766. params.successStatuses = [200];
  1767. _context3.next = 13;
  1768. return this.request(params);
  1769. case 13:
  1770. result = _context3.sent;
  1771. ret = {
  1772. name: name,
  1773. url: this._objectUrl(name),
  1774. res: result.res
  1775. };
  1776. if (params.headers && params.headers['x-oss-callback']) {
  1777. ret.data = JSON.parse(result.data.toString());
  1778. }
  1779. return _context3.abrupt("return", ret);
  1780. case 17:
  1781. case "end":
  1782. return _context3.stop();
  1783. }
  1784. }
  1785. }, _callee3, this);
  1786. }));
  1787. function putStream(_x7, _x8, _x9) {
  1788. return _putStream.apply(this, arguments);
  1789. }
  1790. return putStream;
  1791. }();
  1792. merge(proto, require('../common/object/copyObject'));
  1793. merge(proto, require('../common/object/getObjectTagging'));
  1794. merge(proto, require('../common/object/putObjectTagging'));
  1795. merge(proto, require('../common/object/deleteObjectTagging'));
  1796. merge(proto, require('../common/image'));
  1797. merge(proto, require('../common/object/getBucketVersions'));
  1798. merge(proto, require('../common/object/getACL'));
  1799. merge(proto, require('../common/object/putACL'));
  1800. merge(proto, require('../common/object/head'));
  1801. merge(proto, require('../common/object/delete'));
  1802. merge(proto, require('../common/object/get'));
  1803. merge(proto, require('../common/object/putSymlink'));
  1804. merge(proto, require('../common/object/getSymlink'));
  1805. merge(proto, require('../common/object/deleteMulti'));
  1806. merge(proto, require('../common/object/getObjectMeta'));
  1807. merge(proto, require('../common/object/getObjectUrl'));
  1808. merge(proto, require('../common/object/generateObjectUrl'));
  1809. merge(proto, require('../common/object/signatureUrl'));
  1810. proto.putMeta = /*#__PURE__*/function () {
  1811. var _putMeta = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4(name, meta, options) {
  1812. var copyResult;
  1813. return _regenerator.default.wrap(function _callee4$(_context4) {
  1814. while (1) {
  1815. switch (_context4.prev = _context4.next) {
  1816. case 0:
  1817. _context4.next = 2;
  1818. return this.copy(name, name, {
  1819. meta: meta || {},
  1820. timeout: options && options.timeout,
  1821. ctx: options && options.ctx
  1822. });
  1823. case 2:
  1824. copyResult = _context4.sent;
  1825. return _context4.abrupt("return", copyResult);
  1826. case 4:
  1827. case "end":
  1828. return _context4.stop();
  1829. }
  1830. }
  1831. }, _callee4, this);
  1832. }));
  1833. function putMeta(_x10, _x11, _x12) {
  1834. return _putMeta.apply(this, arguments);
  1835. }
  1836. return putMeta;
  1837. }();
  1838. proto.list = /*#__PURE__*/function () {
  1839. var _list = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5(query, options) {
  1840. var params, result, objects, that, prefixes;
  1841. return _regenerator.default.wrap(function _callee5$(_context5) {
  1842. while (1) {
  1843. switch (_context5.prev = _context5.next) {
  1844. case 0:
  1845. // prefix, marker, max-keys, delimiter
  1846. params = this._objectRequestParams('GET', '', options);
  1847. params.query = query;
  1848. params.xmlResponse = true;
  1849. params.successStatuses = [200];
  1850. _context5.next = 6;
  1851. return this.request(params);
  1852. case 6:
  1853. result = _context5.sent;
  1854. objects = result.data.Contents || [];
  1855. that = this;
  1856. if (objects) {
  1857. if (!Array.isArray(objects)) {
  1858. objects = [objects];
  1859. }
  1860. objects = objects.map(function (obj) {
  1861. return {
  1862. name: obj.Key,
  1863. url: that._objectUrl(obj.Key),
  1864. lastModified: obj.LastModified,
  1865. etag: obj.ETag,
  1866. type: obj.Type,
  1867. size: Number(obj.Size),
  1868. storageClass: obj.StorageClass,
  1869. owner: {
  1870. id: obj.Owner.ID,
  1871. displayName: obj.Owner.DisplayName
  1872. }
  1873. };
  1874. });
  1875. }
  1876. prefixes = result.data.CommonPrefixes || null;
  1877. if (prefixes) {
  1878. if (!Array.isArray(prefixes)) {
  1879. prefixes = [prefixes];
  1880. }
  1881. prefixes = prefixes.map(function (item) {
  1882. return item.Prefix;
  1883. });
  1884. }
  1885. return _context5.abrupt("return", {
  1886. res: result.res,
  1887. objects: objects,
  1888. prefixes: prefixes,
  1889. nextMarker: result.data.NextMarker || null,
  1890. isTruncated: result.data.IsTruncated === 'true'
  1891. });
  1892. case 13:
  1893. case "end":
  1894. return _context5.stop();
  1895. }
  1896. }
  1897. }, _callee5, this);
  1898. }));
  1899. function list(_x13, _x14) {
  1900. return _list.apply(this, arguments);
  1901. }
  1902. return list;
  1903. }();
  1904. proto.listV2 = /*#__PURE__*/function () {
  1905. var _listV = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6(query) {
  1906. var options,
  1907. continuation_token,
  1908. params,
  1909. result,
  1910. objects,
  1911. that,
  1912. prefixes,
  1913. _args6 = arguments;
  1914. return _regenerator.default.wrap(function _callee6$(_context6) {
  1915. while (1) {
  1916. switch (_context6.prev = _context6.next) {
  1917. case 0:
  1918. options = _args6.length > 1 && _args6[1] !== undefined ? _args6[1] : {};
  1919. continuation_token = query['continuation-token'] || query.continuationToken;
  1920. if (continuation_token) {
  1921. options.subres = Object.assign({
  1922. 'continuation-token': continuation_token
  1923. }, options.subres);
  1924. }
  1925. params = this._objectRequestParams('GET', '', options);
  1926. params.query = Object.assign({
  1927. 'list-type': 2
  1928. }, query);
  1929. delete params.query['continuation-token'];
  1930. delete params.query.continuationToken;
  1931. params.xmlResponse = true;
  1932. params.successStatuses = [200];
  1933. _context6.next = 11;
  1934. return this.request(params);
  1935. case 11:
  1936. result = _context6.sent;
  1937. objects = result.data.Contents || [];
  1938. that = this;
  1939. if (objects) {
  1940. if (!Array.isArray(objects)) {
  1941. objects = [objects];
  1942. }
  1943. objects = objects.map(function (obj) {
  1944. return {
  1945. name: obj.Key,
  1946. url: that._objectUrl(obj.Key),
  1947. lastModified: obj.LastModified,
  1948. etag: obj.ETag,
  1949. type: obj.Type,
  1950. size: Number(obj.Size),
  1951. storageClass: obj.StorageClass,
  1952. owner: obj.Owner ? {
  1953. id: obj.Owner.ID,
  1954. displayName: obj.Owner.DisplayName
  1955. } : null
  1956. };
  1957. });
  1958. }
  1959. prefixes = result.data.CommonPrefixes || null;
  1960. if (prefixes) {
  1961. if (!Array.isArray(prefixes)) {
  1962. prefixes = [prefixes];
  1963. }
  1964. prefixes = prefixes.map(function (item) {
  1965. return item.Prefix;
  1966. });
  1967. }
  1968. return _context6.abrupt("return", {
  1969. res: result.res,
  1970. objects: objects,
  1971. prefixes: prefixes,
  1972. isTruncated: result.data.IsTruncated === 'true',
  1973. keyCount: +result.data.KeyCount,
  1974. continuationToken: result.data.ContinuationToken || null,
  1975. nextContinuationToken: result.data.NextContinuationToken || null
  1976. });
  1977. case 18:
  1978. case "end":
  1979. return _context6.stop();
  1980. }
  1981. }
  1982. }, _callee6, this);
  1983. }));
  1984. function listV2(_x15) {
  1985. return _listV.apply(this, arguments);
  1986. }
  1987. return listV2;
  1988. }();
  1989. /**
  1990. * Restore Object
  1991. * @param {String} name the object key
  1992. * @param {Object} options
  1993. * @returns {{res}}
  1994. */
  1995. proto.restore = /*#__PURE__*/function () {
  1996. var _restore = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee7(name) {
  1997. var options,
  1998. params,
  1999. paramsXMLObj,
  2000. result,
  2001. _args7 = arguments;
  2002. return _regenerator.default.wrap(function _callee7$(_context7) {
  2003. while (1) {
  2004. switch (_context7.prev = _context7.next) {
  2005. case 0:
  2006. options = _args7.length > 1 && _args7[1] !== undefined ? _args7[1] : {
  2007. type: 'Archive'
  2008. };
  2009. options = options || {};
  2010. options.subres = Object.assign({
  2011. restore: ''
  2012. }, options.subres);
  2013. if (options.versionId) {
  2014. options.subres.versionId = options.versionId;
  2015. }
  2016. params = this._objectRequestParams('POST', name, options);
  2017. if (options.type === 'ColdArchive') {
  2018. paramsXMLObj = {
  2019. RestoreRequest: {
  2020. Days: options.Days ? options.Days : 2,
  2021. JobParameters: {
  2022. Tier: options.JobParameters ? options.JobParameters : 'Standard'
  2023. }
  2024. }
  2025. };
  2026. params.content = obj2xml(paramsXMLObj, {
  2027. headers: true
  2028. });
  2029. params.mime = 'xml';
  2030. }
  2031. params.successStatuses = [202];
  2032. _context7.next = 9;
  2033. return this.request(params);
  2034. case 9:
  2035. result = _context7.sent;
  2036. return _context7.abrupt("return", {
  2037. res: result.res
  2038. });
  2039. case 11:
  2040. case "end":
  2041. return _context7.stop();
  2042. }
  2043. }
  2044. }, _callee7, this);
  2045. }));
  2046. function restore(_x16) {
  2047. return _restore.apply(this, arguments);
  2048. }
  2049. return restore;
  2050. }();
  2051. proto._objectUrl = function _objectUrl(name) {
  2052. return this._getReqUrl({
  2053. bucket: this.options.bucket,
  2054. object: name
  2055. });
  2056. };
  2057. /**
  2058. * generator request params
  2059. * @return {Object} params
  2060. *
  2061. * @api private
  2062. */
  2063. proto._objectRequestParams = function _objectRequestParams(method, name, options) {
  2064. if (!this.options.bucket && !this.options.cname) {
  2065. throw new Error('Please create a bucket first');
  2066. }
  2067. options = options || {};
  2068. name = this._objectName(name);
  2069. var params = {
  2070. object: name,
  2071. bucket: this.options.bucket,
  2072. method: method,
  2073. subres: options && options.subres,
  2074. timeout: options && options.timeout,
  2075. ctx: options && options.ctx
  2076. };
  2077. if (options.headers) {
  2078. params.headers = {};
  2079. copy(options.headers).to(params.headers);
  2080. }
  2081. return params;
  2082. };
  2083. proto._objectName = function _objectName(name) {
  2084. return name.replace(/^\/+/, '');
  2085. };
  2086. proto._convertMetaToHeaders = function _convertMetaToHeaders(meta, headers) {
  2087. if (!meta) {
  2088. return;
  2089. }
  2090. Object.keys(meta).forEach(function (k) {
  2091. headers["x-oss-meta-".concat(k)] = meta[k];
  2092. });
  2093. };
  2094. proto._deleteFileSafe = function _deleteFileSafe(filepath) {
  2095. var _this = this;
  2096. return new Promise(function (resolve) {
  2097. fs.exists(filepath, function (exists) {
  2098. if (!exists) {
  2099. resolve();
  2100. } else {
  2101. fs.unlink(filepath, function (err) {
  2102. if (err) {
  2103. _this.debug('unlink %j error: %s', filepath, err, 'error');
  2104. }
  2105. resolve();
  2106. });
  2107. }
  2108. });
  2109. });
  2110. };
  2111. },{"../common/callback":24,"../common/image":27,"../common/object/copyObject":31,"../common/object/delete":32,"../common/object/deleteMulti":33,"../common/object/deleteObjectTagging":34,"../common/object/generateObjectUrl":35,"../common/object/get":36,"../common/object/getACL":37,"../common/object/getBucketVersions":38,"../common/object/getObjectMeta":39,"../common/object/getObjectTagging":40,"../common/object/getObjectUrl":41,"../common/object/getSymlink":42,"../common/object/head":43,"../common/object/putACL":44,"../common/object/putObjectTagging":45,"../common/object/putSymlink":46,"../common/object/signatureUrl":47,"../common/utils/isBlob":62,"../common/utils/isBuffer":63,"../common/utils/isFile":64,"../common/utils/obj2xml":69,"@babel/runtime/helpers/asyncToGenerator":73,"@babel/runtime/helpers/interopRequireDefault":74,"@babel/runtime/regenerator":76,"copy-to":88,"core-js/modules/es.array.map.js":249,"core-js/modules/es.function.name.js":253,"core-js/modules/es.number.constructor.js":254,"core-js/modules/es.object.assign.js":255,"core-js/modules/es.object.keys.js":257,"core-js/modules/es.object.to-string.js":258,"core-js/modules/es.promise.js":259,"core-js/modules/es.regexp.exec.js":261,"core-js/modules/es.regexp.to-string.js":262,"core-js/modules/es.string.replace.js":266,"core-js/modules/web.dom-collections.for-each.js":296,"fs":84,"merge-descriptors":315,"mime":317,"path":321}],6:[function(require,module,exports){
  2112. "use strict";
  2113. exports.version = "6.17.1";
  2114. },{}],7:[function(require,module,exports){
  2115. "use strict";
  2116. var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
  2117. var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
  2118. var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
  2119. Object.defineProperty(exports, "__esModule", {
  2120. value: true
  2121. });
  2122. exports.abortBucketWorm = void 0;
  2123. var checkBucketName_1 = require("../utils/checkBucketName");
  2124. function abortBucketWorm(_x, _x2) {
  2125. return _abortBucketWorm.apply(this, arguments);
  2126. }
  2127. function _abortBucketWorm() {
  2128. _abortBucketWorm = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(name, options) {
  2129. var params, result;
  2130. return _regenerator.default.wrap(function _callee$(_context) {
  2131. while (1) {
  2132. switch (_context.prev = _context.next) {
  2133. case 0:
  2134. checkBucketName_1.checkBucketName(name);
  2135. params = this._bucketRequestParams('DELETE', name, 'worm', options);
  2136. _context.next = 4;
  2137. return this.request(params);
  2138. case 4:
  2139. result = _context.sent;
  2140. return _context.abrupt("return", {
  2141. res: result.res,
  2142. status: result.status
  2143. });
  2144. case 6:
  2145. case "end":
  2146. return _context.stop();
  2147. }
  2148. }
  2149. }, _callee, this);
  2150. }));
  2151. return _abortBucketWorm.apply(this, arguments);
  2152. }
  2153. exports.abortBucketWorm = abortBucketWorm;
  2154. },{"../utils/checkBucketName":50,"@babel/runtime/helpers/asyncToGenerator":73,"@babel/runtime/helpers/interopRequireDefault":74,"@babel/runtime/regenerator":76}],8:[function(require,module,exports){
  2155. "use strict";
  2156. var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
  2157. var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
  2158. var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
  2159. Object.defineProperty(exports, "__esModule", {
  2160. value: true
  2161. });
  2162. exports.completeBucketWorm = void 0;
  2163. var checkBucketName_1 = require("../utils/checkBucketName");
  2164. function completeBucketWorm(_x, _x2, _x3) {
  2165. return _completeBucketWorm.apply(this, arguments);
  2166. }
  2167. function _completeBucketWorm() {
  2168. _completeBucketWorm = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(name, wormId, options) {
  2169. var params, result;
  2170. return _regenerator.default.wrap(function _callee$(_context) {
  2171. while (1) {
  2172. switch (_context.prev = _context.next) {
  2173. case 0:
  2174. checkBucketName_1.checkBucketName(name);
  2175. params = this._bucketRequestParams('POST', name, {
  2176. wormId: wormId
  2177. }, options);
  2178. _context.next = 4;
  2179. return this.request(params);
  2180. case 4:
  2181. result = _context.sent;
  2182. return _context.abrupt("return", {
  2183. res: result.res,
  2184. status: result.status
  2185. });
  2186. case 6:
  2187. case "end":
  2188. return _context.stop();
  2189. }
  2190. }
  2191. }, _callee, this);
  2192. }));
  2193. return _completeBucketWorm.apply(this, arguments);
  2194. }
  2195. exports.completeBucketWorm = completeBucketWorm;
  2196. },{"../utils/checkBucketName":50,"@babel/runtime/helpers/asyncToGenerator":73,"@babel/runtime/helpers/interopRequireDefault":74,"@babel/runtime/regenerator":76}],9:[function(require,module,exports){
  2197. "use strict";
  2198. var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
  2199. var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
  2200. require("core-js/modules/es.object.assign.js");
  2201. var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
  2202. Object.defineProperty(exports, "__esModule", {
  2203. value: true
  2204. });
  2205. exports.deleteBucketInventory = void 0;
  2206. var checkBucketName_1 = require("../utils/checkBucketName");
  2207. /**
  2208. * deleteBucketInventory
  2209. * @param {String} bucketName - bucket name
  2210. * @param {String} inventoryId
  2211. * @param {Object} options
  2212. */
  2213. function deleteBucketInventory(_x, _x2) {
  2214. return _deleteBucketInventory.apply(this, arguments);
  2215. }
  2216. function _deleteBucketInventory() {
  2217. _deleteBucketInventory = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(bucketName, inventoryId) {
  2218. var options,
  2219. subres,
  2220. params,
  2221. result,
  2222. _args = arguments;
  2223. return _regenerator.default.wrap(function _callee$(_context) {
  2224. while (1) {
  2225. switch (_context.prev = _context.next) {
  2226. case 0:
  2227. options = _args.length > 2 && _args[2] !== undefined ? _args[2] : {};
  2228. subres = Object.assign({
  2229. inventory: '',
  2230. inventoryId: inventoryId
  2231. }, options.subres);
  2232. checkBucketName_1.checkBucketName(bucketName);
  2233. params = this._bucketRequestParams('DELETE', bucketName, subres, options);
  2234. params.successStatuses = [204];
  2235. _context.next = 7;
  2236. return this.request(params);
  2237. case 7:
  2238. result = _context.sent;
  2239. return _context.abrupt("return", {
  2240. status: result.status,
  2241. res: result.res
  2242. });
  2243. case 9:
  2244. case "end":
  2245. return _context.stop();
  2246. }
  2247. }
  2248. }, _callee, this);
  2249. }));
  2250. return _deleteBucketInventory.apply(this, arguments);
  2251. }
  2252. exports.deleteBucketInventory = deleteBucketInventory;
  2253. },{"../utils/checkBucketName":50,"@babel/runtime/helpers/asyncToGenerator":73,"@babel/runtime/helpers/interopRequireDefault":74,"@babel/runtime/regenerator":76,"core-js/modules/es.object.assign.js":255}],10:[function(require,module,exports){
  2254. "use strict";
  2255. var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
  2256. var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
  2257. var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
  2258. var _require = require('../utils/checkBucketName'),
  2259. _checkBucketName = _require.checkBucketName;
  2260. var proto = exports;
  2261. proto.deleteBucketLifecycle = /*#__PURE__*/function () {
  2262. var _deleteBucketLifecycle = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(name, options) {
  2263. var params, result;
  2264. return _regenerator.default.wrap(function _callee$(_context) {
  2265. while (1) {
  2266. switch (_context.prev = _context.next) {
  2267. case 0:
  2268. _checkBucketName(name);
  2269. params = this._bucketRequestParams('DELETE', name, 'lifecycle', options);
  2270. params.successStatuses = [204];
  2271. _context.next = 5;
  2272. return this.request(params);
  2273. case 5:
  2274. result = _context.sent;
  2275. return _context.abrupt("return", {
  2276. res: result.res
  2277. });
  2278. case 7:
  2279. case "end":
  2280. return _context.stop();
  2281. }
  2282. }
  2283. }, _callee, this);
  2284. }));
  2285. function deleteBucketLifecycle(_x, _x2) {
  2286. return _deleteBucketLifecycle.apply(this, arguments);
  2287. }
  2288. return deleteBucketLifecycle;
  2289. }();
  2290. },{"../utils/checkBucketName":50,"@babel/runtime/helpers/asyncToGenerator":73,"@babel/runtime/helpers/interopRequireDefault":74,"@babel/runtime/regenerator":76}],11:[function(require,module,exports){
  2291. "use strict";
  2292. var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
  2293. var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
  2294. var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
  2295. var _require = require('../utils/checkBucketName'),
  2296. _checkBucketName = _require.checkBucketName;
  2297. var proto = exports;
  2298. proto.deleteBucketWebsite = /*#__PURE__*/function () {
  2299. var _deleteBucketWebsite = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(name, options) {
  2300. var params, result;
  2301. return _regenerator.default.wrap(function _callee$(_context) {
  2302. while (1) {
  2303. switch (_context.prev = _context.next) {
  2304. case 0:
  2305. _checkBucketName(name);
  2306. params = this._bucketRequestParams('DELETE', name, 'website', options);
  2307. params.successStatuses = [204];
  2308. _context.next = 5;
  2309. return this.request(params);
  2310. case 5:
  2311. result = _context.sent;
  2312. return _context.abrupt("return", {
  2313. res: result.res
  2314. });
  2315. case 7:
  2316. case "end":
  2317. return _context.stop();
  2318. }
  2319. }
  2320. }, _callee, this);
  2321. }));
  2322. function deleteBucketWebsite(_x, _x2) {
  2323. return _deleteBucketWebsite.apply(this, arguments);
  2324. }
  2325. return deleteBucketWebsite;
  2326. }();
  2327. },{"../utils/checkBucketName":50,"@babel/runtime/helpers/asyncToGenerator":73,"@babel/runtime/helpers/interopRequireDefault":74,"@babel/runtime/regenerator":76}],12:[function(require,module,exports){
  2328. "use strict";
  2329. var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
  2330. var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
  2331. var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
  2332. Object.defineProperty(exports, "__esModule", {
  2333. value: true
  2334. });
  2335. exports.extendBucketWorm = void 0;
  2336. var checkBucketName_1 = require("../utils/checkBucketName");
  2337. var obj2xml_1 = require("../utils/obj2xml");
  2338. function extendBucketWorm(_x, _x2, _x3, _x4) {
  2339. return _extendBucketWorm.apply(this, arguments);
  2340. }
  2341. function _extendBucketWorm() {
  2342. _extendBucketWorm = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(name, wormId, days, options) {
  2343. var params, paramlXMLObJ, result;
  2344. return _regenerator.default.wrap(function _callee$(_context) {
  2345. while (1) {
  2346. switch (_context.prev = _context.next) {
  2347. case 0:
  2348. checkBucketName_1.checkBucketName(name);
  2349. params = this._bucketRequestParams('POST', name, {
  2350. wormExtend: '',
  2351. wormId: wormId
  2352. }, options);
  2353. paramlXMLObJ = {
  2354. ExtendWormConfiguration: {
  2355. RetentionPeriodInDays: days
  2356. }
  2357. };
  2358. params.mime = 'xml';
  2359. params.content = obj2xml_1.obj2xml(paramlXMLObJ, {
  2360. headers: true
  2361. });
  2362. params.successStatuses = [200];
  2363. _context.next = 8;
  2364. return this.request(params);
  2365. case 8:
  2366. result = _context.sent;
  2367. return _context.abrupt("return", {
  2368. res: result.res,
  2369. status: result.status
  2370. });
  2371. case 10:
  2372. case "end":
  2373. return _context.stop();
  2374. }
  2375. }
  2376. }, _callee, this);
  2377. }));
  2378. return _extendBucketWorm.apply(this, arguments);
  2379. }
  2380. exports.extendBucketWorm = extendBucketWorm;
  2381. },{"../utils/checkBucketName":50,"../utils/obj2xml":69,"@babel/runtime/helpers/asyncToGenerator":73,"@babel/runtime/helpers/interopRequireDefault":74,"@babel/runtime/regenerator":76}],13:[function(require,module,exports){
  2382. "use strict";
  2383. var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
  2384. var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
  2385. require("core-js/modules/es.object.assign.js");
  2386. var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
  2387. Object.defineProperty(exports, "__esModule", {
  2388. value: true
  2389. });
  2390. exports.getBucketInventory = void 0;
  2391. var checkBucketName_1 = require("../utils/checkBucketName");
  2392. var formatInventoryConfig_1 = require("../utils/formatInventoryConfig");
  2393. /**
  2394. * getBucketInventory
  2395. * @param {String} bucketName - bucket name
  2396. * @param {String} inventoryId
  2397. * @param {Object} options
  2398. */
  2399. function getBucketInventory(_x, _x2) {
  2400. return _getBucketInventory.apply(this, arguments);
  2401. }
  2402. function _getBucketInventory() {
  2403. _getBucketInventory = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(bucketName, inventoryId) {
  2404. var options,
  2405. subres,
  2406. params,
  2407. result,
  2408. _args = arguments;
  2409. return _regenerator.default.wrap(function _callee$(_context) {
  2410. while (1) {
  2411. switch (_context.prev = _context.next) {
  2412. case 0:
  2413. options = _args.length > 2 && _args[2] !== undefined ? _args[2] : {};
  2414. subres = Object.assign({
  2415. inventory: '',
  2416. inventoryId: inventoryId
  2417. }, options.subres);
  2418. checkBucketName_1.checkBucketName(bucketName);
  2419. params = this._bucketRequestParams('GET', bucketName, subres, options);
  2420. params.successStatuses = [200];
  2421. params.xmlResponse = true;
  2422. _context.next = 8;
  2423. return this.request(params);
  2424. case 8:
  2425. result = _context.sent;
  2426. return _context.abrupt("return", {
  2427. status: result.status,
  2428. res: result.res,
  2429. inventory: formatInventoryConfig_1.formatInventoryConfig(result.data)
  2430. });
  2431. case 10:
  2432. case "end":
  2433. return _context.stop();
  2434. }
  2435. }
  2436. }, _callee, this);
  2437. }));
  2438. return _getBucketInventory.apply(this, arguments);
  2439. }
  2440. exports.getBucketInventory = getBucketInventory;
  2441. },{"../utils/checkBucketName":50,"../utils/formatInventoryConfig":58,"@babel/runtime/helpers/asyncToGenerator":73,"@babel/runtime/helpers/interopRequireDefault":74,"@babel/runtime/regenerator":76,"core-js/modules/es.object.assign.js":255}],14:[function(require,module,exports){
  2442. "use strict";
  2443. var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
  2444. var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
  2445. require("core-js/modules/es.array.map.js");
  2446. var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
  2447. var _require = require('../utils/checkBucketName'),
  2448. _checkBucketName = _require.checkBucketName;
  2449. var _require2 = require('../utils/isArray'),
  2450. isArray = _require2.isArray;
  2451. var _require3 = require('../utils/formatObjKey'),
  2452. formatObjKey = _require3.formatObjKey;
  2453. var proto = exports;
  2454. proto.getBucketLifecycle = /*#__PURE__*/function () {
  2455. var _getBucketLifecycle = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(name, options) {
  2456. var params, result, rules;
  2457. return _regenerator.default.wrap(function _callee$(_context) {
  2458. while (1) {
  2459. switch (_context.prev = _context.next) {
  2460. case 0:
  2461. _checkBucketName(name);
  2462. params = this._bucketRequestParams('GET', name, 'lifecycle', options);
  2463. params.successStatuses = [200];
  2464. params.xmlResponse = true;
  2465. _context.next = 6;
  2466. return this.request(params);
  2467. case 6:
  2468. result = _context.sent;
  2469. rules = result.data.Rule || null;
  2470. if (rules) {
  2471. if (!isArray(rules)) {
  2472. rules = [rules];
  2473. }
  2474. rules = rules.map(function (_) {
  2475. if (_.ID) {
  2476. _.id = _.ID;
  2477. delete _.ID;
  2478. }
  2479. if (_.Tag && !isArray(_.Tag)) {
  2480. _.Tag = [_.Tag];
  2481. }
  2482. return formatObjKey(_, 'firstLowerCase');
  2483. });
  2484. }
  2485. return _context.abrupt("return", {
  2486. rules: rules,
  2487. res: result.res
  2488. });
  2489. case 10:
  2490. case "end":
  2491. return _context.stop();
  2492. }
  2493. }
  2494. }, _callee, this);
  2495. }));
  2496. function getBucketLifecycle(_x, _x2) {
  2497. return _getBucketLifecycle.apply(this, arguments);
  2498. }
  2499. return getBucketLifecycle;
  2500. }();
  2501. },{"../utils/checkBucketName":50,"../utils/formatObjKey":59,"../utils/isArray":61,"@babel/runtime/helpers/asyncToGenerator":73,"@babel/runtime/helpers/interopRequireDefault":74,"@babel/runtime/regenerator":76,"core-js/modules/es.array.map.js":249}],15:[function(require,module,exports){
  2502. "use strict";
  2503. var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
  2504. var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
  2505. var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
  2506. var _require = require('../utils/checkBucketName'),
  2507. _checkBucketName = _require.checkBucketName;
  2508. var proto = exports;
  2509. /**
  2510. * getBucketVersioning
  2511. * @param {String} bucketName - bucket name
  2512. */
  2513. proto.getBucketVersioning = /*#__PURE__*/function () {
  2514. var _getBucketVersioning = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(bucketName, options) {
  2515. var params, result, versionStatus;
  2516. return _regenerator.default.wrap(function _callee$(_context) {
  2517. while (1) {
  2518. switch (_context.prev = _context.next) {
  2519. case 0:
  2520. _checkBucketName(bucketName);
  2521. params = this._bucketRequestParams('GET', bucketName, 'versioning', options);
  2522. params.xmlResponse = true;
  2523. params.successStatuses = [200];
  2524. _context.next = 6;
  2525. return this.request(params);
  2526. case 6:
  2527. result = _context.sent;
  2528. versionStatus = result.data.Status;
  2529. return _context.abrupt("return", {
  2530. status: result.status,
  2531. versionStatus: versionStatus,
  2532. res: result.res
  2533. });
  2534. case 9:
  2535. case "end":
  2536. return _context.stop();
  2537. }
  2538. }
  2539. }, _callee, this);
  2540. }));
  2541. function getBucketVersioning(_x, _x2) {
  2542. return _getBucketVersioning.apply(this, arguments);
  2543. }
  2544. return getBucketVersioning;
  2545. }();
  2546. },{"../utils/checkBucketName":50,"@babel/runtime/helpers/asyncToGenerator":73,"@babel/runtime/helpers/interopRequireDefault":74,"@babel/runtime/regenerator":76}],16:[function(require,module,exports){
  2547. "use strict";
  2548. var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
  2549. var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
  2550. var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
  2551. var _require = require('../utils/checkBucketName'),
  2552. _checkBucketName = _require.checkBucketName;
  2553. var _require2 = require('../utils/isObject'),
  2554. isObject = _require2.isObject;
  2555. var proto = exports;
  2556. proto.getBucketWebsite = /*#__PURE__*/function () {
  2557. var _getBucketWebsite = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(name, options) {
  2558. var params, result, routingRules;
  2559. return _regenerator.default.wrap(function _callee$(_context) {
  2560. while (1) {
  2561. switch (_context.prev = _context.next) {
  2562. case 0:
  2563. _checkBucketName(name);
  2564. params = this._bucketRequestParams('GET', name, 'website', options);
  2565. params.successStatuses = [200];
  2566. params.xmlResponse = true;
  2567. _context.next = 6;
  2568. return this.request(params);
  2569. case 6:
  2570. result = _context.sent;
  2571. routingRules = [];
  2572. if (result.data.RoutingRules && result.data.RoutingRules.RoutingRule) {
  2573. if (isObject(result.data.RoutingRules.RoutingRule)) {
  2574. routingRules = [result.data.RoutingRules.RoutingRule];
  2575. } else {
  2576. routingRules = result.data.RoutingRules.RoutingRule;
  2577. }
  2578. }
  2579. return _context.abrupt("return", {
  2580. index: result.data.IndexDocument && result.data.IndexDocument.Suffix || '',
  2581. supportSubDir: result.data.IndexDocument && result.data.IndexDocument.SupportSubDir || 'false',
  2582. type: result.data.IndexDocument && result.data.IndexDocument.Type,
  2583. routingRules: routingRules,
  2584. error: result.data.ErrorDocument && result.data.ErrorDocument.Key || null,
  2585. res: result.res
  2586. });
  2587. case 10:
  2588. case "end":
  2589. return _context.stop();
  2590. }
  2591. }
  2592. }, _callee, this);
  2593. }));
  2594. function getBucketWebsite(_x, _x2) {
  2595. return _getBucketWebsite.apply(this, arguments);
  2596. }
  2597. return getBucketWebsite;
  2598. }();
  2599. },{"../utils/checkBucketName":50,"../utils/isObject":67,"@babel/runtime/helpers/asyncToGenerator":73,"@babel/runtime/helpers/interopRequireDefault":74,"@babel/runtime/regenerator":76}],17:[function(require,module,exports){
  2600. "use strict";
  2601. var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
  2602. var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
  2603. require("core-js/modules/es.object.assign.js");
  2604. var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
  2605. Object.defineProperty(exports, "__esModule", {
  2606. value: true
  2607. });
  2608. exports.getBucketWorm = void 0;
  2609. var checkBucketName_1 = require("../utils/checkBucketName");
  2610. var dataFix_1 = require("../utils/dataFix");
  2611. function getBucketWorm(_x, _x2) {
  2612. return _getBucketWorm.apply(this, arguments);
  2613. }
  2614. function _getBucketWorm() {
  2615. _getBucketWorm = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(name, options) {
  2616. var params, result;
  2617. return _regenerator.default.wrap(function _callee$(_context) {
  2618. while (1) {
  2619. switch (_context.prev = _context.next) {
  2620. case 0:
  2621. checkBucketName_1.checkBucketName(name);
  2622. params = this._bucketRequestParams('GET', name, 'worm', options);
  2623. params.successStatuses = [200];
  2624. params.xmlResponse = true;
  2625. _context.next = 6;
  2626. return this.request(params);
  2627. case 6:
  2628. result = _context.sent;
  2629. dataFix_1.dataFix(result.data, {
  2630. lowerFirst: true,
  2631. rename: {
  2632. RetentionPeriodInDays: 'days'
  2633. }
  2634. });
  2635. return _context.abrupt("return", Object.assign(Object.assign({}, result.data), {
  2636. res: result.res,
  2637. status: result.status
  2638. }));
  2639. case 9:
  2640. case "end":
  2641. return _context.stop();
  2642. }
  2643. }
  2644. }, _callee, this);
  2645. }));
  2646. return _getBucketWorm.apply(this, arguments);
  2647. }
  2648. exports.getBucketWorm = getBucketWorm;
  2649. },{"../utils/checkBucketName":50,"../utils/dataFix":55,"@babel/runtime/helpers/asyncToGenerator":73,"@babel/runtime/helpers/interopRequireDefault":74,"@babel/runtime/regenerator":76,"core-js/modules/es.object.assign.js":255}],18:[function(require,module,exports){
  2650. "use strict";
  2651. var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
  2652. var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
  2653. var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
  2654. Object.defineProperty(exports, "__esModule", {
  2655. value: true
  2656. });
  2657. exports.initiateBucketWorm = void 0;
  2658. var obj2xml_1 = require("../utils/obj2xml");
  2659. var checkBucketName_1 = require("../utils/checkBucketName");
  2660. function initiateBucketWorm(_x, _x2, _x3) {
  2661. return _initiateBucketWorm.apply(this, arguments);
  2662. }
  2663. function _initiateBucketWorm() {
  2664. _initiateBucketWorm = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(name, days, options) {
  2665. var params, paramlXMLObJ, result;
  2666. return _regenerator.default.wrap(function _callee$(_context) {
  2667. while (1) {
  2668. switch (_context.prev = _context.next) {
  2669. case 0:
  2670. checkBucketName_1.checkBucketName(name);
  2671. params = this._bucketRequestParams('POST', name, 'worm', options);
  2672. paramlXMLObJ = {
  2673. InitiateWormConfiguration: {
  2674. RetentionPeriodInDays: days
  2675. }
  2676. };
  2677. params.mime = 'xml';
  2678. params.content = obj2xml_1.obj2xml(paramlXMLObJ, {
  2679. headers: true
  2680. });
  2681. params.successStatuses = [200];
  2682. _context.next = 8;
  2683. return this.request(params);
  2684. case 8:
  2685. result = _context.sent;
  2686. return _context.abrupt("return", {
  2687. res: result.res,
  2688. wormId: result.res.headers['x-oss-worm-id'],
  2689. status: result.status
  2690. });
  2691. case 10:
  2692. case "end":
  2693. return _context.stop();
  2694. }
  2695. }
  2696. }, _callee, this);
  2697. }));
  2698. return _initiateBucketWorm.apply(this, arguments);
  2699. }
  2700. exports.initiateBucketWorm = initiateBucketWorm;
  2701. },{"../utils/checkBucketName":50,"../utils/obj2xml":69,"@babel/runtime/helpers/asyncToGenerator":73,"@babel/runtime/helpers/interopRequireDefault":74,"@babel/runtime/regenerator":76}],19:[function(require,module,exports){
  2702. "use strict";
  2703. var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
  2704. var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
  2705. require("core-js/modules/es.object.assign.js");
  2706. var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
  2707. Object.defineProperty(exports, "__esModule", {
  2708. value: true
  2709. });
  2710. exports.listBucketInventory = void 0;
  2711. var checkBucketName_1 = require("../utils/checkBucketName");
  2712. var formatInventoryConfig_1 = require("../utils/formatInventoryConfig");
  2713. /**
  2714. * listBucketInventory
  2715. * @param {String} bucketName - bucket name
  2716. * @param {String} inventoryId
  2717. * @param {Object} options
  2718. */
  2719. function listBucketInventory(_x) {
  2720. return _listBucketInventory.apply(this, arguments);
  2721. }
  2722. function _listBucketInventory() {
  2723. _listBucketInventory = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(bucketName) {
  2724. var options,
  2725. continuationToken,
  2726. subres,
  2727. params,
  2728. result,
  2729. data,
  2730. res,
  2731. status,
  2732. _args = arguments;
  2733. return _regenerator.default.wrap(function _callee$(_context) {
  2734. while (1) {
  2735. switch (_context.prev = _context.next) {
  2736. case 0:
  2737. options = _args.length > 1 && _args[1] !== undefined ? _args[1] : {};
  2738. continuationToken = options.continuationToken;
  2739. subres = Object.assign({
  2740. inventory: ''
  2741. }, continuationToken && {
  2742. 'continuation-token': continuationToken
  2743. }, options.subres);
  2744. checkBucketName_1.checkBucketName(bucketName);
  2745. params = this._bucketRequestParams('GET', bucketName, subres, options);
  2746. params.successStatuses = [200];
  2747. params.xmlResponse = true;
  2748. _context.next = 9;
  2749. return this.request(params);
  2750. case 9:
  2751. result = _context.sent;
  2752. data = result.data, res = result.res, status = result.status;
  2753. return _context.abrupt("return", {
  2754. isTruncated: data.IsTruncated === 'true',
  2755. nextContinuationToken: data.NextContinuationToken,
  2756. inventoryList: formatInventoryConfig_1.formatInventoryConfig(data.InventoryConfiguration, true),
  2757. status: status,
  2758. res: res
  2759. });
  2760. case 12:
  2761. case "end":
  2762. return _context.stop();
  2763. }
  2764. }
  2765. }, _callee, this);
  2766. }));
  2767. return _listBucketInventory.apply(this, arguments);
  2768. }
  2769. exports.listBucketInventory = listBucketInventory;
  2770. },{"../utils/checkBucketName":50,"../utils/formatInventoryConfig":58,"@babel/runtime/helpers/asyncToGenerator":73,"@babel/runtime/helpers/interopRequireDefault":74,"@babel/runtime/regenerator":76,"core-js/modules/es.object.assign.js":255}],20:[function(require,module,exports){
  2771. "use strict";
  2772. var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
  2773. var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
  2774. require("core-js/modules/es.object.assign.js");
  2775. require("core-js/modules/es.array.concat.js");
  2776. var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
  2777. Object.defineProperty(exports, "__esModule", {
  2778. value: true
  2779. });
  2780. exports.putBucketInventory = void 0;
  2781. var checkBucketName_1 = require("../utils/checkBucketName");
  2782. var obj2xml_1 = require("../utils/obj2xml");
  2783. /**
  2784. * putBucketInventory
  2785. * @param {String} bucketName - bucket name
  2786. * @param {Inventory} inventory
  2787. * @param {Object} options
  2788. */
  2789. function putBucketInventory(_x, _x2) {
  2790. return _putBucketInventory.apply(this, arguments);
  2791. }
  2792. function _putBucketInventory() {
  2793. _putBucketInventory = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(bucketName, inventory) {
  2794. var options,
  2795. subres,
  2796. OSSBucketDestination,
  2797. optionalFields,
  2798. includedObjectVersions,
  2799. destinationBucketPrefix,
  2800. rolePrefix,
  2801. paramXMLObj,
  2802. paramXML,
  2803. params,
  2804. result,
  2805. _args = arguments;
  2806. return _regenerator.default.wrap(function _callee$(_context) {
  2807. while (1) {
  2808. switch (_context.prev = _context.next) {
  2809. case 0:
  2810. options = _args.length > 2 && _args[2] !== undefined ? _args[2] : {};
  2811. subres = Object.assign({
  2812. inventory: '',
  2813. inventoryId: inventory.id
  2814. }, options.subres);
  2815. checkBucketName_1.checkBucketName(bucketName);
  2816. OSSBucketDestination = inventory.OSSBucketDestination, optionalFields = inventory.optionalFields, includedObjectVersions = inventory.includedObjectVersions;
  2817. destinationBucketPrefix = 'acs:oss:::';
  2818. rolePrefix = "acs:ram::".concat(OSSBucketDestination.accountId, ":role/");
  2819. paramXMLObj = {
  2820. InventoryConfiguration: {
  2821. Id: inventory.id,
  2822. IsEnabled: inventory.isEnabled,
  2823. Filter: {
  2824. Prefix: inventory.prefix || ''
  2825. },
  2826. Destination: {
  2827. OSSBucketDestination: {
  2828. Format: OSSBucketDestination.format,
  2829. AccountId: OSSBucketDestination.accountId,
  2830. RoleArn: "".concat(rolePrefix).concat(OSSBucketDestination.rolename),
  2831. Bucket: "".concat(destinationBucketPrefix).concat(OSSBucketDestination.bucket),
  2832. Prefix: OSSBucketDestination.prefix || '',
  2833. Encryption: OSSBucketDestination.encryption || ''
  2834. }
  2835. },
  2836. Schedule: {
  2837. Frequency: inventory.frequency
  2838. },
  2839. IncludedObjectVersions: includedObjectVersions,
  2840. OptionalFields: {
  2841. Field: (optionalFields === null || optionalFields === void 0 ? void 0 : optionalFields.field) || []
  2842. }
  2843. }
  2844. };
  2845. paramXML = obj2xml_1.obj2xml(paramXMLObj, {
  2846. headers: true,
  2847. firstUpperCase: true
  2848. });
  2849. params = this._bucketRequestParams('PUT', bucketName, subres, options);
  2850. params.successStatuses = [200];
  2851. params.mime = 'xml';
  2852. params.content = paramXML;
  2853. _context.next = 14;
  2854. return this.request(params);
  2855. case 14:
  2856. result = _context.sent;
  2857. return _context.abrupt("return", {
  2858. status: result.status,
  2859. res: result.res
  2860. });
  2861. case 16:
  2862. case "end":
  2863. return _context.stop();
  2864. }
  2865. }
  2866. }, _callee, this);
  2867. }));
  2868. return _putBucketInventory.apply(this, arguments);
  2869. }
  2870. exports.putBucketInventory = putBucketInventory;
  2871. },{"../utils/checkBucketName":50,"../utils/obj2xml":69,"@babel/runtime/helpers/asyncToGenerator":73,"@babel/runtime/helpers/interopRequireDefault":74,"@babel/runtime/regenerator":76,"core-js/modules/es.array.concat.js":241,"core-js/modules/es.object.assign.js":255}],21:[function(require,module,exports){
  2872. "use strict";
  2873. var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
  2874. var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
  2875. require("core-js/modules/web.dom-collections.for-each.js");
  2876. require("core-js/modules/es.array.includes.js");
  2877. var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
  2878. /* eslint-disable no-use-before-define */
  2879. var _require = require('../utils/checkBucketName'),
  2880. _checkBucketName = _require.checkBucketName;
  2881. var _require2 = require('../utils/isArray'),
  2882. isArray = _require2.isArray;
  2883. var _require3 = require('../utils/deepCopy'),
  2884. deepCopy = _require3.deepCopy;
  2885. var _require4 = require('../utils/isObject'),
  2886. isObject = _require4.isObject;
  2887. var _require5 = require('../utils/obj2xml'),
  2888. obj2xml = _require5.obj2xml;
  2889. var _require6 = require('../utils/checkObjectTag'),
  2890. checkObjectTag = _require6.checkObjectTag;
  2891. var _require7 = require('../utils/getStrBytesCount'),
  2892. getStrBytesCount = _require7.getStrBytesCount;
  2893. var proto = exports;
  2894. proto.putBucketLifecycle = /*#__PURE__*/function () {
  2895. var _putBucketLifecycle = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(name, rules, options) {
  2896. var params, Rule, paramXMLObj, paramXML, result;
  2897. return _regenerator.default.wrap(function _callee$(_context) {
  2898. while (1) {
  2899. switch (_context.prev = _context.next) {
  2900. case 0:
  2901. _checkBucketName(name);
  2902. if (isArray(rules)) {
  2903. _context.next = 3;
  2904. break;
  2905. }
  2906. throw new Error('rules must be Array');
  2907. case 3:
  2908. params = this._bucketRequestParams('PUT', name, 'lifecycle', options);
  2909. Rule = [];
  2910. paramXMLObj = {
  2911. LifecycleConfiguration: {
  2912. Rule: Rule
  2913. }
  2914. };
  2915. rules.forEach(function (_) {
  2916. defaultDaysAndDate2Expiration(_); // todo delete, 兼容旧版本
  2917. checkRule(_);
  2918. if (_.id) {
  2919. _.ID = _.id;
  2920. delete _.id;
  2921. }
  2922. Rule.push(_);
  2923. });
  2924. paramXML = obj2xml(paramXMLObj, {
  2925. headers: true,
  2926. firstUpperCase: true
  2927. });
  2928. params.content = paramXML;
  2929. params.mime = 'xml';
  2930. params.successStatuses = [200];
  2931. _context.next = 13;
  2932. return this.request(params);
  2933. case 13:
  2934. result = _context.sent;
  2935. return _context.abrupt("return", {
  2936. res: result.res
  2937. });
  2938. case 15:
  2939. case "end":
  2940. return _context.stop();
  2941. }
  2942. }
  2943. }, _callee, this);
  2944. }));
  2945. function putBucketLifecycle(_x, _x2, _x3) {
  2946. return _putBucketLifecycle.apply(this, arguments);
  2947. }
  2948. return putBucketLifecycle;
  2949. }(); // todo delete, 兼容旧版本
  2950. function defaultDaysAndDate2Expiration(obj) {
  2951. if (obj.days) {
  2952. obj.expiration = {
  2953. days: obj.days
  2954. };
  2955. }
  2956. if (obj.date) {
  2957. obj.expiration = {
  2958. createdBeforeDate: obj.date
  2959. };
  2960. }
  2961. }
  2962. function checkDaysAndDate(obj, key) {
  2963. var days = obj.days,
  2964. createdBeforeDate = obj.createdBeforeDate;
  2965. if (!days && !createdBeforeDate) {
  2966. throw new Error("".concat(key, " must includes days or createdBeforeDate"));
  2967. } else if (days && !/^[1-9][0-9]*$/.test(days)) {
  2968. throw new Error('days must be a positive integer');
  2969. } else if (createdBeforeDate && !/\d{4}-\d{2}-\d{2}T00:00:00.000Z/.test(createdBeforeDate)) {
  2970. throw new Error('createdBeforeDate must be date and conform to iso8601 format');
  2971. }
  2972. }
  2973. function handleCheckTag(tag) {
  2974. if (!isArray(tag) && !isObject(tag)) {
  2975. throw new Error('tag must be Object or Array');
  2976. }
  2977. tag = isObject(tag) ? [tag] : tag;
  2978. var tagObj = {};
  2979. var tagClone = deepCopy(tag);
  2980. tagClone.forEach(function (v) {
  2981. tagObj[v.key] = v.value;
  2982. });
  2983. checkObjectTag(tagObj);
  2984. }
  2985. function checkRule(rule) {
  2986. if (rule.id && getStrBytesCount(rule.id) > 255) throw new Error('ID is composed of 255 bytes at most');
  2987. if (rule.prefix === undefined) throw new Error('Rule must includes prefix');
  2988. if (!['Enabled', 'Disabled'].includes(rule.status)) throw new Error('Status must be Enabled or Disabled');
  2989. if (rule.transition) {
  2990. if (!['IA', 'Archive'].includes(rule.transition.storageClass)) throw new Error('StorageClass must be IA or Archive');
  2991. checkDaysAndDate(rule.transition, 'Transition');
  2992. }
  2993. if (rule.expiration) {
  2994. if (!rule.expiration.expiredObjectDeleteMarker) {
  2995. checkDaysAndDate(rule.expiration, 'Expiration');
  2996. } else if (rule.expiration.days || rule.expiration.createdBeforeDate) {
  2997. throw new Error('expiredObjectDeleteMarker cannot be used with days or createdBeforeDate');
  2998. }
  2999. }
  3000. if (rule.abortMultipartUpload) {
  3001. checkDaysAndDate(rule.abortMultipartUpload, 'AbortMultipartUpload');
  3002. }
  3003. if (!rule.expiration && !rule.abortMultipartUpload && !rule.transition && !rule.noncurrentVersionTransition) {
  3004. throw new Error('Rule must includes expiration or abortMultipartUpload or transition or noncurrentVersionTransition');
  3005. }
  3006. if (rule.tag) {
  3007. if (rule.abortMultipartUpload) {
  3008. throw new Error('Tag cannot be used with abortMultipartUpload');
  3009. }
  3010. handleCheckTag(rule.tag);
  3011. }
  3012. }
  3013. },{"../utils/checkBucketName":50,"../utils/checkObjectTag":52,"../utils/deepCopy":56,"../utils/getStrBytesCount":60,"../utils/isArray":61,"../utils/isObject":67,"../utils/obj2xml":69,"@babel/runtime/helpers/asyncToGenerator":73,"@babel/runtime/helpers/interopRequireDefault":74,"@babel/runtime/regenerator":76,"core-js/modules/es.array.includes.js":246,"core-js/modules/web.dom-collections.for-each.js":296}],22:[function(require,module,exports){
  3014. "use strict";
  3015. var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
  3016. var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
  3017. require("core-js/modules/es.array.includes.js");
  3018. var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
  3019. var _require = require('../utils/checkBucketName'),
  3020. _checkBucketName = _require.checkBucketName;
  3021. var _require2 = require('../utils/obj2xml'),
  3022. obj2xml = _require2.obj2xml;
  3023. var proto = exports;
  3024. /**
  3025. * putBucketVersioning
  3026. * @param {String} name - bucket name
  3027. * @param {String} status
  3028. * @param {Object} options
  3029. */
  3030. proto.putBucketVersioning = /*#__PURE__*/function () {
  3031. var _putBucketVersioning = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(name, status) {
  3032. var options,
  3033. params,
  3034. paramXMLObj,
  3035. result,
  3036. _args = arguments;
  3037. return _regenerator.default.wrap(function _callee$(_context) {
  3038. while (1) {
  3039. switch (_context.prev = _context.next) {
  3040. case 0:
  3041. options = _args.length > 2 && _args[2] !== undefined ? _args[2] : {};
  3042. _checkBucketName(name);
  3043. if (['Enabled', 'Suspended'].includes(status)) {
  3044. _context.next = 4;
  3045. break;
  3046. }
  3047. throw new Error('status must be Enabled or Suspended');
  3048. case 4:
  3049. params = this._bucketRequestParams('PUT', name, 'versioning', options);
  3050. paramXMLObj = {
  3051. VersioningConfiguration: {
  3052. Status: status
  3053. }
  3054. };
  3055. params.mime = 'xml';
  3056. params.content = obj2xml(paramXMLObj, {
  3057. headers: true
  3058. });
  3059. _context.next = 10;
  3060. return this.request(params);
  3061. case 10:
  3062. result = _context.sent;
  3063. return _context.abrupt("return", {
  3064. res: result.res,
  3065. status: result.status
  3066. });
  3067. case 12:
  3068. case "end":
  3069. return _context.stop();
  3070. }
  3071. }
  3072. }, _callee, this);
  3073. }));
  3074. function putBucketVersioning(_x, _x2) {
  3075. return _putBucketVersioning.apply(this, arguments);
  3076. }
  3077. return putBucketVersioning;
  3078. }();
  3079. },{"../utils/checkBucketName":50,"../utils/obj2xml":69,"@babel/runtime/helpers/asyncToGenerator":73,"@babel/runtime/helpers/interopRequireDefault":74,"@babel/runtime/regenerator":76,"core-js/modules/es.array.includes.js":246}],23:[function(require,module,exports){
  3080. "use strict";
  3081. var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
  3082. var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
  3083. var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
  3084. var _require = require('../utils/checkBucketName'),
  3085. _checkBucketName = _require.checkBucketName;
  3086. var _require2 = require('../utils/obj2xml'),
  3087. obj2xml = _require2.obj2xml;
  3088. var _require3 = require('../utils/isArray'),
  3089. isArray = _require3.isArray;
  3090. var proto = exports;
  3091. proto.putBucketWebsite = /*#__PURE__*/function () {
  3092. var _putBucketWebsite = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(name) {
  3093. var config,
  3094. options,
  3095. params,
  3096. IndexDocument,
  3097. WebsiteConfiguration,
  3098. website,
  3099. result,
  3100. _args = arguments;
  3101. return _regenerator.default.wrap(function _callee$(_context) {
  3102. while (1) {
  3103. switch (_context.prev = _context.next) {
  3104. case 0:
  3105. config = _args.length > 1 && _args[1] !== undefined ? _args[1] : {};
  3106. options = _args.length > 2 ? _args[2] : undefined;
  3107. _checkBucketName(name);
  3108. params = this._bucketRequestParams('PUT', name, 'website', options);
  3109. IndexDocument = {
  3110. Suffix: config.index || 'index.html'
  3111. };
  3112. WebsiteConfiguration = {
  3113. IndexDocument: IndexDocument
  3114. };
  3115. website = {
  3116. WebsiteConfiguration: WebsiteConfiguration
  3117. };
  3118. if (config.supportSubDir) {
  3119. IndexDocument.SupportSubDir = config.supportSubDir;
  3120. }
  3121. if (config.type) {
  3122. IndexDocument.Type = config.type;
  3123. }
  3124. if (config.error) {
  3125. WebsiteConfiguration.ErrorDocument = {
  3126. Key: config.error
  3127. };
  3128. }
  3129. if (!(config.routingRules !== undefined)) {
  3130. _context.next = 14;
  3131. break;
  3132. }
  3133. if (isArray(config.routingRules)) {
  3134. _context.next = 13;
  3135. break;
  3136. }
  3137. throw new Error('RoutingRules must be Array');
  3138. case 13:
  3139. WebsiteConfiguration.RoutingRules = {
  3140. RoutingRule: config.routingRules
  3141. };
  3142. case 14:
  3143. website = obj2xml(website);
  3144. params.content = website;
  3145. params.mime = 'xml';
  3146. params.successStatuses = [200];
  3147. _context.next = 20;
  3148. return this.request(params);
  3149. case 20:
  3150. result = _context.sent;
  3151. return _context.abrupt("return", {
  3152. res: result.res
  3153. });
  3154. case 22:
  3155. case "end":
  3156. return _context.stop();
  3157. }
  3158. }
  3159. }, _callee, this);
  3160. }));
  3161. function putBucketWebsite(_x) {
  3162. return _putBucketWebsite.apply(this, arguments);
  3163. }
  3164. return putBucketWebsite;
  3165. }();
  3166. },{"../utils/checkBucketName":50,"../utils/isArray":61,"../utils/obj2xml":69,"@babel/runtime/helpers/asyncToGenerator":73,"@babel/runtime/helpers/interopRequireDefault":74,"@babel/runtime/regenerator":76}],24:[function(require,module,exports){
  3167. (function (Buffer){(function (){
  3168. "use strict";
  3169. require("core-js/modules/es.object.to-string.js");
  3170. require("core-js/modules/es.regexp.to-string.js");
  3171. require("core-js/modules/web.dom-collections.for-each.js");
  3172. require("core-js/modules/es.object.keys.js");
  3173. exports.encodeCallback = function encodeCallback(reqParams, options) {
  3174. reqParams.headers = reqParams.headers || {};
  3175. if (!Object.prototype.hasOwnProperty.call(reqParams.headers, 'x-oss-callback')) {
  3176. if (options.callback) {
  3177. var json = {
  3178. callbackUrl: encodeURI(options.callback.url),
  3179. callbackBody: options.callback.body
  3180. };
  3181. if (options.callback.host) {
  3182. json.callbackHost = options.callback.host;
  3183. }
  3184. if (options.callback.contentType) {
  3185. json.callbackBodyType = options.callback.contentType;
  3186. }
  3187. var callback = Buffer.from(JSON.stringify(json)).toString('base64');
  3188. reqParams.headers['x-oss-callback'] = callback;
  3189. if (options.callback.customValue) {
  3190. var callbackVar = {};
  3191. Object.keys(options.callback.customValue).forEach(function (key) {
  3192. callbackVar["x:".concat(key)] = options.callback.customValue[key];
  3193. });
  3194. reqParams.headers['x-oss-callback-var'] = Buffer.from(JSON.stringify(callbackVar)).toString('base64');
  3195. }
  3196. }
  3197. }
  3198. };
  3199. }).call(this)}).call(this,require("buffer").Buffer)
  3200. },{"buffer":85,"core-js/modules/es.object.keys.js":257,"core-js/modules/es.object.to-string.js":258,"core-js/modules/es.regexp.to-string.js":262,"core-js/modules/web.dom-collections.for-each.js":296}],25:[function(require,module,exports){
  3201. "use strict";
  3202. require("core-js/modules/es.array.concat.js");
  3203. require("core-js/modules/es.regexp.exec.js");
  3204. require("core-js/modules/es.string.replace.js");
  3205. require("core-js/modules/web.dom-collections.for-each.js");
  3206. var __importDefault = void 0 && (void 0).__importDefault || function (mod) {
  3207. return mod && mod.__esModule ? mod : {
  3208. "default": mod
  3209. };
  3210. };
  3211. Object.defineProperty(exports, "__esModule", {
  3212. value: true
  3213. });
  3214. exports.getReqUrl = void 0;
  3215. var copy_to_1 = __importDefault(require("copy-to"));
  3216. var url_1 = __importDefault(require("url"));
  3217. var merge_descriptors_1 = __importDefault(require("merge-descriptors"));
  3218. var is_type_of_1 = __importDefault(require("is-type-of"));
  3219. var isIP_1 = require("../utils/isIP");
  3220. var checkConfigValid_1 = require("../utils/checkConfigValid");
  3221. function getReqUrl(params) {
  3222. var ep = {};
  3223. var isCname = this.options.cname;
  3224. checkConfigValid_1.checkConfigValid(this.options.endpoint, 'endpoint');
  3225. copy_to_1.default(this.options.endpoint, false).to(ep);
  3226. if (params.bucket && !isCname && !isIP_1.isIP(ep.hostname) && !this.options.sldEnable) {
  3227. ep.host = "".concat(params.bucket, ".").concat(ep.host);
  3228. }
  3229. var resourcePath = '/';
  3230. if (params.bucket && this.options.sldEnable) {
  3231. resourcePath += "".concat(params.bucket, "/");
  3232. }
  3233. if (params.object) {
  3234. // Preserve '/' in result url
  3235. resourcePath += this._escape(params.object).replace(/\+/g, '%2B');
  3236. }
  3237. ep.pathname = resourcePath;
  3238. var query = {};
  3239. if (params.query) {
  3240. merge_descriptors_1.default(query, params.query);
  3241. }
  3242. if (params.subres) {
  3243. var subresAsQuery = {};
  3244. if (is_type_of_1.default.string(params.subres)) {
  3245. subresAsQuery[params.subres] = '';
  3246. } else if (is_type_of_1.default.array(params.subres)) {
  3247. params.subres.forEach(function (k) {
  3248. subresAsQuery[k] = '';
  3249. });
  3250. } else {
  3251. subresAsQuery = params.subres;
  3252. }
  3253. merge_descriptors_1.default(query, subresAsQuery);
  3254. }
  3255. ep.query = query;
  3256. return url_1.default.format(ep);
  3257. }
  3258. exports.getReqUrl = getReqUrl;
  3259. },{"../utils/checkConfigValid":51,"../utils/isIP":66,"copy-to":88,"core-js/modules/es.array.concat.js":241,"core-js/modules/es.regexp.exec.js":261,"core-js/modules/es.string.replace.js":266,"core-js/modules/web.dom-collections.for-each.js":296,"is-type-of":398,"merge-descriptors":315,"url":404}],26:[function(require,module,exports){
  3260. "use strict";
  3261. require("core-js/modules/es.array.concat.js");
  3262. require("core-js/modules/es.object.assign.js");
  3263. require("core-js/modules/es.string.trim.js");
  3264. var ms = require('humanize-ms');
  3265. var urlutil = require('url');
  3266. var _require = require('../utils/checkBucketName'),
  3267. _checkBucketName = _require.checkBucketName;
  3268. var _require2 = require('../utils/setRegion'),
  3269. setRegion = _require2.setRegion;
  3270. var _require3 = require('../utils/checkConfigValid'),
  3271. checkConfigValid = _require3.checkConfigValid;
  3272. function setEndpoint(endpoint, secure) {
  3273. checkConfigValid(endpoint, 'endpoint');
  3274. var url = urlutil.parse(endpoint);
  3275. if (!url.protocol) {
  3276. url = urlutil.parse("http".concat(secure ? 's' : '', "://").concat(endpoint));
  3277. }
  3278. if (url.protocol !== 'http:' && url.protocol !== 'https:') {
  3279. throw new Error('Endpoint protocol must be http or https.');
  3280. }
  3281. return url;
  3282. }
  3283. module.exports = function (options) {
  3284. if (!options || !options.accessKeyId || !options.accessKeySecret) {
  3285. throw new Error('require accessKeyId, accessKeySecret');
  3286. }
  3287. if (options.stsToken && !options.refreshSTSToken && !options.refreshSTSTokenInterval) {
  3288. console.warn("It's recommended to set 'refreshSTSToken' and 'refreshSTSTokenInterval' to refresh" + ' stsToken、accessKeyId、accessKeySecret automatically when sts token has expired');
  3289. }
  3290. if (options.bucket) {
  3291. _checkBucketName(options.bucket);
  3292. }
  3293. var opts = Object.assign({
  3294. region: 'oss-cn-hangzhou',
  3295. internal: false,
  3296. secure: false,
  3297. timeout: 60000,
  3298. bucket: null,
  3299. endpoint: null,
  3300. cname: false,
  3301. isRequestPay: false,
  3302. sldEnable: false,
  3303. headerEncoding: 'utf-8',
  3304. refreshSTSToken: null,
  3305. refreshSTSTokenInterval: 60000 * 5,
  3306. retryMax: 0
  3307. }, options);
  3308. opts.accessKeyId = opts.accessKeyId.trim();
  3309. opts.accessKeySecret = opts.accessKeySecret.trim();
  3310. if (opts.timeout) {
  3311. opts.timeout = ms(opts.timeout);
  3312. }
  3313. if (opts.endpoint) {
  3314. opts.endpoint = setEndpoint(opts.endpoint, opts.secure);
  3315. } else if (opts.region) {
  3316. opts.endpoint = setRegion(opts.region, opts.internal, opts.secure);
  3317. } else {
  3318. throw new Error('require options.endpoint or options.region');
  3319. }
  3320. opts.inited = true;
  3321. return opts;
  3322. };
  3323. },{"../utils/checkBucketName":50,"../utils/checkConfigValid":51,"../utils/setRegion":71,"core-js/modules/es.array.concat.js":241,"core-js/modules/es.object.assign.js":255,"core-js/modules/es.string.trim.js":269,"humanize-ms":303,"url":404}],27:[function(require,module,exports){
  3324. "use strict";
  3325. var merge = require('merge-descriptors');
  3326. var proto = exports;
  3327. merge(proto, require('./processObjectSave'));
  3328. },{"./processObjectSave":28,"merge-descriptors":315}],28:[function(require,module,exports){
  3329. "use strict";
  3330. var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
  3331. var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
  3332. require("core-js/modules/es.array.concat.js");
  3333. var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
  3334. /* eslint-disable no-use-before-define */
  3335. var _require = require('../utils/checkBucketName'),
  3336. _checkBucketName = _require.checkBucketName;
  3337. var querystring = require('querystring');
  3338. var _require2 = require('js-base64'),
  3339. str2Base64 = _require2.Base64.encode;
  3340. var proto = exports;
  3341. proto.processObjectSave = /*#__PURE__*/function () {
  3342. var _processObjectSave = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(sourceObject, targetObject, process, targetBucket) {
  3343. var params, bucketParam, content, result;
  3344. return _regenerator.default.wrap(function _callee$(_context) {
  3345. while (1) {
  3346. switch (_context.prev = _context.next) {
  3347. case 0:
  3348. checkArgs(sourceObject, 'sourceObject');
  3349. checkArgs(targetObject, 'targetObject');
  3350. checkArgs(process, 'process');
  3351. targetObject = this._objectName(targetObject);
  3352. if (targetBucket) {
  3353. _checkBucketName(targetBucket);
  3354. }
  3355. params = this._objectRequestParams('POST', sourceObject, {
  3356. subres: 'x-oss-process'
  3357. });
  3358. bucketParam = targetBucket ? ",b_".concat(str2Base64(targetBucket)) : '';
  3359. targetObject = str2Base64(targetObject);
  3360. content = {
  3361. 'x-oss-process': "".concat(process, "|sys/saveas,o_").concat(targetObject).concat(bucketParam)
  3362. };
  3363. params.content = querystring.stringify(content);
  3364. _context.next = 12;
  3365. return this.request(params);
  3366. case 12:
  3367. result = _context.sent;
  3368. return _context.abrupt("return", {
  3369. res: result.res,
  3370. status: result.res.status
  3371. });
  3372. case 14:
  3373. case "end":
  3374. return _context.stop();
  3375. }
  3376. }
  3377. }, _callee, this);
  3378. }));
  3379. function processObjectSave(_x, _x2, _x3, _x4) {
  3380. return _processObjectSave.apply(this, arguments);
  3381. }
  3382. return processObjectSave;
  3383. }();
  3384. function checkArgs(name, key) {
  3385. if (!name) {
  3386. throw new Error("".concat(key, " is required"));
  3387. }
  3388. if (typeof name !== 'string') {
  3389. throw new Error("".concat(key, " must be String"));
  3390. }
  3391. }
  3392. },{"../utils/checkBucketName":50,"@babel/runtime/helpers/asyncToGenerator":73,"@babel/runtime/helpers/interopRequireDefault":74,"@babel/runtime/regenerator":76,"core-js/modules/es.array.concat.js":241,"js-base64":314,"querystring":328}],29:[function(require,module,exports){
  3393. "use strict";
  3394. var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
  3395. var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
  3396. require("core-js/modules/es.array.concat.js");
  3397. require("core-js/modules/es.function.name.js");
  3398. require("core-js/modules/es.object.to-string.js");
  3399. require("core-js/modules/es.promise.js");
  3400. require("core-js/modules/es.array.from.js");
  3401. require("core-js/modules/es.string.iterator.js");
  3402. require("core-js/modules/es.array.map.js");
  3403. require("core-js/modules/es.array.filter.js");
  3404. require("core-js/modules/es.array.find.js");
  3405. require("core-js/modules/es.regexp.to-string.js");
  3406. var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
  3407. /* eslint-disable no-async-promise-executor */
  3408. var debug = require('debug')('ali-oss:multipart-copy');
  3409. var copy = require('copy-to');
  3410. var proto = exports;
  3411. /**
  3412. * Upload a part copy in a multipart from the source bucket/object
  3413. * used with initMultipartUpload and completeMultipartUpload.
  3414. * @param {String} name copy object name
  3415. * @param {String} uploadId the upload id
  3416. * @param {Number} partNo the part number
  3417. * @param {String} range like 0-102400 part size need to copy
  3418. * @param {Object} sourceData
  3419. * {String} sourceData.sourceKey the source object name
  3420. * {String} sourceData.sourceBucketName the source bucket name
  3421. * @param {Object} options
  3422. */
  3423. /* eslint max-len: [0] */
  3424. proto.uploadPartCopy = /*#__PURE__*/function () {
  3425. var _uploadPartCopy = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(name, uploadId, partNo, range, sourceData) {
  3426. var options,
  3427. versionId,
  3428. copySource,
  3429. params,
  3430. result,
  3431. _args = arguments;
  3432. return _regenerator.default.wrap(function _callee$(_context) {
  3433. while (1) {
  3434. switch (_context.prev = _context.next) {
  3435. case 0:
  3436. options = _args.length > 5 && _args[5] !== undefined ? _args[5] : {};
  3437. options.headers = options.headers || {};
  3438. versionId = options.versionId || options.subres && options.subres.versionId || null;
  3439. if (versionId) {
  3440. copySource = "/".concat(sourceData.sourceBucketName, "/").concat(encodeURIComponent(sourceData.sourceKey), "?versionId=").concat(versionId);
  3441. } else {
  3442. copySource = "/".concat(sourceData.sourceBucketName, "/").concat(encodeURIComponent(sourceData.sourceKey));
  3443. }
  3444. options.headers['x-oss-copy-source'] = copySource;
  3445. if (range) {
  3446. options.headers['x-oss-copy-source-range'] = "bytes=".concat(range);
  3447. }
  3448. options.subres = {
  3449. partNumber: partNo,
  3450. uploadId: uploadId
  3451. };
  3452. params = this._objectRequestParams('PUT', name, options);
  3453. params.mime = options.mime;
  3454. params.successStatuses = [200];
  3455. _context.next = 12;
  3456. return this.request(params);
  3457. case 12:
  3458. result = _context.sent;
  3459. return _context.abrupt("return", {
  3460. name: name,
  3461. etag: result.res.headers.etag,
  3462. res: result.res
  3463. });
  3464. case 14:
  3465. case "end":
  3466. return _context.stop();
  3467. }
  3468. }
  3469. }, _callee, this);
  3470. }));
  3471. function uploadPartCopy(_x, _x2, _x3, _x4, _x5) {
  3472. return _uploadPartCopy.apply(this, arguments);
  3473. }
  3474. return uploadPartCopy;
  3475. }();
  3476. /**
  3477. * @param {String} name copy object name
  3478. * @param {Object} sourceData
  3479. * {String} sourceData.sourceKey the source object name
  3480. * {String} sourceData.sourceBucketName the source bucket name
  3481. * {Number} sourceData.startOffset data copy start byte offset, e.g: 0
  3482. * {Number} sourceData.endOffset data copy end byte offset, e.g: 102400
  3483. * @param {Object} options
  3484. * {Number} options.partSize
  3485. */
  3486. proto.multipartUploadCopy = /*#__PURE__*/function () {
  3487. var _multipartUploadCopy = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(name, sourceData) {
  3488. var options,
  3489. _options$versionId,
  3490. versionId,
  3491. metaOpt,
  3492. objectMeta,
  3493. fileSize,
  3494. minPartSize,
  3495. copySize,
  3496. init,
  3497. uploadId,
  3498. partSize,
  3499. checkpoint,
  3500. _args2 = arguments;
  3501. return _regenerator.default.wrap(function _callee2$(_context2) {
  3502. while (1) {
  3503. switch (_context2.prev = _context2.next) {
  3504. case 0:
  3505. options = _args2.length > 2 && _args2[2] !== undefined ? _args2[2] : {};
  3506. this.resetCancelFlag();
  3507. _options$versionId = options.versionId, versionId = _options$versionId === void 0 ? null : _options$versionId;
  3508. metaOpt = {
  3509. versionId: versionId
  3510. };
  3511. _context2.next = 6;
  3512. return this._getObjectMeta(sourceData.sourceBucketName, sourceData.sourceKey, metaOpt);
  3513. case 6:
  3514. objectMeta = _context2.sent;
  3515. fileSize = objectMeta.res.headers['content-length'];
  3516. sourceData.startOffset = sourceData.startOffset || 0;
  3517. sourceData.endOffset = sourceData.endOffset || fileSize;
  3518. if (!(options.checkpoint && options.checkpoint.uploadId)) {
  3519. _context2.next = 14;
  3520. break;
  3521. }
  3522. _context2.next = 13;
  3523. return this._resumeMultipartCopy(options.checkpoint, sourceData, options);
  3524. case 13:
  3525. return _context2.abrupt("return", _context2.sent);
  3526. case 14:
  3527. minPartSize = 100 * 1024;
  3528. copySize = sourceData.endOffset - sourceData.startOffset;
  3529. if (!(copySize < minPartSize)) {
  3530. _context2.next = 18;
  3531. break;
  3532. }
  3533. throw new Error("copySize must not be smaller than ".concat(minPartSize));
  3534. case 18:
  3535. if (!(options.partSize && options.partSize < minPartSize)) {
  3536. _context2.next = 20;
  3537. break;
  3538. }
  3539. throw new Error("partSize must not be smaller than ".concat(minPartSize));
  3540. case 20:
  3541. _context2.next = 22;
  3542. return this.initMultipartUpload(name, options);
  3543. case 22:
  3544. init = _context2.sent;
  3545. uploadId = init.uploadId;
  3546. partSize = this._getPartSize(copySize, options.partSize);
  3547. checkpoint = {
  3548. name: name,
  3549. copySize: copySize,
  3550. partSize: partSize,
  3551. uploadId: uploadId,
  3552. doneParts: []
  3553. };
  3554. if (!(options && options.progress)) {
  3555. _context2.next = 29;
  3556. break;
  3557. }
  3558. _context2.next = 29;
  3559. return options.progress(0, checkpoint, init.res);
  3560. case 29:
  3561. _context2.next = 31;
  3562. return this._resumeMultipartCopy(checkpoint, sourceData, options);
  3563. case 31:
  3564. return _context2.abrupt("return", _context2.sent);
  3565. case 32:
  3566. case "end":
  3567. return _context2.stop();
  3568. }
  3569. }
  3570. }, _callee2, this);
  3571. }));
  3572. function multipartUploadCopy(_x6, _x7) {
  3573. return _multipartUploadCopy.apply(this, arguments);
  3574. }
  3575. return multipartUploadCopy;
  3576. }();
  3577. /*
  3578. * Resume multipart copy from checkpoint. The checkpoint will be
  3579. * updated after each successful part copy.
  3580. * @param {Object} checkpoint the checkpoint
  3581. * @param {Object} options
  3582. */
  3583. proto._resumeMultipartCopy = /*#__PURE__*/function () {
  3584. var _resumeMultipartCopy2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4(checkpoint, sourceData, options) {
  3585. var _options$versionId2, versionId, metaOpt, copySize, partSize, uploadId, doneParts, name, partOffs, numParts, uploadPartCopyOptions, uploadPartJob, all, done, todo, defaultParallel, parallel, i, errors, abortEvent, err;
  3586. return _regenerator.default.wrap(function _callee4$(_context4) {
  3587. while (1) {
  3588. switch (_context4.prev = _context4.next) {
  3589. case 0:
  3590. if (!this.isCancel()) {
  3591. _context4.next = 2;
  3592. break;
  3593. }
  3594. throw this._makeCancelEvent();
  3595. case 2:
  3596. _options$versionId2 = options.versionId, versionId = _options$versionId2 === void 0 ? null : _options$versionId2;
  3597. metaOpt = {
  3598. versionId: versionId
  3599. };
  3600. copySize = checkpoint.copySize, partSize = checkpoint.partSize, uploadId = checkpoint.uploadId, doneParts = checkpoint.doneParts, name = checkpoint.name;
  3601. partOffs = this._divideMultipartCopyParts(copySize, partSize, sourceData.startOffset);
  3602. numParts = partOffs.length;
  3603. uploadPartCopyOptions = {
  3604. headers: {}
  3605. };
  3606. if (options.copyheaders) {
  3607. copy(options.copyheaders).to(uploadPartCopyOptions.headers);
  3608. }
  3609. if (versionId) {
  3610. copy(metaOpt).to(uploadPartCopyOptions);
  3611. }
  3612. uploadPartJob = function uploadPartJob(self, partNo, source) {
  3613. return new Promise( /*#__PURE__*/function () {
  3614. var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3(resolve, reject) {
  3615. var pi, range, result;
  3616. return _regenerator.default.wrap(function _callee3$(_context3) {
  3617. while (1) {
  3618. switch (_context3.prev = _context3.next) {
  3619. case 0:
  3620. _context3.prev = 0;
  3621. if (self.isCancel()) {
  3622. _context3.next = 22;
  3623. break;
  3624. }
  3625. pi = partOffs[partNo - 1];
  3626. range = "".concat(pi.start, "-").concat(pi.end - 1);
  3627. _context3.prev = 4;
  3628. _context3.next = 7;
  3629. return self.uploadPartCopy(name, uploadId, partNo, range, source, uploadPartCopyOptions);
  3630. case 7:
  3631. result = _context3.sent;
  3632. _context3.next = 15;
  3633. break;
  3634. case 10:
  3635. _context3.prev = 10;
  3636. _context3.t0 = _context3["catch"](4);
  3637. if (!(_context3.t0.status === 404)) {
  3638. _context3.next = 14;
  3639. break;
  3640. }
  3641. throw self._makeAbortEvent();
  3642. case 14:
  3643. throw _context3.t0;
  3644. case 15:
  3645. if (self.isCancel()) {
  3646. _context3.next = 22;
  3647. break;
  3648. }
  3649. debug("content-range ".concat(result.res.headers['content-range']));
  3650. doneParts.push({
  3651. number: partNo,
  3652. etag: result.res.headers.etag
  3653. });
  3654. checkpoint.doneParts = doneParts;
  3655. if (!(options && options.progress)) {
  3656. _context3.next = 22;
  3657. break;
  3658. }
  3659. _context3.next = 22;
  3660. return options.progress(doneParts.length / numParts, checkpoint, result.res);
  3661. case 22:
  3662. resolve();
  3663. _context3.next = 29;
  3664. break;
  3665. case 25:
  3666. _context3.prev = 25;
  3667. _context3.t1 = _context3["catch"](0);
  3668. _context3.t1.partNum = partNo;
  3669. reject(_context3.t1);
  3670. case 29:
  3671. case "end":
  3672. return _context3.stop();
  3673. }
  3674. }
  3675. }, _callee3, null, [[0, 25], [4, 10]]);
  3676. }));
  3677. return function (_x11, _x12) {
  3678. return _ref.apply(this, arguments);
  3679. };
  3680. }());
  3681. };
  3682. all = Array.from(new Array(numParts), function (x, i) {
  3683. return i + 1;
  3684. });
  3685. done = doneParts.map(function (p) {
  3686. return p.number;
  3687. });
  3688. todo = all.filter(function (p) {
  3689. return done.indexOf(p) < 0;
  3690. });
  3691. defaultParallel = 5;
  3692. parallel = options.parallel || defaultParallel;
  3693. if (!(this.checkBrowserAndVersion('Internet Explorer', '10') || parallel === 1)) {
  3694. _context4.next = 28;
  3695. break;
  3696. }
  3697. i = 0;
  3698. case 18:
  3699. if (!(i < todo.length)) {
  3700. _context4.next = 26;
  3701. break;
  3702. }
  3703. if (!this.isCancel()) {
  3704. _context4.next = 21;
  3705. break;
  3706. }
  3707. throw this._makeCancelEvent();
  3708. case 21:
  3709. _context4.next = 23;
  3710. return uploadPartJob(this, todo[i], sourceData);
  3711. case 23:
  3712. i++;
  3713. _context4.next = 18;
  3714. break;
  3715. case 26:
  3716. _context4.next = 40;
  3717. break;
  3718. case 28:
  3719. _context4.next = 30;
  3720. return this._parallelNode(todo, parallel, uploadPartJob, sourceData);
  3721. case 30:
  3722. errors = _context4.sent;
  3723. abortEvent = errors.find(function (err) {
  3724. return err.name === 'abort';
  3725. });
  3726. if (!abortEvent) {
  3727. _context4.next = 34;
  3728. break;
  3729. }
  3730. throw abortEvent;
  3731. case 34:
  3732. if (!this.isCancel()) {
  3733. _context4.next = 36;
  3734. break;
  3735. }
  3736. throw this._makeCancelEvent();
  3737. case 36:
  3738. if (!(errors && errors.length > 0)) {
  3739. _context4.next = 40;
  3740. break;
  3741. }
  3742. err = errors[0];
  3743. err.message = "Failed to copy some parts with error: ".concat(err.toString(), " part_num: ").concat(err.partNum);
  3744. throw err;
  3745. case 40:
  3746. _context4.next = 42;
  3747. return this.completeMultipartUpload(name, uploadId, doneParts, options);
  3748. case 42:
  3749. return _context4.abrupt("return", _context4.sent);
  3750. case 43:
  3751. case "end":
  3752. return _context4.stop();
  3753. }
  3754. }
  3755. }, _callee4, this);
  3756. }));
  3757. function _resumeMultipartCopy(_x8, _x9, _x10) {
  3758. return _resumeMultipartCopy2.apply(this, arguments);
  3759. }
  3760. return _resumeMultipartCopy;
  3761. }();
  3762. proto._divideMultipartCopyParts = function _divideMultipartCopyParts(fileSize, partSize, startOffset) {
  3763. var numParts = Math.ceil(fileSize / partSize);
  3764. var partOffs = [];
  3765. for (var i = 0; i < numParts; i++) {
  3766. var start = partSize * i + startOffset;
  3767. var end = Math.min(start + partSize, fileSize + startOffset);
  3768. partOffs.push({
  3769. start: start,
  3770. end: end
  3771. });
  3772. }
  3773. return partOffs;
  3774. };
  3775. /**
  3776. * Get Object Meta
  3777. * @param {String} bucket bucket name
  3778. * @param {String} name object name
  3779. * @param {Object} options
  3780. */
  3781. proto._getObjectMeta = /*#__PURE__*/function () {
  3782. var _getObjectMeta2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5(bucket, name, options) {
  3783. var currentBucket, data;
  3784. return _regenerator.default.wrap(function _callee5$(_context5) {
  3785. while (1) {
  3786. switch (_context5.prev = _context5.next) {
  3787. case 0:
  3788. currentBucket = this.getBucket();
  3789. this.setBucket(bucket);
  3790. _context5.next = 4;
  3791. return this.head(name, options);
  3792. case 4:
  3793. data = _context5.sent;
  3794. this.setBucket(currentBucket);
  3795. return _context5.abrupt("return", data);
  3796. case 7:
  3797. case "end":
  3798. return _context5.stop();
  3799. }
  3800. }
  3801. }, _callee5, this);
  3802. }));
  3803. function _getObjectMeta(_x13, _x14, _x15) {
  3804. return _getObjectMeta2.apply(this, arguments);
  3805. }
  3806. return _getObjectMeta;
  3807. }();
  3808. },{"@babel/runtime/helpers/asyncToGenerator":73,"@babel/runtime/helpers/interopRequireDefault":74,"@babel/runtime/regenerator":76,"copy-to":88,"core-js/modules/es.array.concat.js":241,"core-js/modules/es.array.filter.js":243,"core-js/modules/es.array.find.js":244,"core-js/modules/es.array.from.js":245,"core-js/modules/es.array.map.js":249,"core-js/modules/es.function.name.js":253,"core-js/modules/es.object.to-string.js":258,"core-js/modules/es.promise.js":259,"core-js/modules/es.regexp.to-string.js":262,"core-js/modules/es.string.iterator.js":264,"debug":397}],30:[function(require,module,exports){
  3809. (function (process){(function (){
  3810. "use strict";
  3811. var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
  3812. var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
  3813. require("core-js/modules/es.array.map.js");
  3814. require("core-js/modules/es.array.filter.js");
  3815. require("core-js/modules/es.array.sort.js");
  3816. require("core-js/modules/es.array.concat.js");
  3817. require("core-js/modules/es.object.to-string.js");
  3818. require("core-js/modules/es.regexp.to-string.js");
  3819. var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
  3820. var copy = require('copy-to');
  3821. var callback = require('./callback');
  3822. var _require = require('./utils/deepCopy'),
  3823. deepCopyWith = _require.deepCopyWith;
  3824. var _require2 = require('./utils/isBuffer'),
  3825. isBuffer = _require2.isBuffer;
  3826. var proto = exports;
  3827. /**
  3828. * List the on-going multipart uploads
  3829. * https://help.aliyun.com/document_detail/31997.html
  3830. * @param {Object} options
  3831. * @return {Array} the multipart uploads
  3832. */
  3833. proto.listUploads = /*#__PURE__*/function () {
  3834. var _listUploads = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(query, options) {
  3835. var opt, params, result, uploads;
  3836. return _regenerator.default.wrap(function _callee$(_context) {
  3837. while (1) {
  3838. switch (_context.prev = _context.next) {
  3839. case 0:
  3840. options = options || {};
  3841. opt = {};
  3842. copy(options).to(opt);
  3843. opt.subres = 'uploads';
  3844. params = this._objectRequestParams('GET', '', opt);
  3845. params.query = query;
  3846. params.xmlResponse = true;
  3847. params.successStatuses = [200];
  3848. _context.next = 10;
  3849. return this.request(params);
  3850. case 10:
  3851. result = _context.sent;
  3852. uploads = result.data.Upload || [];
  3853. if (!Array.isArray(uploads)) {
  3854. uploads = [uploads];
  3855. }
  3856. uploads = uploads.map(function (up) {
  3857. return {
  3858. name: up.Key,
  3859. uploadId: up.UploadId,
  3860. initiated: up.Initiated
  3861. };
  3862. });
  3863. return _context.abrupt("return", {
  3864. res: result.res,
  3865. uploads: uploads,
  3866. bucket: result.data.Bucket,
  3867. nextKeyMarker: result.data.NextKeyMarker,
  3868. nextUploadIdMarker: result.data.NextUploadIdMarker,
  3869. isTruncated: result.data.IsTruncated === 'true'
  3870. });
  3871. case 15:
  3872. case "end":
  3873. return _context.stop();
  3874. }
  3875. }
  3876. }, _callee, this);
  3877. }));
  3878. function listUploads(_x, _x2) {
  3879. return _listUploads.apply(this, arguments);
  3880. }
  3881. return listUploads;
  3882. }();
  3883. /**
  3884. * List the done uploadPart parts
  3885. * @param {String} name object name
  3886. * @param {String} uploadId multipart upload id
  3887. * @param {Object} query
  3888. * {Number} query.max-parts The maximum part number in the response of the OSS. Default value: 1000
  3889. * {Number} query.part-number-marker Starting position of a specific list.
  3890. * {String} query.encoding-type Specify the encoding of the returned content and the encoding type.
  3891. * @param {Object} options
  3892. * @return {Object} result
  3893. */
  3894. proto.listParts = /*#__PURE__*/function () {
  3895. var _listParts = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(name, uploadId, query, options) {
  3896. var opt, params, result;
  3897. return _regenerator.default.wrap(function _callee2$(_context2) {
  3898. while (1) {
  3899. switch (_context2.prev = _context2.next) {
  3900. case 0:
  3901. options = options || {};
  3902. opt = {};
  3903. copy(options).to(opt);
  3904. opt.subres = {
  3905. uploadId: uploadId
  3906. };
  3907. params = this._objectRequestParams('GET', name, opt);
  3908. params.query = query;
  3909. params.xmlResponse = true;
  3910. params.successStatuses = [200];
  3911. _context2.next = 10;
  3912. return this.request(params);
  3913. case 10:
  3914. result = _context2.sent;
  3915. return _context2.abrupt("return", {
  3916. res: result.res,
  3917. uploadId: result.data.UploadId,
  3918. bucket: result.data.Bucket,
  3919. name: result.data.Key,
  3920. partNumberMarker: result.data.PartNumberMarker,
  3921. nextPartNumberMarker: result.data.NextPartNumberMarker,
  3922. maxParts: result.data.MaxParts,
  3923. isTruncated: result.data.IsTruncated,
  3924. parts: result.data.Part || []
  3925. });
  3926. case 12:
  3927. case "end":
  3928. return _context2.stop();
  3929. }
  3930. }
  3931. }, _callee2, this);
  3932. }));
  3933. function listParts(_x3, _x4, _x5, _x6) {
  3934. return _listParts.apply(this, arguments);
  3935. }
  3936. return listParts;
  3937. }();
  3938. /**
  3939. * Abort a multipart upload transaction
  3940. * @param {String} name the object name
  3941. * @param {String} uploadId the upload id
  3942. * @param {Object} options
  3943. */
  3944. proto.abortMultipartUpload = /*#__PURE__*/function () {
  3945. var _abortMultipartUpload = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3(name, uploadId, options) {
  3946. var opt, params, result;
  3947. return _regenerator.default.wrap(function _callee3$(_context3) {
  3948. while (1) {
  3949. switch (_context3.prev = _context3.next) {
  3950. case 0:
  3951. this._stop();
  3952. options = options || {};
  3953. opt = {};
  3954. copy(options).to(opt);
  3955. opt.subres = {
  3956. uploadId: uploadId
  3957. };
  3958. params = this._objectRequestParams('DELETE', name, opt);
  3959. params.successStatuses = [204];
  3960. _context3.next = 9;
  3961. return this.request(params);
  3962. case 9:
  3963. result = _context3.sent;
  3964. return _context3.abrupt("return", {
  3965. res: result.res
  3966. });
  3967. case 11:
  3968. case "end":
  3969. return _context3.stop();
  3970. }
  3971. }
  3972. }, _callee3, this);
  3973. }));
  3974. function abortMultipartUpload(_x7, _x8, _x9) {
  3975. return _abortMultipartUpload.apply(this, arguments);
  3976. }
  3977. return abortMultipartUpload;
  3978. }();
  3979. /**
  3980. * Initiate a multipart upload transaction
  3981. * @param {String} name the object name
  3982. * @param {Object} options
  3983. * @return {String} upload id
  3984. */
  3985. proto.initMultipartUpload = /*#__PURE__*/function () {
  3986. var _initMultipartUpload = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4(name, options) {
  3987. var opt, params, result;
  3988. return _regenerator.default.wrap(function _callee4$(_context4) {
  3989. while (1) {
  3990. switch (_context4.prev = _context4.next) {
  3991. case 0:
  3992. options = options || {};
  3993. opt = {};
  3994. copy(options).to(opt);
  3995. opt.headers = opt.headers || {};
  3996. this._convertMetaToHeaders(options.meta, opt.headers);
  3997. opt.subres = 'uploads';
  3998. params = this._objectRequestParams('POST', name, opt);
  3999. params.mime = options.mime;
  4000. params.xmlResponse = true;
  4001. params.successStatuses = [200];
  4002. _context4.next = 12;
  4003. return this.request(params);
  4004. case 12:
  4005. result = _context4.sent;
  4006. return _context4.abrupt("return", {
  4007. res: result.res,
  4008. bucket: result.data.Bucket,
  4009. name: result.data.Key,
  4010. uploadId: result.data.UploadId
  4011. });
  4012. case 14:
  4013. case "end":
  4014. return _context4.stop();
  4015. }
  4016. }
  4017. }, _callee4, this);
  4018. }));
  4019. function initMultipartUpload(_x10, _x11) {
  4020. return _initMultipartUpload.apply(this, arguments);
  4021. }
  4022. return initMultipartUpload;
  4023. }();
  4024. /**
  4025. * Upload a part in a multipart upload transaction
  4026. * @param {String} name the object name
  4027. * @param {String} uploadId the upload id
  4028. * @param {Integer} partNo the part number
  4029. * @param {File} file upload File, whole File
  4030. * @param {Integer} start part start bytes e.g: 102400
  4031. * @param {Integer} end part end bytes e.g: 204800
  4032. * @param {Object} options
  4033. */
  4034. proto.uploadPart = /*#__PURE__*/function () {
  4035. var _uploadPart2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5(name, uploadId, partNo, file, start, end, options) {
  4036. var data, isBrowserEnv;
  4037. return _regenerator.default.wrap(function _callee5$(_context5) {
  4038. while (1) {
  4039. switch (_context5.prev = _context5.next) {
  4040. case 0:
  4041. data = {
  4042. size: end - start
  4043. };
  4044. isBrowserEnv = process && process.browser;
  4045. if (!isBrowserEnv) {
  4046. _context5.next = 8;
  4047. break;
  4048. }
  4049. _context5.next = 5;
  4050. return this._createBuffer(file, start, end);
  4051. case 5:
  4052. data.content = _context5.sent;
  4053. _context5.next = 11;
  4054. break;
  4055. case 8:
  4056. _context5.next = 10;
  4057. return this._createStream(file, start, end);
  4058. case 10:
  4059. data.stream = _context5.sent;
  4060. case 11:
  4061. _context5.next = 13;
  4062. return this._uploadPart(name, uploadId, partNo, data, options);
  4063. case 13:
  4064. return _context5.abrupt("return", _context5.sent);
  4065. case 14:
  4066. case "end":
  4067. return _context5.stop();
  4068. }
  4069. }
  4070. }, _callee5, this);
  4071. }));
  4072. function uploadPart(_x12, _x13, _x14, _x15, _x16, _x17, _x18) {
  4073. return _uploadPart2.apply(this, arguments);
  4074. }
  4075. return uploadPart;
  4076. }();
  4077. /**
  4078. * Complete a multipart upload transaction
  4079. * @param {String} name the object name
  4080. * @param {String} uploadId the upload id
  4081. * @param {Array} parts the uploaded parts, each in the structure:
  4082. * {Integer} number partNo
  4083. * {String} etag part etag uploadPartCopy result.res.header.etag
  4084. * @param {Object} options
  4085. * {Object} options.callback The callback parameter is composed of a JSON string encoded in Base64
  4086. * {String} options.callback.url the OSS sends a callback request to this URL
  4087. * {String} options.callback.host The host header value for initiating callback requests
  4088. * {String} options.callback.body The value of the request body when a callback is initiated
  4089. * {String} options.callback.contentType The Content-Type of the callback requests initiatiated
  4090. * {Object} options.callback.customValue Custom parameters are a map of key-values, e.g:
  4091. * customValue = {
  4092. * key1: 'value1',
  4093. * key2: 'value2'
  4094. * }
  4095. */
  4096. proto.completeMultipartUpload = /*#__PURE__*/function () {
  4097. var _completeMultipartUpload = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6(name, uploadId, parts, options) {
  4098. var completeParts, xml, i, p, opt, params, result, ret;
  4099. return _regenerator.default.wrap(function _callee6$(_context6) {
  4100. while (1) {
  4101. switch (_context6.prev = _context6.next) {
  4102. case 0:
  4103. completeParts = parts.concat().sort(function (a, b) {
  4104. return a.number - b.number;
  4105. }).filter(function (item, index, arr) {
  4106. return !index || item.number !== arr[index - 1].number;
  4107. });
  4108. xml = '<?xml version="1.0" encoding="UTF-8"?>\n<CompleteMultipartUpload>\n';
  4109. for (i = 0; i < completeParts.length; i++) {
  4110. p = completeParts[i];
  4111. xml += '<Part>\n';
  4112. xml += "<PartNumber>".concat(p.number, "</PartNumber>\n");
  4113. xml += "<ETag>".concat(p.etag, "</ETag>\n");
  4114. xml += '</Part>\n';
  4115. }
  4116. xml += '</CompleteMultipartUpload>';
  4117. options = options || {};
  4118. opt = {};
  4119. opt = deepCopyWith(options, function (_) {
  4120. if (isBuffer(_)) return null;
  4121. });
  4122. if (opt.headers) delete opt.headers['x-oss-server-side-encryption'];
  4123. opt.subres = {
  4124. uploadId: uploadId
  4125. };
  4126. params = this._objectRequestParams('POST', name, opt);
  4127. callback.encodeCallback(params, opt);
  4128. params.mime = 'xml';
  4129. params.content = xml;
  4130. if (!(params.headers && params.headers['x-oss-callback'])) {
  4131. params.xmlResponse = true;
  4132. }
  4133. params.successStatuses = [200];
  4134. _context6.next = 17;
  4135. return this.request(params);
  4136. case 17:
  4137. result = _context6.sent;
  4138. ret = {
  4139. res: result.res,
  4140. bucket: params.bucket,
  4141. name: name,
  4142. etag: result.res.headers.etag
  4143. };
  4144. if (params.headers && params.headers['x-oss-callback']) {
  4145. ret.data = JSON.parse(result.data.toString());
  4146. }
  4147. return _context6.abrupt("return", ret);
  4148. case 21:
  4149. case "end":
  4150. return _context6.stop();
  4151. }
  4152. }
  4153. }, _callee6, this);
  4154. }));
  4155. function completeMultipartUpload(_x19, _x20, _x21, _x22) {
  4156. return _completeMultipartUpload.apply(this, arguments);
  4157. }
  4158. return completeMultipartUpload;
  4159. }();
  4160. /**
  4161. * Upload a part in a multipart upload transaction
  4162. * @param {String} name the object name
  4163. * @param {String} uploadId the upload id
  4164. * @param {Integer} partNo the part number
  4165. * @param {Object} data the body data
  4166. * @param {Object} options
  4167. */
  4168. proto._uploadPart = /*#__PURE__*/function () {
  4169. var _uploadPart3 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee7(name, uploadId, partNo, data, options) {
  4170. var opt, params, isBrowserEnv, result;
  4171. return _regenerator.default.wrap(function _callee7$(_context7) {
  4172. while (1) {
  4173. switch (_context7.prev = _context7.next) {
  4174. case 0:
  4175. options = options || {};
  4176. opt = {};
  4177. copy(options).to(opt);
  4178. opt.headers = {
  4179. 'Content-Length': data.size
  4180. };
  4181. opt.subres = {
  4182. partNumber: partNo,
  4183. uploadId: uploadId
  4184. };
  4185. params = this._objectRequestParams('PUT', name, opt);
  4186. params.mime = opt.mime;
  4187. isBrowserEnv = process && process.browser;
  4188. isBrowserEnv ? params.content = data.content : params.stream = data.stream;
  4189. params.successStatuses = [200];
  4190. params.disabledMD5 = options.disabledMD5;
  4191. _context7.next = 13;
  4192. return this.request(params);
  4193. case 13:
  4194. result = _context7.sent;
  4195. if (result.res.headers.etag) {
  4196. _context7.next = 16;
  4197. break;
  4198. }
  4199. throw new Error('Please set the etag of expose-headers in OSS \n https://help.aliyun.com/document_detail/32069.html');
  4200. case 16:
  4201. if (data.stream) {
  4202. data.stream = null;
  4203. params.stream = null;
  4204. }
  4205. return _context7.abrupt("return", {
  4206. name: name,
  4207. etag: result.res.headers.etag,
  4208. res: result.res
  4209. });
  4210. case 18:
  4211. case "end":
  4212. return _context7.stop();
  4213. }
  4214. }
  4215. }, _callee7, this);
  4216. }));
  4217. function _uploadPart(_x23, _x24, _x25, _x26, _x27) {
  4218. return _uploadPart3.apply(this, arguments);
  4219. }
  4220. return _uploadPart;
  4221. }();
  4222. }).call(this)}).call(this,require('_process'))
  4223. },{"./callback":24,"./utils/deepCopy":56,"./utils/isBuffer":63,"@babel/runtime/helpers/asyncToGenerator":73,"@babel/runtime/helpers/interopRequireDefault":74,"@babel/runtime/regenerator":76,"_process":399,"copy-to":88,"core-js/modules/es.array.concat.js":241,"core-js/modules/es.array.filter.js":243,"core-js/modules/es.array.map.js":249,"core-js/modules/es.array.sort.js":251,"core-js/modules/es.object.to-string.js":258,"core-js/modules/es.regexp.to-string.js":262}],31:[function(require,module,exports){
  4224. "use strict";
  4225. var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
  4226. var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
  4227. require("core-js/modules/web.dom-collections.for-each.js");
  4228. require("core-js/modules/es.object.keys.js");
  4229. require("core-js/modules/es.array.find.js");
  4230. require("core-js/modules/es.array.includes.js");
  4231. require("core-js/modules/es.array.concat.js");
  4232. require("core-js/modules/es.regexp.exec.js");
  4233. require("core-js/modules/es.string.replace.js");
  4234. var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
  4235. var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
  4236. var _require = require('../utils/checkBucketName'),
  4237. _checkBucketName = _require.checkBucketName;
  4238. var proto = exports;
  4239. var REPLACE_HEDERS = ['content-type', 'content-encoding', 'content-language', 'content-disposition', 'cache-control', 'expires'];
  4240. proto.copy = /*#__PURE__*/function () {
  4241. var _copy = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(name, sourceName, bucketName, options) {
  4242. var params, result, data;
  4243. return _regenerator.default.wrap(function _callee$(_context) {
  4244. while (1) {
  4245. switch (_context.prev = _context.next) {
  4246. case 0:
  4247. if ((0, _typeof2.default)(bucketName) === 'object') {
  4248. options = bucketName; // 兼容旧版本,旧版本第三个参数为options
  4249. }
  4250. options = options || {};
  4251. options.headers = options.headers || {};
  4252. Object.keys(options.headers).forEach(function (key) {
  4253. options.headers["x-oss-copy-source-".concat(key.toLowerCase())] = options.headers[key];
  4254. });
  4255. if (options.meta || Object.keys(options.headers).find(function (_) {
  4256. return REPLACE_HEDERS.includes(_.toLowerCase());
  4257. })) {
  4258. options.headers['x-oss-metadata-directive'] = 'REPLACE';
  4259. }
  4260. this._convertMetaToHeaders(options.meta, options.headers);
  4261. sourceName = this._getSourceName(sourceName, bucketName);
  4262. if (options.versionId) {
  4263. sourceName = "".concat(sourceName, "?versionId=").concat(options.versionId);
  4264. }
  4265. options.headers['x-oss-copy-source'] = sourceName;
  4266. params = this._objectRequestParams('PUT', name, options);
  4267. params.xmlResponse = true;
  4268. params.successStatuses = [200, 304];
  4269. _context.next = 14;
  4270. return this.request(params);
  4271. case 14:
  4272. result = _context.sent;
  4273. data = result.data;
  4274. if (data) {
  4275. data = {
  4276. etag: data.ETag,
  4277. lastModified: data.LastModified
  4278. };
  4279. }
  4280. return _context.abrupt("return", {
  4281. data: data,
  4282. res: result.res
  4283. });
  4284. case 18:
  4285. case "end":
  4286. return _context.stop();
  4287. }
  4288. }
  4289. }, _callee, this);
  4290. }));
  4291. function copy(_x, _x2, _x3, _x4) {
  4292. return _copy.apply(this, arguments);
  4293. }
  4294. return copy;
  4295. }(); // todo delete
  4296. proto._getSourceName = function _getSourceName(sourceName, bucketName) {
  4297. if (typeof bucketName === 'string') {
  4298. sourceName = this._objectName(sourceName);
  4299. } else if (sourceName[0] !== '/') {
  4300. bucketName = this.options.bucket;
  4301. } else {
  4302. bucketName = sourceName.replace(/\/(.+?)(\/.*)/, '$1');
  4303. sourceName = sourceName.replace(/(\/.+?\/)(.*)/, '$2');
  4304. }
  4305. _checkBucketName(bucketName);
  4306. sourceName = encodeURIComponent(sourceName);
  4307. sourceName = "/".concat(bucketName, "/").concat(sourceName);
  4308. return sourceName;
  4309. };
  4310. },{"../utils/checkBucketName":50,"@babel/runtime/helpers/asyncToGenerator":73,"@babel/runtime/helpers/interopRequireDefault":74,"@babel/runtime/helpers/typeof":75,"@babel/runtime/regenerator":76,"core-js/modules/es.array.concat.js":241,"core-js/modules/es.array.find.js":244,"core-js/modules/es.array.includes.js":246,"core-js/modules/es.object.keys.js":257,"core-js/modules/es.regexp.exec.js":261,"core-js/modules/es.string.replace.js":266,"core-js/modules/web.dom-collections.for-each.js":296}],32:[function(require,module,exports){
  4311. "use strict";
  4312. var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
  4313. var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
  4314. require("core-js/modules/es.object.assign.js");
  4315. var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
  4316. var proto = exports;
  4317. /**
  4318. * delete
  4319. * @param {String} name - object name
  4320. * @param {Object} options
  4321. * @param {{res}}
  4322. */
  4323. proto.delete = /*#__PURE__*/function () {
  4324. var _delete2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(name) {
  4325. var options,
  4326. params,
  4327. result,
  4328. _args = arguments;
  4329. return _regenerator.default.wrap(function _callee$(_context) {
  4330. while (1) {
  4331. switch (_context.prev = _context.next) {
  4332. case 0:
  4333. options = _args.length > 1 && _args[1] !== undefined ? _args[1] : {};
  4334. options.subres = Object.assign({}, options.subres);
  4335. if (options.versionId) {
  4336. options.subres.versionId = options.versionId;
  4337. }
  4338. params = this._objectRequestParams('DELETE', name, options);
  4339. params.successStatuses = [204];
  4340. _context.next = 7;
  4341. return this.request(params);
  4342. case 7:
  4343. result = _context.sent;
  4344. return _context.abrupt("return", {
  4345. res: result.res
  4346. });
  4347. case 9:
  4348. case "end":
  4349. return _context.stop();
  4350. }
  4351. }
  4352. }, _callee, this);
  4353. }));
  4354. function _delete(_x) {
  4355. return _delete2.apply(this, arguments);
  4356. }
  4357. return _delete;
  4358. }();
  4359. },{"@babel/runtime/helpers/asyncToGenerator":73,"@babel/runtime/helpers/interopRequireDefault":74,"@babel/runtime/regenerator":76,"core-js/modules/es.object.assign.js":255}],33:[function(require,module,exports){
  4360. "use strict";
  4361. var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
  4362. var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
  4363. require("core-js/modules/es.object.assign.js");
  4364. var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
  4365. /* eslint-disable object-curly-newline */
  4366. var utility = require('utility');
  4367. var _require = require('../utils/obj2xml'),
  4368. obj2xml = _require.obj2xml;
  4369. var proto = exports;
  4370. proto.deleteMulti = /*#__PURE__*/function () {
  4371. var _deleteMulti = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(names) {
  4372. var options,
  4373. objects,
  4374. i,
  4375. object,
  4376. _names$i,
  4377. key,
  4378. versionId,
  4379. paramXMLObj,
  4380. paramXML,
  4381. params,
  4382. result,
  4383. r,
  4384. deleted,
  4385. _args = arguments;
  4386. return _regenerator.default.wrap(function _callee$(_context) {
  4387. while (1) {
  4388. switch (_context.prev = _context.next) {
  4389. case 0:
  4390. options = _args.length > 1 && _args[1] !== undefined ? _args[1] : {};
  4391. objects = [];
  4392. if (!(!names || !names.length)) {
  4393. _context.next = 4;
  4394. break;
  4395. }
  4396. throw new Error('names is required');
  4397. case 4:
  4398. for (i = 0; i < names.length; i++) {
  4399. object = {};
  4400. if (typeof names[i] === 'string') {
  4401. object.Key = utility.escape(this._objectName(names[i]));
  4402. } else {
  4403. _names$i = names[i], key = _names$i.key, versionId = _names$i.versionId;
  4404. object.Key = utility.escape(this._objectName(key));
  4405. object.VersionId = versionId;
  4406. }
  4407. objects.push(object);
  4408. }
  4409. paramXMLObj = {
  4410. Delete: {
  4411. Quiet: !!options.quiet,
  4412. Object: objects
  4413. }
  4414. };
  4415. paramXML = obj2xml(paramXMLObj, {
  4416. headers: true
  4417. });
  4418. options.subres = Object.assign({
  4419. delete: ''
  4420. }, options.subres);
  4421. if (options.versionId) {
  4422. options.subres.versionId = options.versionId;
  4423. }
  4424. params = this._objectRequestParams('POST', '', options);
  4425. params.mime = 'xml';
  4426. params.content = paramXML;
  4427. params.xmlResponse = true;
  4428. params.successStatuses = [200];
  4429. _context.next = 16;
  4430. return this.request(params);
  4431. case 16:
  4432. result = _context.sent;
  4433. r = result.data;
  4434. deleted = r && r.Deleted || null;
  4435. if (deleted) {
  4436. if (!Array.isArray(deleted)) {
  4437. deleted = [deleted];
  4438. }
  4439. }
  4440. return _context.abrupt("return", {
  4441. res: result.res,
  4442. deleted: deleted || []
  4443. });
  4444. case 21:
  4445. case "end":
  4446. return _context.stop();
  4447. }
  4448. }
  4449. }, _callee, this);
  4450. }));
  4451. function deleteMulti(_x) {
  4452. return _deleteMulti.apply(this, arguments);
  4453. }
  4454. return deleteMulti;
  4455. }();
  4456. },{"../utils/obj2xml":69,"@babel/runtime/helpers/asyncToGenerator":73,"@babel/runtime/helpers/interopRequireDefault":74,"@babel/runtime/regenerator":76,"core-js/modules/es.object.assign.js":255,"utility":406}],34:[function(require,module,exports){
  4457. "use strict";
  4458. var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
  4459. var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
  4460. require("core-js/modules/es.object.assign.js");
  4461. var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
  4462. var proto = exports;
  4463. /**
  4464. * deleteObjectTagging
  4465. * @param {String} name - object name
  4466. * @param {Object} options
  4467. */
  4468. proto.deleteObjectTagging = /*#__PURE__*/function () {
  4469. var _deleteObjectTagging = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(name) {
  4470. var options,
  4471. params,
  4472. result,
  4473. _args = arguments;
  4474. return _regenerator.default.wrap(function _callee$(_context) {
  4475. while (1) {
  4476. switch (_context.prev = _context.next) {
  4477. case 0:
  4478. options = _args.length > 1 && _args[1] !== undefined ? _args[1] : {};
  4479. options.subres = Object.assign({
  4480. tagging: ''
  4481. }, options.subres);
  4482. if (options.versionId) {
  4483. options.subres.versionId = options.versionId;
  4484. }
  4485. name = this._objectName(name);
  4486. params = this._objectRequestParams('DELETE', name, options);
  4487. params.successStatuses = [204];
  4488. _context.next = 8;
  4489. return this.request(params);
  4490. case 8:
  4491. result = _context.sent;
  4492. return _context.abrupt("return", {
  4493. status: result.status,
  4494. res: result.res
  4495. });
  4496. case 10:
  4497. case "end":
  4498. return _context.stop();
  4499. }
  4500. }
  4501. }, _callee, this);
  4502. }));
  4503. function deleteObjectTagging(_x) {
  4504. return _deleteObjectTagging.apply(this, arguments);
  4505. }
  4506. return deleteObjectTagging;
  4507. }();
  4508. },{"@babel/runtime/helpers/asyncToGenerator":73,"@babel/runtime/helpers/interopRequireDefault":74,"@babel/runtime/regenerator":76,"core-js/modules/es.object.assign.js":255}],35:[function(require,module,exports){
  4509. "use strict";
  4510. require("core-js/modules/es.array.concat.js");
  4511. var urlutil = require('url');
  4512. var _require = require('../utils/isIP'),
  4513. isIP = _require.isIP;
  4514. var proto = exports;
  4515. /**
  4516. * Get Object url by name
  4517. * @param {String} name - object name
  4518. * @param {String} [baseUrl] - If provide `baseUrl`, will use `baseUrl` instead the default `endpoint and bucket`.
  4519. * @return {String} object url include bucket
  4520. */
  4521. proto.generateObjectUrl = function generateObjectUrl(name, baseUrl) {
  4522. if (isIP(this.options.endpoint.hostname)) {
  4523. throw new Error('can not get the object URL when endpoint is IP');
  4524. }
  4525. if (!baseUrl) {
  4526. baseUrl = this.options.endpoint.format();
  4527. var copyUrl = urlutil.parse(baseUrl);
  4528. var bucket = this.options.bucket;
  4529. copyUrl.hostname = "".concat(bucket, ".").concat(copyUrl.hostname);
  4530. copyUrl.host = "".concat(bucket, ".").concat(copyUrl.host);
  4531. baseUrl = copyUrl.format();
  4532. } else if (baseUrl[baseUrl.length - 1] !== '/') {
  4533. baseUrl += '/';
  4534. }
  4535. return baseUrl + this._escape(this._objectName(name));
  4536. };
  4537. },{"../utils/isIP":66,"core-js/modules/es.array.concat.js":241,"url":404}],36:[function(require,module,exports){
  4538. (function (process){(function (){
  4539. "use strict";
  4540. var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
  4541. var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
  4542. require("core-js/modules/es.object.assign.js");
  4543. var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
  4544. var fs = require('fs');
  4545. var is = require('is-type-of');
  4546. var proto = exports;
  4547. /**
  4548. * get
  4549. * @param {String} name - object name
  4550. * @param {String | Stream} file
  4551. * @param {Object} options
  4552. * @param {{res}}
  4553. */
  4554. proto.get = /*#__PURE__*/function () {
  4555. var _get = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(name, file) {
  4556. var options,
  4557. writeStream,
  4558. needDestroy,
  4559. isBrowserEnv,
  4560. responseCacheControl,
  4561. defaultSubresOptions,
  4562. result,
  4563. params,
  4564. _args = arguments;
  4565. return _regenerator.default.wrap(function _callee$(_context) {
  4566. while (1) {
  4567. switch (_context.prev = _context.next) {
  4568. case 0:
  4569. options = _args.length > 2 && _args[2] !== undefined ? _args[2] : {};
  4570. writeStream = null;
  4571. needDestroy = false;
  4572. if (is.writableStream(file)) {
  4573. writeStream = file;
  4574. } else if (is.string(file)) {
  4575. writeStream = fs.createWriteStream(file);
  4576. needDestroy = true;
  4577. } else {
  4578. // get(name, options)
  4579. options = file;
  4580. }
  4581. options = options || {};
  4582. isBrowserEnv = process && process.browser;
  4583. responseCacheControl = options.responseCacheControl === null ? '' : 'no-cache';
  4584. defaultSubresOptions = isBrowserEnv && responseCacheControl ? {
  4585. 'response-cache-control': responseCacheControl
  4586. } : {};
  4587. options.subres = Object.assign(defaultSubresOptions, options.subres);
  4588. if (options.versionId) {
  4589. options.subres.versionId = options.versionId;
  4590. }
  4591. if (options.process) {
  4592. options.subres['x-oss-process'] = options.process;
  4593. }
  4594. _context.prev = 11;
  4595. params = this._objectRequestParams('GET', name, options);
  4596. params.writeStream = writeStream;
  4597. params.successStatuses = [200, 206, 304];
  4598. _context.next = 17;
  4599. return this.request(params);
  4600. case 17:
  4601. result = _context.sent;
  4602. if (needDestroy) {
  4603. writeStream.destroy();
  4604. }
  4605. _context.next = 28;
  4606. break;
  4607. case 21:
  4608. _context.prev = 21;
  4609. _context.t0 = _context["catch"](11);
  4610. if (!needDestroy) {
  4611. _context.next = 27;
  4612. break;
  4613. }
  4614. writeStream.destroy(); // should delete the exists file before throw error
  4615. _context.next = 27;
  4616. return this._deleteFileSafe(file);
  4617. case 27:
  4618. throw _context.t0;
  4619. case 28:
  4620. return _context.abrupt("return", {
  4621. res: result.res,
  4622. content: result.data
  4623. });
  4624. case 29:
  4625. case "end":
  4626. return _context.stop();
  4627. }
  4628. }
  4629. }, _callee, this, [[11, 21]]);
  4630. }));
  4631. function get(_x, _x2) {
  4632. return _get.apply(this, arguments);
  4633. }
  4634. return get;
  4635. }();
  4636. }).call(this)}).call(this,require('_process'))
  4637. },{"@babel/runtime/helpers/asyncToGenerator":73,"@babel/runtime/helpers/interopRequireDefault":74,"@babel/runtime/regenerator":76,"_process":399,"core-js/modules/es.object.assign.js":255,"fs":84,"is-type-of":398}],37:[function(require,module,exports){
  4638. "use strict";
  4639. var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
  4640. var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
  4641. require("core-js/modules/es.object.assign.js");
  4642. var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
  4643. var proto = exports;
  4644. /*
  4645. * Get object's ACL
  4646. * @param {String} name the object key
  4647. * @param {Object} options
  4648. * @return {Object}
  4649. */
  4650. proto.getACL = /*#__PURE__*/function () {
  4651. var _getACL = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(name) {
  4652. var options,
  4653. params,
  4654. result,
  4655. _args = arguments;
  4656. return _regenerator.default.wrap(function _callee$(_context) {
  4657. while (1) {
  4658. switch (_context.prev = _context.next) {
  4659. case 0:
  4660. options = _args.length > 1 && _args[1] !== undefined ? _args[1] : {};
  4661. options.subres = Object.assign({
  4662. acl: ''
  4663. }, options.subres);
  4664. if (options.versionId) {
  4665. options.subres.versionId = options.versionId;
  4666. }
  4667. name = this._objectName(name);
  4668. params = this._objectRequestParams('GET', name, options);
  4669. params.successStatuses = [200];
  4670. params.xmlResponse = true;
  4671. _context.next = 9;
  4672. return this.request(params);
  4673. case 9:
  4674. result = _context.sent;
  4675. return _context.abrupt("return", {
  4676. acl: result.data.AccessControlList.Grant,
  4677. owner: {
  4678. id: result.data.Owner.ID,
  4679. displayName: result.data.Owner.DisplayName
  4680. },
  4681. res: result.res
  4682. });
  4683. case 11:
  4684. case "end":
  4685. return _context.stop();
  4686. }
  4687. }
  4688. }, _callee, this);
  4689. }));
  4690. function getACL(_x) {
  4691. return _getACL.apply(this, arguments);
  4692. }
  4693. return getACL;
  4694. }();
  4695. },{"@babel/runtime/helpers/asyncToGenerator":73,"@babel/runtime/helpers/interopRequireDefault":74,"@babel/runtime/regenerator":76,"core-js/modules/es.object.assign.js":255}],38:[function(require,module,exports){
  4696. "use strict";
  4697. var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
  4698. var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
  4699. require("core-js/modules/es.regexp.exec.js");
  4700. require("core-js/modules/es.string.replace.js");
  4701. require("core-js/modules/web.dom-collections.for-each.js");
  4702. require("core-js/modules/es.object.keys.js");
  4703. require("core-js/modules/es.object.assign.js");
  4704. require("core-js/modules/es.array.map.js");
  4705. require("core-js/modules/es.number.constructor.js");
  4706. var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
  4707. /* eslint-disable no-use-before-define */
  4708. var proto = exports;
  4709. var _require = require('../utils/isObject'),
  4710. isObject = _require.isObject;
  4711. var _require2 = require('../utils/isArray'),
  4712. isArray = _require2.isArray;
  4713. proto.getBucketVersions = getBucketVersions;
  4714. proto.listObjectVersions = getBucketVersions;
  4715. function getBucketVersions() {
  4716. return _getBucketVersions.apply(this, arguments);
  4717. }
  4718. function _getBucketVersions() {
  4719. _getBucketVersions = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
  4720. var query,
  4721. options,
  4722. params,
  4723. result,
  4724. objects,
  4725. deleteMarker,
  4726. that,
  4727. prefixes,
  4728. _args = arguments;
  4729. return _regenerator.default.wrap(function _callee$(_context) {
  4730. while (1) {
  4731. switch (_context.prev = _context.next) {
  4732. case 0:
  4733. query = _args.length > 0 && _args[0] !== undefined ? _args[0] : {};
  4734. options = _args.length > 1 && _args[1] !== undefined ? _args[1] : {};
  4735. if (!(query.versionIdMarker && query.keyMarker === undefined)) {
  4736. _context.next = 4;
  4737. break;
  4738. }
  4739. throw new Error('A version-id marker cannot be specified without a key marker');
  4740. case 4:
  4741. options.subres = Object.assign({
  4742. versions: ''
  4743. }, options.subres);
  4744. if (options.versionId) {
  4745. options.subres.versionId = options.versionId;
  4746. }
  4747. params = this._objectRequestParams('GET', '', options);
  4748. params.xmlResponse = true;
  4749. params.successStatuses = [200];
  4750. params.query = formatQuery(query);
  4751. _context.next = 12;
  4752. return this.request(params);
  4753. case 12:
  4754. result = _context.sent;
  4755. objects = result.data.Version || [];
  4756. deleteMarker = result.data.DeleteMarker || [];
  4757. that = this;
  4758. if (objects) {
  4759. if (!Array.isArray(objects)) {
  4760. objects = [objects];
  4761. }
  4762. objects = objects.map(function (obj) {
  4763. return {
  4764. name: obj.Key,
  4765. url: that._objectUrl(obj.Key),
  4766. lastModified: obj.LastModified,
  4767. isLatest: obj.IsLatest === 'true',
  4768. versionId: obj.VersionId,
  4769. etag: obj.ETag,
  4770. type: obj.Type,
  4771. size: Number(obj.Size),
  4772. storageClass: obj.StorageClass,
  4773. owner: {
  4774. id: obj.Owner.ID,
  4775. displayName: obj.Owner.DisplayName
  4776. }
  4777. };
  4778. });
  4779. }
  4780. if (deleteMarker) {
  4781. if (!isArray(deleteMarker)) {
  4782. deleteMarker = [deleteMarker];
  4783. }
  4784. deleteMarker = deleteMarker.map(function (obj) {
  4785. return {
  4786. name: obj.Key,
  4787. lastModified: obj.LastModified,
  4788. versionId: obj.VersionId,
  4789. owner: {
  4790. id: obj.Owner.ID,
  4791. displayName: obj.Owner.DisplayName
  4792. }
  4793. };
  4794. });
  4795. }
  4796. prefixes = result.data.CommonPrefixes || null;
  4797. if (prefixes) {
  4798. if (!isArray(prefixes)) {
  4799. prefixes = [prefixes];
  4800. }
  4801. prefixes = prefixes.map(function (item) {
  4802. return item.Prefix;
  4803. });
  4804. }
  4805. return _context.abrupt("return", {
  4806. res: result.res,
  4807. objects: objects,
  4808. deleteMarker: deleteMarker,
  4809. prefixes: prefixes,
  4810. // attirbute of legacy error
  4811. nextMarker: result.data.NextKeyMarker || null,
  4812. // attirbute of legacy error
  4813. NextVersionIdMarker: result.data.NextVersionIdMarker || null,
  4814. nextKeyMarker: result.data.NextKeyMarker || null,
  4815. nextVersionIdMarker: result.data.NextVersionIdMarker || null,
  4816. isTruncated: result.data.IsTruncated === 'true'
  4817. });
  4818. case 21:
  4819. case "end":
  4820. return _context.stop();
  4821. }
  4822. }
  4823. }, _callee, this);
  4824. }));
  4825. return _getBucketVersions.apply(this, arguments);
  4826. }
  4827. function camel2Line(name) {
  4828. return name.replace(/([A-Z])/g, '-$1').toLowerCase();
  4829. }
  4830. function formatQuery() {
  4831. var query = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  4832. var obj = {};
  4833. if (isObject(query)) {
  4834. Object.keys(query).forEach(function (key) {
  4835. obj[camel2Line(key)] = query[key];
  4836. });
  4837. }
  4838. return obj;
  4839. }
  4840. },{"../utils/isArray":61,"../utils/isObject":67,"@babel/runtime/helpers/asyncToGenerator":73,"@babel/runtime/helpers/interopRequireDefault":74,"@babel/runtime/regenerator":76,"core-js/modules/es.array.map.js":249,"core-js/modules/es.number.constructor.js":254,"core-js/modules/es.object.assign.js":255,"core-js/modules/es.object.keys.js":257,"core-js/modules/es.regexp.exec.js":261,"core-js/modules/es.string.replace.js":266,"core-js/modules/web.dom-collections.for-each.js":296}],39:[function(require,module,exports){
  4841. "use strict";
  4842. var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
  4843. var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
  4844. require("core-js/modules/es.object.assign.js");
  4845. var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
  4846. var proto = exports;
  4847. /**
  4848. * getObjectMeta
  4849. * @param {String} name - object name
  4850. * @param {Object} options
  4851. * @param {{res}}
  4852. */
  4853. proto.getObjectMeta = /*#__PURE__*/function () {
  4854. var _getObjectMeta = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(name, options) {
  4855. var params, result;
  4856. return _regenerator.default.wrap(function _callee$(_context) {
  4857. while (1) {
  4858. switch (_context.prev = _context.next) {
  4859. case 0:
  4860. options = options || {};
  4861. name = this._objectName(name);
  4862. options.subres = Object.assign({
  4863. objectMeta: ''
  4864. }, options.subres);
  4865. if (options.versionId) {
  4866. options.subres.versionId = options.versionId;
  4867. }
  4868. params = this._objectRequestParams('HEAD', name, options);
  4869. params.successStatuses = [200];
  4870. _context.next = 8;
  4871. return this.request(params);
  4872. case 8:
  4873. result = _context.sent;
  4874. return _context.abrupt("return", {
  4875. status: result.status,
  4876. res: result.res
  4877. });
  4878. case 10:
  4879. case "end":
  4880. return _context.stop();
  4881. }
  4882. }
  4883. }, _callee, this);
  4884. }));
  4885. function getObjectMeta(_x, _x2) {
  4886. return _getObjectMeta.apply(this, arguments);
  4887. }
  4888. return getObjectMeta;
  4889. }();
  4890. },{"@babel/runtime/helpers/asyncToGenerator":73,"@babel/runtime/helpers/interopRequireDefault":74,"@babel/runtime/regenerator":76,"core-js/modules/es.object.assign.js":255}],40:[function(require,module,exports){
  4891. "use strict";
  4892. var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
  4893. var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
  4894. require("core-js/modules/es.object.assign.js");
  4895. require("core-js/modules/web.dom-collections.for-each.js");
  4896. var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
  4897. var proto = exports;
  4898. var _require = require('../utils/isObject'),
  4899. isObject = _require.isObject;
  4900. /**
  4901. * getObjectTagging
  4902. * @param {String} name - object name
  4903. * @param {Object} options
  4904. * @return {Object}
  4905. */
  4906. proto.getObjectTagging = /*#__PURE__*/function () {
  4907. var _getObjectTagging = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(name) {
  4908. var options,
  4909. params,
  4910. result,
  4911. Tagging,
  4912. Tag,
  4913. tag,
  4914. _args = arguments;
  4915. return _regenerator.default.wrap(function _callee$(_context) {
  4916. while (1) {
  4917. switch (_context.prev = _context.next) {
  4918. case 0:
  4919. options = _args.length > 1 && _args[1] !== undefined ? _args[1] : {};
  4920. options.subres = Object.assign({
  4921. tagging: ''
  4922. }, options.subres);
  4923. if (options.versionId) {
  4924. options.subres.versionId = options.versionId;
  4925. }
  4926. name = this._objectName(name);
  4927. params = this._objectRequestParams('GET', name, options);
  4928. params.successStatuses = [200];
  4929. _context.next = 8;
  4930. return this.request(params);
  4931. case 8:
  4932. result = _context.sent;
  4933. _context.next = 11;
  4934. return this.parseXML(result.data);
  4935. case 11:
  4936. Tagging = _context.sent;
  4937. Tag = Tagging.TagSet.Tag;
  4938. Tag = Tag && isObject(Tag) ? [Tag] : Tag || [];
  4939. tag = {};
  4940. Tag.forEach(function (item) {
  4941. tag[item.Key] = item.Value;
  4942. });
  4943. return _context.abrupt("return", {
  4944. status: result.status,
  4945. res: result.res,
  4946. tag: tag
  4947. });
  4948. case 17:
  4949. case "end":
  4950. return _context.stop();
  4951. }
  4952. }
  4953. }, _callee, this);
  4954. }));
  4955. function getObjectTagging(_x) {
  4956. return _getObjectTagging.apply(this, arguments);
  4957. }
  4958. return getObjectTagging;
  4959. }();
  4960. },{"../utils/isObject":67,"@babel/runtime/helpers/asyncToGenerator":73,"@babel/runtime/helpers/interopRequireDefault":74,"@babel/runtime/regenerator":76,"core-js/modules/es.object.assign.js":255,"core-js/modules/web.dom-collections.for-each.js":296}],41:[function(require,module,exports){
  4961. "use strict";
  4962. var _require = require('../utils/isIP'),
  4963. isIP = _require.isIP;
  4964. var proto = exports;
  4965. /**
  4966. * Get Object url by name
  4967. * @param {String} name - object name
  4968. * @param {String} [baseUrl] - If provide `baseUrl`,
  4969. * will use `baseUrl` instead the default `endpoint`.
  4970. * @return {String} object url
  4971. */
  4972. proto.getObjectUrl = function getObjectUrl(name, baseUrl) {
  4973. if (isIP(this.options.endpoint.hostname)) {
  4974. throw new Error('can not get the object URL when endpoint is IP');
  4975. }
  4976. if (!baseUrl) {
  4977. baseUrl = this.options.endpoint.format();
  4978. } else if (baseUrl[baseUrl.length - 1] !== '/') {
  4979. baseUrl += '/';
  4980. }
  4981. return baseUrl + this._escape(this._objectName(name));
  4982. };
  4983. },{"../utils/isIP":66}],42:[function(require,module,exports){
  4984. "use strict";
  4985. var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
  4986. var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
  4987. require("core-js/modules/es.object.assign.js");
  4988. var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
  4989. var proto = exports;
  4990. /**
  4991. * getSymlink
  4992. * @param {String} name - object name
  4993. * @param {Object} options
  4994. * @param {{res}}
  4995. */
  4996. proto.getSymlink = /*#__PURE__*/function () {
  4997. var _getSymlink = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(name) {
  4998. var options,
  4999. params,
  5000. result,
  5001. target,
  5002. _args = arguments;
  5003. return _regenerator.default.wrap(function _callee$(_context) {
  5004. while (1) {
  5005. switch (_context.prev = _context.next) {
  5006. case 0:
  5007. options = _args.length > 1 && _args[1] !== undefined ? _args[1] : {};
  5008. options.subres = Object.assign({
  5009. symlink: ''
  5010. }, options.subres);
  5011. if (options.versionId) {
  5012. options.subres.versionId = options.versionId;
  5013. }
  5014. name = this._objectName(name);
  5015. params = this._objectRequestParams('GET', name, options);
  5016. params.successStatuses = [200];
  5017. _context.next = 8;
  5018. return this.request(params);
  5019. case 8:
  5020. result = _context.sent;
  5021. target = result.res.headers['x-oss-symlink-target'];
  5022. return _context.abrupt("return", {
  5023. targetName: decodeURIComponent(target),
  5024. res: result.res
  5025. });
  5026. case 11:
  5027. case "end":
  5028. return _context.stop();
  5029. }
  5030. }
  5031. }, _callee, this);
  5032. }));
  5033. function getSymlink(_x) {
  5034. return _getSymlink.apply(this, arguments);
  5035. }
  5036. return getSymlink;
  5037. }();
  5038. },{"@babel/runtime/helpers/asyncToGenerator":73,"@babel/runtime/helpers/interopRequireDefault":74,"@babel/runtime/regenerator":76,"core-js/modules/es.object.assign.js":255}],43:[function(require,module,exports){
  5039. "use strict";
  5040. var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
  5041. var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
  5042. require("core-js/modules/es.object.assign.js");
  5043. require("core-js/modules/web.dom-collections.for-each.js");
  5044. require("core-js/modules/es.object.keys.js");
  5045. var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
  5046. var proto = exports;
  5047. /**
  5048. * head
  5049. * @param {String} name - object name
  5050. * @param {Object} options
  5051. * @param {{res}}
  5052. */
  5053. proto.head = /*#__PURE__*/function () {
  5054. var _head = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(name) {
  5055. var options,
  5056. params,
  5057. result,
  5058. data,
  5059. _args = arguments;
  5060. return _regenerator.default.wrap(function _callee$(_context) {
  5061. while (1) {
  5062. switch (_context.prev = _context.next) {
  5063. case 0:
  5064. options = _args.length > 1 && _args[1] !== undefined ? _args[1] : {};
  5065. options.subres = Object.assign({}, options.subres);
  5066. if (options.versionId) {
  5067. options.subres.versionId = options.versionId;
  5068. }
  5069. params = this._objectRequestParams('HEAD', name, options);
  5070. params.successStatuses = [200, 304];
  5071. _context.next = 7;
  5072. return this.request(params);
  5073. case 7:
  5074. result = _context.sent;
  5075. data = {
  5076. meta: null,
  5077. res: result.res,
  5078. status: result.status
  5079. };
  5080. if (result.status === 200) {
  5081. Object.keys(result.headers).forEach(function (k) {
  5082. if (k.indexOf('x-oss-meta-') === 0) {
  5083. if (!data.meta) {
  5084. data.meta = {};
  5085. }
  5086. data.meta[k.substring(11)] = result.headers[k];
  5087. }
  5088. });
  5089. }
  5090. return _context.abrupt("return", data);
  5091. case 11:
  5092. case "end":
  5093. return _context.stop();
  5094. }
  5095. }
  5096. }, _callee, this);
  5097. }));
  5098. function head(_x) {
  5099. return _head.apply(this, arguments);
  5100. }
  5101. return head;
  5102. }();
  5103. },{"@babel/runtime/helpers/asyncToGenerator":73,"@babel/runtime/helpers/interopRequireDefault":74,"@babel/runtime/regenerator":76,"core-js/modules/es.object.assign.js":255,"core-js/modules/es.object.keys.js":257,"core-js/modules/web.dom-collections.for-each.js":296}],44:[function(require,module,exports){
  5104. "use strict";
  5105. var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
  5106. var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
  5107. require("core-js/modules/es.object.assign.js");
  5108. var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
  5109. var proto = exports;
  5110. /*
  5111. * Set object's ACL
  5112. * @param {String} name the object key
  5113. * @param {String} acl the object ACL
  5114. * @param {Object} options
  5115. */
  5116. proto.putACL = /*#__PURE__*/function () {
  5117. var _putACL = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(name, acl, options) {
  5118. var params, result;
  5119. return _regenerator.default.wrap(function _callee$(_context) {
  5120. while (1) {
  5121. switch (_context.prev = _context.next) {
  5122. case 0:
  5123. options = options || {};
  5124. options.subres = Object.assign({
  5125. acl: ''
  5126. }, options.subres);
  5127. if (options.versionId) {
  5128. options.subres.versionId = options.versionId;
  5129. }
  5130. options.headers = options.headers || {};
  5131. options.headers['x-oss-object-acl'] = acl;
  5132. name = this._objectName(name);
  5133. params = this._objectRequestParams('PUT', name, options);
  5134. params.successStatuses = [200];
  5135. _context.next = 10;
  5136. return this.request(params);
  5137. case 10:
  5138. result = _context.sent;
  5139. return _context.abrupt("return", {
  5140. res: result.res
  5141. });
  5142. case 12:
  5143. case "end":
  5144. return _context.stop();
  5145. }
  5146. }
  5147. }, _callee, this);
  5148. }));
  5149. function putACL(_x, _x2, _x3) {
  5150. return _putACL.apply(this, arguments);
  5151. }
  5152. return putACL;
  5153. }();
  5154. },{"@babel/runtime/helpers/asyncToGenerator":73,"@babel/runtime/helpers/interopRequireDefault":74,"@babel/runtime/regenerator":76,"core-js/modules/es.object.assign.js":255}],45:[function(require,module,exports){
  5155. "use strict";
  5156. var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
  5157. var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
  5158. require("core-js/modules/es.object.assign.js");
  5159. require("core-js/modules/es.array.map.js");
  5160. require("core-js/modules/es.object.keys.js");
  5161. var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
  5162. var _require = require('../utils/obj2xml'),
  5163. obj2xml = _require.obj2xml;
  5164. var _require2 = require('../utils/checkObjectTag'),
  5165. checkObjectTag = _require2.checkObjectTag;
  5166. var proto = exports;
  5167. /**
  5168. * putObjectTagging
  5169. * @param {String} name - object name
  5170. * @param {Object} tag - object tag, eg: `{a: "1", b: "2"}`
  5171. * @param {Object} options
  5172. */
  5173. proto.putObjectTagging = /*#__PURE__*/function () {
  5174. var _putObjectTagging = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(name, tag) {
  5175. var options,
  5176. params,
  5177. paramXMLObj,
  5178. result,
  5179. _args = arguments;
  5180. return _regenerator.default.wrap(function _callee$(_context) {
  5181. while (1) {
  5182. switch (_context.prev = _context.next) {
  5183. case 0:
  5184. options = _args.length > 2 && _args[2] !== undefined ? _args[2] : {};
  5185. checkObjectTag(tag);
  5186. options.subres = Object.assign({
  5187. tagging: ''
  5188. }, options.subres);
  5189. if (options.versionId) {
  5190. options.subres.versionId = options.versionId;
  5191. }
  5192. name = this._objectName(name);
  5193. params = this._objectRequestParams('PUT', name, options);
  5194. params.successStatuses = [200];
  5195. tag = Object.keys(tag).map(function (key) {
  5196. return {
  5197. Key: key,
  5198. Value: tag[key]
  5199. };
  5200. });
  5201. paramXMLObj = {
  5202. Tagging: {
  5203. TagSet: {
  5204. Tag: tag
  5205. }
  5206. }
  5207. };
  5208. params.mime = 'xml';
  5209. params.content = obj2xml(paramXMLObj);
  5210. _context.next = 13;
  5211. return this.request(params);
  5212. case 13:
  5213. result = _context.sent;
  5214. return _context.abrupt("return", {
  5215. res: result.res,
  5216. status: result.status
  5217. });
  5218. case 15:
  5219. case "end":
  5220. return _context.stop();
  5221. }
  5222. }
  5223. }, _callee, this);
  5224. }));
  5225. function putObjectTagging(_x, _x2) {
  5226. return _putObjectTagging.apply(this, arguments);
  5227. }
  5228. return putObjectTagging;
  5229. }();
  5230. },{"../utils/checkObjectTag":52,"../utils/obj2xml":69,"@babel/runtime/helpers/asyncToGenerator":73,"@babel/runtime/helpers/interopRequireDefault":74,"@babel/runtime/regenerator":76,"core-js/modules/es.array.map.js":249,"core-js/modules/es.object.assign.js":255,"core-js/modules/es.object.keys.js":257}],46:[function(require,module,exports){
  5231. "use strict";
  5232. var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
  5233. var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
  5234. require("core-js/modules/es.object.assign.js");
  5235. var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
  5236. var proto = exports;
  5237. /**
  5238. * putSymlink
  5239. * @param {String} name - object name
  5240. * @param {String} targetName - target name
  5241. * @param {Object} options
  5242. * @param {{res}}
  5243. */
  5244. proto.putSymlink = /*#__PURE__*/function () {
  5245. var _putSymlink = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(name, targetName, options) {
  5246. var params, result;
  5247. return _regenerator.default.wrap(function _callee$(_context) {
  5248. while (1) {
  5249. switch (_context.prev = _context.next) {
  5250. case 0:
  5251. options = options || {};
  5252. options.headers = options.headers || {};
  5253. targetName = this._escape(this._objectName(targetName));
  5254. this._convertMetaToHeaders(options.meta, options.headers);
  5255. options.headers['x-oss-symlink-target'] = targetName;
  5256. options.subres = Object.assign({
  5257. symlink: ''
  5258. }, options.subres);
  5259. if (options.versionId) {
  5260. options.subres.versionId = options.versionId;
  5261. }
  5262. if (options.storageClass) {
  5263. options.headers['x-oss-storage-class'] = options.storageClass;
  5264. }
  5265. name = this._objectName(name);
  5266. params = this._objectRequestParams('PUT', name, options);
  5267. params.successStatuses = [200];
  5268. _context.next = 13;
  5269. return this.request(params);
  5270. case 13:
  5271. result = _context.sent;
  5272. return _context.abrupt("return", {
  5273. res: result.res
  5274. });
  5275. case 15:
  5276. case "end":
  5277. return _context.stop();
  5278. }
  5279. }
  5280. }, _callee, this);
  5281. }));
  5282. function putSymlink(_x, _x2, _x3) {
  5283. return _putSymlink.apply(this, arguments);
  5284. }
  5285. return putSymlink;
  5286. }();
  5287. },{"@babel/runtime/helpers/asyncToGenerator":73,"@babel/runtime/helpers/interopRequireDefault":74,"@babel/runtime/regenerator":76,"core-js/modules/es.object.assign.js":255}],47:[function(require,module,exports){
  5288. "use strict";
  5289. require("core-js/modules/es.object.assign.js");
  5290. var urlutil = require('url');
  5291. var utility = require('utility');
  5292. var copy = require('copy-to');
  5293. var signHelper = require('../../common/signUtils');
  5294. var _require = require('../utils/isIP'),
  5295. isIP = _require.isIP;
  5296. var _require2 = require('../../common/utils/isFunction'),
  5297. isFunction = _require2.isFunction;
  5298. var _require3 = require('../utils/setSTSToken'),
  5299. checkCredentials = _require3.checkCredentials;
  5300. var _require4 = require('../utils/formatObjKey'),
  5301. formatObjKey = _require4.formatObjKey;
  5302. var proto = exports;
  5303. proto.signatureUrl = function signatureUrl(name, options) {
  5304. var _this = this;
  5305. if (isIP(this.options.endpoint.hostname)) {
  5306. throw new Error('can not get the object URL when endpoint is IP');
  5307. }
  5308. options = options || {};
  5309. name = this._objectName(name);
  5310. options.method = options.method || 'GET';
  5311. var expires = utility.timestamp() + (options.expires || 1800);
  5312. var params = {
  5313. bucket: this.options.bucket,
  5314. object: name
  5315. };
  5316. var resource = this._getResource(params);
  5317. if (this.options.stsToken && isFunction(this.options.refreshSTSToken)) {
  5318. var now = new Date();
  5319. if (this.stsTokenFreshTime >= this.options.refreshSTSTokenInterval) {
  5320. this.stsTokenFreshTime = now;
  5321. this.options.refreshSTSToken().then(function (r) {
  5322. var credentials = formatObjKey(r, 'firstLowerCase');
  5323. if (credentials.securityToken) {
  5324. credentials.stsToken = credentials.securityToken;
  5325. }
  5326. checkCredentials(credentials);
  5327. Object.assign(_this.options, credentials);
  5328. });
  5329. } else {
  5330. this.stsTokenFreshTime = now;
  5331. }
  5332. }
  5333. if (this.options.stsToken) {
  5334. options['security-token'] = this.options.stsToken;
  5335. }
  5336. var signRes = signHelper._signatureForURL(this.options.accessKeySecret, options, resource, expires);
  5337. var url = urlutil.parse(this._getReqUrl(params));
  5338. url.query = {
  5339. OSSAccessKeyId: this.options.accessKeyId,
  5340. Expires: expires,
  5341. Signature: signRes.Signature
  5342. };
  5343. copy(signRes.subResource).to(url.query);
  5344. return url.format();
  5345. };
  5346. },{"../../common/signUtils":49,"../../common/utils/isFunction":65,"../utils/formatObjKey":59,"../utils/isIP":66,"../utils/setSTSToken":72,"copy-to":88,"core-js/modules/es.object.assign.js":255,"url":404,"utility":406}],48:[function(require,module,exports){
  5347. "use strict";
  5348. var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
  5349. var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
  5350. require("core-js/modules/es.array.iterator.js");
  5351. require("core-js/modules/es.object.to-string.js");
  5352. require("core-js/modules/es.promise.js");
  5353. require("core-js/modules/es.string.iterator.js");
  5354. require("core-js/modules/web.dom-collections.iterator.js");
  5355. require("core-js/modules/web.dom-collections.for-each.js");
  5356. require("core-js/modules/es.function.name.js");
  5357. var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
  5358. var _require = require('./utils/isArray'),
  5359. isArray = _require.isArray;
  5360. var proto = exports;
  5361. proto._parallelNode = /*#__PURE__*/function () {
  5362. var _parallelNode2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(todo, parallel, fn, sourceData) {
  5363. var that, jobErr, jobs, tempBatch, remainder, batch, taskIndex, i;
  5364. return _regenerator.default.wrap(function _callee$(_context) {
  5365. while (1) {
  5366. switch (_context.prev = _context.next) {
  5367. case 0:
  5368. that = this; // upload in parallel
  5369. jobErr = [];
  5370. jobs = [];
  5371. tempBatch = todo.length / parallel;
  5372. remainder = todo.length % parallel;
  5373. batch = remainder === 0 ? tempBatch : (todo.length - remainder) / parallel + 1;
  5374. taskIndex = 1;
  5375. i = 0;
  5376. case 8:
  5377. if (!(i < todo.length)) {
  5378. _context.next = 26;
  5379. break;
  5380. }
  5381. if (!that.isCancel()) {
  5382. _context.next = 11;
  5383. break;
  5384. }
  5385. return _context.abrupt("break", 26);
  5386. case 11:
  5387. if (sourceData) {
  5388. jobs.push(fn(that, todo[i], sourceData));
  5389. } else {
  5390. jobs.push(fn(that, todo[i]));
  5391. }
  5392. if (!(jobs.length === parallel || taskIndex === batch && i === todo.length - 1)) {
  5393. _context.next = 23;
  5394. break;
  5395. }
  5396. _context.prev = 13;
  5397. taskIndex += 1;
  5398. /* eslint no-await-in-loop: [0] */
  5399. _context.next = 17;
  5400. return Promise.all(jobs);
  5401. case 17:
  5402. _context.next = 22;
  5403. break;
  5404. case 19:
  5405. _context.prev = 19;
  5406. _context.t0 = _context["catch"](13);
  5407. jobErr.push(_context.t0);
  5408. case 22:
  5409. jobs = [];
  5410. case 23:
  5411. i++;
  5412. _context.next = 8;
  5413. break;
  5414. case 26:
  5415. return _context.abrupt("return", jobErr);
  5416. case 27:
  5417. case "end":
  5418. return _context.stop();
  5419. }
  5420. }
  5421. }, _callee, this, [[13, 19]]);
  5422. }));
  5423. function _parallelNode(_x, _x2, _x3, _x4) {
  5424. return _parallelNode2.apply(this, arguments);
  5425. }
  5426. return _parallelNode;
  5427. }();
  5428. proto._parallel = function _parallel(todo, parallel, jobPromise) {
  5429. var that = this;
  5430. return new Promise(function (resolve) {
  5431. var _jobErr = [];
  5432. if (parallel <= 0 || !todo) {
  5433. resolve(_jobErr);
  5434. return;
  5435. }
  5436. function onlyOnce(fn) {
  5437. return function () {
  5438. if (fn === null) throw new Error('Callback was already called.');
  5439. var callFn = fn;
  5440. fn = null;
  5441. for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
  5442. args[_key] = arguments[_key];
  5443. }
  5444. callFn.apply(this, args);
  5445. };
  5446. }
  5447. function createArrayIterator(coll) {
  5448. var i = -1;
  5449. var len = coll.length;
  5450. return function next() {
  5451. return ++i < len && !that.isCancel() ? {
  5452. value: coll[i],
  5453. key: i
  5454. } : null;
  5455. };
  5456. }
  5457. var nextElem = createArrayIterator(todo);
  5458. var done = false;
  5459. var running = 0;
  5460. var looping = false;
  5461. function iterateeCallback(err, value) {
  5462. running -= 1;
  5463. if (err) {
  5464. done = true;
  5465. _jobErr.push(err);
  5466. resolve(_jobErr);
  5467. } else if (value === {} || done && running <= 0) {
  5468. done = true;
  5469. resolve(_jobErr);
  5470. } else if (!looping) {
  5471. /* eslint no-use-before-define: [0] */
  5472. if (that.isCancel()) {
  5473. resolve(_jobErr);
  5474. } else {
  5475. replenish();
  5476. }
  5477. }
  5478. }
  5479. function iteratee(value, callback) {
  5480. jobPromise(value).then(function (result) {
  5481. callback(null, result);
  5482. }).catch(function (err) {
  5483. callback(err);
  5484. });
  5485. }
  5486. function replenish() {
  5487. looping = true;
  5488. while (running < parallel && !done && !that.isCancel()) {
  5489. var elem = nextElem();
  5490. if (elem === null || _jobErr.length > 0) {
  5491. done = true;
  5492. if (running <= 0) {
  5493. resolve(_jobErr);
  5494. }
  5495. return;
  5496. }
  5497. running += 1;
  5498. iteratee(elem.value, onlyOnce(iterateeCallback));
  5499. }
  5500. looping = false;
  5501. }
  5502. replenish();
  5503. });
  5504. };
  5505. /**
  5506. * cancel operation, now can use with multipartUpload
  5507. * @param {Object} abort
  5508. * {String} anort.name object key
  5509. * {String} anort.uploadId upload id
  5510. * {String} anort.options timeout
  5511. */
  5512. proto.cancel = function cancel(abort) {
  5513. this.options.cancelFlag = true;
  5514. if (isArray(this.multipartUploadStreams)) {
  5515. this.multipartUploadStreams.forEach(function (_) {
  5516. if (_.destroyed === false) {
  5517. var err = {
  5518. name: 'cancel',
  5519. message: 'cancel'
  5520. };
  5521. _.destroy(err);
  5522. }
  5523. });
  5524. }
  5525. this.multipartUploadStreams = [];
  5526. if (abort) {
  5527. this.abortMultipartUpload(abort.name, abort.uploadId, abort.options);
  5528. }
  5529. };
  5530. proto.isCancel = function isCancel() {
  5531. return this.options.cancelFlag;
  5532. };
  5533. proto.resetCancelFlag = function resetCancelFlag() {
  5534. this.options.cancelFlag = false;
  5535. };
  5536. proto._stop = function _stop() {
  5537. this.options.cancelFlag = true;
  5538. }; // cancel is not error , so create an object
  5539. proto._makeCancelEvent = function _makeCancelEvent() {
  5540. var cancelEvent = {
  5541. status: 0,
  5542. name: 'cancel'
  5543. };
  5544. return cancelEvent;
  5545. }; // abort is not error , so create an object
  5546. proto._makeAbortEvent = function _makeAbortEvent() {
  5547. var abortEvent = {
  5548. status: 0,
  5549. name: 'abort',
  5550. message: 'upload task has been abort'
  5551. };
  5552. return abortEvent;
  5553. };
  5554. },{"./utils/isArray":61,"@babel/runtime/helpers/asyncToGenerator":73,"@babel/runtime/helpers/interopRequireDefault":74,"@babel/runtime/regenerator":76,"core-js/modules/es.array.iterator.js":247,"core-js/modules/es.function.name.js":253,"core-js/modules/es.object.to-string.js":258,"core-js/modules/es.promise.js":259,"core-js/modules/es.string.iterator.js":264,"core-js/modules/web.dom-collections.for-each.js":296,"core-js/modules/web.dom-collections.iterator.js":297}],49:[function(require,module,exports){
  5555. (function (Buffer){(function (){
  5556. "use strict";
  5557. require("core-js/modules/es.string.trim.js");
  5558. require("core-js/modules/es.array.sort.js");
  5559. require("core-js/modules/es.array.join.js");
  5560. require("core-js/modules/web.dom-collections.for-each.js");
  5561. require("core-js/modules/es.object.keys.js");
  5562. require("core-js/modules/es.array.concat.js");
  5563. require("core-js/modules/es.object.to-string.js");
  5564. require("core-js/modules/es.regexp.to-string.js");
  5565. var crypto = require('./../../shims/crypto/crypto.js');
  5566. var is = require('is-type-of');
  5567. var _require = require('./utils/lowercaseKeyHeader'),
  5568. lowercaseKeyHeader = _require.lowercaseKeyHeader;
  5569. /**
  5570. *
  5571. * @param {String} resourcePath
  5572. * @param {Object} parameters
  5573. * @return
  5574. */
  5575. exports.buildCanonicalizedResource = function buildCanonicalizedResource(resourcePath, parameters) {
  5576. var canonicalizedResource = "".concat(resourcePath);
  5577. var separatorString = '?';
  5578. if (is.string(parameters) && parameters.trim() !== '') {
  5579. canonicalizedResource += separatorString + parameters;
  5580. } else if (is.array(parameters)) {
  5581. parameters.sort();
  5582. canonicalizedResource += separatorString + parameters.join('&');
  5583. } else if (parameters) {
  5584. var compareFunc = function compareFunc(entry1, entry2) {
  5585. if (entry1[0] > entry2[0]) {
  5586. return 1;
  5587. } else if (entry1[0] < entry2[0]) {
  5588. return -1;
  5589. }
  5590. return 0;
  5591. };
  5592. var processFunc = function processFunc(key) {
  5593. canonicalizedResource += separatorString + key;
  5594. if (parameters[key] || parameters[key] === 0) {
  5595. canonicalizedResource += "=".concat(parameters[key]);
  5596. }
  5597. separatorString = '&';
  5598. };
  5599. Object.keys(parameters).sort(compareFunc).forEach(processFunc);
  5600. }
  5601. return canonicalizedResource;
  5602. };
  5603. /**
  5604. * @param {String} method
  5605. * @param {String} resourcePath
  5606. * @param {Object} request
  5607. * @param {String} expires
  5608. * @return {String} canonicalString
  5609. */
  5610. exports.buildCanonicalString = function canonicalString(method, resourcePath, request, expires) {
  5611. request = request || {};
  5612. var headers = lowercaseKeyHeader(request.headers);
  5613. var OSS_PREFIX = 'x-oss-';
  5614. var ossHeaders = [];
  5615. var headersToSign = {};
  5616. var signContent = [method.toUpperCase(), headers['content-md5'] || '', headers['content-type'], expires || headers['x-oss-date']];
  5617. Object.keys(headers).forEach(function (key) {
  5618. var lowerKey = key.toLowerCase();
  5619. if (lowerKey.indexOf(OSS_PREFIX) === 0) {
  5620. headersToSign[lowerKey] = String(headers[key]).trim();
  5621. }
  5622. });
  5623. Object.keys(headersToSign).sort().forEach(function (key) {
  5624. ossHeaders.push("".concat(key, ":").concat(headersToSign[key]));
  5625. });
  5626. signContent = signContent.concat(ossHeaders);
  5627. signContent.push(this.buildCanonicalizedResource(resourcePath, request.parameters));
  5628. return signContent.join('\n');
  5629. };
  5630. /**
  5631. * @param {String} accessKeySecret
  5632. * @param {String} canonicalString
  5633. */
  5634. exports.computeSignature = function computeSignature(accessKeySecret, canonicalString) {
  5635. var headerEncoding = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'utf-8';
  5636. var signature = crypto.createHmac('sha1', accessKeySecret);
  5637. return signature.update(Buffer.from(canonicalString, headerEncoding)).digest('base64');
  5638. };
  5639. /**
  5640. * @param {String} accessKeyId
  5641. * @param {String} accessKeySecret
  5642. * @param {String} canonicalString
  5643. */
  5644. exports.authorization = function authorization(accessKeyId, accessKeySecret, canonicalString, headerEncoding) {
  5645. return "OSS ".concat(accessKeyId, ":").concat(this.computeSignature(accessKeySecret, canonicalString, headerEncoding));
  5646. };
  5647. /**
  5648. *
  5649. * @param {String} accessKeySecret
  5650. * @param {Object} options
  5651. * @param {String} resource
  5652. * @param {Number} expires
  5653. */
  5654. exports._signatureForURL = function _signatureForURL(accessKeySecret) {
  5655. var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  5656. var resource = arguments.length > 2 ? arguments[2] : undefined;
  5657. var expires = arguments.length > 3 ? arguments[3] : undefined;
  5658. var headerEncoding = arguments.length > 4 ? arguments[4] : undefined;
  5659. var headers = {};
  5660. var _options$subResource = options.subResource,
  5661. subResource = _options$subResource === void 0 ? {} : _options$subResource;
  5662. if (options.process) {
  5663. var processKeyword = 'x-oss-process';
  5664. subResource[processKeyword] = options.process;
  5665. }
  5666. if (options.trafficLimit) {
  5667. var trafficLimitKey = 'x-oss-traffic-limit';
  5668. subResource[trafficLimitKey] = options.trafficLimit;
  5669. }
  5670. if (options.response) {
  5671. Object.keys(options.response).forEach(function (k) {
  5672. var key = "response-".concat(k.toLowerCase());
  5673. subResource[key] = options.response[k];
  5674. });
  5675. }
  5676. Object.keys(options).forEach(function (key) {
  5677. var lowerKey = key.toLowerCase();
  5678. var value = options[key];
  5679. if (lowerKey.indexOf('x-oss-') === 0) {
  5680. headers[lowerKey] = value;
  5681. } else if (lowerKey.indexOf('content-md5') === 0) {
  5682. headers[key] = value;
  5683. } else if (lowerKey.indexOf('content-type') === 0) {
  5684. headers[key] = value;
  5685. }
  5686. });
  5687. if (Object.prototype.hasOwnProperty.call(options, 'security-token')) {
  5688. subResource['security-token'] = options['security-token'];
  5689. }
  5690. if (Object.prototype.hasOwnProperty.call(options, 'callback')) {
  5691. var json = {
  5692. callbackUrl: encodeURI(options.callback.url),
  5693. callbackBody: options.callback.body
  5694. };
  5695. if (options.callback.host) {
  5696. json.callbackHost = options.callback.host;
  5697. }
  5698. if (options.callback.contentType) {
  5699. json.callbackBodyType = options.callback.contentType;
  5700. }
  5701. subResource.callback = Buffer.from(JSON.stringify(json)).toString('base64');
  5702. if (options.callback.customValue) {
  5703. var callbackVar = {};
  5704. Object.keys(options.callback.customValue).forEach(function (key) {
  5705. callbackVar["x:".concat(key)] = options.callback.customValue[key];
  5706. });
  5707. subResource['callback-var'] = Buffer.from(JSON.stringify(callbackVar)).toString('base64');
  5708. }
  5709. }
  5710. var canonicalString = this.buildCanonicalString(options.method, resource, {
  5711. headers: headers,
  5712. parameters: subResource
  5713. }, expires.toString());
  5714. return {
  5715. Signature: this.computeSignature(accessKeySecret, canonicalString, headerEncoding),
  5716. subResource: subResource
  5717. };
  5718. };
  5719. }).call(this)}).call(this,require("buffer").Buffer)
  5720. },{"./../../shims/crypto/crypto.js":393,"./utils/lowercaseKeyHeader":68,"buffer":85,"core-js/modules/es.array.concat.js":241,"core-js/modules/es.array.join.js":248,"core-js/modules/es.array.sort.js":251,"core-js/modules/es.object.keys.js":257,"core-js/modules/es.object.to-string.js":258,"core-js/modules/es.regexp.to-string.js":262,"core-js/modules/es.string.trim.js":269,"core-js/modules/web.dom-collections.for-each.js":296,"is-type-of":398}],50:[function(require,module,exports){
  5721. "use strict";
  5722. Object.defineProperty(exports, "__esModule", {
  5723. value: true
  5724. });
  5725. exports.checkBucketName = void 0;
  5726. exports.checkBucketName = function (name) {
  5727. var createBucket = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  5728. var bucketRegex = createBucket ? /^[a-z0-9][a-z0-9-]{1,61}[a-z0-9]$/ : /^[a-z0-9_][a-z0-9-_]{1,61}[a-z0-9_]$/;
  5729. if (!bucketRegex.test(name)) {
  5730. throw new Error('The bucket must be conform to the specifications');
  5731. }
  5732. };
  5733. },{}],51:[function(require,module,exports){
  5734. "use strict";
  5735. Object.defineProperty(exports, "__esModule", {
  5736. value: true
  5737. });
  5738. exports.checkConfigValid = void 0;
  5739. var checkConfigMap = {
  5740. endpoint: checkEndpoint,
  5741. region: /^[a-zA-Z0-9\-_]+$/
  5742. };
  5743. function checkEndpoint(endpoint) {
  5744. if (typeof endpoint === 'string') {
  5745. return /^[a-zA-Z0-9._:/-]+$/.test(endpoint);
  5746. } else if (endpoint.host) {
  5747. return /^[a-zA-Z0-9._:/-]+$/.test(endpoint.host);
  5748. }
  5749. return false;
  5750. }
  5751. exports.checkConfigValid = function (conf, key) {
  5752. if (checkConfigMap[key]) {
  5753. var isConfigValid = true;
  5754. if (checkConfigMap[key] instanceof Function) {
  5755. isConfigValid = checkConfigMap[key](conf);
  5756. } else {
  5757. isConfigValid = checkConfigMap[key].test(conf);
  5758. }
  5759. if (!isConfigValid) {
  5760. throw new Error("The ".concat(key, " must be conform to the specifications"));
  5761. }
  5762. }
  5763. };
  5764. },{}],52:[function(require,module,exports){
  5765. "use strict";
  5766. require("core-js/modules/es.array.concat.js");
  5767. require("core-js/modules/es.object.entries.js");
  5768. require("core-js/modules/web.dom-collections.for-each.js");
  5769. Object.defineProperty(exports, "__esModule", {
  5770. value: true
  5771. });
  5772. exports.checkObjectTag = void 0;
  5773. var _require = require('./checkValid'),
  5774. checkValid = _require.checkValid;
  5775. var _require2 = require('./isObject'),
  5776. isObject = _require2.isObject;
  5777. var commonRules = [{
  5778. validator: function validator(value) {
  5779. if (typeof value !== 'string') {
  5780. throw new Error('the key and value of the tag must be String');
  5781. }
  5782. }
  5783. }, {
  5784. pattern: /^[a-zA-Z0-9 +-=._:/]+$/,
  5785. msg: 'tag can contain letters, numbers, spaces, and the following symbols: plus sign (+), hyphen (-), equal sign (=), period (.), underscore (_), colon (:), and forward slash (/)'
  5786. }];
  5787. var rules = {
  5788. key: [].concat(commonRules, [{
  5789. pattern: /^.{1,128}$/,
  5790. msg: 'tag key can be a maximum of 128 bytes in length'
  5791. }]),
  5792. value: [].concat(commonRules, [{
  5793. pattern: /^.{0,256}$/,
  5794. msg: 'tag value can be a maximum of 256 bytes in length'
  5795. }])
  5796. };
  5797. function checkObjectTag(tag) {
  5798. if (!isObject(tag)) {
  5799. throw new Error('tag must be Object');
  5800. }
  5801. var entries = Object.entries(tag);
  5802. if (entries.length > 10) {
  5803. throw new Error('maximum of 10 tags for a object');
  5804. }
  5805. var rulesIndexKey = ['key', 'value'];
  5806. entries.forEach(function (keyValue) {
  5807. keyValue.forEach(function (item, index) {
  5808. checkValid(item, rules[rulesIndexKey[index]]);
  5809. });
  5810. });
  5811. }
  5812. exports.checkObjectTag = checkObjectTag;
  5813. },{"./checkValid":53,"./isObject":67,"core-js/modules/es.array.concat.js":241,"core-js/modules/es.object.entries.js":256,"core-js/modules/web.dom-collections.for-each.js":296}],53:[function(require,module,exports){
  5814. "use strict";
  5815. require("core-js/modules/web.dom-collections.for-each.js");
  5816. Object.defineProperty(exports, "__esModule", {
  5817. value: true
  5818. });
  5819. exports.checkValid = void 0;
  5820. function checkValid(_value, _rules) {
  5821. _rules.forEach(function (rule) {
  5822. if (rule.validator) {
  5823. rule.validator(_value);
  5824. } else if (rule.pattern && !rule.pattern.test(_value)) {
  5825. throw new Error(rule.msg);
  5826. }
  5827. });
  5828. }
  5829. exports.checkValid = checkValid;
  5830. },{"core-js/modules/web.dom-collections.for-each.js":296}],54:[function(require,module,exports){
  5831. (function (Buffer){(function (){
  5832. "use strict";
  5833. require("core-js/modules/es.array.includes.js");
  5834. require("core-js/modules/es.string.includes.js");
  5835. require("core-js/modules/es.object.assign.js");
  5836. require("core-js/modules/es.array.concat.js");
  5837. Object.defineProperty(exports, "__esModule", {
  5838. value: true
  5839. });
  5840. exports.createRequest = void 0;
  5841. var crypto = require('./../../../shims/crypto/crypto.js');
  5842. var debug = require('debug')('ali-oss');
  5843. var mime = require('mime');
  5844. var dateFormat = require('dateformat');
  5845. var copy = require('copy-to');
  5846. var path = require('path');
  5847. var _require = require('./encoder'),
  5848. encoder = _require.encoder;
  5849. var _require2 = require('./isIP'),
  5850. isIP = _require2.isIP;
  5851. var _require3 = require('./setRegion'),
  5852. setRegion = _require3.setRegion;
  5853. var _require4 = require('../client/getReqUrl'),
  5854. getReqUrl = _require4.getReqUrl;
  5855. function getHeader(headers, name) {
  5856. return headers[name] || headers[name.toLowerCase()];
  5857. }
  5858. function delHeader(headers, name) {
  5859. delete headers[name];
  5860. delete headers[name.toLowerCase()];
  5861. }
  5862. function createRequest(params) {
  5863. var date = new Date();
  5864. if (this.options.amendTimeSkewed) {
  5865. date = +new Date() + this.options.amendTimeSkewed;
  5866. }
  5867. var headers = {
  5868. 'x-oss-date': dateFormat(date, 'UTC:ddd, dd mmm yyyy HH:MM:ss \'GMT\'')
  5869. };
  5870. if (typeof window !== 'undefined') {
  5871. headers['x-oss-user-agent'] = this.userAgent;
  5872. }
  5873. if (this.userAgent.includes('nodejs')) {
  5874. headers['User-Agent'] = this.userAgent;
  5875. }
  5876. if (this.options.isRequestPay) {
  5877. Object.assign(headers, {
  5878. 'x-oss-request-payer': 'requester'
  5879. });
  5880. }
  5881. if (this.options.stsToken) {
  5882. headers['x-oss-security-token'] = this.options.stsToken;
  5883. }
  5884. copy(params.headers).to(headers);
  5885. if (!getHeader(headers, 'Content-Type')) {
  5886. if (params.mime && params.mime.indexOf('/') > 0) {
  5887. headers['Content-Type'] = params.mime;
  5888. } else {
  5889. headers['Content-Type'] = mime.getType(params.mime || path.extname(params.object || ''));
  5890. }
  5891. }
  5892. if (!getHeader(headers, 'Content-Type')) {
  5893. delHeader(headers, 'Content-Type');
  5894. }
  5895. if (params.content) {
  5896. if (!params.disabledMD5) {
  5897. headers['Content-MD5'] = crypto.createHash('md5').update(Buffer.from(params.content, 'utf8')).digest('base64');
  5898. }
  5899. if (!headers['Content-Length']) {
  5900. headers['Content-Length'] = params.content.length;
  5901. }
  5902. }
  5903. var hasOwnProperty = Object.prototype.hasOwnProperty;
  5904. for (var k in headers) {
  5905. if (headers[k] && hasOwnProperty.call(headers, k)) {
  5906. headers[k] = encoder(String(headers[k]), this.options.headerEncoding);
  5907. }
  5908. }
  5909. var authResource = this._getResource(params);
  5910. headers.authorization = this.authorization(params.method, authResource, params.subres, headers, this.options.headerEncoding); // const url = this._getReqUrl(params);
  5911. if (isIP(this.options.endpoint.hostname)) {
  5912. var _this$options = this.options,
  5913. region = _this$options.region,
  5914. internal = _this$options.internal,
  5915. secure = _this$options.secure;
  5916. var hostInfo = setRegion(region, internal, secure);
  5917. headers.host = "".concat(params.bucket, ".").concat(hostInfo.host);
  5918. }
  5919. var url = getReqUrl.bind(this)(params);
  5920. debug('request %s %s, with headers %j, !!stream: %s', params.method, url, headers, !!params.stream);
  5921. var timeout = params.timeout || this.options.timeout;
  5922. var reqParams = {
  5923. method: params.method,
  5924. content: params.content,
  5925. stream: params.stream,
  5926. headers: headers,
  5927. timeout: timeout,
  5928. writeStream: params.writeStream,
  5929. customResponse: params.customResponse,
  5930. ctx: params.ctx || this.ctx
  5931. };
  5932. if (this.agent) {
  5933. reqParams.agent = this.agent;
  5934. }
  5935. if (this.httpsAgent) {
  5936. reqParams.httpsAgent = this.httpsAgent;
  5937. }
  5938. reqParams.enableProxy = !!this.options.enableProxy;
  5939. reqParams.proxy = this.options.proxy ? this.options.proxy : null;
  5940. return {
  5941. url: url,
  5942. params: reqParams
  5943. };
  5944. }
  5945. exports.createRequest = createRequest;
  5946. }).call(this)}).call(this,require("buffer").Buffer)
  5947. },{"../client/getReqUrl":25,"./../../../shims/crypto/crypto.js":393,"./encoder":57,"./isIP":66,"./setRegion":71,"buffer":85,"copy-to":88,"core-js/modules/es.array.concat.js":241,"core-js/modules/es.array.includes.js":246,"core-js/modules/es.object.assign.js":255,"core-js/modules/es.string.includes.js":263,"dateformat":299,"debug":397,"mime":317,"path":321}],55:[function(require,module,exports){
  5948. "use strict";
  5949. require("core-js/modules/web.dom-collections.for-each.js");
  5950. require("core-js/modules/es.object.entries.js");
  5951. require("core-js/modules/es.regexp.exec.js");
  5952. require("core-js/modules/es.string.replace.js");
  5953. require("core-js/modules/es.array.includes.js");
  5954. require("core-js/modules/es.object.keys.js");
  5955. Object.defineProperty(exports, "__esModule", {
  5956. value: true
  5957. });
  5958. exports.dataFix = void 0;
  5959. var isObject_1 = require("./isObject");
  5960. var TRUE = ['true', 'TRUE', '1', 1];
  5961. var FALSE = ['false', 'FALSE', '0', 0];
  5962. function dataFix(o, conf, finalKill) {
  5963. if (!isObject_1.isObject(o)) return;
  5964. var _conf$remove = conf.remove,
  5965. remove = _conf$remove === void 0 ? [] : _conf$remove,
  5966. _conf$rename = conf.rename,
  5967. rename = _conf$rename === void 0 ? {} : _conf$rename,
  5968. _conf$camel = conf.camel,
  5969. camel = _conf$camel === void 0 ? [] : _conf$camel,
  5970. _conf$bool = conf.bool,
  5971. bool = _conf$bool === void 0 ? [] : _conf$bool,
  5972. _conf$lowerFirst = conf.lowerFirst,
  5973. lowerFirst = _conf$lowerFirst === void 0 ? false : _conf$lowerFirst; // 删除不需要的数据
  5974. remove.forEach(function (v) {
  5975. return delete o[v];
  5976. }); // 重命名
  5977. Object.entries(rename).forEach(function (v) {
  5978. if (!o[v[0]]) return;
  5979. if (o[v[1]]) return;
  5980. o[v[1]] = o[v[0]];
  5981. delete o[v[0]];
  5982. }); // 驼峰化
  5983. camel.forEach(function (v) {
  5984. if (!o[v]) return;
  5985. var afterKey = v.replace(/^(.)/, function ($0) {
  5986. return $0.toLowerCase();
  5987. }).replace(/-(\w)/g, function (_, $1) {
  5988. return $1.toUpperCase();
  5989. });
  5990. if (o[afterKey]) return;
  5991. o[afterKey] = o[v]; // todo 暂时兼容以前数据,不做删除
  5992. // delete o[v];
  5993. }); // 转换值为布尔值
  5994. bool.forEach(function (v) {
  5995. o[v] = fixBool(o[v]);
  5996. }); // finalKill
  5997. if (typeof finalKill === 'function') {
  5998. finalKill(o);
  5999. } // 首字母转小写
  6000. fixLowerFirst(o, lowerFirst);
  6001. return dataFix;
  6002. }
  6003. exports.dataFix = dataFix;
  6004. function fixBool(value) {
  6005. if (!value) return false;
  6006. if (TRUE.includes(value)) return true;
  6007. return FALSE.includes(value) ? false : value;
  6008. }
  6009. function fixLowerFirst(o, lowerFirst) {
  6010. if (lowerFirst) {
  6011. Object.keys(o).forEach(function (key) {
  6012. var lowerK = key.replace(/^\w/, function (match) {
  6013. return match.toLowerCase();
  6014. });
  6015. if (typeof o[lowerK] === 'undefined') {
  6016. o[lowerK] = o[key];
  6017. delete o[key];
  6018. }
  6019. });
  6020. }
  6021. }
  6022. },{"./isObject":67,"core-js/modules/es.array.includes.js":246,"core-js/modules/es.object.entries.js":256,"core-js/modules/es.object.keys.js":257,"core-js/modules/es.regexp.exec.js":261,"core-js/modules/es.string.replace.js":266,"core-js/modules/web.dom-collections.for-each.js":296}],56:[function(require,module,exports){
  6023. "use strict";
  6024. var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
  6025. require("core-js/modules/es.array.slice.js");
  6026. require("core-js/modules/web.dom-collections.for-each.js");
  6027. require("core-js/modules/es.object.keys.js");
  6028. var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
  6029. Object.defineProperty(exports, "__esModule", {
  6030. value: true
  6031. });
  6032. exports.deepCopyWith = exports.deepCopy = void 0;
  6033. var isBuffer_1 = require("./isBuffer");
  6034. exports.deepCopy = function (obj) {
  6035. if (obj === null || (0, _typeof2.default)(obj) !== 'object') {
  6036. return obj;
  6037. }
  6038. if (isBuffer_1.isBuffer(obj)) {
  6039. return obj.slice();
  6040. }
  6041. var copy = Array.isArray(obj) ? [] : {};
  6042. Object.keys(obj).forEach(function (key) {
  6043. copy[key] = exports.deepCopy(obj[key]);
  6044. });
  6045. return copy;
  6046. };
  6047. exports.deepCopyWith = function (obj, customizer) {
  6048. function deepCopyWithHelper(value, innerKey, innerObject) {
  6049. var result = customizer(value, innerKey, innerObject);
  6050. if (result !== undefined) return result;
  6051. if (value === null || (0, _typeof2.default)(value) !== 'object') {
  6052. return value;
  6053. }
  6054. if (isBuffer_1.isBuffer(value)) {
  6055. return value.slice();
  6056. }
  6057. var copy = Array.isArray(value) ? [] : {};
  6058. Object.keys(value).forEach(function (k) {
  6059. copy[k] = deepCopyWithHelper(value[k], k, value);
  6060. });
  6061. return copy;
  6062. }
  6063. if (customizer) {
  6064. return deepCopyWithHelper(obj, '', null);
  6065. } else {
  6066. return exports.deepCopy(obj);
  6067. }
  6068. };
  6069. },{"./isBuffer":63,"@babel/runtime/helpers/interopRequireDefault":74,"@babel/runtime/helpers/typeof":75,"core-js/modules/es.array.slice.js":250,"core-js/modules/es.object.keys.js":257,"core-js/modules/web.dom-collections.for-each.js":296}],57:[function(require,module,exports){
  6070. (function (Buffer){(function (){
  6071. "use strict";
  6072. require("core-js/modules/es.object.to-string.js");
  6073. require("core-js/modules/es.regexp.to-string.js");
  6074. Object.defineProperty(exports, "__esModule", {
  6075. value: true
  6076. });
  6077. exports.encoder = void 0;
  6078. function encoder(str) {
  6079. var encoding = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'utf-8';
  6080. if (encoding === 'utf-8') return str;
  6081. return Buffer.from(str).toString('latin1');
  6082. }
  6083. exports.encoder = encoder;
  6084. }).call(this)}).call(this,require("buffer").Buffer)
  6085. },{"buffer":85,"core-js/modules/es.object.to-string.js":258,"core-js/modules/es.regexp.to-string.js":262}],58:[function(require,module,exports){
  6086. "use strict";
  6087. require("core-js/modules/es.array.map.js");
  6088. require("core-js/modules/es.regexp.exec.js");
  6089. require("core-js/modules/es.string.replace.js");
  6090. Object.defineProperty(exports, "__esModule", {
  6091. value: true
  6092. });
  6093. exports.formatInventoryConfig = void 0;
  6094. var dataFix_1 = require("../utils/dataFix");
  6095. var isObject_1 = require("../utils/isObject");
  6096. var isArray_1 = require("../utils/isArray");
  6097. var formatObjKey_1 = require("../utils/formatObjKey");
  6098. function formatInventoryConfig(inventoryConfig) {
  6099. var toArray = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  6100. if (toArray && isObject_1.isObject(inventoryConfig)) inventoryConfig = [inventoryConfig];
  6101. if (isArray_1.isArray(inventoryConfig)) {
  6102. inventoryConfig = inventoryConfig.map(formatFn);
  6103. } else {
  6104. inventoryConfig = formatFn(inventoryConfig);
  6105. }
  6106. return inventoryConfig;
  6107. }
  6108. exports.formatInventoryConfig = formatInventoryConfig;
  6109. function formatFn(_) {
  6110. dataFix_1.dataFix(_, {
  6111. bool: ['IsEnabled']
  6112. }, function (conf) {
  6113. var _a, _b; // prefix
  6114. conf.prefix = conf.Filter.Prefix;
  6115. delete conf.Filter; // OSSBucketDestination
  6116. conf.OSSBucketDestination = conf.Destination.OSSBucketDestination; // OSSBucketDestination.rolename
  6117. conf.OSSBucketDestination.rolename = conf.OSSBucketDestination.RoleArn.replace(/.*\//, '');
  6118. delete conf.OSSBucketDestination.RoleArn; // OSSBucketDestination.bucket
  6119. conf.OSSBucketDestination.bucket = conf.OSSBucketDestination.Bucket.replace(/.*:::/, '');
  6120. delete conf.OSSBucketDestination.Bucket;
  6121. delete conf.Destination; // frequency
  6122. conf.frequency = conf.Schedule.Frequency;
  6123. delete conf.Schedule.Frequency; // optionalFields
  6124. if (((_a = conf === null || conf === void 0 ? void 0 : conf.OptionalFields) === null || _a === void 0 ? void 0 : _a.Field) && !isArray_1.isArray((_b = conf.OptionalFields) === null || _b === void 0 ? void 0 : _b.Field)) conf.OptionalFields.Field = [conf.OptionalFields.Field];
  6125. }); // firstLowerCase
  6126. _ = formatObjKey_1.formatObjKey(_, 'firstLowerCase', {
  6127. exclude: ['OSSBucketDestination', 'SSE-OSS', 'SSE-KMS']
  6128. });
  6129. return _;
  6130. }
  6131. },{"../utils/dataFix":55,"../utils/formatObjKey":59,"../utils/isArray":61,"../utils/isObject":67,"core-js/modules/es.array.map.js":249,"core-js/modules/es.regexp.exec.js":261,"core-js/modules/es.string.replace.js":266}],59:[function(require,module,exports){
  6132. "use strict";
  6133. var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
  6134. require("core-js/modules/web.dom-collections.for-each.js");
  6135. require("core-js/modules/es.object.keys.js");
  6136. require("core-js/modules/es.array.includes.js");
  6137. require("core-js/modules/es.string.includes.js");
  6138. require("core-js/modules/es.regexp.exec.js");
  6139. require("core-js/modules/es.string.replace.js");
  6140. var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
  6141. Object.defineProperty(exports, "__esModule", {
  6142. value: true
  6143. });
  6144. exports.formatObjKey = void 0;
  6145. function formatObjKey(obj, type, options) {
  6146. if (obj === null || (0, _typeof2.default)(obj) !== 'object') {
  6147. return obj;
  6148. }
  6149. var o;
  6150. if (Array.isArray(obj)) {
  6151. o = [];
  6152. for (var i = 0; i < obj.length; i++) {
  6153. o.push(formatObjKey(obj[i], type, options));
  6154. }
  6155. } else {
  6156. o = {};
  6157. Object.keys(obj).forEach(function (key) {
  6158. o[handelFormat(key, type, options)] = formatObjKey(obj[key], type, options);
  6159. });
  6160. }
  6161. return o;
  6162. }
  6163. exports.formatObjKey = formatObjKey;
  6164. function handelFormat(key, type, options) {
  6165. var _a;
  6166. if (options && ((_a = options.exclude) === null || _a === void 0 ? void 0 : _a.includes(key))) return key;
  6167. if (type === 'firstUpperCase') {
  6168. key = key.replace(/^./, function (_) {
  6169. return _.toUpperCase();
  6170. });
  6171. } else if (type === 'firstLowerCase') {
  6172. key = key.replace(/^./, function (_) {
  6173. return _.toLowerCase();
  6174. });
  6175. }
  6176. return key;
  6177. }
  6178. },{"@babel/runtime/helpers/interopRequireDefault":74,"@babel/runtime/helpers/typeof":75,"core-js/modules/es.array.includes.js":246,"core-js/modules/es.object.keys.js":257,"core-js/modules/es.regexp.exec.js":261,"core-js/modules/es.string.includes.js":263,"core-js/modules/es.string.replace.js":266,"core-js/modules/web.dom-collections.for-each.js":296}],60:[function(require,module,exports){
  6179. "use strict";
  6180. Object.defineProperty(exports, "__esModule", {
  6181. value: true
  6182. });
  6183. exports.getStrBytesCount = void 0;
  6184. function getStrBytesCount(str) {
  6185. var bytesCount = 0;
  6186. for (var i = 0; i < str.length; i++) {
  6187. var c = str.charAt(i);
  6188. if (/^[\u00-\uff]$/.test(c)) {
  6189. bytesCount += 1;
  6190. } else {
  6191. bytesCount += 2;
  6192. }
  6193. }
  6194. return bytesCount;
  6195. }
  6196. exports.getStrBytesCount = getStrBytesCount;
  6197. },{}],61:[function(require,module,exports){
  6198. "use strict";
  6199. require("core-js/modules/es.object.to-string.js");
  6200. Object.defineProperty(exports, "__esModule", {
  6201. value: true
  6202. });
  6203. exports.isArray = void 0;
  6204. exports.isArray = function (obj) {
  6205. return Object.prototype.toString.call(obj) === '[object Array]';
  6206. };
  6207. },{"core-js/modules/es.object.to-string.js":258}],62:[function(require,module,exports){
  6208. "use strict";
  6209. Object.defineProperty(exports, "__esModule", {
  6210. value: true
  6211. });
  6212. exports.isBlob = void 0;
  6213. function isBlob(blob) {
  6214. return typeof Blob !== 'undefined' && blob instanceof Blob;
  6215. }
  6216. exports.isBlob = isBlob;
  6217. },{}],63:[function(require,module,exports){
  6218. (function (Buffer){(function (){
  6219. "use strict";
  6220. Object.defineProperty(exports, "__esModule", {
  6221. value: true
  6222. });
  6223. exports.isBuffer = void 0;
  6224. function isBuffer(obj) {
  6225. return Buffer.isBuffer(obj);
  6226. }
  6227. exports.isBuffer = isBuffer;
  6228. }).call(this)}).call(this,{"isBuffer":require("../../../node_modules/is-buffer/index.js")})
  6229. },{"../../../node_modules/is-buffer/index.js":312}],64:[function(require,module,exports){
  6230. "use strict";
  6231. Object.defineProperty(exports, "__esModule", {
  6232. value: true
  6233. });
  6234. exports.isFile = void 0;
  6235. exports.isFile = function (obj) {
  6236. return typeof File !== 'undefined' && obj instanceof File;
  6237. };
  6238. },{}],65:[function(require,module,exports){
  6239. "use strict";
  6240. Object.defineProperty(exports, "__esModule", {
  6241. value: true
  6242. });
  6243. exports.isFunction = void 0;
  6244. exports.isFunction = function (v) {
  6245. return typeof v === 'function';
  6246. };
  6247. },{}],66:[function(require,module,exports){
  6248. "use strict";
  6249. Object.defineProperty(exports, "__esModule", {
  6250. value: true
  6251. });
  6252. exports.isIP = void 0; // it provide commont methods for node and browser , we will add more solutions later in this file
  6253. /**
  6254. * Judge isIP include ipv4 or ipv6
  6255. * @param {String} options
  6256. * @return {Array} the multipart uploads
  6257. */
  6258. exports.isIP = function (host) {
  6259. var ipv4Regex = /^(25[0-5]|2[0-4]\d|[0-1]?\d?\d)(\.(25[0-5]|2[0-4]\d|[0-1]?\d?\d)){3}$/;
  6260. var ipv6Regex = /^\s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(%.+)?\s*$/;
  6261. return ipv4Regex.test(host) || ipv6Regex.test(host);
  6262. };
  6263. },{}],67:[function(require,module,exports){
  6264. "use strict";
  6265. require("core-js/modules/es.object.to-string.js");
  6266. Object.defineProperty(exports, "__esModule", {
  6267. value: true
  6268. });
  6269. exports.isObject = void 0;
  6270. exports.isObject = function (obj) {
  6271. return Object.prototype.toString.call(obj) === '[object Object]';
  6272. };
  6273. },{"core-js/modules/es.object.to-string.js":258}],68:[function(require,module,exports){
  6274. "use strict";
  6275. require("core-js/modules/web.dom-collections.for-each.js");
  6276. require("core-js/modules/es.object.keys.js");
  6277. Object.defineProperty(exports, "__esModule", {
  6278. value: true
  6279. });
  6280. exports.lowercaseKeyHeader = void 0;
  6281. var isObject_1 = require("./isObject");
  6282. function lowercaseKeyHeader(headers) {
  6283. var lowercaseHeader = {};
  6284. if (isObject_1.isObject(headers)) {
  6285. Object.keys(headers).forEach(function (key) {
  6286. lowercaseHeader[key.toLowerCase()] = headers[key];
  6287. });
  6288. }
  6289. return lowercaseHeader;
  6290. }
  6291. exports.lowercaseKeyHeader = lowercaseKeyHeader;
  6292. },{"./isObject":67,"core-js/modules/es.object.keys.js":257,"core-js/modules/web.dom-collections.for-each.js":296}],69:[function(require,module,exports){
  6293. "use strict";
  6294. require("core-js/modules/es.regexp.exec.js");
  6295. require("core-js/modules/es.string.replace.js");
  6296. require("core-js/modules/es.object.to-string.js");
  6297. require("core-js/modules/web.dom-collections.for-each.js");
  6298. require("core-js/modules/es.object.keys.js");
  6299. require("core-js/modules/es.array.concat.js");
  6300. require("core-js/modules/es.array.join.js");
  6301. require("core-js/modules/es.array.map.js");
  6302. require("core-js/modules/es.regexp.to-string.js");
  6303. Object.defineProperty(exports, "__esModule", {
  6304. value: true
  6305. });
  6306. exports.obj2xml = void 0;
  6307. var formatObjKey_1 = require("./formatObjKey");
  6308. function type(params) {
  6309. return Object.prototype.toString.call(params).replace(/(.*? |])/g, '').toLowerCase();
  6310. }
  6311. function obj2xml(obj, options) {
  6312. var s = '';
  6313. if (options && options.headers) {
  6314. s = '<?xml version="1.0" encoding="UTF-8"?>\n';
  6315. }
  6316. if (options && options.firstUpperCase) {
  6317. obj = formatObjKey_1.formatObjKey(obj, 'firstUpperCase');
  6318. }
  6319. if (type(obj) === 'object') {
  6320. Object.keys(obj).forEach(function (key) {
  6321. // filter undefined or null
  6322. if (type(obj[key]) !== 'undefined' && type(obj[key]) !== 'null') {
  6323. if (type(obj[key]) === 'string' || type(obj[key]) === 'number') {
  6324. s += "<".concat(key, ">").concat(obj[key], "</").concat(key, ">");
  6325. } else if (type(obj[key]) === 'object') {
  6326. s += "<".concat(key, ">").concat(obj2xml(obj[key]), "</").concat(key, ">");
  6327. } else if (type(obj[key]) === 'array') {
  6328. s += obj[key].map(function (keyChild) {
  6329. return "<".concat(key, ">").concat(obj2xml(keyChild), "</").concat(key, ">");
  6330. }).join('');
  6331. } else {
  6332. s += "<".concat(key, ">").concat(obj[key].toString(), "</").concat(key, ">");
  6333. }
  6334. }
  6335. });
  6336. } else {
  6337. s += obj.toString();
  6338. }
  6339. return s;
  6340. }
  6341. exports.obj2xml = obj2xml;
  6342. },{"./formatObjKey":59,"core-js/modules/es.array.concat.js":241,"core-js/modules/es.array.join.js":248,"core-js/modules/es.array.map.js":249,"core-js/modules/es.object.keys.js":257,"core-js/modules/es.object.to-string.js":258,"core-js/modules/es.regexp.exec.js":261,"core-js/modules/es.regexp.to-string.js":262,"core-js/modules/es.string.replace.js":266,"core-js/modules/web.dom-collections.for-each.js":296}],70:[function(require,module,exports){
  6343. "use strict";
  6344. require("core-js/modules/es.object.to-string.js");
  6345. require("core-js/modules/es.promise.js");
  6346. Object.defineProperty(exports, "__esModule", {
  6347. value: true
  6348. });
  6349. exports.retry = void 0;
  6350. function retry(func, retryMax) {
  6351. var config = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  6352. var retryNum = 0;
  6353. var _config$retryDelay = config.retryDelay,
  6354. retryDelay = _config$retryDelay === void 0 ? 500 : _config$retryDelay,
  6355. _config$errorHandler = config.errorHandler,
  6356. errorHandler = _config$errorHandler === void 0 ? function () {
  6357. return true;
  6358. } : _config$errorHandler;
  6359. var funcR = function funcR() {
  6360. for (var _len = arguments.length, arg = new Array(_len), _key = 0; _key < _len; _key++) {
  6361. arg[_key] = arguments[_key];
  6362. }
  6363. return new Promise(function (resolve, reject) {
  6364. func.apply(void 0, arg).then(function (result) {
  6365. retryNum = 0;
  6366. resolve(result);
  6367. }).catch(function (err) {
  6368. if (retryNum < retryMax && errorHandler(err)) {
  6369. retryNum++;
  6370. setTimeout(function () {
  6371. resolve(funcR.apply(void 0, arg));
  6372. }, retryDelay);
  6373. } else {
  6374. retryNum = 0;
  6375. reject(err);
  6376. }
  6377. });
  6378. });
  6379. };
  6380. return funcR;
  6381. }
  6382. exports.retry = retry;
  6383. },{"core-js/modules/es.object.to-string.js":258,"core-js/modules/es.promise.js":259}],71:[function(require,module,exports){
  6384. "use strict";
  6385. var __importDefault = void 0 && (void 0).__importDefault || function (mod) {
  6386. return mod && mod.__esModule ? mod : {
  6387. "default": mod
  6388. };
  6389. };
  6390. Object.defineProperty(exports, "__esModule", {
  6391. value: true
  6392. });
  6393. exports.setRegion = void 0;
  6394. var url_1 = __importDefault(require("url"));
  6395. var checkConfigValid_1 = require("./checkConfigValid");
  6396. function setRegion(region) {
  6397. var internal = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  6398. var secure = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  6399. checkConfigValid_1.checkConfigValid(region, 'region');
  6400. var protocol = secure ? 'https://' : 'http://';
  6401. var suffix = internal ? '-internal.aliyuncs.com' : '.aliyuncs.com';
  6402. var prefix = 'vpc100-oss-cn-'; // aliyun VPC region: https://help.aliyun.com/knowledge_detail/38740.html
  6403. if (region.substr(0, prefix.length) === prefix) {
  6404. suffix = '.aliyuncs.com';
  6405. }
  6406. return url_1.default.parse(protocol + region + suffix);
  6407. }
  6408. exports.setRegion = setRegion;
  6409. },{"./checkConfigValid":51,"url":404}],72:[function(require,module,exports){
  6410. "use strict";
  6411. var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
  6412. var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
  6413. require("core-js/modules/es.object.keys.js");
  6414. require("core-js/modules/es.array.find.js");
  6415. require("core-js/modules/es.object.assign.js");
  6416. var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
  6417. Object.defineProperty(exports, "__esModule", {
  6418. value: true
  6419. });
  6420. exports.checkCredentials = exports.setSTSToken = void 0;
  6421. var formatObjKey_1 = require("./formatObjKey");
  6422. function setSTSToken() {
  6423. return _setSTSToken.apply(this, arguments);
  6424. }
  6425. function _setSTSToken() {
  6426. _setSTSToken = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
  6427. var now, credentials;
  6428. return _regenerator.default.wrap(function _callee$(_context) {
  6429. while (1) {
  6430. switch (_context.prev = _context.next) {
  6431. case 0:
  6432. if (!this.options) this.options = {};
  6433. now = new Date();
  6434. if (!this.stsTokenFreshTime) {
  6435. _context.next = 14;
  6436. break;
  6437. }
  6438. if (!(+now - this.stsTokenFreshTime >= this.options.refreshSTSTokenInterval)) {
  6439. _context.next = 12;
  6440. break;
  6441. }
  6442. this.stsTokenFreshTime = now;
  6443. _context.next = 7;
  6444. return this.options.refreshSTSToken();
  6445. case 7:
  6446. credentials = _context.sent;
  6447. credentials = formatObjKey_1.formatObjKey(credentials, 'firstLowerCase');
  6448. if (credentials.securityToken) {
  6449. credentials.stsToken = credentials.securityToken;
  6450. }
  6451. checkCredentials(credentials);
  6452. Object.assign(this.options, credentials);
  6453. case 12:
  6454. _context.next = 15;
  6455. break;
  6456. case 14:
  6457. this.stsTokenFreshTime = now;
  6458. case 15:
  6459. return _context.abrupt("return", null);
  6460. case 16:
  6461. case "end":
  6462. return _context.stop();
  6463. }
  6464. }
  6465. }, _callee, this);
  6466. }));
  6467. return _setSTSToken.apply(this, arguments);
  6468. }
  6469. exports.setSTSToken = setSTSToken;
  6470. function checkCredentials(obj) {
  6471. var stsTokenKey = ['accessKeySecret', 'accessKeyId', 'stsToken'];
  6472. var objKeys = Object.keys(obj);
  6473. stsTokenKey.forEach(function (_) {
  6474. if (!objKeys.find(function (key) {
  6475. return key === _;
  6476. })) {
  6477. throw Error("refreshSTSToken must return contains ".concat(_));
  6478. }
  6479. });
  6480. }
  6481. exports.checkCredentials = checkCredentials;
  6482. },{"./formatObjKey":59,"@babel/runtime/helpers/asyncToGenerator":73,"@babel/runtime/helpers/interopRequireDefault":74,"@babel/runtime/regenerator":76,"core-js/modules/es.array.find.js":244,"core-js/modules/es.object.assign.js":255,"core-js/modules/es.object.keys.js":257}],73:[function(require,module,exports){
  6483. function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
  6484. try {
  6485. var info = gen[key](arg);
  6486. var value = info.value;
  6487. } catch (error) {
  6488. reject(error);
  6489. return;
  6490. }
  6491. if (info.done) {
  6492. resolve(value);
  6493. } else {
  6494. Promise.resolve(value).then(_next, _throw);
  6495. }
  6496. }
  6497. function _asyncToGenerator(fn) {
  6498. return function () {
  6499. var self = this,
  6500. args = arguments;
  6501. return new Promise(function (resolve, reject) {
  6502. var gen = fn.apply(self, args);
  6503. function _next(value) {
  6504. asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
  6505. }
  6506. function _throw(err) {
  6507. asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
  6508. }
  6509. _next(undefined);
  6510. });
  6511. };
  6512. }
  6513. module.exports = _asyncToGenerator;
  6514. module.exports["default"] = module.exports, module.exports.__esModule = true;
  6515. },{}],74:[function(require,module,exports){
  6516. function _interopRequireDefault(obj) {
  6517. return obj && obj.__esModule ? obj : {
  6518. "default": obj
  6519. };
  6520. }
  6521. module.exports = _interopRequireDefault;
  6522. module.exports["default"] = module.exports, module.exports.__esModule = true;
  6523. },{}],75:[function(require,module,exports){
  6524. function _typeof(obj) {
  6525. "@babel/helpers - typeof";
  6526. if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
  6527. module.exports = _typeof = function _typeof(obj) {
  6528. return typeof obj;
  6529. };
  6530. module.exports["default"] = module.exports, module.exports.__esModule = true;
  6531. } else {
  6532. module.exports = _typeof = function _typeof(obj) {
  6533. return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
  6534. };
  6535. module.exports["default"] = module.exports, module.exports.__esModule = true;
  6536. }
  6537. return _typeof(obj);
  6538. }
  6539. module.exports = _typeof;
  6540. module.exports["default"] = module.exports, module.exports.__esModule = true;
  6541. },{}],76:[function(require,module,exports){
  6542. module.exports = require("regenerator-runtime");
  6543. },{"regenerator-runtime":342}],77:[function(require,module,exports){
  6544. module.exports = noop;
  6545. module.exports.HttpsAgent = noop;
  6546. // Noop function for browser since native api's don't use agents.
  6547. function noop () {}
  6548. },{}],78:[function(require,module,exports){
  6549. (function (global){(function (){
  6550. 'use strict';
  6551. var objectAssign = require('object-assign');
  6552. // compare and isBuffer taken from https://github.com/feross/buffer/blob/680e9e5e488f22aac27599a57dc844a6315928dd/index.js
  6553. // original notice:
  6554. /*!
  6555. * The buffer module from node.js, for the browser.
  6556. *
  6557. * @author Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
  6558. * @license MIT
  6559. */
  6560. function compare(a, b) {
  6561. if (a === b) {
  6562. return 0;
  6563. }
  6564. var x = a.length;
  6565. var y = b.length;
  6566. for (var i = 0, len = Math.min(x, y); i < len; ++i) {
  6567. if (a[i] !== b[i]) {
  6568. x = a[i];
  6569. y = b[i];
  6570. break;
  6571. }
  6572. }
  6573. if (x < y) {
  6574. return -1;
  6575. }
  6576. if (y < x) {
  6577. return 1;
  6578. }
  6579. return 0;
  6580. }
  6581. function isBuffer(b) {
  6582. if (global.Buffer && typeof global.Buffer.isBuffer === 'function') {
  6583. return global.Buffer.isBuffer(b);
  6584. }
  6585. return !!(b != null && b._isBuffer);
  6586. }
  6587. // based on node assert, original notice:
  6588. // NB: The URL to the CommonJS spec is kept just for tradition.
  6589. // node-assert has evolved a lot since then, both in API and behavior.
  6590. // http://wiki.commonjs.org/wiki/Unit_Testing/1.0
  6591. //
  6592. // THIS IS NOT TESTED NOR LIKELY TO WORK OUTSIDE V8!
  6593. //
  6594. // Originally from narwhal.js (http://narwhaljs.org)
  6595. // Copyright (c) 2009 Thomas Robinson <280north.com>
  6596. //
  6597. // Permission is hereby granted, free of charge, to any person obtaining a copy
  6598. // of this software and associated documentation files (the 'Software'), to
  6599. // deal in the Software without restriction, including without limitation the
  6600. // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
  6601. // sell copies of the Software, and to permit persons to whom the Software is
  6602. // furnished to do so, subject to the following conditions:
  6603. //
  6604. // The above copyright notice and this permission notice shall be included in
  6605. // all copies or substantial portions of the Software.
  6606. //
  6607. // THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  6608. // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  6609. // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  6610. // AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
  6611. // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
  6612. // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  6613. var util = require('util/');
  6614. var hasOwn = Object.prototype.hasOwnProperty;
  6615. var pSlice = Array.prototype.slice;
  6616. var functionsHaveNames = (function () {
  6617. return function foo() {}.name === 'foo';
  6618. }());
  6619. function pToString (obj) {
  6620. return Object.prototype.toString.call(obj);
  6621. }
  6622. function isView(arrbuf) {
  6623. if (isBuffer(arrbuf)) {
  6624. return false;
  6625. }
  6626. if (typeof global.ArrayBuffer !== 'function') {
  6627. return false;
  6628. }
  6629. if (typeof ArrayBuffer.isView === 'function') {
  6630. return ArrayBuffer.isView(arrbuf);
  6631. }
  6632. if (!arrbuf) {
  6633. return false;
  6634. }
  6635. if (arrbuf instanceof DataView) {
  6636. return true;
  6637. }
  6638. if (arrbuf.buffer && arrbuf.buffer instanceof ArrayBuffer) {
  6639. return true;
  6640. }
  6641. return false;
  6642. }
  6643. // 1. The assert module provides functions that throw
  6644. // AssertionError's when particular conditions are not met. The
  6645. // assert module must conform to the following interface.
  6646. var assert = module.exports = ok;
  6647. // 2. The AssertionError is defined in assert.
  6648. // new assert.AssertionError({ message: message,
  6649. // actual: actual,
  6650. // expected: expected })
  6651. var regex = /\s*function\s+([^\(\s]*)\s*/;
  6652. // based on https://github.com/ljharb/function.prototype.name/blob/adeeeec8bfcc6068b187d7d9fb3d5bb1d3a30899/implementation.js
  6653. function getName(func) {
  6654. if (!util.isFunction(func)) {
  6655. return;
  6656. }
  6657. if (functionsHaveNames) {
  6658. return func.name;
  6659. }
  6660. var str = func.toString();
  6661. var match = str.match(regex);
  6662. return match && match[1];
  6663. }
  6664. assert.AssertionError = function AssertionError(options) {
  6665. this.name = 'AssertionError';
  6666. this.actual = options.actual;
  6667. this.expected = options.expected;
  6668. this.operator = options.operator;
  6669. if (options.message) {
  6670. this.message = options.message;
  6671. this.generatedMessage = false;
  6672. } else {
  6673. this.message = getMessage(this);
  6674. this.generatedMessage = true;
  6675. }
  6676. var stackStartFunction = options.stackStartFunction || fail;
  6677. if (Error.captureStackTrace) {
  6678. Error.captureStackTrace(this, stackStartFunction);
  6679. } else {
  6680. // non v8 browsers so we can have a stacktrace
  6681. var err = new Error();
  6682. if (err.stack) {
  6683. var out = err.stack;
  6684. // try to strip useless frames
  6685. var fn_name = getName(stackStartFunction);
  6686. var idx = out.indexOf('\n' + fn_name);
  6687. if (idx >= 0) {
  6688. // once we have located the function frame
  6689. // we need to strip out everything before it (and its line)
  6690. var next_line = out.indexOf('\n', idx + 1);
  6691. out = out.substring(next_line + 1);
  6692. }
  6693. this.stack = out;
  6694. }
  6695. }
  6696. };
  6697. // assert.AssertionError instanceof Error
  6698. util.inherits(assert.AssertionError, Error);
  6699. function truncate(s, n) {
  6700. if (typeof s === 'string') {
  6701. return s.length < n ? s : s.slice(0, n);
  6702. } else {
  6703. return s;
  6704. }
  6705. }
  6706. function inspect(something) {
  6707. if (functionsHaveNames || !util.isFunction(something)) {
  6708. return util.inspect(something);
  6709. }
  6710. var rawname = getName(something);
  6711. var name = rawname ? ': ' + rawname : '';
  6712. return '[Function' + name + ']';
  6713. }
  6714. function getMessage(self) {
  6715. return truncate(inspect(self.actual), 128) + ' ' +
  6716. self.operator + ' ' +
  6717. truncate(inspect(self.expected), 128);
  6718. }
  6719. // At present only the three keys mentioned above are used and
  6720. // understood by the spec. Implementations or sub modules can pass
  6721. // other keys to the AssertionError's constructor - they will be
  6722. // ignored.
  6723. // 3. All of the following functions must throw an AssertionError
  6724. // when a corresponding condition is not met, with a message that
  6725. // may be undefined if not provided. All assertion methods provide
  6726. // both the actual and expected values to the assertion error for
  6727. // display purposes.
  6728. function fail(actual, expected, message, operator, stackStartFunction) {
  6729. throw new assert.AssertionError({
  6730. message: message,
  6731. actual: actual,
  6732. expected: expected,
  6733. operator: operator,
  6734. stackStartFunction: stackStartFunction
  6735. });
  6736. }
  6737. // EXTENSION! allows for well behaved errors defined elsewhere.
  6738. assert.fail = fail;
  6739. // 4. Pure assertion tests whether a value is truthy, as determined
  6740. // by !!guard.
  6741. // assert.ok(guard, message_opt);
  6742. // This statement is equivalent to assert.equal(true, !!guard,
  6743. // message_opt);. To test strictly for the value true, use
  6744. // assert.strictEqual(true, guard, message_opt);.
  6745. function ok(value, message) {
  6746. if (!value) fail(value, true, message, '==', assert.ok);
  6747. }
  6748. assert.ok = ok;
  6749. // 5. The equality assertion tests shallow, coercive equality with
  6750. // ==.
  6751. // assert.equal(actual, expected, message_opt);
  6752. assert.equal = function equal(actual, expected, message) {
  6753. if (actual != expected) fail(actual, expected, message, '==', assert.equal);
  6754. };
  6755. // 6. The non-equality assertion tests for whether two objects are not equal
  6756. // with != assert.notEqual(actual, expected, message_opt);
  6757. assert.notEqual = function notEqual(actual, expected, message) {
  6758. if (actual == expected) {
  6759. fail(actual, expected, message, '!=', assert.notEqual);
  6760. }
  6761. };
  6762. // 7. The equivalence assertion tests a deep equality relation.
  6763. // assert.deepEqual(actual, expected, message_opt);
  6764. assert.deepEqual = function deepEqual(actual, expected, message) {
  6765. if (!_deepEqual(actual, expected, false)) {
  6766. fail(actual, expected, message, 'deepEqual', assert.deepEqual);
  6767. }
  6768. };
  6769. assert.deepStrictEqual = function deepStrictEqual(actual, expected, message) {
  6770. if (!_deepEqual(actual, expected, true)) {
  6771. fail(actual, expected, message, 'deepStrictEqual', assert.deepStrictEqual);
  6772. }
  6773. };
  6774. function _deepEqual(actual, expected, strict, memos) {
  6775. // 7.1. All identical values are equivalent, as determined by ===.
  6776. if (actual === expected) {
  6777. return true;
  6778. } else if (isBuffer(actual) && isBuffer(expected)) {
  6779. return compare(actual, expected) === 0;
  6780. // 7.2. If the expected value is a Date object, the actual value is
  6781. // equivalent if it is also a Date object that refers to the same time.
  6782. } else if (util.isDate(actual) && util.isDate(expected)) {
  6783. return actual.getTime() === expected.getTime();
  6784. // 7.3 If the expected value is a RegExp object, the actual value is
  6785. // equivalent if it is also a RegExp object with the same source and
  6786. // properties (`global`, `multiline`, `lastIndex`, `ignoreCase`).
  6787. } else if (util.isRegExp(actual) && util.isRegExp(expected)) {
  6788. return actual.source === expected.source &&
  6789. actual.global === expected.global &&
  6790. actual.multiline === expected.multiline &&
  6791. actual.lastIndex === expected.lastIndex &&
  6792. actual.ignoreCase === expected.ignoreCase;
  6793. // 7.4. Other pairs that do not both pass typeof value == 'object',
  6794. // equivalence is determined by ==.
  6795. } else if ((actual === null || typeof actual !== 'object') &&
  6796. (expected === null || typeof expected !== 'object')) {
  6797. return strict ? actual === expected : actual == expected;
  6798. // If both values are instances of typed arrays, wrap their underlying
  6799. // ArrayBuffers in a Buffer each to increase performance
  6800. // This optimization requires the arrays to have the same type as checked by
  6801. // Object.prototype.toString (aka pToString). Never perform binary
  6802. // comparisons for Float*Arrays, though, since e.g. +0 === -0 but their
  6803. // bit patterns are not identical.
  6804. } else if (isView(actual) && isView(expected) &&
  6805. pToString(actual) === pToString(expected) &&
  6806. !(actual instanceof Float32Array ||
  6807. actual instanceof Float64Array)) {
  6808. return compare(new Uint8Array(actual.buffer),
  6809. new Uint8Array(expected.buffer)) === 0;
  6810. // 7.5 For all other Object pairs, including Array objects, equivalence is
  6811. // determined by having the same number of owned properties (as verified
  6812. // with Object.prototype.hasOwnProperty.call), the same set of keys
  6813. // (although not necessarily the same order), equivalent values for every
  6814. // corresponding key, and an identical 'prototype' property. Note: this
  6815. // accounts for both named and indexed properties on Arrays.
  6816. } else if (isBuffer(actual) !== isBuffer(expected)) {
  6817. return false;
  6818. } else {
  6819. memos = memos || {actual: [], expected: []};
  6820. var actualIndex = memos.actual.indexOf(actual);
  6821. if (actualIndex !== -1) {
  6822. if (actualIndex === memos.expected.indexOf(expected)) {
  6823. return true;
  6824. }
  6825. }
  6826. memos.actual.push(actual);
  6827. memos.expected.push(expected);
  6828. return objEquiv(actual, expected, strict, memos);
  6829. }
  6830. }
  6831. function isArguments(object) {
  6832. return Object.prototype.toString.call(object) == '[object Arguments]';
  6833. }
  6834. function objEquiv(a, b, strict, actualVisitedObjects) {
  6835. if (a === null || a === undefined || b === null || b === undefined)
  6836. return false;
  6837. // if one is a primitive, the other must be same
  6838. if (util.isPrimitive(a) || util.isPrimitive(b))
  6839. return a === b;
  6840. if (strict && Object.getPrototypeOf(a) !== Object.getPrototypeOf(b))
  6841. return false;
  6842. var aIsArgs = isArguments(a);
  6843. var bIsArgs = isArguments(b);
  6844. if ((aIsArgs && !bIsArgs) || (!aIsArgs && bIsArgs))
  6845. return false;
  6846. if (aIsArgs) {
  6847. a = pSlice.call(a);
  6848. b = pSlice.call(b);
  6849. return _deepEqual(a, b, strict);
  6850. }
  6851. var ka = objectKeys(a);
  6852. var kb = objectKeys(b);
  6853. var key, i;
  6854. // having the same number of owned properties (keys incorporates
  6855. // hasOwnProperty)
  6856. if (ka.length !== kb.length)
  6857. return false;
  6858. //the same set of keys (although not necessarily the same order),
  6859. ka.sort();
  6860. kb.sort();
  6861. //~~~cheap key test
  6862. for (i = ka.length - 1; i >= 0; i--) {
  6863. if (ka[i] !== kb[i])
  6864. return false;
  6865. }
  6866. //equivalent values for every corresponding key, and
  6867. //~~~possibly expensive deep test
  6868. for (i = ka.length - 1; i >= 0; i--) {
  6869. key = ka[i];
  6870. if (!_deepEqual(a[key], b[key], strict, actualVisitedObjects))
  6871. return false;
  6872. }
  6873. return true;
  6874. }
  6875. // 8. The non-equivalence assertion tests for any deep inequality.
  6876. // assert.notDeepEqual(actual, expected, message_opt);
  6877. assert.notDeepEqual = function notDeepEqual(actual, expected, message) {
  6878. if (_deepEqual(actual, expected, false)) {
  6879. fail(actual, expected, message, 'notDeepEqual', assert.notDeepEqual);
  6880. }
  6881. };
  6882. assert.notDeepStrictEqual = notDeepStrictEqual;
  6883. function notDeepStrictEqual(actual, expected, message) {
  6884. if (_deepEqual(actual, expected, true)) {
  6885. fail(actual, expected, message, 'notDeepStrictEqual', notDeepStrictEqual);
  6886. }
  6887. }
  6888. // 9. The strict equality assertion tests strict equality, as determined by ===.
  6889. // assert.strictEqual(actual, expected, message_opt);
  6890. assert.strictEqual = function strictEqual(actual, expected, message) {
  6891. if (actual !== expected) {
  6892. fail(actual, expected, message, '===', assert.strictEqual);
  6893. }
  6894. };
  6895. // 10. The strict non-equality assertion tests for strict inequality, as
  6896. // determined by !==. assert.notStrictEqual(actual, expected, message_opt);
  6897. assert.notStrictEqual = function notStrictEqual(actual, expected, message) {
  6898. if (actual === expected) {
  6899. fail(actual, expected, message, '!==', assert.notStrictEqual);
  6900. }
  6901. };
  6902. function expectedException(actual, expected) {
  6903. if (!actual || !expected) {
  6904. return false;
  6905. }
  6906. if (Object.prototype.toString.call(expected) == '[object RegExp]') {
  6907. return expected.test(actual);
  6908. }
  6909. try {
  6910. if (actual instanceof expected) {
  6911. return true;
  6912. }
  6913. } catch (e) {
  6914. // Ignore. The instanceof check doesn't work for arrow functions.
  6915. }
  6916. if (Error.isPrototypeOf(expected)) {
  6917. return false;
  6918. }
  6919. return expected.call({}, actual) === true;
  6920. }
  6921. function _tryBlock(block) {
  6922. var error;
  6923. try {
  6924. block();
  6925. } catch (e) {
  6926. error = e;
  6927. }
  6928. return error;
  6929. }
  6930. function _throws(shouldThrow, block, expected, message) {
  6931. var actual;
  6932. if (typeof block !== 'function') {
  6933. throw new TypeError('"block" argument must be a function');
  6934. }
  6935. if (typeof expected === 'string') {
  6936. message = expected;
  6937. expected = null;
  6938. }
  6939. actual = _tryBlock(block);
  6940. message = (expected && expected.name ? ' (' + expected.name + ').' : '.') +
  6941. (message ? ' ' + message : '.');
  6942. if (shouldThrow && !actual) {
  6943. fail(actual, expected, 'Missing expected exception' + message);
  6944. }
  6945. var userProvidedMessage = typeof message === 'string';
  6946. var isUnwantedException = !shouldThrow && util.isError(actual);
  6947. var isUnexpectedException = !shouldThrow && actual && !expected;
  6948. if ((isUnwantedException &&
  6949. userProvidedMessage &&
  6950. expectedException(actual, expected)) ||
  6951. isUnexpectedException) {
  6952. fail(actual, expected, 'Got unwanted exception' + message);
  6953. }
  6954. if ((shouldThrow && actual && expected &&
  6955. !expectedException(actual, expected)) || (!shouldThrow && actual)) {
  6956. throw actual;
  6957. }
  6958. }
  6959. // 11. Expected to throw an error:
  6960. // assert.throws(block, Error_opt, message_opt);
  6961. assert.throws = function(block, /*optional*/error, /*optional*/message) {
  6962. _throws(true, block, error, message);
  6963. };
  6964. // EXTENSION! This is annoying to write outside this module.
  6965. assert.doesNotThrow = function(block, /*optional*/error, /*optional*/message) {
  6966. _throws(false, block, error, message);
  6967. };
  6968. assert.ifError = function(err) { if (err) throw err; };
  6969. // Expose a strict only variant of assert
  6970. function strict(value, message) {
  6971. if (!value) fail(value, true, message, '==', strict);
  6972. }
  6973. assert.strict = objectAssign(strict, assert, {
  6974. equal: assert.strictEqual,
  6975. deepEqual: assert.deepStrictEqual,
  6976. notEqual: assert.notStrictEqual,
  6977. notDeepEqual: assert.notDeepStrictEqual
  6978. });
  6979. assert.strict.strict = assert.strict;
  6980. var objectKeys = Object.keys || function (obj) {
  6981. var keys = [];
  6982. for (var key in obj) {
  6983. if (hasOwn.call(obj, key)) keys.push(key);
  6984. }
  6985. return keys;
  6986. };
  6987. }).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
  6988. },{"object-assign":320,"util/":81}],79:[function(require,module,exports){
  6989. if (typeof Object.create === 'function') {
  6990. // implementation from standard node.js 'util' module
  6991. module.exports = function inherits(ctor, superCtor) {
  6992. ctor.super_ = superCtor
  6993. ctor.prototype = Object.create(superCtor.prototype, {
  6994. constructor: {
  6995. value: ctor,
  6996. enumerable: false,
  6997. writable: true,
  6998. configurable: true
  6999. }
  7000. });
  7001. };
  7002. } else {
  7003. // old school shim for old browsers
  7004. module.exports = function inherits(ctor, superCtor) {
  7005. ctor.super_ = superCtor
  7006. var TempCtor = function () {}
  7007. TempCtor.prototype = superCtor.prototype
  7008. ctor.prototype = new TempCtor()
  7009. ctor.prototype.constructor = ctor
  7010. }
  7011. }
  7012. },{}],80:[function(require,module,exports){
  7013. module.exports = function isBuffer(arg) {
  7014. return arg && typeof arg === 'object'
  7015. && typeof arg.copy === 'function'
  7016. && typeof arg.fill === 'function'
  7017. && typeof arg.readUInt8 === 'function';
  7018. }
  7019. },{}],81:[function(require,module,exports){
  7020. (function (process,global){(function (){
  7021. // Copyright Joyent, Inc. and other Node contributors.
  7022. //
  7023. // Permission is hereby granted, free of charge, to any person obtaining a
  7024. // copy of this software and associated documentation files (the
  7025. // "Software"), to deal in the Software without restriction, including
  7026. // without limitation the rights to use, copy, modify, merge, publish,
  7027. // distribute, sublicense, and/or sell copies of the Software, and to permit
  7028. // persons to whom the Software is furnished to do so, subject to the
  7029. // following conditions:
  7030. //
  7031. // The above copyright notice and this permission notice shall be included
  7032. // in all copies or substantial portions of the Software.
  7033. //
  7034. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  7035. // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  7036. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  7037. // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  7038. // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  7039. // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  7040. // USE OR OTHER DEALINGS IN THE SOFTWARE.
  7041. var formatRegExp = /%[sdj%]/g;
  7042. exports.format = function(f) {
  7043. if (!isString(f)) {
  7044. var objects = [];
  7045. for (var i = 0; i < arguments.length; i++) {
  7046. objects.push(inspect(arguments[i]));
  7047. }
  7048. return objects.join(' ');
  7049. }
  7050. var i = 1;
  7051. var args = arguments;
  7052. var len = args.length;
  7053. var str = String(f).replace(formatRegExp, function(x) {
  7054. if (x === '%%') return '%';
  7055. if (i >= len) return x;
  7056. switch (x) {
  7057. case '%s': return String(args[i++]);
  7058. case '%d': return Number(args[i++]);
  7059. case '%j':
  7060. try {
  7061. return JSON.stringify(args[i++]);
  7062. } catch (_) {
  7063. return '[Circular]';
  7064. }
  7065. default:
  7066. return x;
  7067. }
  7068. });
  7069. for (var x = args[i]; i < len; x = args[++i]) {
  7070. if (isNull(x) || !isObject(x)) {
  7071. str += ' ' + x;
  7072. } else {
  7073. str += ' ' + inspect(x);
  7074. }
  7075. }
  7076. return str;
  7077. };
  7078. // Mark that a method should not be used.
  7079. // Returns a modified function which warns once by default.
  7080. // If --no-deprecation is set, then it is a no-op.
  7081. exports.deprecate = function(fn, msg) {
  7082. // Allow for deprecating things in the process of starting up.
  7083. if (isUndefined(global.process)) {
  7084. return function() {
  7085. return exports.deprecate(fn, msg).apply(this, arguments);
  7086. };
  7087. }
  7088. if (process.noDeprecation === true) {
  7089. return fn;
  7090. }
  7091. var warned = false;
  7092. function deprecated() {
  7093. if (!warned) {
  7094. if (process.throwDeprecation) {
  7095. throw new Error(msg);
  7096. } else if (process.traceDeprecation) {
  7097. console.trace(msg);
  7098. } else {
  7099. console.error(msg);
  7100. }
  7101. warned = true;
  7102. }
  7103. return fn.apply(this, arguments);
  7104. }
  7105. return deprecated;
  7106. };
  7107. var debugs = {};
  7108. var debugEnviron;
  7109. exports.debuglog = function(set) {
  7110. if (isUndefined(debugEnviron))
  7111. debugEnviron = process.env.NODE_DEBUG || '';
  7112. set = set.toUpperCase();
  7113. if (!debugs[set]) {
  7114. if (new RegExp('\\b' + set + '\\b', 'i').test(debugEnviron)) {
  7115. var pid = process.pid;
  7116. debugs[set] = function() {
  7117. var msg = exports.format.apply(exports, arguments);
  7118. console.error('%s %d: %s', set, pid, msg);
  7119. };
  7120. } else {
  7121. debugs[set] = function() {};
  7122. }
  7123. }
  7124. return debugs[set];
  7125. };
  7126. /**
  7127. * Echos the value of a value. Trys to print the value out
  7128. * in the best way possible given the different types.
  7129. *
  7130. * @param {Object} obj The object to print out.
  7131. * @param {Object} opts Optional options object that alters the output.
  7132. */
  7133. /* legacy: obj, showHidden, depth, colors*/
  7134. function inspect(obj, opts) {
  7135. // default options
  7136. var ctx = {
  7137. seen: [],
  7138. stylize: stylizeNoColor
  7139. };
  7140. // legacy...
  7141. if (arguments.length >= 3) ctx.depth = arguments[2];
  7142. if (arguments.length >= 4) ctx.colors = arguments[3];
  7143. if (isBoolean(opts)) {
  7144. // legacy...
  7145. ctx.showHidden = opts;
  7146. } else if (opts) {
  7147. // got an "options" object
  7148. exports._extend(ctx, opts);
  7149. }
  7150. // set default options
  7151. if (isUndefined(ctx.showHidden)) ctx.showHidden = false;
  7152. if (isUndefined(ctx.depth)) ctx.depth = 2;
  7153. if (isUndefined(ctx.colors)) ctx.colors = false;
  7154. if (isUndefined(ctx.customInspect)) ctx.customInspect = true;
  7155. if (ctx.colors) ctx.stylize = stylizeWithColor;
  7156. return formatValue(ctx, obj, ctx.depth);
  7157. }
  7158. exports.inspect = inspect;
  7159. // http://en.wikipedia.org/wiki/ANSI_escape_code#graphics
  7160. inspect.colors = {
  7161. 'bold' : [1, 22],
  7162. 'italic' : [3, 23],
  7163. 'underline' : [4, 24],
  7164. 'inverse' : [7, 27],
  7165. 'white' : [37, 39],
  7166. 'grey' : [90, 39],
  7167. 'black' : [30, 39],
  7168. 'blue' : [34, 39],
  7169. 'cyan' : [36, 39],
  7170. 'green' : [32, 39],
  7171. 'magenta' : [35, 39],
  7172. 'red' : [31, 39],
  7173. 'yellow' : [33, 39]
  7174. };
  7175. // Don't use 'blue' not visible on cmd.exe
  7176. inspect.styles = {
  7177. 'special': 'cyan',
  7178. 'number': 'yellow',
  7179. 'boolean': 'yellow',
  7180. 'undefined': 'grey',
  7181. 'null': 'bold',
  7182. 'string': 'green',
  7183. 'date': 'magenta',
  7184. // "name": intentionally not styling
  7185. 'regexp': 'red'
  7186. };
  7187. function stylizeWithColor(str, styleType) {
  7188. var style = inspect.styles[styleType];
  7189. if (style) {
  7190. return '\u001b[' + inspect.colors[style][0] + 'm' + str +
  7191. '\u001b[' + inspect.colors[style][1] + 'm';
  7192. } else {
  7193. return str;
  7194. }
  7195. }
  7196. function stylizeNoColor(str, styleType) {
  7197. return str;
  7198. }
  7199. function arrayToHash(array) {
  7200. var hash = {};
  7201. array.forEach(function(val, idx) {
  7202. hash[val] = true;
  7203. });
  7204. return hash;
  7205. }
  7206. function formatValue(ctx, value, recurseTimes) {
  7207. // Provide a hook for user-specified inspect functions.
  7208. // Check that value is an object with an inspect function on it
  7209. if (ctx.customInspect &&
  7210. value &&
  7211. isFunction(value.inspect) &&
  7212. // Filter out the util module, it's inspect function is special
  7213. value.inspect !== exports.inspect &&
  7214. // Also filter out any prototype objects using the circular check.
  7215. !(value.constructor && value.constructor.prototype === value)) {
  7216. var ret = value.inspect(recurseTimes, ctx);
  7217. if (!isString(ret)) {
  7218. ret = formatValue(ctx, ret, recurseTimes);
  7219. }
  7220. return ret;
  7221. }
  7222. // Primitive types cannot have properties
  7223. var primitive = formatPrimitive(ctx, value);
  7224. if (primitive) {
  7225. return primitive;
  7226. }
  7227. // Look up the keys of the object.
  7228. var keys = Object.keys(value);
  7229. var visibleKeys = arrayToHash(keys);
  7230. if (ctx.showHidden) {
  7231. keys = Object.getOwnPropertyNames(value);
  7232. }
  7233. // IE doesn't make error fields non-enumerable
  7234. // http://msdn.microsoft.com/en-us/library/ie/dww52sbt(v=vs.94).aspx
  7235. if (isError(value)
  7236. && (keys.indexOf('message') >= 0 || keys.indexOf('description') >= 0)) {
  7237. return formatError(value);
  7238. }
  7239. // Some type of object without properties can be shortcutted.
  7240. if (keys.length === 0) {
  7241. if (isFunction(value)) {
  7242. var name = value.name ? ': ' + value.name : '';
  7243. return ctx.stylize('[Function' + name + ']', 'special');
  7244. }
  7245. if (isRegExp(value)) {
  7246. return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');
  7247. }
  7248. if (isDate(value)) {
  7249. return ctx.stylize(Date.prototype.toString.call(value), 'date');
  7250. }
  7251. if (isError(value)) {
  7252. return formatError(value);
  7253. }
  7254. }
  7255. var base = '', array = false, braces = ['{', '}'];
  7256. // Make Array say that they are Array
  7257. if (isArray(value)) {
  7258. array = true;
  7259. braces = ['[', ']'];
  7260. }
  7261. // Make functions say that they are functions
  7262. if (isFunction(value)) {
  7263. var n = value.name ? ': ' + value.name : '';
  7264. base = ' [Function' + n + ']';
  7265. }
  7266. // Make RegExps say that they are RegExps
  7267. if (isRegExp(value)) {
  7268. base = ' ' + RegExp.prototype.toString.call(value);
  7269. }
  7270. // Make dates with properties first say the date
  7271. if (isDate(value)) {
  7272. base = ' ' + Date.prototype.toUTCString.call(value);
  7273. }
  7274. // Make error with message first say the error
  7275. if (isError(value)) {
  7276. base = ' ' + formatError(value);
  7277. }
  7278. if (keys.length === 0 && (!array || value.length == 0)) {
  7279. return braces[0] + base + braces[1];
  7280. }
  7281. if (recurseTimes < 0) {
  7282. if (isRegExp(value)) {
  7283. return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');
  7284. } else {
  7285. return ctx.stylize('[Object]', 'special');
  7286. }
  7287. }
  7288. ctx.seen.push(value);
  7289. var output;
  7290. if (array) {
  7291. output = formatArray(ctx, value, recurseTimes, visibleKeys, keys);
  7292. } else {
  7293. output = keys.map(function(key) {
  7294. return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array);
  7295. });
  7296. }
  7297. ctx.seen.pop();
  7298. return reduceToSingleString(output, base, braces);
  7299. }
  7300. function formatPrimitive(ctx, value) {
  7301. if (isUndefined(value))
  7302. return ctx.stylize('undefined', 'undefined');
  7303. if (isString(value)) {
  7304. var simple = '\'' + JSON.stringify(value).replace(/^"|"$/g, '')
  7305. .replace(/'/g, "\\'")
  7306. .replace(/\\"/g, '"') + '\'';
  7307. return ctx.stylize(simple, 'string');
  7308. }
  7309. if (isNumber(value))
  7310. return ctx.stylize('' + value, 'number');
  7311. if (isBoolean(value))
  7312. return ctx.stylize('' + value, 'boolean');
  7313. // For some reason typeof null is "object", so special case here.
  7314. if (isNull(value))
  7315. return ctx.stylize('null', 'null');
  7316. }
  7317. function formatError(value) {
  7318. return '[' + Error.prototype.toString.call(value) + ']';
  7319. }
  7320. function formatArray(ctx, value, recurseTimes, visibleKeys, keys) {
  7321. var output = [];
  7322. for (var i = 0, l = value.length; i < l; ++i) {
  7323. if (hasOwnProperty(value, String(i))) {
  7324. output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,
  7325. String(i), true));
  7326. } else {
  7327. output.push('');
  7328. }
  7329. }
  7330. keys.forEach(function(key) {
  7331. if (!key.match(/^\d+$/)) {
  7332. output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,
  7333. key, true));
  7334. }
  7335. });
  7336. return output;
  7337. }
  7338. function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) {
  7339. var name, str, desc;
  7340. desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] };
  7341. if (desc.get) {
  7342. if (desc.set) {
  7343. str = ctx.stylize('[Getter/Setter]', 'special');
  7344. } else {
  7345. str = ctx.stylize('[Getter]', 'special');
  7346. }
  7347. } else {
  7348. if (desc.set) {
  7349. str = ctx.stylize('[Setter]', 'special');
  7350. }
  7351. }
  7352. if (!hasOwnProperty(visibleKeys, key)) {
  7353. name = '[' + key + ']';
  7354. }
  7355. if (!str) {
  7356. if (ctx.seen.indexOf(desc.value) < 0) {
  7357. if (isNull(recurseTimes)) {
  7358. str = formatValue(ctx, desc.value, null);
  7359. } else {
  7360. str = formatValue(ctx, desc.value, recurseTimes - 1);
  7361. }
  7362. if (str.indexOf('\n') > -1) {
  7363. if (array) {
  7364. str = str.split('\n').map(function(line) {
  7365. return ' ' + line;
  7366. }).join('\n').substr(2);
  7367. } else {
  7368. str = '\n' + str.split('\n').map(function(line) {
  7369. return ' ' + line;
  7370. }).join('\n');
  7371. }
  7372. }
  7373. } else {
  7374. str = ctx.stylize('[Circular]', 'special');
  7375. }
  7376. }
  7377. if (isUndefined(name)) {
  7378. if (array && key.match(/^\d+$/)) {
  7379. return str;
  7380. }
  7381. name = JSON.stringify('' + key);
  7382. if (name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)) {
  7383. name = name.substr(1, name.length - 2);
  7384. name = ctx.stylize(name, 'name');
  7385. } else {
  7386. name = name.replace(/'/g, "\\'")
  7387. .replace(/\\"/g, '"')
  7388. .replace(/(^"|"$)/g, "'");
  7389. name = ctx.stylize(name, 'string');
  7390. }
  7391. }
  7392. return name + ': ' + str;
  7393. }
  7394. function reduceToSingleString(output, base, braces) {
  7395. var numLinesEst = 0;
  7396. var length = output.reduce(function(prev, cur) {
  7397. numLinesEst++;
  7398. if (cur.indexOf('\n') >= 0) numLinesEst++;
  7399. return prev + cur.replace(/\u001b\[\d\d?m/g, '').length + 1;
  7400. }, 0);
  7401. if (length > 60) {
  7402. return braces[0] +
  7403. (base === '' ? '' : base + '\n ') +
  7404. ' ' +
  7405. output.join(',\n ') +
  7406. ' ' +
  7407. braces[1];
  7408. }
  7409. return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1];
  7410. }
  7411. // NOTE: These type checking functions intentionally don't use `instanceof`
  7412. // because it is fragile and can be easily faked with `Object.create()`.
  7413. function isArray(ar) {
  7414. return Array.isArray(ar);
  7415. }
  7416. exports.isArray = isArray;
  7417. function isBoolean(arg) {
  7418. return typeof arg === 'boolean';
  7419. }
  7420. exports.isBoolean = isBoolean;
  7421. function isNull(arg) {
  7422. return arg === null;
  7423. }
  7424. exports.isNull = isNull;
  7425. function isNullOrUndefined(arg) {
  7426. return arg == null;
  7427. }
  7428. exports.isNullOrUndefined = isNullOrUndefined;
  7429. function isNumber(arg) {
  7430. return typeof arg === 'number';
  7431. }
  7432. exports.isNumber = isNumber;
  7433. function isString(arg) {
  7434. return typeof arg === 'string';
  7435. }
  7436. exports.isString = isString;
  7437. function isSymbol(arg) {
  7438. return typeof arg === 'symbol';
  7439. }
  7440. exports.isSymbol = isSymbol;
  7441. function isUndefined(arg) {
  7442. return arg === void 0;
  7443. }
  7444. exports.isUndefined = isUndefined;
  7445. function isRegExp(re) {
  7446. return isObject(re) && objectToString(re) === '[object RegExp]';
  7447. }
  7448. exports.isRegExp = isRegExp;
  7449. function isObject(arg) {
  7450. return typeof arg === 'object' && arg !== null;
  7451. }
  7452. exports.isObject = isObject;
  7453. function isDate(d) {
  7454. return isObject(d) && objectToString(d) === '[object Date]';
  7455. }
  7456. exports.isDate = isDate;
  7457. function isError(e) {
  7458. return isObject(e) &&
  7459. (objectToString(e) === '[object Error]' || e instanceof Error);
  7460. }
  7461. exports.isError = isError;
  7462. function isFunction(arg) {
  7463. return typeof arg === 'function';
  7464. }
  7465. exports.isFunction = isFunction;
  7466. function isPrimitive(arg) {
  7467. return arg === null ||
  7468. typeof arg === 'boolean' ||
  7469. typeof arg === 'number' ||
  7470. typeof arg === 'string' ||
  7471. typeof arg === 'symbol' || // ES6 symbol
  7472. typeof arg === 'undefined';
  7473. }
  7474. exports.isPrimitive = isPrimitive;
  7475. exports.isBuffer = require('./support/isBuffer');
  7476. function objectToString(o) {
  7477. return Object.prototype.toString.call(o);
  7478. }
  7479. function pad(n) {
  7480. return n < 10 ? '0' + n.toString(10) : n.toString(10);
  7481. }
  7482. var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep',
  7483. 'Oct', 'Nov', 'Dec'];
  7484. // 26 Feb 16:19:34
  7485. function timestamp() {
  7486. var d = new Date();
  7487. var time = [pad(d.getHours()),
  7488. pad(d.getMinutes()),
  7489. pad(d.getSeconds())].join(':');
  7490. return [d.getDate(), months[d.getMonth()], time].join(' ');
  7491. }
  7492. // log is just a thin wrapper to console.log that prepends a timestamp
  7493. exports.log = function() {
  7494. console.log('%s - %s', timestamp(), exports.format.apply(exports, arguments));
  7495. };
  7496. /**
  7497. * Inherit the prototype methods from one constructor into another.
  7498. *
  7499. * The Function.prototype.inherits from lang.js rewritten as a standalone
  7500. * function (not on Function.prototype). NOTE: If this file is to be loaded
  7501. * during bootstrapping this function needs to be rewritten using some native
  7502. * functions as prototype setup using normal JavaScript does not work as
  7503. * expected during bootstrapping (see mirror.js in r114903).
  7504. *
  7505. * @param {function} ctor Constructor function which needs to inherit the
  7506. * prototype.
  7507. * @param {function} superCtor Constructor function to inherit prototype from.
  7508. */
  7509. exports.inherits = require('inherits');
  7510. exports._extend = function(origin, add) {
  7511. // Don't do anything if add isn't an object
  7512. if (!add || !isObject(add)) return origin;
  7513. var keys = Object.keys(add);
  7514. var i = keys.length;
  7515. while (i--) {
  7516. origin[keys[i]] = add[keys[i]];
  7517. }
  7518. return origin;
  7519. };
  7520. function hasOwnProperty(obj, prop) {
  7521. return Object.prototype.hasOwnProperty.call(obj, prop);
  7522. }
  7523. }).call(this)}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
  7524. },{"./support/isBuffer":80,"_process":399,"inherits":79}],82:[function(require,module,exports){
  7525. 'use strict'
  7526. exports.byteLength = byteLength
  7527. exports.toByteArray = toByteArray
  7528. exports.fromByteArray = fromByteArray
  7529. var lookup = []
  7530. var revLookup = []
  7531. var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array
  7532. var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
  7533. for (var i = 0, len = code.length; i < len; ++i) {
  7534. lookup[i] = code[i]
  7535. revLookup[code.charCodeAt(i)] = i
  7536. }
  7537. // Support decoding URL-safe base64 strings, as Node.js does.
  7538. // See: https://en.wikipedia.org/wiki/Base64#URL_applications
  7539. revLookup['-'.charCodeAt(0)] = 62
  7540. revLookup['_'.charCodeAt(0)] = 63
  7541. function getLens (b64) {
  7542. var len = b64.length
  7543. if (len % 4 > 0) {
  7544. throw new Error('Invalid string. Length must be a multiple of 4')
  7545. }
  7546. // Trim off extra bytes after placeholder bytes are found
  7547. // See: https://github.com/beatgammit/base64-js/issues/42
  7548. var validLen = b64.indexOf('=')
  7549. if (validLen === -1) validLen = len
  7550. var placeHoldersLen = validLen === len
  7551. ? 0
  7552. : 4 - (validLen % 4)
  7553. return [validLen, placeHoldersLen]
  7554. }
  7555. // base64 is 4/3 + up to two characters of the original data
  7556. function byteLength (b64) {
  7557. var lens = getLens(b64)
  7558. var validLen = lens[0]
  7559. var placeHoldersLen = lens[1]
  7560. return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
  7561. }
  7562. function _byteLength (b64, validLen, placeHoldersLen) {
  7563. return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
  7564. }
  7565. function toByteArray (b64) {
  7566. var tmp
  7567. var lens = getLens(b64)
  7568. var validLen = lens[0]
  7569. var placeHoldersLen = lens[1]
  7570. var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen))
  7571. var curByte = 0
  7572. // if there are placeholders, only get up to the last complete 4 chars
  7573. var len = placeHoldersLen > 0
  7574. ? validLen - 4
  7575. : validLen
  7576. var i
  7577. for (i = 0; i < len; i += 4) {
  7578. tmp =
  7579. (revLookup[b64.charCodeAt(i)] << 18) |
  7580. (revLookup[b64.charCodeAt(i + 1)] << 12) |
  7581. (revLookup[b64.charCodeAt(i + 2)] << 6) |
  7582. revLookup[b64.charCodeAt(i + 3)]
  7583. arr[curByte++] = (tmp >> 16) & 0xFF
  7584. arr[curByte++] = (tmp >> 8) & 0xFF
  7585. arr[curByte++] = tmp & 0xFF
  7586. }
  7587. if (placeHoldersLen === 2) {
  7588. tmp =
  7589. (revLookup[b64.charCodeAt(i)] << 2) |
  7590. (revLookup[b64.charCodeAt(i + 1)] >> 4)
  7591. arr[curByte++] = tmp & 0xFF
  7592. }
  7593. if (placeHoldersLen === 1) {
  7594. tmp =
  7595. (revLookup[b64.charCodeAt(i)] << 10) |
  7596. (revLookup[b64.charCodeAt(i + 1)] << 4) |
  7597. (revLookup[b64.charCodeAt(i + 2)] >> 2)
  7598. arr[curByte++] = (tmp >> 8) & 0xFF
  7599. arr[curByte++] = tmp & 0xFF
  7600. }
  7601. return arr
  7602. }
  7603. function tripletToBase64 (num) {
  7604. return lookup[num >> 18 & 0x3F] +
  7605. lookup[num >> 12 & 0x3F] +
  7606. lookup[num >> 6 & 0x3F] +
  7607. lookup[num & 0x3F]
  7608. }
  7609. function encodeChunk (uint8, start, end) {
  7610. var tmp
  7611. var output = []
  7612. for (var i = start; i < end; i += 3) {
  7613. tmp =
  7614. ((uint8[i] << 16) & 0xFF0000) +
  7615. ((uint8[i + 1] << 8) & 0xFF00) +
  7616. (uint8[i + 2] & 0xFF)
  7617. output.push(tripletToBase64(tmp))
  7618. }
  7619. return output.join('')
  7620. }
  7621. function fromByteArray (uint8) {
  7622. var tmp
  7623. var len = uint8.length
  7624. var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes
  7625. var parts = []
  7626. var maxChunkLength = 16383 // must be multiple of 3
  7627. // go through the array every three bytes, we'll deal with trailing stuff later
  7628. for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {
  7629. parts.push(encodeChunk(uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)))
  7630. }
  7631. // pad the end with zeros, but make sure to not forget the extra bytes
  7632. if (extraBytes === 1) {
  7633. tmp = uint8[len - 1]
  7634. parts.push(
  7635. lookup[tmp >> 2] +
  7636. lookup[(tmp << 4) & 0x3F] +
  7637. '=='
  7638. )
  7639. } else if (extraBytes === 2) {
  7640. tmp = (uint8[len - 2] << 8) + uint8[len - 1]
  7641. parts.push(
  7642. lookup[tmp >> 10] +
  7643. lookup[(tmp >> 4) & 0x3F] +
  7644. lookup[(tmp << 2) & 0x3F] +
  7645. '='
  7646. )
  7647. }
  7648. return parts.join('')
  7649. }
  7650. },{}],83:[function(require,module,exports){
  7651. /*!
  7652. * Bowser - a browser detector
  7653. * https://github.com/ded/bowser
  7654. * MIT License | (c) Dustin Diaz 2015
  7655. */
  7656. !function (root, name, definition) {
  7657. if (typeof module != 'undefined' && module.exports) module.exports = definition()
  7658. else if (typeof define == 'function' && define.amd) define(name, definition)
  7659. else root[name] = definition()
  7660. }(this, 'bowser', function () {
  7661. /**
  7662. * See useragents.js for examples of navigator.userAgent
  7663. */
  7664. var t = true
  7665. function detect(ua) {
  7666. function getFirstMatch(regex) {
  7667. var match = ua.match(regex);
  7668. return (match && match.length > 1 && match[1]) || '';
  7669. }
  7670. function getSecondMatch(regex) {
  7671. var match = ua.match(regex);
  7672. return (match && match.length > 1 && match[2]) || '';
  7673. }
  7674. var iosdevice = getFirstMatch(/(ipod|iphone|ipad)/i).toLowerCase()
  7675. , likeAndroid = /like android/i.test(ua)
  7676. , android = !likeAndroid && /android/i.test(ua)
  7677. , nexusMobile = /nexus\s*[0-6]\s*/i.test(ua)
  7678. , nexusTablet = !nexusMobile && /nexus\s*[0-9]+/i.test(ua)
  7679. , chromeos = /CrOS/.test(ua)
  7680. , silk = /silk/i.test(ua)
  7681. , sailfish = /sailfish/i.test(ua)
  7682. , tizen = /tizen/i.test(ua)
  7683. , webos = /(web|hpw)(o|0)s/i.test(ua)
  7684. , windowsphone = /windows phone/i.test(ua)
  7685. , samsungBrowser = /SamsungBrowser/i.test(ua)
  7686. , windows = !windowsphone && /windows/i.test(ua)
  7687. , mac = !iosdevice && !silk && /macintosh/i.test(ua)
  7688. , linux = !android && !sailfish && !tizen && !webos && /linux/i.test(ua)
  7689. , edgeVersion = getSecondMatch(/edg([ea]|ios)\/(\d+(\.\d+)?)/i)
  7690. , versionIdentifier = getFirstMatch(/version\/(\d+(\.\d+)?)/i)
  7691. , tablet = /tablet/i.test(ua) && !/tablet pc/i.test(ua)
  7692. , mobile = !tablet && /[^-]mobi/i.test(ua)
  7693. , xbox = /xbox/i.test(ua)
  7694. , result
  7695. if (/opera/i.test(ua)) {
  7696. // an old Opera
  7697. result = {
  7698. name: 'Opera'
  7699. , opera: t
  7700. , version: versionIdentifier || getFirstMatch(/(?:opera|opr|opios)[\s\/](\d+(\.\d+)?)/i)
  7701. }
  7702. } else if (/opr\/|opios/i.test(ua)) {
  7703. // a new Opera
  7704. result = {
  7705. name: 'Opera'
  7706. , opera: t
  7707. , version: getFirstMatch(/(?:opr|opios)[\s\/](\d+(\.\d+)?)/i) || versionIdentifier
  7708. }
  7709. }
  7710. else if (/SamsungBrowser/i.test(ua)) {
  7711. result = {
  7712. name: 'Samsung Internet for Android'
  7713. , samsungBrowser: t
  7714. , version: versionIdentifier || getFirstMatch(/(?:SamsungBrowser)[\s\/](\d+(\.\d+)?)/i)
  7715. }
  7716. }
  7717. else if (/Whale/i.test(ua)) {
  7718. result = {
  7719. name: 'NAVER Whale browser'
  7720. , whale: t
  7721. , version: getFirstMatch(/(?:whale)[\s\/](\d+(?:\.\d+)+)/i)
  7722. }
  7723. }
  7724. else if (/MZBrowser/i.test(ua)) {
  7725. result = {
  7726. name: 'MZ Browser'
  7727. , mzbrowser: t
  7728. , version: getFirstMatch(/(?:MZBrowser)[\s\/](\d+(?:\.\d+)+)/i)
  7729. }
  7730. }
  7731. else if (/coast/i.test(ua)) {
  7732. result = {
  7733. name: 'Opera Coast'
  7734. , coast: t
  7735. , version: versionIdentifier || getFirstMatch(/(?:coast)[\s\/](\d+(\.\d+)?)/i)
  7736. }
  7737. }
  7738. else if (/focus/i.test(ua)) {
  7739. result = {
  7740. name: 'Focus'
  7741. , focus: t
  7742. , version: getFirstMatch(/(?:focus)[\s\/](\d+(?:\.\d+)+)/i)
  7743. }
  7744. }
  7745. else if (/yabrowser/i.test(ua)) {
  7746. result = {
  7747. name: 'Yandex Browser'
  7748. , yandexbrowser: t
  7749. , version: versionIdentifier || getFirstMatch(/(?:yabrowser)[\s\/](\d+(\.\d+)?)/i)
  7750. }
  7751. }
  7752. else if (/ucbrowser/i.test(ua)) {
  7753. result = {
  7754. name: 'UC Browser'
  7755. , ucbrowser: t
  7756. , version: getFirstMatch(/(?:ucbrowser)[\s\/](\d+(?:\.\d+)+)/i)
  7757. }
  7758. }
  7759. else if (/mxios/i.test(ua)) {
  7760. result = {
  7761. name: 'Maxthon'
  7762. , maxthon: t
  7763. , version: getFirstMatch(/(?:mxios)[\s\/](\d+(?:\.\d+)+)/i)
  7764. }
  7765. }
  7766. else if (/epiphany/i.test(ua)) {
  7767. result = {
  7768. name: 'Epiphany'
  7769. , epiphany: t
  7770. , version: getFirstMatch(/(?:epiphany)[\s\/](\d+(?:\.\d+)+)/i)
  7771. }
  7772. }
  7773. else if (/puffin/i.test(ua)) {
  7774. result = {
  7775. name: 'Puffin'
  7776. , puffin: t
  7777. , version: getFirstMatch(/(?:puffin)[\s\/](\d+(?:\.\d+)?)/i)
  7778. }
  7779. }
  7780. else if (/sleipnir/i.test(ua)) {
  7781. result = {
  7782. name: 'Sleipnir'
  7783. , sleipnir: t
  7784. , version: getFirstMatch(/(?:sleipnir)[\s\/](\d+(?:\.\d+)+)/i)
  7785. }
  7786. }
  7787. else if (/k-meleon/i.test(ua)) {
  7788. result = {
  7789. name: 'K-Meleon'
  7790. , kMeleon: t
  7791. , version: getFirstMatch(/(?:k-meleon)[\s\/](\d+(?:\.\d+)+)/i)
  7792. }
  7793. }
  7794. else if (windowsphone) {
  7795. result = {
  7796. name: 'Windows Phone'
  7797. , osname: 'Windows Phone'
  7798. , windowsphone: t
  7799. }
  7800. if (edgeVersion) {
  7801. result.msedge = t
  7802. result.version = edgeVersion
  7803. }
  7804. else {
  7805. result.msie = t
  7806. result.version = getFirstMatch(/iemobile\/(\d+(\.\d+)?)/i)
  7807. }
  7808. }
  7809. else if (/msie|trident/i.test(ua)) {
  7810. result = {
  7811. name: 'Internet Explorer'
  7812. , msie: t
  7813. , version: getFirstMatch(/(?:msie |rv:)(\d+(\.\d+)?)/i)
  7814. }
  7815. } else if (chromeos) {
  7816. result = {
  7817. name: 'Chrome'
  7818. , osname: 'Chrome OS'
  7819. , chromeos: t
  7820. , chromeBook: t
  7821. , chrome: t
  7822. , version: getFirstMatch(/(?:chrome|crios|crmo)\/(\d+(\.\d+)?)/i)
  7823. }
  7824. } else if (/edg([ea]|ios)/i.test(ua)) {
  7825. result = {
  7826. name: 'Microsoft Edge'
  7827. , msedge: t
  7828. , version: edgeVersion
  7829. }
  7830. }
  7831. else if (/vivaldi/i.test(ua)) {
  7832. result = {
  7833. name: 'Vivaldi'
  7834. , vivaldi: t
  7835. , version: getFirstMatch(/vivaldi\/(\d+(\.\d+)?)/i) || versionIdentifier
  7836. }
  7837. }
  7838. else if (sailfish) {
  7839. result = {
  7840. name: 'Sailfish'
  7841. , osname: 'Sailfish OS'
  7842. , sailfish: t
  7843. , version: getFirstMatch(/sailfish\s?browser\/(\d+(\.\d+)?)/i)
  7844. }
  7845. }
  7846. else if (/seamonkey\//i.test(ua)) {
  7847. result = {
  7848. name: 'SeaMonkey'
  7849. , seamonkey: t
  7850. , version: getFirstMatch(/seamonkey\/(\d+(\.\d+)?)/i)
  7851. }
  7852. }
  7853. else if (/firefox|iceweasel|fxios/i.test(ua)) {
  7854. result = {
  7855. name: 'Firefox'
  7856. , firefox: t
  7857. , version: getFirstMatch(/(?:firefox|iceweasel|fxios)[ \/](\d+(\.\d+)?)/i)
  7858. }
  7859. if (/\((mobile|tablet);[^\)]*rv:[\d\.]+\)/i.test(ua)) {
  7860. result.firefoxos = t
  7861. result.osname = 'Firefox OS'
  7862. }
  7863. }
  7864. else if (silk) {
  7865. result = {
  7866. name: 'Amazon Silk'
  7867. , silk: t
  7868. , version : getFirstMatch(/silk\/(\d+(\.\d+)?)/i)
  7869. }
  7870. }
  7871. else if (/phantom/i.test(ua)) {
  7872. result = {
  7873. name: 'PhantomJS'
  7874. , phantom: t
  7875. , version: getFirstMatch(/phantomjs\/(\d+(\.\d+)?)/i)
  7876. }
  7877. }
  7878. else if (/slimerjs/i.test(ua)) {
  7879. result = {
  7880. name: 'SlimerJS'
  7881. , slimer: t
  7882. , version: getFirstMatch(/slimerjs\/(\d+(\.\d+)?)/i)
  7883. }
  7884. }
  7885. else if (/blackberry|\bbb\d+/i.test(ua) || /rim\stablet/i.test(ua)) {
  7886. result = {
  7887. name: 'BlackBerry'
  7888. , osname: 'BlackBerry OS'
  7889. , blackberry: t
  7890. , version: versionIdentifier || getFirstMatch(/blackberry[\d]+\/(\d+(\.\d+)?)/i)
  7891. }
  7892. }
  7893. else if (webos) {
  7894. result = {
  7895. name: 'WebOS'
  7896. , osname: 'WebOS'
  7897. , webos: t
  7898. , version: versionIdentifier || getFirstMatch(/w(?:eb)?osbrowser\/(\d+(\.\d+)?)/i)
  7899. };
  7900. /touchpad\//i.test(ua) && (result.touchpad = t)
  7901. }
  7902. else if (/bada/i.test(ua)) {
  7903. result = {
  7904. name: 'Bada'
  7905. , osname: 'Bada'
  7906. , bada: t
  7907. , version: getFirstMatch(/dolfin\/(\d+(\.\d+)?)/i)
  7908. };
  7909. }
  7910. else if (tizen) {
  7911. result = {
  7912. name: 'Tizen'
  7913. , osname: 'Tizen'
  7914. , tizen: t
  7915. , version: getFirstMatch(/(?:tizen\s?)?browser\/(\d+(\.\d+)?)/i) || versionIdentifier
  7916. };
  7917. }
  7918. else if (/qupzilla/i.test(ua)) {
  7919. result = {
  7920. name: 'QupZilla'
  7921. , qupzilla: t
  7922. , version: getFirstMatch(/(?:qupzilla)[\s\/](\d+(?:\.\d+)+)/i) || versionIdentifier
  7923. }
  7924. }
  7925. else if (/chromium/i.test(ua)) {
  7926. result = {
  7927. name: 'Chromium'
  7928. , chromium: t
  7929. , version: getFirstMatch(/(?:chromium)[\s\/](\d+(?:\.\d+)?)/i) || versionIdentifier
  7930. }
  7931. }
  7932. else if (/chrome|crios|crmo/i.test(ua)) {
  7933. result = {
  7934. name: 'Chrome'
  7935. , chrome: t
  7936. , version: getFirstMatch(/(?:chrome|crios|crmo)\/(\d+(\.\d+)?)/i)
  7937. }
  7938. }
  7939. else if (android) {
  7940. result = {
  7941. name: 'Android'
  7942. , version: versionIdentifier
  7943. }
  7944. }
  7945. else if (/safari|applewebkit/i.test(ua)) {
  7946. result = {
  7947. name: 'Safari'
  7948. , safari: t
  7949. }
  7950. if (versionIdentifier) {
  7951. result.version = versionIdentifier
  7952. }
  7953. }
  7954. else if (iosdevice) {
  7955. result = {
  7956. name : iosdevice == 'iphone' ? 'iPhone' : iosdevice == 'ipad' ? 'iPad' : 'iPod'
  7957. }
  7958. // WTF: version is not part of user agent in web apps
  7959. if (versionIdentifier) {
  7960. result.version = versionIdentifier
  7961. }
  7962. }
  7963. else if(/googlebot/i.test(ua)) {
  7964. result = {
  7965. name: 'Googlebot'
  7966. , googlebot: t
  7967. , version: getFirstMatch(/googlebot\/(\d+(\.\d+))/i) || versionIdentifier
  7968. }
  7969. }
  7970. else {
  7971. result = {
  7972. name: getFirstMatch(/^(.*)\/(.*) /),
  7973. version: getSecondMatch(/^(.*)\/(.*) /)
  7974. };
  7975. }
  7976. // set webkit or gecko flag for browsers based on these engines
  7977. if (!result.msedge && /(apple)?webkit/i.test(ua)) {
  7978. if (/(apple)?webkit\/537\.36/i.test(ua)) {
  7979. result.name = result.name || "Blink"
  7980. result.blink = t
  7981. } else {
  7982. result.name = result.name || "Webkit"
  7983. result.webkit = t
  7984. }
  7985. if (!result.version && versionIdentifier) {
  7986. result.version = versionIdentifier
  7987. }
  7988. } else if (!result.opera && /gecko\//i.test(ua)) {
  7989. result.name = result.name || "Gecko"
  7990. result.gecko = t
  7991. result.version = result.version || getFirstMatch(/gecko\/(\d+(\.\d+)?)/i)
  7992. }
  7993. // set OS flags for platforms that have multiple browsers
  7994. if (!result.windowsphone && (android || result.silk)) {
  7995. result.android = t
  7996. result.osname = 'Android'
  7997. } else if (!result.windowsphone && iosdevice) {
  7998. result[iosdevice] = t
  7999. result.ios = t
  8000. result.osname = 'iOS'
  8001. } else if (mac) {
  8002. result.mac = t
  8003. result.osname = 'macOS'
  8004. } else if (xbox) {
  8005. result.xbox = t
  8006. result.osname = 'Xbox'
  8007. } else if (windows) {
  8008. result.windows = t
  8009. result.osname = 'Windows'
  8010. } else if (linux) {
  8011. result.linux = t
  8012. result.osname = 'Linux'
  8013. }
  8014. function getWindowsVersion (s) {
  8015. switch (s) {
  8016. case 'NT': return 'NT'
  8017. case 'XP': return 'XP'
  8018. case 'NT 5.0': return '2000'
  8019. case 'NT 5.1': return 'XP'
  8020. case 'NT 5.2': return '2003'
  8021. case 'NT 6.0': return 'Vista'
  8022. case 'NT 6.1': return '7'
  8023. case 'NT 6.2': return '8'
  8024. case 'NT 6.3': return '8.1'
  8025. case 'NT 10.0': return '10'
  8026. default: return undefined
  8027. }
  8028. }
  8029. // OS version extraction
  8030. var osVersion = '';
  8031. if (result.windows) {
  8032. osVersion = getWindowsVersion(getFirstMatch(/Windows ((NT|XP)( \d\d?.\d)?)/i))
  8033. } else if (result.windowsphone) {
  8034. osVersion = getFirstMatch(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i);
  8035. } else if (result.mac) {
  8036. osVersion = getFirstMatch(/Mac OS X (\d+([_\.\s]\d+)*)/i);
  8037. osVersion = osVersion.replace(/[_\s]/g, '.');
  8038. } else if (iosdevice) {
  8039. osVersion = getFirstMatch(/os (\d+([_\s]\d+)*) like mac os x/i);
  8040. osVersion = osVersion.replace(/[_\s]/g, '.');
  8041. } else if (android) {
  8042. osVersion = getFirstMatch(/android[ \/-](\d+(\.\d+)*)/i);
  8043. } else if (result.webos) {
  8044. osVersion = getFirstMatch(/(?:web|hpw)os\/(\d+(\.\d+)*)/i);
  8045. } else if (result.blackberry) {
  8046. osVersion = getFirstMatch(/rim\stablet\sos\s(\d+(\.\d+)*)/i);
  8047. } else if (result.bada) {
  8048. osVersion = getFirstMatch(/bada\/(\d+(\.\d+)*)/i);
  8049. } else if (result.tizen) {
  8050. osVersion = getFirstMatch(/tizen[\/\s](\d+(\.\d+)*)/i);
  8051. }
  8052. if (osVersion) {
  8053. result.osversion = osVersion;
  8054. }
  8055. // device type extraction
  8056. var osMajorVersion = !result.windows && osVersion.split('.')[0];
  8057. if (
  8058. tablet
  8059. || nexusTablet
  8060. || iosdevice == 'ipad'
  8061. || (android && (osMajorVersion == 3 || (osMajorVersion >= 4 && !mobile)))
  8062. || result.silk
  8063. ) {
  8064. result.tablet = t
  8065. } else if (
  8066. mobile
  8067. || iosdevice == 'iphone'
  8068. || iosdevice == 'ipod'
  8069. || android
  8070. || nexusMobile
  8071. || result.blackberry
  8072. || result.webos
  8073. || result.bada
  8074. ) {
  8075. result.mobile = t
  8076. }
  8077. // Graded Browser Support
  8078. // http://developer.yahoo.com/yui/articles/gbs
  8079. if (result.msedge ||
  8080. (result.msie && result.version >= 10) ||
  8081. (result.yandexbrowser && result.version >= 15) ||
  8082. (result.vivaldi && result.version >= 1.0) ||
  8083. (result.chrome && result.version >= 20) ||
  8084. (result.samsungBrowser && result.version >= 4) ||
  8085. (result.whale && compareVersions([result.version, '1.0']) === 1) ||
  8086. (result.mzbrowser && compareVersions([result.version, '6.0']) === 1) ||
  8087. (result.focus && compareVersions([result.version, '1.0']) === 1) ||
  8088. (result.firefox && result.version >= 20.0) ||
  8089. (result.safari && result.version >= 6) ||
  8090. (result.opera && result.version >= 10.0) ||
  8091. (result.ios && result.osversion && result.osversion.split(".")[0] >= 6) ||
  8092. (result.blackberry && result.version >= 10.1)
  8093. || (result.chromium && result.version >= 20)
  8094. ) {
  8095. result.a = t;
  8096. }
  8097. else if ((result.msie && result.version < 10) ||
  8098. (result.chrome && result.version < 20) ||
  8099. (result.firefox && result.version < 20.0) ||
  8100. (result.safari && result.version < 6) ||
  8101. (result.opera && result.version < 10.0) ||
  8102. (result.ios && result.osversion && result.osversion.split(".")[0] < 6)
  8103. || (result.chromium && result.version < 20)
  8104. ) {
  8105. result.c = t
  8106. } else result.x = t
  8107. return result
  8108. }
  8109. var bowser = detect(typeof navigator !== 'undefined' ? navigator.userAgent || '' : '')
  8110. bowser.test = function (browserList) {
  8111. for (var i = 0; i < browserList.length; ++i) {
  8112. var browserItem = browserList[i];
  8113. if (typeof browserItem=== 'string') {
  8114. if (browserItem in bowser) {
  8115. return true;
  8116. }
  8117. }
  8118. }
  8119. return false;
  8120. }
  8121. /**
  8122. * Get version precisions count
  8123. *
  8124. * @example
  8125. * getVersionPrecision("1.10.3") // 3
  8126. *
  8127. * @param {string} version
  8128. * @return {number}
  8129. */
  8130. function getVersionPrecision(version) {
  8131. return version.split(".").length;
  8132. }
  8133. /**
  8134. * Array::map polyfill
  8135. *
  8136. * @param {Array} arr
  8137. * @param {Function} iterator
  8138. * @return {Array}
  8139. */
  8140. function map(arr, iterator) {
  8141. var result = [], i;
  8142. if (Array.prototype.map) {
  8143. return Array.prototype.map.call(arr, iterator);
  8144. }
  8145. for (i = 0; i < arr.length; i++) {
  8146. result.push(iterator(arr[i]));
  8147. }
  8148. return result;
  8149. }
  8150. /**
  8151. * Calculate browser version weight
  8152. *
  8153. * @example
  8154. * compareVersions(['1.10.2.1', '1.8.2.1.90']) // 1
  8155. * compareVersions(['1.010.2.1', '1.09.2.1.90']); // 1
  8156. * compareVersions(['1.10.2.1', '1.10.2.1']); // 0
  8157. * compareVersions(['1.10.2.1', '1.0800.2']); // -1
  8158. *
  8159. * @param {Array<String>} versions versions to compare
  8160. * @return {Number} comparison result
  8161. */
  8162. function compareVersions(versions) {
  8163. // 1) get common precision for both versions, for example for "10.0" and "9" it should be 2
  8164. var precision = Math.max(getVersionPrecision(versions[0]), getVersionPrecision(versions[1]));
  8165. var chunks = map(versions, function (version) {
  8166. var delta = precision - getVersionPrecision(version);
  8167. // 2) "9" -> "9.0" (for precision = 2)
  8168. version = version + new Array(delta + 1).join(".0");
  8169. // 3) "9.0" -> ["000000000"", "000000009"]
  8170. return map(version.split("."), function (chunk) {
  8171. return new Array(20 - chunk.length).join("0") + chunk;
  8172. }).reverse();
  8173. });
  8174. // iterate in reverse order by reversed chunks array
  8175. while (--precision >= 0) {
  8176. // 4) compare: "000000009" > "000000010" = false (but "9" > "10" = true)
  8177. if (chunks[0][precision] > chunks[1][precision]) {
  8178. return 1;
  8179. }
  8180. else if (chunks[0][precision] === chunks[1][precision]) {
  8181. if (precision === 0) {
  8182. // all version chunks are same
  8183. return 0;
  8184. }
  8185. }
  8186. else {
  8187. return -1;
  8188. }
  8189. }
  8190. }
  8191. /**
  8192. * Check if browser is unsupported
  8193. *
  8194. * @example
  8195. * bowser.isUnsupportedBrowser({
  8196. * msie: "10",
  8197. * firefox: "23",
  8198. * chrome: "29",
  8199. * safari: "5.1",
  8200. * opera: "16",
  8201. * phantom: "534"
  8202. * });
  8203. *
  8204. * @param {Object} minVersions map of minimal version to browser
  8205. * @param {Boolean} [strictMode = false] flag to return false if browser wasn't found in map
  8206. * @param {String} [ua] user agent string
  8207. * @return {Boolean}
  8208. */
  8209. function isUnsupportedBrowser(minVersions, strictMode, ua) {
  8210. var _bowser = bowser;
  8211. // make strictMode param optional with ua param usage
  8212. if (typeof strictMode === 'string') {
  8213. ua = strictMode;
  8214. strictMode = void(0);
  8215. }
  8216. if (strictMode === void(0)) {
  8217. strictMode = false;
  8218. }
  8219. if (ua) {
  8220. _bowser = detect(ua);
  8221. }
  8222. var version = "" + _bowser.version;
  8223. for (var browser in minVersions) {
  8224. if (minVersions.hasOwnProperty(browser)) {
  8225. if (_bowser[browser]) {
  8226. if (typeof minVersions[browser] !== 'string') {
  8227. throw new Error('Browser version in the minVersion map should be a string: ' + browser + ': ' + String(minVersions));
  8228. }
  8229. // browser version and min supported version.
  8230. return compareVersions([version, minVersions[browser]]) < 0;
  8231. }
  8232. }
  8233. }
  8234. return strictMode; // not found
  8235. }
  8236. /**
  8237. * Check if browser is supported
  8238. *
  8239. * @param {Object} minVersions map of minimal version to browser
  8240. * @param {Boolean} [strictMode = false] flag to return false if browser wasn't found in map
  8241. * @param {String} [ua] user agent string
  8242. * @return {Boolean}
  8243. */
  8244. function check(minVersions, strictMode, ua) {
  8245. return !isUnsupportedBrowser(minVersions, strictMode, ua);
  8246. }
  8247. bowser.isUnsupportedBrowser = isUnsupportedBrowser;
  8248. bowser.compareVersions = compareVersions;
  8249. bowser.check = check;
  8250. /*
  8251. * Set our detect method to the main bowser object so we can
  8252. * reuse it to test other user agents.
  8253. * This is needed to implement future tests.
  8254. */
  8255. bowser._detect = detect;
  8256. /*
  8257. * Set our detect public method to the main bowser object
  8258. * This is needed to implement bowser in server side
  8259. */
  8260. bowser.detect = detect;
  8261. return bowser
  8262. });
  8263. },{}],84:[function(require,module,exports){
  8264. },{}],85:[function(require,module,exports){
  8265. (function (global,Buffer){(function (){
  8266. /*!
  8267. * The buffer module from node.js, for the browser.
  8268. *
  8269. * @author Feross Aboukhadijeh <http://feross.org>
  8270. * @license MIT
  8271. */
  8272. /* eslint-disable no-proto */
  8273. 'use strict'
  8274. var base64 = require('base64-js')
  8275. var ieee754 = require('ieee754')
  8276. var isArray = require('isarray')
  8277. exports.Buffer = Buffer
  8278. exports.SlowBuffer = SlowBuffer
  8279. exports.INSPECT_MAX_BYTES = 50
  8280. /**
  8281. * If `Buffer.TYPED_ARRAY_SUPPORT`:
  8282. * === true Use Uint8Array implementation (fastest)
  8283. * === false Use Object implementation (most compatible, even IE6)
  8284. *
  8285. * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,
  8286. * Opera 11.6+, iOS 4.2+.
  8287. *
  8288. * Due to various browser bugs, sometimes the Object implementation will be used even
  8289. * when the browser supports typed arrays.
  8290. *
  8291. * Note:
  8292. *
  8293. * - Firefox 4-29 lacks support for adding new properties to `Uint8Array` instances,
  8294. * See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438.
  8295. *
  8296. * - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function.
  8297. *
  8298. * - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of
  8299. * incorrect length in some situations.
  8300. * We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so they
  8301. * get the Object implementation, which is slower but behaves correctly.
  8302. */
  8303. Buffer.TYPED_ARRAY_SUPPORT = global.TYPED_ARRAY_SUPPORT !== undefined
  8304. ? global.TYPED_ARRAY_SUPPORT
  8305. : typedArraySupport()
  8306. /*
  8307. * Export kMaxLength after typed array support is determined.
  8308. */
  8309. exports.kMaxLength = kMaxLength()
  8310. function typedArraySupport () {
  8311. try {
  8312. var arr = new Uint8Array(1)
  8313. arr.__proto__ = {__proto__: Uint8Array.prototype, foo: function () { return 42 }}
  8314. return arr.foo() === 42 && // typed array instances can be augmented
  8315. typeof arr.subarray === 'function' && // chrome 9-10 lack `subarray`
  8316. arr.subarray(1, 1).byteLength === 0 // ie10 has broken `subarray`
  8317. } catch (e) {
  8318. return false
  8319. }
  8320. }
  8321. function kMaxLength () {
  8322. return Buffer.TYPED_ARRAY_SUPPORT
  8323. ? 0x7fffffff
  8324. : 0x3fffffff
  8325. }
  8326. function createBuffer (that, length) {
  8327. if (kMaxLength() < length) {
  8328. throw new RangeError('Invalid typed array length')
  8329. }
  8330. if (Buffer.TYPED_ARRAY_SUPPORT) {
  8331. // Return an augmented `Uint8Array` instance, for best performance
  8332. that = new Uint8Array(length)
  8333. that.__proto__ = Buffer.prototype
  8334. } else {
  8335. // Fallback: Return an object instance of the Buffer class
  8336. if (that === null) {
  8337. that = new Buffer(length)
  8338. }
  8339. that.length = length
  8340. }
  8341. return that
  8342. }
  8343. /**
  8344. * The Buffer constructor returns instances of `Uint8Array` that have their
  8345. * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of
  8346. * `Uint8Array`, so the returned instances will have all the node `Buffer` methods
  8347. * and the `Uint8Array` methods. Square bracket notation works as expected -- it
  8348. * returns a single octet.
  8349. *
  8350. * The `Uint8Array` prototype remains unmodified.
  8351. */
  8352. function Buffer (arg, encodingOrOffset, length) {
  8353. if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) {
  8354. return new Buffer(arg, encodingOrOffset, length)
  8355. }
  8356. // Common case.
  8357. if (typeof arg === 'number') {
  8358. if (typeof encodingOrOffset === 'string') {
  8359. throw new Error(
  8360. 'If encoding is specified then the first argument must be a string'
  8361. )
  8362. }
  8363. return allocUnsafe(this, arg)
  8364. }
  8365. return from(this, arg, encodingOrOffset, length)
  8366. }
  8367. Buffer.poolSize = 8192 // not used by this implementation
  8368. // TODO: Legacy, not needed anymore. Remove in next major version.
  8369. Buffer._augment = function (arr) {
  8370. arr.__proto__ = Buffer.prototype
  8371. return arr
  8372. }
  8373. function from (that, value, encodingOrOffset, length) {
  8374. if (typeof value === 'number') {
  8375. throw new TypeError('"value" argument must not be a number')
  8376. }
  8377. if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) {
  8378. return fromArrayBuffer(that, value, encodingOrOffset, length)
  8379. }
  8380. if (typeof value === 'string') {
  8381. return fromString(that, value, encodingOrOffset)
  8382. }
  8383. return fromObject(that, value)
  8384. }
  8385. /**
  8386. * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError
  8387. * if value is a number.
  8388. * Buffer.from(str[, encoding])
  8389. * Buffer.from(array)
  8390. * Buffer.from(buffer)
  8391. * Buffer.from(arrayBuffer[, byteOffset[, length]])
  8392. **/
  8393. Buffer.from = function (value, encodingOrOffset, length) {
  8394. return from(null, value, encodingOrOffset, length)
  8395. }
  8396. if (Buffer.TYPED_ARRAY_SUPPORT) {
  8397. Buffer.prototype.__proto__ = Uint8Array.prototype
  8398. Buffer.__proto__ = Uint8Array
  8399. if (typeof Symbol !== 'undefined' && Symbol.species &&
  8400. Buffer[Symbol.species] === Buffer) {
  8401. // Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97
  8402. Object.defineProperty(Buffer, Symbol.species, {
  8403. value: null,
  8404. configurable: true
  8405. })
  8406. }
  8407. }
  8408. function assertSize (size) {
  8409. if (typeof size !== 'number') {
  8410. throw new TypeError('"size" argument must be a number')
  8411. } else if (size < 0) {
  8412. throw new RangeError('"size" argument must not be negative')
  8413. }
  8414. }
  8415. function alloc (that, size, fill, encoding) {
  8416. assertSize(size)
  8417. if (size <= 0) {
  8418. return createBuffer(that, size)
  8419. }
  8420. if (fill !== undefined) {
  8421. // Only pay attention to encoding if it's a string. This
  8422. // prevents accidentally sending in a number that would
  8423. // be interpretted as a start offset.
  8424. return typeof encoding === 'string'
  8425. ? createBuffer(that, size).fill(fill, encoding)
  8426. : createBuffer(that, size).fill(fill)
  8427. }
  8428. return createBuffer(that, size)
  8429. }
  8430. /**
  8431. * Creates a new filled Buffer instance.
  8432. * alloc(size[, fill[, encoding]])
  8433. **/
  8434. Buffer.alloc = function (size, fill, encoding) {
  8435. return alloc(null, size, fill, encoding)
  8436. }
  8437. function allocUnsafe (that, size) {
  8438. assertSize(size)
  8439. that = createBuffer(that, size < 0 ? 0 : checked(size) | 0)
  8440. if (!Buffer.TYPED_ARRAY_SUPPORT) {
  8441. for (var i = 0; i < size; ++i) {
  8442. that[i] = 0
  8443. }
  8444. }
  8445. return that
  8446. }
  8447. /**
  8448. * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.
  8449. * */
  8450. Buffer.allocUnsafe = function (size) {
  8451. return allocUnsafe(null, size)
  8452. }
  8453. /**
  8454. * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
  8455. */
  8456. Buffer.allocUnsafeSlow = function (size) {
  8457. return allocUnsafe(null, size)
  8458. }
  8459. function fromString (that, string, encoding) {
  8460. if (typeof encoding !== 'string' || encoding === '') {
  8461. encoding = 'utf8'
  8462. }
  8463. if (!Buffer.isEncoding(encoding)) {
  8464. throw new TypeError('"encoding" must be a valid string encoding')
  8465. }
  8466. var length = byteLength(string, encoding) | 0
  8467. that = createBuffer(that, length)
  8468. var actual = that.write(string, encoding)
  8469. if (actual !== length) {
  8470. // Writing a hex string, for example, that contains invalid characters will
  8471. // cause everything after the first invalid character to be ignored. (e.g.
  8472. // 'abxxcd' will be treated as 'ab')
  8473. that = that.slice(0, actual)
  8474. }
  8475. return that
  8476. }
  8477. function fromArrayLike (that, array) {
  8478. var length = array.length < 0 ? 0 : checked(array.length) | 0
  8479. that = createBuffer(that, length)
  8480. for (var i = 0; i < length; i += 1) {
  8481. that[i] = array[i] & 255
  8482. }
  8483. return that
  8484. }
  8485. function fromArrayBuffer (that, array, byteOffset, length) {
  8486. array.byteLength // this throws if `array` is not a valid ArrayBuffer
  8487. if (byteOffset < 0 || array.byteLength < byteOffset) {
  8488. throw new RangeError('\'offset\' is out of bounds')
  8489. }
  8490. if (array.byteLength < byteOffset + (length || 0)) {
  8491. throw new RangeError('\'length\' is out of bounds')
  8492. }
  8493. if (byteOffset === undefined && length === undefined) {
  8494. array = new Uint8Array(array)
  8495. } else if (length === undefined) {
  8496. array = new Uint8Array(array, byteOffset)
  8497. } else {
  8498. array = new Uint8Array(array, byteOffset, length)
  8499. }
  8500. if (Buffer.TYPED_ARRAY_SUPPORT) {
  8501. // Return an augmented `Uint8Array` instance, for best performance
  8502. that = array
  8503. that.__proto__ = Buffer.prototype
  8504. } else {
  8505. // Fallback: Return an object instance of the Buffer class
  8506. that = fromArrayLike(that, array)
  8507. }
  8508. return that
  8509. }
  8510. function fromObject (that, obj) {
  8511. if (Buffer.isBuffer(obj)) {
  8512. var len = checked(obj.length) | 0
  8513. that = createBuffer(that, len)
  8514. if (that.length === 0) {
  8515. return that
  8516. }
  8517. obj.copy(that, 0, 0, len)
  8518. return that
  8519. }
  8520. if (obj) {
  8521. if ((typeof ArrayBuffer !== 'undefined' &&
  8522. obj.buffer instanceof ArrayBuffer) || 'length' in obj) {
  8523. if (typeof obj.length !== 'number' || isnan(obj.length)) {
  8524. return createBuffer(that, 0)
  8525. }
  8526. return fromArrayLike(that, obj)
  8527. }
  8528. if (obj.type === 'Buffer' && isArray(obj.data)) {
  8529. return fromArrayLike(that, obj.data)
  8530. }
  8531. }
  8532. throw new TypeError('First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.')
  8533. }
  8534. function checked (length) {
  8535. // Note: cannot use `length < kMaxLength()` here because that fails when
  8536. // length is NaN (which is otherwise coerced to zero.)
  8537. if (length >= kMaxLength()) {
  8538. throw new RangeError('Attempt to allocate Buffer larger than maximum ' +
  8539. 'size: 0x' + kMaxLength().toString(16) + ' bytes')
  8540. }
  8541. return length | 0
  8542. }
  8543. function SlowBuffer (length) {
  8544. if (+length != length) { // eslint-disable-line eqeqeq
  8545. length = 0
  8546. }
  8547. return Buffer.alloc(+length)
  8548. }
  8549. Buffer.isBuffer = function isBuffer (b) {
  8550. return !!(b != null && b._isBuffer)
  8551. }
  8552. Buffer.compare = function compare (a, b) {
  8553. if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {
  8554. throw new TypeError('Arguments must be Buffers')
  8555. }
  8556. if (a === b) return 0
  8557. var x = a.length
  8558. var y = b.length
  8559. for (var i = 0, len = Math.min(x, y); i < len; ++i) {
  8560. if (a[i] !== b[i]) {
  8561. x = a[i]
  8562. y = b[i]
  8563. break
  8564. }
  8565. }
  8566. if (x < y) return -1
  8567. if (y < x) return 1
  8568. return 0
  8569. }
  8570. Buffer.isEncoding = function isEncoding (encoding) {
  8571. switch (String(encoding).toLowerCase()) {
  8572. case 'hex':
  8573. case 'utf8':
  8574. case 'utf-8':
  8575. case 'ascii':
  8576. case 'latin1':
  8577. case 'binary':
  8578. case 'base64':
  8579. case 'ucs2':
  8580. case 'ucs-2':
  8581. case 'utf16le':
  8582. case 'utf-16le':
  8583. return true
  8584. default:
  8585. return false
  8586. }
  8587. }
  8588. Buffer.concat = function concat (list, length) {
  8589. if (!isArray(list)) {
  8590. throw new TypeError('"list" argument must be an Array of Buffers')
  8591. }
  8592. if (list.length === 0) {
  8593. return Buffer.alloc(0)
  8594. }
  8595. var i
  8596. if (length === undefined) {
  8597. length = 0
  8598. for (i = 0; i < list.length; ++i) {
  8599. length += list[i].length
  8600. }
  8601. }
  8602. var buffer = Buffer.allocUnsafe(length)
  8603. var pos = 0
  8604. for (i = 0; i < list.length; ++i) {
  8605. var buf = list[i]
  8606. if (!Buffer.isBuffer(buf)) {
  8607. throw new TypeError('"list" argument must be an Array of Buffers')
  8608. }
  8609. buf.copy(buffer, pos)
  8610. pos += buf.length
  8611. }
  8612. return buffer
  8613. }
  8614. function byteLength (string, encoding) {
  8615. if (Buffer.isBuffer(string)) {
  8616. return string.length
  8617. }
  8618. if (typeof ArrayBuffer !== 'undefined' && typeof ArrayBuffer.isView === 'function' &&
  8619. (ArrayBuffer.isView(string) || string instanceof ArrayBuffer)) {
  8620. return string.byteLength
  8621. }
  8622. if (typeof string !== 'string') {
  8623. string = '' + string
  8624. }
  8625. var len = string.length
  8626. if (len === 0) return 0
  8627. // Use a for loop to avoid recursion
  8628. var loweredCase = false
  8629. for (;;) {
  8630. switch (encoding) {
  8631. case 'ascii':
  8632. case 'latin1':
  8633. case 'binary':
  8634. return len
  8635. case 'utf8':
  8636. case 'utf-8':
  8637. case undefined:
  8638. return utf8ToBytes(string).length
  8639. case 'ucs2':
  8640. case 'ucs-2':
  8641. case 'utf16le':
  8642. case 'utf-16le':
  8643. return len * 2
  8644. case 'hex':
  8645. return len >>> 1
  8646. case 'base64':
  8647. return base64ToBytes(string).length
  8648. default:
  8649. if (loweredCase) return utf8ToBytes(string).length // assume utf8
  8650. encoding = ('' + encoding).toLowerCase()
  8651. loweredCase = true
  8652. }
  8653. }
  8654. }
  8655. Buffer.byteLength = byteLength
  8656. function slowToString (encoding, start, end) {
  8657. var loweredCase = false
  8658. // No need to verify that "this.length <= MAX_UINT32" since it's a read-only
  8659. // property of a typed array.
  8660. // This behaves neither like String nor Uint8Array in that we set start/end
  8661. // to their upper/lower bounds if the value passed is out of range.
  8662. // undefined is handled specially as per ECMA-262 6th Edition,
  8663. // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.
  8664. if (start === undefined || start < 0) {
  8665. start = 0
  8666. }
  8667. // Return early if start > this.length. Done here to prevent potential uint32
  8668. // coercion fail below.
  8669. if (start > this.length) {
  8670. return ''
  8671. }
  8672. if (end === undefined || end > this.length) {
  8673. end = this.length
  8674. }
  8675. if (end <= 0) {
  8676. return ''
  8677. }
  8678. // Force coersion to uint32. This will also coerce falsey/NaN values to 0.
  8679. end >>>= 0
  8680. start >>>= 0
  8681. if (end <= start) {
  8682. return ''
  8683. }
  8684. if (!encoding) encoding = 'utf8'
  8685. while (true) {
  8686. switch (encoding) {
  8687. case 'hex':
  8688. return hexSlice(this, start, end)
  8689. case 'utf8':
  8690. case 'utf-8':
  8691. return utf8Slice(this, start, end)
  8692. case 'ascii':
  8693. return asciiSlice(this, start, end)
  8694. case 'latin1':
  8695. case 'binary':
  8696. return latin1Slice(this, start, end)
  8697. case 'base64':
  8698. return base64Slice(this, start, end)
  8699. case 'ucs2':
  8700. case 'ucs-2':
  8701. case 'utf16le':
  8702. case 'utf-16le':
  8703. return utf16leSlice(this, start, end)
  8704. default:
  8705. if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
  8706. encoding = (encoding + '').toLowerCase()
  8707. loweredCase = true
  8708. }
  8709. }
  8710. }
  8711. // The property is used by `Buffer.isBuffer` and `is-buffer` (in Safari 5-7) to detect
  8712. // Buffer instances.
  8713. Buffer.prototype._isBuffer = true
  8714. function swap (b, n, m) {
  8715. var i = b[n]
  8716. b[n] = b[m]
  8717. b[m] = i
  8718. }
  8719. Buffer.prototype.swap16 = function swap16 () {
  8720. var len = this.length
  8721. if (len % 2 !== 0) {
  8722. throw new RangeError('Buffer size must be a multiple of 16-bits')
  8723. }
  8724. for (var i = 0; i < len; i += 2) {
  8725. swap(this, i, i + 1)
  8726. }
  8727. return this
  8728. }
  8729. Buffer.prototype.swap32 = function swap32 () {
  8730. var len = this.length
  8731. if (len % 4 !== 0) {
  8732. throw new RangeError('Buffer size must be a multiple of 32-bits')
  8733. }
  8734. for (var i = 0; i < len; i += 4) {
  8735. swap(this, i, i + 3)
  8736. swap(this, i + 1, i + 2)
  8737. }
  8738. return this
  8739. }
  8740. Buffer.prototype.swap64 = function swap64 () {
  8741. var len = this.length
  8742. if (len % 8 !== 0) {
  8743. throw new RangeError('Buffer size must be a multiple of 64-bits')
  8744. }
  8745. for (var i = 0; i < len; i += 8) {
  8746. swap(this, i, i + 7)
  8747. swap(this, i + 1, i + 6)
  8748. swap(this, i + 2, i + 5)
  8749. swap(this, i + 3, i + 4)
  8750. }
  8751. return this
  8752. }
  8753. Buffer.prototype.toString = function toString () {
  8754. var length = this.length | 0
  8755. if (length === 0) return ''
  8756. if (arguments.length === 0) return utf8Slice(this, 0, length)
  8757. return slowToString.apply(this, arguments)
  8758. }
  8759. Buffer.prototype.equals = function equals (b) {
  8760. if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')
  8761. if (this === b) return true
  8762. return Buffer.compare(this, b) === 0
  8763. }
  8764. Buffer.prototype.inspect = function inspect () {
  8765. var str = ''
  8766. var max = exports.INSPECT_MAX_BYTES
  8767. if (this.length > 0) {
  8768. str = this.toString('hex', 0, max).match(/.{2}/g).join(' ')
  8769. if (this.length > max) str += ' ... '
  8770. }
  8771. return '<Buffer ' + str + '>'
  8772. }
  8773. Buffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) {
  8774. if (!Buffer.isBuffer(target)) {
  8775. throw new TypeError('Argument must be a Buffer')
  8776. }
  8777. if (start === undefined) {
  8778. start = 0
  8779. }
  8780. if (end === undefined) {
  8781. end = target ? target.length : 0
  8782. }
  8783. if (thisStart === undefined) {
  8784. thisStart = 0
  8785. }
  8786. if (thisEnd === undefined) {
  8787. thisEnd = this.length
  8788. }
  8789. if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {
  8790. throw new RangeError('out of range index')
  8791. }
  8792. if (thisStart >= thisEnd && start >= end) {
  8793. return 0
  8794. }
  8795. if (thisStart >= thisEnd) {
  8796. return -1
  8797. }
  8798. if (start >= end) {
  8799. return 1
  8800. }
  8801. start >>>= 0
  8802. end >>>= 0
  8803. thisStart >>>= 0
  8804. thisEnd >>>= 0
  8805. if (this === target) return 0
  8806. var x = thisEnd - thisStart
  8807. var y = end - start
  8808. var len = Math.min(x, y)
  8809. var thisCopy = this.slice(thisStart, thisEnd)
  8810. var targetCopy = target.slice(start, end)
  8811. for (var i = 0; i < len; ++i) {
  8812. if (thisCopy[i] !== targetCopy[i]) {
  8813. x = thisCopy[i]
  8814. y = targetCopy[i]
  8815. break
  8816. }
  8817. }
  8818. if (x < y) return -1
  8819. if (y < x) return 1
  8820. return 0
  8821. }
  8822. // Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,
  8823. // OR the last index of `val` in `buffer` at offset <= `byteOffset`.
  8824. //
  8825. // Arguments:
  8826. // - buffer - a Buffer to search
  8827. // - val - a string, Buffer, or number
  8828. // - byteOffset - an index into `buffer`; will be clamped to an int32
  8829. // - encoding - an optional encoding, relevant is val is a string
  8830. // - dir - true for indexOf, false for lastIndexOf
  8831. function bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {
  8832. // Empty buffer means no match
  8833. if (buffer.length === 0) return -1
  8834. // Normalize byteOffset
  8835. if (typeof byteOffset === 'string') {
  8836. encoding = byteOffset
  8837. byteOffset = 0
  8838. } else if (byteOffset > 0x7fffffff) {
  8839. byteOffset = 0x7fffffff
  8840. } else if (byteOffset < -0x80000000) {
  8841. byteOffset = -0x80000000
  8842. }
  8843. byteOffset = +byteOffset // Coerce to Number.
  8844. if (isNaN(byteOffset)) {
  8845. // byteOffset: it it's undefined, null, NaN, "foo", etc, search whole buffer
  8846. byteOffset = dir ? 0 : (buffer.length - 1)
  8847. }
  8848. // Normalize byteOffset: negative offsets start from the end of the buffer
  8849. if (byteOffset < 0) byteOffset = buffer.length + byteOffset
  8850. if (byteOffset >= buffer.length) {
  8851. if (dir) return -1
  8852. else byteOffset = buffer.length - 1
  8853. } else if (byteOffset < 0) {
  8854. if (dir) byteOffset = 0
  8855. else return -1
  8856. }
  8857. // Normalize val
  8858. if (typeof val === 'string') {
  8859. val = Buffer.from(val, encoding)
  8860. }
  8861. // Finally, search either indexOf (if dir is true) or lastIndexOf
  8862. if (Buffer.isBuffer(val)) {
  8863. // Special case: looking for empty string/buffer always fails
  8864. if (val.length === 0) {
  8865. return -1
  8866. }
  8867. return arrayIndexOf(buffer, val, byteOffset, encoding, dir)
  8868. } else if (typeof val === 'number') {
  8869. val = val & 0xFF // Search for a byte value [0-255]
  8870. if (Buffer.TYPED_ARRAY_SUPPORT &&
  8871. typeof Uint8Array.prototype.indexOf === 'function') {
  8872. if (dir) {
  8873. return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset)
  8874. } else {
  8875. return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset)
  8876. }
  8877. }
  8878. return arrayIndexOf(buffer, [ val ], byteOffset, encoding, dir)
  8879. }
  8880. throw new TypeError('val must be string, number or Buffer')
  8881. }
  8882. function arrayIndexOf (arr, val, byteOffset, encoding, dir) {
  8883. var indexSize = 1
  8884. var arrLength = arr.length
  8885. var valLength = val.length
  8886. if (encoding !== undefined) {
  8887. encoding = String(encoding).toLowerCase()
  8888. if (encoding === 'ucs2' || encoding === 'ucs-2' ||
  8889. encoding === 'utf16le' || encoding === 'utf-16le') {
  8890. if (arr.length < 2 || val.length < 2) {
  8891. return -1
  8892. }
  8893. indexSize = 2
  8894. arrLength /= 2
  8895. valLength /= 2
  8896. byteOffset /= 2
  8897. }
  8898. }
  8899. function read (buf, i) {
  8900. if (indexSize === 1) {
  8901. return buf[i]
  8902. } else {
  8903. return buf.readUInt16BE(i * indexSize)
  8904. }
  8905. }
  8906. var i
  8907. if (dir) {
  8908. var foundIndex = -1
  8909. for (i = byteOffset; i < arrLength; i++) {
  8910. if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {
  8911. if (foundIndex === -1) foundIndex = i
  8912. if (i - foundIndex + 1 === valLength) return foundIndex * indexSize
  8913. } else {
  8914. if (foundIndex !== -1) i -= i - foundIndex
  8915. foundIndex = -1
  8916. }
  8917. }
  8918. } else {
  8919. if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength
  8920. for (i = byteOffset; i >= 0; i--) {
  8921. var found = true
  8922. for (var j = 0; j < valLength; j++) {
  8923. if (read(arr, i + j) !== read(val, j)) {
  8924. found = false
  8925. break
  8926. }
  8927. }
  8928. if (found) return i
  8929. }
  8930. }
  8931. return -1
  8932. }
  8933. Buffer.prototype.includes = function includes (val, byteOffset, encoding) {
  8934. return this.indexOf(val, byteOffset, encoding) !== -1
  8935. }
  8936. Buffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) {
  8937. return bidirectionalIndexOf(this, val, byteOffset, encoding, true)
  8938. }
  8939. Buffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) {
  8940. return bidirectionalIndexOf(this, val, byteOffset, encoding, false)
  8941. }
  8942. function hexWrite (buf, string, offset, length) {
  8943. offset = Number(offset) || 0
  8944. var remaining = buf.length - offset
  8945. if (!length) {
  8946. length = remaining
  8947. } else {
  8948. length = Number(length)
  8949. if (length > remaining) {
  8950. length = remaining
  8951. }
  8952. }
  8953. // must be an even number of digits
  8954. var strLen = string.length
  8955. if (strLen % 2 !== 0) throw new TypeError('Invalid hex string')
  8956. if (length > strLen / 2) {
  8957. length = strLen / 2
  8958. }
  8959. for (var i = 0; i < length; ++i) {
  8960. var parsed = parseInt(string.substr(i * 2, 2), 16)
  8961. if (isNaN(parsed)) return i
  8962. buf[offset + i] = parsed
  8963. }
  8964. return i
  8965. }
  8966. function utf8Write (buf, string, offset, length) {
  8967. return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)
  8968. }
  8969. function asciiWrite (buf, string, offset, length) {
  8970. return blitBuffer(asciiToBytes(string), buf, offset, length)
  8971. }
  8972. function latin1Write (buf, string, offset, length) {
  8973. return asciiWrite(buf, string, offset, length)
  8974. }
  8975. function base64Write (buf, string, offset, length) {
  8976. return blitBuffer(base64ToBytes(string), buf, offset, length)
  8977. }
  8978. function ucs2Write (buf, string, offset, length) {
  8979. return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)
  8980. }
  8981. Buffer.prototype.write = function write (string, offset, length, encoding) {
  8982. // Buffer#write(string)
  8983. if (offset === undefined) {
  8984. encoding = 'utf8'
  8985. length = this.length
  8986. offset = 0
  8987. // Buffer#write(string, encoding)
  8988. } else if (length === undefined && typeof offset === 'string') {
  8989. encoding = offset
  8990. length = this.length
  8991. offset = 0
  8992. // Buffer#write(string, offset[, length][, encoding])
  8993. } else if (isFinite(offset)) {
  8994. offset = offset | 0
  8995. if (isFinite(length)) {
  8996. length = length | 0
  8997. if (encoding === undefined) encoding = 'utf8'
  8998. } else {
  8999. encoding = length
  9000. length = undefined
  9001. }
  9002. // legacy write(string, encoding, offset, length) - remove in v0.13
  9003. } else {
  9004. throw new Error(
  9005. 'Buffer.write(string, encoding, offset[, length]) is no longer supported'
  9006. )
  9007. }
  9008. var remaining = this.length - offset
  9009. if (length === undefined || length > remaining) length = remaining
  9010. if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {
  9011. throw new RangeError('Attempt to write outside buffer bounds')
  9012. }
  9013. if (!encoding) encoding = 'utf8'
  9014. var loweredCase = false
  9015. for (;;) {
  9016. switch (encoding) {
  9017. case 'hex':
  9018. return hexWrite(this, string, offset, length)
  9019. case 'utf8':
  9020. case 'utf-8':
  9021. return utf8Write(this, string, offset, length)
  9022. case 'ascii':
  9023. return asciiWrite(this, string, offset, length)
  9024. case 'latin1':
  9025. case 'binary':
  9026. return latin1Write(this, string, offset, length)
  9027. case 'base64':
  9028. // Warning: maxLength not taken into account in base64Write
  9029. return base64Write(this, string, offset, length)
  9030. case 'ucs2':
  9031. case 'ucs-2':
  9032. case 'utf16le':
  9033. case 'utf-16le':
  9034. return ucs2Write(this, string, offset, length)
  9035. default:
  9036. if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
  9037. encoding = ('' + encoding).toLowerCase()
  9038. loweredCase = true
  9039. }
  9040. }
  9041. }
  9042. Buffer.prototype.toJSON = function toJSON () {
  9043. return {
  9044. type: 'Buffer',
  9045. data: Array.prototype.slice.call(this._arr || this, 0)
  9046. }
  9047. }
  9048. function base64Slice (buf, start, end) {
  9049. if (start === 0 && end === buf.length) {
  9050. return base64.fromByteArray(buf)
  9051. } else {
  9052. return base64.fromByteArray(buf.slice(start, end))
  9053. }
  9054. }
  9055. function utf8Slice (buf, start, end) {
  9056. end = Math.min(buf.length, end)
  9057. var res = []
  9058. var i = start
  9059. while (i < end) {
  9060. var firstByte = buf[i]
  9061. var codePoint = null
  9062. var bytesPerSequence = (firstByte > 0xEF) ? 4
  9063. : (firstByte > 0xDF) ? 3
  9064. : (firstByte > 0xBF) ? 2
  9065. : 1
  9066. if (i + bytesPerSequence <= end) {
  9067. var secondByte, thirdByte, fourthByte, tempCodePoint
  9068. switch (bytesPerSequence) {
  9069. case 1:
  9070. if (firstByte < 0x80) {
  9071. codePoint = firstByte
  9072. }
  9073. break
  9074. case 2:
  9075. secondByte = buf[i + 1]
  9076. if ((secondByte & 0xC0) === 0x80) {
  9077. tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F)
  9078. if (tempCodePoint > 0x7F) {
  9079. codePoint = tempCodePoint
  9080. }
  9081. }
  9082. break
  9083. case 3:
  9084. secondByte = buf[i + 1]
  9085. thirdByte = buf[i + 2]
  9086. if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {
  9087. tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F)
  9088. if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {
  9089. codePoint = tempCodePoint
  9090. }
  9091. }
  9092. break
  9093. case 4:
  9094. secondByte = buf[i + 1]
  9095. thirdByte = buf[i + 2]
  9096. fourthByte = buf[i + 3]
  9097. if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {
  9098. tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F)
  9099. if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {
  9100. codePoint = tempCodePoint
  9101. }
  9102. }
  9103. }
  9104. }
  9105. if (codePoint === null) {
  9106. // we did not generate a valid codePoint so insert a
  9107. // replacement char (U+FFFD) and advance only 1 byte
  9108. codePoint = 0xFFFD
  9109. bytesPerSequence = 1
  9110. } else if (codePoint > 0xFFFF) {
  9111. // encode to utf16 (surrogate pair dance)
  9112. codePoint -= 0x10000
  9113. res.push(codePoint >>> 10 & 0x3FF | 0xD800)
  9114. codePoint = 0xDC00 | codePoint & 0x3FF
  9115. }
  9116. res.push(codePoint)
  9117. i += bytesPerSequence
  9118. }
  9119. return decodeCodePointsArray(res)
  9120. }
  9121. // Based on http://stackoverflow.com/a/22747272/680742, the browser with
  9122. // the lowest limit is Chrome, with 0x10000 args.
  9123. // We go 1 magnitude less, for safety
  9124. var MAX_ARGUMENTS_LENGTH = 0x1000
  9125. function decodeCodePointsArray (codePoints) {
  9126. var len = codePoints.length
  9127. if (len <= MAX_ARGUMENTS_LENGTH) {
  9128. return String.fromCharCode.apply(String, codePoints) // avoid extra slice()
  9129. }
  9130. // Decode in chunks to avoid "call stack size exceeded".
  9131. var res = ''
  9132. var i = 0
  9133. while (i < len) {
  9134. res += String.fromCharCode.apply(
  9135. String,
  9136. codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)
  9137. )
  9138. }
  9139. return res
  9140. }
  9141. function asciiSlice (buf, start, end) {
  9142. var ret = ''
  9143. end = Math.min(buf.length, end)
  9144. for (var i = start; i < end; ++i) {
  9145. ret += String.fromCharCode(buf[i] & 0x7F)
  9146. }
  9147. return ret
  9148. }
  9149. function latin1Slice (buf, start, end) {
  9150. var ret = ''
  9151. end = Math.min(buf.length, end)
  9152. for (var i = start; i < end; ++i) {
  9153. ret += String.fromCharCode(buf[i])
  9154. }
  9155. return ret
  9156. }
  9157. function hexSlice (buf, start, end) {
  9158. var len = buf.length
  9159. if (!start || start < 0) start = 0
  9160. if (!end || end < 0 || end > len) end = len
  9161. var out = ''
  9162. for (var i = start; i < end; ++i) {
  9163. out += toHex(buf[i])
  9164. }
  9165. return out
  9166. }
  9167. function utf16leSlice (buf, start, end) {
  9168. var bytes = buf.slice(start, end)
  9169. var res = ''
  9170. for (var i = 0; i < bytes.length; i += 2) {
  9171. res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256)
  9172. }
  9173. return res
  9174. }
  9175. Buffer.prototype.slice = function slice (start, end) {
  9176. var len = this.length
  9177. start = ~~start
  9178. end = end === undefined ? len : ~~end
  9179. if (start < 0) {
  9180. start += len
  9181. if (start < 0) start = 0
  9182. } else if (start > len) {
  9183. start = len
  9184. }
  9185. if (end < 0) {
  9186. end += len
  9187. if (end < 0) end = 0
  9188. } else if (end > len) {
  9189. end = len
  9190. }
  9191. if (end < start) end = start
  9192. var newBuf
  9193. if (Buffer.TYPED_ARRAY_SUPPORT) {
  9194. newBuf = this.subarray(start, end)
  9195. newBuf.__proto__ = Buffer.prototype
  9196. } else {
  9197. var sliceLen = end - start
  9198. newBuf = new Buffer(sliceLen, undefined)
  9199. for (var i = 0; i < sliceLen; ++i) {
  9200. newBuf[i] = this[i + start]
  9201. }
  9202. }
  9203. return newBuf
  9204. }
  9205. /*
  9206. * Need to make sure that buffer isn't trying to write out of bounds.
  9207. */
  9208. function checkOffset (offset, ext, length) {
  9209. if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')
  9210. if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')
  9211. }
  9212. Buffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {
  9213. offset = offset | 0
  9214. byteLength = byteLength | 0
  9215. if (!noAssert) checkOffset(offset, byteLength, this.length)
  9216. var val = this[offset]
  9217. var mul = 1
  9218. var i = 0
  9219. while (++i < byteLength && (mul *= 0x100)) {
  9220. val += this[offset + i] * mul
  9221. }
  9222. return val
  9223. }
  9224. Buffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {
  9225. offset = offset | 0
  9226. byteLength = byteLength | 0
  9227. if (!noAssert) {
  9228. checkOffset(offset, byteLength, this.length)
  9229. }
  9230. var val = this[offset + --byteLength]
  9231. var mul = 1
  9232. while (byteLength > 0 && (mul *= 0x100)) {
  9233. val += this[offset + --byteLength] * mul
  9234. }
  9235. return val
  9236. }
  9237. Buffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {
  9238. if (!noAssert) checkOffset(offset, 1, this.length)
  9239. return this[offset]
  9240. }
  9241. Buffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {
  9242. if (!noAssert) checkOffset(offset, 2, this.length)
  9243. return this[offset] | (this[offset + 1] << 8)
  9244. }
  9245. Buffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {
  9246. if (!noAssert) checkOffset(offset, 2, this.length)
  9247. return (this[offset] << 8) | this[offset + 1]
  9248. }
  9249. Buffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {
  9250. if (!noAssert) checkOffset(offset, 4, this.length)
  9251. return ((this[offset]) |
  9252. (this[offset + 1] << 8) |
  9253. (this[offset + 2] << 16)) +
  9254. (this[offset + 3] * 0x1000000)
  9255. }
  9256. Buffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {
  9257. if (!noAssert) checkOffset(offset, 4, this.length)
  9258. return (this[offset] * 0x1000000) +
  9259. ((this[offset + 1] << 16) |
  9260. (this[offset + 2] << 8) |
  9261. this[offset + 3])
  9262. }
  9263. Buffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {
  9264. offset = offset | 0
  9265. byteLength = byteLength | 0
  9266. if (!noAssert) checkOffset(offset, byteLength, this.length)
  9267. var val = this[offset]
  9268. var mul = 1
  9269. var i = 0
  9270. while (++i < byteLength && (mul *= 0x100)) {
  9271. val += this[offset + i] * mul
  9272. }
  9273. mul *= 0x80
  9274. if (val >= mul) val -= Math.pow(2, 8 * byteLength)
  9275. return val
  9276. }
  9277. Buffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {
  9278. offset = offset | 0
  9279. byteLength = byteLength | 0
  9280. if (!noAssert) checkOffset(offset, byteLength, this.length)
  9281. var i = byteLength
  9282. var mul = 1
  9283. var val = this[offset + --i]
  9284. while (i > 0 && (mul *= 0x100)) {
  9285. val += this[offset + --i] * mul
  9286. }
  9287. mul *= 0x80
  9288. if (val >= mul) val -= Math.pow(2, 8 * byteLength)
  9289. return val
  9290. }
  9291. Buffer.prototype.readInt8 = function readInt8 (offset, noAssert) {
  9292. if (!noAssert) checkOffset(offset, 1, this.length)
  9293. if (!(this[offset] & 0x80)) return (this[offset])
  9294. return ((0xff - this[offset] + 1) * -1)
  9295. }
  9296. Buffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {
  9297. if (!noAssert) checkOffset(offset, 2, this.length)
  9298. var val = this[offset] | (this[offset + 1] << 8)
  9299. return (val & 0x8000) ? val | 0xFFFF0000 : val
  9300. }
  9301. Buffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {
  9302. if (!noAssert) checkOffset(offset, 2, this.length)
  9303. var val = this[offset + 1] | (this[offset] << 8)
  9304. return (val & 0x8000) ? val | 0xFFFF0000 : val
  9305. }
  9306. Buffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {
  9307. if (!noAssert) checkOffset(offset, 4, this.length)
  9308. return (this[offset]) |
  9309. (this[offset + 1] << 8) |
  9310. (this[offset + 2] << 16) |
  9311. (this[offset + 3] << 24)
  9312. }
  9313. Buffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {
  9314. if (!noAssert) checkOffset(offset, 4, this.length)
  9315. return (this[offset] << 24) |
  9316. (this[offset + 1] << 16) |
  9317. (this[offset + 2] << 8) |
  9318. (this[offset + 3])
  9319. }
  9320. Buffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {
  9321. if (!noAssert) checkOffset(offset, 4, this.length)
  9322. return ieee754.read(this, offset, true, 23, 4)
  9323. }
  9324. Buffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {
  9325. if (!noAssert) checkOffset(offset, 4, this.length)
  9326. return ieee754.read(this, offset, false, 23, 4)
  9327. }
  9328. Buffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {
  9329. if (!noAssert) checkOffset(offset, 8, this.length)
  9330. return ieee754.read(this, offset, true, 52, 8)
  9331. }
  9332. Buffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {
  9333. if (!noAssert) checkOffset(offset, 8, this.length)
  9334. return ieee754.read(this, offset, false, 52, 8)
  9335. }
  9336. function checkInt (buf, value, offset, ext, max, min) {
  9337. if (!Buffer.isBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance')
  9338. if (value > max || value < min) throw new RangeError('"value" argument is out of bounds')
  9339. if (offset + ext > buf.length) throw new RangeError('Index out of range')
  9340. }
  9341. Buffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {
  9342. value = +value
  9343. offset = offset | 0
  9344. byteLength = byteLength | 0
  9345. if (!noAssert) {
  9346. var maxBytes = Math.pow(2, 8 * byteLength) - 1
  9347. checkInt(this, value, offset, byteLength, maxBytes, 0)
  9348. }
  9349. var mul = 1
  9350. var i = 0
  9351. this[offset] = value & 0xFF
  9352. while (++i < byteLength && (mul *= 0x100)) {
  9353. this[offset + i] = (value / mul) & 0xFF
  9354. }
  9355. return offset + byteLength
  9356. }
  9357. Buffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {
  9358. value = +value
  9359. offset = offset | 0
  9360. byteLength = byteLength | 0
  9361. if (!noAssert) {
  9362. var maxBytes = Math.pow(2, 8 * byteLength) - 1
  9363. checkInt(this, value, offset, byteLength, maxBytes, 0)
  9364. }
  9365. var i = byteLength - 1
  9366. var mul = 1
  9367. this[offset + i] = value & 0xFF
  9368. while (--i >= 0 && (mul *= 0x100)) {
  9369. this[offset + i] = (value / mul) & 0xFF
  9370. }
  9371. return offset + byteLength
  9372. }
  9373. Buffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {
  9374. value = +value
  9375. offset = offset | 0
  9376. if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0)
  9377. if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)
  9378. this[offset] = (value & 0xff)
  9379. return offset + 1
  9380. }
  9381. function objectWriteUInt16 (buf, value, offset, littleEndian) {
  9382. if (value < 0) value = 0xffff + value + 1
  9383. for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; ++i) {
  9384. buf[offset + i] = (value & (0xff << (8 * (littleEndian ? i : 1 - i)))) >>>
  9385. (littleEndian ? i : 1 - i) * 8
  9386. }
  9387. }
  9388. Buffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {
  9389. value = +value
  9390. offset = offset | 0
  9391. if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
  9392. if (Buffer.TYPED_ARRAY_SUPPORT) {
  9393. this[offset] = (value & 0xff)
  9394. this[offset + 1] = (value >>> 8)
  9395. } else {
  9396. objectWriteUInt16(this, value, offset, true)
  9397. }
  9398. return offset + 2
  9399. }
  9400. Buffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {
  9401. value = +value
  9402. offset = offset | 0
  9403. if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
  9404. if (Buffer.TYPED_ARRAY_SUPPORT) {
  9405. this[offset] = (value >>> 8)
  9406. this[offset + 1] = (value & 0xff)
  9407. } else {
  9408. objectWriteUInt16(this, value, offset, false)
  9409. }
  9410. return offset + 2
  9411. }
  9412. function objectWriteUInt32 (buf, value, offset, littleEndian) {
  9413. if (value < 0) value = 0xffffffff + value + 1
  9414. for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; ++i) {
  9415. buf[offset + i] = (value >>> (littleEndian ? i : 3 - i) * 8) & 0xff
  9416. }
  9417. }
  9418. Buffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {
  9419. value = +value
  9420. offset = offset | 0
  9421. if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
  9422. if (Buffer.TYPED_ARRAY_SUPPORT) {
  9423. this[offset + 3] = (value >>> 24)
  9424. this[offset + 2] = (value >>> 16)
  9425. this[offset + 1] = (value >>> 8)
  9426. this[offset] = (value & 0xff)
  9427. } else {
  9428. objectWriteUInt32(this, value, offset, true)
  9429. }
  9430. return offset + 4
  9431. }
  9432. Buffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {
  9433. value = +value
  9434. offset = offset | 0
  9435. if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
  9436. if (Buffer.TYPED_ARRAY_SUPPORT) {
  9437. this[offset] = (value >>> 24)
  9438. this[offset + 1] = (value >>> 16)
  9439. this[offset + 2] = (value >>> 8)
  9440. this[offset + 3] = (value & 0xff)
  9441. } else {
  9442. objectWriteUInt32(this, value, offset, false)
  9443. }
  9444. return offset + 4
  9445. }
  9446. Buffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {
  9447. value = +value
  9448. offset = offset | 0
  9449. if (!noAssert) {
  9450. var limit = Math.pow(2, 8 * byteLength - 1)
  9451. checkInt(this, value, offset, byteLength, limit - 1, -limit)
  9452. }
  9453. var i = 0
  9454. var mul = 1
  9455. var sub = 0
  9456. this[offset] = value & 0xFF
  9457. while (++i < byteLength && (mul *= 0x100)) {
  9458. if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {
  9459. sub = 1
  9460. }
  9461. this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
  9462. }
  9463. return offset + byteLength
  9464. }
  9465. Buffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {
  9466. value = +value
  9467. offset = offset | 0
  9468. if (!noAssert) {
  9469. var limit = Math.pow(2, 8 * byteLength - 1)
  9470. checkInt(this, value, offset, byteLength, limit - 1, -limit)
  9471. }
  9472. var i = byteLength - 1
  9473. var mul = 1
  9474. var sub = 0
  9475. this[offset + i] = value & 0xFF
  9476. while (--i >= 0 && (mul *= 0x100)) {
  9477. if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {
  9478. sub = 1
  9479. }
  9480. this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
  9481. }
  9482. return offset + byteLength
  9483. }
  9484. Buffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {
  9485. value = +value
  9486. offset = offset | 0
  9487. if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80)
  9488. if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)
  9489. if (value < 0) value = 0xff + value + 1
  9490. this[offset] = (value & 0xff)
  9491. return offset + 1
  9492. }
  9493. Buffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {
  9494. value = +value
  9495. offset = offset | 0
  9496. if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
  9497. if (Buffer.TYPED_ARRAY_SUPPORT) {
  9498. this[offset] = (value & 0xff)
  9499. this[offset + 1] = (value >>> 8)
  9500. } else {
  9501. objectWriteUInt16(this, value, offset, true)
  9502. }
  9503. return offset + 2
  9504. }
  9505. Buffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {
  9506. value = +value
  9507. offset = offset | 0
  9508. if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
  9509. if (Buffer.TYPED_ARRAY_SUPPORT) {
  9510. this[offset] = (value >>> 8)
  9511. this[offset + 1] = (value & 0xff)
  9512. } else {
  9513. objectWriteUInt16(this, value, offset, false)
  9514. }
  9515. return offset + 2
  9516. }
  9517. Buffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {
  9518. value = +value
  9519. offset = offset | 0
  9520. if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
  9521. if (Buffer.TYPED_ARRAY_SUPPORT) {
  9522. this[offset] = (value & 0xff)
  9523. this[offset + 1] = (value >>> 8)
  9524. this[offset + 2] = (value >>> 16)
  9525. this[offset + 3] = (value >>> 24)
  9526. } else {
  9527. objectWriteUInt32(this, value, offset, true)
  9528. }
  9529. return offset + 4
  9530. }
  9531. Buffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {
  9532. value = +value
  9533. offset = offset | 0
  9534. if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
  9535. if (value < 0) value = 0xffffffff + value + 1
  9536. if (Buffer.TYPED_ARRAY_SUPPORT) {
  9537. this[offset] = (value >>> 24)
  9538. this[offset + 1] = (value >>> 16)
  9539. this[offset + 2] = (value >>> 8)
  9540. this[offset + 3] = (value & 0xff)
  9541. } else {
  9542. objectWriteUInt32(this, value, offset, false)
  9543. }
  9544. return offset + 4
  9545. }
  9546. function checkIEEE754 (buf, value, offset, ext, max, min) {
  9547. if (offset + ext > buf.length) throw new RangeError('Index out of range')
  9548. if (offset < 0) throw new RangeError('Index out of range')
  9549. }
  9550. function writeFloat (buf, value, offset, littleEndian, noAssert) {
  9551. if (!noAssert) {
  9552. checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38)
  9553. }
  9554. ieee754.write(buf, value, offset, littleEndian, 23, 4)
  9555. return offset + 4
  9556. }
  9557. Buffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {
  9558. return writeFloat(this, value, offset, true, noAssert)
  9559. }
  9560. Buffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {
  9561. return writeFloat(this, value, offset, false, noAssert)
  9562. }
  9563. function writeDouble (buf, value, offset, littleEndian, noAssert) {
  9564. if (!noAssert) {
  9565. checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308)
  9566. }
  9567. ieee754.write(buf, value, offset, littleEndian, 52, 8)
  9568. return offset + 8
  9569. }
  9570. Buffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {
  9571. return writeDouble(this, value, offset, true, noAssert)
  9572. }
  9573. Buffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {
  9574. return writeDouble(this, value, offset, false, noAssert)
  9575. }
  9576. // copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)
  9577. Buffer.prototype.copy = function copy (target, targetStart, start, end) {
  9578. if (!start) start = 0
  9579. if (!end && end !== 0) end = this.length
  9580. if (targetStart >= target.length) targetStart = target.length
  9581. if (!targetStart) targetStart = 0
  9582. if (end > 0 && end < start) end = start
  9583. // Copy 0 bytes; we're done
  9584. if (end === start) return 0
  9585. if (target.length === 0 || this.length === 0) return 0
  9586. // Fatal error conditions
  9587. if (targetStart < 0) {
  9588. throw new RangeError('targetStart out of bounds')
  9589. }
  9590. if (start < 0 || start >= this.length) throw new RangeError('sourceStart out of bounds')
  9591. if (end < 0) throw new RangeError('sourceEnd out of bounds')
  9592. // Are we oob?
  9593. if (end > this.length) end = this.length
  9594. if (target.length - targetStart < end - start) {
  9595. end = target.length - targetStart + start
  9596. }
  9597. var len = end - start
  9598. var i
  9599. if (this === target && start < targetStart && targetStart < end) {
  9600. // descending copy from end
  9601. for (i = len - 1; i >= 0; --i) {
  9602. target[i + targetStart] = this[i + start]
  9603. }
  9604. } else if (len < 1000 || !Buffer.TYPED_ARRAY_SUPPORT) {
  9605. // ascending copy from start
  9606. for (i = 0; i < len; ++i) {
  9607. target[i + targetStart] = this[i + start]
  9608. }
  9609. } else {
  9610. Uint8Array.prototype.set.call(
  9611. target,
  9612. this.subarray(start, start + len),
  9613. targetStart
  9614. )
  9615. }
  9616. return len
  9617. }
  9618. // Usage:
  9619. // buffer.fill(number[, offset[, end]])
  9620. // buffer.fill(buffer[, offset[, end]])
  9621. // buffer.fill(string[, offset[, end]][, encoding])
  9622. Buffer.prototype.fill = function fill (val, start, end, encoding) {
  9623. // Handle string cases:
  9624. if (typeof val === 'string') {
  9625. if (typeof start === 'string') {
  9626. encoding = start
  9627. start = 0
  9628. end = this.length
  9629. } else if (typeof end === 'string') {
  9630. encoding = end
  9631. end = this.length
  9632. }
  9633. if (val.length === 1) {
  9634. var code = val.charCodeAt(0)
  9635. if (code < 256) {
  9636. val = code
  9637. }
  9638. }
  9639. if (encoding !== undefined && typeof encoding !== 'string') {
  9640. throw new TypeError('encoding must be a string')
  9641. }
  9642. if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {
  9643. throw new TypeError('Unknown encoding: ' + encoding)
  9644. }
  9645. } else if (typeof val === 'number') {
  9646. val = val & 255
  9647. }
  9648. // Invalid ranges are not set to a default, so can range check early.
  9649. if (start < 0 || this.length < start || this.length < end) {
  9650. throw new RangeError('Out of range index')
  9651. }
  9652. if (end <= start) {
  9653. return this
  9654. }
  9655. start = start >>> 0
  9656. end = end === undefined ? this.length : end >>> 0
  9657. if (!val) val = 0
  9658. var i
  9659. if (typeof val === 'number') {
  9660. for (i = start; i < end; ++i) {
  9661. this[i] = val
  9662. }
  9663. } else {
  9664. var bytes = Buffer.isBuffer(val)
  9665. ? val
  9666. : utf8ToBytes(new Buffer(val, encoding).toString())
  9667. var len = bytes.length
  9668. for (i = 0; i < end - start; ++i) {
  9669. this[i + start] = bytes[i % len]
  9670. }
  9671. }
  9672. return this
  9673. }
  9674. // HELPER FUNCTIONS
  9675. // ================
  9676. var INVALID_BASE64_RE = /[^+\/0-9A-Za-z-_]/g
  9677. function base64clean (str) {
  9678. // Node strips out invalid characters like \n and \t from the string, base64-js does not
  9679. str = stringtrim(str).replace(INVALID_BASE64_RE, '')
  9680. // Node converts strings with length < 2 to ''
  9681. if (str.length < 2) return ''
  9682. // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not
  9683. while (str.length % 4 !== 0) {
  9684. str = str + '='
  9685. }
  9686. return str
  9687. }
  9688. function stringtrim (str) {
  9689. if (str.trim) return str.trim()
  9690. return str.replace(/^\s+|\s+$/g, '')
  9691. }
  9692. function toHex (n) {
  9693. if (n < 16) return '0' + n.toString(16)
  9694. return n.toString(16)
  9695. }
  9696. function utf8ToBytes (string, units) {
  9697. units = units || Infinity
  9698. var codePoint
  9699. var length = string.length
  9700. var leadSurrogate = null
  9701. var bytes = []
  9702. for (var i = 0; i < length; ++i) {
  9703. codePoint = string.charCodeAt(i)
  9704. // is surrogate component
  9705. if (codePoint > 0xD7FF && codePoint < 0xE000) {
  9706. // last char was a lead
  9707. if (!leadSurrogate) {
  9708. // no lead yet
  9709. if (codePoint > 0xDBFF) {
  9710. // unexpected trail
  9711. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  9712. continue
  9713. } else if (i + 1 === length) {
  9714. // unpaired lead
  9715. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  9716. continue
  9717. }
  9718. // valid lead
  9719. leadSurrogate = codePoint
  9720. continue
  9721. }
  9722. // 2 leads in a row
  9723. if (codePoint < 0xDC00) {
  9724. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  9725. leadSurrogate = codePoint
  9726. continue
  9727. }
  9728. // valid surrogate pair
  9729. codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000
  9730. } else if (leadSurrogate) {
  9731. // valid bmp char, but last char was a lead
  9732. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  9733. }
  9734. leadSurrogate = null
  9735. // encode utf8
  9736. if (codePoint < 0x80) {
  9737. if ((units -= 1) < 0) break
  9738. bytes.push(codePoint)
  9739. } else if (codePoint < 0x800) {
  9740. if ((units -= 2) < 0) break
  9741. bytes.push(
  9742. codePoint >> 0x6 | 0xC0,
  9743. codePoint & 0x3F | 0x80
  9744. )
  9745. } else if (codePoint < 0x10000) {
  9746. if ((units -= 3) < 0) break
  9747. bytes.push(
  9748. codePoint >> 0xC | 0xE0,
  9749. codePoint >> 0x6 & 0x3F | 0x80,
  9750. codePoint & 0x3F | 0x80
  9751. )
  9752. } else if (codePoint < 0x110000) {
  9753. if ((units -= 4) < 0) break
  9754. bytes.push(
  9755. codePoint >> 0x12 | 0xF0,
  9756. codePoint >> 0xC & 0x3F | 0x80,
  9757. codePoint >> 0x6 & 0x3F | 0x80,
  9758. codePoint & 0x3F | 0x80
  9759. )
  9760. } else {
  9761. throw new Error('Invalid code point')
  9762. }
  9763. }
  9764. return bytes
  9765. }
  9766. function asciiToBytes (str) {
  9767. var byteArray = []
  9768. for (var i = 0; i < str.length; ++i) {
  9769. // Node's code seems to be doing this and not & 0x7F..
  9770. byteArray.push(str.charCodeAt(i) & 0xFF)
  9771. }
  9772. return byteArray
  9773. }
  9774. function utf16leToBytes (str, units) {
  9775. var c, hi, lo
  9776. var byteArray = []
  9777. for (var i = 0; i < str.length; ++i) {
  9778. if ((units -= 2) < 0) break
  9779. c = str.charCodeAt(i)
  9780. hi = c >> 8
  9781. lo = c % 256
  9782. byteArray.push(lo)
  9783. byteArray.push(hi)
  9784. }
  9785. return byteArray
  9786. }
  9787. function base64ToBytes (str) {
  9788. return base64.toByteArray(base64clean(str))
  9789. }
  9790. function blitBuffer (src, dst, offset, length) {
  9791. for (var i = 0; i < length; ++i) {
  9792. if ((i + offset >= dst.length) || (i >= src.length)) break
  9793. dst[i + offset] = src[i]
  9794. }
  9795. return i
  9796. }
  9797. function isnan (val) {
  9798. return val !== val // eslint-disable-line no-self-compare
  9799. }
  9800. }).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {},require("buffer").Buffer)
  9801. },{"base64-js":82,"buffer":85,"ieee754":304,"isarray":313}],86:[function(require,module,exports){
  9802. // Copyright Joyent, Inc. and other Node contributors.
  9803. //
  9804. // Permission is hereby granted, free of charge, to any person obtaining a
  9805. // copy of this software and associated documentation files (the
  9806. // "Software"), to deal in the Software without restriction, including
  9807. // without limitation the rights to use, copy, modify, merge, publish,
  9808. // distribute, sublicense, and/or sell copies of the Software, and to permit
  9809. // persons to whom the Software is furnished to do so, subject to the
  9810. // following conditions:
  9811. //
  9812. // The above copyright notice and this permission notice shall be included
  9813. // in all copies or substantial portions of the Software.
  9814. //
  9815. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  9816. // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  9817. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  9818. // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  9819. // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  9820. // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  9821. // USE OR OTHER DEALINGS IN THE SOFTWARE.
  9822. var Buffer = require('buffer').Buffer;
  9823. var isBufferEncoding = Buffer.isEncoding
  9824. || function(encoding) {
  9825. switch (encoding && encoding.toLowerCase()) {
  9826. 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': return true;
  9827. default: return false;
  9828. }
  9829. }
  9830. function assertEncoding(encoding) {
  9831. if (encoding && !isBufferEncoding(encoding)) {
  9832. throw new Error('Unknown encoding: ' + encoding);
  9833. }
  9834. }
  9835. // StringDecoder provides an interface for efficiently splitting a series of
  9836. // buffers into a series of JS strings without breaking apart multi-byte
  9837. // characters. CESU-8 is handled as part of the UTF-8 encoding.
  9838. //
  9839. // @TODO Handling all encodings inside a single object makes it very difficult
  9840. // to reason about this code, so it should be split up in the future.
  9841. // @TODO There should be a utf8-strict encoding that rejects invalid UTF-8 code
  9842. // points as used by CESU-8.
  9843. var StringDecoder = exports.StringDecoder = function(encoding) {
  9844. this.encoding = (encoding || 'utf8').toLowerCase().replace(/[-_]/, '');
  9845. assertEncoding(encoding);
  9846. switch (this.encoding) {
  9847. case 'utf8':
  9848. // CESU-8 represents each of Surrogate Pair by 3-bytes
  9849. this.surrogateSize = 3;
  9850. break;
  9851. case 'ucs2':
  9852. case 'utf16le':
  9853. // UTF-16 represents each of Surrogate Pair by 2-bytes
  9854. this.surrogateSize = 2;
  9855. this.detectIncompleteChar = utf16DetectIncompleteChar;
  9856. break;
  9857. case 'base64':
  9858. // Base-64 stores 3 bytes in 4 chars, and pads the remainder.
  9859. this.surrogateSize = 3;
  9860. this.detectIncompleteChar = base64DetectIncompleteChar;
  9861. break;
  9862. default:
  9863. this.write = passThroughWrite;
  9864. return;
  9865. }
  9866. // Enough space to store all bytes of a single character. UTF-8 needs 4
  9867. // bytes, but CESU-8 may require up to 6 (3 bytes per surrogate).
  9868. this.charBuffer = new Buffer(6);
  9869. // Number of bytes received for the current incomplete multi-byte character.
  9870. this.charReceived = 0;
  9871. // Number of bytes expected for the current incomplete multi-byte character.
  9872. this.charLength = 0;
  9873. };
  9874. // write decodes the given buffer and returns it as JS string that is
  9875. // guaranteed to not contain any partial multi-byte characters. Any partial
  9876. // character found at the end of the buffer is buffered up, and will be
  9877. // returned when calling write again with the remaining bytes.
  9878. //
  9879. // Note: Converting a Buffer containing an orphan surrogate to a String
  9880. // currently works, but converting a String to a Buffer (via `new Buffer`, or
  9881. // Buffer#write) will replace incomplete surrogates with the unicode
  9882. // replacement character. See https://codereview.chromium.org/121173009/ .
  9883. StringDecoder.prototype.write = function(buffer) {
  9884. var charStr = '';
  9885. // if our last write ended with an incomplete multibyte character
  9886. while (this.charLength) {
  9887. // determine how many remaining bytes this buffer has to offer for this char
  9888. var available = (buffer.length >= this.charLength - this.charReceived) ?
  9889. this.charLength - this.charReceived :
  9890. buffer.length;
  9891. // add the new bytes to the char buffer
  9892. buffer.copy(this.charBuffer, this.charReceived, 0, available);
  9893. this.charReceived += available;
  9894. if (this.charReceived < this.charLength) {
  9895. // still not enough chars in this buffer? wait for more ...
  9896. return '';
  9897. }
  9898. // remove bytes belonging to the current character from the buffer
  9899. buffer = buffer.slice(available, buffer.length);
  9900. // get the character that was split
  9901. charStr = this.charBuffer.slice(0, this.charLength).toString(this.encoding);
  9902. // CESU-8: lead surrogate (D800-DBFF) is also the incomplete character
  9903. var charCode = charStr.charCodeAt(charStr.length - 1);
  9904. if (charCode >= 0xD800 && charCode <= 0xDBFF) {
  9905. this.charLength += this.surrogateSize;
  9906. charStr = '';
  9907. continue;
  9908. }
  9909. this.charReceived = this.charLength = 0;
  9910. // if there are no more bytes in this buffer, just emit our char
  9911. if (buffer.length === 0) {
  9912. return charStr;
  9913. }
  9914. break;
  9915. }
  9916. // determine and set charLength / charReceived
  9917. this.detectIncompleteChar(buffer);
  9918. var end = buffer.length;
  9919. if (this.charLength) {
  9920. // buffer the incomplete character bytes we got
  9921. buffer.copy(this.charBuffer, 0, buffer.length - this.charReceived, end);
  9922. end -= this.charReceived;
  9923. }
  9924. charStr += buffer.toString(this.encoding, 0, end);
  9925. var end = charStr.length - 1;
  9926. var charCode = charStr.charCodeAt(end);
  9927. // CESU-8: lead surrogate (D800-DBFF) is also the incomplete character
  9928. if (charCode >= 0xD800 && charCode <= 0xDBFF) {
  9929. var size = this.surrogateSize;
  9930. this.charLength += size;
  9931. this.charReceived += size;
  9932. this.charBuffer.copy(this.charBuffer, size, 0, size);
  9933. buffer.copy(this.charBuffer, 0, 0, size);
  9934. return charStr.substring(0, end);
  9935. }
  9936. // or just emit the charStr
  9937. return charStr;
  9938. };
  9939. // detectIncompleteChar determines if there is an incomplete UTF-8 character at
  9940. // the end of the given buffer. If so, it sets this.charLength to the byte
  9941. // length that character, and sets this.charReceived to the number of bytes
  9942. // that are available for this character.
  9943. StringDecoder.prototype.detectIncompleteChar = function(buffer) {
  9944. // determine how many bytes we have to check at the end of this buffer
  9945. var i = (buffer.length >= 3) ? 3 : buffer.length;
  9946. // Figure out if one of the last i bytes of our buffer announces an
  9947. // incomplete char.
  9948. for (; i > 0; i--) {
  9949. var c = buffer[buffer.length - i];
  9950. // See http://en.wikipedia.org/wiki/UTF-8#Description
  9951. // 110XXXXX
  9952. if (i == 1 && c >> 5 == 0x06) {
  9953. this.charLength = 2;
  9954. break;
  9955. }
  9956. // 1110XXXX
  9957. if (i <= 2 && c >> 4 == 0x0E) {
  9958. this.charLength = 3;
  9959. break;
  9960. }
  9961. // 11110XXX
  9962. if (i <= 3 && c >> 3 == 0x1E) {
  9963. this.charLength = 4;
  9964. break;
  9965. }
  9966. }
  9967. this.charReceived = i;
  9968. };
  9969. StringDecoder.prototype.end = function(buffer) {
  9970. var res = '';
  9971. if (buffer && buffer.length)
  9972. res = this.write(buffer);
  9973. if (this.charReceived) {
  9974. var cr = this.charReceived;
  9975. var buf = this.charBuffer;
  9976. var enc = this.encoding;
  9977. res += buf.slice(0, cr).toString(enc);
  9978. }
  9979. return res;
  9980. };
  9981. function passThroughWrite(buffer) {
  9982. return buffer.toString(this.encoding);
  9983. }
  9984. function utf16DetectIncompleteChar(buffer) {
  9985. this.charReceived = buffer.length % 2;
  9986. this.charLength = this.charReceived ? 2 : 0;
  9987. }
  9988. function base64DetectIncompleteChar(buffer) {
  9989. this.charReceived = buffer.length % 3;
  9990. this.charLength = this.charReceived ? 3 : 0;
  9991. }
  9992. },{"buffer":85}],87:[function(require,module,exports){
  9993. module.exports = {
  9994. "100": "Continue",
  9995. "101": "Switching Protocols",
  9996. "102": "Processing",
  9997. "200": "OK",
  9998. "201": "Created",
  9999. "202": "Accepted",
  10000. "203": "Non-Authoritative Information",
  10001. "204": "No Content",
  10002. "205": "Reset Content",
  10003. "206": "Partial Content",
  10004. "207": "Multi-Status",
  10005. "208": "Already Reported",
  10006. "226": "IM Used",
  10007. "300": "Multiple Choices",
  10008. "301": "Moved Permanently",
  10009. "302": "Found",
  10010. "303": "See Other",
  10011. "304": "Not Modified",
  10012. "305": "Use Proxy",
  10013. "307": "Temporary Redirect",
  10014. "308": "Permanent Redirect",
  10015. "400": "Bad Request",
  10016. "401": "Unauthorized",
  10017. "402": "Payment Required",
  10018. "403": "Forbidden",
  10019. "404": "Not Found",
  10020. "405": "Method Not Allowed",
  10021. "406": "Not Acceptable",
  10022. "407": "Proxy Authentication Required",
  10023. "408": "Request Timeout",
  10024. "409": "Conflict",
  10025. "410": "Gone",
  10026. "411": "Length Required",
  10027. "412": "Precondition Failed",
  10028. "413": "Payload Too Large",
  10029. "414": "URI Too Long",
  10030. "415": "Unsupported Media Type",
  10031. "416": "Range Not Satisfiable",
  10032. "417": "Expectation Failed",
  10033. "418": "I'm a teapot",
  10034. "421": "Misdirected Request",
  10035. "422": "Unprocessable Entity",
  10036. "423": "Locked",
  10037. "424": "Failed Dependency",
  10038. "425": "Unordered Collection",
  10039. "426": "Upgrade Required",
  10040. "428": "Precondition Required",
  10041. "429": "Too Many Requests",
  10042. "431": "Request Header Fields Too Large",
  10043. "451": "Unavailable For Legal Reasons",
  10044. "500": "Internal Server Error",
  10045. "501": "Not Implemented",
  10046. "502": "Bad Gateway",
  10047. "503": "Service Unavailable",
  10048. "504": "Gateway Timeout",
  10049. "505": "HTTP Version Not Supported",
  10050. "506": "Variant Also Negotiates",
  10051. "507": "Insufficient Storage",
  10052. "508": "Loop Detected",
  10053. "509": "Bandwidth Limit Exceeded",
  10054. "510": "Not Extended",
  10055. "511": "Network Authentication Required"
  10056. }
  10057. },{}],88:[function(require,module,exports){
  10058. /*!
  10059. * copy-to - index.js
  10060. * Copyright(c) 2014 dead_horse <dead_horse@qq.com>
  10061. * MIT Licensed
  10062. */
  10063. 'use strict';
  10064. /**
  10065. * slice() reference.
  10066. */
  10067. var slice = Array.prototype.slice;
  10068. /**
  10069. * Expose copy
  10070. *
  10071. * ```
  10072. * copy({foo: 'nar', hello: 'copy'}).to({hello: 'world'});
  10073. * copy({foo: 'nar', hello: 'copy'}).toCover({hello: 'world'});
  10074. * ```
  10075. *
  10076. * @param {Object} src
  10077. * @return {Copy}
  10078. */
  10079. module.exports = Copy;
  10080. /**
  10081. * Copy
  10082. * @param {Object} src
  10083. * @param {Boolean} withAccess
  10084. */
  10085. function Copy(src, withAccess) {
  10086. if (!(this instanceof Copy)) return new Copy(src, withAccess);
  10087. this.src = src;
  10088. this._withAccess = withAccess;
  10089. }
  10090. /**
  10091. * copy properties include getter and setter
  10092. * @param {[type]} val [description]
  10093. * @return {[type]} [description]
  10094. */
  10095. Copy.prototype.withAccess = function (w) {
  10096. this._withAccess = w !== false;
  10097. return this;
  10098. };
  10099. /**
  10100. * pick keys in src
  10101. *
  10102. * @api: public
  10103. */
  10104. Copy.prototype.pick = function(keys) {
  10105. if (!Array.isArray(keys)) {
  10106. keys = slice.call(arguments);
  10107. }
  10108. if (keys.length) {
  10109. this.keys = keys;
  10110. }
  10111. return this;
  10112. };
  10113. /**
  10114. * copy src to target,
  10115. * do not cover any property target has
  10116. * @param {Object} to
  10117. *
  10118. * @api: public
  10119. */
  10120. Copy.prototype.to = function(to) {
  10121. to = to || {};
  10122. if (!this.src) return to;
  10123. var keys = this.keys || Object.keys(this.src);
  10124. if (!this._withAccess) {
  10125. for (var i = 0; i < keys.length; i++) {
  10126. key = keys[i];
  10127. if (to[key] !== undefined) continue;
  10128. to[key] = this.src[key];
  10129. }
  10130. return to;
  10131. }
  10132. for (var i = 0; i < keys.length; i++) {
  10133. var key = keys[i];
  10134. if (!notDefined(to, key)) continue;
  10135. var getter = this.src.__lookupGetter__(key);
  10136. var setter = this.src.__lookupSetter__(key);
  10137. if (getter) to.__defineGetter__(key, getter);
  10138. if (setter) to.__defineSetter__(key, setter);
  10139. if (!getter && !setter) {
  10140. to[key] = this.src[key];
  10141. }
  10142. }
  10143. return to;
  10144. };
  10145. /**
  10146. * copy src to target,
  10147. * override any property target has
  10148. * @param {Object} to
  10149. *
  10150. * @api: public
  10151. */
  10152. Copy.prototype.toCover = function(to) {
  10153. var keys = this.keys || Object.keys(this.src);
  10154. for (var i = 0; i < keys.length; i++) {
  10155. var key = keys[i];
  10156. delete to[key];
  10157. var getter = this.src.__lookupGetter__(key);
  10158. var setter = this.src.__lookupSetter__(key);
  10159. if (getter) to.__defineGetter__(key, getter);
  10160. if (setter) to.__defineSetter__(key, setter);
  10161. if (!getter && !setter) {
  10162. to[key] = this.src[key];
  10163. }
  10164. }
  10165. };
  10166. Copy.prototype.override = Copy.prototype.toCover;
  10167. /**
  10168. * append another object to src
  10169. * @param {Obj} obj
  10170. * @return {Copy}
  10171. */
  10172. Copy.prototype.and = function (obj) {
  10173. var src = {};
  10174. this.to(src);
  10175. this.src = obj;
  10176. this.to(src);
  10177. this.src = src;
  10178. return this;
  10179. };
  10180. /**
  10181. * check obj[key] if not defiend
  10182. * @param {Object} obj
  10183. * @param {String} key
  10184. * @return {Boolean}
  10185. */
  10186. function notDefined(obj, key) {
  10187. return obj[key] === undefined
  10188. && obj.__lookupGetter__(key) === undefined
  10189. && obj.__lookupSetter__(key) === undefined;
  10190. }
  10191. },{}],89:[function(require,module,exports){
  10192. module.exports = function (it) {
  10193. if (typeof it != 'function') {
  10194. throw TypeError(String(it) + ' is not a function');
  10195. } return it;
  10196. };
  10197. },{}],90:[function(require,module,exports){
  10198. var isObject = require('../internals/is-object');
  10199. module.exports = function (it) {
  10200. if (!isObject(it) && it !== null) {
  10201. throw TypeError("Can't set " + String(it) + ' as a prototype');
  10202. } return it;
  10203. };
  10204. },{"../internals/is-object":162}],91:[function(require,module,exports){
  10205. var wellKnownSymbol = require('../internals/well-known-symbol');
  10206. var create = require('../internals/object-create');
  10207. var definePropertyModule = require('../internals/object-define-property');
  10208. var UNSCOPABLES = wellKnownSymbol('unscopables');
  10209. var ArrayPrototype = Array.prototype;
  10210. // Array.prototype[@@unscopables]
  10211. // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
  10212. if (ArrayPrototype[UNSCOPABLES] == undefined) {
  10213. definePropertyModule.f(ArrayPrototype, UNSCOPABLES, {
  10214. configurable: true,
  10215. value: create(null)
  10216. });
  10217. }
  10218. // add a key to Array.prototype[@@unscopables]
  10219. module.exports = function (key) {
  10220. ArrayPrototype[UNSCOPABLES][key] = true;
  10221. };
  10222. },{"../internals/object-create":177,"../internals/object-define-property":179,"../internals/well-known-symbol":237}],92:[function(require,module,exports){
  10223. 'use strict';
  10224. var charAt = require('../internals/string-multibyte').charAt;
  10225. // `AdvanceStringIndex` abstract operation
  10226. // https://tc39.es/ecma262/#sec-advancestringindex
  10227. module.exports = function (S, index, unicode) {
  10228. return index + (unicode ? charAt(S, index).length : 1);
  10229. };
  10230. },{"../internals/string-multibyte":213}],93:[function(require,module,exports){
  10231. module.exports = function (it, Constructor, name) {
  10232. if (!(it instanceof Constructor)) {
  10233. throw TypeError('Incorrect ' + (name ? name + ' ' : '') + 'invocation');
  10234. } return it;
  10235. };
  10236. },{}],94:[function(require,module,exports){
  10237. var isObject = require('../internals/is-object');
  10238. module.exports = function (it) {
  10239. if (!isObject(it)) {
  10240. throw TypeError(String(it) + ' is not an object');
  10241. } return it;
  10242. };
  10243. },{"../internals/is-object":162}],95:[function(require,module,exports){
  10244. // eslint-disable-next-line es/no-typed-arrays -- safe
  10245. module.exports = typeof ArrayBuffer !== 'undefined' && typeof DataView !== 'undefined';
  10246. },{}],96:[function(require,module,exports){
  10247. 'use strict';
  10248. var NATIVE_ARRAY_BUFFER = require('../internals/array-buffer-native');
  10249. var DESCRIPTORS = require('../internals/descriptors');
  10250. var global = require('../internals/global');
  10251. var isObject = require('../internals/is-object');
  10252. var has = require('../internals/has');
  10253. var classof = require('../internals/classof');
  10254. var createNonEnumerableProperty = require('../internals/create-non-enumerable-property');
  10255. var redefine = require('../internals/redefine');
  10256. var defineProperty = require('../internals/object-define-property').f;
  10257. var getPrototypeOf = require('../internals/object-get-prototype-of');
  10258. var setPrototypeOf = require('../internals/object-set-prototype-of');
  10259. var wellKnownSymbol = require('../internals/well-known-symbol');
  10260. var uid = require('../internals/uid');
  10261. var Int8Array = global.Int8Array;
  10262. var Int8ArrayPrototype = Int8Array && Int8Array.prototype;
  10263. var Uint8ClampedArray = global.Uint8ClampedArray;
  10264. var Uint8ClampedArrayPrototype = Uint8ClampedArray && Uint8ClampedArray.prototype;
  10265. var TypedArray = Int8Array && getPrototypeOf(Int8Array);
  10266. var TypedArrayPrototype = Int8ArrayPrototype && getPrototypeOf(Int8ArrayPrototype);
  10267. var ObjectPrototype = Object.prototype;
  10268. var isPrototypeOf = ObjectPrototype.isPrototypeOf;
  10269. var TO_STRING_TAG = wellKnownSymbol('toStringTag');
  10270. var TYPED_ARRAY_TAG = uid('TYPED_ARRAY_TAG');
  10271. var TYPED_ARRAY_CONSTRUCTOR = uid('TYPED_ARRAY_CONSTRUCTOR');
  10272. // Fixing native typed arrays in Opera Presto crashes the browser, see #595
  10273. var NATIVE_ARRAY_BUFFER_VIEWS = NATIVE_ARRAY_BUFFER && !!setPrototypeOf && classof(global.opera) !== 'Opera';
  10274. var TYPED_ARRAY_TAG_REQIRED = false;
  10275. var NAME, Constructor, Prototype;
  10276. var TypedArrayConstructorsList = {
  10277. Int8Array: 1,
  10278. Uint8Array: 1,
  10279. Uint8ClampedArray: 1,
  10280. Int16Array: 2,
  10281. Uint16Array: 2,
  10282. Int32Array: 4,
  10283. Uint32Array: 4,
  10284. Float32Array: 4,
  10285. Float64Array: 8
  10286. };
  10287. var BigIntArrayConstructorsList = {
  10288. BigInt64Array: 8,
  10289. BigUint64Array: 8
  10290. };
  10291. var isView = function isView(it) {
  10292. if (!isObject(it)) return false;
  10293. var klass = classof(it);
  10294. return klass === 'DataView'
  10295. || has(TypedArrayConstructorsList, klass)
  10296. || has(BigIntArrayConstructorsList, klass);
  10297. };
  10298. var isTypedArray = function (it) {
  10299. if (!isObject(it)) return false;
  10300. var klass = classof(it);
  10301. return has(TypedArrayConstructorsList, klass)
  10302. || has(BigIntArrayConstructorsList, klass);
  10303. };
  10304. var aTypedArray = function (it) {
  10305. if (isTypedArray(it)) return it;
  10306. throw TypeError('Target is not a typed array');
  10307. };
  10308. var aTypedArrayConstructor = function (C) {
  10309. if (setPrototypeOf && !isPrototypeOf.call(TypedArray, C)) {
  10310. throw TypeError('Target is not a typed array constructor');
  10311. } return C;
  10312. };
  10313. var exportTypedArrayMethod = function (KEY, property, forced) {
  10314. if (!DESCRIPTORS) return;
  10315. if (forced) for (var ARRAY in TypedArrayConstructorsList) {
  10316. var TypedArrayConstructor = global[ARRAY];
  10317. if (TypedArrayConstructor && has(TypedArrayConstructor.prototype, KEY)) try {
  10318. delete TypedArrayConstructor.prototype[KEY];
  10319. } catch (error) { /* empty */ }
  10320. }
  10321. if (!TypedArrayPrototype[KEY] || forced) {
  10322. redefine(TypedArrayPrototype, KEY, forced ? property
  10323. : NATIVE_ARRAY_BUFFER_VIEWS && Int8ArrayPrototype[KEY] || property);
  10324. }
  10325. };
  10326. var exportTypedArrayStaticMethod = function (KEY, property, forced) {
  10327. var ARRAY, TypedArrayConstructor;
  10328. if (!DESCRIPTORS) return;
  10329. if (setPrototypeOf) {
  10330. if (forced) for (ARRAY in TypedArrayConstructorsList) {
  10331. TypedArrayConstructor = global[ARRAY];
  10332. if (TypedArrayConstructor && has(TypedArrayConstructor, KEY)) try {
  10333. delete TypedArrayConstructor[KEY];
  10334. } catch (error) { /* empty */ }
  10335. }
  10336. if (!TypedArray[KEY] || forced) {
  10337. // V8 ~ Chrome 49-50 `%TypedArray%` methods are non-writable non-configurable
  10338. try {
  10339. return redefine(TypedArray, KEY, forced ? property : NATIVE_ARRAY_BUFFER_VIEWS && TypedArray[KEY] || property);
  10340. } catch (error) { /* empty */ }
  10341. } else return;
  10342. }
  10343. for (ARRAY in TypedArrayConstructorsList) {
  10344. TypedArrayConstructor = global[ARRAY];
  10345. if (TypedArrayConstructor && (!TypedArrayConstructor[KEY] || forced)) {
  10346. redefine(TypedArrayConstructor, KEY, property);
  10347. }
  10348. }
  10349. };
  10350. for (NAME in TypedArrayConstructorsList) {
  10351. Constructor = global[NAME];
  10352. Prototype = Constructor && Constructor.prototype;
  10353. if (Prototype) createNonEnumerableProperty(Prototype, TYPED_ARRAY_CONSTRUCTOR, Constructor);
  10354. else NATIVE_ARRAY_BUFFER_VIEWS = false;
  10355. }
  10356. for (NAME in BigIntArrayConstructorsList) {
  10357. Constructor = global[NAME];
  10358. Prototype = Constructor && Constructor.prototype;
  10359. if (Prototype) createNonEnumerableProperty(Prototype, TYPED_ARRAY_CONSTRUCTOR, Constructor);
  10360. }
  10361. // WebKit bug - typed arrays constructors prototype is Object.prototype
  10362. if (!NATIVE_ARRAY_BUFFER_VIEWS || typeof TypedArray != 'function' || TypedArray === Function.prototype) {
  10363. // eslint-disable-next-line no-shadow -- safe
  10364. TypedArray = function TypedArray() {
  10365. throw TypeError('Incorrect invocation');
  10366. };
  10367. if (NATIVE_ARRAY_BUFFER_VIEWS) for (NAME in TypedArrayConstructorsList) {
  10368. if (global[NAME]) setPrototypeOf(global[NAME], TypedArray);
  10369. }
  10370. }
  10371. if (!NATIVE_ARRAY_BUFFER_VIEWS || !TypedArrayPrototype || TypedArrayPrototype === ObjectPrototype) {
  10372. TypedArrayPrototype = TypedArray.prototype;
  10373. if (NATIVE_ARRAY_BUFFER_VIEWS) for (NAME in TypedArrayConstructorsList) {
  10374. if (global[NAME]) setPrototypeOf(global[NAME].prototype, TypedArrayPrototype);
  10375. }
  10376. }
  10377. // WebKit bug - one more object in Uint8ClampedArray prototype chain
  10378. if (NATIVE_ARRAY_BUFFER_VIEWS && getPrototypeOf(Uint8ClampedArrayPrototype) !== TypedArrayPrototype) {
  10379. setPrototypeOf(Uint8ClampedArrayPrototype, TypedArrayPrototype);
  10380. }
  10381. if (DESCRIPTORS && !has(TypedArrayPrototype, TO_STRING_TAG)) {
  10382. TYPED_ARRAY_TAG_REQIRED = true;
  10383. defineProperty(TypedArrayPrototype, TO_STRING_TAG, { get: function () {
  10384. return isObject(this) ? this[TYPED_ARRAY_TAG] : undefined;
  10385. } });
  10386. for (NAME in TypedArrayConstructorsList) if (global[NAME]) {
  10387. createNonEnumerableProperty(global[NAME], TYPED_ARRAY_TAG, NAME);
  10388. }
  10389. }
  10390. module.exports = {
  10391. NATIVE_ARRAY_BUFFER_VIEWS: NATIVE_ARRAY_BUFFER_VIEWS,
  10392. TYPED_ARRAY_CONSTRUCTOR: TYPED_ARRAY_CONSTRUCTOR,
  10393. TYPED_ARRAY_TAG: TYPED_ARRAY_TAG_REQIRED && TYPED_ARRAY_TAG,
  10394. aTypedArray: aTypedArray,
  10395. aTypedArrayConstructor: aTypedArrayConstructor,
  10396. exportTypedArrayMethod: exportTypedArrayMethod,
  10397. exportTypedArrayStaticMethod: exportTypedArrayStaticMethod,
  10398. isView: isView,
  10399. isTypedArray: isTypedArray,
  10400. TypedArray: TypedArray,
  10401. TypedArrayPrototype: TypedArrayPrototype
  10402. };
  10403. },{"../internals/array-buffer-native":95,"../internals/classof":115,"../internals/create-non-enumerable-property":120,"../internals/descriptors":125,"../internals/global":147,"../internals/has":148,"../internals/is-object":162,"../internals/object-define-property":179,"../internals/object-get-prototype-of":184,"../internals/object-set-prototype-of":188,"../internals/redefine":197,"../internals/uid":234,"../internals/well-known-symbol":237}],97:[function(require,module,exports){
  10404. 'use strict';
  10405. var global = require('../internals/global');
  10406. var DESCRIPTORS = require('../internals/descriptors');
  10407. var NATIVE_ARRAY_BUFFER = require('../internals/array-buffer-native');
  10408. var createNonEnumerableProperty = require('../internals/create-non-enumerable-property');
  10409. var redefineAll = require('../internals/redefine-all');
  10410. var fails = require('../internals/fails');
  10411. var anInstance = require('../internals/an-instance');
  10412. var toInteger = require('../internals/to-integer');
  10413. var toLength = require('../internals/to-length');
  10414. var toIndex = require('../internals/to-index');
  10415. var IEEE754 = require('../internals/ieee754');
  10416. var getPrototypeOf = require('../internals/object-get-prototype-of');
  10417. var setPrototypeOf = require('../internals/object-set-prototype-of');
  10418. var getOwnPropertyNames = require('../internals/object-get-own-property-names').f;
  10419. var defineProperty = require('../internals/object-define-property').f;
  10420. var arrayFill = require('../internals/array-fill');
  10421. var setToStringTag = require('../internals/set-to-string-tag');
  10422. var InternalStateModule = require('../internals/internal-state');
  10423. var getInternalState = InternalStateModule.get;
  10424. var setInternalState = InternalStateModule.set;
  10425. var ARRAY_BUFFER = 'ArrayBuffer';
  10426. var DATA_VIEW = 'DataView';
  10427. var PROTOTYPE = 'prototype';
  10428. var WRONG_LENGTH = 'Wrong length';
  10429. var WRONG_INDEX = 'Wrong index';
  10430. var NativeArrayBuffer = global[ARRAY_BUFFER];
  10431. var $ArrayBuffer = NativeArrayBuffer;
  10432. var $DataView = global[DATA_VIEW];
  10433. var $DataViewPrototype = $DataView && $DataView[PROTOTYPE];
  10434. var ObjectPrototype = Object.prototype;
  10435. var RangeError = global.RangeError;
  10436. var packIEEE754 = IEEE754.pack;
  10437. var unpackIEEE754 = IEEE754.unpack;
  10438. var packInt8 = function (number) {
  10439. return [number & 0xFF];
  10440. };
  10441. var packInt16 = function (number) {
  10442. return [number & 0xFF, number >> 8 & 0xFF];
  10443. };
  10444. var packInt32 = function (number) {
  10445. return [number & 0xFF, number >> 8 & 0xFF, number >> 16 & 0xFF, number >> 24 & 0xFF];
  10446. };
  10447. var unpackInt32 = function (buffer) {
  10448. return buffer[3] << 24 | buffer[2] << 16 | buffer[1] << 8 | buffer[0];
  10449. };
  10450. var packFloat32 = function (number) {
  10451. return packIEEE754(number, 23, 4);
  10452. };
  10453. var packFloat64 = function (number) {
  10454. return packIEEE754(number, 52, 8);
  10455. };
  10456. var addGetter = function (Constructor, key) {
  10457. defineProperty(Constructor[PROTOTYPE], key, { get: function () { return getInternalState(this)[key]; } });
  10458. };
  10459. var get = function (view, count, index, isLittleEndian) {
  10460. var intIndex = toIndex(index);
  10461. var store = getInternalState(view);
  10462. if (intIndex + count > store.byteLength) throw RangeError(WRONG_INDEX);
  10463. var bytes = getInternalState(store.buffer).bytes;
  10464. var start = intIndex + store.byteOffset;
  10465. var pack = bytes.slice(start, start + count);
  10466. return isLittleEndian ? pack : pack.reverse();
  10467. };
  10468. var set = function (view, count, index, conversion, value, isLittleEndian) {
  10469. var intIndex = toIndex(index);
  10470. var store = getInternalState(view);
  10471. if (intIndex + count > store.byteLength) throw RangeError(WRONG_INDEX);
  10472. var bytes = getInternalState(store.buffer).bytes;
  10473. var start = intIndex + store.byteOffset;
  10474. var pack = conversion(+value);
  10475. for (var i = 0; i < count; i++) bytes[start + i] = pack[isLittleEndian ? i : count - i - 1];
  10476. };
  10477. if (!NATIVE_ARRAY_BUFFER) {
  10478. $ArrayBuffer = function ArrayBuffer(length) {
  10479. anInstance(this, $ArrayBuffer, ARRAY_BUFFER);
  10480. var byteLength = toIndex(length);
  10481. setInternalState(this, {
  10482. bytes: arrayFill.call(new Array(byteLength), 0),
  10483. byteLength: byteLength
  10484. });
  10485. if (!DESCRIPTORS) this.byteLength = byteLength;
  10486. };
  10487. $DataView = function DataView(buffer, byteOffset, byteLength) {
  10488. anInstance(this, $DataView, DATA_VIEW);
  10489. anInstance(buffer, $ArrayBuffer, DATA_VIEW);
  10490. var bufferLength = getInternalState(buffer).byteLength;
  10491. var offset = toInteger(byteOffset);
  10492. if (offset < 0 || offset > bufferLength) throw RangeError('Wrong offset');
  10493. byteLength = byteLength === undefined ? bufferLength - offset : toLength(byteLength);
  10494. if (offset + byteLength > bufferLength) throw RangeError(WRONG_LENGTH);
  10495. setInternalState(this, {
  10496. buffer: buffer,
  10497. byteLength: byteLength,
  10498. byteOffset: offset
  10499. });
  10500. if (!DESCRIPTORS) {
  10501. this.buffer = buffer;
  10502. this.byteLength = byteLength;
  10503. this.byteOffset = offset;
  10504. }
  10505. };
  10506. if (DESCRIPTORS) {
  10507. addGetter($ArrayBuffer, 'byteLength');
  10508. addGetter($DataView, 'buffer');
  10509. addGetter($DataView, 'byteLength');
  10510. addGetter($DataView, 'byteOffset');
  10511. }
  10512. redefineAll($DataView[PROTOTYPE], {
  10513. getInt8: function getInt8(byteOffset) {
  10514. return get(this, 1, byteOffset)[0] << 24 >> 24;
  10515. },
  10516. getUint8: function getUint8(byteOffset) {
  10517. return get(this, 1, byteOffset)[0];
  10518. },
  10519. getInt16: function getInt16(byteOffset /* , littleEndian */) {
  10520. var bytes = get(this, 2, byteOffset, arguments.length > 1 ? arguments[1] : undefined);
  10521. return (bytes[1] << 8 | bytes[0]) << 16 >> 16;
  10522. },
  10523. getUint16: function getUint16(byteOffset /* , littleEndian */) {
  10524. var bytes = get(this, 2, byteOffset, arguments.length > 1 ? arguments[1] : undefined);
  10525. return bytes[1] << 8 | bytes[0];
  10526. },
  10527. getInt32: function getInt32(byteOffset /* , littleEndian */) {
  10528. return unpackInt32(get(this, 4, byteOffset, arguments.length > 1 ? arguments[1] : undefined));
  10529. },
  10530. getUint32: function getUint32(byteOffset /* , littleEndian */) {
  10531. return unpackInt32(get(this, 4, byteOffset, arguments.length > 1 ? arguments[1] : undefined)) >>> 0;
  10532. },
  10533. getFloat32: function getFloat32(byteOffset /* , littleEndian */) {
  10534. return unpackIEEE754(get(this, 4, byteOffset, arguments.length > 1 ? arguments[1] : undefined), 23);
  10535. },
  10536. getFloat64: function getFloat64(byteOffset /* , littleEndian */) {
  10537. return unpackIEEE754(get(this, 8, byteOffset, arguments.length > 1 ? arguments[1] : undefined), 52);
  10538. },
  10539. setInt8: function setInt8(byteOffset, value) {
  10540. set(this, 1, byteOffset, packInt8, value);
  10541. },
  10542. setUint8: function setUint8(byteOffset, value) {
  10543. set(this, 1, byteOffset, packInt8, value);
  10544. },
  10545. setInt16: function setInt16(byteOffset, value /* , littleEndian */) {
  10546. set(this, 2, byteOffset, packInt16, value, arguments.length > 2 ? arguments[2] : undefined);
  10547. },
  10548. setUint16: function setUint16(byteOffset, value /* , littleEndian */) {
  10549. set(this, 2, byteOffset, packInt16, value, arguments.length > 2 ? arguments[2] : undefined);
  10550. },
  10551. setInt32: function setInt32(byteOffset, value /* , littleEndian */) {
  10552. set(this, 4, byteOffset, packInt32, value, arguments.length > 2 ? arguments[2] : undefined);
  10553. },
  10554. setUint32: function setUint32(byteOffset, value /* , littleEndian */) {
  10555. set(this, 4, byteOffset, packInt32, value, arguments.length > 2 ? arguments[2] : undefined);
  10556. },
  10557. setFloat32: function setFloat32(byteOffset, value /* , littleEndian */) {
  10558. set(this, 4, byteOffset, packFloat32, value, arguments.length > 2 ? arguments[2] : undefined);
  10559. },
  10560. setFloat64: function setFloat64(byteOffset, value /* , littleEndian */) {
  10561. set(this, 8, byteOffset, packFloat64, value, arguments.length > 2 ? arguments[2] : undefined);
  10562. }
  10563. });
  10564. } else {
  10565. /* eslint-disable no-new -- required for testing */
  10566. if (!fails(function () {
  10567. NativeArrayBuffer(1);
  10568. }) || !fails(function () {
  10569. new NativeArrayBuffer(-1);
  10570. }) || fails(function () {
  10571. new NativeArrayBuffer();
  10572. new NativeArrayBuffer(1.5);
  10573. new NativeArrayBuffer(NaN);
  10574. return NativeArrayBuffer.name != ARRAY_BUFFER;
  10575. })) {
  10576. /* eslint-enable no-new -- required for testing */
  10577. $ArrayBuffer = function ArrayBuffer(length) {
  10578. anInstance(this, $ArrayBuffer);
  10579. return new NativeArrayBuffer(toIndex(length));
  10580. };
  10581. var ArrayBufferPrototype = $ArrayBuffer[PROTOTYPE] = NativeArrayBuffer[PROTOTYPE];
  10582. for (var keys = getOwnPropertyNames(NativeArrayBuffer), j = 0, key; keys.length > j;) {
  10583. if (!((key = keys[j++]) in $ArrayBuffer)) {
  10584. createNonEnumerableProperty($ArrayBuffer, key, NativeArrayBuffer[key]);
  10585. }
  10586. }
  10587. ArrayBufferPrototype.constructor = $ArrayBuffer;
  10588. }
  10589. // WebKit bug - the same parent prototype for typed arrays and data view
  10590. if (setPrototypeOf && getPrototypeOf($DataViewPrototype) !== ObjectPrototype) {
  10591. setPrototypeOf($DataViewPrototype, ObjectPrototype);
  10592. }
  10593. // iOS Safari 7.x bug
  10594. var testView = new $DataView(new $ArrayBuffer(2));
  10595. var $setInt8 = $DataViewPrototype.setInt8;
  10596. testView.setInt8(0, 2147483648);
  10597. testView.setInt8(1, 2147483649);
  10598. if (testView.getInt8(0) || !testView.getInt8(1)) redefineAll($DataViewPrototype, {
  10599. setInt8: function setInt8(byteOffset, value) {
  10600. $setInt8.call(this, byteOffset, value << 24 >> 24);
  10601. },
  10602. setUint8: function setUint8(byteOffset, value) {
  10603. $setInt8.call(this, byteOffset, value << 24 >> 24);
  10604. }
  10605. }, { unsafe: true });
  10606. }
  10607. setToStringTag($ArrayBuffer, ARRAY_BUFFER);
  10608. setToStringTag($DataView, DATA_VIEW);
  10609. module.exports = {
  10610. ArrayBuffer: $ArrayBuffer,
  10611. DataView: $DataView
  10612. };
  10613. },{"../internals/an-instance":93,"../internals/array-buffer-native":95,"../internals/array-fill":99,"../internals/create-non-enumerable-property":120,"../internals/descriptors":125,"../internals/fails":140,"../internals/global":147,"../internals/ieee754":153,"../internals/internal-state":157,"../internals/object-define-property":179,"../internals/object-get-own-property-names":182,"../internals/object-get-prototype-of":184,"../internals/object-set-prototype-of":188,"../internals/redefine-all":196,"../internals/set-to-string-tag":208,"../internals/to-index":218,"../internals/to-integer":220,"../internals/to-length":221}],98:[function(require,module,exports){
  10614. 'use strict';
  10615. var toObject = require('../internals/to-object');
  10616. var toAbsoluteIndex = require('../internals/to-absolute-index');
  10617. var toLength = require('../internals/to-length');
  10618. var min = Math.min;
  10619. // `Array.prototype.copyWithin` method implementation
  10620. // https://tc39.es/ecma262/#sec-array.prototype.copywithin
  10621. // eslint-disable-next-line es/no-array-prototype-copywithin -- safe
  10622. module.exports = [].copyWithin || function copyWithin(target /* = 0 */, start /* = 0, end = @length */) {
  10623. var O = toObject(this);
  10624. var len = toLength(O.length);
  10625. var to = toAbsoluteIndex(target, len);
  10626. var from = toAbsoluteIndex(start, len);
  10627. var end = arguments.length > 2 ? arguments[2] : undefined;
  10628. var count = min((end === undefined ? len : toAbsoluteIndex(end, len)) - from, len - to);
  10629. var inc = 1;
  10630. if (from < to && to < from + count) {
  10631. inc = -1;
  10632. from += count - 1;
  10633. to += count - 1;
  10634. }
  10635. while (count-- > 0) {
  10636. if (from in O) O[to] = O[from];
  10637. else delete O[to];
  10638. to += inc;
  10639. from += inc;
  10640. } return O;
  10641. };
  10642. },{"../internals/to-absolute-index":217,"../internals/to-length":221,"../internals/to-object":222}],99:[function(require,module,exports){
  10643. 'use strict';
  10644. var toObject = require('../internals/to-object');
  10645. var toAbsoluteIndex = require('../internals/to-absolute-index');
  10646. var toLength = require('../internals/to-length');
  10647. // `Array.prototype.fill` method implementation
  10648. // https://tc39.es/ecma262/#sec-array.prototype.fill
  10649. module.exports = function fill(value /* , start = 0, end = @length */) {
  10650. var O = toObject(this);
  10651. var length = toLength(O.length);
  10652. var argumentsLength = arguments.length;
  10653. var index = toAbsoluteIndex(argumentsLength > 1 ? arguments[1] : undefined, length);
  10654. var end = argumentsLength > 2 ? arguments[2] : undefined;
  10655. var endPos = end === undefined ? length : toAbsoluteIndex(end, length);
  10656. while (endPos > index) O[index++] = value;
  10657. return O;
  10658. };
  10659. },{"../internals/to-absolute-index":217,"../internals/to-length":221,"../internals/to-object":222}],100:[function(require,module,exports){
  10660. 'use strict';
  10661. var $forEach = require('../internals/array-iteration').forEach;
  10662. var arrayMethodIsStrict = require('../internals/array-method-is-strict');
  10663. var STRICT_METHOD = arrayMethodIsStrict('forEach');
  10664. // `Array.prototype.forEach` method implementation
  10665. // https://tc39.es/ecma262/#sec-array.prototype.foreach
  10666. module.exports = !STRICT_METHOD ? function forEach(callbackfn /* , thisArg */) {
  10667. return $forEach(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
  10668. // eslint-disable-next-line es/no-array-prototype-foreach -- safe
  10669. } : [].forEach;
  10670. },{"../internals/array-iteration":104,"../internals/array-method-is-strict":107}],101:[function(require,module,exports){
  10671. module.exports = function (Constructor, list) {
  10672. var index = 0;
  10673. var length = list.length;
  10674. var result = new Constructor(length);
  10675. while (length > index) result[index] = list[index++];
  10676. return result;
  10677. };
  10678. },{}],102:[function(require,module,exports){
  10679. 'use strict';
  10680. var bind = require('../internals/function-bind-context');
  10681. var toObject = require('../internals/to-object');
  10682. var callWithSafeIterationClosing = require('../internals/call-with-safe-iteration-closing');
  10683. var isArrayIteratorMethod = require('../internals/is-array-iterator-method');
  10684. var toLength = require('../internals/to-length');
  10685. var createProperty = require('../internals/create-property');
  10686. var getIterator = require('../internals/get-iterator');
  10687. var getIteratorMethod = require('../internals/get-iterator-method');
  10688. // `Array.from` method implementation
  10689. // https://tc39.es/ecma262/#sec-array.from
  10690. module.exports = function from(arrayLike /* , mapfn = undefined, thisArg = undefined */) {
  10691. var O = toObject(arrayLike);
  10692. var C = typeof this == 'function' ? this : Array;
  10693. var argumentsLength = arguments.length;
  10694. var mapfn = argumentsLength > 1 ? arguments[1] : undefined;
  10695. var mapping = mapfn !== undefined;
  10696. var iteratorMethod = getIteratorMethod(O);
  10697. var index = 0;
  10698. var length, result, step, iterator, next, value;
  10699. if (mapping) mapfn = bind(mapfn, argumentsLength > 2 ? arguments[2] : undefined, 2);
  10700. // if the target is not iterable or it's an array with the default iterator - use a simple case
  10701. if (iteratorMethod != undefined && !(C == Array && isArrayIteratorMethod(iteratorMethod))) {
  10702. iterator = getIterator(O, iteratorMethod);
  10703. next = iterator.next;
  10704. result = new C();
  10705. for (;!(step = next.call(iterator)).done; index++) {
  10706. value = mapping ? callWithSafeIterationClosing(iterator, mapfn, [step.value, index], true) : step.value;
  10707. createProperty(result, index, value);
  10708. }
  10709. } else {
  10710. length = toLength(O.length);
  10711. result = new C(length);
  10712. for (;length > index; index++) {
  10713. value = mapping ? mapfn(O[index], index) : O[index];
  10714. createProperty(result, index, value);
  10715. }
  10716. }
  10717. result.length = index;
  10718. return result;
  10719. };
  10720. },{"../internals/call-with-safe-iteration-closing":112,"../internals/create-property":122,"../internals/function-bind-context":142,"../internals/get-iterator":145,"../internals/get-iterator-method":144,"../internals/is-array-iterator-method":158,"../internals/to-length":221,"../internals/to-object":222}],103:[function(require,module,exports){
  10721. var toIndexedObject = require('../internals/to-indexed-object');
  10722. var toLength = require('../internals/to-length');
  10723. var toAbsoluteIndex = require('../internals/to-absolute-index');
  10724. // `Array.prototype.{ indexOf, includes }` methods implementation
  10725. var createMethod = function (IS_INCLUDES) {
  10726. return function ($this, el, fromIndex) {
  10727. var O = toIndexedObject($this);
  10728. var length = toLength(O.length);
  10729. var index = toAbsoluteIndex(fromIndex, length);
  10730. var value;
  10731. // Array#includes uses SameValueZero equality algorithm
  10732. // eslint-disable-next-line no-self-compare -- NaN check
  10733. if (IS_INCLUDES && el != el) while (length > index) {
  10734. value = O[index++];
  10735. // eslint-disable-next-line no-self-compare -- NaN check
  10736. if (value != value) return true;
  10737. // Array#indexOf ignores holes, Array#includes - not
  10738. } else for (;length > index; index++) {
  10739. if ((IS_INCLUDES || index in O) && O[index] === el) return IS_INCLUDES || index || 0;
  10740. } return !IS_INCLUDES && -1;
  10741. };
  10742. };
  10743. module.exports = {
  10744. // `Array.prototype.includes` method
  10745. // https://tc39.es/ecma262/#sec-array.prototype.includes
  10746. includes: createMethod(true),
  10747. // `Array.prototype.indexOf` method
  10748. // https://tc39.es/ecma262/#sec-array.prototype.indexof
  10749. indexOf: createMethod(false)
  10750. };
  10751. },{"../internals/to-absolute-index":217,"../internals/to-indexed-object":219,"../internals/to-length":221}],104:[function(require,module,exports){
  10752. var bind = require('../internals/function-bind-context');
  10753. var IndexedObject = require('../internals/indexed-object');
  10754. var toObject = require('../internals/to-object');
  10755. var toLength = require('../internals/to-length');
  10756. var arraySpeciesCreate = require('../internals/array-species-create');
  10757. var push = [].push;
  10758. // `Array.prototype.{ forEach, map, filter, some, every, find, findIndex, filterReject }` methods implementation
  10759. var createMethod = function (TYPE) {
  10760. var IS_MAP = TYPE == 1;
  10761. var IS_FILTER = TYPE == 2;
  10762. var IS_SOME = TYPE == 3;
  10763. var IS_EVERY = TYPE == 4;
  10764. var IS_FIND_INDEX = TYPE == 6;
  10765. var IS_FILTER_REJECT = TYPE == 7;
  10766. var NO_HOLES = TYPE == 5 || IS_FIND_INDEX;
  10767. return function ($this, callbackfn, that, specificCreate) {
  10768. var O = toObject($this);
  10769. var self = IndexedObject(O);
  10770. var boundFunction = bind(callbackfn, that, 3);
  10771. var length = toLength(self.length);
  10772. var index = 0;
  10773. var create = specificCreate || arraySpeciesCreate;
  10774. var target = IS_MAP ? create($this, length) : IS_FILTER || IS_FILTER_REJECT ? create($this, 0) : undefined;
  10775. var value, result;
  10776. for (;length > index; index++) if (NO_HOLES || index in self) {
  10777. value = self[index];
  10778. result = boundFunction(value, index, O);
  10779. if (TYPE) {
  10780. if (IS_MAP) target[index] = result; // map
  10781. else if (result) switch (TYPE) {
  10782. case 3: return true; // some
  10783. case 5: return value; // find
  10784. case 6: return index; // findIndex
  10785. case 2: push.call(target, value); // filter
  10786. } else switch (TYPE) {
  10787. case 4: return false; // every
  10788. case 7: push.call(target, value); // filterReject
  10789. }
  10790. }
  10791. }
  10792. return IS_FIND_INDEX ? -1 : IS_SOME || IS_EVERY ? IS_EVERY : target;
  10793. };
  10794. };
  10795. module.exports = {
  10796. // `Array.prototype.forEach` method
  10797. // https://tc39.es/ecma262/#sec-array.prototype.foreach
  10798. forEach: createMethod(0),
  10799. // `Array.prototype.map` method
  10800. // https://tc39.es/ecma262/#sec-array.prototype.map
  10801. map: createMethod(1),
  10802. // `Array.prototype.filter` method
  10803. // https://tc39.es/ecma262/#sec-array.prototype.filter
  10804. filter: createMethod(2),
  10805. // `Array.prototype.some` method
  10806. // https://tc39.es/ecma262/#sec-array.prototype.some
  10807. some: createMethod(3),
  10808. // `Array.prototype.every` method
  10809. // https://tc39.es/ecma262/#sec-array.prototype.every
  10810. every: createMethod(4),
  10811. // `Array.prototype.find` method
  10812. // https://tc39.es/ecma262/#sec-array.prototype.find
  10813. find: createMethod(5),
  10814. // `Array.prototype.findIndex` method
  10815. // https://tc39.es/ecma262/#sec-array.prototype.findIndex
  10816. findIndex: createMethod(6),
  10817. // `Array.prototype.filterReject` method
  10818. // https://github.com/tc39/proposal-array-filtering
  10819. filterReject: createMethod(7)
  10820. };
  10821. },{"../internals/array-species-create":111,"../internals/function-bind-context":142,"../internals/indexed-object":154,"../internals/to-length":221,"../internals/to-object":222}],105:[function(require,module,exports){
  10822. 'use strict';
  10823. /* eslint-disable es/no-array-prototype-lastindexof -- safe */
  10824. var toIndexedObject = require('../internals/to-indexed-object');
  10825. var toInteger = require('../internals/to-integer');
  10826. var toLength = require('../internals/to-length');
  10827. var arrayMethodIsStrict = require('../internals/array-method-is-strict');
  10828. var min = Math.min;
  10829. var $lastIndexOf = [].lastIndexOf;
  10830. var NEGATIVE_ZERO = !!$lastIndexOf && 1 / [1].lastIndexOf(1, -0) < 0;
  10831. var STRICT_METHOD = arrayMethodIsStrict('lastIndexOf');
  10832. var FORCED = NEGATIVE_ZERO || !STRICT_METHOD;
  10833. // `Array.prototype.lastIndexOf` method implementation
  10834. // https://tc39.es/ecma262/#sec-array.prototype.lastindexof
  10835. module.exports = FORCED ? function lastIndexOf(searchElement /* , fromIndex = @[*-1] */) {
  10836. // convert -0 to +0
  10837. if (NEGATIVE_ZERO) return $lastIndexOf.apply(this, arguments) || 0;
  10838. var O = toIndexedObject(this);
  10839. var length = toLength(O.length);
  10840. var index = length - 1;
  10841. if (arguments.length > 1) index = min(index, toInteger(arguments[1]));
  10842. if (index < 0) index = length + index;
  10843. for (;index >= 0; index--) if (index in O && O[index] === searchElement) return index || 0;
  10844. return -1;
  10845. } : $lastIndexOf;
  10846. },{"../internals/array-method-is-strict":107,"../internals/to-indexed-object":219,"../internals/to-integer":220,"../internals/to-length":221}],106:[function(require,module,exports){
  10847. var fails = require('../internals/fails');
  10848. var wellKnownSymbol = require('../internals/well-known-symbol');
  10849. var V8_VERSION = require('../internals/engine-v8-version');
  10850. var SPECIES = wellKnownSymbol('species');
  10851. module.exports = function (METHOD_NAME) {
  10852. // We can't use this feature detection in V8 since it causes
  10853. // deoptimization and serious performance degradation
  10854. // https://github.com/zloirock/core-js/issues/677
  10855. return V8_VERSION >= 51 || !fails(function () {
  10856. var array = [];
  10857. var constructor = array.constructor = {};
  10858. constructor[SPECIES] = function () {
  10859. return { foo: 1 };
  10860. };
  10861. return array[METHOD_NAME](Boolean).foo !== 1;
  10862. });
  10863. };
  10864. },{"../internals/engine-v8-version":136,"../internals/fails":140,"../internals/well-known-symbol":237}],107:[function(require,module,exports){
  10865. 'use strict';
  10866. var fails = require('../internals/fails');
  10867. module.exports = function (METHOD_NAME, argument) {
  10868. var method = [][METHOD_NAME];
  10869. return !!method && fails(function () {
  10870. // eslint-disable-next-line no-useless-call,no-throw-literal -- required for testing
  10871. method.call(null, argument || function () { throw 1; }, 1);
  10872. });
  10873. };
  10874. },{"../internals/fails":140}],108:[function(require,module,exports){
  10875. var aFunction = require('../internals/a-function');
  10876. var toObject = require('../internals/to-object');
  10877. var IndexedObject = require('../internals/indexed-object');
  10878. var toLength = require('../internals/to-length');
  10879. // `Array.prototype.{ reduce, reduceRight }` methods implementation
  10880. var createMethod = function (IS_RIGHT) {
  10881. return function (that, callbackfn, argumentsLength, memo) {
  10882. aFunction(callbackfn);
  10883. var O = toObject(that);
  10884. var self = IndexedObject(O);
  10885. var length = toLength(O.length);
  10886. var index = IS_RIGHT ? length - 1 : 0;
  10887. var i = IS_RIGHT ? -1 : 1;
  10888. if (argumentsLength < 2) while (true) {
  10889. if (index in self) {
  10890. memo = self[index];
  10891. index += i;
  10892. break;
  10893. }
  10894. index += i;
  10895. if (IS_RIGHT ? index < 0 : length <= index) {
  10896. throw TypeError('Reduce of empty array with no initial value');
  10897. }
  10898. }
  10899. for (;IS_RIGHT ? index >= 0 : length > index; index += i) if (index in self) {
  10900. memo = callbackfn(memo, self[index], index, O);
  10901. }
  10902. return memo;
  10903. };
  10904. };
  10905. module.exports = {
  10906. // `Array.prototype.reduce` method
  10907. // https://tc39.es/ecma262/#sec-array.prototype.reduce
  10908. left: createMethod(false),
  10909. // `Array.prototype.reduceRight` method
  10910. // https://tc39.es/ecma262/#sec-array.prototype.reduceright
  10911. right: createMethod(true)
  10912. };
  10913. },{"../internals/a-function":89,"../internals/indexed-object":154,"../internals/to-length":221,"../internals/to-object":222}],109:[function(require,module,exports){
  10914. // TODO: use something more complex like timsort?
  10915. var floor = Math.floor;
  10916. var mergeSort = function (array, comparefn) {
  10917. var length = array.length;
  10918. var middle = floor(length / 2);
  10919. return length < 8 ? insertionSort(array, comparefn) : merge(
  10920. mergeSort(array.slice(0, middle), comparefn),
  10921. mergeSort(array.slice(middle), comparefn),
  10922. comparefn
  10923. );
  10924. };
  10925. var insertionSort = function (array, comparefn) {
  10926. var length = array.length;
  10927. var i = 1;
  10928. var element, j;
  10929. while (i < length) {
  10930. j = i;
  10931. element = array[i];
  10932. while (j && comparefn(array[j - 1], element) > 0) {
  10933. array[j] = array[--j];
  10934. }
  10935. if (j !== i++) array[j] = element;
  10936. } return array;
  10937. };
  10938. var merge = function (left, right, comparefn) {
  10939. var llength = left.length;
  10940. var rlength = right.length;
  10941. var lindex = 0;
  10942. var rindex = 0;
  10943. var result = [];
  10944. while (lindex < llength || rindex < rlength) {
  10945. if (lindex < llength && rindex < rlength) {
  10946. result.push(comparefn(left[lindex], right[rindex]) <= 0 ? left[lindex++] : right[rindex++]);
  10947. } else {
  10948. result.push(lindex < llength ? left[lindex++] : right[rindex++]);
  10949. }
  10950. } return result;
  10951. };
  10952. module.exports = mergeSort;
  10953. },{}],110:[function(require,module,exports){
  10954. var isObject = require('../internals/is-object');
  10955. var isArray = require('../internals/is-array');
  10956. var wellKnownSymbol = require('../internals/well-known-symbol');
  10957. var SPECIES = wellKnownSymbol('species');
  10958. // a part of `ArraySpeciesCreate` abstract operation
  10959. // https://tc39.es/ecma262/#sec-arrayspeciescreate
  10960. module.exports = function (originalArray) {
  10961. var C;
  10962. if (isArray(originalArray)) {
  10963. C = originalArray.constructor;
  10964. // cross-realm fallback
  10965. if (typeof C == 'function' && (C === Array || isArray(C.prototype))) C = undefined;
  10966. else if (isObject(C)) {
  10967. C = C[SPECIES];
  10968. if (C === null) C = undefined;
  10969. }
  10970. } return C === undefined ? Array : C;
  10971. };
  10972. },{"../internals/is-array":159,"../internals/is-object":162,"../internals/well-known-symbol":237}],111:[function(require,module,exports){
  10973. var arraySpeciesConstructor = require('../internals/array-species-constructor');
  10974. // `ArraySpeciesCreate` abstract operation
  10975. // https://tc39.es/ecma262/#sec-arrayspeciescreate
  10976. module.exports = function (originalArray, length) {
  10977. return new (arraySpeciesConstructor(originalArray))(length === 0 ? 0 : length);
  10978. };
  10979. },{"../internals/array-species-constructor":110}],112:[function(require,module,exports){
  10980. var anObject = require('../internals/an-object');
  10981. var iteratorClose = require('../internals/iterator-close');
  10982. // call something on iterator step with safe closing on error
  10983. module.exports = function (iterator, fn, value, ENTRIES) {
  10984. try {
  10985. return ENTRIES ? fn(anObject(value)[0], value[1]) : fn(value);
  10986. } catch (error) {
  10987. iteratorClose(iterator, 'throw', error);
  10988. }
  10989. };
  10990. },{"../internals/an-object":94,"../internals/iterator-close":167}],113:[function(require,module,exports){
  10991. var wellKnownSymbol = require('../internals/well-known-symbol');
  10992. var ITERATOR = wellKnownSymbol('iterator');
  10993. var SAFE_CLOSING = false;
  10994. try {
  10995. var called = 0;
  10996. var iteratorWithReturn = {
  10997. next: function () {
  10998. return { done: !!called++ };
  10999. },
  11000. 'return': function () {
  11001. SAFE_CLOSING = true;
  11002. }
  11003. };
  11004. iteratorWithReturn[ITERATOR] = function () {
  11005. return this;
  11006. };
  11007. // eslint-disable-next-line es/no-array-from, no-throw-literal -- required for testing
  11008. Array.from(iteratorWithReturn, function () { throw 2; });
  11009. } catch (error) { /* empty */ }
  11010. module.exports = function (exec, SKIP_CLOSING) {
  11011. if (!SKIP_CLOSING && !SAFE_CLOSING) return false;
  11012. var ITERATION_SUPPORT = false;
  11013. try {
  11014. var object = {};
  11015. object[ITERATOR] = function () {
  11016. return {
  11017. next: function () {
  11018. return { done: ITERATION_SUPPORT = true };
  11019. }
  11020. };
  11021. };
  11022. exec(object);
  11023. } catch (error) { /* empty */ }
  11024. return ITERATION_SUPPORT;
  11025. };
  11026. },{"../internals/well-known-symbol":237}],114:[function(require,module,exports){
  11027. var toString = {}.toString;
  11028. module.exports = function (it) {
  11029. return toString.call(it).slice(8, -1);
  11030. };
  11031. },{}],115:[function(require,module,exports){
  11032. var TO_STRING_TAG_SUPPORT = require('../internals/to-string-tag-support');
  11033. var classofRaw = require('../internals/classof-raw');
  11034. var wellKnownSymbol = require('../internals/well-known-symbol');
  11035. var TO_STRING_TAG = wellKnownSymbol('toStringTag');
  11036. // ES3 wrong here
  11037. var CORRECT_ARGUMENTS = classofRaw(function () { return arguments; }()) == 'Arguments';
  11038. // fallback for IE11 Script Access Denied error
  11039. var tryGet = function (it, key) {
  11040. try {
  11041. return it[key];
  11042. } catch (error) { /* empty */ }
  11043. };
  11044. // getting tag from ES6+ `Object.prototype.toString`
  11045. module.exports = TO_STRING_TAG_SUPPORT ? classofRaw : function (it) {
  11046. var O, tag, result;
  11047. return it === undefined ? 'Undefined' : it === null ? 'Null'
  11048. // @@toStringTag case
  11049. : typeof (tag = tryGet(O = Object(it), TO_STRING_TAG)) == 'string' ? tag
  11050. // builtinTag case
  11051. : CORRECT_ARGUMENTS ? classofRaw(O)
  11052. // ES3 arguments fallback
  11053. : (result = classofRaw(O)) == 'Object' && typeof O.callee == 'function' ? 'Arguments' : result;
  11054. };
  11055. },{"../internals/classof-raw":114,"../internals/to-string-tag-support":227,"../internals/well-known-symbol":237}],116:[function(require,module,exports){
  11056. var has = require('../internals/has');
  11057. var ownKeys = require('../internals/own-keys');
  11058. var getOwnPropertyDescriptorModule = require('../internals/object-get-own-property-descriptor');
  11059. var definePropertyModule = require('../internals/object-define-property');
  11060. module.exports = function (target, source) {
  11061. var keys = ownKeys(source);
  11062. var defineProperty = definePropertyModule.f;
  11063. var getOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f;
  11064. for (var i = 0; i < keys.length; i++) {
  11065. var key = keys[i];
  11066. if (!has(target, key)) defineProperty(target, key, getOwnPropertyDescriptor(source, key));
  11067. }
  11068. };
  11069. },{"../internals/has":148,"../internals/object-define-property":179,"../internals/object-get-own-property-descriptor":180,"../internals/own-keys":192}],117:[function(require,module,exports){
  11070. var wellKnownSymbol = require('../internals/well-known-symbol');
  11071. var MATCH = wellKnownSymbol('match');
  11072. module.exports = function (METHOD_NAME) {
  11073. var regexp = /./;
  11074. try {
  11075. '/./'[METHOD_NAME](regexp);
  11076. } catch (error1) {
  11077. try {
  11078. regexp[MATCH] = false;
  11079. return '/./'[METHOD_NAME](regexp);
  11080. } catch (error2) { /* empty */ }
  11081. } return false;
  11082. };
  11083. },{"../internals/well-known-symbol":237}],118:[function(require,module,exports){
  11084. var fails = require('../internals/fails');
  11085. module.exports = !fails(function () {
  11086. function F() { /* empty */ }
  11087. F.prototype.constructor = null;
  11088. // eslint-disable-next-line es/no-object-getprototypeof -- required for testing
  11089. return Object.getPrototypeOf(new F()) !== F.prototype;
  11090. });
  11091. },{"../internals/fails":140}],119:[function(require,module,exports){
  11092. 'use strict';
  11093. var IteratorPrototype = require('../internals/iterators-core').IteratorPrototype;
  11094. var create = require('../internals/object-create');
  11095. var createPropertyDescriptor = require('../internals/create-property-descriptor');
  11096. var setToStringTag = require('../internals/set-to-string-tag');
  11097. var Iterators = require('../internals/iterators');
  11098. var returnThis = function () { return this; };
  11099. module.exports = function (IteratorConstructor, NAME, next) {
  11100. var TO_STRING_TAG = NAME + ' Iterator';
  11101. IteratorConstructor.prototype = create(IteratorPrototype, { next: createPropertyDescriptor(1, next) });
  11102. setToStringTag(IteratorConstructor, TO_STRING_TAG, false, true);
  11103. Iterators[TO_STRING_TAG] = returnThis;
  11104. return IteratorConstructor;
  11105. };
  11106. },{"../internals/create-property-descriptor":121,"../internals/iterators":169,"../internals/iterators-core":168,"../internals/object-create":177,"../internals/set-to-string-tag":208}],120:[function(require,module,exports){
  11107. var DESCRIPTORS = require('../internals/descriptors');
  11108. var definePropertyModule = require('../internals/object-define-property');
  11109. var createPropertyDescriptor = require('../internals/create-property-descriptor');
  11110. module.exports = DESCRIPTORS ? function (object, key, value) {
  11111. return definePropertyModule.f(object, key, createPropertyDescriptor(1, value));
  11112. } : function (object, key, value) {
  11113. object[key] = value;
  11114. return object;
  11115. };
  11116. },{"../internals/create-property-descriptor":121,"../internals/descriptors":125,"../internals/object-define-property":179}],121:[function(require,module,exports){
  11117. module.exports = function (bitmap, value) {
  11118. return {
  11119. enumerable: !(bitmap & 1),
  11120. configurable: !(bitmap & 2),
  11121. writable: !(bitmap & 4),
  11122. value: value
  11123. };
  11124. };
  11125. },{}],122:[function(require,module,exports){
  11126. 'use strict';
  11127. var toPropertyKey = require('../internals/to-property-key');
  11128. var definePropertyModule = require('../internals/object-define-property');
  11129. var createPropertyDescriptor = require('../internals/create-property-descriptor');
  11130. module.exports = function (object, key, value) {
  11131. var propertyKey = toPropertyKey(key);
  11132. if (propertyKey in object) definePropertyModule.f(object, propertyKey, createPropertyDescriptor(0, value));
  11133. else object[propertyKey] = value;
  11134. };
  11135. },{"../internals/create-property-descriptor":121,"../internals/object-define-property":179,"../internals/to-property-key":226}],123:[function(require,module,exports){
  11136. 'use strict';
  11137. var $ = require('../internals/export');
  11138. var createIteratorConstructor = require('../internals/create-iterator-constructor');
  11139. var getPrototypeOf = require('../internals/object-get-prototype-of');
  11140. var setPrototypeOf = require('../internals/object-set-prototype-of');
  11141. var setToStringTag = require('../internals/set-to-string-tag');
  11142. var createNonEnumerableProperty = require('../internals/create-non-enumerable-property');
  11143. var redefine = require('../internals/redefine');
  11144. var wellKnownSymbol = require('../internals/well-known-symbol');
  11145. var IS_PURE = require('../internals/is-pure');
  11146. var Iterators = require('../internals/iterators');
  11147. var IteratorsCore = require('../internals/iterators-core');
  11148. var IteratorPrototype = IteratorsCore.IteratorPrototype;
  11149. var BUGGY_SAFARI_ITERATORS = IteratorsCore.BUGGY_SAFARI_ITERATORS;
  11150. var ITERATOR = wellKnownSymbol('iterator');
  11151. var KEYS = 'keys';
  11152. var VALUES = 'values';
  11153. var ENTRIES = 'entries';
  11154. var returnThis = function () { return this; };
  11155. module.exports = function (Iterable, NAME, IteratorConstructor, next, DEFAULT, IS_SET, FORCED) {
  11156. createIteratorConstructor(IteratorConstructor, NAME, next);
  11157. var getIterationMethod = function (KIND) {
  11158. if (KIND === DEFAULT && defaultIterator) return defaultIterator;
  11159. if (!BUGGY_SAFARI_ITERATORS && KIND in IterablePrototype) return IterablePrototype[KIND];
  11160. switch (KIND) {
  11161. case KEYS: return function keys() { return new IteratorConstructor(this, KIND); };
  11162. case VALUES: return function values() { return new IteratorConstructor(this, KIND); };
  11163. case ENTRIES: return function entries() { return new IteratorConstructor(this, KIND); };
  11164. } return function () { return new IteratorConstructor(this); };
  11165. };
  11166. var TO_STRING_TAG = NAME + ' Iterator';
  11167. var INCORRECT_VALUES_NAME = false;
  11168. var IterablePrototype = Iterable.prototype;
  11169. var nativeIterator = IterablePrototype[ITERATOR]
  11170. || IterablePrototype['@@iterator']
  11171. || DEFAULT && IterablePrototype[DEFAULT];
  11172. var defaultIterator = !BUGGY_SAFARI_ITERATORS && nativeIterator || getIterationMethod(DEFAULT);
  11173. var anyNativeIterator = NAME == 'Array' ? IterablePrototype.entries || nativeIterator : nativeIterator;
  11174. var CurrentIteratorPrototype, methods, KEY;
  11175. // fix native
  11176. if (anyNativeIterator) {
  11177. CurrentIteratorPrototype = getPrototypeOf(anyNativeIterator.call(new Iterable()));
  11178. if (IteratorPrototype !== Object.prototype && CurrentIteratorPrototype.next) {
  11179. if (!IS_PURE && getPrototypeOf(CurrentIteratorPrototype) !== IteratorPrototype) {
  11180. if (setPrototypeOf) {
  11181. setPrototypeOf(CurrentIteratorPrototype, IteratorPrototype);
  11182. } else if (typeof CurrentIteratorPrototype[ITERATOR] != 'function') {
  11183. createNonEnumerableProperty(CurrentIteratorPrototype, ITERATOR, returnThis);
  11184. }
  11185. }
  11186. // Set @@toStringTag to native iterators
  11187. setToStringTag(CurrentIteratorPrototype, TO_STRING_TAG, true, true);
  11188. if (IS_PURE) Iterators[TO_STRING_TAG] = returnThis;
  11189. }
  11190. }
  11191. // fix Array.prototype.{ values, @@iterator }.name in V8 / FF
  11192. if (DEFAULT == VALUES && nativeIterator && nativeIterator.name !== VALUES) {
  11193. INCORRECT_VALUES_NAME = true;
  11194. defaultIterator = function values() { return nativeIterator.call(this); };
  11195. }
  11196. // define iterator
  11197. if ((!IS_PURE || FORCED) && IterablePrototype[ITERATOR] !== defaultIterator) {
  11198. createNonEnumerableProperty(IterablePrototype, ITERATOR, defaultIterator);
  11199. }
  11200. Iterators[NAME] = defaultIterator;
  11201. // export additional methods
  11202. if (DEFAULT) {
  11203. methods = {
  11204. values: getIterationMethod(VALUES),
  11205. keys: IS_SET ? defaultIterator : getIterationMethod(KEYS),
  11206. entries: getIterationMethod(ENTRIES)
  11207. };
  11208. if (FORCED) for (KEY in methods) {
  11209. if (BUGGY_SAFARI_ITERATORS || INCORRECT_VALUES_NAME || !(KEY in IterablePrototype)) {
  11210. redefine(IterablePrototype, KEY, methods[KEY]);
  11211. }
  11212. } else $({ target: NAME, proto: true, forced: BUGGY_SAFARI_ITERATORS || INCORRECT_VALUES_NAME }, methods);
  11213. }
  11214. return methods;
  11215. };
  11216. },{"../internals/create-iterator-constructor":119,"../internals/create-non-enumerable-property":120,"../internals/export":139,"../internals/is-pure":163,"../internals/iterators":169,"../internals/iterators-core":168,"../internals/object-get-prototype-of":184,"../internals/object-set-prototype-of":188,"../internals/redefine":197,"../internals/set-to-string-tag":208,"../internals/well-known-symbol":237}],124:[function(require,module,exports){
  11217. var path = require('../internals/path');
  11218. var has = require('../internals/has');
  11219. var wrappedWellKnownSymbolModule = require('../internals/well-known-symbol-wrapped');
  11220. var defineProperty = require('../internals/object-define-property').f;
  11221. module.exports = function (NAME) {
  11222. var Symbol = path.Symbol || (path.Symbol = {});
  11223. if (!has(Symbol, NAME)) defineProperty(Symbol, NAME, {
  11224. value: wrappedWellKnownSymbolModule.f(NAME)
  11225. });
  11226. };
  11227. },{"../internals/has":148,"../internals/object-define-property":179,"../internals/path":193,"../internals/well-known-symbol-wrapped":236}],125:[function(require,module,exports){
  11228. var fails = require('../internals/fails');
  11229. // Detect IE8's incomplete defineProperty implementation
  11230. module.exports = !fails(function () {
  11231. // eslint-disable-next-line es/no-object-defineproperty -- required for testing
  11232. return Object.defineProperty({}, 1, { get: function () { return 7; } })[1] != 7;
  11233. });
  11234. },{"../internals/fails":140}],126:[function(require,module,exports){
  11235. var global = require('../internals/global');
  11236. var isObject = require('../internals/is-object');
  11237. var document = global.document;
  11238. // typeof document.createElement is 'object' in old IE
  11239. var EXISTS = isObject(document) && isObject(document.createElement);
  11240. module.exports = function (it) {
  11241. return EXISTS ? document.createElement(it) : {};
  11242. };
  11243. },{"../internals/global":147,"../internals/is-object":162}],127:[function(require,module,exports){
  11244. // iterable DOM collections
  11245. // flag - `iterable` interface - 'entries', 'keys', 'values', 'forEach' methods
  11246. module.exports = {
  11247. CSSRuleList: 0,
  11248. CSSStyleDeclaration: 0,
  11249. CSSValueList: 0,
  11250. ClientRectList: 0,
  11251. DOMRectList: 0,
  11252. DOMStringList: 0,
  11253. DOMTokenList: 1,
  11254. DataTransferItemList: 0,
  11255. FileList: 0,
  11256. HTMLAllCollection: 0,
  11257. HTMLCollection: 0,
  11258. HTMLFormElement: 0,
  11259. HTMLSelectElement: 0,
  11260. MediaList: 0,
  11261. MimeTypeArray: 0,
  11262. NamedNodeMap: 0,
  11263. NodeList: 1,
  11264. PaintRequestList: 0,
  11265. Plugin: 0,
  11266. PluginArray: 0,
  11267. SVGLengthList: 0,
  11268. SVGNumberList: 0,
  11269. SVGPathSegList: 0,
  11270. SVGPointList: 0,
  11271. SVGStringList: 0,
  11272. SVGTransformList: 0,
  11273. SourceBufferList: 0,
  11274. StyleSheetList: 0,
  11275. TextTrackCueList: 0,
  11276. TextTrackList: 0,
  11277. TouchList: 0
  11278. };
  11279. },{}],128:[function(require,module,exports){
  11280. var userAgent = require('../internals/engine-user-agent');
  11281. var firefox = userAgent.match(/firefox\/(\d+)/i);
  11282. module.exports = !!firefox && +firefox[1];
  11283. },{"../internals/engine-user-agent":135}],129:[function(require,module,exports){
  11284. module.exports = typeof window == 'object';
  11285. },{}],130:[function(require,module,exports){
  11286. var UA = require('../internals/engine-user-agent');
  11287. module.exports = /MSIE|Trident/.test(UA);
  11288. },{"../internals/engine-user-agent":135}],131:[function(require,module,exports){
  11289. var userAgent = require('../internals/engine-user-agent');
  11290. var global = require('../internals/global');
  11291. module.exports = /ipad|iphone|ipod/i.test(userAgent) && global.Pebble !== undefined;
  11292. },{"../internals/engine-user-agent":135,"../internals/global":147}],132:[function(require,module,exports){
  11293. var userAgent = require('../internals/engine-user-agent');
  11294. module.exports = /(?:ipad|iphone|ipod).*applewebkit/i.test(userAgent);
  11295. },{"../internals/engine-user-agent":135}],133:[function(require,module,exports){
  11296. var classof = require('../internals/classof-raw');
  11297. var global = require('../internals/global');
  11298. module.exports = classof(global.process) == 'process';
  11299. },{"../internals/classof-raw":114,"../internals/global":147}],134:[function(require,module,exports){
  11300. var userAgent = require('../internals/engine-user-agent');
  11301. module.exports = /web0s(?!.*chrome)/i.test(userAgent);
  11302. },{"../internals/engine-user-agent":135}],135:[function(require,module,exports){
  11303. var getBuiltIn = require('../internals/get-built-in');
  11304. module.exports = getBuiltIn('navigator', 'userAgent') || '';
  11305. },{"../internals/get-built-in":143}],136:[function(require,module,exports){
  11306. var global = require('../internals/global');
  11307. var userAgent = require('../internals/engine-user-agent');
  11308. var process = global.process;
  11309. var Deno = global.Deno;
  11310. var versions = process && process.versions || Deno && Deno.version;
  11311. var v8 = versions && versions.v8;
  11312. var match, version;
  11313. if (v8) {
  11314. match = v8.split('.');
  11315. version = match[0] < 4 ? 1 : match[0] + match[1];
  11316. } else if (userAgent) {
  11317. match = userAgent.match(/Edge\/(\d+)/);
  11318. if (!match || match[1] >= 74) {
  11319. match = userAgent.match(/Chrome\/(\d+)/);
  11320. if (match) version = match[1];
  11321. }
  11322. }
  11323. module.exports = version && +version;
  11324. },{"../internals/engine-user-agent":135,"../internals/global":147}],137:[function(require,module,exports){
  11325. var userAgent = require('../internals/engine-user-agent');
  11326. var webkit = userAgent.match(/AppleWebKit\/(\d+)\./);
  11327. module.exports = !!webkit && +webkit[1];
  11328. },{"../internals/engine-user-agent":135}],138:[function(require,module,exports){
  11329. // IE8- don't enum bug keys
  11330. module.exports = [
  11331. 'constructor',
  11332. 'hasOwnProperty',
  11333. 'isPrototypeOf',
  11334. 'propertyIsEnumerable',
  11335. 'toLocaleString',
  11336. 'toString',
  11337. 'valueOf'
  11338. ];
  11339. },{}],139:[function(require,module,exports){
  11340. var global = require('../internals/global');
  11341. var getOwnPropertyDescriptor = require('../internals/object-get-own-property-descriptor').f;
  11342. var createNonEnumerableProperty = require('../internals/create-non-enumerable-property');
  11343. var redefine = require('../internals/redefine');
  11344. var setGlobal = require('../internals/set-global');
  11345. var copyConstructorProperties = require('../internals/copy-constructor-properties');
  11346. var isForced = require('../internals/is-forced');
  11347. /*
  11348. options.target - name of the target object
  11349. options.global - target is the global object
  11350. options.stat - export as static methods of target
  11351. options.proto - export as prototype methods of target
  11352. options.real - real prototype method for the `pure` version
  11353. options.forced - export even if the native feature is available
  11354. options.bind - bind methods to the target, required for the `pure` version
  11355. options.wrap - wrap constructors to preventing global pollution, required for the `pure` version
  11356. options.unsafe - use the simple assignment of property instead of delete + defineProperty
  11357. options.sham - add a flag to not completely full polyfills
  11358. options.enumerable - export as enumerable property
  11359. options.noTargetGet - prevent calling a getter on target
  11360. */
  11361. module.exports = function (options, source) {
  11362. var TARGET = options.target;
  11363. var GLOBAL = options.global;
  11364. var STATIC = options.stat;
  11365. var FORCED, target, key, targetProperty, sourceProperty, descriptor;
  11366. if (GLOBAL) {
  11367. target = global;
  11368. } else if (STATIC) {
  11369. target = global[TARGET] || setGlobal(TARGET, {});
  11370. } else {
  11371. target = (global[TARGET] || {}).prototype;
  11372. }
  11373. if (target) for (key in source) {
  11374. sourceProperty = source[key];
  11375. if (options.noTargetGet) {
  11376. descriptor = getOwnPropertyDescriptor(target, key);
  11377. targetProperty = descriptor && descriptor.value;
  11378. } else targetProperty = target[key];
  11379. FORCED = isForced(GLOBAL ? key : TARGET + (STATIC ? '.' : '#') + key, options.forced);
  11380. // contained in target
  11381. if (!FORCED && targetProperty !== undefined) {
  11382. if (typeof sourceProperty === typeof targetProperty) continue;
  11383. copyConstructorProperties(sourceProperty, targetProperty);
  11384. }
  11385. // add a flag to not completely full polyfills
  11386. if (options.sham || (targetProperty && targetProperty.sham)) {
  11387. createNonEnumerableProperty(sourceProperty, 'sham', true);
  11388. }
  11389. // extend global
  11390. redefine(target, key, sourceProperty, options);
  11391. }
  11392. };
  11393. },{"../internals/copy-constructor-properties":116,"../internals/create-non-enumerable-property":120,"../internals/global":147,"../internals/is-forced":160,"../internals/object-get-own-property-descriptor":180,"../internals/redefine":197,"../internals/set-global":206}],140:[function(require,module,exports){
  11394. module.exports = function (exec) {
  11395. try {
  11396. return !!exec();
  11397. } catch (error) {
  11398. return true;
  11399. }
  11400. };
  11401. },{}],141:[function(require,module,exports){
  11402. 'use strict';
  11403. // TODO: Remove from `core-js@4` since it's moved to entry points
  11404. require('../modules/es.regexp.exec');
  11405. var redefine = require('../internals/redefine');
  11406. var regexpExec = require('../internals/regexp-exec');
  11407. var fails = require('../internals/fails');
  11408. var wellKnownSymbol = require('../internals/well-known-symbol');
  11409. var createNonEnumerableProperty = require('../internals/create-non-enumerable-property');
  11410. var SPECIES = wellKnownSymbol('species');
  11411. var RegExpPrototype = RegExp.prototype;
  11412. module.exports = function (KEY, exec, FORCED, SHAM) {
  11413. var SYMBOL = wellKnownSymbol(KEY);
  11414. var DELEGATES_TO_SYMBOL = !fails(function () {
  11415. // String methods call symbol-named RegEp methods
  11416. var O = {};
  11417. O[SYMBOL] = function () { return 7; };
  11418. return ''[KEY](O) != 7;
  11419. });
  11420. var DELEGATES_TO_EXEC = DELEGATES_TO_SYMBOL && !fails(function () {
  11421. // Symbol-named RegExp methods call .exec
  11422. var execCalled = false;
  11423. var re = /a/;
  11424. if (KEY === 'split') {
  11425. // We can't use real regex here since it causes deoptimization
  11426. // and serious performance degradation in V8
  11427. // https://github.com/zloirock/core-js/issues/306
  11428. re = {};
  11429. // RegExp[@@split] doesn't call the regex's exec method, but first creates
  11430. // a new one. We need to return the patched regex when creating the new one.
  11431. re.constructor = {};
  11432. re.constructor[SPECIES] = function () { return re; };
  11433. re.flags = '';
  11434. re[SYMBOL] = /./[SYMBOL];
  11435. }
  11436. re.exec = function () { execCalled = true; return null; };
  11437. re[SYMBOL]('');
  11438. return !execCalled;
  11439. });
  11440. if (
  11441. !DELEGATES_TO_SYMBOL ||
  11442. !DELEGATES_TO_EXEC ||
  11443. FORCED
  11444. ) {
  11445. var nativeRegExpMethod = /./[SYMBOL];
  11446. var methods = exec(SYMBOL, ''[KEY], function (nativeMethod, regexp, str, arg2, forceStringMethod) {
  11447. var $exec = regexp.exec;
  11448. if ($exec === regexpExec || $exec === RegExpPrototype.exec) {
  11449. if (DELEGATES_TO_SYMBOL && !forceStringMethod) {
  11450. // The native String method already delegates to @@method (this
  11451. // polyfilled function), leasing to infinite recursion.
  11452. // We avoid it by directly calling the native @@method method.
  11453. return { done: true, value: nativeRegExpMethod.call(regexp, str, arg2) };
  11454. }
  11455. return { done: true, value: nativeMethod.call(str, regexp, arg2) };
  11456. }
  11457. return { done: false };
  11458. });
  11459. redefine(String.prototype, KEY, methods[0]);
  11460. redefine(RegExpPrototype, SYMBOL, methods[1]);
  11461. }
  11462. if (SHAM) createNonEnumerableProperty(RegExpPrototype[SYMBOL], 'sham', true);
  11463. };
  11464. },{"../internals/create-non-enumerable-property":120,"../internals/fails":140,"../internals/redefine":197,"../internals/regexp-exec":199,"../internals/well-known-symbol":237,"../modules/es.regexp.exec":261}],142:[function(require,module,exports){
  11465. var aFunction = require('../internals/a-function');
  11466. // optional / simple context binding
  11467. module.exports = function (fn, that, length) {
  11468. aFunction(fn);
  11469. if (that === undefined) return fn;
  11470. switch (length) {
  11471. case 0: return function () {
  11472. return fn.call(that);
  11473. };
  11474. case 1: return function (a) {
  11475. return fn.call(that, a);
  11476. };
  11477. case 2: return function (a, b) {
  11478. return fn.call(that, a, b);
  11479. };
  11480. case 3: return function (a, b, c) {
  11481. return fn.call(that, a, b, c);
  11482. };
  11483. }
  11484. return function (/* ...args */) {
  11485. return fn.apply(that, arguments);
  11486. };
  11487. };
  11488. },{"../internals/a-function":89}],143:[function(require,module,exports){
  11489. var global = require('../internals/global');
  11490. var aFunction = function (variable) {
  11491. return typeof variable == 'function' ? variable : undefined;
  11492. };
  11493. module.exports = function (namespace, method) {
  11494. return arguments.length < 2 ? aFunction(global[namespace]) : global[namespace] && global[namespace][method];
  11495. };
  11496. },{"../internals/global":147}],144:[function(require,module,exports){
  11497. var classof = require('../internals/classof');
  11498. var Iterators = require('../internals/iterators');
  11499. var wellKnownSymbol = require('../internals/well-known-symbol');
  11500. var ITERATOR = wellKnownSymbol('iterator');
  11501. module.exports = function (it) {
  11502. if (it != undefined) return it[ITERATOR]
  11503. || it['@@iterator']
  11504. || Iterators[classof(it)];
  11505. };
  11506. },{"../internals/classof":115,"../internals/iterators":169,"../internals/well-known-symbol":237}],145:[function(require,module,exports){
  11507. var anObject = require('../internals/an-object');
  11508. var getIteratorMethod = require('../internals/get-iterator-method');
  11509. module.exports = function (it, usingIterator) {
  11510. var iteratorMethod = arguments.length < 2 ? getIteratorMethod(it) : usingIterator;
  11511. if (typeof iteratorMethod != 'function') {
  11512. throw TypeError(String(it) + ' is not iterable');
  11513. } return anObject(iteratorMethod.call(it));
  11514. };
  11515. },{"../internals/an-object":94,"../internals/get-iterator-method":144}],146:[function(require,module,exports){
  11516. var toObject = require('../internals/to-object');
  11517. var floor = Math.floor;
  11518. var replace = ''.replace;
  11519. var SUBSTITUTION_SYMBOLS = /\$([$&'`]|\d{1,2}|<[^>]*>)/g;
  11520. var SUBSTITUTION_SYMBOLS_NO_NAMED = /\$([$&'`]|\d{1,2})/g;
  11521. // `GetSubstitution` abstract operation
  11522. // https://tc39.es/ecma262/#sec-getsubstitution
  11523. module.exports = function (matched, str, position, captures, namedCaptures, replacement) {
  11524. var tailPos = position + matched.length;
  11525. var m = captures.length;
  11526. var symbols = SUBSTITUTION_SYMBOLS_NO_NAMED;
  11527. if (namedCaptures !== undefined) {
  11528. namedCaptures = toObject(namedCaptures);
  11529. symbols = SUBSTITUTION_SYMBOLS;
  11530. }
  11531. return replace.call(replacement, symbols, function (match, ch) {
  11532. var capture;
  11533. switch (ch.charAt(0)) {
  11534. case '$': return '$';
  11535. case '&': return matched;
  11536. case '`': return str.slice(0, position);
  11537. case "'": return str.slice(tailPos);
  11538. case '<':
  11539. capture = namedCaptures[ch.slice(1, -1)];
  11540. break;
  11541. default: // \d\d?
  11542. var n = +ch;
  11543. if (n === 0) return match;
  11544. if (n > m) {
  11545. var f = floor(n / 10);
  11546. if (f === 0) return match;
  11547. if (f <= m) return captures[f - 1] === undefined ? ch.charAt(1) : captures[f - 1] + ch.charAt(1);
  11548. return match;
  11549. }
  11550. capture = captures[n - 1];
  11551. }
  11552. return capture === undefined ? '' : capture;
  11553. });
  11554. };
  11555. },{"../internals/to-object":222}],147:[function(require,module,exports){
  11556. (function (global){(function (){
  11557. var check = function (it) {
  11558. return it && it.Math == Math && it;
  11559. };
  11560. // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
  11561. module.exports =
  11562. // eslint-disable-next-line es/no-global-this -- safe
  11563. check(typeof globalThis == 'object' && globalThis) ||
  11564. check(typeof window == 'object' && window) ||
  11565. // eslint-disable-next-line no-restricted-globals -- safe
  11566. check(typeof self == 'object' && self) ||
  11567. check(typeof global == 'object' && global) ||
  11568. // eslint-disable-next-line no-new-func -- fallback
  11569. (function () { return this; })() || Function('return this')();
  11570. }).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
  11571. },{}],148:[function(require,module,exports){
  11572. var toObject = require('../internals/to-object');
  11573. var hasOwnProperty = {}.hasOwnProperty;
  11574. module.exports = Object.hasOwn || function hasOwn(it, key) {
  11575. return hasOwnProperty.call(toObject(it), key);
  11576. };
  11577. },{"../internals/to-object":222}],149:[function(require,module,exports){
  11578. module.exports = {};
  11579. },{}],150:[function(require,module,exports){
  11580. var global = require('../internals/global');
  11581. module.exports = function (a, b) {
  11582. var console = global.console;
  11583. if (console && console.error) {
  11584. arguments.length === 1 ? console.error(a) : console.error(a, b);
  11585. }
  11586. };
  11587. },{"../internals/global":147}],151:[function(require,module,exports){
  11588. var getBuiltIn = require('../internals/get-built-in');
  11589. module.exports = getBuiltIn('document', 'documentElement');
  11590. },{"../internals/get-built-in":143}],152:[function(require,module,exports){
  11591. var DESCRIPTORS = require('../internals/descriptors');
  11592. var fails = require('../internals/fails');
  11593. var createElement = require('../internals/document-create-element');
  11594. // Thank's IE8 for his funny defineProperty
  11595. module.exports = !DESCRIPTORS && !fails(function () {
  11596. // eslint-disable-next-line es/no-object-defineproperty -- requied for testing
  11597. return Object.defineProperty(createElement('div'), 'a', {
  11598. get: function () { return 7; }
  11599. }).a != 7;
  11600. });
  11601. },{"../internals/descriptors":125,"../internals/document-create-element":126,"../internals/fails":140}],153:[function(require,module,exports){
  11602. // IEEE754 conversions based on https://github.com/feross/ieee754
  11603. var abs = Math.abs;
  11604. var pow = Math.pow;
  11605. var floor = Math.floor;
  11606. var log = Math.log;
  11607. var LN2 = Math.LN2;
  11608. var pack = function (number, mantissaLength, bytes) {
  11609. var buffer = new Array(bytes);
  11610. var exponentLength = bytes * 8 - mantissaLength - 1;
  11611. var eMax = (1 << exponentLength) - 1;
  11612. var eBias = eMax >> 1;
  11613. var rt = mantissaLength === 23 ? pow(2, -24) - pow(2, -77) : 0;
  11614. var sign = number < 0 || number === 0 && 1 / number < 0 ? 1 : 0;
  11615. var index = 0;
  11616. var exponent, mantissa, c;
  11617. number = abs(number);
  11618. // eslint-disable-next-line no-self-compare -- NaN check
  11619. if (number != number || number === Infinity) {
  11620. // eslint-disable-next-line no-self-compare -- NaN check
  11621. mantissa = number != number ? 1 : 0;
  11622. exponent = eMax;
  11623. } else {
  11624. exponent = floor(log(number) / LN2);
  11625. if (number * (c = pow(2, -exponent)) < 1) {
  11626. exponent--;
  11627. c *= 2;
  11628. }
  11629. if (exponent + eBias >= 1) {
  11630. number += rt / c;
  11631. } else {
  11632. number += rt * pow(2, 1 - eBias);
  11633. }
  11634. if (number * c >= 2) {
  11635. exponent++;
  11636. c /= 2;
  11637. }
  11638. if (exponent + eBias >= eMax) {
  11639. mantissa = 0;
  11640. exponent = eMax;
  11641. } else if (exponent + eBias >= 1) {
  11642. mantissa = (number * c - 1) * pow(2, mantissaLength);
  11643. exponent = exponent + eBias;
  11644. } else {
  11645. mantissa = number * pow(2, eBias - 1) * pow(2, mantissaLength);
  11646. exponent = 0;
  11647. }
  11648. }
  11649. for (; mantissaLength >= 8; buffer[index++] = mantissa & 255, mantissa /= 256, mantissaLength -= 8);
  11650. exponent = exponent << mantissaLength | mantissa;
  11651. exponentLength += mantissaLength;
  11652. for (; exponentLength > 0; buffer[index++] = exponent & 255, exponent /= 256, exponentLength -= 8);
  11653. buffer[--index] |= sign * 128;
  11654. return buffer;
  11655. };
  11656. var unpack = function (buffer, mantissaLength) {
  11657. var bytes = buffer.length;
  11658. var exponentLength = bytes * 8 - mantissaLength - 1;
  11659. var eMax = (1 << exponentLength) - 1;
  11660. var eBias = eMax >> 1;
  11661. var nBits = exponentLength - 7;
  11662. var index = bytes - 1;
  11663. var sign = buffer[index--];
  11664. var exponent = sign & 127;
  11665. var mantissa;
  11666. sign >>= 7;
  11667. for (; nBits > 0; exponent = exponent * 256 + buffer[index], index--, nBits -= 8);
  11668. mantissa = exponent & (1 << -nBits) - 1;
  11669. exponent >>= -nBits;
  11670. nBits += mantissaLength;
  11671. for (; nBits > 0; mantissa = mantissa * 256 + buffer[index], index--, nBits -= 8);
  11672. if (exponent === 0) {
  11673. exponent = 1 - eBias;
  11674. } else if (exponent === eMax) {
  11675. return mantissa ? NaN : sign ? -Infinity : Infinity;
  11676. } else {
  11677. mantissa = mantissa + pow(2, mantissaLength);
  11678. exponent = exponent - eBias;
  11679. } return (sign ? -1 : 1) * mantissa * pow(2, exponent - mantissaLength);
  11680. };
  11681. module.exports = {
  11682. pack: pack,
  11683. unpack: unpack
  11684. };
  11685. },{}],154:[function(require,module,exports){
  11686. var fails = require('../internals/fails');
  11687. var classof = require('../internals/classof-raw');
  11688. var split = ''.split;
  11689. // fallback for non-array-like ES3 and non-enumerable old V8 strings
  11690. module.exports = fails(function () {
  11691. // throws an error in rhino, see https://github.com/mozilla/rhino/issues/346
  11692. // eslint-disable-next-line no-prototype-builtins -- safe
  11693. return !Object('z').propertyIsEnumerable(0);
  11694. }) ? function (it) {
  11695. return classof(it) == 'String' ? split.call(it, '') : Object(it);
  11696. } : Object;
  11697. },{"../internals/classof-raw":114,"../internals/fails":140}],155:[function(require,module,exports){
  11698. var isObject = require('../internals/is-object');
  11699. var setPrototypeOf = require('../internals/object-set-prototype-of');
  11700. // makes subclassing work correct for wrapped built-ins
  11701. module.exports = function ($this, dummy, Wrapper) {
  11702. var NewTarget, NewTargetPrototype;
  11703. if (
  11704. // it can work only with native `setPrototypeOf`
  11705. setPrototypeOf &&
  11706. // we haven't completely correct pre-ES6 way for getting `new.target`, so use this
  11707. typeof (NewTarget = dummy.constructor) == 'function' &&
  11708. NewTarget !== Wrapper &&
  11709. isObject(NewTargetPrototype = NewTarget.prototype) &&
  11710. NewTargetPrototype !== Wrapper.prototype
  11711. ) setPrototypeOf($this, NewTargetPrototype);
  11712. return $this;
  11713. };
  11714. },{"../internals/is-object":162,"../internals/object-set-prototype-of":188}],156:[function(require,module,exports){
  11715. var store = require('../internals/shared-store');
  11716. var functionToString = Function.toString;
  11717. // this helper broken in `core-js@3.4.1-3.4.4`, so we can't use `shared` helper
  11718. if (typeof store.inspectSource != 'function') {
  11719. store.inspectSource = function (it) {
  11720. return functionToString.call(it);
  11721. };
  11722. }
  11723. module.exports = store.inspectSource;
  11724. },{"../internals/shared-store":210}],157:[function(require,module,exports){
  11725. var NATIVE_WEAK_MAP = require('../internals/native-weak-map');
  11726. var global = require('../internals/global');
  11727. var isObject = require('../internals/is-object');
  11728. var createNonEnumerableProperty = require('../internals/create-non-enumerable-property');
  11729. var objectHas = require('../internals/has');
  11730. var shared = require('../internals/shared-store');
  11731. var sharedKey = require('../internals/shared-key');
  11732. var hiddenKeys = require('../internals/hidden-keys');
  11733. var OBJECT_ALREADY_INITIALIZED = 'Object already initialized';
  11734. var WeakMap = global.WeakMap;
  11735. var set, get, has;
  11736. var enforce = function (it) {
  11737. return has(it) ? get(it) : set(it, {});
  11738. };
  11739. var getterFor = function (TYPE) {
  11740. return function (it) {
  11741. var state;
  11742. if (!isObject(it) || (state = get(it)).type !== TYPE) {
  11743. throw TypeError('Incompatible receiver, ' + TYPE + ' required');
  11744. } return state;
  11745. };
  11746. };
  11747. if (NATIVE_WEAK_MAP || shared.state) {
  11748. var store = shared.state || (shared.state = new WeakMap());
  11749. var wmget = store.get;
  11750. var wmhas = store.has;
  11751. var wmset = store.set;
  11752. set = function (it, metadata) {
  11753. if (wmhas.call(store, it)) throw new TypeError(OBJECT_ALREADY_INITIALIZED);
  11754. metadata.facade = it;
  11755. wmset.call(store, it, metadata);
  11756. return metadata;
  11757. };
  11758. get = function (it) {
  11759. return wmget.call(store, it) || {};
  11760. };
  11761. has = function (it) {
  11762. return wmhas.call(store, it);
  11763. };
  11764. } else {
  11765. var STATE = sharedKey('state');
  11766. hiddenKeys[STATE] = true;
  11767. set = function (it, metadata) {
  11768. if (objectHas(it, STATE)) throw new TypeError(OBJECT_ALREADY_INITIALIZED);
  11769. metadata.facade = it;
  11770. createNonEnumerableProperty(it, STATE, metadata);
  11771. return metadata;
  11772. };
  11773. get = function (it) {
  11774. return objectHas(it, STATE) ? it[STATE] : {};
  11775. };
  11776. has = function (it) {
  11777. return objectHas(it, STATE);
  11778. };
  11779. }
  11780. module.exports = {
  11781. set: set,
  11782. get: get,
  11783. has: has,
  11784. enforce: enforce,
  11785. getterFor: getterFor
  11786. };
  11787. },{"../internals/create-non-enumerable-property":120,"../internals/global":147,"../internals/has":148,"../internals/hidden-keys":149,"../internals/is-object":162,"../internals/native-weak-map":173,"../internals/shared-key":209,"../internals/shared-store":210}],158:[function(require,module,exports){
  11788. var wellKnownSymbol = require('../internals/well-known-symbol');
  11789. var Iterators = require('../internals/iterators');
  11790. var ITERATOR = wellKnownSymbol('iterator');
  11791. var ArrayPrototype = Array.prototype;
  11792. // check on default Array iterator
  11793. module.exports = function (it) {
  11794. return it !== undefined && (Iterators.Array === it || ArrayPrototype[ITERATOR] === it);
  11795. };
  11796. },{"../internals/iterators":169,"../internals/well-known-symbol":237}],159:[function(require,module,exports){
  11797. var classof = require('../internals/classof-raw');
  11798. // `IsArray` abstract operation
  11799. // https://tc39.es/ecma262/#sec-isarray
  11800. // eslint-disable-next-line es/no-array-isarray -- safe
  11801. module.exports = Array.isArray || function isArray(arg) {
  11802. return classof(arg) == 'Array';
  11803. };
  11804. },{"../internals/classof-raw":114}],160:[function(require,module,exports){
  11805. var fails = require('../internals/fails');
  11806. var replacement = /#|\.prototype\./;
  11807. var isForced = function (feature, detection) {
  11808. var value = data[normalize(feature)];
  11809. return value == POLYFILL ? true
  11810. : value == NATIVE ? false
  11811. : typeof detection == 'function' ? fails(detection)
  11812. : !!detection;
  11813. };
  11814. var normalize = isForced.normalize = function (string) {
  11815. return String(string).replace(replacement, '.').toLowerCase();
  11816. };
  11817. var data = isForced.data = {};
  11818. var NATIVE = isForced.NATIVE = 'N';
  11819. var POLYFILL = isForced.POLYFILL = 'P';
  11820. module.exports = isForced;
  11821. },{"../internals/fails":140}],161:[function(require,module,exports){
  11822. var isObject = require('../internals/is-object');
  11823. var floor = Math.floor;
  11824. // `Number.isInteger` method implementation
  11825. // https://tc39.es/ecma262/#sec-number.isinteger
  11826. module.exports = function isInteger(it) {
  11827. return !isObject(it) && isFinite(it) && floor(it) === it;
  11828. };
  11829. },{"../internals/is-object":162}],162:[function(require,module,exports){
  11830. module.exports = function (it) {
  11831. return typeof it === 'object' ? it !== null : typeof it === 'function';
  11832. };
  11833. },{}],163:[function(require,module,exports){
  11834. module.exports = false;
  11835. },{}],164:[function(require,module,exports){
  11836. var isObject = require('../internals/is-object');
  11837. var classof = require('../internals/classof-raw');
  11838. var wellKnownSymbol = require('../internals/well-known-symbol');
  11839. var MATCH = wellKnownSymbol('match');
  11840. // `IsRegExp` abstract operation
  11841. // https://tc39.es/ecma262/#sec-isregexp
  11842. module.exports = function (it) {
  11843. var isRegExp;
  11844. return isObject(it) && ((isRegExp = it[MATCH]) !== undefined ? !!isRegExp : classof(it) == 'RegExp');
  11845. };
  11846. },{"../internals/classof-raw":114,"../internals/is-object":162,"../internals/well-known-symbol":237}],165:[function(require,module,exports){
  11847. var getBuiltIn = require('../internals/get-built-in');
  11848. var USE_SYMBOL_AS_UID = require('../internals/use-symbol-as-uid');
  11849. module.exports = USE_SYMBOL_AS_UID ? function (it) {
  11850. return typeof it == 'symbol';
  11851. } : function (it) {
  11852. var $Symbol = getBuiltIn('Symbol');
  11853. return typeof $Symbol == 'function' && Object(it) instanceof $Symbol;
  11854. };
  11855. },{"../internals/get-built-in":143,"../internals/use-symbol-as-uid":235}],166:[function(require,module,exports){
  11856. var anObject = require('../internals/an-object');
  11857. var isArrayIteratorMethod = require('../internals/is-array-iterator-method');
  11858. var toLength = require('../internals/to-length');
  11859. var bind = require('../internals/function-bind-context');
  11860. var getIterator = require('../internals/get-iterator');
  11861. var getIteratorMethod = require('../internals/get-iterator-method');
  11862. var iteratorClose = require('../internals/iterator-close');
  11863. var Result = function (stopped, result) {
  11864. this.stopped = stopped;
  11865. this.result = result;
  11866. };
  11867. module.exports = function (iterable, unboundFunction, options) {
  11868. var that = options && options.that;
  11869. var AS_ENTRIES = !!(options && options.AS_ENTRIES);
  11870. var IS_ITERATOR = !!(options && options.IS_ITERATOR);
  11871. var INTERRUPTED = !!(options && options.INTERRUPTED);
  11872. var fn = bind(unboundFunction, that, 1 + AS_ENTRIES + INTERRUPTED);
  11873. var iterator, iterFn, index, length, result, next, step;
  11874. var stop = function (condition) {
  11875. if (iterator) iteratorClose(iterator, 'normal', condition);
  11876. return new Result(true, condition);
  11877. };
  11878. var callFn = function (value) {
  11879. if (AS_ENTRIES) {
  11880. anObject(value);
  11881. return INTERRUPTED ? fn(value[0], value[1], stop) : fn(value[0], value[1]);
  11882. } return INTERRUPTED ? fn(value, stop) : fn(value);
  11883. };
  11884. if (IS_ITERATOR) {
  11885. iterator = iterable;
  11886. } else {
  11887. iterFn = getIteratorMethod(iterable);
  11888. if (typeof iterFn != 'function') throw TypeError('Target is not iterable');
  11889. // optimisation for array iterators
  11890. if (isArrayIteratorMethod(iterFn)) {
  11891. for (index = 0, length = toLength(iterable.length); length > index; index++) {
  11892. result = callFn(iterable[index]);
  11893. if (result && result instanceof Result) return result;
  11894. } return new Result(false);
  11895. }
  11896. iterator = getIterator(iterable, iterFn);
  11897. }
  11898. next = iterator.next;
  11899. while (!(step = next.call(iterator)).done) {
  11900. try {
  11901. result = callFn(step.value);
  11902. } catch (error) {
  11903. iteratorClose(iterator, 'throw', error);
  11904. }
  11905. if (typeof result == 'object' && result && result instanceof Result) return result;
  11906. } return new Result(false);
  11907. };
  11908. },{"../internals/an-object":94,"../internals/function-bind-context":142,"../internals/get-iterator":145,"../internals/get-iterator-method":144,"../internals/is-array-iterator-method":158,"../internals/iterator-close":167,"../internals/to-length":221}],167:[function(require,module,exports){
  11909. var anObject = require('../internals/an-object');
  11910. module.exports = function (iterator, kind, value) {
  11911. var innerResult, innerError;
  11912. anObject(iterator);
  11913. try {
  11914. innerResult = iterator['return'];
  11915. if (innerResult === undefined) {
  11916. if (kind === 'throw') throw value;
  11917. return value;
  11918. }
  11919. innerResult = innerResult.call(iterator);
  11920. } catch (error) {
  11921. innerError = true;
  11922. innerResult = error;
  11923. }
  11924. if (kind === 'throw') throw value;
  11925. if (innerError) throw innerResult;
  11926. anObject(innerResult);
  11927. return value;
  11928. };
  11929. },{"../internals/an-object":94}],168:[function(require,module,exports){
  11930. 'use strict';
  11931. var fails = require('../internals/fails');
  11932. var getPrototypeOf = require('../internals/object-get-prototype-of');
  11933. var createNonEnumerableProperty = require('../internals/create-non-enumerable-property');
  11934. var has = require('../internals/has');
  11935. var wellKnownSymbol = require('../internals/well-known-symbol');
  11936. var IS_PURE = require('../internals/is-pure');
  11937. var ITERATOR = wellKnownSymbol('iterator');
  11938. var BUGGY_SAFARI_ITERATORS = false;
  11939. var returnThis = function () { return this; };
  11940. // `%IteratorPrototype%` object
  11941. // https://tc39.es/ecma262/#sec-%iteratorprototype%-object
  11942. var IteratorPrototype, PrototypeOfArrayIteratorPrototype, arrayIterator;
  11943. /* eslint-disable es/no-array-prototype-keys -- safe */
  11944. if ([].keys) {
  11945. arrayIterator = [].keys();
  11946. // Safari 8 has buggy iterators w/o `next`
  11947. if (!('next' in arrayIterator)) BUGGY_SAFARI_ITERATORS = true;
  11948. else {
  11949. PrototypeOfArrayIteratorPrototype = getPrototypeOf(getPrototypeOf(arrayIterator));
  11950. if (PrototypeOfArrayIteratorPrototype !== Object.prototype) IteratorPrototype = PrototypeOfArrayIteratorPrototype;
  11951. }
  11952. }
  11953. var NEW_ITERATOR_PROTOTYPE = IteratorPrototype == undefined || fails(function () {
  11954. var test = {};
  11955. // FF44- legacy iterators case
  11956. return IteratorPrototype[ITERATOR].call(test) !== test;
  11957. });
  11958. if (NEW_ITERATOR_PROTOTYPE) IteratorPrototype = {};
  11959. // `%IteratorPrototype%[@@iterator]()` method
  11960. // https://tc39.es/ecma262/#sec-%iteratorprototype%-@@iterator
  11961. if ((!IS_PURE || NEW_ITERATOR_PROTOTYPE) && !has(IteratorPrototype, ITERATOR)) {
  11962. createNonEnumerableProperty(IteratorPrototype, ITERATOR, returnThis);
  11963. }
  11964. module.exports = {
  11965. IteratorPrototype: IteratorPrototype,
  11966. BUGGY_SAFARI_ITERATORS: BUGGY_SAFARI_ITERATORS
  11967. };
  11968. },{"../internals/create-non-enumerable-property":120,"../internals/fails":140,"../internals/has":148,"../internals/is-pure":163,"../internals/object-get-prototype-of":184,"../internals/well-known-symbol":237}],169:[function(require,module,exports){
  11969. arguments[4][149][0].apply(exports,arguments)
  11970. },{"dup":149}],170:[function(require,module,exports){
  11971. var global = require('../internals/global');
  11972. var getOwnPropertyDescriptor = require('../internals/object-get-own-property-descriptor').f;
  11973. var macrotask = require('../internals/task').set;
  11974. var IS_IOS = require('../internals/engine-is-ios');
  11975. var IS_IOS_PEBBLE = require('../internals/engine-is-ios-pebble');
  11976. var IS_WEBOS_WEBKIT = require('../internals/engine-is-webos-webkit');
  11977. var IS_NODE = require('../internals/engine-is-node');
  11978. var MutationObserver = global.MutationObserver || global.WebKitMutationObserver;
  11979. var document = global.document;
  11980. var process = global.process;
  11981. var Promise = global.Promise;
  11982. // Node.js 11 shows ExperimentalWarning on getting `queueMicrotask`
  11983. var queueMicrotaskDescriptor = getOwnPropertyDescriptor(global, 'queueMicrotask');
  11984. var queueMicrotask = queueMicrotaskDescriptor && queueMicrotaskDescriptor.value;
  11985. var flush, head, last, notify, toggle, node, promise, then;
  11986. // modern engines have queueMicrotask method
  11987. if (!queueMicrotask) {
  11988. flush = function () {
  11989. var parent, fn;
  11990. if (IS_NODE && (parent = process.domain)) parent.exit();
  11991. while (head) {
  11992. fn = head.fn;
  11993. head = head.next;
  11994. try {
  11995. fn();
  11996. } catch (error) {
  11997. if (head) notify();
  11998. else last = undefined;
  11999. throw error;
  12000. }
  12001. } last = undefined;
  12002. if (parent) parent.enter();
  12003. };
  12004. // browsers with MutationObserver, except iOS - https://github.com/zloirock/core-js/issues/339
  12005. // also except WebOS Webkit https://github.com/zloirock/core-js/issues/898
  12006. if (!IS_IOS && !IS_NODE && !IS_WEBOS_WEBKIT && MutationObserver && document) {
  12007. toggle = true;
  12008. node = document.createTextNode('');
  12009. new MutationObserver(flush).observe(node, { characterData: true });
  12010. notify = function () {
  12011. node.data = toggle = !toggle;
  12012. };
  12013. // environments with maybe non-completely correct, but existent Promise
  12014. } else if (!IS_IOS_PEBBLE && Promise && Promise.resolve) {
  12015. // Promise.resolve without an argument throws an error in LG WebOS 2
  12016. promise = Promise.resolve(undefined);
  12017. // workaround of WebKit ~ iOS Safari 10.1 bug
  12018. promise.constructor = Promise;
  12019. then = promise.then;
  12020. notify = function () {
  12021. then.call(promise, flush);
  12022. };
  12023. // Node.js without promises
  12024. } else if (IS_NODE) {
  12025. notify = function () {
  12026. process.nextTick(flush);
  12027. };
  12028. // for other environments - macrotask based on:
  12029. // - setImmediate
  12030. // - MessageChannel
  12031. // - window.postMessag
  12032. // - onreadystatechange
  12033. // - setTimeout
  12034. } else {
  12035. notify = function () {
  12036. // strange IE + webpack dev server bug - use .call(global)
  12037. macrotask.call(global, flush);
  12038. };
  12039. }
  12040. }
  12041. module.exports = queueMicrotask || function (fn) {
  12042. var task = { fn: fn, next: undefined };
  12043. if (last) last.next = task;
  12044. if (!head) {
  12045. head = task;
  12046. notify();
  12047. } last = task;
  12048. };
  12049. },{"../internals/engine-is-ios":132,"../internals/engine-is-ios-pebble":131,"../internals/engine-is-node":133,"../internals/engine-is-webos-webkit":134,"../internals/global":147,"../internals/object-get-own-property-descriptor":180,"../internals/task":216}],171:[function(require,module,exports){
  12050. var global = require('../internals/global');
  12051. module.exports = global.Promise;
  12052. },{"../internals/global":147}],172:[function(require,module,exports){
  12053. /* eslint-disable es/no-symbol -- required for testing */
  12054. var V8_VERSION = require('../internals/engine-v8-version');
  12055. var fails = require('../internals/fails');
  12056. // eslint-disable-next-line es/no-object-getownpropertysymbols -- required for testing
  12057. module.exports = !!Object.getOwnPropertySymbols && !fails(function () {
  12058. var symbol = Symbol();
  12059. // Chrome 38 Symbol has incorrect toString conversion
  12060. // `get-own-property-symbols` polyfill symbols converted to object are not Symbol instances
  12061. return !String(symbol) || !(Object(symbol) instanceof Symbol) ||
  12062. // Chrome 38-40 symbols are not inherited from DOM collections prototypes to instances
  12063. !Symbol.sham && V8_VERSION && V8_VERSION < 41;
  12064. });
  12065. },{"../internals/engine-v8-version":136,"../internals/fails":140}],173:[function(require,module,exports){
  12066. var global = require('../internals/global');
  12067. var inspectSource = require('../internals/inspect-source');
  12068. var WeakMap = global.WeakMap;
  12069. module.exports = typeof WeakMap === 'function' && /native code/.test(inspectSource(WeakMap));
  12070. },{"../internals/global":147,"../internals/inspect-source":156}],174:[function(require,module,exports){
  12071. 'use strict';
  12072. var aFunction = require('../internals/a-function');
  12073. var PromiseCapability = function (C) {
  12074. var resolve, reject;
  12075. this.promise = new C(function ($$resolve, $$reject) {
  12076. if (resolve !== undefined || reject !== undefined) throw TypeError('Bad Promise constructor');
  12077. resolve = $$resolve;
  12078. reject = $$reject;
  12079. });
  12080. this.resolve = aFunction(resolve);
  12081. this.reject = aFunction(reject);
  12082. };
  12083. // `NewPromiseCapability` abstract operation
  12084. // https://tc39.es/ecma262/#sec-newpromisecapability
  12085. module.exports.f = function (C) {
  12086. return new PromiseCapability(C);
  12087. };
  12088. },{"../internals/a-function":89}],175:[function(require,module,exports){
  12089. var isRegExp = require('../internals/is-regexp');
  12090. module.exports = function (it) {
  12091. if (isRegExp(it)) {
  12092. throw TypeError("The method doesn't accept regular expressions");
  12093. } return it;
  12094. };
  12095. },{"../internals/is-regexp":164}],176:[function(require,module,exports){
  12096. 'use strict';
  12097. var DESCRIPTORS = require('../internals/descriptors');
  12098. var fails = require('../internals/fails');
  12099. var objectKeys = require('../internals/object-keys');
  12100. var getOwnPropertySymbolsModule = require('../internals/object-get-own-property-symbols');
  12101. var propertyIsEnumerableModule = require('../internals/object-property-is-enumerable');
  12102. var toObject = require('../internals/to-object');
  12103. var IndexedObject = require('../internals/indexed-object');
  12104. // eslint-disable-next-line es/no-object-assign -- safe
  12105. var $assign = Object.assign;
  12106. // eslint-disable-next-line es/no-object-defineproperty -- required for testing
  12107. var defineProperty = Object.defineProperty;
  12108. // `Object.assign` method
  12109. // https://tc39.es/ecma262/#sec-object.assign
  12110. module.exports = !$assign || fails(function () {
  12111. // should have correct order of operations (Edge bug)
  12112. if (DESCRIPTORS && $assign({ b: 1 }, $assign(defineProperty({}, 'a', {
  12113. enumerable: true,
  12114. get: function () {
  12115. defineProperty(this, 'b', {
  12116. value: 3,
  12117. enumerable: false
  12118. });
  12119. }
  12120. }), { b: 2 })).b !== 1) return true;
  12121. // should work with symbols and should have deterministic property order (V8 bug)
  12122. var A = {};
  12123. var B = {};
  12124. // eslint-disable-next-line es/no-symbol -- safe
  12125. var symbol = Symbol();
  12126. var alphabet = 'abcdefghijklmnopqrst';
  12127. A[symbol] = 7;
  12128. alphabet.split('').forEach(function (chr) { B[chr] = chr; });
  12129. return $assign({}, A)[symbol] != 7 || objectKeys($assign({}, B)).join('') != alphabet;
  12130. }) ? function assign(target, source) { // eslint-disable-line no-unused-vars -- required for `.length`
  12131. var T = toObject(target);
  12132. var argumentsLength = arguments.length;
  12133. var index = 1;
  12134. var getOwnPropertySymbols = getOwnPropertySymbolsModule.f;
  12135. var propertyIsEnumerable = propertyIsEnumerableModule.f;
  12136. while (argumentsLength > index) {
  12137. var S = IndexedObject(arguments[index++]);
  12138. var keys = getOwnPropertySymbols ? objectKeys(S).concat(getOwnPropertySymbols(S)) : objectKeys(S);
  12139. var length = keys.length;
  12140. var j = 0;
  12141. var key;
  12142. while (length > j) {
  12143. key = keys[j++];
  12144. if (!DESCRIPTORS || propertyIsEnumerable.call(S, key)) T[key] = S[key];
  12145. }
  12146. } return T;
  12147. } : $assign;
  12148. },{"../internals/descriptors":125,"../internals/fails":140,"../internals/indexed-object":154,"../internals/object-get-own-property-symbols":183,"../internals/object-keys":186,"../internals/object-property-is-enumerable":187,"../internals/to-object":222}],177:[function(require,module,exports){
  12149. /* global ActiveXObject -- old IE, WSH */
  12150. var anObject = require('../internals/an-object');
  12151. var defineProperties = require('../internals/object-define-properties');
  12152. var enumBugKeys = require('../internals/enum-bug-keys');
  12153. var hiddenKeys = require('../internals/hidden-keys');
  12154. var html = require('../internals/html');
  12155. var documentCreateElement = require('../internals/document-create-element');
  12156. var sharedKey = require('../internals/shared-key');
  12157. var GT = '>';
  12158. var LT = '<';
  12159. var PROTOTYPE = 'prototype';
  12160. var SCRIPT = 'script';
  12161. var IE_PROTO = sharedKey('IE_PROTO');
  12162. var EmptyConstructor = function () { /* empty */ };
  12163. var scriptTag = function (content) {
  12164. return LT + SCRIPT + GT + content + LT + '/' + SCRIPT + GT;
  12165. };
  12166. // Create object with fake `null` prototype: use ActiveX Object with cleared prototype
  12167. var NullProtoObjectViaActiveX = function (activeXDocument) {
  12168. activeXDocument.write(scriptTag(''));
  12169. activeXDocument.close();
  12170. var temp = activeXDocument.parentWindow.Object;
  12171. activeXDocument = null; // avoid memory leak
  12172. return temp;
  12173. };
  12174. // Create object with fake `null` prototype: use iframe Object with cleared prototype
  12175. var NullProtoObjectViaIFrame = function () {
  12176. // Thrash, waste and sodomy: IE GC bug
  12177. var iframe = documentCreateElement('iframe');
  12178. var JS = 'java' + SCRIPT + ':';
  12179. var iframeDocument;
  12180. iframe.style.display = 'none';
  12181. html.appendChild(iframe);
  12182. // https://github.com/zloirock/core-js/issues/475
  12183. iframe.src = String(JS);
  12184. iframeDocument = iframe.contentWindow.document;
  12185. iframeDocument.open();
  12186. iframeDocument.write(scriptTag('document.F=Object'));
  12187. iframeDocument.close();
  12188. return iframeDocument.F;
  12189. };
  12190. // Check for document.domain and active x support
  12191. // No need to use active x approach when document.domain is not set
  12192. // see https://github.com/es-shims/es5-shim/issues/150
  12193. // variation of https://github.com/kitcambridge/es5-shim/commit/4f738ac066346
  12194. // avoid IE GC bug
  12195. var activeXDocument;
  12196. var NullProtoObject = function () {
  12197. try {
  12198. activeXDocument = new ActiveXObject('htmlfile');
  12199. } catch (error) { /* ignore */ }
  12200. NullProtoObject = typeof document != 'undefined'
  12201. ? document.domain && activeXDocument
  12202. ? NullProtoObjectViaActiveX(activeXDocument) // old IE
  12203. : NullProtoObjectViaIFrame()
  12204. : NullProtoObjectViaActiveX(activeXDocument); // WSH
  12205. var length = enumBugKeys.length;
  12206. while (length--) delete NullProtoObject[PROTOTYPE][enumBugKeys[length]];
  12207. return NullProtoObject();
  12208. };
  12209. hiddenKeys[IE_PROTO] = true;
  12210. // `Object.create` method
  12211. // https://tc39.es/ecma262/#sec-object.create
  12212. module.exports = Object.create || function create(O, Properties) {
  12213. var result;
  12214. if (O !== null) {
  12215. EmptyConstructor[PROTOTYPE] = anObject(O);
  12216. result = new EmptyConstructor();
  12217. EmptyConstructor[PROTOTYPE] = null;
  12218. // add "__proto__" for Object.getPrototypeOf polyfill
  12219. result[IE_PROTO] = O;
  12220. } else result = NullProtoObject();
  12221. return Properties === undefined ? result : defineProperties(result, Properties);
  12222. };
  12223. },{"../internals/an-object":94,"../internals/document-create-element":126,"../internals/enum-bug-keys":138,"../internals/hidden-keys":149,"../internals/html":151,"../internals/object-define-properties":178,"../internals/shared-key":209}],178:[function(require,module,exports){
  12224. var DESCRIPTORS = require('../internals/descriptors');
  12225. var definePropertyModule = require('../internals/object-define-property');
  12226. var anObject = require('../internals/an-object');
  12227. var objectKeys = require('../internals/object-keys');
  12228. // `Object.defineProperties` method
  12229. // https://tc39.es/ecma262/#sec-object.defineproperties
  12230. // eslint-disable-next-line es/no-object-defineproperties -- safe
  12231. module.exports = DESCRIPTORS ? Object.defineProperties : function defineProperties(O, Properties) {
  12232. anObject(O);
  12233. var keys = objectKeys(Properties);
  12234. var length = keys.length;
  12235. var index = 0;
  12236. var key;
  12237. while (length > index) definePropertyModule.f(O, key = keys[index++], Properties[key]);
  12238. return O;
  12239. };
  12240. },{"../internals/an-object":94,"../internals/descriptors":125,"../internals/object-define-property":179,"../internals/object-keys":186}],179:[function(require,module,exports){
  12241. var DESCRIPTORS = require('../internals/descriptors');
  12242. var IE8_DOM_DEFINE = require('../internals/ie8-dom-define');
  12243. var anObject = require('../internals/an-object');
  12244. var toPropertyKey = require('../internals/to-property-key');
  12245. // eslint-disable-next-line es/no-object-defineproperty -- safe
  12246. var $defineProperty = Object.defineProperty;
  12247. // `Object.defineProperty` method
  12248. // https://tc39.es/ecma262/#sec-object.defineproperty
  12249. exports.f = DESCRIPTORS ? $defineProperty : function defineProperty(O, P, Attributes) {
  12250. anObject(O);
  12251. P = toPropertyKey(P);
  12252. anObject(Attributes);
  12253. if (IE8_DOM_DEFINE) try {
  12254. return $defineProperty(O, P, Attributes);
  12255. } catch (error) { /* empty */ }
  12256. if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported');
  12257. if ('value' in Attributes) O[P] = Attributes.value;
  12258. return O;
  12259. };
  12260. },{"../internals/an-object":94,"../internals/descriptors":125,"../internals/ie8-dom-define":152,"../internals/to-property-key":226}],180:[function(require,module,exports){
  12261. var DESCRIPTORS = require('../internals/descriptors');
  12262. var propertyIsEnumerableModule = require('../internals/object-property-is-enumerable');
  12263. var createPropertyDescriptor = require('../internals/create-property-descriptor');
  12264. var toIndexedObject = require('../internals/to-indexed-object');
  12265. var toPropertyKey = require('../internals/to-property-key');
  12266. var has = require('../internals/has');
  12267. var IE8_DOM_DEFINE = require('../internals/ie8-dom-define');
  12268. // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
  12269. var $getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
  12270. // `Object.getOwnPropertyDescriptor` method
  12271. // https://tc39.es/ecma262/#sec-object.getownpropertydescriptor
  12272. exports.f = DESCRIPTORS ? $getOwnPropertyDescriptor : function getOwnPropertyDescriptor(O, P) {
  12273. O = toIndexedObject(O);
  12274. P = toPropertyKey(P);
  12275. if (IE8_DOM_DEFINE) try {
  12276. return $getOwnPropertyDescriptor(O, P);
  12277. } catch (error) { /* empty */ }
  12278. if (has(O, P)) return createPropertyDescriptor(!propertyIsEnumerableModule.f.call(O, P), O[P]);
  12279. };
  12280. },{"../internals/create-property-descriptor":121,"../internals/descriptors":125,"../internals/has":148,"../internals/ie8-dom-define":152,"../internals/object-property-is-enumerable":187,"../internals/to-indexed-object":219,"../internals/to-property-key":226}],181:[function(require,module,exports){
  12281. /* eslint-disable es/no-object-getownpropertynames -- safe */
  12282. var toIndexedObject = require('../internals/to-indexed-object');
  12283. var $getOwnPropertyNames = require('../internals/object-get-own-property-names').f;
  12284. var toString = {}.toString;
  12285. var windowNames = typeof window == 'object' && window && Object.getOwnPropertyNames
  12286. ? Object.getOwnPropertyNames(window) : [];
  12287. var getWindowNames = function (it) {
  12288. try {
  12289. return $getOwnPropertyNames(it);
  12290. } catch (error) {
  12291. return windowNames.slice();
  12292. }
  12293. };
  12294. // fallback for IE11 buggy Object.getOwnPropertyNames with iframe and window
  12295. module.exports.f = function getOwnPropertyNames(it) {
  12296. return windowNames && toString.call(it) == '[object Window]'
  12297. ? getWindowNames(it)
  12298. : $getOwnPropertyNames(toIndexedObject(it));
  12299. };
  12300. },{"../internals/object-get-own-property-names":182,"../internals/to-indexed-object":219}],182:[function(require,module,exports){
  12301. var internalObjectKeys = require('../internals/object-keys-internal');
  12302. var enumBugKeys = require('../internals/enum-bug-keys');
  12303. var hiddenKeys = enumBugKeys.concat('length', 'prototype');
  12304. // `Object.getOwnPropertyNames` method
  12305. // https://tc39.es/ecma262/#sec-object.getownpropertynames
  12306. // eslint-disable-next-line es/no-object-getownpropertynames -- safe
  12307. exports.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {
  12308. return internalObjectKeys(O, hiddenKeys);
  12309. };
  12310. },{"../internals/enum-bug-keys":138,"../internals/object-keys-internal":185}],183:[function(require,module,exports){
  12311. // eslint-disable-next-line es/no-object-getownpropertysymbols -- safe
  12312. exports.f = Object.getOwnPropertySymbols;
  12313. },{}],184:[function(require,module,exports){
  12314. var has = require('../internals/has');
  12315. var toObject = require('../internals/to-object');
  12316. var sharedKey = require('../internals/shared-key');
  12317. var CORRECT_PROTOTYPE_GETTER = require('../internals/correct-prototype-getter');
  12318. var IE_PROTO = sharedKey('IE_PROTO');
  12319. var ObjectPrototype = Object.prototype;
  12320. // `Object.getPrototypeOf` method
  12321. // https://tc39.es/ecma262/#sec-object.getprototypeof
  12322. // eslint-disable-next-line es/no-object-getprototypeof -- safe
  12323. module.exports = CORRECT_PROTOTYPE_GETTER ? Object.getPrototypeOf : function (O) {
  12324. O = toObject(O);
  12325. if (has(O, IE_PROTO)) return O[IE_PROTO];
  12326. if (typeof O.constructor == 'function' && O instanceof O.constructor) {
  12327. return O.constructor.prototype;
  12328. } return O instanceof Object ? ObjectPrototype : null;
  12329. };
  12330. },{"../internals/correct-prototype-getter":118,"../internals/has":148,"../internals/shared-key":209,"../internals/to-object":222}],185:[function(require,module,exports){
  12331. var has = require('../internals/has');
  12332. var toIndexedObject = require('../internals/to-indexed-object');
  12333. var indexOf = require('../internals/array-includes').indexOf;
  12334. var hiddenKeys = require('../internals/hidden-keys');
  12335. module.exports = function (object, names) {
  12336. var O = toIndexedObject(object);
  12337. var i = 0;
  12338. var result = [];
  12339. var key;
  12340. for (key in O) !has(hiddenKeys, key) && has(O, key) && result.push(key);
  12341. // Don't enum bug & hidden keys
  12342. while (names.length > i) if (has(O, key = names[i++])) {
  12343. ~indexOf(result, key) || result.push(key);
  12344. }
  12345. return result;
  12346. };
  12347. },{"../internals/array-includes":103,"../internals/has":148,"../internals/hidden-keys":149,"../internals/to-indexed-object":219}],186:[function(require,module,exports){
  12348. var internalObjectKeys = require('../internals/object-keys-internal');
  12349. var enumBugKeys = require('../internals/enum-bug-keys');
  12350. // `Object.keys` method
  12351. // https://tc39.es/ecma262/#sec-object.keys
  12352. // eslint-disable-next-line es/no-object-keys -- safe
  12353. module.exports = Object.keys || function keys(O) {
  12354. return internalObjectKeys(O, enumBugKeys);
  12355. };
  12356. },{"../internals/enum-bug-keys":138,"../internals/object-keys-internal":185}],187:[function(require,module,exports){
  12357. 'use strict';
  12358. var $propertyIsEnumerable = {}.propertyIsEnumerable;
  12359. // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
  12360. var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
  12361. // Nashorn ~ JDK8 bug
  12362. var NASHORN_BUG = getOwnPropertyDescriptor && !$propertyIsEnumerable.call({ 1: 2 }, 1);
  12363. // `Object.prototype.propertyIsEnumerable` method implementation
  12364. // https://tc39.es/ecma262/#sec-object.prototype.propertyisenumerable
  12365. exports.f = NASHORN_BUG ? function propertyIsEnumerable(V) {
  12366. var descriptor = getOwnPropertyDescriptor(this, V);
  12367. return !!descriptor && descriptor.enumerable;
  12368. } : $propertyIsEnumerable;
  12369. },{}],188:[function(require,module,exports){
  12370. /* eslint-disable no-proto -- safe */
  12371. var anObject = require('../internals/an-object');
  12372. var aPossiblePrototype = require('../internals/a-possible-prototype');
  12373. // `Object.setPrototypeOf` method
  12374. // https://tc39.es/ecma262/#sec-object.setprototypeof
  12375. // Works with __proto__ only. Old v8 can't work with null proto objects.
  12376. // eslint-disable-next-line es/no-object-setprototypeof -- safe
  12377. module.exports = Object.setPrototypeOf || ('__proto__' in {} ? function () {
  12378. var CORRECT_SETTER = false;
  12379. var test = {};
  12380. var setter;
  12381. try {
  12382. // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
  12383. setter = Object.getOwnPropertyDescriptor(Object.prototype, '__proto__').set;
  12384. setter.call(test, []);
  12385. CORRECT_SETTER = test instanceof Array;
  12386. } catch (error) { /* empty */ }
  12387. return function setPrototypeOf(O, proto) {
  12388. anObject(O);
  12389. aPossiblePrototype(proto);
  12390. if (CORRECT_SETTER) setter.call(O, proto);
  12391. else O.__proto__ = proto;
  12392. return O;
  12393. };
  12394. }() : undefined);
  12395. },{"../internals/a-possible-prototype":90,"../internals/an-object":94}],189:[function(require,module,exports){
  12396. var DESCRIPTORS = require('../internals/descriptors');
  12397. var objectKeys = require('../internals/object-keys');
  12398. var toIndexedObject = require('../internals/to-indexed-object');
  12399. var propertyIsEnumerable = require('../internals/object-property-is-enumerable').f;
  12400. // `Object.{ entries, values }` methods implementation
  12401. var createMethod = function (TO_ENTRIES) {
  12402. return function (it) {
  12403. var O = toIndexedObject(it);
  12404. var keys = objectKeys(O);
  12405. var length = keys.length;
  12406. var i = 0;
  12407. var result = [];
  12408. var key;
  12409. while (length > i) {
  12410. key = keys[i++];
  12411. if (!DESCRIPTORS || propertyIsEnumerable.call(O, key)) {
  12412. result.push(TO_ENTRIES ? [key, O[key]] : O[key]);
  12413. }
  12414. }
  12415. return result;
  12416. };
  12417. };
  12418. module.exports = {
  12419. // `Object.entries` method
  12420. // https://tc39.es/ecma262/#sec-object.entries
  12421. entries: createMethod(true),
  12422. // `Object.values` method
  12423. // https://tc39.es/ecma262/#sec-object.values
  12424. values: createMethod(false)
  12425. };
  12426. },{"../internals/descriptors":125,"../internals/object-keys":186,"../internals/object-property-is-enumerable":187,"../internals/to-indexed-object":219}],190:[function(require,module,exports){
  12427. 'use strict';
  12428. var TO_STRING_TAG_SUPPORT = require('../internals/to-string-tag-support');
  12429. var classof = require('../internals/classof');
  12430. // `Object.prototype.toString` method implementation
  12431. // https://tc39.es/ecma262/#sec-object.prototype.tostring
  12432. module.exports = TO_STRING_TAG_SUPPORT ? {}.toString : function toString() {
  12433. return '[object ' + classof(this) + ']';
  12434. };
  12435. },{"../internals/classof":115,"../internals/to-string-tag-support":227}],191:[function(require,module,exports){
  12436. var isObject = require('../internals/is-object');
  12437. // `OrdinaryToPrimitive` abstract operation
  12438. // https://tc39.es/ecma262/#sec-ordinarytoprimitive
  12439. module.exports = function (input, pref) {
  12440. var fn, val;
  12441. if (pref === 'string' && typeof (fn = input.toString) == 'function' && !isObject(val = fn.call(input))) return val;
  12442. if (typeof (fn = input.valueOf) == 'function' && !isObject(val = fn.call(input))) return val;
  12443. if (pref !== 'string' && typeof (fn = input.toString) == 'function' && !isObject(val = fn.call(input))) return val;
  12444. throw TypeError("Can't convert object to primitive value");
  12445. };
  12446. },{"../internals/is-object":162}],192:[function(require,module,exports){
  12447. var getBuiltIn = require('../internals/get-built-in');
  12448. var getOwnPropertyNamesModule = require('../internals/object-get-own-property-names');
  12449. var getOwnPropertySymbolsModule = require('../internals/object-get-own-property-symbols');
  12450. var anObject = require('../internals/an-object');
  12451. // all object keys, includes non-enumerable and symbols
  12452. module.exports = getBuiltIn('Reflect', 'ownKeys') || function ownKeys(it) {
  12453. var keys = getOwnPropertyNamesModule.f(anObject(it));
  12454. var getOwnPropertySymbols = getOwnPropertySymbolsModule.f;
  12455. return getOwnPropertySymbols ? keys.concat(getOwnPropertySymbols(it)) : keys;
  12456. };
  12457. },{"../internals/an-object":94,"../internals/get-built-in":143,"../internals/object-get-own-property-names":182,"../internals/object-get-own-property-symbols":183}],193:[function(require,module,exports){
  12458. var global = require('../internals/global');
  12459. module.exports = global;
  12460. },{"../internals/global":147}],194:[function(require,module,exports){
  12461. module.exports = function (exec) {
  12462. try {
  12463. return { error: false, value: exec() };
  12464. } catch (error) {
  12465. return { error: true, value: error };
  12466. }
  12467. };
  12468. },{}],195:[function(require,module,exports){
  12469. var anObject = require('../internals/an-object');
  12470. var isObject = require('../internals/is-object');
  12471. var newPromiseCapability = require('../internals/new-promise-capability');
  12472. module.exports = function (C, x) {
  12473. anObject(C);
  12474. if (isObject(x) && x.constructor === C) return x;
  12475. var promiseCapability = newPromiseCapability.f(C);
  12476. var resolve = promiseCapability.resolve;
  12477. resolve(x);
  12478. return promiseCapability.promise;
  12479. };
  12480. },{"../internals/an-object":94,"../internals/is-object":162,"../internals/new-promise-capability":174}],196:[function(require,module,exports){
  12481. var redefine = require('../internals/redefine');
  12482. module.exports = function (target, src, options) {
  12483. for (var key in src) redefine(target, key, src[key], options);
  12484. return target;
  12485. };
  12486. },{"../internals/redefine":197}],197:[function(require,module,exports){
  12487. var global = require('../internals/global');
  12488. var createNonEnumerableProperty = require('../internals/create-non-enumerable-property');
  12489. var has = require('../internals/has');
  12490. var setGlobal = require('../internals/set-global');
  12491. var inspectSource = require('../internals/inspect-source');
  12492. var InternalStateModule = require('../internals/internal-state');
  12493. var getInternalState = InternalStateModule.get;
  12494. var enforceInternalState = InternalStateModule.enforce;
  12495. var TEMPLATE = String(String).split('String');
  12496. (module.exports = function (O, key, value, options) {
  12497. var unsafe = options ? !!options.unsafe : false;
  12498. var simple = options ? !!options.enumerable : false;
  12499. var noTargetGet = options ? !!options.noTargetGet : false;
  12500. var state;
  12501. if (typeof value == 'function') {
  12502. if (typeof key == 'string' && !has(value, 'name')) {
  12503. createNonEnumerableProperty(value, 'name', key);
  12504. }
  12505. state = enforceInternalState(value);
  12506. if (!state.source) {
  12507. state.source = TEMPLATE.join(typeof key == 'string' ? key : '');
  12508. }
  12509. }
  12510. if (O === global) {
  12511. if (simple) O[key] = value;
  12512. else setGlobal(key, value);
  12513. return;
  12514. } else if (!unsafe) {
  12515. delete O[key];
  12516. } else if (!noTargetGet && O[key]) {
  12517. simple = true;
  12518. }
  12519. if (simple) O[key] = value;
  12520. else createNonEnumerableProperty(O, key, value);
  12521. // add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative
  12522. })(Function.prototype, 'toString', function toString() {
  12523. return typeof this == 'function' && getInternalState(this).source || inspectSource(this);
  12524. });
  12525. },{"../internals/create-non-enumerable-property":120,"../internals/global":147,"../internals/has":148,"../internals/inspect-source":156,"../internals/internal-state":157,"../internals/set-global":206}],198:[function(require,module,exports){
  12526. var classof = require('./classof-raw');
  12527. var regexpExec = require('./regexp-exec');
  12528. // `RegExpExec` abstract operation
  12529. // https://tc39.es/ecma262/#sec-regexpexec
  12530. module.exports = function (R, S) {
  12531. var exec = R.exec;
  12532. if (typeof exec === 'function') {
  12533. var result = exec.call(R, S);
  12534. if (typeof result !== 'object') {
  12535. throw TypeError('RegExp exec method returned something other than an Object or null');
  12536. }
  12537. return result;
  12538. }
  12539. if (classof(R) !== 'RegExp') {
  12540. throw TypeError('RegExp#exec called on incompatible receiver');
  12541. }
  12542. return regexpExec.call(R, S);
  12543. };
  12544. },{"./classof-raw":114,"./regexp-exec":199}],199:[function(require,module,exports){
  12545. 'use strict';
  12546. /* eslint-disable regexp/no-empty-capturing-group, regexp/no-empty-group, regexp/no-lazy-ends -- testing */
  12547. /* eslint-disable regexp/no-useless-quantifier -- testing */
  12548. var toString = require('../internals/to-string');
  12549. var regexpFlags = require('../internals/regexp-flags');
  12550. var stickyHelpers = require('../internals/regexp-sticky-helpers');
  12551. var shared = require('../internals/shared');
  12552. var create = require('../internals/object-create');
  12553. var getInternalState = require('../internals/internal-state').get;
  12554. var UNSUPPORTED_DOT_ALL = require('../internals/regexp-unsupported-dot-all');
  12555. var UNSUPPORTED_NCG = require('../internals/regexp-unsupported-ncg');
  12556. var nativeExec = RegExp.prototype.exec;
  12557. var nativeReplace = shared('native-string-replace', String.prototype.replace);
  12558. var patchedExec = nativeExec;
  12559. var UPDATES_LAST_INDEX_WRONG = (function () {
  12560. var re1 = /a/;
  12561. var re2 = /b*/g;
  12562. nativeExec.call(re1, 'a');
  12563. nativeExec.call(re2, 'a');
  12564. return re1.lastIndex !== 0 || re2.lastIndex !== 0;
  12565. })();
  12566. var UNSUPPORTED_Y = stickyHelpers.UNSUPPORTED_Y || stickyHelpers.BROKEN_CARET;
  12567. // nonparticipating capturing group, copied from es5-shim's String#split patch.
  12568. var NPCG_INCLUDED = /()??/.exec('')[1] !== undefined;
  12569. var PATCH = UPDATES_LAST_INDEX_WRONG || NPCG_INCLUDED || UNSUPPORTED_Y || UNSUPPORTED_DOT_ALL || UNSUPPORTED_NCG;
  12570. if (PATCH) {
  12571. // eslint-disable-next-line max-statements -- TODO
  12572. patchedExec = function exec(string) {
  12573. var re = this;
  12574. var state = getInternalState(re);
  12575. var str = toString(string);
  12576. var raw = state.raw;
  12577. var result, reCopy, lastIndex, match, i, object, group;
  12578. if (raw) {
  12579. raw.lastIndex = re.lastIndex;
  12580. result = patchedExec.call(raw, str);
  12581. re.lastIndex = raw.lastIndex;
  12582. return result;
  12583. }
  12584. var groups = state.groups;
  12585. var sticky = UNSUPPORTED_Y && re.sticky;
  12586. var flags = regexpFlags.call(re);
  12587. var source = re.source;
  12588. var charsAdded = 0;
  12589. var strCopy = str;
  12590. if (sticky) {
  12591. flags = flags.replace('y', '');
  12592. if (flags.indexOf('g') === -1) {
  12593. flags += 'g';
  12594. }
  12595. strCopy = str.slice(re.lastIndex);
  12596. // Support anchored sticky behavior.
  12597. if (re.lastIndex > 0 && (!re.multiline || re.multiline && str.charAt(re.lastIndex - 1) !== '\n')) {
  12598. source = '(?: ' + source + ')';
  12599. strCopy = ' ' + strCopy;
  12600. charsAdded++;
  12601. }
  12602. // ^(? + rx + ) is needed, in combination with some str slicing, to
  12603. // simulate the 'y' flag.
  12604. reCopy = new RegExp('^(?:' + source + ')', flags);
  12605. }
  12606. if (NPCG_INCLUDED) {
  12607. reCopy = new RegExp('^' + source + '$(?!\\s)', flags);
  12608. }
  12609. if (UPDATES_LAST_INDEX_WRONG) lastIndex = re.lastIndex;
  12610. match = nativeExec.call(sticky ? reCopy : re, strCopy);
  12611. if (sticky) {
  12612. if (match) {
  12613. match.input = match.input.slice(charsAdded);
  12614. match[0] = match[0].slice(charsAdded);
  12615. match.index = re.lastIndex;
  12616. re.lastIndex += match[0].length;
  12617. } else re.lastIndex = 0;
  12618. } else if (UPDATES_LAST_INDEX_WRONG && match) {
  12619. re.lastIndex = re.global ? match.index + match[0].length : lastIndex;
  12620. }
  12621. if (NPCG_INCLUDED && match && match.length > 1) {
  12622. // Fix browsers whose `exec` methods don't consistently return `undefined`
  12623. // for NPCG, like IE8. NOTE: This doesn' work for /(.?)?/
  12624. nativeReplace.call(match[0], reCopy, function () {
  12625. for (i = 1; i < arguments.length - 2; i++) {
  12626. if (arguments[i] === undefined) match[i] = undefined;
  12627. }
  12628. });
  12629. }
  12630. if (match && groups) {
  12631. match.groups = object = create(null);
  12632. for (i = 0; i < groups.length; i++) {
  12633. group = groups[i];
  12634. object[group[0]] = match[group[1]];
  12635. }
  12636. }
  12637. return match;
  12638. };
  12639. }
  12640. module.exports = patchedExec;
  12641. },{"../internals/internal-state":157,"../internals/object-create":177,"../internals/regexp-flags":200,"../internals/regexp-sticky-helpers":201,"../internals/regexp-unsupported-dot-all":202,"../internals/regexp-unsupported-ncg":203,"../internals/shared":211,"../internals/to-string":228}],200:[function(require,module,exports){
  12642. 'use strict';
  12643. var anObject = require('../internals/an-object');
  12644. // `RegExp.prototype.flags` getter implementation
  12645. // https://tc39.es/ecma262/#sec-get-regexp.prototype.flags
  12646. module.exports = function () {
  12647. var that = anObject(this);
  12648. var result = '';
  12649. if (that.global) result += 'g';
  12650. if (that.ignoreCase) result += 'i';
  12651. if (that.multiline) result += 'm';
  12652. if (that.dotAll) result += 's';
  12653. if (that.unicode) result += 'u';
  12654. if (that.sticky) result += 'y';
  12655. return result;
  12656. };
  12657. },{"../internals/an-object":94}],201:[function(require,module,exports){
  12658. var fails = require('../internals/fails');
  12659. var global = require('../internals/global');
  12660. // babel-minify and Closure Compiler transpiles RegExp('a', 'y') -> /a/y and it causes SyntaxError
  12661. var $RegExp = global.RegExp;
  12662. exports.UNSUPPORTED_Y = fails(function () {
  12663. var re = $RegExp('a', 'y');
  12664. re.lastIndex = 2;
  12665. return re.exec('abcd') != null;
  12666. });
  12667. exports.BROKEN_CARET = fails(function () {
  12668. // https://bugzilla.mozilla.org/show_bug.cgi?id=773687
  12669. var re = $RegExp('^r', 'gy');
  12670. re.lastIndex = 2;
  12671. return re.exec('str') != null;
  12672. });
  12673. },{"../internals/fails":140,"../internals/global":147}],202:[function(require,module,exports){
  12674. var fails = require('./fails');
  12675. var global = require('../internals/global');
  12676. // babel-minify and Closure Compiler transpiles RegExp('.', 's') -> /./s and it causes SyntaxError
  12677. var $RegExp = global.RegExp;
  12678. module.exports = fails(function () {
  12679. var re = $RegExp('.', 's');
  12680. return !(re.dotAll && re.exec('\n') && re.flags === 's');
  12681. });
  12682. },{"../internals/global":147,"./fails":140}],203:[function(require,module,exports){
  12683. var fails = require('./fails');
  12684. var global = require('../internals/global');
  12685. // babel-minify and Closure Compiler transpiles RegExp('(?<a>b)', 'g') -> /(?<a>b)/g and it causes SyntaxError
  12686. var $RegExp = global.RegExp;
  12687. module.exports = fails(function () {
  12688. var re = $RegExp('(?<a>b)', 'g');
  12689. return re.exec('b').groups.a !== 'b' ||
  12690. 'b'.replace(re, '$<a>c') !== 'bc';
  12691. });
  12692. },{"../internals/global":147,"./fails":140}],204:[function(require,module,exports){
  12693. // `RequireObjectCoercible` abstract operation
  12694. // https://tc39.es/ecma262/#sec-requireobjectcoercible
  12695. module.exports = function (it) {
  12696. if (it == undefined) throw TypeError("Can't call method on " + it);
  12697. return it;
  12698. };
  12699. },{}],205:[function(require,module,exports){
  12700. // `SameValue` abstract operation
  12701. // https://tc39.es/ecma262/#sec-samevalue
  12702. // eslint-disable-next-line es/no-object-is -- safe
  12703. module.exports = Object.is || function is(x, y) {
  12704. // eslint-disable-next-line no-self-compare -- NaN check
  12705. return x === y ? x !== 0 || 1 / x === 1 / y : x != x && y != y;
  12706. };
  12707. },{}],206:[function(require,module,exports){
  12708. var global = require('../internals/global');
  12709. module.exports = function (key, value) {
  12710. try {
  12711. // eslint-disable-next-line es/no-object-defineproperty -- safe
  12712. Object.defineProperty(global, key, { value: value, configurable: true, writable: true });
  12713. } catch (error) {
  12714. global[key] = value;
  12715. } return value;
  12716. };
  12717. },{"../internals/global":147}],207:[function(require,module,exports){
  12718. 'use strict';
  12719. var getBuiltIn = require('../internals/get-built-in');
  12720. var definePropertyModule = require('../internals/object-define-property');
  12721. var wellKnownSymbol = require('../internals/well-known-symbol');
  12722. var DESCRIPTORS = require('../internals/descriptors');
  12723. var SPECIES = wellKnownSymbol('species');
  12724. module.exports = function (CONSTRUCTOR_NAME) {
  12725. var Constructor = getBuiltIn(CONSTRUCTOR_NAME);
  12726. var defineProperty = definePropertyModule.f;
  12727. if (DESCRIPTORS && Constructor && !Constructor[SPECIES]) {
  12728. defineProperty(Constructor, SPECIES, {
  12729. configurable: true,
  12730. get: function () { return this; }
  12731. });
  12732. }
  12733. };
  12734. },{"../internals/descriptors":125,"../internals/get-built-in":143,"../internals/object-define-property":179,"../internals/well-known-symbol":237}],208:[function(require,module,exports){
  12735. var defineProperty = require('../internals/object-define-property').f;
  12736. var has = require('../internals/has');
  12737. var wellKnownSymbol = require('../internals/well-known-symbol');
  12738. var TO_STRING_TAG = wellKnownSymbol('toStringTag');
  12739. module.exports = function (it, TAG, STATIC) {
  12740. if (it && !has(it = STATIC ? it : it.prototype, TO_STRING_TAG)) {
  12741. defineProperty(it, TO_STRING_TAG, { configurable: true, value: TAG });
  12742. }
  12743. };
  12744. },{"../internals/has":148,"../internals/object-define-property":179,"../internals/well-known-symbol":237}],209:[function(require,module,exports){
  12745. var shared = require('../internals/shared');
  12746. var uid = require('../internals/uid');
  12747. var keys = shared('keys');
  12748. module.exports = function (key) {
  12749. return keys[key] || (keys[key] = uid(key));
  12750. };
  12751. },{"../internals/shared":211,"../internals/uid":234}],210:[function(require,module,exports){
  12752. var global = require('../internals/global');
  12753. var setGlobal = require('../internals/set-global');
  12754. var SHARED = '__core-js_shared__';
  12755. var store = global[SHARED] || setGlobal(SHARED, {});
  12756. module.exports = store;
  12757. },{"../internals/global":147,"../internals/set-global":206}],211:[function(require,module,exports){
  12758. var IS_PURE = require('../internals/is-pure');
  12759. var store = require('../internals/shared-store');
  12760. (module.exports = function (key, value) {
  12761. return store[key] || (store[key] = value !== undefined ? value : {});
  12762. })('versions', []).push({
  12763. version: '3.17.2',
  12764. mode: IS_PURE ? 'pure' : 'global',
  12765. copyright: '© 2021 Denis Pushkarev (zloirock.ru)'
  12766. });
  12767. },{"../internals/is-pure":163,"../internals/shared-store":210}],212:[function(require,module,exports){
  12768. var anObject = require('../internals/an-object');
  12769. var aFunction = require('../internals/a-function');
  12770. var wellKnownSymbol = require('../internals/well-known-symbol');
  12771. var SPECIES = wellKnownSymbol('species');
  12772. // `SpeciesConstructor` abstract operation
  12773. // https://tc39.es/ecma262/#sec-speciesconstructor
  12774. module.exports = function (O, defaultConstructor) {
  12775. var C = anObject(O).constructor;
  12776. var S;
  12777. return C === undefined || (S = anObject(C)[SPECIES]) == undefined ? defaultConstructor : aFunction(S);
  12778. };
  12779. },{"../internals/a-function":89,"../internals/an-object":94,"../internals/well-known-symbol":237}],213:[function(require,module,exports){
  12780. var toInteger = require('../internals/to-integer');
  12781. var toString = require('../internals/to-string');
  12782. var requireObjectCoercible = require('../internals/require-object-coercible');
  12783. // `String.prototype.codePointAt` methods implementation
  12784. var createMethod = function (CONVERT_TO_STRING) {
  12785. return function ($this, pos) {
  12786. var S = toString(requireObjectCoercible($this));
  12787. var position = toInteger(pos);
  12788. var size = S.length;
  12789. var first, second;
  12790. if (position < 0 || position >= size) return CONVERT_TO_STRING ? '' : undefined;
  12791. first = S.charCodeAt(position);
  12792. return first < 0xD800 || first > 0xDBFF || position + 1 === size
  12793. || (second = S.charCodeAt(position + 1)) < 0xDC00 || second > 0xDFFF
  12794. ? CONVERT_TO_STRING ? S.charAt(position) : first
  12795. : CONVERT_TO_STRING ? S.slice(position, position + 2) : (first - 0xD800 << 10) + (second - 0xDC00) + 0x10000;
  12796. };
  12797. };
  12798. module.exports = {
  12799. // `String.prototype.codePointAt` method
  12800. // https://tc39.es/ecma262/#sec-string.prototype.codepointat
  12801. codeAt: createMethod(false),
  12802. // `String.prototype.at` method
  12803. // https://github.com/mathiasbynens/String.prototype.at
  12804. charAt: createMethod(true)
  12805. };
  12806. },{"../internals/require-object-coercible":204,"../internals/to-integer":220,"../internals/to-string":228}],214:[function(require,module,exports){
  12807. var fails = require('../internals/fails');
  12808. var whitespaces = require('../internals/whitespaces');
  12809. var non = '\u200B\u0085\u180E';
  12810. // check that a method works with the correct list
  12811. // of whitespaces and has a correct name
  12812. module.exports = function (METHOD_NAME) {
  12813. return fails(function () {
  12814. return !!whitespaces[METHOD_NAME]() || non[METHOD_NAME]() != non || whitespaces[METHOD_NAME].name !== METHOD_NAME;
  12815. });
  12816. };
  12817. },{"../internals/fails":140,"../internals/whitespaces":238}],215:[function(require,module,exports){
  12818. var requireObjectCoercible = require('../internals/require-object-coercible');
  12819. var toString = require('../internals/to-string');
  12820. var whitespaces = require('../internals/whitespaces');
  12821. var whitespace = '[' + whitespaces + ']';
  12822. var ltrim = RegExp('^' + whitespace + whitespace + '*');
  12823. var rtrim = RegExp(whitespace + whitespace + '*$');
  12824. // `String.prototype.{ trim, trimStart, trimEnd, trimLeft, trimRight }` methods implementation
  12825. var createMethod = function (TYPE) {
  12826. return function ($this) {
  12827. var string = toString(requireObjectCoercible($this));
  12828. if (TYPE & 1) string = string.replace(ltrim, '');
  12829. if (TYPE & 2) string = string.replace(rtrim, '');
  12830. return string;
  12831. };
  12832. };
  12833. module.exports = {
  12834. // `String.prototype.{ trimLeft, trimStart }` methods
  12835. // https://tc39.es/ecma262/#sec-string.prototype.trimstart
  12836. start: createMethod(1),
  12837. // `String.prototype.{ trimRight, trimEnd }` methods
  12838. // https://tc39.es/ecma262/#sec-string.prototype.trimend
  12839. end: createMethod(2),
  12840. // `String.prototype.trim` method
  12841. // https://tc39.es/ecma262/#sec-string.prototype.trim
  12842. trim: createMethod(3)
  12843. };
  12844. },{"../internals/require-object-coercible":204,"../internals/to-string":228,"../internals/whitespaces":238}],216:[function(require,module,exports){
  12845. var global = require('../internals/global');
  12846. var fails = require('../internals/fails');
  12847. var bind = require('../internals/function-bind-context');
  12848. var html = require('../internals/html');
  12849. var createElement = require('../internals/document-create-element');
  12850. var IS_IOS = require('../internals/engine-is-ios');
  12851. var IS_NODE = require('../internals/engine-is-node');
  12852. var set = global.setImmediate;
  12853. var clear = global.clearImmediate;
  12854. var process = global.process;
  12855. var MessageChannel = global.MessageChannel;
  12856. var Dispatch = global.Dispatch;
  12857. var counter = 0;
  12858. var queue = {};
  12859. var ONREADYSTATECHANGE = 'onreadystatechange';
  12860. var location, defer, channel, port;
  12861. try {
  12862. // Deno throws a ReferenceError on `location` access without `--location` flag
  12863. location = global.location;
  12864. } catch (error) { /* empty */ }
  12865. var run = function (id) {
  12866. // eslint-disable-next-line no-prototype-builtins -- safe
  12867. if (queue.hasOwnProperty(id)) {
  12868. var fn = queue[id];
  12869. delete queue[id];
  12870. fn();
  12871. }
  12872. };
  12873. var runner = function (id) {
  12874. return function () {
  12875. run(id);
  12876. };
  12877. };
  12878. var listener = function (event) {
  12879. run(event.data);
  12880. };
  12881. var post = function (id) {
  12882. // old engines have not location.origin
  12883. global.postMessage(String(id), location.protocol + '//' + location.host);
  12884. };
  12885. // Node.js 0.9+ & IE10+ has setImmediate, otherwise:
  12886. if (!set || !clear) {
  12887. set = function setImmediate(fn) {
  12888. var args = [];
  12889. var argumentsLength = arguments.length;
  12890. var i = 1;
  12891. while (argumentsLength > i) args.push(arguments[i++]);
  12892. queue[++counter] = function () {
  12893. // eslint-disable-next-line no-new-func -- spec requirement
  12894. (typeof fn == 'function' ? fn : Function(fn)).apply(undefined, args);
  12895. };
  12896. defer(counter);
  12897. return counter;
  12898. };
  12899. clear = function clearImmediate(id) {
  12900. delete queue[id];
  12901. };
  12902. // Node.js 0.8-
  12903. if (IS_NODE) {
  12904. defer = function (id) {
  12905. process.nextTick(runner(id));
  12906. };
  12907. // Sphere (JS game engine) Dispatch API
  12908. } else if (Dispatch && Dispatch.now) {
  12909. defer = function (id) {
  12910. Dispatch.now(runner(id));
  12911. };
  12912. // Browsers with MessageChannel, includes WebWorkers
  12913. // except iOS - https://github.com/zloirock/core-js/issues/624
  12914. } else if (MessageChannel && !IS_IOS) {
  12915. channel = new MessageChannel();
  12916. port = channel.port2;
  12917. channel.port1.onmessage = listener;
  12918. defer = bind(port.postMessage, port, 1);
  12919. // Browsers with postMessage, skip WebWorkers
  12920. // IE8 has postMessage, but it's sync & typeof its postMessage is 'object'
  12921. } else if (
  12922. global.addEventListener &&
  12923. typeof postMessage == 'function' &&
  12924. !global.importScripts &&
  12925. location && location.protocol !== 'file:' &&
  12926. !fails(post)
  12927. ) {
  12928. defer = post;
  12929. global.addEventListener('message', listener, false);
  12930. // IE8-
  12931. } else if (ONREADYSTATECHANGE in createElement('script')) {
  12932. defer = function (id) {
  12933. html.appendChild(createElement('script'))[ONREADYSTATECHANGE] = function () {
  12934. html.removeChild(this);
  12935. run(id);
  12936. };
  12937. };
  12938. // Rest old browsers
  12939. } else {
  12940. defer = function (id) {
  12941. setTimeout(runner(id), 0);
  12942. };
  12943. }
  12944. }
  12945. module.exports = {
  12946. set: set,
  12947. clear: clear
  12948. };
  12949. },{"../internals/document-create-element":126,"../internals/engine-is-ios":132,"../internals/engine-is-node":133,"../internals/fails":140,"../internals/function-bind-context":142,"../internals/global":147,"../internals/html":151}],217:[function(require,module,exports){
  12950. var toInteger = require('../internals/to-integer');
  12951. var max = Math.max;
  12952. var min = Math.min;
  12953. // Helper for a popular repeating case of the spec:
  12954. // Let integer be ? ToInteger(index).
  12955. // If integer < 0, let result be max((length + integer), 0); else let result be min(integer, length).
  12956. module.exports = function (index, length) {
  12957. var integer = toInteger(index);
  12958. return integer < 0 ? max(integer + length, 0) : min(integer, length);
  12959. };
  12960. },{"../internals/to-integer":220}],218:[function(require,module,exports){
  12961. var toInteger = require('../internals/to-integer');
  12962. var toLength = require('../internals/to-length');
  12963. // `ToIndex` abstract operation
  12964. // https://tc39.es/ecma262/#sec-toindex
  12965. module.exports = function (it) {
  12966. if (it === undefined) return 0;
  12967. var number = toInteger(it);
  12968. var length = toLength(number);
  12969. if (number !== length) throw RangeError('Wrong length or index');
  12970. return length;
  12971. };
  12972. },{"../internals/to-integer":220,"../internals/to-length":221}],219:[function(require,module,exports){
  12973. // toObject with fallback for non-array-like ES3 strings
  12974. var IndexedObject = require('../internals/indexed-object');
  12975. var requireObjectCoercible = require('../internals/require-object-coercible');
  12976. module.exports = function (it) {
  12977. return IndexedObject(requireObjectCoercible(it));
  12978. };
  12979. },{"../internals/indexed-object":154,"../internals/require-object-coercible":204}],220:[function(require,module,exports){
  12980. var ceil = Math.ceil;
  12981. var floor = Math.floor;
  12982. // `ToInteger` abstract operation
  12983. // https://tc39.es/ecma262/#sec-tointeger
  12984. module.exports = function (argument) {
  12985. return isNaN(argument = +argument) ? 0 : (argument > 0 ? floor : ceil)(argument);
  12986. };
  12987. },{}],221:[function(require,module,exports){
  12988. var toInteger = require('../internals/to-integer');
  12989. var min = Math.min;
  12990. // `ToLength` abstract operation
  12991. // https://tc39.es/ecma262/#sec-tolength
  12992. module.exports = function (argument) {
  12993. return argument > 0 ? min(toInteger(argument), 0x1FFFFFFFFFFFFF) : 0; // 2 ** 53 - 1 == 9007199254740991
  12994. };
  12995. },{"../internals/to-integer":220}],222:[function(require,module,exports){
  12996. var requireObjectCoercible = require('../internals/require-object-coercible');
  12997. // `ToObject` abstract operation
  12998. // https://tc39.es/ecma262/#sec-toobject
  12999. module.exports = function (argument) {
  13000. return Object(requireObjectCoercible(argument));
  13001. };
  13002. },{"../internals/require-object-coercible":204}],223:[function(require,module,exports){
  13003. var toPositiveInteger = require('../internals/to-positive-integer');
  13004. module.exports = function (it, BYTES) {
  13005. var offset = toPositiveInteger(it);
  13006. if (offset % BYTES) throw RangeError('Wrong offset');
  13007. return offset;
  13008. };
  13009. },{"../internals/to-positive-integer":224}],224:[function(require,module,exports){
  13010. var toInteger = require('../internals/to-integer');
  13011. module.exports = function (it) {
  13012. var result = toInteger(it);
  13013. if (result < 0) throw RangeError("The argument can't be less than 0");
  13014. return result;
  13015. };
  13016. },{"../internals/to-integer":220}],225:[function(require,module,exports){
  13017. var isObject = require('../internals/is-object');
  13018. var isSymbol = require('../internals/is-symbol');
  13019. var ordinaryToPrimitive = require('../internals/ordinary-to-primitive');
  13020. var wellKnownSymbol = require('../internals/well-known-symbol');
  13021. var TO_PRIMITIVE = wellKnownSymbol('toPrimitive');
  13022. // `ToPrimitive` abstract operation
  13023. // https://tc39.es/ecma262/#sec-toprimitive
  13024. module.exports = function (input, pref) {
  13025. if (!isObject(input) || isSymbol(input)) return input;
  13026. var exoticToPrim = input[TO_PRIMITIVE];
  13027. var result;
  13028. if (exoticToPrim !== undefined) {
  13029. if (pref === undefined) pref = 'default';
  13030. result = exoticToPrim.call(input, pref);
  13031. if (!isObject(result) || isSymbol(result)) return result;
  13032. throw TypeError("Can't convert object to primitive value");
  13033. }
  13034. if (pref === undefined) pref = 'number';
  13035. return ordinaryToPrimitive(input, pref);
  13036. };
  13037. },{"../internals/is-object":162,"../internals/is-symbol":165,"../internals/ordinary-to-primitive":191,"../internals/well-known-symbol":237}],226:[function(require,module,exports){
  13038. var toPrimitive = require('../internals/to-primitive');
  13039. var isSymbol = require('../internals/is-symbol');
  13040. // `ToPropertyKey` abstract operation
  13041. // https://tc39.es/ecma262/#sec-topropertykey
  13042. module.exports = function (argument) {
  13043. var key = toPrimitive(argument, 'string');
  13044. return isSymbol(key) ? key : String(key);
  13045. };
  13046. },{"../internals/is-symbol":165,"../internals/to-primitive":225}],227:[function(require,module,exports){
  13047. var wellKnownSymbol = require('../internals/well-known-symbol');
  13048. var TO_STRING_TAG = wellKnownSymbol('toStringTag');
  13049. var test = {};
  13050. test[TO_STRING_TAG] = 'z';
  13051. module.exports = String(test) === '[object z]';
  13052. },{"../internals/well-known-symbol":237}],228:[function(require,module,exports){
  13053. var isSymbol = require('../internals/is-symbol');
  13054. module.exports = function (argument) {
  13055. if (isSymbol(argument)) throw TypeError('Cannot convert a Symbol value to a string');
  13056. return String(argument);
  13057. };
  13058. },{"../internals/is-symbol":165}],229:[function(require,module,exports){
  13059. 'use strict';
  13060. var $ = require('../internals/export');
  13061. var global = require('../internals/global');
  13062. var DESCRIPTORS = require('../internals/descriptors');
  13063. var TYPED_ARRAYS_CONSTRUCTORS_REQUIRES_WRAPPERS = require('../internals/typed-array-constructors-require-wrappers');
  13064. var ArrayBufferViewCore = require('../internals/array-buffer-view-core');
  13065. var ArrayBufferModule = require('../internals/array-buffer');
  13066. var anInstance = require('../internals/an-instance');
  13067. var createPropertyDescriptor = require('../internals/create-property-descriptor');
  13068. var createNonEnumerableProperty = require('../internals/create-non-enumerable-property');
  13069. var isInteger = require('../internals/is-integer');
  13070. var toLength = require('../internals/to-length');
  13071. var toIndex = require('../internals/to-index');
  13072. var toOffset = require('../internals/to-offset');
  13073. var toPropertyKey = require('../internals/to-property-key');
  13074. var has = require('../internals/has');
  13075. var classof = require('../internals/classof');
  13076. var isObject = require('../internals/is-object');
  13077. var isSymbol = require('../internals/is-symbol');
  13078. var create = require('../internals/object-create');
  13079. var setPrototypeOf = require('../internals/object-set-prototype-of');
  13080. var getOwnPropertyNames = require('../internals/object-get-own-property-names').f;
  13081. var typedArrayFrom = require('../internals/typed-array-from');
  13082. var forEach = require('../internals/array-iteration').forEach;
  13083. var setSpecies = require('../internals/set-species');
  13084. var definePropertyModule = require('../internals/object-define-property');
  13085. var getOwnPropertyDescriptorModule = require('../internals/object-get-own-property-descriptor');
  13086. var InternalStateModule = require('../internals/internal-state');
  13087. var inheritIfRequired = require('../internals/inherit-if-required');
  13088. var getInternalState = InternalStateModule.get;
  13089. var setInternalState = InternalStateModule.set;
  13090. var nativeDefineProperty = definePropertyModule.f;
  13091. var nativeGetOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f;
  13092. var round = Math.round;
  13093. var RangeError = global.RangeError;
  13094. var ArrayBuffer = ArrayBufferModule.ArrayBuffer;
  13095. var DataView = ArrayBufferModule.DataView;
  13096. var NATIVE_ARRAY_BUFFER_VIEWS = ArrayBufferViewCore.NATIVE_ARRAY_BUFFER_VIEWS;
  13097. var TYPED_ARRAY_CONSTRUCTOR = ArrayBufferViewCore.TYPED_ARRAY_CONSTRUCTOR;
  13098. var TYPED_ARRAY_TAG = ArrayBufferViewCore.TYPED_ARRAY_TAG;
  13099. var TypedArray = ArrayBufferViewCore.TypedArray;
  13100. var TypedArrayPrototype = ArrayBufferViewCore.TypedArrayPrototype;
  13101. var aTypedArrayConstructor = ArrayBufferViewCore.aTypedArrayConstructor;
  13102. var isTypedArray = ArrayBufferViewCore.isTypedArray;
  13103. var BYTES_PER_ELEMENT = 'BYTES_PER_ELEMENT';
  13104. var WRONG_LENGTH = 'Wrong length';
  13105. var fromList = function (C, list) {
  13106. var index = 0;
  13107. var length = list.length;
  13108. var result = new (aTypedArrayConstructor(C))(length);
  13109. while (length > index) result[index] = list[index++];
  13110. return result;
  13111. };
  13112. var addGetter = function (it, key) {
  13113. nativeDefineProperty(it, key, { get: function () {
  13114. return getInternalState(this)[key];
  13115. } });
  13116. };
  13117. var isArrayBuffer = function (it) {
  13118. var klass;
  13119. return it instanceof ArrayBuffer || (klass = classof(it)) == 'ArrayBuffer' || klass == 'SharedArrayBuffer';
  13120. };
  13121. var isTypedArrayIndex = function (target, key) {
  13122. return isTypedArray(target)
  13123. && !isSymbol(key)
  13124. && key in target
  13125. && isInteger(+key)
  13126. && key >= 0;
  13127. };
  13128. var wrappedGetOwnPropertyDescriptor = function getOwnPropertyDescriptor(target, key) {
  13129. key = toPropertyKey(key);
  13130. return isTypedArrayIndex(target, key)
  13131. ? createPropertyDescriptor(2, target[key])
  13132. : nativeGetOwnPropertyDescriptor(target, key);
  13133. };
  13134. var wrappedDefineProperty = function defineProperty(target, key, descriptor) {
  13135. key = toPropertyKey(key);
  13136. if (isTypedArrayIndex(target, key)
  13137. && isObject(descriptor)
  13138. && has(descriptor, 'value')
  13139. && !has(descriptor, 'get')
  13140. && !has(descriptor, 'set')
  13141. // TODO: add validation descriptor w/o calling accessors
  13142. && !descriptor.configurable
  13143. && (!has(descriptor, 'writable') || descriptor.writable)
  13144. && (!has(descriptor, 'enumerable') || descriptor.enumerable)
  13145. ) {
  13146. target[key] = descriptor.value;
  13147. return target;
  13148. } return nativeDefineProperty(target, key, descriptor);
  13149. };
  13150. if (DESCRIPTORS) {
  13151. if (!NATIVE_ARRAY_BUFFER_VIEWS) {
  13152. getOwnPropertyDescriptorModule.f = wrappedGetOwnPropertyDescriptor;
  13153. definePropertyModule.f = wrappedDefineProperty;
  13154. addGetter(TypedArrayPrototype, 'buffer');
  13155. addGetter(TypedArrayPrototype, 'byteOffset');
  13156. addGetter(TypedArrayPrototype, 'byteLength');
  13157. addGetter(TypedArrayPrototype, 'length');
  13158. }
  13159. $({ target: 'Object', stat: true, forced: !NATIVE_ARRAY_BUFFER_VIEWS }, {
  13160. getOwnPropertyDescriptor: wrappedGetOwnPropertyDescriptor,
  13161. defineProperty: wrappedDefineProperty
  13162. });
  13163. module.exports = function (TYPE, wrapper, CLAMPED) {
  13164. var BYTES = TYPE.match(/\d+$/)[0] / 8;
  13165. var CONSTRUCTOR_NAME = TYPE + (CLAMPED ? 'Clamped' : '') + 'Array';
  13166. var GETTER = 'get' + TYPE;
  13167. var SETTER = 'set' + TYPE;
  13168. var NativeTypedArrayConstructor = global[CONSTRUCTOR_NAME];
  13169. var TypedArrayConstructor = NativeTypedArrayConstructor;
  13170. var TypedArrayConstructorPrototype = TypedArrayConstructor && TypedArrayConstructor.prototype;
  13171. var exported = {};
  13172. var getter = function (that, index) {
  13173. var data = getInternalState(that);
  13174. return data.view[GETTER](index * BYTES + data.byteOffset, true);
  13175. };
  13176. var setter = function (that, index, value) {
  13177. var data = getInternalState(that);
  13178. if (CLAMPED) value = (value = round(value)) < 0 ? 0 : value > 0xFF ? 0xFF : value & 0xFF;
  13179. data.view[SETTER](index * BYTES + data.byteOffset, value, true);
  13180. };
  13181. var addElement = function (that, index) {
  13182. nativeDefineProperty(that, index, {
  13183. get: function () {
  13184. return getter(this, index);
  13185. },
  13186. set: function (value) {
  13187. return setter(this, index, value);
  13188. },
  13189. enumerable: true
  13190. });
  13191. };
  13192. if (!NATIVE_ARRAY_BUFFER_VIEWS) {
  13193. TypedArrayConstructor = wrapper(function (that, data, offset, $length) {
  13194. anInstance(that, TypedArrayConstructor, CONSTRUCTOR_NAME);
  13195. var index = 0;
  13196. var byteOffset = 0;
  13197. var buffer, byteLength, length;
  13198. if (!isObject(data)) {
  13199. length = toIndex(data);
  13200. byteLength = length * BYTES;
  13201. buffer = new ArrayBuffer(byteLength);
  13202. } else if (isArrayBuffer(data)) {
  13203. buffer = data;
  13204. byteOffset = toOffset(offset, BYTES);
  13205. var $len = data.byteLength;
  13206. if ($length === undefined) {
  13207. if ($len % BYTES) throw RangeError(WRONG_LENGTH);
  13208. byteLength = $len - byteOffset;
  13209. if (byteLength < 0) throw RangeError(WRONG_LENGTH);
  13210. } else {
  13211. byteLength = toLength($length) * BYTES;
  13212. if (byteLength + byteOffset > $len) throw RangeError(WRONG_LENGTH);
  13213. }
  13214. length = byteLength / BYTES;
  13215. } else if (isTypedArray(data)) {
  13216. return fromList(TypedArrayConstructor, data);
  13217. } else {
  13218. return typedArrayFrom.call(TypedArrayConstructor, data);
  13219. }
  13220. setInternalState(that, {
  13221. buffer: buffer,
  13222. byteOffset: byteOffset,
  13223. byteLength: byteLength,
  13224. length: length,
  13225. view: new DataView(buffer)
  13226. });
  13227. while (index < length) addElement(that, index++);
  13228. });
  13229. if (setPrototypeOf) setPrototypeOf(TypedArrayConstructor, TypedArray);
  13230. TypedArrayConstructorPrototype = TypedArrayConstructor.prototype = create(TypedArrayPrototype);
  13231. } else if (TYPED_ARRAYS_CONSTRUCTORS_REQUIRES_WRAPPERS) {
  13232. TypedArrayConstructor = wrapper(function (dummy, data, typedArrayOffset, $length) {
  13233. anInstance(dummy, TypedArrayConstructor, CONSTRUCTOR_NAME);
  13234. return inheritIfRequired(function () {
  13235. if (!isObject(data)) return new NativeTypedArrayConstructor(toIndex(data));
  13236. if (isArrayBuffer(data)) return $length !== undefined
  13237. ? new NativeTypedArrayConstructor(data, toOffset(typedArrayOffset, BYTES), $length)
  13238. : typedArrayOffset !== undefined
  13239. ? new NativeTypedArrayConstructor(data, toOffset(typedArrayOffset, BYTES))
  13240. : new NativeTypedArrayConstructor(data);
  13241. if (isTypedArray(data)) return fromList(TypedArrayConstructor, data);
  13242. return typedArrayFrom.call(TypedArrayConstructor, data);
  13243. }(), dummy, TypedArrayConstructor);
  13244. });
  13245. if (setPrototypeOf) setPrototypeOf(TypedArrayConstructor, TypedArray);
  13246. forEach(getOwnPropertyNames(NativeTypedArrayConstructor), function (key) {
  13247. if (!(key in TypedArrayConstructor)) {
  13248. createNonEnumerableProperty(TypedArrayConstructor, key, NativeTypedArrayConstructor[key]);
  13249. }
  13250. });
  13251. TypedArrayConstructor.prototype = TypedArrayConstructorPrototype;
  13252. }
  13253. if (TypedArrayConstructorPrototype.constructor !== TypedArrayConstructor) {
  13254. createNonEnumerableProperty(TypedArrayConstructorPrototype, 'constructor', TypedArrayConstructor);
  13255. }
  13256. createNonEnumerableProperty(TypedArrayConstructorPrototype, TYPED_ARRAY_CONSTRUCTOR, TypedArrayConstructor);
  13257. if (TYPED_ARRAY_TAG) {
  13258. createNonEnumerableProperty(TypedArrayConstructorPrototype, TYPED_ARRAY_TAG, CONSTRUCTOR_NAME);
  13259. }
  13260. exported[CONSTRUCTOR_NAME] = TypedArrayConstructor;
  13261. $({
  13262. global: true, forced: TypedArrayConstructor != NativeTypedArrayConstructor, sham: !NATIVE_ARRAY_BUFFER_VIEWS
  13263. }, exported);
  13264. if (!(BYTES_PER_ELEMENT in TypedArrayConstructor)) {
  13265. createNonEnumerableProperty(TypedArrayConstructor, BYTES_PER_ELEMENT, BYTES);
  13266. }
  13267. if (!(BYTES_PER_ELEMENT in TypedArrayConstructorPrototype)) {
  13268. createNonEnumerableProperty(TypedArrayConstructorPrototype, BYTES_PER_ELEMENT, BYTES);
  13269. }
  13270. setSpecies(CONSTRUCTOR_NAME);
  13271. };
  13272. } else module.exports = function () { /* empty */ };
  13273. },{"../internals/an-instance":93,"../internals/array-buffer":97,"../internals/array-buffer-view-core":96,"../internals/array-iteration":104,"../internals/classof":115,"../internals/create-non-enumerable-property":120,"../internals/create-property-descriptor":121,"../internals/descriptors":125,"../internals/export":139,"../internals/global":147,"../internals/has":148,"../internals/inherit-if-required":155,"../internals/internal-state":157,"../internals/is-integer":161,"../internals/is-object":162,"../internals/is-symbol":165,"../internals/object-create":177,"../internals/object-define-property":179,"../internals/object-get-own-property-descriptor":180,"../internals/object-get-own-property-names":182,"../internals/object-set-prototype-of":188,"../internals/set-species":207,"../internals/to-index":218,"../internals/to-length":221,"../internals/to-offset":223,"../internals/to-property-key":226,"../internals/typed-array-constructors-require-wrappers":230,"../internals/typed-array-from":232}],230:[function(require,module,exports){
  13274. /* eslint-disable no-new -- required for testing */
  13275. var global = require('../internals/global');
  13276. var fails = require('../internals/fails');
  13277. var checkCorrectnessOfIteration = require('../internals/check-correctness-of-iteration');
  13278. var NATIVE_ARRAY_BUFFER_VIEWS = require('../internals/array-buffer-view-core').NATIVE_ARRAY_BUFFER_VIEWS;
  13279. var ArrayBuffer = global.ArrayBuffer;
  13280. var Int8Array = global.Int8Array;
  13281. module.exports = !NATIVE_ARRAY_BUFFER_VIEWS || !fails(function () {
  13282. Int8Array(1);
  13283. }) || !fails(function () {
  13284. new Int8Array(-1);
  13285. }) || !checkCorrectnessOfIteration(function (iterable) {
  13286. new Int8Array();
  13287. new Int8Array(null);
  13288. new Int8Array(1.5);
  13289. new Int8Array(iterable);
  13290. }, true) || fails(function () {
  13291. // Safari (11+) bug - a reason why even Safari 13 should load a typed array polyfill
  13292. return new Int8Array(new ArrayBuffer(2), 1, undefined).length !== 1;
  13293. });
  13294. },{"../internals/array-buffer-view-core":96,"../internals/check-correctness-of-iteration":113,"../internals/fails":140,"../internals/global":147}],231:[function(require,module,exports){
  13295. var arrayFromConstructorAndList = require('../internals/array-from-constructor-and-list');
  13296. var typedArraySpeciesConstructor = require('../internals/typed-array-species-constructor');
  13297. module.exports = function (instance, list) {
  13298. return arrayFromConstructorAndList(typedArraySpeciesConstructor(instance), list);
  13299. };
  13300. },{"../internals/array-from-constructor-and-list":101,"../internals/typed-array-species-constructor":233}],232:[function(require,module,exports){
  13301. var toObject = require('../internals/to-object');
  13302. var toLength = require('../internals/to-length');
  13303. var getIterator = require('../internals/get-iterator');
  13304. var getIteratorMethod = require('../internals/get-iterator-method');
  13305. var isArrayIteratorMethod = require('../internals/is-array-iterator-method');
  13306. var bind = require('../internals/function-bind-context');
  13307. var aTypedArrayConstructor = require('../internals/array-buffer-view-core').aTypedArrayConstructor;
  13308. module.exports = function from(source /* , mapfn, thisArg */) {
  13309. var O = toObject(source);
  13310. var argumentsLength = arguments.length;
  13311. var mapfn = argumentsLength > 1 ? arguments[1] : undefined;
  13312. var mapping = mapfn !== undefined;
  13313. var iteratorMethod = getIteratorMethod(O);
  13314. var i, length, result, step, iterator, next;
  13315. if (iteratorMethod != undefined && !isArrayIteratorMethod(iteratorMethod)) {
  13316. iterator = getIterator(O, iteratorMethod);
  13317. next = iterator.next;
  13318. O = [];
  13319. while (!(step = next.call(iterator)).done) {
  13320. O.push(step.value);
  13321. }
  13322. }
  13323. if (mapping && argumentsLength > 2) {
  13324. mapfn = bind(mapfn, arguments[2], 2);
  13325. }
  13326. length = toLength(O.length);
  13327. result = new (aTypedArrayConstructor(this))(length);
  13328. for (i = 0; length > i; i++) {
  13329. result[i] = mapping ? mapfn(O[i], i) : O[i];
  13330. }
  13331. return result;
  13332. };
  13333. },{"../internals/array-buffer-view-core":96,"../internals/function-bind-context":142,"../internals/get-iterator":145,"../internals/get-iterator-method":144,"../internals/is-array-iterator-method":158,"../internals/to-length":221,"../internals/to-object":222}],233:[function(require,module,exports){
  13334. var ArrayBufferViewCore = require('../internals/array-buffer-view-core');
  13335. var speciesConstructor = require('../internals/species-constructor');
  13336. var TYPED_ARRAY_CONSTRUCTOR = ArrayBufferViewCore.TYPED_ARRAY_CONSTRUCTOR;
  13337. var aTypedArrayConstructor = ArrayBufferViewCore.aTypedArrayConstructor;
  13338. // a part of `TypedArraySpeciesCreate` abstract operation
  13339. // https://tc39.es/ecma262/#typedarray-species-create
  13340. module.exports = function (originalArray) {
  13341. return aTypedArrayConstructor(speciesConstructor(originalArray, originalArray[TYPED_ARRAY_CONSTRUCTOR]));
  13342. };
  13343. },{"../internals/array-buffer-view-core":96,"../internals/species-constructor":212}],234:[function(require,module,exports){
  13344. var id = 0;
  13345. var postfix = Math.random();
  13346. module.exports = function (key) {
  13347. return 'Symbol(' + String(key === undefined ? '' : key) + ')_' + (++id + postfix).toString(36);
  13348. };
  13349. },{}],235:[function(require,module,exports){
  13350. /* eslint-disable es/no-symbol -- required for testing */
  13351. var NATIVE_SYMBOL = require('../internals/native-symbol');
  13352. module.exports = NATIVE_SYMBOL
  13353. && !Symbol.sham
  13354. && typeof Symbol.iterator == 'symbol';
  13355. },{"../internals/native-symbol":172}],236:[function(require,module,exports){
  13356. var wellKnownSymbol = require('../internals/well-known-symbol');
  13357. exports.f = wellKnownSymbol;
  13358. },{"../internals/well-known-symbol":237}],237:[function(require,module,exports){
  13359. var global = require('../internals/global');
  13360. var shared = require('../internals/shared');
  13361. var has = require('../internals/has');
  13362. var uid = require('../internals/uid');
  13363. var NATIVE_SYMBOL = require('../internals/native-symbol');
  13364. var USE_SYMBOL_AS_UID = require('../internals/use-symbol-as-uid');
  13365. var WellKnownSymbolsStore = shared('wks');
  13366. var Symbol = global.Symbol;
  13367. var createWellKnownSymbol = USE_SYMBOL_AS_UID ? Symbol : Symbol && Symbol.withoutSetter || uid;
  13368. module.exports = function (name) {
  13369. if (!has(WellKnownSymbolsStore, name) || !(NATIVE_SYMBOL || typeof WellKnownSymbolsStore[name] == 'string')) {
  13370. if (NATIVE_SYMBOL && has(Symbol, name)) {
  13371. WellKnownSymbolsStore[name] = Symbol[name];
  13372. } else {
  13373. WellKnownSymbolsStore[name] = createWellKnownSymbol('Symbol.' + name);
  13374. }
  13375. } return WellKnownSymbolsStore[name];
  13376. };
  13377. },{"../internals/global":147,"../internals/has":148,"../internals/native-symbol":172,"../internals/shared":211,"../internals/uid":234,"../internals/use-symbol-as-uid":235}],238:[function(require,module,exports){
  13378. // a string of all valid unicode whitespaces
  13379. module.exports = '\u0009\u000A\u000B\u000C\u000D\u0020\u00A0\u1680\u2000\u2001\u2002' +
  13380. '\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF';
  13381. },{}],239:[function(require,module,exports){
  13382. 'use strict';
  13383. var $ = require('../internals/export');
  13384. var global = require('../internals/global');
  13385. var arrayBufferModule = require('../internals/array-buffer');
  13386. var setSpecies = require('../internals/set-species');
  13387. var ARRAY_BUFFER = 'ArrayBuffer';
  13388. var ArrayBuffer = arrayBufferModule[ARRAY_BUFFER];
  13389. var NativeArrayBuffer = global[ARRAY_BUFFER];
  13390. // `ArrayBuffer` constructor
  13391. // https://tc39.es/ecma262/#sec-arraybuffer-constructor
  13392. $({ global: true, forced: NativeArrayBuffer !== ArrayBuffer }, {
  13393. ArrayBuffer: ArrayBuffer
  13394. });
  13395. setSpecies(ARRAY_BUFFER);
  13396. },{"../internals/array-buffer":97,"../internals/export":139,"../internals/global":147,"../internals/set-species":207}],240:[function(require,module,exports){
  13397. 'use strict';
  13398. var $ = require('../internals/export');
  13399. var fails = require('../internals/fails');
  13400. var ArrayBufferModule = require('../internals/array-buffer');
  13401. var anObject = require('../internals/an-object');
  13402. var toAbsoluteIndex = require('../internals/to-absolute-index');
  13403. var toLength = require('../internals/to-length');
  13404. var speciesConstructor = require('../internals/species-constructor');
  13405. var ArrayBuffer = ArrayBufferModule.ArrayBuffer;
  13406. var DataView = ArrayBufferModule.DataView;
  13407. var nativeArrayBufferSlice = ArrayBuffer.prototype.slice;
  13408. var INCORRECT_SLICE = fails(function () {
  13409. return !new ArrayBuffer(2).slice(1, undefined).byteLength;
  13410. });
  13411. // `ArrayBuffer.prototype.slice` method
  13412. // https://tc39.es/ecma262/#sec-arraybuffer.prototype.slice
  13413. $({ target: 'ArrayBuffer', proto: true, unsafe: true, forced: INCORRECT_SLICE }, {
  13414. slice: function slice(start, end) {
  13415. if (nativeArrayBufferSlice !== undefined && end === undefined) {
  13416. return nativeArrayBufferSlice.call(anObject(this), start); // FF fix
  13417. }
  13418. var length = anObject(this).byteLength;
  13419. var first = toAbsoluteIndex(start, length);
  13420. var fin = toAbsoluteIndex(end === undefined ? length : end, length);
  13421. var result = new (speciesConstructor(this, ArrayBuffer))(toLength(fin - first));
  13422. var viewSource = new DataView(this);
  13423. var viewTarget = new DataView(result);
  13424. var index = 0;
  13425. while (first < fin) {
  13426. viewTarget.setUint8(index++, viewSource.getUint8(first++));
  13427. } return result;
  13428. }
  13429. });
  13430. },{"../internals/an-object":94,"../internals/array-buffer":97,"../internals/export":139,"../internals/fails":140,"../internals/species-constructor":212,"../internals/to-absolute-index":217,"../internals/to-length":221}],241:[function(require,module,exports){
  13431. 'use strict';
  13432. var $ = require('../internals/export');
  13433. var fails = require('../internals/fails');
  13434. var isArray = require('../internals/is-array');
  13435. var isObject = require('../internals/is-object');
  13436. var toObject = require('../internals/to-object');
  13437. var toLength = require('../internals/to-length');
  13438. var createProperty = require('../internals/create-property');
  13439. var arraySpeciesCreate = require('../internals/array-species-create');
  13440. var arrayMethodHasSpeciesSupport = require('../internals/array-method-has-species-support');
  13441. var wellKnownSymbol = require('../internals/well-known-symbol');
  13442. var V8_VERSION = require('../internals/engine-v8-version');
  13443. var IS_CONCAT_SPREADABLE = wellKnownSymbol('isConcatSpreadable');
  13444. var MAX_SAFE_INTEGER = 0x1FFFFFFFFFFFFF;
  13445. var MAXIMUM_ALLOWED_INDEX_EXCEEDED = 'Maximum allowed index exceeded';
  13446. // We can't use this feature detection in V8 since it causes
  13447. // deoptimization and serious performance degradation
  13448. // https://github.com/zloirock/core-js/issues/679
  13449. var IS_CONCAT_SPREADABLE_SUPPORT = V8_VERSION >= 51 || !fails(function () {
  13450. var array = [];
  13451. array[IS_CONCAT_SPREADABLE] = false;
  13452. return array.concat()[0] !== array;
  13453. });
  13454. var SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('concat');
  13455. var isConcatSpreadable = function (O) {
  13456. if (!isObject(O)) return false;
  13457. var spreadable = O[IS_CONCAT_SPREADABLE];
  13458. return spreadable !== undefined ? !!spreadable : isArray(O);
  13459. };
  13460. var FORCED = !IS_CONCAT_SPREADABLE_SUPPORT || !SPECIES_SUPPORT;
  13461. // `Array.prototype.concat` method
  13462. // https://tc39.es/ecma262/#sec-array.prototype.concat
  13463. // with adding support of @@isConcatSpreadable and @@species
  13464. $({ target: 'Array', proto: true, forced: FORCED }, {
  13465. // eslint-disable-next-line no-unused-vars -- required for `.length`
  13466. concat: function concat(arg) {
  13467. var O = toObject(this);
  13468. var A = arraySpeciesCreate(O, 0);
  13469. var n = 0;
  13470. var i, k, length, len, E;
  13471. for (i = -1, length = arguments.length; i < length; i++) {
  13472. E = i === -1 ? O : arguments[i];
  13473. if (isConcatSpreadable(E)) {
  13474. len = toLength(E.length);
  13475. if (n + len > MAX_SAFE_INTEGER) throw TypeError(MAXIMUM_ALLOWED_INDEX_EXCEEDED);
  13476. for (k = 0; k < len; k++, n++) if (k in E) createProperty(A, n, E[k]);
  13477. } else {
  13478. if (n >= MAX_SAFE_INTEGER) throw TypeError(MAXIMUM_ALLOWED_INDEX_EXCEEDED);
  13479. createProperty(A, n++, E);
  13480. }
  13481. }
  13482. A.length = n;
  13483. return A;
  13484. }
  13485. });
  13486. },{"../internals/array-method-has-species-support":106,"../internals/array-species-create":111,"../internals/create-property":122,"../internals/engine-v8-version":136,"../internals/export":139,"../internals/fails":140,"../internals/is-array":159,"../internals/is-object":162,"../internals/to-length":221,"../internals/to-object":222,"../internals/well-known-symbol":237}],242:[function(require,module,exports){
  13487. var $ = require('../internals/export');
  13488. var fill = require('../internals/array-fill');
  13489. var addToUnscopables = require('../internals/add-to-unscopables');
  13490. // `Array.prototype.fill` method
  13491. // https://tc39.es/ecma262/#sec-array.prototype.fill
  13492. $({ target: 'Array', proto: true }, {
  13493. fill: fill
  13494. });
  13495. // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
  13496. addToUnscopables('fill');
  13497. },{"../internals/add-to-unscopables":91,"../internals/array-fill":99,"../internals/export":139}],243:[function(require,module,exports){
  13498. 'use strict';
  13499. var $ = require('../internals/export');
  13500. var $filter = require('../internals/array-iteration').filter;
  13501. var arrayMethodHasSpeciesSupport = require('../internals/array-method-has-species-support');
  13502. var HAS_SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('filter');
  13503. // `Array.prototype.filter` method
  13504. // https://tc39.es/ecma262/#sec-array.prototype.filter
  13505. // with adding support of @@species
  13506. $({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT }, {
  13507. filter: function filter(callbackfn /* , thisArg */) {
  13508. return $filter(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
  13509. }
  13510. });
  13511. },{"../internals/array-iteration":104,"../internals/array-method-has-species-support":106,"../internals/export":139}],244:[function(require,module,exports){
  13512. 'use strict';
  13513. var $ = require('../internals/export');
  13514. var $find = require('../internals/array-iteration').find;
  13515. var addToUnscopables = require('../internals/add-to-unscopables');
  13516. var FIND = 'find';
  13517. var SKIPS_HOLES = true;
  13518. // Shouldn't skip holes
  13519. if (FIND in []) Array(1)[FIND](function () { SKIPS_HOLES = false; });
  13520. // `Array.prototype.find` method
  13521. // https://tc39.es/ecma262/#sec-array.prototype.find
  13522. $({ target: 'Array', proto: true, forced: SKIPS_HOLES }, {
  13523. find: function find(callbackfn /* , that = undefined */) {
  13524. return $find(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
  13525. }
  13526. });
  13527. // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
  13528. addToUnscopables(FIND);
  13529. },{"../internals/add-to-unscopables":91,"../internals/array-iteration":104,"../internals/export":139}],245:[function(require,module,exports){
  13530. var $ = require('../internals/export');
  13531. var from = require('../internals/array-from');
  13532. var checkCorrectnessOfIteration = require('../internals/check-correctness-of-iteration');
  13533. var INCORRECT_ITERATION = !checkCorrectnessOfIteration(function (iterable) {
  13534. // eslint-disable-next-line es/no-array-from -- required for testing
  13535. Array.from(iterable);
  13536. });
  13537. // `Array.from` method
  13538. // https://tc39.es/ecma262/#sec-array.from
  13539. $({ target: 'Array', stat: true, forced: INCORRECT_ITERATION }, {
  13540. from: from
  13541. });
  13542. },{"../internals/array-from":102,"../internals/check-correctness-of-iteration":113,"../internals/export":139}],246:[function(require,module,exports){
  13543. 'use strict';
  13544. var $ = require('../internals/export');
  13545. var $includes = require('../internals/array-includes').includes;
  13546. var addToUnscopables = require('../internals/add-to-unscopables');
  13547. // `Array.prototype.includes` method
  13548. // https://tc39.es/ecma262/#sec-array.prototype.includes
  13549. $({ target: 'Array', proto: true }, {
  13550. includes: function includes(el /* , fromIndex = 0 */) {
  13551. return $includes(this, el, arguments.length > 1 ? arguments[1] : undefined);
  13552. }
  13553. });
  13554. // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
  13555. addToUnscopables('includes');
  13556. },{"../internals/add-to-unscopables":91,"../internals/array-includes":103,"../internals/export":139}],247:[function(require,module,exports){
  13557. 'use strict';
  13558. var toIndexedObject = require('../internals/to-indexed-object');
  13559. var addToUnscopables = require('../internals/add-to-unscopables');
  13560. var Iterators = require('../internals/iterators');
  13561. var InternalStateModule = require('../internals/internal-state');
  13562. var defineIterator = require('../internals/define-iterator');
  13563. var ARRAY_ITERATOR = 'Array Iterator';
  13564. var setInternalState = InternalStateModule.set;
  13565. var getInternalState = InternalStateModule.getterFor(ARRAY_ITERATOR);
  13566. // `Array.prototype.entries` method
  13567. // https://tc39.es/ecma262/#sec-array.prototype.entries
  13568. // `Array.prototype.keys` method
  13569. // https://tc39.es/ecma262/#sec-array.prototype.keys
  13570. // `Array.prototype.values` method
  13571. // https://tc39.es/ecma262/#sec-array.prototype.values
  13572. // `Array.prototype[@@iterator]` method
  13573. // https://tc39.es/ecma262/#sec-array.prototype-@@iterator
  13574. // `CreateArrayIterator` internal method
  13575. // https://tc39.es/ecma262/#sec-createarrayiterator
  13576. module.exports = defineIterator(Array, 'Array', function (iterated, kind) {
  13577. setInternalState(this, {
  13578. type: ARRAY_ITERATOR,
  13579. target: toIndexedObject(iterated), // target
  13580. index: 0, // next index
  13581. kind: kind // kind
  13582. });
  13583. // `%ArrayIteratorPrototype%.next` method
  13584. // https://tc39.es/ecma262/#sec-%arrayiteratorprototype%.next
  13585. }, function () {
  13586. var state = getInternalState(this);
  13587. var target = state.target;
  13588. var kind = state.kind;
  13589. var index = state.index++;
  13590. if (!target || index >= target.length) {
  13591. state.target = undefined;
  13592. return { value: undefined, done: true };
  13593. }
  13594. if (kind == 'keys') return { value: index, done: false };
  13595. if (kind == 'values') return { value: target[index], done: false };
  13596. return { value: [index, target[index]], done: false };
  13597. }, 'values');
  13598. // argumentsList[@@iterator] is %ArrayProto_values%
  13599. // https://tc39.es/ecma262/#sec-createunmappedargumentsobject
  13600. // https://tc39.es/ecma262/#sec-createmappedargumentsobject
  13601. Iterators.Arguments = Iterators.Array;
  13602. // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
  13603. addToUnscopables('keys');
  13604. addToUnscopables('values');
  13605. addToUnscopables('entries');
  13606. },{"../internals/add-to-unscopables":91,"../internals/define-iterator":123,"../internals/internal-state":157,"../internals/iterators":169,"../internals/to-indexed-object":219}],248:[function(require,module,exports){
  13607. 'use strict';
  13608. var $ = require('../internals/export');
  13609. var IndexedObject = require('../internals/indexed-object');
  13610. var toIndexedObject = require('../internals/to-indexed-object');
  13611. var arrayMethodIsStrict = require('../internals/array-method-is-strict');
  13612. var nativeJoin = [].join;
  13613. var ES3_STRINGS = IndexedObject != Object;
  13614. var STRICT_METHOD = arrayMethodIsStrict('join', ',');
  13615. // `Array.prototype.join` method
  13616. // https://tc39.es/ecma262/#sec-array.prototype.join
  13617. $({ target: 'Array', proto: true, forced: ES3_STRINGS || !STRICT_METHOD }, {
  13618. join: function join(separator) {
  13619. return nativeJoin.call(toIndexedObject(this), separator === undefined ? ',' : separator);
  13620. }
  13621. });
  13622. },{"../internals/array-method-is-strict":107,"../internals/export":139,"../internals/indexed-object":154,"../internals/to-indexed-object":219}],249:[function(require,module,exports){
  13623. 'use strict';
  13624. var $ = require('../internals/export');
  13625. var $map = require('../internals/array-iteration').map;
  13626. var arrayMethodHasSpeciesSupport = require('../internals/array-method-has-species-support');
  13627. var HAS_SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('map');
  13628. // `Array.prototype.map` method
  13629. // https://tc39.es/ecma262/#sec-array.prototype.map
  13630. // with adding support of @@species
  13631. $({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT }, {
  13632. map: function map(callbackfn /* , thisArg */) {
  13633. return $map(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
  13634. }
  13635. });
  13636. },{"../internals/array-iteration":104,"../internals/array-method-has-species-support":106,"../internals/export":139}],250:[function(require,module,exports){
  13637. 'use strict';
  13638. var $ = require('../internals/export');
  13639. var isObject = require('../internals/is-object');
  13640. var isArray = require('../internals/is-array');
  13641. var toAbsoluteIndex = require('../internals/to-absolute-index');
  13642. var toLength = require('../internals/to-length');
  13643. var toIndexedObject = require('../internals/to-indexed-object');
  13644. var createProperty = require('../internals/create-property');
  13645. var wellKnownSymbol = require('../internals/well-known-symbol');
  13646. var arrayMethodHasSpeciesSupport = require('../internals/array-method-has-species-support');
  13647. var HAS_SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('slice');
  13648. var SPECIES = wellKnownSymbol('species');
  13649. var nativeSlice = [].slice;
  13650. var max = Math.max;
  13651. // `Array.prototype.slice` method
  13652. // https://tc39.es/ecma262/#sec-array.prototype.slice
  13653. // fallback for not array-like ES3 strings and DOM objects
  13654. $({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT }, {
  13655. slice: function slice(start, end) {
  13656. var O = toIndexedObject(this);
  13657. var length = toLength(O.length);
  13658. var k = toAbsoluteIndex(start, length);
  13659. var fin = toAbsoluteIndex(end === undefined ? length : end, length);
  13660. // inline `ArraySpeciesCreate` for usage native `Array#slice` where it's possible
  13661. var Constructor, result, n;
  13662. if (isArray(O)) {
  13663. Constructor = O.constructor;
  13664. // cross-realm fallback
  13665. if (typeof Constructor == 'function' && (Constructor === Array || isArray(Constructor.prototype))) {
  13666. Constructor = undefined;
  13667. } else if (isObject(Constructor)) {
  13668. Constructor = Constructor[SPECIES];
  13669. if (Constructor === null) Constructor = undefined;
  13670. }
  13671. if (Constructor === Array || Constructor === undefined) {
  13672. return nativeSlice.call(O, k, fin);
  13673. }
  13674. }
  13675. result = new (Constructor === undefined ? Array : Constructor)(max(fin - k, 0));
  13676. for (n = 0; k < fin; k++, n++) if (k in O) createProperty(result, n, O[k]);
  13677. result.length = n;
  13678. return result;
  13679. }
  13680. });
  13681. },{"../internals/array-method-has-species-support":106,"../internals/create-property":122,"../internals/export":139,"../internals/is-array":159,"../internals/is-object":162,"../internals/to-absolute-index":217,"../internals/to-indexed-object":219,"../internals/to-length":221,"../internals/well-known-symbol":237}],251:[function(require,module,exports){
  13682. 'use strict';
  13683. var $ = require('../internals/export');
  13684. var aFunction = require('../internals/a-function');
  13685. var toObject = require('../internals/to-object');
  13686. var toLength = require('../internals/to-length');
  13687. var toString = require('../internals/to-string');
  13688. var fails = require('../internals/fails');
  13689. var internalSort = require('../internals/array-sort');
  13690. var arrayMethodIsStrict = require('../internals/array-method-is-strict');
  13691. var FF = require('../internals/engine-ff-version');
  13692. var IE_OR_EDGE = require('../internals/engine-is-ie-or-edge');
  13693. var V8 = require('../internals/engine-v8-version');
  13694. var WEBKIT = require('../internals/engine-webkit-version');
  13695. var test = [];
  13696. var nativeSort = test.sort;
  13697. // IE8-
  13698. var FAILS_ON_UNDEFINED = fails(function () {
  13699. test.sort(undefined);
  13700. });
  13701. // V8 bug
  13702. var FAILS_ON_NULL = fails(function () {
  13703. test.sort(null);
  13704. });
  13705. // Old WebKit
  13706. var STRICT_METHOD = arrayMethodIsStrict('sort');
  13707. var STABLE_SORT = !fails(function () {
  13708. // feature detection can be too slow, so check engines versions
  13709. if (V8) return V8 < 70;
  13710. if (FF && FF > 3) return;
  13711. if (IE_OR_EDGE) return true;
  13712. if (WEBKIT) return WEBKIT < 603;
  13713. var result = '';
  13714. var code, chr, value, index;
  13715. // generate an array with more 512 elements (Chakra and old V8 fails only in this case)
  13716. for (code = 65; code < 76; code++) {
  13717. chr = String.fromCharCode(code);
  13718. switch (code) {
  13719. case 66: case 69: case 70: case 72: value = 3; break;
  13720. case 68: case 71: value = 4; break;
  13721. default: value = 2;
  13722. }
  13723. for (index = 0; index < 47; index++) {
  13724. test.push({ k: chr + index, v: value });
  13725. }
  13726. }
  13727. test.sort(function (a, b) { return b.v - a.v; });
  13728. for (index = 0; index < test.length; index++) {
  13729. chr = test[index].k.charAt(0);
  13730. if (result.charAt(result.length - 1) !== chr) result += chr;
  13731. }
  13732. return result !== 'DGBEFHACIJK';
  13733. });
  13734. var FORCED = FAILS_ON_UNDEFINED || !FAILS_ON_NULL || !STRICT_METHOD || !STABLE_SORT;
  13735. var getSortCompare = function (comparefn) {
  13736. return function (x, y) {
  13737. if (y === undefined) return -1;
  13738. if (x === undefined) return 1;
  13739. if (comparefn !== undefined) return +comparefn(x, y) || 0;
  13740. return toString(x) > toString(y) ? 1 : -1;
  13741. };
  13742. };
  13743. // `Array.prototype.sort` method
  13744. // https://tc39.es/ecma262/#sec-array.prototype.sort
  13745. $({ target: 'Array', proto: true, forced: FORCED }, {
  13746. sort: function sort(comparefn) {
  13747. if (comparefn !== undefined) aFunction(comparefn);
  13748. var array = toObject(this);
  13749. if (STABLE_SORT) return comparefn === undefined ? nativeSort.call(array) : nativeSort.call(array, comparefn);
  13750. var items = [];
  13751. var arrayLength = toLength(array.length);
  13752. var itemsLength, index;
  13753. for (index = 0; index < arrayLength; index++) {
  13754. if (index in array) items.push(array[index]);
  13755. }
  13756. items = internalSort(items, getSortCompare(comparefn));
  13757. itemsLength = items.length;
  13758. index = 0;
  13759. while (index < itemsLength) array[index] = items[index++];
  13760. while (index < arrayLength) delete array[index++];
  13761. return array;
  13762. }
  13763. });
  13764. },{"../internals/a-function":89,"../internals/array-method-is-strict":107,"../internals/array-sort":109,"../internals/engine-ff-version":128,"../internals/engine-is-ie-or-edge":130,"../internals/engine-v8-version":136,"../internals/engine-webkit-version":137,"../internals/export":139,"../internals/fails":140,"../internals/to-length":221,"../internals/to-object":222,"../internals/to-string":228}],252:[function(require,module,exports){
  13765. 'use strict';
  13766. var $ = require('../internals/export');
  13767. var toAbsoluteIndex = require('../internals/to-absolute-index');
  13768. var toInteger = require('../internals/to-integer');
  13769. var toLength = require('../internals/to-length');
  13770. var toObject = require('../internals/to-object');
  13771. var arraySpeciesCreate = require('../internals/array-species-create');
  13772. var createProperty = require('../internals/create-property');
  13773. var arrayMethodHasSpeciesSupport = require('../internals/array-method-has-species-support');
  13774. var HAS_SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('splice');
  13775. var max = Math.max;
  13776. var min = Math.min;
  13777. var MAX_SAFE_INTEGER = 0x1FFFFFFFFFFFFF;
  13778. var MAXIMUM_ALLOWED_LENGTH_EXCEEDED = 'Maximum allowed length exceeded';
  13779. // `Array.prototype.splice` method
  13780. // https://tc39.es/ecma262/#sec-array.prototype.splice
  13781. // with adding support of @@species
  13782. $({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT }, {
  13783. splice: function splice(start, deleteCount /* , ...items */) {
  13784. var O = toObject(this);
  13785. var len = toLength(O.length);
  13786. var actualStart = toAbsoluteIndex(start, len);
  13787. var argumentsLength = arguments.length;
  13788. var insertCount, actualDeleteCount, A, k, from, to;
  13789. if (argumentsLength === 0) {
  13790. insertCount = actualDeleteCount = 0;
  13791. } else if (argumentsLength === 1) {
  13792. insertCount = 0;
  13793. actualDeleteCount = len - actualStart;
  13794. } else {
  13795. insertCount = argumentsLength - 2;
  13796. actualDeleteCount = min(max(toInteger(deleteCount), 0), len - actualStart);
  13797. }
  13798. if (len + insertCount - actualDeleteCount > MAX_SAFE_INTEGER) {
  13799. throw TypeError(MAXIMUM_ALLOWED_LENGTH_EXCEEDED);
  13800. }
  13801. A = arraySpeciesCreate(O, actualDeleteCount);
  13802. for (k = 0; k < actualDeleteCount; k++) {
  13803. from = actualStart + k;
  13804. if (from in O) createProperty(A, k, O[from]);
  13805. }
  13806. A.length = actualDeleteCount;
  13807. if (insertCount < actualDeleteCount) {
  13808. for (k = actualStart; k < len - actualDeleteCount; k++) {
  13809. from = k + actualDeleteCount;
  13810. to = k + insertCount;
  13811. if (from in O) O[to] = O[from];
  13812. else delete O[to];
  13813. }
  13814. for (k = len; k > len - actualDeleteCount + insertCount; k--) delete O[k - 1];
  13815. } else if (insertCount > actualDeleteCount) {
  13816. for (k = len - actualDeleteCount; k > actualStart; k--) {
  13817. from = k + actualDeleteCount - 1;
  13818. to = k + insertCount - 1;
  13819. if (from in O) O[to] = O[from];
  13820. else delete O[to];
  13821. }
  13822. }
  13823. for (k = 0; k < insertCount; k++) {
  13824. O[k + actualStart] = arguments[k + 2];
  13825. }
  13826. O.length = len - actualDeleteCount + insertCount;
  13827. return A;
  13828. }
  13829. });
  13830. },{"../internals/array-method-has-species-support":106,"../internals/array-species-create":111,"../internals/create-property":122,"../internals/export":139,"../internals/to-absolute-index":217,"../internals/to-integer":220,"../internals/to-length":221,"../internals/to-object":222}],253:[function(require,module,exports){
  13831. var DESCRIPTORS = require('../internals/descriptors');
  13832. var defineProperty = require('../internals/object-define-property').f;
  13833. var FunctionPrototype = Function.prototype;
  13834. var FunctionPrototypeToString = FunctionPrototype.toString;
  13835. var nameRE = /^\s*function ([^ (]*)/;
  13836. var NAME = 'name';
  13837. // Function instances `.name` property
  13838. // https://tc39.es/ecma262/#sec-function-instances-name
  13839. if (DESCRIPTORS && !(NAME in FunctionPrototype)) {
  13840. defineProperty(FunctionPrototype, NAME, {
  13841. configurable: true,
  13842. get: function () {
  13843. try {
  13844. return FunctionPrototypeToString.call(this).match(nameRE)[1];
  13845. } catch (error) {
  13846. return '';
  13847. }
  13848. }
  13849. });
  13850. }
  13851. },{"../internals/descriptors":125,"../internals/object-define-property":179}],254:[function(require,module,exports){
  13852. 'use strict';
  13853. var DESCRIPTORS = require('../internals/descriptors');
  13854. var global = require('../internals/global');
  13855. var isForced = require('../internals/is-forced');
  13856. var redefine = require('../internals/redefine');
  13857. var has = require('../internals/has');
  13858. var classof = require('../internals/classof-raw');
  13859. var inheritIfRequired = require('../internals/inherit-if-required');
  13860. var isSymbol = require('../internals/is-symbol');
  13861. var toPrimitive = require('../internals/to-primitive');
  13862. var fails = require('../internals/fails');
  13863. var create = require('../internals/object-create');
  13864. var getOwnPropertyNames = require('../internals/object-get-own-property-names').f;
  13865. var getOwnPropertyDescriptor = require('../internals/object-get-own-property-descriptor').f;
  13866. var defineProperty = require('../internals/object-define-property').f;
  13867. var trim = require('../internals/string-trim').trim;
  13868. var NUMBER = 'Number';
  13869. var NativeNumber = global[NUMBER];
  13870. var NumberPrototype = NativeNumber.prototype;
  13871. // Opera ~12 has broken Object#toString
  13872. var BROKEN_CLASSOF = classof(create(NumberPrototype)) == NUMBER;
  13873. // `ToNumber` abstract operation
  13874. // https://tc39.es/ecma262/#sec-tonumber
  13875. var toNumber = function (argument) {
  13876. if (isSymbol(argument)) throw TypeError('Cannot convert a Symbol value to a number');
  13877. var it = toPrimitive(argument, 'number');
  13878. var first, third, radix, maxCode, digits, length, index, code;
  13879. if (typeof it == 'string' && it.length > 2) {
  13880. it = trim(it);
  13881. first = it.charCodeAt(0);
  13882. if (first === 43 || first === 45) {
  13883. third = it.charCodeAt(2);
  13884. if (third === 88 || third === 120) return NaN; // Number('+0x1') should be NaN, old V8 fix
  13885. } else if (first === 48) {
  13886. switch (it.charCodeAt(1)) {
  13887. case 66: case 98: radix = 2; maxCode = 49; break; // fast equal of /^0b[01]+$/i
  13888. case 79: case 111: radix = 8; maxCode = 55; break; // fast equal of /^0o[0-7]+$/i
  13889. default: return +it;
  13890. }
  13891. digits = it.slice(2);
  13892. length = digits.length;
  13893. for (index = 0; index < length; index++) {
  13894. code = digits.charCodeAt(index);
  13895. // parseInt parses a string to a first unavailable symbol
  13896. // but ToNumber should return NaN if a string contains unavailable symbols
  13897. if (code < 48 || code > maxCode) return NaN;
  13898. } return parseInt(digits, radix);
  13899. }
  13900. } return +it;
  13901. };
  13902. // `Number` constructor
  13903. // https://tc39.es/ecma262/#sec-number-constructor
  13904. if (isForced(NUMBER, !NativeNumber(' 0o1') || !NativeNumber('0b1') || NativeNumber('+0x1'))) {
  13905. var NumberWrapper = function Number(value) {
  13906. var it = arguments.length < 1 ? 0 : value;
  13907. var dummy = this;
  13908. return dummy instanceof NumberWrapper
  13909. // check on 1..constructor(foo) case
  13910. && (BROKEN_CLASSOF ? fails(function () { NumberPrototype.valueOf.call(dummy); }) : classof(dummy) != NUMBER)
  13911. ? inheritIfRequired(new NativeNumber(toNumber(it)), dummy, NumberWrapper) : toNumber(it);
  13912. };
  13913. for (var keys = DESCRIPTORS ? getOwnPropertyNames(NativeNumber) : (
  13914. // ES3:
  13915. 'MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,' +
  13916. // ES2015 (in case, if modules with ES2015 Number statics required before):
  13917. 'EPSILON,isFinite,isInteger,isNaN,isSafeInteger,MAX_SAFE_INTEGER,' +
  13918. 'MIN_SAFE_INTEGER,parseFloat,parseInt,isInteger,' +
  13919. // ESNext
  13920. 'fromString,range'
  13921. ).split(','), j = 0, key; keys.length > j; j++) {
  13922. if (has(NativeNumber, key = keys[j]) && !has(NumberWrapper, key)) {
  13923. defineProperty(NumberWrapper, key, getOwnPropertyDescriptor(NativeNumber, key));
  13924. }
  13925. }
  13926. NumberWrapper.prototype = NumberPrototype;
  13927. NumberPrototype.constructor = NumberWrapper;
  13928. redefine(global, NUMBER, NumberWrapper);
  13929. }
  13930. },{"../internals/classof-raw":114,"../internals/descriptors":125,"../internals/fails":140,"../internals/global":147,"../internals/has":148,"../internals/inherit-if-required":155,"../internals/is-forced":160,"../internals/is-symbol":165,"../internals/object-create":177,"../internals/object-define-property":179,"../internals/object-get-own-property-descriptor":180,"../internals/object-get-own-property-names":182,"../internals/redefine":197,"../internals/string-trim":215,"../internals/to-primitive":225}],255:[function(require,module,exports){
  13931. var $ = require('../internals/export');
  13932. var assign = require('../internals/object-assign');
  13933. // `Object.assign` method
  13934. // https://tc39.es/ecma262/#sec-object.assign
  13935. // eslint-disable-next-line es/no-object-assign -- required for testing
  13936. $({ target: 'Object', stat: true, forced: Object.assign !== assign }, {
  13937. assign: assign
  13938. });
  13939. },{"../internals/export":139,"../internals/object-assign":176}],256:[function(require,module,exports){
  13940. var $ = require('../internals/export');
  13941. var $entries = require('../internals/object-to-array').entries;
  13942. // `Object.entries` method
  13943. // https://tc39.es/ecma262/#sec-object.entries
  13944. $({ target: 'Object', stat: true }, {
  13945. entries: function entries(O) {
  13946. return $entries(O);
  13947. }
  13948. });
  13949. },{"../internals/export":139,"../internals/object-to-array":189}],257:[function(require,module,exports){
  13950. var $ = require('../internals/export');
  13951. var toObject = require('../internals/to-object');
  13952. var nativeKeys = require('../internals/object-keys');
  13953. var fails = require('../internals/fails');
  13954. var FAILS_ON_PRIMITIVES = fails(function () { nativeKeys(1); });
  13955. // `Object.keys` method
  13956. // https://tc39.es/ecma262/#sec-object.keys
  13957. $({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES }, {
  13958. keys: function keys(it) {
  13959. return nativeKeys(toObject(it));
  13960. }
  13961. });
  13962. },{"../internals/export":139,"../internals/fails":140,"../internals/object-keys":186,"../internals/to-object":222}],258:[function(require,module,exports){
  13963. var TO_STRING_TAG_SUPPORT = require('../internals/to-string-tag-support');
  13964. var redefine = require('../internals/redefine');
  13965. var toString = require('../internals/object-to-string');
  13966. // `Object.prototype.toString` method
  13967. // https://tc39.es/ecma262/#sec-object.prototype.tostring
  13968. if (!TO_STRING_TAG_SUPPORT) {
  13969. redefine(Object.prototype, 'toString', toString, { unsafe: true });
  13970. }
  13971. },{"../internals/object-to-string":190,"../internals/redefine":197,"../internals/to-string-tag-support":227}],259:[function(require,module,exports){
  13972. 'use strict';
  13973. var $ = require('../internals/export');
  13974. var IS_PURE = require('../internals/is-pure');
  13975. var global = require('../internals/global');
  13976. var getBuiltIn = require('../internals/get-built-in');
  13977. var NativePromise = require('../internals/native-promise-constructor');
  13978. var redefine = require('../internals/redefine');
  13979. var redefineAll = require('../internals/redefine-all');
  13980. var setPrototypeOf = require('../internals/object-set-prototype-of');
  13981. var setToStringTag = require('../internals/set-to-string-tag');
  13982. var setSpecies = require('../internals/set-species');
  13983. var isObject = require('../internals/is-object');
  13984. var aFunction = require('../internals/a-function');
  13985. var anInstance = require('../internals/an-instance');
  13986. var inspectSource = require('../internals/inspect-source');
  13987. var iterate = require('../internals/iterate');
  13988. var checkCorrectnessOfIteration = require('../internals/check-correctness-of-iteration');
  13989. var speciesConstructor = require('../internals/species-constructor');
  13990. var task = require('../internals/task').set;
  13991. var microtask = require('../internals/microtask');
  13992. var promiseResolve = require('../internals/promise-resolve');
  13993. var hostReportErrors = require('../internals/host-report-errors');
  13994. var newPromiseCapabilityModule = require('../internals/new-promise-capability');
  13995. var perform = require('../internals/perform');
  13996. var InternalStateModule = require('../internals/internal-state');
  13997. var isForced = require('../internals/is-forced');
  13998. var wellKnownSymbol = require('../internals/well-known-symbol');
  13999. var IS_BROWSER = require('../internals/engine-is-browser');
  14000. var IS_NODE = require('../internals/engine-is-node');
  14001. var V8_VERSION = require('../internals/engine-v8-version');
  14002. var SPECIES = wellKnownSymbol('species');
  14003. var PROMISE = 'Promise';
  14004. var getInternalState = InternalStateModule.get;
  14005. var setInternalState = InternalStateModule.set;
  14006. var getInternalPromiseState = InternalStateModule.getterFor(PROMISE);
  14007. var NativePromisePrototype = NativePromise && NativePromise.prototype;
  14008. var PromiseConstructor = NativePromise;
  14009. var PromiseConstructorPrototype = NativePromisePrototype;
  14010. var TypeError = global.TypeError;
  14011. var document = global.document;
  14012. var process = global.process;
  14013. var newPromiseCapability = newPromiseCapabilityModule.f;
  14014. var newGenericPromiseCapability = newPromiseCapability;
  14015. var DISPATCH_EVENT = !!(document && document.createEvent && global.dispatchEvent);
  14016. var NATIVE_REJECTION_EVENT = typeof PromiseRejectionEvent == 'function';
  14017. var UNHANDLED_REJECTION = 'unhandledrejection';
  14018. var REJECTION_HANDLED = 'rejectionhandled';
  14019. var PENDING = 0;
  14020. var FULFILLED = 1;
  14021. var REJECTED = 2;
  14022. var HANDLED = 1;
  14023. var UNHANDLED = 2;
  14024. var SUBCLASSING = false;
  14025. var Internal, OwnPromiseCapability, PromiseWrapper, nativeThen;
  14026. var FORCED = isForced(PROMISE, function () {
  14027. var PROMISE_CONSTRUCTOR_SOURCE = inspectSource(PromiseConstructor);
  14028. var GLOBAL_CORE_JS_PROMISE = PROMISE_CONSTRUCTOR_SOURCE !== String(PromiseConstructor);
  14029. // V8 6.6 (Node 10 and Chrome 66) have a bug with resolving custom thenables
  14030. // https://bugs.chromium.org/p/chromium/issues/detail?id=830565
  14031. // We can't detect it synchronously, so just check versions
  14032. if (!GLOBAL_CORE_JS_PROMISE && V8_VERSION === 66) return true;
  14033. // We need Promise#finally in the pure version for preventing prototype pollution
  14034. if (IS_PURE && !PromiseConstructorPrototype['finally']) return true;
  14035. // We can't use @@species feature detection in V8 since it causes
  14036. // deoptimization and performance degradation
  14037. // https://github.com/zloirock/core-js/issues/679
  14038. if (V8_VERSION >= 51 && /native code/.test(PROMISE_CONSTRUCTOR_SOURCE)) return false;
  14039. // Detect correctness of subclassing with @@species support
  14040. var promise = new PromiseConstructor(function (resolve) { resolve(1); });
  14041. var FakePromise = function (exec) {
  14042. exec(function () { /* empty */ }, function () { /* empty */ });
  14043. };
  14044. var constructor = promise.constructor = {};
  14045. constructor[SPECIES] = FakePromise;
  14046. SUBCLASSING = promise.then(function () { /* empty */ }) instanceof FakePromise;
  14047. if (!SUBCLASSING) return true;
  14048. // Unhandled rejections tracking support, NodeJS Promise without it fails @@species test
  14049. return !GLOBAL_CORE_JS_PROMISE && IS_BROWSER && !NATIVE_REJECTION_EVENT;
  14050. });
  14051. var INCORRECT_ITERATION = FORCED || !checkCorrectnessOfIteration(function (iterable) {
  14052. PromiseConstructor.all(iterable)['catch'](function () { /* empty */ });
  14053. });
  14054. // helpers
  14055. var isThenable = function (it) {
  14056. var then;
  14057. return isObject(it) && typeof (then = it.then) == 'function' ? then : false;
  14058. };
  14059. var notify = function (state, isReject) {
  14060. if (state.notified) return;
  14061. state.notified = true;
  14062. var chain = state.reactions;
  14063. microtask(function () {
  14064. var value = state.value;
  14065. var ok = state.state == FULFILLED;
  14066. var index = 0;
  14067. // variable length - can't use forEach
  14068. while (chain.length > index) {
  14069. var reaction = chain[index++];
  14070. var handler = ok ? reaction.ok : reaction.fail;
  14071. var resolve = reaction.resolve;
  14072. var reject = reaction.reject;
  14073. var domain = reaction.domain;
  14074. var result, then, exited;
  14075. try {
  14076. if (handler) {
  14077. if (!ok) {
  14078. if (state.rejection === UNHANDLED) onHandleUnhandled(state);
  14079. state.rejection = HANDLED;
  14080. }
  14081. if (handler === true) result = value;
  14082. else {
  14083. if (domain) domain.enter();
  14084. result = handler(value); // can throw
  14085. if (domain) {
  14086. domain.exit();
  14087. exited = true;
  14088. }
  14089. }
  14090. if (result === reaction.promise) {
  14091. reject(TypeError('Promise-chain cycle'));
  14092. } else if (then = isThenable(result)) {
  14093. then.call(result, resolve, reject);
  14094. } else resolve(result);
  14095. } else reject(value);
  14096. } catch (error) {
  14097. if (domain && !exited) domain.exit();
  14098. reject(error);
  14099. }
  14100. }
  14101. state.reactions = [];
  14102. state.notified = false;
  14103. if (isReject && !state.rejection) onUnhandled(state);
  14104. });
  14105. };
  14106. var dispatchEvent = function (name, promise, reason) {
  14107. var event, handler;
  14108. if (DISPATCH_EVENT) {
  14109. event = document.createEvent('Event');
  14110. event.promise = promise;
  14111. event.reason = reason;
  14112. event.initEvent(name, false, true);
  14113. global.dispatchEvent(event);
  14114. } else event = { promise: promise, reason: reason };
  14115. if (!NATIVE_REJECTION_EVENT && (handler = global['on' + name])) handler(event);
  14116. else if (name === UNHANDLED_REJECTION) hostReportErrors('Unhandled promise rejection', reason);
  14117. };
  14118. var onUnhandled = function (state) {
  14119. task.call(global, function () {
  14120. var promise = state.facade;
  14121. var value = state.value;
  14122. var IS_UNHANDLED = isUnhandled(state);
  14123. var result;
  14124. if (IS_UNHANDLED) {
  14125. result = perform(function () {
  14126. if (IS_NODE) {
  14127. process.emit('unhandledRejection', value, promise);
  14128. } else dispatchEvent(UNHANDLED_REJECTION, promise, value);
  14129. });
  14130. // Browsers should not trigger `rejectionHandled` event if it was handled here, NodeJS - should
  14131. state.rejection = IS_NODE || isUnhandled(state) ? UNHANDLED : HANDLED;
  14132. if (result.error) throw result.value;
  14133. }
  14134. });
  14135. };
  14136. var isUnhandled = function (state) {
  14137. return state.rejection !== HANDLED && !state.parent;
  14138. };
  14139. var onHandleUnhandled = function (state) {
  14140. task.call(global, function () {
  14141. var promise = state.facade;
  14142. if (IS_NODE) {
  14143. process.emit('rejectionHandled', promise);
  14144. } else dispatchEvent(REJECTION_HANDLED, promise, state.value);
  14145. });
  14146. };
  14147. var bind = function (fn, state, unwrap) {
  14148. return function (value) {
  14149. fn(state, value, unwrap);
  14150. };
  14151. };
  14152. var internalReject = function (state, value, unwrap) {
  14153. if (state.done) return;
  14154. state.done = true;
  14155. if (unwrap) state = unwrap;
  14156. state.value = value;
  14157. state.state = REJECTED;
  14158. notify(state, true);
  14159. };
  14160. var internalResolve = function (state, value, unwrap) {
  14161. if (state.done) return;
  14162. state.done = true;
  14163. if (unwrap) state = unwrap;
  14164. try {
  14165. if (state.facade === value) throw TypeError("Promise can't be resolved itself");
  14166. var then = isThenable(value);
  14167. if (then) {
  14168. microtask(function () {
  14169. var wrapper = { done: false };
  14170. try {
  14171. then.call(value,
  14172. bind(internalResolve, wrapper, state),
  14173. bind(internalReject, wrapper, state)
  14174. );
  14175. } catch (error) {
  14176. internalReject(wrapper, error, state);
  14177. }
  14178. });
  14179. } else {
  14180. state.value = value;
  14181. state.state = FULFILLED;
  14182. notify(state, false);
  14183. }
  14184. } catch (error) {
  14185. internalReject({ done: false }, error, state);
  14186. }
  14187. };
  14188. // constructor polyfill
  14189. if (FORCED) {
  14190. // 25.4.3.1 Promise(executor)
  14191. PromiseConstructor = function Promise(executor) {
  14192. anInstance(this, PromiseConstructor, PROMISE);
  14193. aFunction(executor);
  14194. Internal.call(this);
  14195. var state = getInternalState(this);
  14196. try {
  14197. executor(bind(internalResolve, state), bind(internalReject, state));
  14198. } catch (error) {
  14199. internalReject(state, error);
  14200. }
  14201. };
  14202. PromiseConstructorPrototype = PromiseConstructor.prototype;
  14203. // eslint-disable-next-line no-unused-vars -- required for `.length`
  14204. Internal = function Promise(executor) {
  14205. setInternalState(this, {
  14206. type: PROMISE,
  14207. done: false,
  14208. notified: false,
  14209. parent: false,
  14210. reactions: [],
  14211. rejection: false,
  14212. state: PENDING,
  14213. value: undefined
  14214. });
  14215. };
  14216. Internal.prototype = redefineAll(PromiseConstructorPrototype, {
  14217. // `Promise.prototype.then` method
  14218. // https://tc39.es/ecma262/#sec-promise.prototype.then
  14219. then: function then(onFulfilled, onRejected) {
  14220. var state = getInternalPromiseState(this);
  14221. var reaction = newPromiseCapability(speciesConstructor(this, PromiseConstructor));
  14222. reaction.ok = typeof onFulfilled == 'function' ? onFulfilled : true;
  14223. reaction.fail = typeof onRejected == 'function' && onRejected;
  14224. reaction.domain = IS_NODE ? process.domain : undefined;
  14225. state.parent = true;
  14226. state.reactions.push(reaction);
  14227. if (state.state != PENDING) notify(state, false);
  14228. return reaction.promise;
  14229. },
  14230. // `Promise.prototype.catch` method
  14231. // https://tc39.es/ecma262/#sec-promise.prototype.catch
  14232. 'catch': function (onRejected) {
  14233. return this.then(undefined, onRejected);
  14234. }
  14235. });
  14236. OwnPromiseCapability = function () {
  14237. var promise = new Internal();
  14238. var state = getInternalState(promise);
  14239. this.promise = promise;
  14240. this.resolve = bind(internalResolve, state);
  14241. this.reject = bind(internalReject, state);
  14242. };
  14243. newPromiseCapabilityModule.f = newPromiseCapability = function (C) {
  14244. return C === PromiseConstructor || C === PromiseWrapper
  14245. ? new OwnPromiseCapability(C)
  14246. : newGenericPromiseCapability(C);
  14247. };
  14248. if (!IS_PURE && typeof NativePromise == 'function' && NativePromisePrototype !== Object.prototype) {
  14249. nativeThen = NativePromisePrototype.then;
  14250. if (!SUBCLASSING) {
  14251. // make `Promise#then` return a polyfilled `Promise` for native promise-based APIs
  14252. redefine(NativePromisePrototype, 'then', function then(onFulfilled, onRejected) {
  14253. var that = this;
  14254. return new PromiseConstructor(function (resolve, reject) {
  14255. nativeThen.call(that, resolve, reject);
  14256. }).then(onFulfilled, onRejected);
  14257. // https://github.com/zloirock/core-js/issues/640
  14258. }, { unsafe: true });
  14259. // makes sure that native promise-based APIs `Promise#catch` properly works with patched `Promise#then`
  14260. redefine(NativePromisePrototype, 'catch', PromiseConstructorPrototype['catch'], { unsafe: true });
  14261. }
  14262. // make `.constructor === Promise` work for native promise-based APIs
  14263. try {
  14264. delete NativePromisePrototype.constructor;
  14265. } catch (error) { /* empty */ }
  14266. // make `instanceof Promise` work for native promise-based APIs
  14267. if (setPrototypeOf) {
  14268. setPrototypeOf(NativePromisePrototype, PromiseConstructorPrototype);
  14269. }
  14270. }
  14271. }
  14272. $({ global: true, wrap: true, forced: FORCED }, {
  14273. Promise: PromiseConstructor
  14274. });
  14275. setToStringTag(PromiseConstructor, PROMISE, false, true);
  14276. setSpecies(PROMISE);
  14277. PromiseWrapper = getBuiltIn(PROMISE);
  14278. // statics
  14279. $({ target: PROMISE, stat: true, forced: FORCED }, {
  14280. // `Promise.reject` method
  14281. // https://tc39.es/ecma262/#sec-promise.reject
  14282. reject: function reject(r) {
  14283. var capability = newPromiseCapability(this);
  14284. capability.reject.call(undefined, r);
  14285. return capability.promise;
  14286. }
  14287. });
  14288. $({ target: PROMISE, stat: true, forced: IS_PURE || FORCED }, {
  14289. // `Promise.resolve` method
  14290. // https://tc39.es/ecma262/#sec-promise.resolve
  14291. resolve: function resolve(x) {
  14292. return promiseResolve(IS_PURE && this === PromiseWrapper ? PromiseConstructor : this, x);
  14293. }
  14294. });
  14295. $({ target: PROMISE, stat: true, forced: INCORRECT_ITERATION }, {
  14296. // `Promise.all` method
  14297. // https://tc39.es/ecma262/#sec-promise.all
  14298. all: function all(iterable) {
  14299. var C = this;
  14300. var capability = newPromiseCapability(C);
  14301. var resolve = capability.resolve;
  14302. var reject = capability.reject;
  14303. var result = perform(function () {
  14304. var $promiseResolve = aFunction(C.resolve);
  14305. var values = [];
  14306. var counter = 0;
  14307. var remaining = 1;
  14308. iterate(iterable, function (promise) {
  14309. var index = counter++;
  14310. var alreadyCalled = false;
  14311. values.push(undefined);
  14312. remaining++;
  14313. $promiseResolve.call(C, promise).then(function (value) {
  14314. if (alreadyCalled) return;
  14315. alreadyCalled = true;
  14316. values[index] = value;
  14317. --remaining || resolve(values);
  14318. }, reject);
  14319. });
  14320. --remaining || resolve(values);
  14321. });
  14322. if (result.error) reject(result.value);
  14323. return capability.promise;
  14324. },
  14325. // `Promise.race` method
  14326. // https://tc39.es/ecma262/#sec-promise.race
  14327. race: function race(iterable) {
  14328. var C = this;
  14329. var capability = newPromiseCapability(C);
  14330. var reject = capability.reject;
  14331. var result = perform(function () {
  14332. var $promiseResolve = aFunction(C.resolve);
  14333. iterate(iterable, function (promise) {
  14334. $promiseResolve.call(C, promise).then(capability.resolve, reject);
  14335. });
  14336. });
  14337. if (result.error) reject(result.value);
  14338. return capability.promise;
  14339. }
  14340. });
  14341. },{"../internals/a-function":89,"../internals/an-instance":93,"../internals/check-correctness-of-iteration":113,"../internals/engine-is-browser":129,"../internals/engine-is-node":133,"../internals/engine-v8-version":136,"../internals/export":139,"../internals/get-built-in":143,"../internals/global":147,"../internals/host-report-errors":150,"../internals/inspect-source":156,"../internals/internal-state":157,"../internals/is-forced":160,"../internals/is-object":162,"../internals/is-pure":163,"../internals/iterate":166,"../internals/microtask":170,"../internals/native-promise-constructor":171,"../internals/new-promise-capability":174,"../internals/object-set-prototype-of":188,"../internals/perform":194,"../internals/promise-resolve":195,"../internals/redefine":197,"../internals/redefine-all":196,"../internals/set-species":207,"../internals/set-to-string-tag":208,"../internals/species-constructor":212,"../internals/task":216,"../internals/well-known-symbol":237}],260:[function(require,module,exports){
  14342. var DESCRIPTORS = require('../internals/descriptors');
  14343. var global = require('../internals/global');
  14344. var isForced = require('../internals/is-forced');
  14345. var inheritIfRequired = require('../internals/inherit-if-required');
  14346. var createNonEnumerableProperty = require('../internals/create-non-enumerable-property');
  14347. var defineProperty = require('../internals/object-define-property').f;
  14348. var getOwnPropertyNames = require('../internals/object-get-own-property-names').f;
  14349. var isRegExp = require('../internals/is-regexp');
  14350. var toString = require('../internals/to-string');
  14351. var getFlags = require('../internals/regexp-flags');
  14352. var stickyHelpers = require('../internals/regexp-sticky-helpers');
  14353. var redefine = require('../internals/redefine');
  14354. var fails = require('../internals/fails');
  14355. var has = require('../internals/has');
  14356. var enforceInternalState = require('../internals/internal-state').enforce;
  14357. var setSpecies = require('../internals/set-species');
  14358. var wellKnownSymbol = require('../internals/well-known-symbol');
  14359. var UNSUPPORTED_DOT_ALL = require('../internals/regexp-unsupported-dot-all');
  14360. var UNSUPPORTED_NCG = require('../internals/regexp-unsupported-ncg');
  14361. var MATCH = wellKnownSymbol('match');
  14362. var NativeRegExp = global.RegExp;
  14363. var RegExpPrototype = NativeRegExp.prototype;
  14364. // TODO: Use only propper RegExpIdentifierName
  14365. var IS_NCG = /^\?<[^\s\d!#%&*+<=>@^][^\s!#%&*+<=>@^]*>/;
  14366. var re1 = /a/g;
  14367. var re2 = /a/g;
  14368. // "new" should create a new object, old webkit bug
  14369. var CORRECT_NEW = new NativeRegExp(re1) !== re1;
  14370. var UNSUPPORTED_Y = stickyHelpers.UNSUPPORTED_Y;
  14371. var BASE_FORCED = DESCRIPTORS &&
  14372. (!CORRECT_NEW || UNSUPPORTED_Y || UNSUPPORTED_DOT_ALL || UNSUPPORTED_NCG || fails(function () {
  14373. re2[MATCH] = false;
  14374. // RegExp constructor can alter flags and IsRegExp works correct with @@match
  14375. return NativeRegExp(re1) != re1 || NativeRegExp(re2) == re2 || NativeRegExp(re1, 'i') != '/a/i';
  14376. }));
  14377. var handleDotAll = function (string) {
  14378. var length = string.length;
  14379. var index = 0;
  14380. var result = '';
  14381. var brackets = false;
  14382. var chr;
  14383. for (; index <= length; index++) {
  14384. chr = string.charAt(index);
  14385. if (chr === '\\') {
  14386. result += chr + string.charAt(++index);
  14387. continue;
  14388. }
  14389. if (!brackets && chr === '.') {
  14390. result += '[\\s\\S]';
  14391. } else {
  14392. if (chr === '[') {
  14393. brackets = true;
  14394. } else if (chr === ']') {
  14395. brackets = false;
  14396. } result += chr;
  14397. }
  14398. } return result;
  14399. };
  14400. var handleNCG = function (string) {
  14401. var length = string.length;
  14402. var index = 0;
  14403. var result = '';
  14404. var named = [];
  14405. var names = {};
  14406. var brackets = false;
  14407. var ncg = false;
  14408. var groupid = 0;
  14409. var groupname = '';
  14410. var chr;
  14411. for (; index <= length; index++) {
  14412. chr = string.charAt(index);
  14413. if (chr === '\\') {
  14414. chr = chr + string.charAt(++index);
  14415. } else if (chr === ']') {
  14416. brackets = false;
  14417. } else if (!brackets) switch (true) {
  14418. case chr === '[':
  14419. brackets = true;
  14420. break;
  14421. case chr === '(':
  14422. if (IS_NCG.test(string.slice(index + 1))) {
  14423. index += 2;
  14424. ncg = true;
  14425. }
  14426. result += chr;
  14427. groupid++;
  14428. continue;
  14429. case chr === '>' && ncg:
  14430. if (groupname === '' || has(names, groupname)) {
  14431. throw new SyntaxError('Invalid capture group name');
  14432. }
  14433. names[groupname] = true;
  14434. named.push([groupname, groupid]);
  14435. ncg = false;
  14436. groupname = '';
  14437. continue;
  14438. }
  14439. if (ncg) groupname += chr;
  14440. else result += chr;
  14441. } return [result, named];
  14442. };
  14443. // `RegExp` constructor
  14444. // https://tc39.es/ecma262/#sec-regexp-constructor
  14445. if (isForced('RegExp', BASE_FORCED)) {
  14446. var RegExpWrapper = function RegExp(pattern, flags) {
  14447. var thisIsRegExp = this instanceof RegExpWrapper;
  14448. var patternIsRegExp = isRegExp(pattern);
  14449. var flagsAreUndefined = flags === undefined;
  14450. var groups = [];
  14451. var rawPattern = pattern;
  14452. var rawFlags, dotAll, sticky, handled, result, state;
  14453. if (!thisIsRegExp && patternIsRegExp && flagsAreUndefined && pattern.constructor === RegExpWrapper) {
  14454. return pattern;
  14455. }
  14456. if (patternIsRegExp || pattern instanceof RegExpWrapper) {
  14457. pattern = pattern.source;
  14458. if (flagsAreUndefined) flags = 'flags' in rawPattern ? rawPattern.flags : getFlags.call(rawPattern);
  14459. }
  14460. pattern = pattern === undefined ? '' : toString(pattern);
  14461. flags = flags === undefined ? '' : toString(flags);
  14462. rawPattern = pattern;
  14463. if (UNSUPPORTED_DOT_ALL && 'dotAll' in re1) {
  14464. dotAll = !!flags && flags.indexOf('s') > -1;
  14465. if (dotAll) flags = flags.replace(/s/g, '');
  14466. }
  14467. rawFlags = flags;
  14468. if (UNSUPPORTED_Y && 'sticky' in re1) {
  14469. sticky = !!flags && flags.indexOf('y') > -1;
  14470. if (sticky) flags = flags.replace(/y/g, '');
  14471. }
  14472. if (UNSUPPORTED_NCG) {
  14473. handled = handleNCG(pattern);
  14474. pattern = handled[0];
  14475. groups = handled[1];
  14476. }
  14477. result = inheritIfRequired(NativeRegExp(pattern, flags), thisIsRegExp ? this : RegExpPrototype, RegExpWrapper);
  14478. if (dotAll || sticky || groups.length) {
  14479. state = enforceInternalState(result);
  14480. if (dotAll) {
  14481. state.dotAll = true;
  14482. state.raw = RegExpWrapper(handleDotAll(pattern), rawFlags);
  14483. }
  14484. if (sticky) state.sticky = true;
  14485. if (groups.length) state.groups = groups;
  14486. }
  14487. if (pattern !== rawPattern) try {
  14488. // fails in old engines, but we have no alternatives for unsupported regex syntax
  14489. createNonEnumerableProperty(result, 'source', rawPattern === '' ? '(?:)' : rawPattern);
  14490. } catch (error) { /* empty */ }
  14491. return result;
  14492. };
  14493. var proxy = function (key) {
  14494. key in RegExpWrapper || defineProperty(RegExpWrapper, key, {
  14495. configurable: true,
  14496. get: function () { return NativeRegExp[key]; },
  14497. set: function (it) { NativeRegExp[key] = it; }
  14498. });
  14499. };
  14500. for (var keys = getOwnPropertyNames(NativeRegExp), index = 0; keys.length > index;) {
  14501. proxy(keys[index++]);
  14502. }
  14503. RegExpPrototype.constructor = RegExpWrapper;
  14504. RegExpWrapper.prototype = RegExpPrototype;
  14505. redefine(global, 'RegExp', RegExpWrapper);
  14506. }
  14507. // https://tc39.es/ecma262/#sec-get-regexp-@@species
  14508. setSpecies('RegExp');
  14509. },{"../internals/create-non-enumerable-property":120,"../internals/descriptors":125,"../internals/fails":140,"../internals/global":147,"../internals/has":148,"../internals/inherit-if-required":155,"../internals/internal-state":157,"../internals/is-forced":160,"../internals/is-regexp":164,"../internals/object-define-property":179,"../internals/object-get-own-property-names":182,"../internals/redefine":197,"../internals/regexp-flags":200,"../internals/regexp-sticky-helpers":201,"../internals/regexp-unsupported-dot-all":202,"../internals/regexp-unsupported-ncg":203,"../internals/set-species":207,"../internals/to-string":228,"../internals/well-known-symbol":237}],261:[function(require,module,exports){
  14510. 'use strict';
  14511. var $ = require('../internals/export');
  14512. var exec = require('../internals/regexp-exec');
  14513. // `RegExp.prototype.exec` method
  14514. // https://tc39.es/ecma262/#sec-regexp.prototype.exec
  14515. $({ target: 'RegExp', proto: true, forced: /./.exec !== exec }, {
  14516. exec: exec
  14517. });
  14518. },{"../internals/export":139,"../internals/regexp-exec":199}],262:[function(require,module,exports){
  14519. 'use strict';
  14520. var redefine = require('../internals/redefine');
  14521. var anObject = require('../internals/an-object');
  14522. var $toString = require('../internals/to-string');
  14523. var fails = require('../internals/fails');
  14524. var flags = require('../internals/regexp-flags');
  14525. var TO_STRING = 'toString';
  14526. var RegExpPrototype = RegExp.prototype;
  14527. var nativeToString = RegExpPrototype[TO_STRING];
  14528. var NOT_GENERIC = fails(function () { return nativeToString.call({ source: 'a', flags: 'b' }) != '/a/b'; });
  14529. // FF44- RegExp#toString has a wrong name
  14530. var INCORRECT_NAME = nativeToString.name != TO_STRING;
  14531. // `RegExp.prototype.toString` method
  14532. // https://tc39.es/ecma262/#sec-regexp.prototype.tostring
  14533. if (NOT_GENERIC || INCORRECT_NAME) {
  14534. redefine(RegExp.prototype, TO_STRING, function toString() {
  14535. var R = anObject(this);
  14536. var p = $toString(R.source);
  14537. var rf = R.flags;
  14538. var f = $toString(rf === undefined && R instanceof RegExp && !('flags' in RegExpPrototype) ? flags.call(R) : rf);
  14539. return '/' + p + '/' + f;
  14540. }, { unsafe: true });
  14541. }
  14542. },{"../internals/an-object":94,"../internals/fails":140,"../internals/redefine":197,"../internals/regexp-flags":200,"../internals/to-string":228}],263:[function(require,module,exports){
  14543. 'use strict';
  14544. var $ = require('../internals/export');
  14545. var notARegExp = require('../internals/not-a-regexp');
  14546. var requireObjectCoercible = require('../internals/require-object-coercible');
  14547. var toString = require('../internals/to-string');
  14548. var correctIsRegExpLogic = require('../internals/correct-is-regexp-logic');
  14549. // `String.prototype.includes` method
  14550. // https://tc39.es/ecma262/#sec-string.prototype.includes
  14551. $({ target: 'String', proto: true, forced: !correctIsRegExpLogic('includes') }, {
  14552. includes: function includes(searchString /* , position = 0 */) {
  14553. return !!~toString(requireObjectCoercible(this))
  14554. .indexOf(toString(notARegExp(searchString)), arguments.length > 1 ? arguments[1] : undefined);
  14555. }
  14556. });
  14557. },{"../internals/correct-is-regexp-logic":117,"../internals/export":139,"../internals/not-a-regexp":175,"../internals/require-object-coercible":204,"../internals/to-string":228}],264:[function(require,module,exports){
  14558. 'use strict';
  14559. var charAt = require('../internals/string-multibyte').charAt;
  14560. var toString = require('../internals/to-string');
  14561. var InternalStateModule = require('../internals/internal-state');
  14562. var defineIterator = require('../internals/define-iterator');
  14563. var STRING_ITERATOR = 'String Iterator';
  14564. var setInternalState = InternalStateModule.set;
  14565. var getInternalState = InternalStateModule.getterFor(STRING_ITERATOR);
  14566. // `String.prototype[@@iterator]` method
  14567. // https://tc39.es/ecma262/#sec-string.prototype-@@iterator
  14568. defineIterator(String, 'String', function (iterated) {
  14569. setInternalState(this, {
  14570. type: STRING_ITERATOR,
  14571. string: toString(iterated),
  14572. index: 0
  14573. });
  14574. // `%StringIteratorPrototype%.next` method
  14575. // https://tc39.es/ecma262/#sec-%stringiteratorprototype%.next
  14576. }, function next() {
  14577. var state = getInternalState(this);
  14578. var string = state.string;
  14579. var index = state.index;
  14580. var point;
  14581. if (index >= string.length) return { value: undefined, done: true };
  14582. point = charAt(string, index);
  14583. state.index += point.length;
  14584. return { value: point, done: false };
  14585. });
  14586. },{"../internals/define-iterator":123,"../internals/internal-state":157,"../internals/string-multibyte":213,"../internals/to-string":228}],265:[function(require,module,exports){
  14587. 'use strict';
  14588. var fixRegExpWellKnownSymbolLogic = require('../internals/fix-regexp-well-known-symbol-logic');
  14589. var anObject = require('../internals/an-object');
  14590. var toLength = require('../internals/to-length');
  14591. var toString = require('../internals/to-string');
  14592. var requireObjectCoercible = require('../internals/require-object-coercible');
  14593. var advanceStringIndex = require('../internals/advance-string-index');
  14594. var regExpExec = require('../internals/regexp-exec-abstract');
  14595. // @@match logic
  14596. fixRegExpWellKnownSymbolLogic('match', function (MATCH, nativeMatch, maybeCallNative) {
  14597. return [
  14598. // `String.prototype.match` method
  14599. // https://tc39.es/ecma262/#sec-string.prototype.match
  14600. function match(regexp) {
  14601. var O = requireObjectCoercible(this);
  14602. var matcher = regexp == undefined ? undefined : regexp[MATCH];
  14603. return matcher !== undefined ? matcher.call(regexp, O) : new RegExp(regexp)[MATCH](toString(O));
  14604. },
  14605. // `RegExp.prototype[@@match]` method
  14606. // https://tc39.es/ecma262/#sec-regexp.prototype-@@match
  14607. function (string) {
  14608. var rx = anObject(this);
  14609. var S = toString(string);
  14610. var res = maybeCallNative(nativeMatch, rx, S);
  14611. if (res.done) return res.value;
  14612. if (!rx.global) return regExpExec(rx, S);
  14613. var fullUnicode = rx.unicode;
  14614. rx.lastIndex = 0;
  14615. var A = [];
  14616. var n = 0;
  14617. var result;
  14618. while ((result = regExpExec(rx, S)) !== null) {
  14619. var matchStr = toString(result[0]);
  14620. A[n] = matchStr;
  14621. if (matchStr === '') rx.lastIndex = advanceStringIndex(S, toLength(rx.lastIndex), fullUnicode);
  14622. n++;
  14623. }
  14624. return n === 0 ? null : A;
  14625. }
  14626. ];
  14627. });
  14628. },{"../internals/advance-string-index":92,"../internals/an-object":94,"../internals/fix-regexp-well-known-symbol-logic":141,"../internals/regexp-exec-abstract":198,"../internals/require-object-coercible":204,"../internals/to-length":221,"../internals/to-string":228}],266:[function(require,module,exports){
  14629. 'use strict';
  14630. var fixRegExpWellKnownSymbolLogic = require('../internals/fix-regexp-well-known-symbol-logic');
  14631. var fails = require('../internals/fails');
  14632. var anObject = require('../internals/an-object');
  14633. var toInteger = require('../internals/to-integer');
  14634. var toLength = require('../internals/to-length');
  14635. var toString = require('../internals/to-string');
  14636. var requireObjectCoercible = require('../internals/require-object-coercible');
  14637. var advanceStringIndex = require('../internals/advance-string-index');
  14638. var getSubstitution = require('../internals/get-substitution');
  14639. var regExpExec = require('../internals/regexp-exec-abstract');
  14640. var wellKnownSymbol = require('../internals/well-known-symbol');
  14641. var REPLACE = wellKnownSymbol('replace');
  14642. var max = Math.max;
  14643. var min = Math.min;
  14644. var maybeToString = function (it) {
  14645. return it === undefined ? it : String(it);
  14646. };
  14647. // IE <= 11 replaces $0 with the whole match, as if it was $&
  14648. // https://stackoverflow.com/questions/6024666/getting-ie-to-replace-a-regex-with-the-literal-string-0
  14649. var REPLACE_KEEPS_$0 = (function () {
  14650. // eslint-disable-next-line regexp/prefer-escape-replacement-dollar-char -- required for testing
  14651. return 'a'.replace(/./, '$0') === '$0';
  14652. })();
  14653. // Safari <= 13.0.3(?) substitutes nth capture where n>m with an empty string
  14654. var REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE = (function () {
  14655. if (/./[REPLACE]) {
  14656. return /./[REPLACE]('a', '$0') === '';
  14657. }
  14658. return false;
  14659. })();
  14660. var REPLACE_SUPPORTS_NAMED_GROUPS = !fails(function () {
  14661. var re = /./;
  14662. re.exec = function () {
  14663. var result = [];
  14664. result.groups = { a: '7' };
  14665. return result;
  14666. };
  14667. // eslint-disable-next-line regexp/no-useless-dollar-replacements -- false positive
  14668. return ''.replace(re, '$<a>') !== '7';
  14669. });
  14670. // @@replace logic
  14671. fixRegExpWellKnownSymbolLogic('replace', function (_, nativeReplace, maybeCallNative) {
  14672. var UNSAFE_SUBSTITUTE = REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE ? '$' : '$0';
  14673. return [
  14674. // `String.prototype.replace` method
  14675. // https://tc39.es/ecma262/#sec-string.prototype.replace
  14676. function replace(searchValue, replaceValue) {
  14677. var O = requireObjectCoercible(this);
  14678. var replacer = searchValue == undefined ? undefined : searchValue[REPLACE];
  14679. return replacer !== undefined
  14680. ? replacer.call(searchValue, O, replaceValue)
  14681. : nativeReplace.call(toString(O), searchValue, replaceValue);
  14682. },
  14683. // `RegExp.prototype[@@replace]` method
  14684. // https://tc39.es/ecma262/#sec-regexp.prototype-@@replace
  14685. function (string, replaceValue) {
  14686. var rx = anObject(this);
  14687. var S = toString(string);
  14688. if (
  14689. typeof replaceValue === 'string' &&
  14690. replaceValue.indexOf(UNSAFE_SUBSTITUTE) === -1 &&
  14691. replaceValue.indexOf('$<') === -1
  14692. ) {
  14693. var res = maybeCallNative(nativeReplace, rx, S, replaceValue);
  14694. if (res.done) return res.value;
  14695. }
  14696. var functionalReplace = typeof replaceValue === 'function';
  14697. if (!functionalReplace) replaceValue = toString(replaceValue);
  14698. var global = rx.global;
  14699. if (global) {
  14700. var fullUnicode = rx.unicode;
  14701. rx.lastIndex = 0;
  14702. }
  14703. var results = [];
  14704. while (true) {
  14705. var result = regExpExec(rx, S);
  14706. if (result === null) break;
  14707. results.push(result);
  14708. if (!global) break;
  14709. var matchStr = toString(result[0]);
  14710. if (matchStr === '') rx.lastIndex = advanceStringIndex(S, toLength(rx.lastIndex), fullUnicode);
  14711. }
  14712. var accumulatedResult = '';
  14713. var nextSourcePosition = 0;
  14714. for (var i = 0; i < results.length; i++) {
  14715. result = results[i];
  14716. var matched = toString(result[0]);
  14717. var position = max(min(toInteger(result.index), S.length), 0);
  14718. var captures = [];
  14719. // NOTE: This is equivalent to
  14720. // captures = result.slice(1).map(maybeToString)
  14721. // but for some reason `nativeSlice.call(result, 1, result.length)` (called in
  14722. // the slice polyfill when slicing native arrays) "doesn't work" in safari 9 and
  14723. // causes a crash (https://pastebin.com/N21QzeQA) when trying to debug it.
  14724. for (var j = 1; j < result.length; j++) captures.push(maybeToString(result[j]));
  14725. var namedCaptures = result.groups;
  14726. if (functionalReplace) {
  14727. var replacerArgs = [matched].concat(captures, position, S);
  14728. if (namedCaptures !== undefined) replacerArgs.push(namedCaptures);
  14729. var replacement = toString(replaceValue.apply(undefined, replacerArgs));
  14730. } else {
  14731. replacement = getSubstitution(matched, S, position, captures, namedCaptures, replaceValue);
  14732. }
  14733. if (position >= nextSourcePosition) {
  14734. accumulatedResult += S.slice(nextSourcePosition, position) + replacement;
  14735. nextSourcePosition = position + matched.length;
  14736. }
  14737. }
  14738. return accumulatedResult + S.slice(nextSourcePosition);
  14739. }
  14740. ];
  14741. }, !REPLACE_SUPPORTS_NAMED_GROUPS || !REPLACE_KEEPS_$0 || REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE);
  14742. },{"../internals/advance-string-index":92,"../internals/an-object":94,"../internals/fails":140,"../internals/fix-regexp-well-known-symbol-logic":141,"../internals/get-substitution":146,"../internals/regexp-exec-abstract":198,"../internals/require-object-coercible":204,"../internals/to-integer":220,"../internals/to-length":221,"../internals/to-string":228,"../internals/well-known-symbol":237}],267:[function(require,module,exports){
  14743. 'use strict';
  14744. var fixRegExpWellKnownSymbolLogic = require('../internals/fix-regexp-well-known-symbol-logic');
  14745. var anObject = require('../internals/an-object');
  14746. var requireObjectCoercible = require('../internals/require-object-coercible');
  14747. var sameValue = require('../internals/same-value');
  14748. var toString = require('../internals/to-string');
  14749. var regExpExec = require('../internals/regexp-exec-abstract');
  14750. // @@search logic
  14751. fixRegExpWellKnownSymbolLogic('search', function (SEARCH, nativeSearch, maybeCallNative) {
  14752. return [
  14753. // `String.prototype.search` method
  14754. // https://tc39.es/ecma262/#sec-string.prototype.search
  14755. function search(regexp) {
  14756. var O = requireObjectCoercible(this);
  14757. var searcher = regexp == undefined ? undefined : regexp[SEARCH];
  14758. return searcher !== undefined ? searcher.call(regexp, O) : new RegExp(regexp)[SEARCH](toString(O));
  14759. },
  14760. // `RegExp.prototype[@@search]` method
  14761. // https://tc39.es/ecma262/#sec-regexp.prototype-@@search
  14762. function (string) {
  14763. var rx = anObject(this);
  14764. var S = toString(string);
  14765. var res = maybeCallNative(nativeSearch, rx, S);
  14766. if (res.done) return res.value;
  14767. var previousLastIndex = rx.lastIndex;
  14768. if (!sameValue(previousLastIndex, 0)) rx.lastIndex = 0;
  14769. var result = regExpExec(rx, S);
  14770. if (!sameValue(rx.lastIndex, previousLastIndex)) rx.lastIndex = previousLastIndex;
  14771. return result === null ? -1 : result.index;
  14772. }
  14773. ];
  14774. });
  14775. },{"../internals/an-object":94,"../internals/fix-regexp-well-known-symbol-logic":141,"../internals/regexp-exec-abstract":198,"../internals/require-object-coercible":204,"../internals/same-value":205,"../internals/to-string":228}],268:[function(require,module,exports){
  14776. 'use strict';
  14777. var fixRegExpWellKnownSymbolLogic = require('../internals/fix-regexp-well-known-symbol-logic');
  14778. var isRegExp = require('../internals/is-regexp');
  14779. var anObject = require('../internals/an-object');
  14780. var requireObjectCoercible = require('../internals/require-object-coercible');
  14781. var speciesConstructor = require('../internals/species-constructor');
  14782. var advanceStringIndex = require('../internals/advance-string-index');
  14783. var toLength = require('../internals/to-length');
  14784. var toString = require('../internals/to-string');
  14785. var callRegExpExec = require('../internals/regexp-exec-abstract');
  14786. var regexpExec = require('../internals/regexp-exec');
  14787. var stickyHelpers = require('../internals/regexp-sticky-helpers');
  14788. var fails = require('../internals/fails');
  14789. var UNSUPPORTED_Y = stickyHelpers.UNSUPPORTED_Y;
  14790. var arrayPush = [].push;
  14791. var min = Math.min;
  14792. var MAX_UINT32 = 0xFFFFFFFF;
  14793. // Chrome 51 has a buggy "split" implementation when RegExp#exec !== nativeExec
  14794. // Weex JS has frozen built-in prototypes, so use try / catch wrapper
  14795. var SPLIT_WORKS_WITH_OVERWRITTEN_EXEC = !fails(function () {
  14796. // eslint-disable-next-line regexp/no-empty-group -- required for testing
  14797. var re = /(?:)/;
  14798. var originalExec = re.exec;
  14799. re.exec = function () { return originalExec.apply(this, arguments); };
  14800. var result = 'ab'.split(re);
  14801. return result.length !== 2 || result[0] !== 'a' || result[1] !== 'b';
  14802. });
  14803. // @@split logic
  14804. fixRegExpWellKnownSymbolLogic('split', function (SPLIT, nativeSplit, maybeCallNative) {
  14805. var internalSplit;
  14806. if (
  14807. 'abbc'.split(/(b)*/)[1] == 'c' ||
  14808. // eslint-disable-next-line regexp/no-empty-group -- required for testing
  14809. 'test'.split(/(?:)/, -1).length != 4 ||
  14810. 'ab'.split(/(?:ab)*/).length != 2 ||
  14811. '.'.split(/(.?)(.?)/).length != 4 ||
  14812. // eslint-disable-next-line regexp/no-empty-capturing-group, regexp/no-empty-group -- required for testing
  14813. '.'.split(/()()/).length > 1 ||
  14814. ''.split(/.?/).length
  14815. ) {
  14816. // based on es5-shim implementation, need to rework it
  14817. internalSplit = function (separator, limit) {
  14818. var string = toString(requireObjectCoercible(this));
  14819. var lim = limit === undefined ? MAX_UINT32 : limit >>> 0;
  14820. if (lim === 0) return [];
  14821. if (separator === undefined) return [string];
  14822. // If `separator` is not a regex, use native split
  14823. if (!isRegExp(separator)) {
  14824. return nativeSplit.call(string, separator, lim);
  14825. }
  14826. var output = [];
  14827. var flags = (separator.ignoreCase ? 'i' : '') +
  14828. (separator.multiline ? 'm' : '') +
  14829. (separator.unicode ? 'u' : '') +
  14830. (separator.sticky ? 'y' : '');
  14831. var lastLastIndex = 0;
  14832. // Make `global` and avoid `lastIndex` issues by working with a copy
  14833. var separatorCopy = new RegExp(separator.source, flags + 'g');
  14834. var match, lastIndex, lastLength;
  14835. while (match = regexpExec.call(separatorCopy, string)) {
  14836. lastIndex = separatorCopy.lastIndex;
  14837. if (lastIndex > lastLastIndex) {
  14838. output.push(string.slice(lastLastIndex, match.index));
  14839. if (match.length > 1 && match.index < string.length) arrayPush.apply(output, match.slice(1));
  14840. lastLength = match[0].length;
  14841. lastLastIndex = lastIndex;
  14842. if (output.length >= lim) break;
  14843. }
  14844. if (separatorCopy.lastIndex === match.index) separatorCopy.lastIndex++; // Avoid an infinite loop
  14845. }
  14846. if (lastLastIndex === string.length) {
  14847. if (lastLength || !separatorCopy.test('')) output.push('');
  14848. } else output.push(string.slice(lastLastIndex));
  14849. return output.length > lim ? output.slice(0, lim) : output;
  14850. };
  14851. // Chakra, V8
  14852. } else if ('0'.split(undefined, 0).length) {
  14853. internalSplit = function (separator, limit) {
  14854. return separator === undefined && limit === 0 ? [] : nativeSplit.call(this, separator, limit);
  14855. };
  14856. } else internalSplit = nativeSplit;
  14857. return [
  14858. // `String.prototype.split` method
  14859. // https://tc39.es/ecma262/#sec-string.prototype.split
  14860. function split(separator, limit) {
  14861. var O = requireObjectCoercible(this);
  14862. var splitter = separator == undefined ? undefined : separator[SPLIT];
  14863. return splitter !== undefined
  14864. ? splitter.call(separator, O, limit)
  14865. : internalSplit.call(toString(O), separator, limit);
  14866. },
  14867. // `RegExp.prototype[@@split]` method
  14868. // https://tc39.es/ecma262/#sec-regexp.prototype-@@split
  14869. //
  14870. // NOTE: This cannot be properly polyfilled in engines that don't support
  14871. // the 'y' flag.
  14872. function (string, limit) {
  14873. var rx = anObject(this);
  14874. var S = toString(string);
  14875. var res = maybeCallNative(internalSplit, rx, S, limit, internalSplit !== nativeSplit);
  14876. if (res.done) return res.value;
  14877. var C = speciesConstructor(rx, RegExp);
  14878. var unicodeMatching = rx.unicode;
  14879. var flags = (rx.ignoreCase ? 'i' : '') +
  14880. (rx.multiline ? 'm' : '') +
  14881. (rx.unicode ? 'u' : '') +
  14882. (UNSUPPORTED_Y ? 'g' : 'y');
  14883. // ^(? + rx + ) is needed, in combination with some S slicing, to
  14884. // simulate the 'y' flag.
  14885. var splitter = new C(UNSUPPORTED_Y ? '^(?:' + rx.source + ')' : rx, flags);
  14886. var lim = limit === undefined ? MAX_UINT32 : limit >>> 0;
  14887. if (lim === 0) return [];
  14888. if (S.length === 0) return callRegExpExec(splitter, S) === null ? [S] : [];
  14889. var p = 0;
  14890. var q = 0;
  14891. var A = [];
  14892. while (q < S.length) {
  14893. splitter.lastIndex = UNSUPPORTED_Y ? 0 : q;
  14894. var z = callRegExpExec(splitter, UNSUPPORTED_Y ? S.slice(q) : S);
  14895. var e;
  14896. if (
  14897. z === null ||
  14898. (e = min(toLength(splitter.lastIndex + (UNSUPPORTED_Y ? q : 0)), S.length)) === p
  14899. ) {
  14900. q = advanceStringIndex(S, q, unicodeMatching);
  14901. } else {
  14902. A.push(S.slice(p, q));
  14903. if (A.length === lim) return A;
  14904. for (var i = 1; i <= z.length - 1; i++) {
  14905. A.push(z[i]);
  14906. if (A.length === lim) return A;
  14907. }
  14908. q = p = e;
  14909. }
  14910. }
  14911. A.push(S.slice(p));
  14912. return A;
  14913. }
  14914. ];
  14915. }, !SPLIT_WORKS_WITH_OVERWRITTEN_EXEC, UNSUPPORTED_Y);
  14916. },{"../internals/advance-string-index":92,"../internals/an-object":94,"../internals/fails":140,"../internals/fix-regexp-well-known-symbol-logic":141,"../internals/is-regexp":164,"../internals/regexp-exec":199,"../internals/regexp-exec-abstract":198,"../internals/regexp-sticky-helpers":201,"../internals/require-object-coercible":204,"../internals/species-constructor":212,"../internals/to-length":221,"../internals/to-string":228}],269:[function(require,module,exports){
  14917. 'use strict';
  14918. var $ = require('../internals/export');
  14919. var $trim = require('../internals/string-trim').trim;
  14920. var forcedStringTrimMethod = require('../internals/string-trim-forced');
  14921. // `String.prototype.trim` method
  14922. // https://tc39.es/ecma262/#sec-string.prototype.trim
  14923. $({ target: 'String', proto: true, forced: forcedStringTrimMethod('trim') }, {
  14924. trim: function trim() {
  14925. return $trim(this);
  14926. }
  14927. });
  14928. },{"../internals/export":139,"../internals/string-trim":215,"../internals/string-trim-forced":214}],270:[function(require,module,exports){
  14929. // `Symbol.prototype.description` getter
  14930. // https://tc39.es/ecma262/#sec-symbol.prototype.description
  14931. 'use strict';
  14932. var $ = require('../internals/export');
  14933. var DESCRIPTORS = require('../internals/descriptors');
  14934. var global = require('../internals/global');
  14935. var has = require('../internals/has');
  14936. var isObject = require('../internals/is-object');
  14937. var defineProperty = require('../internals/object-define-property').f;
  14938. var copyConstructorProperties = require('../internals/copy-constructor-properties');
  14939. var NativeSymbol = global.Symbol;
  14940. if (DESCRIPTORS && typeof NativeSymbol == 'function' && (!('description' in NativeSymbol.prototype) ||
  14941. // Safari 12 bug
  14942. NativeSymbol().description !== undefined
  14943. )) {
  14944. var EmptyStringDescriptionStore = {};
  14945. // wrap Symbol constructor for correct work with undefined description
  14946. var SymbolWrapper = function Symbol() {
  14947. var description = arguments.length < 1 || arguments[0] === undefined ? undefined : String(arguments[0]);
  14948. var result = this instanceof SymbolWrapper
  14949. ? new NativeSymbol(description)
  14950. // in Edge 13, String(Symbol(undefined)) === 'Symbol(undefined)'
  14951. : description === undefined ? NativeSymbol() : NativeSymbol(description);
  14952. if (description === '') EmptyStringDescriptionStore[result] = true;
  14953. return result;
  14954. };
  14955. copyConstructorProperties(SymbolWrapper, NativeSymbol);
  14956. var symbolPrototype = SymbolWrapper.prototype = NativeSymbol.prototype;
  14957. symbolPrototype.constructor = SymbolWrapper;
  14958. var symbolToString = symbolPrototype.toString;
  14959. var nativeSymbol = String(NativeSymbol('test')) == 'Symbol(test)';
  14960. var regexp = /^Symbol\((.*)\)[^)]+$/;
  14961. defineProperty(symbolPrototype, 'description', {
  14962. configurable: true,
  14963. get: function description() {
  14964. var symbol = isObject(this) ? this.valueOf() : this;
  14965. var string = symbolToString.call(symbol);
  14966. if (has(EmptyStringDescriptionStore, symbol)) return '';
  14967. var desc = nativeSymbol ? string.slice(7, -1) : string.replace(regexp, '$1');
  14968. return desc === '' ? undefined : desc;
  14969. }
  14970. });
  14971. $({ global: true, forced: true }, {
  14972. Symbol: SymbolWrapper
  14973. });
  14974. }
  14975. },{"../internals/copy-constructor-properties":116,"../internals/descriptors":125,"../internals/export":139,"../internals/global":147,"../internals/has":148,"../internals/is-object":162,"../internals/object-define-property":179}],271:[function(require,module,exports){
  14976. 'use strict';
  14977. var $ = require('../internals/export');
  14978. var global = require('../internals/global');
  14979. var getBuiltIn = require('../internals/get-built-in');
  14980. var IS_PURE = require('../internals/is-pure');
  14981. var DESCRIPTORS = require('../internals/descriptors');
  14982. var NATIVE_SYMBOL = require('../internals/native-symbol');
  14983. var fails = require('../internals/fails');
  14984. var has = require('../internals/has');
  14985. var isArray = require('../internals/is-array');
  14986. var isObject = require('../internals/is-object');
  14987. var isSymbol = require('../internals/is-symbol');
  14988. var anObject = require('../internals/an-object');
  14989. var toObject = require('../internals/to-object');
  14990. var toIndexedObject = require('../internals/to-indexed-object');
  14991. var toPropertyKey = require('../internals/to-property-key');
  14992. var $toString = require('../internals/to-string');
  14993. var createPropertyDescriptor = require('../internals/create-property-descriptor');
  14994. var nativeObjectCreate = require('../internals/object-create');
  14995. var objectKeys = require('../internals/object-keys');
  14996. var getOwnPropertyNamesModule = require('../internals/object-get-own-property-names');
  14997. var getOwnPropertyNamesExternal = require('../internals/object-get-own-property-names-external');
  14998. var getOwnPropertySymbolsModule = require('../internals/object-get-own-property-symbols');
  14999. var getOwnPropertyDescriptorModule = require('../internals/object-get-own-property-descriptor');
  15000. var definePropertyModule = require('../internals/object-define-property');
  15001. var propertyIsEnumerableModule = require('../internals/object-property-is-enumerable');
  15002. var createNonEnumerableProperty = require('../internals/create-non-enumerable-property');
  15003. var redefine = require('../internals/redefine');
  15004. var shared = require('../internals/shared');
  15005. var sharedKey = require('../internals/shared-key');
  15006. var hiddenKeys = require('../internals/hidden-keys');
  15007. var uid = require('../internals/uid');
  15008. var wellKnownSymbol = require('../internals/well-known-symbol');
  15009. var wrappedWellKnownSymbolModule = require('../internals/well-known-symbol-wrapped');
  15010. var defineWellKnownSymbol = require('../internals/define-well-known-symbol');
  15011. var setToStringTag = require('../internals/set-to-string-tag');
  15012. var InternalStateModule = require('../internals/internal-state');
  15013. var $forEach = require('../internals/array-iteration').forEach;
  15014. var HIDDEN = sharedKey('hidden');
  15015. var SYMBOL = 'Symbol';
  15016. var PROTOTYPE = 'prototype';
  15017. var TO_PRIMITIVE = wellKnownSymbol('toPrimitive');
  15018. var setInternalState = InternalStateModule.set;
  15019. var getInternalState = InternalStateModule.getterFor(SYMBOL);
  15020. var ObjectPrototype = Object[PROTOTYPE];
  15021. var $Symbol = global.Symbol;
  15022. var $stringify = getBuiltIn('JSON', 'stringify');
  15023. var nativeGetOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f;
  15024. var nativeDefineProperty = definePropertyModule.f;
  15025. var nativeGetOwnPropertyNames = getOwnPropertyNamesExternal.f;
  15026. var nativePropertyIsEnumerable = propertyIsEnumerableModule.f;
  15027. var AllSymbols = shared('symbols');
  15028. var ObjectPrototypeSymbols = shared('op-symbols');
  15029. var StringToSymbolRegistry = shared('string-to-symbol-registry');
  15030. var SymbolToStringRegistry = shared('symbol-to-string-registry');
  15031. var WellKnownSymbolsStore = shared('wks');
  15032. var QObject = global.QObject;
  15033. // Don't use setters in Qt Script, https://github.com/zloirock/core-js/issues/173
  15034. var USE_SETTER = !QObject || !QObject[PROTOTYPE] || !QObject[PROTOTYPE].findChild;
  15035. // fallback for old Android, https://code.google.com/p/v8/issues/detail?id=687
  15036. var setSymbolDescriptor = DESCRIPTORS && fails(function () {
  15037. return nativeObjectCreate(nativeDefineProperty({}, 'a', {
  15038. get: function () { return nativeDefineProperty(this, 'a', { value: 7 }).a; }
  15039. })).a != 7;
  15040. }) ? function (O, P, Attributes) {
  15041. var ObjectPrototypeDescriptor = nativeGetOwnPropertyDescriptor(ObjectPrototype, P);
  15042. if (ObjectPrototypeDescriptor) delete ObjectPrototype[P];
  15043. nativeDefineProperty(O, P, Attributes);
  15044. if (ObjectPrototypeDescriptor && O !== ObjectPrototype) {
  15045. nativeDefineProperty(ObjectPrototype, P, ObjectPrototypeDescriptor);
  15046. }
  15047. } : nativeDefineProperty;
  15048. var wrap = function (tag, description) {
  15049. var symbol = AllSymbols[tag] = nativeObjectCreate($Symbol[PROTOTYPE]);
  15050. setInternalState(symbol, {
  15051. type: SYMBOL,
  15052. tag: tag,
  15053. description: description
  15054. });
  15055. if (!DESCRIPTORS) symbol.description = description;
  15056. return symbol;
  15057. };
  15058. var $defineProperty = function defineProperty(O, P, Attributes) {
  15059. if (O === ObjectPrototype) $defineProperty(ObjectPrototypeSymbols, P, Attributes);
  15060. anObject(O);
  15061. var key = toPropertyKey(P);
  15062. anObject(Attributes);
  15063. if (has(AllSymbols, key)) {
  15064. if (!Attributes.enumerable) {
  15065. if (!has(O, HIDDEN)) nativeDefineProperty(O, HIDDEN, createPropertyDescriptor(1, {}));
  15066. O[HIDDEN][key] = true;
  15067. } else {
  15068. if (has(O, HIDDEN) && O[HIDDEN][key]) O[HIDDEN][key] = false;
  15069. Attributes = nativeObjectCreate(Attributes, { enumerable: createPropertyDescriptor(0, false) });
  15070. } return setSymbolDescriptor(O, key, Attributes);
  15071. } return nativeDefineProperty(O, key, Attributes);
  15072. };
  15073. var $defineProperties = function defineProperties(O, Properties) {
  15074. anObject(O);
  15075. var properties = toIndexedObject(Properties);
  15076. var keys = objectKeys(properties).concat($getOwnPropertySymbols(properties));
  15077. $forEach(keys, function (key) {
  15078. if (!DESCRIPTORS || $propertyIsEnumerable.call(properties, key)) $defineProperty(O, key, properties[key]);
  15079. });
  15080. return O;
  15081. };
  15082. var $create = function create(O, Properties) {
  15083. return Properties === undefined ? nativeObjectCreate(O) : $defineProperties(nativeObjectCreate(O), Properties);
  15084. };
  15085. var $propertyIsEnumerable = function propertyIsEnumerable(V) {
  15086. var P = toPropertyKey(V);
  15087. var enumerable = nativePropertyIsEnumerable.call(this, P);
  15088. if (this === ObjectPrototype && has(AllSymbols, P) && !has(ObjectPrototypeSymbols, P)) return false;
  15089. return enumerable || !has(this, P) || !has(AllSymbols, P) || has(this, HIDDEN) && this[HIDDEN][P] ? enumerable : true;
  15090. };
  15091. var $getOwnPropertyDescriptor = function getOwnPropertyDescriptor(O, P) {
  15092. var it = toIndexedObject(O);
  15093. var key = toPropertyKey(P);
  15094. if (it === ObjectPrototype && has(AllSymbols, key) && !has(ObjectPrototypeSymbols, key)) return;
  15095. var descriptor = nativeGetOwnPropertyDescriptor(it, key);
  15096. if (descriptor && has(AllSymbols, key) && !(has(it, HIDDEN) && it[HIDDEN][key])) {
  15097. descriptor.enumerable = true;
  15098. }
  15099. return descriptor;
  15100. };
  15101. var $getOwnPropertyNames = function getOwnPropertyNames(O) {
  15102. var names = nativeGetOwnPropertyNames(toIndexedObject(O));
  15103. var result = [];
  15104. $forEach(names, function (key) {
  15105. if (!has(AllSymbols, key) && !has(hiddenKeys, key)) result.push(key);
  15106. });
  15107. return result;
  15108. };
  15109. var $getOwnPropertySymbols = function getOwnPropertySymbols(O) {
  15110. var IS_OBJECT_PROTOTYPE = O === ObjectPrototype;
  15111. var names = nativeGetOwnPropertyNames(IS_OBJECT_PROTOTYPE ? ObjectPrototypeSymbols : toIndexedObject(O));
  15112. var result = [];
  15113. $forEach(names, function (key) {
  15114. if (has(AllSymbols, key) && (!IS_OBJECT_PROTOTYPE || has(ObjectPrototype, key))) {
  15115. result.push(AllSymbols[key]);
  15116. }
  15117. });
  15118. return result;
  15119. };
  15120. // `Symbol` constructor
  15121. // https://tc39.es/ecma262/#sec-symbol-constructor
  15122. if (!NATIVE_SYMBOL) {
  15123. $Symbol = function Symbol() {
  15124. if (this instanceof $Symbol) throw TypeError('Symbol is not a constructor');
  15125. var description = !arguments.length || arguments[0] === undefined ? undefined : $toString(arguments[0]);
  15126. var tag = uid(description);
  15127. var setter = function (value) {
  15128. if (this === ObjectPrototype) setter.call(ObjectPrototypeSymbols, value);
  15129. if (has(this, HIDDEN) && has(this[HIDDEN], tag)) this[HIDDEN][tag] = false;
  15130. setSymbolDescriptor(this, tag, createPropertyDescriptor(1, value));
  15131. };
  15132. if (DESCRIPTORS && USE_SETTER) setSymbolDescriptor(ObjectPrototype, tag, { configurable: true, set: setter });
  15133. return wrap(tag, description);
  15134. };
  15135. redefine($Symbol[PROTOTYPE], 'toString', function toString() {
  15136. return getInternalState(this).tag;
  15137. });
  15138. redefine($Symbol, 'withoutSetter', function (description) {
  15139. return wrap(uid(description), description);
  15140. });
  15141. propertyIsEnumerableModule.f = $propertyIsEnumerable;
  15142. definePropertyModule.f = $defineProperty;
  15143. getOwnPropertyDescriptorModule.f = $getOwnPropertyDescriptor;
  15144. getOwnPropertyNamesModule.f = getOwnPropertyNamesExternal.f = $getOwnPropertyNames;
  15145. getOwnPropertySymbolsModule.f = $getOwnPropertySymbols;
  15146. wrappedWellKnownSymbolModule.f = function (name) {
  15147. return wrap(wellKnownSymbol(name), name);
  15148. };
  15149. if (DESCRIPTORS) {
  15150. // https://github.com/tc39/proposal-Symbol-description
  15151. nativeDefineProperty($Symbol[PROTOTYPE], 'description', {
  15152. configurable: true,
  15153. get: function description() {
  15154. return getInternalState(this).description;
  15155. }
  15156. });
  15157. if (!IS_PURE) {
  15158. redefine(ObjectPrototype, 'propertyIsEnumerable', $propertyIsEnumerable, { unsafe: true });
  15159. }
  15160. }
  15161. }
  15162. $({ global: true, wrap: true, forced: !NATIVE_SYMBOL, sham: !NATIVE_SYMBOL }, {
  15163. Symbol: $Symbol
  15164. });
  15165. $forEach(objectKeys(WellKnownSymbolsStore), function (name) {
  15166. defineWellKnownSymbol(name);
  15167. });
  15168. $({ target: SYMBOL, stat: true, forced: !NATIVE_SYMBOL }, {
  15169. // `Symbol.for` method
  15170. // https://tc39.es/ecma262/#sec-symbol.for
  15171. 'for': function (key) {
  15172. var string = $toString(key);
  15173. if (has(StringToSymbolRegistry, string)) return StringToSymbolRegistry[string];
  15174. var symbol = $Symbol(string);
  15175. StringToSymbolRegistry[string] = symbol;
  15176. SymbolToStringRegistry[symbol] = string;
  15177. return symbol;
  15178. },
  15179. // `Symbol.keyFor` method
  15180. // https://tc39.es/ecma262/#sec-symbol.keyfor
  15181. keyFor: function keyFor(sym) {
  15182. if (!isSymbol(sym)) throw TypeError(sym + ' is not a symbol');
  15183. if (has(SymbolToStringRegistry, sym)) return SymbolToStringRegistry[sym];
  15184. },
  15185. useSetter: function () { USE_SETTER = true; },
  15186. useSimple: function () { USE_SETTER = false; }
  15187. });
  15188. $({ target: 'Object', stat: true, forced: !NATIVE_SYMBOL, sham: !DESCRIPTORS }, {
  15189. // `Object.create` method
  15190. // https://tc39.es/ecma262/#sec-object.create
  15191. create: $create,
  15192. // `Object.defineProperty` method
  15193. // https://tc39.es/ecma262/#sec-object.defineproperty
  15194. defineProperty: $defineProperty,
  15195. // `Object.defineProperties` method
  15196. // https://tc39.es/ecma262/#sec-object.defineproperties
  15197. defineProperties: $defineProperties,
  15198. // `Object.getOwnPropertyDescriptor` method
  15199. // https://tc39.es/ecma262/#sec-object.getownpropertydescriptors
  15200. getOwnPropertyDescriptor: $getOwnPropertyDescriptor
  15201. });
  15202. $({ target: 'Object', stat: true, forced: !NATIVE_SYMBOL }, {
  15203. // `Object.getOwnPropertyNames` method
  15204. // https://tc39.es/ecma262/#sec-object.getownpropertynames
  15205. getOwnPropertyNames: $getOwnPropertyNames,
  15206. // `Object.getOwnPropertySymbols` method
  15207. // https://tc39.es/ecma262/#sec-object.getownpropertysymbols
  15208. getOwnPropertySymbols: $getOwnPropertySymbols
  15209. });
  15210. // Chrome 38 and 39 `Object.getOwnPropertySymbols` fails on primitives
  15211. // https://bugs.chromium.org/p/v8/issues/detail?id=3443
  15212. $({ target: 'Object', stat: true, forced: fails(function () { getOwnPropertySymbolsModule.f(1); }) }, {
  15213. getOwnPropertySymbols: function getOwnPropertySymbols(it) {
  15214. return getOwnPropertySymbolsModule.f(toObject(it));
  15215. }
  15216. });
  15217. // `JSON.stringify` method behavior with symbols
  15218. // https://tc39.es/ecma262/#sec-json.stringify
  15219. if ($stringify) {
  15220. var FORCED_JSON_STRINGIFY = !NATIVE_SYMBOL || fails(function () {
  15221. var symbol = $Symbol();
  15222. // MS Edge converts symbol values to JSON as {}
  15223. return $stringify([symbol]) != '[null]'
  15224. // WebKit converts symbol values to JSON as null
  15225. || $stringify({ a: symbol }) != '{}'
  15226. // V8 throws on boxed symbols
  15227. || $stringify(Object(symbol)) != '{}';
  15228. });
  15229. $({ target: 'JSON', stat: true, forced: FORCED_JSON_STRINGIFY }, {
  15230. // eslint-disable-next-line no-unused-vars -- required for `.length`
  15231. stringify: function stringify(it, replacer, space) {
  15232. var args = [it];
  15233. var index = 1;
  15234. var $replacer;
  15235. while (arguments.length > index) args.push(arguments[index++]);
  15236. $replacer = replacer;
  15237. if (!isObject(replacer) && it === undefined || isSymbol(it)) return; // IE8 returns string on undefined
  15238. if (!isArray(replacer)) replacer = function (key, value) {
  15239. if (typeof $replacer == 'function') value = $replacer.call(this, key, value);
  15240. if (!isSymbol(value)) return value;
  15241. };
  15242. args[1] = replacer;
  15243. return $stringify.apply(null, args);
  15244. }
  15245. });
  15246. }
  15247. // `Symbol.prototype[@@toPrimitive]` method
  15248. // https://tc39.es/ecma262/#sec-symbol.prototype-@@toprimitive
  15249. if (!$Symbol[PROTOTYPE][TO_PRIMITIVE]) {
  15250. createNonEnumerableProperty($Symbol[PROTOTYPE], TO_PRIMITIVE, $Symbol[PROTOTYPE].valueOf);
  15251. }
  15252. // `Symbol.prototype[@@toStringTag]` property
  15253. // https://tc39.es/ecma262/#sec-symbol.prototype-@@tostringtag
  15254. setToStringTag($Symbol, SYMBOL);
  15255. hiddenKeys[HIDDEN] = true;
  15256. },{"../internals/an-object":94,"../internals/array-iteration":104,"../internals/create-non-enumerable-property":120,"../internals/create-property-descriptor":121,"../internals/define-well-known-symbol":124,"../internals/descriptors":125,"../internals/export":139,"../internals/fails":140,"../internals/get-built-in":143,"../internals/global":147,"../internals/has":148,"../internals/hidden-keys":149,"../internals/internal-state":157,"../internals/is-array":159,"../internals/is-object":162,"../internals/is-pure":163,"../internals/is-symbol":165,"../internals/native-symbol":172,"../internals/object-create":177,"../internals/object-define-property":179,"../internals/object-get-own-property-descriptor":180,"../internals/object-get-own-property-names":182,"../internals/object-get-own-property-names-external":181,"../internals/object-get-own-property-symbols":183,"../internals/object-keys":186,"../internals/object-property-is-enumerable":187,"../internals/redefine":197,"../internals/set-to-string-tag":208,"../internals/shared":211,"../internals/shared-key":209,"../internals/to-indexed-object":219,"../internals/to-object":222,"../internals/to-property-key":226,"../internals/to-string":228,"../internals/uid":234,"../internals/well-known-symbol":237,"../internals/well-known-symbol-wrapped":236}],272:[function(require,module,exports){
  15257. 'use strict';
  15258. var ArrayBufferViewCore = require('../internals/array-buffer-view-core');
  15259. var $copyWithin = require('../internals/array-copy-within');
  15260. var aTypedArray = ArrayBufferViewCore.aTypedArray;
  15261. var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod;
  15262. // `%TypedArray%.prototype.copyWithin` method
  15263. // https://tc39.es/ecma262/#sec-%typedarray%.prototype.copywithin
  15264. exportTypedArrayMethod('copyWithin', function copyWithin(target, start /* , end */) {
  15265. return $copyWithin.call(aTypedArray(this), target, start, arguments.length > 2 ? arguments[2] : undefined);
  15266. });
  15267. },{"../internals/array-buffer-view-core":96,"../internals/array-copy-within":98}],273:[function(require,module,exports){
  15268. 'use strict';
  15269. var ArrayBufferViewCore = require('../internals/array-buffer-view-core');
  15270. var $every = require('../internals/array-iteration').every;
  15271. var aTypedArray = ArrayBufferViewCore.aTypedArray;
  15272. var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod;
  15273. // `%TypedArray%.prototype.every` method
  15274. // https://tc39.es/ecma262/#sec-%typedarray%.prototype.every
  15275. exportTypedArrayMethod('every', function every(callbackfn /* , thisArg */) {
  15276. return $every(aTypedArray(this), callbackfn, arguments.length > 1 ? arguments[1] : undefined);
  15277. });
  15278. },{"../internals/array-buffer-view-core":96,"../internals/array-iteration":104}],274:[function(require,module,exports){
  15279. 'use strict';
  15280. var ArrayBufferViewCore = require('../internals/array-buffer-view-core');
  15281. var $fill = require('../internals/array-fill');
  15282. var aTypedArray = ArrayBufferViewCore.aTypedArray;
  15283. var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod;
  15284. // `%TypedArray%.prototype.fill` method
  15285. // https://tc39.es/ecma262/#sec-%typedarray%.prototype.fill
  15286. // eslint-disable-next-line no-unused-vars -- required for `.length`
  15287. exportTypedArrayMethod('fill', function fill(value /* , start, end */) {
  15288. return $fill.apply(aTypedArray(this), arguments);
  15289. });
  15290. },{"../internals/array-buffer-view-core":96,"../internals/array-fill":99}],275:[function(require,module,exports){
  15291. 'use strict';
  15292. var ArrayBufferViewCore = require('../internals/array-buffer-view-core');
  15293. var $filter = require('../internals/array-iteration').filter;
  15294. var fromSpeciesAndList = require('../internals/typed-array-from-species-and-list');
  15295. var aTypedArray = ArrayBufferViewCore.aTypedArray;
  15296. var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod;
  15297. // `%TypedArray%.prototype.filter` method
  15298. // https://tc39.es/ecma262/#sec-%typedarray%.prototype.filter
  15299. exportTypedArrayMethod('filter', function filter(callbackfn /* , thisArg */) {
  15300. var list = $filter(aTypedArray(this), callbackfn, arguments.length > 1 ? arguments[1] : undefined);
  15301. return fromSpeciesAndList(this, list);
  15302. });
  15303. },{"../internals/array-buffer-view-core":96,"../internals/array-iteration":104,"../internals/typed-array-from-species-and-list":231}],276:[function(require,module,exports){
  15304. 'use strict';
  15305. var ArrayBufferViewCore = require('../internals/array-buffer-view-core');
  15306. var $findIndex = require('../internals/array-iteration').findIndex;
  15307. var aTypedArray = ArrayBufferViewCore.aTypedArray;
  15308. var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod;
  15309. // `%TypedArray%.prototype.findIndex` method
  15310. // https://tc39.es/ecma262/#sec-%typedarray%.prototype.findindex
  15311. exportTypedArrayMethod('findIndex', function findIndex(predicate /* , thisArg */) {
  15312. return $findIndex(aTypedArray(this), predicate, arguments.length > 1 ? arguments[1] : undefined);
  15313. });
  15314. },{"../internals/array-buffer-view-core":96,"../internals/array-iteration":104}],277:[function(require,module,exports){
  15315. 'use strict';
  15316. var ArrayBufferViewCore = require('../internals/array-buffer-view-core');
  15317. var $find = require('../internals/array-iteration').find;
  15318. var aTypedArray = ArrayBufferViewCore.aTypedArray;
  15319. var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod;
  15320. // `%TypedArray%.prototype.find` method
  15321. // https://tc39.es/ecma262/#sec-%typedarray%.prototype.find
  15322. exportTypedArrayMethod('find', function find(predicate /* , thisArg */) {
  15323. return $find(aTypedArray(this), predicate, arguments.length > 1 ? arguments[1] : undefined);
  15324. });
  15325. },{"../internals/array-buffer-view-core":96,"../internals/array-iteration":104}],278:[function(require,module,exports){
  15326. 'use strict';
  15327. var ArrayBufferViewCore = require('../internals/array-buffer-view-core');
  15328. var $forEach = require('../internals/array-iteration').forEach;
  15329. var aTypedArray = ArrayBufferViewCore.aTypedArray;
  15330. var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod;
  15331. // `%TypedArray%.prototype.forEach` method
  15332. // https://tc39.es/ecma262/#sec-%typedarray%.prototype.foreach
  15333. exportTypedArrayMethod('forEach', function forEach(callbackfn /* , thisArg */) {
  15334. $forEach(aTypedArray(this), callbackfn, arguments.length > 1 ? arguments[1] : undefined);
  15335. });
  15336. },{"../internals/array-buffer-view-core":96,"../internals/array-iteration":104}],279:[function(require,module,exports){
  15337. 'use strict';
  15338. var ArrayBufferViewCore = require('../internals/array-buffer-view-core');
  15339. var $includes = require('../internals/array-includes').includes;
  15340. var aTypedArray = ArrayBufferViewCore.aTypedArray;
  15341. var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod;
  15342. // `%TypedArray%.prototype.includes` method
  15343. // https://tc39.es/ecma262/#sec-%typedarray%.prototype.includes
  15344. exportTypedArrayMethod('includes', function includes(searchElement /* , fromIndex */) {
  15345. return $includes(aTypedArray(this), searchElement, arguments.length > 1 ? arguments[1] : undefined);
  15346. });
  15347. },{"../internals/array-buffer-view-core":96,"../internals/array-includes":103}],280:[function(require,module,exports){
  15348. 'use strict';
  15349. var ArrayBufferViewCore = require('../internals/array-buffer-view-core');
  15350. var $indexOf = require('../internals/array-includes').indexOf;
  15351. var aTypedArray = ArrayBufferViewCore.aTypedArray;
  15352. var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod;
  15353. // `%TypedArray%.prototype.indexOf` method
  15354. // https://tc39.es/ecma262/#sec-%typedarray%.prototype.indexof
  15355. exportTypedArrayMethod('indexOf', function indexOf(searchElement /* , fromIndex */) {
  15356. return $indexOf(aTypedArray(this), searchElement, arguments.length > 1 ? arguments[1] : undefined);
  15357. });
  15358. },{"../internals/array-buffer-view-core":96,"../internals/array-includes":103}],281:[function(require,module,exports){
  15359. 'use strict';
  15360. var global = require('../internals/global');
  15361. var ArrayBufferViewCore = require('../internals/array-buffer-view-core');
  15362. var ArrayIterators = require('../modules/es.array.iterator');
  15363. var wellKnownSymbol = require('../internals/well-known-symbol');
  15364. var ITERATOR = wellKnownSymbol('iterator');
  15365. var Uint8Array = global.Uint8Array;
  15366. var arrayValues = ArrayIterators.values;
  15367. var arrayKeys = ArrayIterators.keys;
  15368. var arrayEntries = ArrayIterators.entries;
  15369. var aTypedArray = ArrayBufferViewCore.aTypedArray;
  15370. var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod;
  15371. var nativeTypedArrayIterator = Uint8Array && Uint8Array.prototype[ITERATOR];
  15372. var CORRECT_ITER_NAME = !!nativeTypedArrayIterator
  15373. && (nativeTypedArrayIterator.name == 'values' || nativeTypedArrayIterator.name == undefined);
  15374. var typedArrayValues = function values() {
  15375. return arrayValues.call(aTypedArray(this));
  15376. };
  15377. // `%TypedArray%.prototype.entries` method
  15378. // https://tc39.es/ecma262/#sec-%typedarray%.prototype.entries
  15379. exportTypedArrayMethod('entries', function entries() {
  15380. return arrayEntries.call(aTypedArray(this));
  15381. });
  15382. // `%TypedArray%.prototype.keys` method
  15383. // https://tc39.es/ecma262/#sec-%typedarray%.prototype.keys
  15384. exportTypedArrayMethod('keys', function keys() {
  15385. return arrayKeys.call(aTypedArray(this));
  15386. });
  15387. // `%TypedArray%.prototype.values` method
  15388. // https://tc39.es/ecma262/#sec-%typedarray%.prototype.values
  15389. exportTypedArrayMethod('values', typedArrayValues, !CORRECT_ITER_NAME);
  15390. // `%TypedArray%.prototype[@@iterator]` method
  15391. // https://tc39.es/ecma262/#sec-%typedarray%.prototype-@@iterator
  15392. exportTypedArrayMethod(ITERATOR, typedArrayValues, !CORRECT_ITER_NAME);
  15393. },{"../internals/array-buffer-view-core":96,"../internals/global":147,"../internals/well-known-symbol":237,"../modules/es.array.iterator":247}],282:[function(require,module,exports){
  15394. 'use strict';
  15395. var ArrayBufferViewCore = require('../internals/array-buffer-view-core');
  15396. var aTypedArray = ArrayBufferViewCore.aTypedArray;
  15397. var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod;
  15398. var $join = [].join;
  15399. // `%TypedArray%.prototype.join` method
  15400. // https://tc39.es/ecma262/#sec-%typedarray%.prototype.join
  15401. // eslint-disable-next-line no-unused-vars -- required for `.length`
  15402. exportTypedArrayMethod('join', function join(separator) {
  15403. return $join.apply(aTypedArray(this), arguments);
  15404. });
  15405. },{"../internals/array-buffer-view-core":96}],283:[function(require,module,exports){
  15406. 'use strict';
  15407. var ArrayBufferViewCore = require('../internals/array-buffer-view-core');
  15408. var $lastIndexOf = require('../internals/array-last-index-of');
  15409. var aTypedArray = ArrayBufferViewCore.aTypedArray;
  15410. var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod;
  15411. // `%TypedArray%.prototype.lastIndexOf` method
  15412. // https://tc39.es/ecma262/#sec-%typedarray%.prototype.lastindexof
  15413. // eslint-disable-next-line no-unused-vars -- required for `.length`
  15414. exportTypedArrayMethod('lastIndexOf', function lastIndexOf(searchElement /* , fromIndex */) {
  15415. return $lastIndexOf.apply(aTypedArray(this), arguments);
  15416. });
  15417. },{"../internals/array-buffer-view-core":96,"../internals/array-last-index-of":105}],284:[function(require,module,exports){
  15418. 'use strict';
  15419. var ArrayBufferViewCore = require('../internals/array-buffer-view-core');
  15420. var $map = require('../internals/array-iteration').map;
  15421. var typedArraySpeciesConstructor = require('../internals/typed-array-species-constructor');
  15422. var aTypedArray = ArrayBufferViewCore.aTypedArray;
  15423. var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod;
  15424. // `%TypedArray%.prototype.map` method
  15425. // https://tc39.es/ecma262/#sec-%typedarray%.prototype.map
  15426. exportTypedArrayMethod('map', function map(mapfn /* , thisArg */) {
  15427. return $map(aTypedArray(this), mapfn, arguments.length > 1 ? arguments[1] : undefined, function (O, length) {
  15428. return new (typedArraySpeciesConstructor(O))(length);
  15429. });
  15430. });
  15431. },{"../internals/array-buffer-view-core":96,"../internals/array-iteration":104,"../internals/typed-array-species-constructor":233}],285:[function(require,module,exports){
  15432. 'use strict';
  15433. var ArrayBufferViewCore = require('../internals/array-buffer-view-core');
  15434. var $reduceRight = require('../internals/array-reduce').right;
  15435. var aTypedArray = ArrayBufferViewCore.aTypedArray;
  15436. var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod;
  15437. // `%TypedArray%.prototype.reduceRicht` method
  15438. // https://tc39.es/ecma262/#sec-%typedarray%.prototype.reduceright
  15439. exportTypedArrayMethod('reduceRight', function reduceRight(callbackfn /* , initialValue */) {
  15440. return $reduceRight(aTypedArray(this), callbackfn, arguments.length, arguments.length > 1 ? arguments[1] : undefined);
  15441. });
  15442. },{"../internals/array-buffer-view-core":96,"../internals/array-reduce":108}],286:[function(require,module,exports){
  15443. 'use strict';
  15444. var ArrayBufferViewCore = require('../internals/array-buffer-view-core');
  15445. var $reduce = require('../internals/array-reduce').left;
  15446. var aTypedArray = ArrayBufferViewCore.aTypedArray;
  15447. var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod;
  15448. // `%TypedArray%.prototype.reduce` method
  15449. // https://tc39.es/ecma262/#sec-%typedarray%.prototype.reduce
  15450. exportTypedArrayMethod('reduce', function reduce(callbackfn /* , initialValue */) {
  15451. return $reduce(aTypedArray(this), callbackfn, arguments.length, arguments.length > 1 ? arguments[1] : undefined);
  15452. });
  15453. },{"../internals/array-buffer-view-core":96,"../internals/array-reduce":108}],287:[function(require,module,exports){
  15454. 'use strict';
  15455. var ArrayBufferViewCore = require('../internals/array-buffer-view-core');
  15456. var aTypedArray = ArrayBufferViewCore.aTypedArray;
  15457. var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod;
  15458. var floor = Math.floor;
  15459. // `%TypedArray%.prototype.reverse` method
  15460. // https://tc39.es/ecma262/#sec-%typedarray%.prototype.reverse
  15461. exportTypedArrayMethod('reverse', function reverse() {
  15462. var that = this;
  15463. var length = aTypedArray(that).length;
  15464. var middle = floor(length / 2);
  15465. var index = 0;
  15466. var value;
  15467. while (index < middle) {
  15468. value = that[index];
  15469. that[index++] = that[--length];
  15470. that[length] = value;
  15471. } return that;
  15472. });
  15473. },{"../internals/array-buffer-view-core":96}],288:[function(require,module,exports){
  15474. 'use strict';
  15475. var ArrayBufferViewCore = require('../internals/array-buffer-view-core');
  15476. var toLength = require('../internals/to-length');
  15477. var toOffset = require('../internals/to-offset');
  15478. var toObject = require('../internals/to-object');
  15479. var fails = require('../internals/fails');
  15480. var aTypedArray = ArrayBufferViewCore.aTypedArray;
  15481. var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod;
  15482. var FORCED = fails(function () {
  15483. // eslint-disable-next-line es/no-typed-arrays -- required for testing
  15484. new Int8Array(1).set({});
  15485. });
  15486. // `%TypedArray%.prototype.set` method
  15487. // https://tc39.es/ecma262/#sec-%typedarray%.prototype.set
  15488. exportTypedArrayMethod('set', function set(arrayLike /* , offset */) {
  15489. aTypedArray(this);
  15490. var offset = toOffset(arguments.length > 1 ? arguments[1] : undefined, 1);
  15491. var length = this.length;
  15492. var src = toObject(arrayLike);
  15493. var len = toLength(src.length);
  15494. var index = 0;
  15495. if (len + offset > length) throw RangeError('Wrong length');
  15496. while (index < len) this[offset + index] = src[index++];
  15497. }, FORCED);
  15498. },{"../internals/array-buffer-view-core":96,"../internals/fails":140,"../internals/to-length":221,"../internals/to-object":222,"../internals/to-offset":223}],289:[function(require,module,exports){
  15499. 'use strict';
  15500. var ArrayBufferViewCore = require('../internals/array-buffer-view-core');
  15501. var typedArraySpeciesConstructor = require('../internals/typed-array-species-constructor');
  15502. var fails = require('../internals/fails');
  15503. var aTypedArray = ArrayBufferViewCore.aTypedArray;
  15504. var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod;
  15505. var $slice = [].slice;
  15506. var FORCED = fails(function () {
  15507. // eslint-disable-next-line es/no-typed-arrays -- required for testing
  15508. new Int8Array(1).slice();
  15509. });
  15510. // `%TypedArray%.prototype.slice` method
  15511. // https://tc39.es/ecma262/#sec-%typedarray%.prototype.slice
  15512. exportTypedArrayMethod('slice', function slice(start, end) {
  15513. var list = $slice.call(aTypedArray(this), start, end);
  15514. var C = typedArraySpeciesConstructor(this);
  15515. var index = 0;
  15516. var length = list.length;
  15517. var result = new C(length);
  15518. while (length > index) result[index] = list[index++];
  15519. return result;
  15520. }, FORCED);
  15521. },{"../internals/array-buffer-view-core":96,"../internals/fails":140,"../internals/typed-array-species-constructor":233}],290:[function(require,module,exports){
  15522. 'use strict';
  15523. var ArrayBufferViewCore = require('../internals/array-buffer-view-core');
  15524. var $some = require('../internals/array-iteration').some;
  15525. var aTypedArray = ArrayBufferViewCore.aTypedArray;
  15526. var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod;
  15527. // `%TypedArray%.prototype.some` method
  15528. // https://tc39.es/ecma262/#sec-%typedarray%.prototype.some
  15529. exportTypedArrayMethod('some', function some(callbackfn /* , thisArg */) {
  15530. return $some(aTypedArray(this), callbackfn, arguments.length > 1 ? arguments[1] : undefined);
  15531. });
  15532. },{"../internals/array-buffer-view-core":96,"../internals/array-iteration":104}],291:[function(require,module,exports){
  15533. 'use strict';
  15534. var ArrayBufferViewCore = require('../internals/array-buffer-view-core');
  15535. var global = require('../internals/global');
  15536. var fails = require('../internals/fails');
  15537. var aFunction = require('../internals/a-function');
  15538. var toLength = require('../internals/to-length');
  15539. var internalSort = require('../internals/array-sort');
  15540. var FF = require('../internals/engine-ff-version');
  15541. var IE_OR_EDGE = require('../internals/engine-is-ie-or-edge');
  15542. var V8 = require('../internals/engine-v8-version');
  15543. var WEBKIT = require('../internals/engine-webkit-version');
  15544. var aTypedArray = ArrayBufferViewCore.aTypedArray;
  15545. var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod;
  15546. var Uint16Array = global.Uint16Array;
  15547. var nativeSort = Uint16Array && Uint16Array.prototype.sort;
  15548. // WebKit
  15549. var ACCEPT_INCORRECT_ARGUMENTS = !!nativeSort && !fails(function () {
  15550. var array = new Uint16Array(2);
  15551. array.sort(null);
  15552. array.sort({});
  15553. });
  15554. var STABLE_SORT = !!nativeSort && !fails(function () {
  15555. // feature detection can be too slow, so check engines versions
  15556. if (V8) return V8 < 74;
  15557. if (FF) return FF < 67;
  15558. if (IE_OR_EDGE) return true;
  15559. if (WEBKIT) return WEBKIT < 602;
  15560. var array = new Uint16Array(516);
  15561. var expected = Array(516);
  15562. var index, mod;
  15563. for (index = 0; index < 516; index++) {
  15564. mod = index % 4;
  15565. array[index] = 515 - index;
  15566. expected[index] = index - 2 * mod + 3;
  15567. }
  15568. array.sort(function (a, b) {
  15569. return (a / 4 | 0) - (b / 4 | 0);
  15570. });
  15571. for (index = 0; index < 516; index++) {
  15572. if (array[index] !== expected[index]) return true;
  15573. }
  15574. });
  15575. var getSortCompare = function (comparefn) {
  15576. return function (x, y) {
  15577. if (comparefn !== undefined) return +comparefn(x, y) || 0;
  15578. // eslint-disable-next-line no-self-compare -- NaN check
  15579. if (y !== y) return -1;
  15580. // eslint-disable-next-line no-self-compare -- NaN check
  15581. if (x !== x) return 1;
  15582. if (x === 0 && y === 0) return 1 / x > 0 && 1 / y < 0 ? 1 : -1;
  15583. return x > y;
  15584. };
  15585. };
  15586. // `%TypedArray%.prototype.sort` method
  15587. // https://tc39.es/ecma262/#sec-%typedarray%.prototype.sort
  15588. exportTypedArrayMethod('sort', function sort(comparefn) {
  15589. var array = this;
  15590. if (comparefn !== undefined) aFunction(comparefn);
  15591. if (STABLE_SORT) return nativeSort.call(array, comparefn);
  15592. aTypedArray(array);
  15593. var arrayLength = toLength(array.length);
  15594. var items = Array(arrayLength);
  15595. var index;
  15596. for (index = 0; index < arrayLength; index++) {
  15597. items[index] = array[index];
  15598. }
  15599. items = internalSort(array, getSortCompare(comparefn));
  15600. for (index = 0; index < arrayLength; index++) {
  15601. array[index] = items[index];
  15602. }
  15603. return array;
  15604. }, !STABLE_SORT || ACCEPT_INCORRECT_ARGUMENTS);
  15605. },{"../internals/a-function":89,"../internals/array-buffer-view-core":96,"../internals/array-sort":109,"../internals/engine-ff-version":128,"../internals/engine-is-ie-or-edge":130,"../internals/engine-v8-version":136,"../internals/engine-webkit-version":137,"../internals/fails":140,"../internals/global":147,"../internals/to-length":221}],292:[function(require,module,exports){
  15606. 'use strict';
  15607. var ArrayBufferViewCore = require('../internals/array-buffer-view-core');
  15608. var toLength = require('../internals/to-length');
  15609. var toAbsoluteIndex = require('../internals/to-absolute-index');
  15610. var typedArraySpeciesConstructor = require('../internals/typed-array-species-constructor');
  15611. var aTypedArray = ArrayBufferViewCore.aTypedArray;
  15612. var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod;
  15613. // `%TypedArray%.prototype.subarray` method
  15614. // https://tc39.es/ecma262/#sec-%typedarray%.prototype.subarray
  15615. exportTypedArrayMethod('subarray', function subarray(begin, end) {
  15616. var O = aTypedArray(this);
  15617. var length = O.length;
  15618. var beginIndex = toAbsoluteIndex(begin, length);
  15619. var C = typedArraySpeciesConstructor(O);
  15620. return new C(
  15621. O.buffer,
  15622. O.byteOffset + beginIndex * O.BYTES_PER_ELEMENT,
  15623. toLength((end === undefined ? length : toAbsoluteIndex(end, length)) - beginIndex)
  15624. );
  15625. });
  15626. },{"../internals/array-buffer-view-core":96,"../internals/to-absolute-index":217,"../internals/to-length":221,"../internals/typed-array-species-constructor":233}],293:[function(require,module,exports){
  15627. 'use strict';
  15628. var global = require('../internals/global');
  15629. var ArrayBufferViewCore = require('../internals/array-buffer-view-core');
  15630. var fails = require('../internals/fails');
  15631. var Int8Array = global.Int8Array;
  15632. var aTypedArray = ArrayBufferViewCore.aTypedArray;
  15633. var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod;
  15634. var $toLocaleString = [].toLocaleString;
  15635. var $slice = [].slice;
  15636. // iOS Safari 6.x fails here
  15637. var TO_LOCALE_STRING_BUG = !!Int8Array && fails(function () {
  15638. $toLocaleString.call(new Int8Array(1));
  15639. });
  15640. var FORCED = fails(function () {
  15641. return [1, 2].toLocaleString() != new Int8Array([1, 2]).toLocaleString();
  15642. }) || !fails(function () {
  15643. Int8Array.prototype.toLocaleString.call([1, 2]);
  15644. });
  15645. // `%TypedArray%.prototype.toLocaleString` method
  15646. // https://tc39.es/ecma262/#sec-%typedarray%.prototype.tolocalestring
  15647. exportTypedArrayMethod('toLocaleString', function toLocaleString() {
  15648. return $toLocaleString.apply(TO_LOCALE_STRING_BUG ? $slice.call(aTypedArray(this)) : aTypedArray(this), arguments);
  15649. }, FORCED);
  15650. },{"../internals/array-buffer-view-core":96,"../internals/fails":140,"../internals/global":147}],294:[function(require,module,exports){
  15651. 'use strict';
  15652. var exportTypedArrayMethod = require('../internals/array-buffer-view-core').exportTypedArrayMethod;
  15653. var fails = require('../internals/fails');
  15654. var global = require('../internals/global');
  15655. var Uint8Array = global.Uint8Array;
  15656. var Uint8ArrayPrototype = Uint8Array && Uint8Array.prototype || {};
  15657. var arrayToString = [].toString;
  15658. var arrayJoin = [].join;
  15659. if (fails(function () { arrayToString.call({}); })) {
  15660. arrayToString = function toString() {
  15661. return arrayJoin.call(this);
  15662. };
  15663. }
  15664. var IS_NOT_ARRAY_METHOD = Uint8ArrayPrototype.toString != arrayToString;
  15665. // `%TypedArray%.prototype.toString` method
  15666. // https://tc39.es/ecma262/#sec-%typedarray%.prototype.tostring
  15667. exportTypedArrayMethod('toString', arrayToString, IS_NOT_ARRAY_METHOD);
  15668. },{"../internals/array-buffer-view-core":96,"../internals/fails":140,"../internals/global":147}],295:[function(require,module,exports){
  15669. var createTypedArrayConstructor = require('../internals/typed-array-constructor');
  15670. // `Uint8Array` constructor
  15671. // https://tc39.es/ecma262/#sec-typedarray-objects
  15672. createTypedArrayConstructor('Uint8', function (init) {
  15673. return function Uint8Array(data, byteOffset, length) {
  15674. return init(this, data, byteOffset, length);
  15675. };
  15676. });
  15677. },{"../internals/typed-array-constructor":229}],296:[function(require,module,exports){
  15678. var global = require('../internals/global');
  15679. var DOMIterables = require('../internals/dom-iterables');
  15680. var forEach = require('../internals/array-for-each');
  15681. var createNonEnumerableProperty = require('../internals/create-non-enumerable-property');
  15682. for (var COLLECTION_NAME in DOMIterables) {
  15683. var Collection = global[COLLECTION_NAME];
  15684. var CollectionPrototype = Collection && Collection.prototype;
  15685. // some Chrome versions have non-configurable methods on DOMTokenList
  15686. if (CollectionPrototype && CollectionPrototype.forEach !== forEach) try {
  15687. createNonEnumerableProperty(CollectionPrototype, 'forEach', forEach);
  15688. } catch (error) {
  15689. CollectionPrototype.forEach = forEach;
  15690. }
  15691. }
  15692. },{"../internals/array-for-each":100,"../internals/create-non-enumerable-property":120,"../internals/dom-iterables":127,"../internals/global":147}],297:[function(require,module,exports){
  15693. var global = require('../internals/global');
  15694. var DOMIterables = require('../internals/dom-iterables');
  15695. var ArrayIteratorMethods = require('../modules/es.array.iterator');
  15696. var createNonEnumerableProperty = require('../internals/create-non-enumerable-property');
  15697. var wellKnownSymbol = require('../internals/well-known-symbol');
  15698. var ITERATOR = wellKnownSymbol('iterator');
  15699. var TO_STRING_TAG = wellKnownSymbol('toStringTag');
  15700. var ArrayValues = ArrayIteratorMethods.values;
  15701. for (var COLLECTION_NAME in DOMIterables) {
  15702. var Collection = global[COLLECTION_NAME];
  15703. var CollectionPrototype = Collection && Collection.prototype;
  15704. if (CollectionPrototype) {
  15705. // some Chrome versions have non-configurable methods on DOMTokenList
  15706. if (CollectionPrototype[ITERATOR] !== ArrayValues) try {
  15707. createNonEnumerableProperty(CollectionPrototype, ITERATOR, ArrayValues);
  15708. } catch (error) {
  15709. CollectionPrototype[ITERATOR] = ArrayValues;
  15710. }
  15711. if (!CollectionPrototype[TO_STRING_TAG]) {
  15712. createNonEnumerableProperty(CollectionPrototype, TO_STRING_TAG, COLLECTION_NAME);
  15713. }
  15714. if (DOMIterables[COLLECTION_NAME]) for (var METHOD_NAME in ArrayIteratorMethods) {
  15715. // some Chrome versions have non-configurable methods on DOMTokenList
  15716. if (CollectionPrototype[METHOD_NAME] !== ArrayIteratorMethods[METHOD_NAME]) try {
  15717. createNonEnumerableProperty(CollectionPrototype, METHOD_NAME, ArrayIteratorMethods[METHOD_NAME]);
  15718. } catch (error) {
  15719. CollectionPrototype[METHOD_NAME] = ArrayIteratorMethods[METHOD_NAME];
  15720. }
  15721. }
  15722. }
  15723. }
  15724. },{"../internals/create-non-enumerable-property":120,"../internals/dom-iterables":127,"../internals/global":147,"../internals/well-known-symbol":237,"../modules/es.array.iterator":247}],298:[function(require,module,exports){
  15725. // Copyright Joyent, Inc. and other Node contributors.
  15726. //
  15727. // Permission is hereby granted, free of charge, to any person obtaining a
  15728. // copy of this software and associated documentation files (the
  15729. // "Software"), to deal in the Software without restriction, including
  15730. // without limitation the rights to use, copy, modify, merge, publish,
  15731. // distribute, sublicense, and/or sell copies of the Software, and to permit
  15732. // persons to whom the Software is furnished to do so, subject to the
  15733. // following conditions:
  15734. //
  15735. // The above copyright notice and this permission notice shall be included
  15736. // in all copies or substantial portions of the Software.
  15737. //
  15738. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  15739. // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  15740. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  15741. // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  15742. // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  15743. // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  15744. // USE OR OTHER DEALINGS IN THE SOFTWARE.
  15745. // NOTE: These type checking functions intentionally don't use `instanceof`
  15746. // because it is fragile and can be easily faked with `Object.create()`.
  15747. function isArray(arg) {
  15748. if (Array.isArray) {
  15749. return Array.isArray(arg);
  15750. }
  15751. return objectToString(arg) === '[object Array]';
  15752. }
  15753. exports.isArray = isArray;
  15754. function isBoolean(arg) {
  15755. return typeof arg === 'boolean';
  15756. }
  15757. exports.isBoolean = isBoolean;
  15758. function isNull(arg) {
  15759. return arg === null;
  15760. }
  15761. exports.isNull = isNull;
  15762. function isNullOrUndefined(arg) {
  15763. return arg == null;
  15764. }
  15765. exports.isNullOrUndefined = isNullOrUndefined;
  15766. function isNumber(arg) {
  15767. return typeof arg === 'number';
  15768. }
  15769. exports.isNumber = isNumber;
  15770. function isString(arg) {
  15771. return typeof arg === 'string';
  15772. }
  15773. exports.isString = isString;
  15774. function isSymbol(arg) {
  15775. return typeof arg === 'symbol';
  15776. }
  15777. exports.isSymbol = isSymbol;
  15778. function isUndefined(arg) {
  15779. return arg === void 0;
  15780. }
  15781. exports.isUndefined = isUndefined;
  15782. function isRegExp(re) {
  15783. return objectToString(re) === '[object RegExp]';
  15784. }
  15785. exports.isRegExp = isRegExp;
  15786. function isObject(arg) {
  15787. return typeof arg === 'object' && arg !== null;
  15788. }
  15789. exports.isObject = isObject;
  15790. function isDate(d) {
  15791. return objectToString(d) === '[object Date]';
  15792. }
  15793. exports.isDate = isDate;
  15794. function isError(e) {
  15795. return (objectToString(e) === '[object Error]' || e instanceof Error);
  15796. }
  15797. exports.isError = isError;
  15798. function isFunction(arg) {
  15799. return typeof arg === 'function';
  15800. }
  15801. exports.isFunction = isFunction;
  15802. function isPrimitive(arg) {
  15803. return arg === null ||
  15804. typeof arg === 'boolean' ||
  15805. typeof arg === 'number' ||
  15806. typeof arg === 'string' ||
  15807. typeof arg === 'symbol' || // ES6 symbol
  15808. typeof arg === 'undefined';
  15809. }
  15810. exports.isPrimitive = isPrimitive;
  15811. exports.isBuffer = require('buffer').Buffer.isBuffer;
  15812. function objectToString(o) {
  15813. return Object.prototype.toString.call(o);
  15814. }
  15815. },{"buffer":85}],299:[function(require,module,exports){
  15816. /*
  15817. * Date Format 1.2.3
  15818. * (c) 2007-2009 Steven Levithan <stevenlevithan.com>
  15819. * MIT license
  15820. *
  15821. * Includes enhancements by Scott Trenda <scott.trenda.net>
  15822. * and Kris Kowal <cixar.com/~kris.kowal/>
  15823. *
  15824. * Accepts a date, a mask, or a date and a mask.
  15825. * Returns a formatted version of the given date.
  15826. * The date defaults to the current date/time.
  15827. * The mask defaults to dateFormat.masks.default.
  15828. */
  15829. (function(global) {
  15830. 'use strict';
  15831. var dateFormat = (function() {
  15832. var token = /d{1,4}|m{1,4}|yy(?:yy)?|([HhMsTt])\1?|[LloSZWN]|'[^']*'|'[^']*'/g;
  15833. var timezone = /\b(?:[PMCEA][SDP]T|(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time|(?:GMT|UTC)(?:[-+]\d{4})?)\b/g;
  15834. var timezoneClip = /[^-+\dA-Z]/g;
  15835. // Regexes and supporting functions are cached through closure
  15836. return function (date, mask, utc, gmt) {
  15837. // You can't provide utc if you skip other args (use the 'UTC:' mask prefix)
  15838. if (arguments.length === 1 && kindOf(date) === 'string' && !/\d/.test(date)) {
  15839. mask = date;
  15840. date = undefined;
  15841. }
  15842. date = date || new Date;
  15843. if(!(date instanceof Date)) {
  15844. date = new Date(date);
  15845. }
  15846. if (isNaN(date)) {
  15847. throw TypeError('Invalid date');
  15848. }
  15849. mask = String(dateFormat.masks[mask] || mask || dateFormat.masks['default']);
  15850. // Allow setting the utc/gmt argument via the mask
  15851. var maskSlice = mask.slice(0, 4);
  15852. if (maskSlice === 'UTC:' || maskSlice === 'GMT:') {
  15853. mask = mask.slice(4);
  15854. utc = true;
  15855. if (maskSlice === 'GMT:') {
  15856. gmt = true;
  15857. }
  15858. }
  15859. var _ = utc ? 'getUTC' : 'get';
  15860. var d = date[_ + 'Date']();
  15861. var D = date[_ + 'Day']();
  15862. var m = date[_ + 'Month']();
  15863. var y = date[_ + 'FullYear']();
  15864. var H = date[_ + 'Hours']();
  15865. var M = date[_ + 'Minutes']();
  15866. var s = date[_ + 'Seconds']();
  15867. var L = date[_ + 'Milliseconds']();
  15868. var o = utc ? 0 : date.getTimezoneOffset();
  15869. var W = getWeek(date);
  15870. var N = getDayOfWeek(date);
  15871. var flags = {
  15872. d: d,
  15873. dd: pad(d),
  15874. ddd: dateFormat.i18n.dayNames[D],
  15875. dddd: dateFormat.i18n.dayNames[D + 7],
  15876. m: m + 1,
  15877. mm: pad(m + 1),
  15878. mmm: dateFormat.i18n.monthNames[m],
  15879. mmmm: dateFormat.i18n.monthNames[m + 12],
  15880. yy: String(y).slice(2),
  15881. yyyy: y,
  15882. h: H % 12 || 12,
  15883. hh: pad(H % 12 || 12),
  15884. H: H,
  15885. HH: pad(H),
  15886. M: M,
  15887. MM: pad(M),
  15888. s: s,
  15889. ss: pad(s),
  15890. l: pad(L, 3),
  15891. L: pad(Math.round(L / 10)),
  15892. t: H < 12 ? 'a' : 'p',
  15893. tt: H < 12 ? 'am' : 'pm',
  15894. T: H < 12 ? 'A' : 'P',
  15895. TT: H < 12 ? 'AM' : 'PM',
  15896. Z: gmt ? 'GMT' : utc ? 'UTC' : (String(date).match(timezone) || ['']).pop().replace(timezoneClip, ''),
  15897. o: (o > 0 ? '-' : '+') + pad(Math.floor(Math.abs(o) / 60) * 100 + Math.abs(o) % 60, 4),
  15898. S: ['th', 'st', 'nd', 'rd'][d % 10 > 3 ? 0 : (d % 100 - d % 10 != 10) * d % 10],
  15899. W: W,
  15900. N: N
  15901. };
  15902. return mask.replace(token, function (match) {
  15903. if (match in flags) {
  15904. return flags[match];
  15905. }
  15906. return match.slice(1, match.length - 1);
  15907. });
  15908. };
  15909. })();
  15910. dateFormat.masks = {
  15911. 'default': 'ddd mmm dd yyyy HH:MM:ss',
  15912. 'shortDate': 'm/d/yy',
  15913. 'mediumDate': 'mmm d, yyyy',
  15914. 'longDate': 'mmmm d, yyyy',
  15915. 'fullDate': 'dddd, mmmm d, yyyy',
  15916. 'shortTime': 'h:MM TT',
  15917. 'mediumTime': 'h:MM:ss TT',
  15918. 'longTime': 'h:MM:ss TT Z',
  15919. 'isoDate': 'yyyy-mm-dd',
  15920. 'isoTime': 'HH:MM:ss',
  15921. 'isoDateTime': 'yyyy-mm-dd\'T\'HH:MM:sso',
  15922. 'isoUtcDateTime': 'UTC:yyyy-mm-dd\'T\'HH:MM:ss\'Z\'',
  15923. 'expiresHeaderFormat': 'ddd, dd mmm yyyy HH:MM:ss Z'
  15924. };
  15925. // Internationalization strings
  15926. dateFormat.i18n = {
  15927. dayNames: [
  15928. 'Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat',
  15929. 'Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'
  15930. ],
  15931. monthNames: [
  15932. 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec',
  15933. 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'
  15934. ]
  15935. };
  15936. function pad(val, len) {
  15937. val = String(val);
  15938. len = len || 2;
  15939. while (val.length < len) {
  15940. val = '0' + val;
  15941. }
  15942. return val;
  15943. }
  15944. /**
  15945. * Get the ISO 8601 week number
  15946. * Based on comments from
  15947. * http://techblog.procurios.nl/k/n618/news/view/33796/14863/Calculate-ISO-8601-week-and-year-in-javascript.html
  15948. *
  15949. * @param {Object} `date`
  15950. * @return {Number}
  15951. */
  15952. function getWeek(date) {
  15953. // Remove time components of date
  15954. var targetThursday = new Date(date.getFullYear(), date.getMonth(), date.getDate());
  15955. // Change date to Thursday same week
  15956. targetThursday.setDate(targetThursday.getDate() - ((targetThursday.getDay() + 6) % 7) + 3);
  15957. // Take January 4th as it is always in week 1 (see ISO 8601)
  15958. var firstThursday = new Date(targetThursday.getFullYear(), 0, 4);
  15959. // Change date to Thursday same week
  15960. firstThursday.setDate(firstThursday.getDate() - ((firstThursday.getDay() + 6) % 7) + 3);
  15961. // Check if daylight-saving-time-switch occurred and correct for it
  15962. var ds = targetThursday.getTimezoneOffset() - firstThursday.getTimezoneOffset();
  15963. targetThursday.setHours(targetThursday.getHours() - ds);
  15964. // Number of weeks between target Thursday and first Thursday
  15965. var weekDiff = (targetThursday - firstThursday) / (86400000*7);
  15966. return 1 + Math.floor(weekDiff);
  15967. }
  15968. /**
  15969. * Get ISO-8601 numeric representation of the day of the week
  15970. * 1 (for Monday) through 7 (for Sunday)
  15971. *
  15972. * @param {Object} `date`
  15973. * @return {Number}
  15974. */
  15975. function getDayOfWeek(date) {
  15976. var dow = date.getDay();
  15977. if(dow === 0) {
  15978. dow = 7;
  15979. }
  15980. return dow;
  15981. }
  15982. /**
  15983. * kind-of shortcut
  15984. * @param {*} val
  15985. * @return {String}
  15986. */
  15987. function kindOf(val) {
  15988. if (val === null) {
  15989. return 'null';
  15990. }
  15991. if (val === undefined) {
  15992. return 'undefined';
  15993. }
  15994. if (typeof val !== 'object') {
  15995. return typeof val;
  15996. }
  15997. if (Array.isArray(val)) {
  15998. return 'array';
  15999. }
  16000. return {}.toString.call(val)
  16001. .slice(8, -1).toLowerCase();
  16002. };
  16003. if (typeof define === 'function' && define.amd) {
  16004. define(function () {
  16005. return dateFormat;
  16006. });
  16007. } else if (typeof exports === 'object') {
  16008. module.exports = dateFormat;
  16009. } else {
  16010. global.dateFormat = dateFormat;
  16011. }
  16012. })(this);
  16013. },{}],300:[function(require,module,exports){
  16014. /*!
  16015. * escape-html
  16016. * Copyright(c) 2012-2013 TJ Holowaychuk
  16017. * Copyright(c) 2015 Andreas Lubbe
  16018. * Copyright(c) 2015 Tiancheng "Timothy" Gu
  16019. * MIT Licensed
  16020. */
  16021. 'use strict';
  16022. /**
  16023. * Module variables.
  16024. * @private
  16025. */
  16026. var matchHtmlRegExp = /["'&<>]/;
  16027. /**
  16028. * Module exports.
  16029. * @public
  16030. */
  16031. module.exports = escapeHtml;
  16032. /**
  16033. * Escape special characters in the given string of html.
  16034. *
  16035. * @param {string} string The string to escape for inserting into HTML
  16036. * @return {string}
  16037. * @public
  16038. */
  16039. function escapeHtml(string) {
  16040. var str = '' + string;
  16041. var match = matchHtmlRegExp.exec(str);
  16042. if (!match) {
  16043. return str;
  16044. }
  16045. var escape;
  16046. var html = '';
  16047. var index = 0;
  16048. var lastIndex = 0;
  16049. for (index = match.index; index < str.length; index++) {
  16050. switch (str.charCodeAt(index)) {
  16051. case 34: // "
  16052. escape = '&quot;';
  16053. break;
  16054. case 38: // &
  16055. escape = '&amp;';
  16056. break;
  16057. case 39: // '
  16058. escape = '&#39;';
  16059. break;
  16060. case 60: // <
  16061. escape = '&lt;';
  16062. break;
  16063. case 62: // >
  16064. escape = '&gt;';
  16065. break;
  16066. default:
  16067. continue;
  16068. }
  16069. if (lastIndex !== index) {
  16070. html += str.substring(lastIndex, index);
  16071. }
  16072. lastIndex = index + 1;
  16073. html += escape;
  16074. }
  16075. return lastIndex !== index
  16076. ? html + str.substring(lastIndex, index)
  16077. : html;
  16078. }
  16079. },{}],301:[function(require,module,exports){
  16080. // Copyright Joyent, Inc. and other Node contributors.
  16081. //
  16082. // Permission is hereby granted, free of charge, to any person obtaining a
  16083. // copy of this software and associated documentation files (the
  16084. // "Software"), to deal in the Software without restriction, including
  16085. // without limitation the rights to use, copy, modify, merge, publish,
  16086. // distribute, sublicense, and/or sell copies of the Software, and to permit
  16087. // persons to whom the Software is furnished to do so, subject to the
  16088. // following conditions:
  16089. //
  16090. // The above copyright notice and this permission notice shall be included
  16091. // in all copies or substantial portions of the Software.
  16092. //
  16093. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  16094. // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  16095. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  16096. // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  16097. // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  16098. // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  16099. // USE OR OTHER DEALINGS IN THE SOFTWARE.
  16100. function EventEmitter() {
  16101. this._events = this._events || {};
  16102. this._maxListeners = this._maxListeners || undefined;
  16103. }
  16104. module.exports = EventEmitter;
  16105. // Backwards-compat with node 0.10.x
  16106. EventEmitter.EventEmitter = EventEmitter;
  16107. EventEmitter.prototype._events = undefined;
  16108. EventEmitter.prototype._maxListeners = undefined;
  16109. // By default EventEmitters will print a warning if more than 10 listeners are
  16110. // added to it. This is a useful default which helps finding memory leaks.
  16111. EventEmitter.defaultMaxListeners = 10;
  16112. // Obviously not all Emitters should be limited to 10. This function allows
  16113. // that to be increased. Set to zero for unlimited.
  16114. EventEmitter.prototype.setMaxListeners = function(n) {
  16115. if (!isNumber(n) || n < 0 || isNaN(n))
  16116. throw TypeError('n must be a positive number');
  16117. this._maxListeners = n;
  16118. return this;
  16119. };
  16120. EventEmitter.prototype.emit = function(type) {
  16121. var er, handler, len, args, i, listeners;
  16122. if (!this._events)
  16123. this._events = {};
  16124. // If there is no 'error' event listener then throw.
  16125. if (type === 'error') {
  16126. if (!this._events.error ||
  16127. (isObject(this._events.error) && !this._events.error.length)) {
  16128. er = arguments[1];
  16129. if (er instanceof Error) {
  16130. throw er; // Unhandled 'error' event
  16131. } else {
  16132. // At least give some kind of context to the user
  16133. var err = new Error('Uncaught, unspecified "error" event. (' + er + ')');
  16134. err.context = er;
  16135. throw err;
  16136. }
  16137. }
  16138. }
  16139. handler = this._events[type];
  16140. if (isUndefined(handler))
  16141. return false;
  16142. if (isFunction(handler)) {
  16143. switch (arguments.length) {
  16144. // fast cases
  16145. case 1:
  16146. handler.call(this);
  16147. break;
  16148. case 2:
  16149. handler.call(this, arguments[1]);
  16150. break;
  16151. case 3:
  16152. handler.call(this, arguments[1], arguments[2]);
  16153. break;
  16154. // slower
  16155. default:
  16156. args = Array.prototype.slice.call(arguments, 1);
  16157. handler.apply(this, args);
  16158. }
  16159. } else if (isObject(handler)) {
  16160. args = Array.prototype.slice.call(arguments, 1);
  16161. listeners = handler.slice();
  16162. len = listeners.length;
  16163. for (i = 0; i < len; i++)
  16164. listeners[i].apply(this, args);
  16165. }
  16166. return true;
  16167. };
  16168. EventEmitter.prototype.addListener = function(type, listener) {
  16169. var m;
  16170. if (!isFunction(listener))
  16171. throw TypeError('listener must be a function');
  16172. if (!this._events)
  16173. this._events = {};
  16174. // To avoid recursion in the case that type === "newListener"! Before
  16175. // adding it to the listeners, first emit "newListener".
  16176. if (this._events.newListener)
  16177. this.emit('newListener', type,
  16178. isFunction(listener.listener) ?
  16179. listener.listener : listener);
  16180. if (!this._events[type])
  16181. // Optimize the case of one listener. Don't need the extra array object.
  16182. this._events[type] = listener;
  16183. else if (isObject(this._events[type]))
  16184. // If we've already got an array, just append.
  16185. this._events[type].push(listener);
  16186. else
  16187. // Adding the second element, need to change to array.
  16188. this._events[type] = [this._events[type], listener];
  16189. // Check for listener leak
  16190. if (isObject(this._events[type]) && !this._events[type].warned) {
  16191. if (!isUndefined(this._maxListeners)) {
  16192. m = this._maxListeners;
  16193. } else {
  16194. m = EventEmitter.defaultMaxListeners;
  16195. }
  16196. if (m && m > 0 && this._events[type].length > m) {
  16197. this._events[type].warned = true;
  16198. console.error('(node) warning: possible EventEmitter memory ' +
  16199. 'leak detected. %d listeners added. ' +
  16200. 'Use emitter.setMaxListeners() to increase limit.',
  16201. this._events[type].length);
  16202. if (typeof console.trace === 'function') {
  16203. // not supported in IE 10
  16204. console.trace();
  16205. }
  16206. }
  16207. }
  16208. return this;
  16209. };
  16210. EventEmitter.prototype.on = EventEmitter.prototype.addListener;
  16211. EventEmitter.prototype.once = function(type, listener) {
  16212. if (!isFunction(listener))
  16213. throw TypeError('listener must be a function');
  16214. var fired = false;
  16215. function g() {
  16216. this.removeListener(type, g);
  16217. if (!fired) {
  16218. fired = true;
  16219. listener.apply(this, arguments);
  16220. }
  16221. }
  16222. g.listener = listener;
  16223. this.on(type, g);
  16224. return this;
  16225. };
  16226. // emits a 'removeListener' event iff the listener was removed
  16227. EventEmitter.prototype.removeListener = function(type, listener) {
  16228. var list, position, length, i;
  16229. if (!isFunction(listener))
  16230. throw TypeError('listener must be a function');
  16231. if (!this._events || !this._events[type])
  16232. return this;
  16233. list = this._events[type];
  16234. length = list.length;
  16235. position = -1;
  16236. if (list === listener ||
  16237. (isFunction(list.listener) && list.listener === listener)) {
  16238. delete this._events[type];
  16239. if (this._events.removeListener)
  16240. this.emit('removeListener', type, listener);
  16241. } else if (isObject(list)) {
  16242. for (i = length; i-- > 0;) {
  16243. if (list[i] === listener ||
  16244. (list[i].listener && list[i].listener === listener)) {
  16245. position = i;
  16246. break;
  16247. }
  16248. }
  16249. if (position < 0)
  16250. return this;
  16251. if (list.length === 1) {
  16252. list.length = 0;
  16253. delete this._events[type];
  16254. } else {
  16255. list.splice(position, 1);
  16256. }
  16257. if (this._events.removeListener)
  16258. this.emit('removeListener', type, listener);
  16259. }
  16260. return this;
  16261. };
  16262. EventEmitter.prototype.removeAllListeners = function(type) {
  16263. var key, listeners;
  16264. if (!this._events)
  16265. return this;
  16266. // not listening for removeListener, no need to emit
  16267. if (!this._events.removeListener) {
  16268. if (arguments.length === 0)
  16269. this._events = {};
  16270. else if (this._events[type])
  16271. delete this._events[type];
  16272. return this;
  16273. }
  16274. // emit removeListener for all listeners on all events
  16275. if (arguments.length === 0) {
  16276. for (key in this._events) {
  16277. if (key === 'removeListener') continue;
  16278. this.removeAllListeners(key);
  16279. }
  16280. this.removeAllListeners('removeListener');
  16281. this._events = {};
  16282. return this;
  16283. }
  16284. listeners = this._events[type];
  16285. if (isFunction(listeners)) {
  16286. this.removeListener(type, listeners);
  16287. } else if (listeners) {
  16288. // LIFO order
  16289. while (listeners.length)
  16290. this.removeListener(type, listeners[listeners.length - 1]);
  16291. }
  16292. delete this._events[type];
  16293. return this;
  16294. };
  16295. EventEmitter.prototype.listeners = function(type) {
  16296. var ret;
  16297. if (!this._events || !this._events[type])
  16298. ret = [];
  16299. else if (isFunction(this._events[type]))
  16300. ret = [this._events[type]];
  16301. else
  16302. ret = this._events[type].slice();
  16303. return ret;
  16304. };
  16305. EventEmitter.prototype.listenerCount = function(type) {
  16306. if (this._events) {
  16307. var evlistener = this._events[type];
  16308. if (isFunction(evlistener))
  16309. return 1;
  16310. else if (evlistener)
  16311. return evlistener.length;
  16312. }
  16313. return 0;
  16314. };
  16315. EventEmitter.listenerCount = function(emitter, type) {
  16316. return emitter.listenerCount(type);
  16317. };
  16318. function isFunction(arg) {
  16319. return typeof arg === 'function';
  16320. }
  16321. function isNumber(arg) {
  16322. return typeof arg === 'number';
  16323. }
  16324. function isObject(arg) {
  16325. return typeof arg === 'object' && arg !== null;
  16326. }
  16327. function isUndefined(arg) {
  16328. return arg === void 0;
  16329. }
  16330. },{}],302:[function(require,module,exports){
  16331. var http = require('http');
  16332. var https = module.exports;
  16333. for (var key in http) {
  16334. if (http.hasOwnProperty(key)) https[key] = http[key];
  16335. };
  16336. https.request = function (params, cb) {
  16337. if (!params) params = {};
  16338. params.scheme = 'https';
  16339. params.protocol = 'https:';
  16340. return http.request.call(this, params, cb);
  16341. }
  16342. },{"http":400}],303:[function(require,module,exports){
  16343. /*!
  16344. * humanize-ms - index.js
  16345. * Copyright(c) 2014 dead_horse <dead_horse@qq.com>
  16346. * MIT Licensed
  16347. */
  16348. 'use strict';
  16349. /**
  16350. * Module dependencies.
  16351. */
  16352. var util = require('util');
  16353. var ms = require('ms');
  16354. module.exports = function (t) {
  16355. if (typeof t === 'number') return t;
  16356. var r = ms(t);
  16357. if (r === undefined) {
  16358. var err = new Error(util.format('humanize-ms(%j) result undefined', t));
  16359. console.warn(err.stack);
  16360. }
  16361. return r;
  16362. };
  16363. },{"ms":319,"util":352}],304:[function(require,module,exports){
  16364. /*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
  16365. exports.read = function (buffer, offset, isLE, mLen, nBytes) {
  16366. var e, m
  16367. var eLen = (nBytes * 8) - mLen - 1
  16368. var eMax = (1 << eLen) - 1
  16369. var eBias = eMax >> 1
  16370. var nBits = -7
  16371. var i = isLE ? (nBytes - 1) : 0
  16372. var d = isLE ? -1 : 1
  16373. var s = buffer[offset + i]
  16374. i += d
  16375. e = s & ((1 << (-nBits)) - 1)
  16376. s >>= (-nBits)
  16377. nBits += eLen
  16378. for (; nBits > 0; e = (e * 256) + buffer[offset + i], i += d, nBits -= 8) {}
  16379. m = e & ((1 << (-nBits)) - 1)
  16380. e >>= (-nBits)
  16381. nBits += mLen
  16382. for (; nBits > 0; m = (m * 256) + buffer[offset + i], i += d, nBits -= 8) {}
  16383. if (e === 0) {
  16384. e = 1 - eBias
  16385. } else if (e === eMax) {
  16386. return m ? NaN : ((s ? -1 : 1) * Infinity)
  16387. } else {
  16388. m = m + Math.pow(2, mLen)
  16389. e = e - eBias
  16390. }
  16391. return (s ? -1 : 1) * m * Math.pow(2, e - mLen)
  16392. }
  16393. exports.write = function (buffer, value, offset, isLE, mLen, nBytes) {
  16394. var e, m, c
  16395. var eLen = (nBytes * 8) - mLen - 1
  16396. var eMax = (1 << eLen) - 1
  16397. var eBias = eMax >> 1
  16398. var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0)
  16399. var i = isLE ? 0 : (nBytes - 1)
  16400. var d = isLE ? 1 : -1
  16401. var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0
  16402. value = Math.abs(value)
  16403. if (isNaN(value) || value === Infinity) {
  16404. m = isNaN(value) ? 1 : 0
  16405. e = eMax
  16406. } else {
  16407. e = Math.floor(Math.log(value) / Math.LN2)
  16408. if (value * (c = Math.pow(2, -e)) < 1) {
  16409. e--
  16410. c *= 2
  16411. }
  16412. if (e + eBias >= 1) {
  16413. value += rt / c
  16414. } else {
  16415. value += rt * Math.pow(2, 1 - eBias)
  16416. }
  16417. if (value * c >= 2) {
  16418. e++
  16419. c /= 2
  16420. }
  16421. if (e + eBias >= eMax) {
  16422. m = 0
  16423. e = eMax
  16424. } else if (e + eBias >= 1) {
  16425. m = ((value * c) - 1) * Math.pow(2, mLen)
  16426. e = e + eBias
  16427. } else {
  16428. m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen)
  16429. e = 0
  16430. }
  16431. }
  16432. for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}
  16433. e = (e << mLen) | m
  16434. eLen += mLen
  16435. for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}
  16436. buffer[offset + i - d] |= s * 128
  16437. }
  16438. },{}],305:[function(require,module,exports){
  16439. 'use strict';
  16440. var types = [
  16441. require('./nextTick'),
  16442. require('./queueMicrotask'),
  16443. require('./mutation.js'),
  16444. require('./messageChannel'),
  16445. require('./stateChange'),
  16446. require('./timeout')
  16447. ];
  16448. var draining;
  16449. var currentQueue;
  16450. var queueIndex = -1;
  16451. var queue = [];
  16452. var scheduled = false;
  16453. function cleanUpNextTick() {
  16454. if (!draining || !currentQueue) {
  16455. return;
  16456. }
  16457. draining = false;
  16458. if (currentQueue.length) {
  16459. queue = currentQueue.concat(queue);
  16460. } else {
  16461. queueIndex = -1;
  16462. }
  16463. if (queue.length) {
  16464. nextTick();
  16465. }
  16466. }
  16467. //named nextTick for less confusing stack traces
  16468. function nextTick() {
  16469. if (draining) {
  16470. return;
  16471. }
  16472. scheduled = false;
  16473. draining = true;
  16474. var len = queue.length;
  16475. var timeout = setTimeout(cleanUpNextTick);
  16476. while (len) {
  16477. currentQueue = queue;
  16478. queue = [];
  16479. while (currentQueue && ++queueIndex < len) {
  16480. currentQueue[queueIndex].run();
  16481. }
  16482. queueIndex = -1;
  16483. len = queue.length;
  16484. }
  16485. currentQueue = null;
  16486. queueIndex = -1;
  16487. draining = false;
  16488. clearTimeout(timeout);
  16489. }
  16490. var scheduleDrain;
  16491. var i = -1;
  16492. var len = types.length;
  16493. while (++i < len) {
  16494. if (types[i] && types[i].test && types[i].test()) {
  16495. scheduleDrain = types[i].install(nextTick);
  16496. break;
  16497. }
  16498. }
  16499. // v8 likes predictible objects
  16500. function Item(fun, array) {
  16501. this.fun = fun;
  16502. this.array = array;
  16503. }
  16504. Item.prototype.run = function () {
  16505. var fun = this.fun;
  16506. var array = this.array;
  16507. switch (array.length) {
  16508. case 0:
  16509. return fun();
  16510. case 1:
  16511. return fun(array[0]);
  16512. case 2:
  16513. return fun(array[0], array[1]);
  16514. case 3:
  16515. return fun(array[0], array[1], array[2]);
  16516. default:
  16517. return fun.apply(null, array);
  16518. }
  16519. };
  16520. module.exports = immediate;
  16521. function immediate(task) {
  16522. var args = new Array(arguments.length - 1);
  16523. if (arguments.length > 1) {
  16524. for (var i = 1; i < arguments.length; i++) {
  16525. args[i - 1] = arguments[i];
  16526. }
  16527. }
  16528. queue.push(new Item(task, args));
  16529. if (!scheduled && !draining) {
  16530. scheduled = true;
  16531. scheduleDrain();
  16532. }
  16533. }
  16534. },{"./messageChannel":306,"./mutation.js":307,"./nextTick":84,"./queueMicrotask":308,"./stateChange":309,"./timeout":310}],306:[function(require,module,exports){
  16535. (function (global){(function (){
  16536. 'use strict';
  16537. exports.test = function () {
  16538. if (global.setImmediate) {
  16539. // we can only get here in IE10
  16540. // which doesn't handel postMessage well
  16541. return false;
  16542. }
  16543. return typeof global.MessageChannel !== 'undefined';
  16544. };
  16545. exports.install = function (func) {
  16546. var channel = new global.MessageChannel();
  16547. channel.port1.onmessage = func;
  16548. return function () {
  16549. channel.port2.postMessage(0);
  16550. };
  16551. };
  16552. }).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
  16553. },{}],307:[function(require,module,exports){
  16554. (function (global){(function (){
  16555. 'use strict';
  16556. //based off rsvp https://github.com/tildeio/rsvp.js
  16557. //license https://github.com/tildeio/rsvp.js/blob/master/LICENSE
  16558. //https://github.com/tildeio/rsvp.js/blob/master/lib/rsvp/asap.js
  16559. var Mutation = global.MutationObserver || global.WebKitMutationObserver;
  16560. exports.test = function () {
  16561. return Mutation;
  16562. };
  16563. exports.install = function (handle) {
  16564. var called = 0;
  16565. var observer = new Mutation(handle);
  16566. var element = global.document.createTextNode('');
  16567. observer.observe(element, {
  16568. characterData: true
  16569. });
  16570. return function () {
  16571. element.data = (called = ++called % 2);
  16572. };
  16573. };
  16574. }).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
  16575. },{}],308:[function(require,module,exports){
  16576. (function (global){(function (){
  16577. 'use strict';
  16578. exports.test = function () {
  16579. return typeof global.queueMicrotask === 'function';
  16580. };
  16581. exports.install = function (func) {
  16582. return function () {
  16583. global.queueMicrotask(func);
  16584. };
  16585. };
  16586. }).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
  16587. },{}],309:[function(require,module,exports){
  16588. (function (global){(function (){
  16589. 'use strict';
  16590. exports.test = function () {
  16591. return 'document' in global && 'onreadystatechange' in global.document.createElement('script');
  16592. };
  16593. exports.install = function (handle) {
  16594. return function () {
  16595. // Create a <script> element; its readystatechange event will be fired asynchronously once it is inserted
  16596. // into the document. Do so, thus queuing up the task. Remember to clean up once it's been called.
  16597. var scriptEl = global.document.createElement('script');
  16598. scriptEl.onreadystatechange = function () {
  16599. handle();
  16600. scriptEl.onreadystatechange = null;
  16601. scriptEl.parentNode.removeChild(scriptEl);
  16602. scriptEl = null;
  16603. };
  16604. global.document.documentElement.appendChild(scriptEl);
  16605. return handle;
  16606. };
  16607. };
  16608. }).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
  16609. },{}],310:[function(require,module,exports){
  16610. 'use strict';
  16611. exports.test = function () {
  16612. return true;
  16613. };
  16614. exports.install = function (t) {
  16615. return function () {
  16616. setTimeout(t, 0);
  16617. };
  16618. };
  16619. },{}],311:[function(require,module,exports){
  16620. if (typeof Object.create === 'function') {
  16621. // implementation from standard node.js 'util' module
  16622. module.exports = function inherits(ctor, superCtor) {
  16623. if (superCtor) {
  16624. ctor.super_ = superCtor
  16625. ctor.prototype = Object.create(superCtor.prototype, {
  16626. constructor: {
  16627. value: ctor,
  16628. enumerable: false,
  16629. writable: true,
  16630. configurable: true
  16631. }
  16632. })
  16633. }
  16634. };
  16635. } else {
  16636. // old school shim for old browsers
  16637. module.exports = function inherits(ctor, superCtor) {
  16638. if (superCtor) {
  16639. ctor.super_ = superCtor
  16640. var TempCtor = function () {}
  16641. TempCtor.prototype = superCtor.prototype
  16642. ctor.prototype = new TempCtor()
  16643. ctor.prototype.constructor = ctor
  16644. }
  16645. }
  16646. }
  16647. },{}],312:[function(require,module,exports){
  16648. /*!
  16649. * Determine if an object is a Buffer
  16650. *
  16651. * @author Feross Aboukhadijeh <https://feross.org>
  16652. * @license MIT
  16653. */
  16654. // The _isBuffer check is for Safari 5-7 support, because it's missing
  16655. // Object.prototype.constructor. Remove this eventually
  16656. module.exports = function (obj) {
  16657. return obj != null && (isBuffer(obj) || isSlowBuffer(obj) || !!obj._isBuffer)
  16658. }
  16659. function isBuffer (obj) {
  16660. return !!obj.constructor && typeof obj.constructor.isBuffer === 'function' && obj.constructor.isBuffer(obj)
  16661. }
  16662. // For Node v0.10 support. Remove this eventually.
  16663. function isSlowBuffer (obj) {
  16664. return typeof obj.readFloatLE === 'function' && typeof obj.slice === 'function' && isBuffer(obj.slice(0, 0))
  16665. }
  16666. },{}],313:[function(require,module,exports){
  16667. var toString = {}.toString;
  16668. module.exports = Array.isArray || function (arr) {
  16669. return toString.call(arr) == '[object Array]';
  16670. };
  16671. },{}],314:[function(require,module,exports){
  16672. (function (global){(function (){
  16673. /*
  16674. * base64.js
  16675. *
  16676. * Licensed under the BSD 3-Clause License.
  16677. * http://opensource.org/licenses/BSD-3-Clause
  16678. *
  16679. * References:
  16680. * http://en.wikipedia.org/wiki/Base64
  16681. */
  16682. ;(function (global, factory) {
  16683. typeof exports === 'object' && typeof module !== 'undefined'
  16684. ? module.exports = factory(global)
  16685. : typeof define === 'function' && define.amd
  16686. ? define(factory) : factory(global)
  16687. }((
  16688. typeof self !== 'undefined' ? self
  16689. : typeof window !== 'undefined' ? window
  16690. : typeof global !== 'undefined' ? global
  16691. : this
  16692. ), function(global) {
  16693. 'use strict';
  16694. // existing version for noConflict()
  16695. global = global || {};
  16696. var _Base64 = global.Base64;
  16697. var version = "2.6.4";
  16698. // constants
  16699. var b64chars
  16700. = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
  16701. var b64tab = function(bin) {
  16702. var t = {};
  16703. for (var i = 0, l = bin.length; i < l; i++) t[bin.charAt(i)] = i;
  16704. return t;
  16705. }(b64chars);
  16706. var fromCharCode = String.fromCharCode;
  16707. // encoder stuff
  16708. var cb_utob = function(c) {
  16709. if (c.length < 2) {
  16710. var cc = c.charCodeAt(0);
  16711. return cc < 0x80 ? c
  16712. : cc < 0x800 ? (fromCharCode(0xc0 | (cc >>> 6))
  16713. + fromCharCode(0x80 | (cc & 0x3f)))
  16714. : (fromCharCode(0xe0 | ((cc >>> 12) & 0x0f))
  16715. + fromCharCode(0x80 | ((cc >>> 6) & 0x3f))
  16716. + fromCharCode(0x80 | ( cc & 0x3f)));
  16717. } else {
  16718. var cc = 0x10000
  16719. + (c.charCodeAt(0) - 0xD800) * 0x400
  16720. + (c.charCodeAt(1) - 0xDC00);
  16721. return (fromCharCode(0xf0 | ((cc >>> 18) & 0x07))
  16722. + fromCharCode(0x80 | ((cc >>> 12) & 0x3f))
  16723. + fromCharCode(0x80 | ((cc >>> 6) & 0x3f))
  16724. + fromCharCode(0x80 | ( cc & 0x3f)));
  16725. }
  16726. };
  16727. var re_utob = /[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g;
  16728. var utob = function(u) {
  16729. return u.replace(re_utob, cb_utob);
  16730. };
  16731. var cb_encode = function(ccc) {
  16732. var padlen = [0, 2, 1][ccc.length % 3],
  16733. ord = ccc.charCodeAt(0) << 16
  16734. | ((ccc.length > 1 ? ccc.charCodeAt(1) : 0) << 8)
  16735. | ((ccc.length > 2 ? ccc.charCodeAt(2) : 0)),
  16736. chars = [
  16737. b64chars.charAt( ord >>> 18),
  16738. b64chars.charAt((ord >>> 12) & 63),
  16739. padlen >= 2 ? '=' : b64chars.charAt((ord >>> 6) & 63),
  16740. padlen >= 1 ? '=' : b64chars.charAt(ord & 63)
  16741. ];
  16742. return chars.join('');
  16743. };
  16744. var btoa = global.btoa && typeof global.btoa == 'function'
  16745. ? function(b){ return global.btoa(b) } : function(b) {
  16746. if (b.match(/[^\x00-\xFF]/)) throw new RangeError(
  16747. 'The string contains invalid characters.'
  16748. );
  16749. return b.replace(/[\s\S]{1,3}/g, cb_encode);
  16750. };
  16751. var _encode = function(u) {
  16752. return btoa(utob(String(u)));
  16753. };
  16754. var mkUriSafe = function (b64) {
  16755. return b64.replace(/[+\/]/g, function(m0) {
  16756. return m0 == '+' ? '-' : '_';
  16757. }).replace(/=/g, '');
  16758. };
  16759. var encode = function(u, urisafe) {
  16760. return urisafe ? mkUriSafe(_encode(u)) : _encode(u);
  16761. };
  16762. var encodeURI = function(u) { return encode(u, true) };
  16763. var fromUint8Array;
  16764. if (global.Uint8Array) fromUint8Array = function(a, urisafe) {
  16765. // return btoa(fromCharCode.apply(null, a));
  16766. var b64 = '';
  16767. for (var i = 0, l = a.length; i < l; i += 3) {
  16768. var a0 = a[i], a1 = a[i+1], a2 = a[i+2];
  16769. var ord = a0 << 16 | a1 << 8 | a2;
  16770. b64 += b64chars.charAt( ord >>> 18)
  16771. + b64chars.charAt((ord >>> 12) & 63)
  16772. + ( typeof a1 != 'undefined'
  16773. ? b64chars.charAt((ord >>> 6) & 63) : '=')
  16774. + ( typeof a2 != 'undefined'
  16775. ? b64chars.charAt( ord & 63) : '=');
  16776. }
  16777. return urisafe ? mkUriSafe(b64) : b64;
  16778. };
  16779. // decoder stuff
  16780. var re_btou = /[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g;
  16781. var cb_btou = function(cccc) {
  16782. switch(cccc.length) {
  16783. case 4:
  16784. var cp = ((0x07 & cccc.charCodeAt(0)) << 18)
  16785. | ((0x3f & cccc.charCodeAt(1)) << 12)
  16786. | ((0x3f & cccc.charCodeAt(2)) << 6)
  16787. | (0x3f & cccc.charCodeAt(3)),
  16788. offset = cp - 0x10000;
  16789. return (fromCharCode((offset >>> 10) + 0xD800)
  16790. + fromCharCode((offset & 0x3FF) + 0xDC00));
  16791. case 3:
  16792. return fromCharCode(
  16793. ((0x0f & cccc.charCodeAt(0)) << 12)
  16794. | ((0x3f & cccc.charCodeAt(1)) << 6)
  16795. | (0x3f & cccc.charCodeAt(2))
  16796. );
  16797. default:
  16798. return fromCharCode(
  16799. ((0x1f & cccc.charCodeAt(0)) << 6)
  16800. | (0x3f & cccc.charCodeAt(1))
  16801. );
  16802. }
  16803. };
  16804. var btou = function(b) {
  16805. return b.replace(re_btou, cb_btou);
  16806. };
  16807. var cb_decode = function(cccc) {
  16808. var len = cccc.length,
  16809. padlen = len % 4,
  16810. n = (len > 0 ? b64tab[cccc.charAt(0)] << 18 : 0)
  16811. | (len > 1 ? b64tab[cccc.charAt(1)] << 12 : 0)
  16812. | (len > 2 ? b64tab[cccc.charAt(2)] << 6 : 0)
  16813. | (len > 3 ? b64tab[cccc.charAt(3)] : 0),
  16814. chars = [
  16815. fromCharCode( n >>> 16),
  16816. fromCharCode((n >>> 8) & 0xff),
  16817. fromCharCode( n & 0xff)
  16818. ];
  16819. chars.length -= [0, 0, 2, 1][padlen];
  16820. return chars.join('');
  16821. };
  16822. var _atob = global.atob && typeof global.atob == 'function'
  16823. ? function(a){ return global.atob(a) } : function(a){
  16824. return a.replace(/\S{1,4}/g, cb_decode);
  16825. };
  16826. var atob = function(a) {
  16827. return _atob(String(a).replace(/[^A-Za-z0-9\+\/]/g, ''));
  16828. };
  16829. var _decode = function(a) { return btou(_atob(a)) };
  16830. var _fromURI = function(a) {
  16831. return String(a).replace(/[-_]/g, function(m0) {
  16832. return m0 == '-' ? '+' : '/'
  16833. }).replace(/[^A-Za-z0-9\+\/]/g, '');
  16834. };
  16835. var decode = function(a){
  16836. return _decode(_fromURI(a));
  16837. };
  16838. var toUint8Array;
  16839. if (global.Uint8Array) toUint8Array = function(a) {
  16840. return Uint8Array.from(atob(_fromURI(a)), function(c) {
  16841. return c.charCodeAt(0);
  16842. });
  16843. };
  16844. var noConflict = function() {
  16845. var Base64 = global.Base64;
  16846. global.Base64 = _Base64;
  16847. return Base64;
  16848. };
  16849. // export Base64
  16850. global.Base64 = {
  16851. VERSION: version,
  16852. atob: atob,
  16853. btoa: btoa,
  16854. fromBase64: decode,
  16855. toBase64: encode,
  16856. utob: utob,
  16857. encode: encode,
  16858. encodeURI: encodeURI,
  16859. btou: btou,
  16860. decode: decode,
  16861. noConflict: noConflict,
  16862. fromUint8Array: fromUint8Array,
  16863. toUint8Array: toUint8Array
  16864. };
  16865. // if ES5 is available, make Base64.extendString() available
  16866. if (typeof Object.defineProperty === 'function') {
  16867. var noEnum = function(v){
  16868. return {value:v,enumerable:false,writable:true,configurable:true};
  16869. };
  16870. global.Base64.extendString = function () {
  16871. Object.defineProperty(
  16872. String.prototype, 'fromBase64', noEnum(function () {
  16873. return decode(this)
  16874. }));
  16875. Object.defineProperty(
  16876. String.prototype, 'toBase64', noEnum(function (urisafe) {
  16877. return encode(this, urisafe)
  16878. }));
  16879. Object.defineProperty(
  16880. String.prototype, 'toBase64URI', noEnum(function () {
  16881. return encode(this, true)
  16882. }));
  16883. };
  16884. }
  16885. //
  16886. // export Base64 to the namespace
  16887. //
  16888. if (global['Meteor']) { // Meteor.js
  16889. Base64 = global.Base64;
  16890. }
  16891. // module.exports and AMD are mutually exclusive.
  16892. // module.exports has precedence.
  16893. if (typeof module !== 'undefined' && module.exports) {
  16894. module.exports.Base64 = global.Base64;
  16895. }
  16896. else if (typeof define === 'function' && define.amd) {
  16897. // AMD. Register as an anonymous module.
  16898. define([], function(){ return global.Base64 });
  16899. }
  16900. // that's it!
  16901. return {Base64: global.Base64}
  16902. }));
  16903. }).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
  16904. },{}],315:[function(require,module,exports){
  16905. /*!
  16906. * merge-descriptors
  16907. * Copyright(c) 2014 Jonathan Ong
  16908. * Copyright(c) 2015 Douglas Christopher Wilson
  16909. * MIT Licensed
  16910. */
  16911. 'use strict'
  16912. /**
  16913. * Module exports.
  16914. * @public
  16915. */
  16916. module.exports = merge
  16917. /**
  16918. * Module variables.
  16919. * @private
  16920. */
  16921. var hasOwnProperty = Object.prototype.hasOwnProperty
  16922. /**
  16923. * Merge the property descriptors of `src` into `dest`
  16924. *
  16925. * @param {object} dest Object to add descriptors to
  16926. * @param {object} src Object to clone descriptors from
  16927. * @param {boolean} [redefine=true] Redefine `dest` properties with `src` properties
  16928. * @returns {object} Reference to dest
  16929. * @public
  16930. */
  16931. function merge(dest, src, redefine) {
  16932. if (!dest) {
  16933. throw new TypeError('argument dest is required')
  16934. }
  16935. if (!src) {
  16936. throw new TypeError('argument src is required')
  16937. }
  16938. if (redefine === undefined) {
  16939. // Default to true
  16940. redefine = true
  16941. }
  16942. Object.getOwnPropertyNames(src).forEach(function forEachOwnPropertyName(name) {
  16943. if (!redefine && hasOwnProperty.call(dest, name)) {
  16944. // Skip desriptor
  16945. return
  16946. }
  16947. // Copy descriptor
  16948. var descriptor = Object.getOwnPropertyDescriptor(src, name)
  16949. Object.defineProperty(dest, name, descriptor)
  16950. })
  16951. return dest
  16952. }
  16953. },{}],316:[function(require,module,exports){
  16954. 'use strict';
  16955. /**
  16956. * @param typeMap [Object] Map of MIME type -> Array[extensions]
  16957. * @param ...
  16958. */
  16959. require("core-js/modules/es.array.map.js");
  16960. require("core-js/modules/es.regexp.exec.js");
  16961. require("core-js/modules/es.string.replace.js");
  16962. require("core-js/modules/es.regexp.constructor.js");
  16963. require("core-js/modules/es.regexp.to-string.js");
  16964. function Mime() {
  16965. this._types = Object.create(null);
  16966. this._extensions = Object.create(null);
  16967. for (var i = 0; i < arguments.length; i++) {
  16968. this.define(arguments[i]);
  16969. }
  16970. this.define = this.define.bind(this);
  16971. this.getType = this.getType.bind(this);
  16972. this.getExtension = this.getExtension.bind(this);
  16973. }
  16974. /**
  16975. * Define mimetype -> extension mappings. Each key is a mime-type that maps
  16976. * to an array of extensions associated with the type. The first extension is
  16977. * used as the default extension for the type.
  16978. *
  16979. * e.g. mime.define({'audio/ogg', ['oga', 'ogg', 'spx']});
  16980. *
  16981. * If a type declares an extension that has already been defined, an error will
  16982. * be thrown. To suppress this error and force the extension to be associated
  16983. * with the new type, pass `force`=true. Alternatively, you may prefix the
  16984. * extension with "*" to map the type to extension, without mapping the
  16985. * extension to the type.
  16986. *
  16987. * e.g. mime.define({'audio/wav', ['wav']}, {'audio/x-wav', ['*wav']});
  16988. *
  16989. *
  16990. * @param map (Object) type definitions
  16991. * @param force (Boolean) if true, force overriding of existing definitions
  16992. */
  16993. Mime.prototype.define = function (typeMap, force) {
  16994. for (var type in typeMap) {
  16995. var extensions = typeMap[type].map(function (t) {
  16996. return t.toLowerCase();
  16997. });
  16998. type = type.toLowerCase();
  16999. for (var i = 0; i < extensions.length; i++) {
  17000. var ext = extensions[i]; // '*' prefix = not the preferred type for this extension. So fixup the
  17001. // extension, and skip it.
  17002. if (ext[0] === '*') {
  17003. continue;
  17004. }
  17005. if (!force && ext in this._types) {
  17006. throw new Error('Attempt to change mapping for "' + ext + '" extension from "' + this._types[ext] + '" to "' + type + '". Pass `force=true` to allow this, otherwise remove "' + ext + '" from the list of extensions for "' + type + '".');
  17007. }
  17008. this._types[ext] = type;
  17009. } // Use first extension as default
  17010. if (force || !this._extensions[type]) {
  17011. var _ext = extensions[0];
  17012. this._extensions[type] = _ext[0] !== '*' ? _ext : _ext.substr(1);
  17013. }
  17014. }
  17015. };
  17016. /**
  17017. * Lookup a mime type based on extension
  17018. */
  17019. Mime.prototype.getType = function (path) {
  17020. path = String(path);
  17021. var last = path.replace(/^.*[/\\]/, '').toLowerCase();
  17022. var ext = last.replace(/^.*\./, '').toLowerCase();
  17023. var hasPath = last.length < path.length;
  17024. var hasDot = ext.length < last.length - 1;
  17025. return (hasDot || !hasPath) && this._types[ext] || null;
  17026. };
  17027. /**
  17028. * Return file extension associated with a mime type
  17029. */
  17030. Mime.prototype.getExtension = function (type) {
  17031. type = /^\s*([^;\s]*)/.test(type) && RegExp.$1;
  17032. return type && this._extensions[type.toLowerCase()] || null;
  17033. };
  17034. module.exports = Mime;
  17035. },{"core-js/modules/es.array.map.js":249,"core-js/modules/es.regexp.constructor.js":260,"core-js/modules/es.regexp.exec.js":261,"core-js/modules/es.regexp.to-string.js":262,"core-js/modules/es.string.replace.js":266}],317:[function(require,module,exports){
  17036. 'use strict';
  17037. var Mime = require('./Mime');
  17038. module.exports = new Mime(require('./types/standard'));
  17039. },{"./Mime":316,"./types/standard":318}],318:[function(require,module,exports){
  17040. "use strict";
  17041. module.exports = {
  17042. "application/andrew-inset": ["ez"],
  17043. "application/applixware": ["aw"],
  17044. "application/atom+xml": ["atom"],
  17045. "application/atomcat+xml": ["atomcat"],
  17046. "application/atomdeleted+xml": ["atomdeleted"],
  17047. "application/atomsvc+xml": ["atomsvc"],
  17048. "application/atsc-dwd+xml": ["dwd"],
  17049. "application/atsc-held+xml": ["held"],
  17050. "application/atsc-rsat+xml": ["rsat"],
  17051. "application/bdoc": ["bdoc"],
  17052. "application/calendar+xml": ["xcs"],
  17053. "application/ccxml+xml": ["ccxml"],
  17054. "application/cdfx+xml": ["cdfx"],
  17055. "application/cdmi-capability": ["cdmia"],
  17056. "application/cdmi-container": ["cdmic"],
  17057. "application/cdmi-domain": ["cdmid"],
  17058. "application/cdmi-object": ["cdmio"],
  17059. "application/cdmi-queue": ["cdmiq"],
  17060. "application/cu-seeme": ["cu"],
  17061. "application/dash+xml": ["mpd"],
  17062. "application/davmount+xml": ["davmount"],
  17063. "application/docbook+xml": ["dbk"],
  17064. "application/dssc+der": ["dssc"],
  17065. "application/dssc+xml": ["xdssc"],
  17066. "application/ecmascript": ["ecma", "es"],
  17067. "application/emma+xml": ["emma"],
  17068. "application/emotionml+xml": ["emotionml"],
  17069. "application/epub+zip": ["epub"],
  17070. "application/exi": ["exi"],
  17071. "application/fdt+xml": ["fdt"],
  17072. "application/font-tdpfr": ["pfr"],
  17073. "application/geo+json": ["geojson"],
  17074. "application/gml+xml": ["gml"],
  17075. "application/gpx+xml": ["gpx"],
  17076. "application/gxf": ["gxf"],
  17077. "application/gzip": ["gz"],
  17078. "application/hjson": ["hjson"],
  17079. "application/hyperstudio": ["stk"],
  17080. "application/inkml+xml": ["ink", "inkml"],
  17081. "application/ipfix": ["ipfix"],
  17082. "application/its+xml": ["its"],
  17083. "application/java-archive": ["jar", "war", "ear"],
  17084. "application/java-serialized-object": ["ser"],
  17085. "application/java-vm": ["class"],
  17086. "application/javascript": ["js", "mjs"],
  17087. "application/json": ["json", "map"],
  17088. "application/json5": ["json5"],
  17089. "application/jsonml+json": ["jsonml"],
  17090. "application/ld+json": ["jsonld"],
  17091. "application/lgr+xml": ["lgr"],
  17092. "application/lost+xml": ["lostxml"],
  17093. "application/mac-binhex40": ["hqx"],
  17094. "application/mac-compactpro": ["cpt"],
  17095. "application/mads+xml": ["mads"],
  17096. "application/manifest+json": ["webmanifest"],
  17097. "application/marc": ["mrc"],
  17098. "application/marcxml+xml": ["mrcx"],
  17099. "application/mathematica": ["ma", "nb", "mb"],
  17100. "application/mathml+xml": ["mathml"],
  17101. "application/mbox": ["mbox"],
  17102. "application/mediaservercontrol+xml": ["mscml"],
  17103. "application/metalink+xml": ["metalink"],
  17104. "application/metalink4+xml": ["meta4"],
  17105. "application/mets+xml": ["mets"],
  17106. "application/mmt-aei+xml": ["maei"],
  17107. "application/mmt-usd+xml": ["musd"],
  17108. "application/mods+xml": ["mods"],
  17109. "application/mp21": ["m21", "mp21"],
  17110. "application/mp4": ["mp4s", "m4p"],
  17111. "application/mrb-consumer+xml": ["*xdf"],
  17112. "application/mrb-publish+xml": ["*xdf"],
  17113. "application/msword": ["doc", "dot"],
  17114. "application/mxf": ["mxf"],
  17115. "application/n-quads": ["nq"],
  17116. "application/n-triples": ["nt"],
  17117. "application/node": ["cjs"],
  17118. "application/octet-stream": ["bin", "dms", "lrf", "mar", "so", "dist", "distz", "pkg", "bpk", "dump", "elc", "deploy", "exe", "dll", "deb", "dmg", "iso", "img", "msi", "msp", "msm", "buffer"],
  17119. "application/oda": ["oda"],
  17120. "application/oebps-package+xml": ["opf"],
  17121. "application/ogg": ["ogx"],
  17122. "application/omdoc+xml": ["omdoc"],
  17123. "application/onenote": ["onetoc", "onetoc2", "onetmp", "onepkg"],
  17124. "application/oxps": ["oxps"],
  17125. "application/p2p-overlay+xml": ["relo"],
  17126. "application/patch-ops-error+xml": ["*xer"],
  17127. "application/pdf": ["pdf"],
  17128. "application/pgp-encrypted": ["pgp"],
  17129. "application/pgp-signature": ["asc", "sig"],
  17130. "application/pics-rules": ["prf"],
  17131. "application/pkcs10": ["p10"],
  17132. "application/pkcs7-mime": ["p7m", "p7c"],
  17133. "application/pkcs7-signature": ["p7s"],
  17134. "application/pkcs8": ["p8"],
  17135. "application/pkix-attr-cert": ["ac"],
  17136. "application/pkix-cert": ["cer"],
  17137. "application/pkix-crl": ["crl"],
  17138. "application/pkix-pkipath": ["pkipath"],
  17139. "application/pkixcmp": ["pki"],
  17140. "application/pls+xml": ["pls"],
  17141. "application/postscript": ["ai", "eps", "ps"],
  17142. "application/provenance+xml": ["provx"],
  17143. "application/pskc+xml": ["pskcxml"],
  17144. "application/raml+yaml": ["raml"],
  17145. "application/rdf+xml": ["rdf", "owl"],
  17146. "application/reginfo+xml": ["rif"],
  17147. "application/relax-ng-compact-syntax": ["rnc"],
  17148. "application/resource-lists+xml": ["rl"],
  17149. "application/resource-lists-diff+xml": ["rld"],
  17150. "application/rls-services+xml": ["rs"],
  17151. "application/route-apd+xml": ["rapd"],
  17152. "application/route-s-tsid+xml": ["sls"],
  17153. "application/route-usd+xml": ["rusd"],
  17154. "application/rpki-ghostbusters": ["gbr"],
  17155. "application/rpki-manifest": ["mft"],
  17156. "application/rpki-roa": ["roa"],
  17157. "application/rsd+xml": ["rsd"],
  17158. "application/rss+xml": ["rss"],
  17159. "application/rtf": ["rtf"],
  17160. "application/sbml+xml": ["sbml"],
  17161. "application/scvp-cv-request": ["scq"],
  17162. "application/scvp-cv-response": ["scs"],
  17163. "application/scvp-vp-request": ["spq"],
  17164. "application/scvp-vp-response": ["spp"],
  17165. "application/sdp": ["sdp"],
  17166. "application/senml+xml": ["senmlx"],
  17167. "application/sensml+xml": ["sensmlx"],
  17168. "application/set-payment-initiation": ["setpay"],
  17169. "application/set-registration-initiation": ["setreg"],
  17170. "application/shf+xml": ["shf"],
  17171. "application/sieve": ["siv", "sieve"],
  17172. "application/smil+xml": ["smi", "smil"],
  17173. "application/sparql-query": ["rq"],
  17174. "application/sparql-results+xml": ["srx"],
  17175. "application/srgs": ["gram"],
  17176. "application/srgs+xml": ["grxml"],
  17177. "application/sru+xml": ["sru"],
  17178. "application/ssdl+xml": ["ssdl"],
  17179. "application/ssml+xml": ["ssml"],
  17180. "application/swid+xml": ["swidtag"],
  17181. "application/tei+xml": ["tei", "teicorpus"],
  17182. "application/thraud+xml": ["tfi"],
  17183. "application/timestamped-data": ["tsd"],
  17184. "application/toml": ["toml"],
  17185. "application/ttml+xml": ["ttml"],
  17186. "application/ubjson": ["ubj"],
  17187. "application/urc-ressheet+xml": ["rsheet"],
  17188. "application/urc-targetdesc+xml": ["td"],
  17189. "application/voicexml+xml": ["vxml"],
  17190. "application/wasm": ["wasm"],
  17191. "application/widget": ["wgt"],
  17192. "application/winhlp": ["hlp"],
  17193. "application/wsdl+xml": ["wsdl"],
  17194. "application/wspolicy+xml": ["wspolicy"],
  17195. "application/xaml+xml": ["xaml"],
  17196. "application/xcap-att+xml": ["xav"],
  17197. "application/xcap-caps+xml": ["xca"],
  17198. "application/xcap-diff+xml": ["xdf"],
  17199. "application/xcap-el+xml": ["xel"],
  17200. "application/xcap-error+xml": ["xer"],
  17201. "application/xcap-ns+xml": ["xns"],
  17202. "application/xenc+xml": ["xenc"],
  17203. "application/xhtml+xml": ["xhtml", "xht"],
  17204. "application/xliff+xml": ["xlf"],
  17205. "application/xml": ["xml", "xsl", "xsd", "rng"],
  17206. "application/xml-dtd": ["dtd"],
  17207. "application/xop+xml": ["xop"],
  17208. "application/xproc+xml": ["xpl"],
  17209. "application/xslt+xml": ["*xsl", "xslt"],
  17210. "application/xspf+xml": ["xspf"],
  17211. "application/xv+xml": ["mxml", "xhvml", "xvml", "xvm"],
  17212. "application/yang": ["yang"],
  17213. "application/yin+xml": ["yin"],
  17214. "application/zip": ["zip"],
  17215. "audio/3gpp": ["*3gpp"],
  17216. "audio/adpcm": ["adp"],
  17217. "audio/amr": ["amr"],
  17218. "audio/basic": ["au", "snd"],
  17219. "audio/midi": ["mid", "midi", "kar", "rmi"],
  17220. "audio/mobile-xmf": ["mxmf"],
  17221. "audio/mp3": ["*mp3"],
  17222. "audio/mp4": ["m4a", "mp4a"],
  17223. "audio/mpeg": ["mpga", "mp2", "mp2a", "mp3", "m2a", "m3a"],
  17224. "audio/ogg": ["oga", "ogg", "spx", "opus"],
  17225. "audio/s3m": ["s3m"],
  17226. "audio/silk": ["sil"],
  17227. "audio/wav": ["wav"],
  17228. "audio/wave": ["*wav"],
  17229. "audio/webm": ["weba"],
  17230. "audio/xm": ["xm"],
  17231. "font/collection": ["ttc"],
  17232. "font/otf": ["otf"],
  17233. "font/ttf": ["ttf"],
  17234. "font/woff": ["woff"],
  17235. "font/woff2": ["woff2"],
  17236. "image/aces": ["exr"],
  17237. "image/apng": ["apng"],
  17238. "image/avif": ["avif"],
  17239. "image/bmp": ["bmp"],
  17240. "image/cgm": ["cgm"],
  17241. "image/dicom-rle": ["drle"],
  17242. "image/emf": ["emf"],
  17243. "image/fits": ["fits"],
  17244. "image/g3fax": ["g3"],
  17245. "image/gif": ["gif"],
  17246. "image/heic": ["heic"],
  17247. "image/heic-sequence": ["heics"],
  17248. "image/heif": ["heif"],
  17249. "image/heif-sequence": ["heifs"],
  17250. "image/hej2k": ["hej2"],
  17251. "image/hsj2": ["hsj2"],
  17252. "image/ief": ["ief"],
  17253. "image/jls": ["jls"],
  17254. "image/jp2": ["jp2", "jpg2"],
  17255. "image/jpeg": ["jpeg", "jpg", "jpe"],
  17256. "image/jph": ["jph"],
  17257. "image/jphc": ["jhc"],
  17258. "image/jpm": ["jpm"],
  17259. "image/jpx": ["jpx", "jpf"],
  17260. "image/jxr": ["jxr"],
  17261. "image/jxra": ["jxra"],
  17262. "image/jxrs": ["jxrs"],
  17263. "image/jxs": ["jxs"],
  17264. "image/jxsc": ["jxsc"],
  17265. "image/jxsi": ["jxsi"],
  17266. "image/jxss": ["jxss"],
  17267. "image/ktx": ["ktx"],
  17268. "image/ktx2": ["ktx2"],
  17269. "image/png": ["png"],
  17270. "image/sgi": ["sgi"],
  17271. "image/svg+xml": ["svg", "svgz"],
  17272. "image/t38": ["t38"],
  17273. "image/tiff": ["tif", "tiff"],
  17274. "image/tiff-fx": ["tfx"],
  17275. "image/webp": ["webp"],
  17276. "image/wmf": ["wmf"],
  17277. "message/disposition-notification": ["disposition-notification"],
  17278. "message/global": ["u8msg"],
  17279. "message/global-delivery-status": ["u8dsn"],
  17280. "message/global-disposition-notification": ["u8mdn"],
  17281. "message/global-headers": ["u8hdr"],
  17282. "message/rfc822": ["eml", "mime"],
  17283. "model/3mf": ["3mf"],
  17284. "model/gltf+json": ["gltf"],
  17285. "model/gltf-binary": ["glb"],
  17286. "model/iges": ["igs", "iges"],
  17287. "model/mesh": ["msh", "mesh", "silo"],
  17288. "model/mtl": ["mtl"],
  17289. "model/obj": ["obj"],
  17290. "model/stl": ["stl"],
  17291. "model/vrml": ["wrl", "vrml"],
  17292. "model/x3d+binary": ["*x3db", "x3dbz"],
  17293. "model/x3d+fastinfoset": ["x3db"],
  17294. "model/x3d+vrml": ["*x3dv", "x3dvz"],
  17295. "model/x3d+xml": ["x3d", "x3dz"],
  17296. "model/x3d-vrml": ["x3dv"],
  17297. "text/cache-manifest": ["appcache", "manifest"],
  17298. "text/calendar": ["ics", "ifb"],
  17299. "text/coffeescript": ["coffee", "litcoffee"],
  17300. "text/css": ["css"],
  17301. "text/csv": ["csv"],
  17302. "text/html": ["html", "htm", "shtml"],
  17303. "text/jade": ["jade"],
  17304. "text/jsx": ["jsx"],
  17305. "text/less": ["less"],
  17306. "text/markdown": ["markdown", "md"],
  17307. "text/mathml": ["mml"],
  17308. "text/mdx": ["mdx"],
  17309. "text/n3": ["n3"],
  17310. "text/plain": ["txt", "text", "conf", "def", "list", "log", "in", "ini"],
  17311. "text/richtext": ["rtx"],
  17312. "text/rtf": ["*rtf"],
  17313. "text/sgml": ["sgml", "sgm"],
  17314. "text/shex": ["shex"],
  17315. "text/slim": ["slim", "slm"],
  17316. "text/spdx": ["spdx"],
  17317. "text/stylus": ["stylus", "styl"],
  17318. "text/tab-separated-values": ["tsv"],
  17319. "text/troff": ["t", "tr", "roff", "man", "me", "ms"],
  17320. "text/turtle": ["ttl"],
  17321. "text/uri-list": ["uri", "uris", "urls"],
  17322. "text/vcard": ["vcard"],
  17323. "text/vtt": ["vtt"],
  17324. "text/xml": ["*xml"],
  17325. "text/yaml": ["yaml", "yml"],
  17326. "video/3gpp": ["3gp", "3gpp"],
  17327. "video/3gpp2": ["3g2"],
  17328. "video/h261": ["h261"],
  17329. "video/h263": ["h263"],
  17330. "video/h264": ["h264"],
  17331. "video/iso.segment": ["m4s"],
  17332. "video/jpeg": ["jpgv"],
  17333. "video/jpm": ["*jpm", "jpgm"],
  17334. "video/mj2": ["mj2", "mjp2"],
  17335. "video/mp2t": ["ts"],
  17336. "video/mp4": ["mp4", "mp4v", "mpg4"],
  17337. "video/mpeg": ["mpeg", "mpg", "mpe", "m1v", "m2v"],
  17338. "video/ogg": ["ogv"],
  17339. "video/quicktime": ["qt", "mov"],
  17340. "video/webm": ["webm"]
  17341. };
  17342. },{}],319:[function(require,module,exports){
  17343. /**
  17344. * Helpers.
  17345. */
  17346. var s = 1000;
  17347. var m = s * 60;
  17348. var h = m * 60;
  17349. var d = h * 24;
  17350. var w = d * 7;
  17351. var y = d * 365.25;
  17352. /**
  17353. * Parse or format the given `val`.
  17354. *
  17355. * Options:
  17356. *
  17357. * - `long` verbose formatting [false]
  17358. *
  17359. * @param {String|Number} val
  17360. * @param {Object} [options]
  17361. * @throws {Error} throw an error if val is not a non-empty string or a number
  17362. * @return {String|Number}
  17363. * @api public
  17364. */
  17365. module.exports = function (val, options) {
  17366. options = options || {};
  17367. var type = typeof val;
  17368. if (type === 'string' && val.length > 0) {
  17369. return parse(val);
  17370. } else if (type === 'number' && isFinite(val)) {
  17371. return options.long ? fmtLong(val) : fmtShort(val);
  17372. }
  17373. throw new Error(
  17374. 'val is not a non-empty string or a valid number. val=' +
  17375. JSON.stringify(val)
  17376. );
  17377. };
  17378. /**
  17379. * Parse the given `str` and return milliseconds.
  17380. *
  17381. * @param {String} str
  17382. * @return {Number}
  17383. * @api private
  17384. */
  17385. function parse(str) {
  17386. str = String(str);
  17387. if (str.length > 100) {
  17388. return;
  17389. }
  17390. var match = /^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(
  17391. str
  17392. );
  17393. if (!match) {
  17394. return;
  17395. }
  17396. var n = parseFloat(match[1]);
  17397. var type = (match[2] || 'ms').toLowerCase();
  17398. switch (type) {
  17399. case 'years':
  17400. case 'year':
  17401. case 'yrs':
  17402. case 'yr':
  17403. case 'y':
  17404. return n * y;
  17405. case 'weeks':
  17406. case 'week':
  17407. case 'w':
  17408. return n * w;
  17409. case 'days':
  17410. case 'day':
  17411. case 'd':
  17412. return n * d;
  17413. case 'hours':
  17414. case 'hour':
  17415. case 'hrs':
  17416. case 'hr':
  17417. case 'h':
  17418. return n * h;
  17419. case 'minutes':
  17420. case 'minute':
  17421. case 'mins':
  17422. case 'min':
  17423. case 'm':
  17424. return n * m;
  17425. case 'seconds':
  17426. case 'second':
  17427. case 'secs':
  17428. case 'sec':
  17429. case 's':
  17430. return n * s;
  17431. case 'milliseconds':
  17432. case 'millisecond':
  17433. case 'msecs':
  17434. case 'msec':
  17435. case 'ms':
  17436. return n;
  17437. default:
  17438. return undefined;
  17439. }
  17440. }
  17441. /**
  17442. * Short format for `ms`.
  17443. *
  17444. * @param {Number} ms
  17445. * @return {String}
  17446. * @api private
  17447. */
  17448. function fmtShort(ms) {
  17449. var msAbs = Math.abs(ms);
  17450. if (msAbs >= d) {
  17451. return Math.round(ms / d) + 'd';
  17452. }
  17453. if (msAbs >= h) {
  17454. return Math.round(ms / h) + 'h';
  17455. }
  17456. if (msAbs >= m) {
  17457. return Math.round(ms / m) + 'm';
  17458. }
  17459. if (msAbs >= s) {
  17460. return Math.round(ms / s) + 's';
  17461. }
  17462. return ms + 'ms';
  17463. }
  17464. /**
  17465. * Long format for `ms`.
  17466. *
  17467. * @param {Number} ms
  17468. * @return {String}
  17469. * @api private
  17470. */
  17471. function fmtLong(ms) {
  17472. var msAbs = Math.abs(ms);
  17473. if (msAbs >= d) {
  17474. return plural(ms, msAbs, d, 'day');
  17475. }
  17476. if (msAbs >= h) {
  17477. return plural(ms, msAbs, h, 'hour');
  17478. }
  17479. if (msAbs >= m) {
  17480. return plural(ms, msAbs, m, 'minute');
  17481. }
  17482. if (msAbs >= s) {
  17483. return plural(ms, msAbs, s, 'second');
  17484. }
  17485. return ms + ' ms';
  17486. }
  17487. /**
  17488. * Pluralization helper.
  17489. */
  17490. function plural(ms, msAbs, n, name) {
  17491. var isPlural = msAbs >= n * 1.5;
  17492. return Math.round(ms / n) + ' ' + name + (isPlural ? 's' : '');
  17493. }
  17494. },{}],320:[function(require,module,exports){
  17495. /*
  17496. object-assign
  17497. (c) Sindre Sorhus
  17498. @license MIT
  17499. */
  17500. 'use strict';
  17501. /* eslint-disable no-unused-vars */
  17502. var getOwnPropertySymbols = Object.getOwnPropertySymbols;
  17503. var hasOwnProperty = Object.prototype.hasOwnProperty;
  17504. var propIsEnumerable = Object.prototype.propertyIsEnumerable;
  17505. function toObject(val) {
  17506. if (val === null || val === undefined) {
  17507. throw new TypeError('Object.assign cannot be called with null or undefined');
  17508. }
  17509. return Object(val);
  17510. }
  17511. function shouldUseNative() {
  17512. try {
  17513. if (!Object.assign) {
  17514. return false;
  17515. }
  17516. // Detect buggy property enumeration order in older V8 versions.
  17517. // https://bugs.chromium.org/p/v8/issues/detail?id=4118
  17518. var test1 = new String('abc'); // eslint-disable-line no-new-wrappers
  17519. test1[5] = 'de';
  17520. if (Object.getOwnPropertyNames(test1)[0] === '5') {
  17521. return false;
  17522. }
  17523. // https://bugs.chromium.org/p/v8/issues/detail?id=3056
  17524. var test2 = {};
  17525. for (var i = 0; i < 10; i++) {
  17526. test2['_' + String.fromCharCode(i)] = i;
  17527. }
  17528. var order2 = Object.getOwnPropertyNames(test2).map(function (n) {
  17529. return test2[n];
  17530. });
  17531. if (order2.join('') !== '0123456789') {
  17532. return false;
  17533. }
  17534. // https://bugs.chromium.org/p/v8/issues/detail?id=3056
  17535. var test3 = {};
  17536. 'abcdefghijklmnopqrst'.split('').forEach(function (letter) {
  17537. test3[letter] = letter;
  17538. });
  17539. if (Object.keys(Object.assign({}, test3)).join('') !==
  17540. 'abcdefghijklmnopqrst') {
  17541. return false;
  17542. }
  17543. return true;
  17544. } catch (err) {
  17545. // We don't expect any of the above to throw, but better to be safe.
  17546. return false;
  17547. }
  17548. }
  17549. module.exports = shouldUseNative() ? Object.assign : function (target, source) {
  17550. var from;
  17551. var to = toObject(target);
  17552. var symbols;
  17553. for (var s = 1; s < arguments.length; s++) {
  17554. from = Object(arguments[s]);
  17555. for (var key in from) {
  17556. if (hasOwnProperty.call(from, key)) {
  17557. to[key] = from[key];
  17558. }
  17559. }
  17560. if (getOwnPropertySymbols) {
  17561. symbols = getOwnPropertySymbols(from);
  17562. for (var i = 0; i < symbols.length; i++) {
  17563. if (propIsEnumerable.call(from, symbols[i])) {
  17564. to[symbols[i]] = from[symbols[i]];
  17565. }
  17566. }
  17567. }
  17568. }
  17569. return to;
  17570. };
  17571. },{}],321:[function(require,module,exports){
  17572. (function (process){(function (){
  17573. // .dirname, .basename, and .extname methods are extracted from Node.js v8.11.1,
  17574. // backported and transplited with Babel, with backwards-compat fixes
  17575. // Copyright Joyent, Inc. and other Node contributors.
  17576. //
  17577. // Permission is hereby granted, free of charge, to any person obtaining a
  17578. // copy of this software and associated documentation files (the
  17579. // "Software"), to deal in the Software without restriction, including
  17580. // without limitation the rights to use, copy, modify, merge, publish,
  17581. // distribute, sublicense, and/or sell copies of the Software, and to permit
  17582. // persons to whom the Software is furnished to do so, subject to the
  17583. // following conditions:
  17584. //
  17585. // The above copyright notice and this permission notice shall be included
  17586. // in all copies or substantial portions of the Software.
  17587. //
  17588. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  17589. // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  17590. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  17591. // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  17592. // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  17593. // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  17594. // USE OR OTHER DEALINGS IN THE SOFTWARE.
  17595. // resolves . and .. elements in a path array with directory names there
  17596. // must be no slashes, empty elements, or device names (c:\) in the array
  17597. // (so also no leading and trailing slashes - it does not distinguish
  17598. // relative and absolute paths)
  17599. function normalizeArray(parts, allowAboveRoot) {
  17600. // if the path tries to go above the root, `up` ends up > 0
  17601. var up = 0;
  17602. for (var i = parts.length - 1; i >= 0; i--) {
  17603. var last = parts[i];
  17604. if (last === '.') {
  17605. parts.splice(i, 1);
  17606. } else if (last === '..') {
  17607. parts.splice(i, 1);
  17608. up++;
  17609. } else if (up) {
  17610. parts.splice(i, 1);
  17611. up--;
  17612. }
  17613. }
  17614. // if the path is allowed to go above the root, restore leading ..s
  17615. if (allowAboveRoot) {
  17616. for (; up--; up) {
  17617. parts.unshift('..');
  17618. }
  17619. }
  17620. return parts;
  17621. }
  17622. // path.resolve([from ...], to)
  17623. // posix version
  17624. exports.resolve = function() {
  17625. var resolvedPath = '',
  17626. resolvedAbsolute = false;
  17627. for (var i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) {
  17628. var path = (i >= 0) ? arguments[i] : process.cwd();
  17629. // Skip empty and invalid entries
  17630. if (typeof path !== 'string') {
  17631. throw new TypeError('Arguments to path.resolve must be strings');
  17632. } else if (!path) {
  17633. continue;
  17634. }
  17635. resolvedPath = path + '/' + resolvedPath;
  17636. resolvedAbsolute = path.charAt(0) === '/';
  17637. }
  17638. // At this point the path should be resolved to a full absolute path, but
  17639. // handle relative paths to be safe (might happen when process.cwd() fails)
  17640. // Normalize the path
  17641. resolvedPath = normalizeArray(filter(resolvedPath.split('/'), function(p) {
  17642. return !!p;
  17643. }), !resolvedAbsolute).join('/');
  17644. return ((resolvedAbsolute ? '/' : '') + resolvedPath) || '.';
  17645. };
  17646. // path.normalize(path)
  17647. // posix version
  17648. exports.normalize = function(path) {
  17649. var isAbsolute = exports.isAbsolute(path),
  17650. trailingSlash = substr(path, -1) === '/';
  17651. // Normalize the path
  17652. path = normalizeArray(filter(path.split('/'), function(p) {
  17653. return !!p;
  17654. }), !isAbsolute).join('/');
  17655. if (!path && !isAbsolute) {
  17656. path = '.';
  17657. }
  17658. if (path && trailingSlash) {
  17659. path += '/';
  17660. }
  17661. return (isAbsolute ? '/' : '') + path;
  17662. };
  17663. // posix version
  17664. exports.isAbsolute = function(path) {
  17665. return path.charAt(0) === '/';
  17666. };
  17667. // posix version
  17668. exports.join = function() {
  17669. var paths = Array.prototype.slice.call(arguments, 0);
  17670. return exports.normalize(filter(paths, function(p, index) {
  17671. if (typeof p !== 'string') {
  17672. throw new TypeError('Arguments to path.join must be strings');
  17673. }
  17674. return p;
  17675. }).join('/'));
  17676. };
  17677. // path.relative(from, to)
  17678. // posix version
  17679. exports.relative = function(from, to) {
  17680. from = exports.resolve(from).substr(1);
  17681. to = exports.resolve(to).substr(1);
  17682. function trim(arr) {
  17683. var start = 0;
  17684. for (; start < arr.length; start++) {
  17685. if (arr[start] !== '') break;
  17686. }
  17687. var end = arr.length - 1;
  17688. for (; end >= 0; end--) {
  17689. if (arr[end] !== '') break;
  17690. }
  17691. if (start > end) return [];
  17692. return arr.slice(start, end - start + 1);
  17693. }
  17694. var fromParts = trim(from.split('/'));
  17695. var toParts = trim(to.split('/'));
  17696. var length = Math.min(fromParts.length, toParts.length);
  17697. var samePartsLength = length;
  17698. for (var i = 0; i < length; i++) {
  17699. if (fromParts[i] !== toParts[i]) {
  17700. samePartsLength = i;
  17701. break;
  17702. }
  17703. }
  17704. var outputParts = [];
  17705. for (var i = samePartsLength; i < fromParts.length; i++) {
  17706. outputParts.push('..');
  17707. }
  17708. outputParts = outputParts.concat(toParts.slice(samePartsLength));
  17709. return outputParts.join('/');
  17710. };
  17711. exports.sep = '/';
  17712. exports.delimiter = ':';
  17713. exports.dirname = function (path) {
  17714. if (typeof path !== 'string') path = path + '';
  17715. if (path.length === 0) return '.';
  17716. var code = path.charCodeAt(0);
  17717. var hasRoot = code === 47 /*/*/;
  17718. var end = -1;
  17719. var matchedSlash = true;
  17720. for (var i = path.length - 1; i >= 1; --i) {
  17721. code = path.charCodeAt(i);
  17722. if (code === 47 /*/*/) {
  17723. if (!matchedSlash) {
  17724. end = i;
  17725. break;
  17726. }
  17727. } else {
  17728. // We saw the first non-path separator
  17729. matchedSlash = false;
  17730. }
  17731. }
  17732. if (end === -1) return hasRoot ? '/' : '.';
  17733. if (hasRoot && end === 1) {
  17734. // return '//';
  17735. // Backwards-compat fix:
  17736. return '/';
  17737. }
  17738. return path.slice(0, end);
  17739. };
  17740. function basename(path) {
  17741. if (typeof path !== 'string') path = path + '';
  17742. var start = 0;
  17743. var end = -1;
  17744. var matchedSlash = true;
  17745. var i;
  17746. for (i = path.length - 1; i >= 0; --i) {
  17747. if (path.charCodeAt(i) === 47 /*/*/) {
  17748. // If we reached a path separator that was not part of a set of path
  17749. // separators at the end of the string, stop now
  17750. if (!matchedSlash) {
  17751. start = i + 1;
  17752. break;
  17753. }
  17754. } else if (end === -1) {
  17755. // We saw the first non-path separator, mark this as the end of our
  17756. // path component
  17757. matchedSlash = false;
  17758. end = i + 1;
  17759. }
  17760. }
  17761. if (end === -1) return '';
  17762. return path.slice(start, end);
  17763. }
  17764. // Uses a mixed approach for backwards-compatibility, as ext behavior changed
  17765. // in new Node.js versions, so only basename() above is backported here
  17766. exports.basename = function (path, ext) {
  17767. var f = basename(path);
  17768. if (ext && f.substr(-1 * ext.length) === ext) {
  17769. f = f.substr(0, f.length - ext.length);
  17770. }
  17771. return f;
  17772. };
  17773. exports.extname = function (path) {
  17774. if (typeof path !== 'string') path = path + '';
  17775. var startDot = -1;
  17776. var startPart = 0;
  17777. var end = -1;
  17778. var matchedSlash = true;
  17779. // Track the state of characters (if any) we see before our first dot and
  17780. // after any path separator we find
  17781. var preDotState = 0;
  17782. for (var i = path.length - 1; i >= 0; --i) {
  17783. var code = path.charCodeAt(i);
  17784. if (code === 47 /*/*/) {
  17785. // If we reached a path separator that was not part of a set of path
  17786. // separators at the end of the string, stop now
  17787. if (!matchedSlash) {
  17788. startPart = i + 1;
  17789. break;
  17790. }
  17791. continue;
  17792. }
  17793. if (end === -1) {
  17794. // We saw the first non-path separator, mark this as the end of our
  17795. // extension
  17796. matchedSlash = false;
  17797. end = i + 1;
  17798. }
  17799. if (code === 46 /*.*/) {
  17800. // If this is our first dot, mark it as the start of our extension
  17801. if (startDot === -1)
  17802. startDot = i;
  17803. else if (preDotState !== 1)
  17804. preDotState = 1;
  17805. } else if (startDot !== -1) {
  17806. // We saw a non-dot and non-path separator before our dot, so we should
  17807. // have a good chance at having a non-empty extension
  17808. preDotState = -1;
  17809. }
  17810. }
  17811. if (startDot === -1 || end === -1 ||
  17812. // We saw a non-dot character immediately before the dot
  17813. preDotState === 0 ||
  17814. // The (right-most) trimmed path component is exactly '..'
  17815. preDotState === 1 && startDot === end - 1 && startDot === startPart + 1) {
  17816. return '';
  17817. }
  17818. return path.slice(startDot, end);
  17819. };
  17820. function filter (xs, f) {
  17821. if (xs.filter) return xs.filter(f);
  17822. var res = [];
  17823. for (var i = 0; i < xs.length; i++) {
  17824. if (f(xs[i], i, xs)) res.push(xs[i]);
  17825. }
  17826. return res;
  17827. }
  17828. // String.prototype.substr - negative index don't work in IE8
  17829. var substr = 'ab'.substr(-1) === 'b'
  17830. ? function (str, start, len) { return str.substr(start, len) }
  17831. : function (str, start, len) {
  17832. if (start < 0) start = str.length + start;
  17833. return str.substr(start, len);
  17834. }
  17835. ;
  17836. }).call(this)}).call(this,require('_process'))
  17837. },{"_process":399}],322:[function(require,module,exports){
  17838. (function (global){(function (){
  17839. /*!
  17840. * Platform.js v1.3.6
  17841. * Copyright 2014-2020 Benjamin Tan
  17842. * Copyright 2011-2013 John-David Dalton
  17843. * Available under MIT license
  17844. */
  17845. ;(function() {
  17846. 'use strict';
  17847. /** Used to determine if values are of the language type `Object`. */
  17848. var objectTypes = {
  17849. 'function': true,
  17850. 'object': true
  17851. };
  17852. /** Used as a reference to the global object. */
  17853. var root = (objectTypes[typeof window] && window) || this;
  17854. /** Backup possible global object. */
  17855. var oldRoot = root;
  17856. /** Detect free variable `exports`. */
  17857. var freeExports = objectTypes[typeof exports] && exports;
  17858. /** Detect free variable `module`. */
  17859. var freeModule = objectTypes[typeof module] && module && !module.nodeType && module;
  17860. /** Detect free variable `global` from Node.js or Browserified code and use it as `root`. */
  17861. var freeGlobal = freeExports && freeModule && typeof global == 'object' && global;
  17862. if (freeGlobal && (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal || freeGlobal.self === freeGlobal)) {
  17863. root = freeGlobal;
  17864. }
  17865. /**
  17866. * Used as the maximum length of an array-like object.
  17867. * See the [ES6 spec](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-tolength)
  17868. * for more details.
  17869. */
  17870. var maxSafeInteger = Math.pow(2, 53) - 1;
  17871. /** Regular expression to detect Opera. */
  17872. var reOpera = /\bOpera/;
  17873. /** Possible global object. */
  17874. var thisBinding = this;
  17875. /** Used for native method references. */
  17876. var objectProto = Object.prototype;
  17877. /** Used to check for own properties of an object. */
  17878. var hasOwnProperty = objectProto.hasOwnProperty;
  17879. /** Used to resolve the internal `[[Class]]` of values. */
  17880. var toString = objectProto.toString;
  17881. /*--------------------------------------------------------------------------*/
  17882. /**
  17883. * Capitalizes a string value.
  17884. *
  17885. * @private
  17886. * @param {string} string The string to capitalize.
  17887. * @returns {string} The capitalized string.
  17888. */
  17889. function capitalize(string) {
  17890. string = String(string);
  17891. return string.charAt(0).toUpperCase() + string.slice(1);
  17892. }
  17893. /**
  17894. * A utility function to clean up the OS name.
  17895. *
  17896. * @private
  17897. * @param {string} os The OS name to clean up.
  17898. * @param {string} [pattern] A `RegExp` pattern matching the OS name.
  17899. * @param {string} [label] A label for the OS.
  17900. */
  17901. function cleanupOS(os, pattern, label) {
  17902. // Platform tokens are defined at:
  17903. // http://msdn.microsoft.com/en-us/library/ms537503(VS.85).aspx
  17904. // http://web.archive.org/web/20081122053950/http://msdn.microsoft.com/en-us/library/ms537503(VS.85).aspx
  17905. var data = {
  17906. '10.0': '10',
  17907. '6.4': '10 Technical Preview',
  17908. '6.3': '8.1',
  17909. '6.2': '8',
  17910. '6.1': 'Server 2008 R2 / 7',
  17911. '6.0': 'Server 2008 / Vista',
  17912. '5.2': 'Server 2003 / XP 64-bit',
  17913. '5.1': 'XP',
  17914. '5.01': '2000 SP1',
  17915. '5.0': '2000',
  17916. '4.0': 'NT',
  17917. '4.90': 'ME'
  17918. };
  17919. // Detect Windows version from platform tokens.
  17920. if (pattern && label && /^Win/i.test(os) && !/^Windows Phone /i.test(os) &&
  17921. (data = data[/[\d.]+$/.exec(os)])) {
  17922. os = 'Windows ' + data;
  17923. }
  17924. // Correct character case and cleanup string.
  17925. os = String(os);
  17926. if (pattern && label) {
  17927. os = os.replace(RegExp(pattern, 'i'), label);
  17928. }
  17929. os = format(
  17930. os.replace(/ ce$/i, ' CE')
  17931. .replace(/\bhpw/i, 'web')
  17932. .replace(/\bMacintosh\b/, 'Mac OS')
  17933. .replace(/_PowerPC\b/i, ' OS')
  17934. .replace(/\b(OS X) [^ \d]+/i, '$1')
  17935. .replace(/\bMac (OS X)\b/, '$1')
  17936. .replace(/\/(\d)/, ' $1')
  17937. .replace(/_/g, '.')
  17938. .replace(/(?: BePC|[ .]*fc[ \d.]+)$/i, '')
  17939. .replace(/\bx86\.64\b/gi, 'x86_64')
  17940. .replace(/\b(Windows Phone) OS\b/, '$1')
  17941. .replace(/\b(Chrome OS \w+) [\d.]+\b/, '$1')
  17942. .split(' on ')[0]
  17943. );
  17944. return os;
  17945. }
  17946. /**
  17947. * An iteration utility for arrays and objects.
  17948. *
  17949. * @private
  17950. * @param {Array|Object} object The object to iterate over.
  17951. * @param {Function} callback The function called per iteration.
  17952. */
  17953. function each(object, callback) {
  17954. var index = -1,
  17955. length = object ? object.length : 0;
  17956. if (typeof length == 'number' && length > -1 && length <= maxSafeInteger) {
  17957. while (++index < length) {
  17958. callback(object[index], index, object);
  17959. }
  17960. } else {
  17961. forOwn(object, callback);
  17962. }
  17963. }
  17964. /**
  17965. * Trim and conditionally capitalize string values.
  17966. *
  17967. * @private
  17968. * @param {string} string The string to format.
  17969. * @returns {string} The formatted string.
  17970. */
  17971. function format(string) {
  17972. string = trim(string);
  17973. return /^(?:webOS|i(?:OS|P))/.test(string)
  17974. ? string
  17975. : capitalize(string);
  17976. }
  17977. /**
  17978. * Iterates over an object's own properties, executing the `callback` for each.
  17979. *
  17980. * @private
  17981. * @param {Object} object The object to iterate over.
  17982. * @param {Function} callback The function executed per own property.
  17983. */
  17984. function forOwn(object, callback) {
  17985. for (var key in object) {
  17986. if (hasOwnProperty.call(object, key)) {
  17987. callback(object[key], key, object);
  17988. }
  17989. }
  17990. }
  17991. /**
  17992. * Gets the internal `[[Class]]` of a value.
  17993. *
  17994. * @private
  17995. * @param {*} value The value.
  17996. * @returns {string} The `[[Class]]`.
  17997. */
  17998. function getClassOf(value) {
  17999. return value == null
  18000. ? capitalize(value)
  18001. : toString.call(value).slice(8, -1);
  18002. }
  18003. /**
  18004. * Host objects can return type values that are different from their actual
  18005. * data type. The objects we are concerned with usually return non-primitive
  18006. * types of "object", "function", or "unknown".
  18007. *
  18008. * @private
  18009. * @param {*} object The owner of the property.
  18010. * @param {string} property The property to check.
  18011. * @returns {boolean} Returns `true` if the property value is a non-primitive, else `false`.
  18012. */
  18013. function isHostType(object, property) {
  18014. var type = object != null ? typeof object[property] : 'number';
  18015. return !/^(?:boolean|number|string|undefined)$/.test(type) &&
  18016. (type == 'object' ? !!object[property] : true);
  18017. }
  18018. /**
  18019. * Prepares a string for use in a `RegExp` by making hyphens and spaces optional.
  18020. *
  18021. * @private
  18022. * @param {string} string The string to qualify.
  18023. * @returns {string} The qualified string.
  18024. */
  18025. function qualify(string) {
  18026. return String(string).replace(/([ -])(?!$)/g, '$1?');
  18027. }
  18028. /**
  18029. * A bare-bones `Array#reduce` like utility function.
  18030. *
  18031. * @private
  18032. * @param {Array} array The array to iterate over.
  18033. * @param {Function} callback The function called per iteration.
  18034. * @returns {*} The accumulated result.
  18035. */
  18036. function reduce(array, callback) {
  18037. var accumulator = null;
  18038. each(array, function(value, index) {
  18039. accumulator = callback(accumulator, value, index, array);
  18040. });
  18041. return accumulator;
  18042. }
  18043. /**
  18044. * Removes leading and trailing whitespace from a string.
  18045. *
  18046. * @private
  18047. * @param {string} string The string to trim.
  18048. * @returns {string} The trimmed string.
  18049. */
  18050. function trim(string) {
  18051. return String(string).replace(/^ +| +$/g, '');
  18052. }
  18053. /*--------------------------------------------------------------------------*/
  18054. /**
  18055. * Creates a new platform object.
  18056. *
  18057. * @memberOf platform
  18058. * @param {Object|string} [ua=navigator.userAgent] The user agent string or
  18059. * context object.
  18060. * @returns {Object} A platform object.
  18061. */
  18062. function parse(ua) {
  18063. /** The environment context object. */
  18064. var context = root;
  18065. /** Used to flag when a custom context is provided. */
  18066. var isCustomContext = ua && typeof ua == 'object' && getClassOf(ua) != 'String';
  18067. // Juggle arguments.
  18068. if (isCustomContext) {
  18069. context = ua;
  18070. ua = null;
  18071. }
  18072. /** Browser navigator object. */
  18073. var nav = context.navigator || {};
  18074. /** Browser user agent string. */
  18075. var userAgent = nav.userAgent || '';
  18076. ua || (ua = userAgent);
  18077. /** Used to flag when `thisBinding` is the [ModuleScope]. */
  18078. var isModuleScope = isCustomContext || thisBinding == oldRoot;
  18079. /** Used to detect if browser is like Chrome. */
  18080. var likeChrome = isCustomContext
  18081. ? !!nav.likeChrome
  18082. : /\bChrome\b/.test(ua) && !/internal|\n/i.test(toString.toString());
  18083. /** Internal `[[Class]]` value shortcuts. */
  18084. var objectClass = 'Object',
  18085. airRuntimeClass = isCustomContext ? objectClass : 'ScriptBridgingProxyObject',
  18086. enviroClass = isCustomContext ? objectClass : 'Environment',
  18087. javaClass = (isCustomContext && context.java) ? 'JavaPackage' : getClassOf(context.java),
  18088. phantomClass = isCustomContext ? objectClass : 'RuntimeObject';
  18089. /** Detect Java environments. */
  18090. var java = /\bJava/.test(javaClass) && context.java;
  18091. /** Detect Rhino. */
  18092. var rhino = java && getClassOf(context.environment) == enviroClass;
  18093. /** A character to represent alpha. */
  18094. var alpha = java ? 'a' : '\u03b1';
  18095. /** A character to represent beta. */
  18096. var beta = java ? 'b' : '\u03b2';
  18097. /** Browser document object. */
  18098. var doc = context.document || {};
  18099. /**
  18100. * Detect Opera browser (Presto-based).
  18101. * http://www.howtocreate.co.uk/operaStuff/operaObject.html
  18102. * http://dev.opera.com/articles/view/opera-mini-web-content-authoring-guidelines/#operamini
  18103. */
  18104. var opera = context.operamini || context.opera;
  18105. /** Opera `[[Class]]`. */
  18106. var operaClass = reOpera.test(operaClass = (isCustomContext && opera) ? opera['[[Class]]'] : getClassOf(opera))
  18107. ? operaClass
  18108. : (opera = null);
  18109. /*------------------------------------------------------------------------*/
  18110. /** Temporary variable used over the script's lifetime. */
  18111. var data;
  18112. /** The CPU architecture. */
  18113. var arch = ua;
  18114. /** Platform description array. */
  18115. var description = [];
  18116. /** Platform alpha/beta indicator. */
  18117. var prerelease = null;
  18118. /** A flag to indicate that environment features should be used to resolve the platform. */
  18119. var useFeatures = ua == userAgent;
  18120. /** The browser/environment version. */
  18121. var version = useFeatures && opera && typeof opera.version == 'function' && opera.version();
  18122. /** A flag to indicate if the OS ends with "/ Version" */
  18123. var isSpecialCasedOS;
  18124. /* Detectable layout engines (order is important). */
  18125. var layout = getLayout([
  18126. { 'label': 'EdgeHTML', 'pattern': 'Edge' },
  18127. 'Trident',
  18128. { 'label': 'WebKit', 'pattern': 'AppleWebKit' },
  18129. 'iCab',
  18130. 'Presto',
  18131. 'NetFront',
  18132. 'Tasman',
  18133. 'KHTML',
  18134. 'Gecko'
  18135. ]);
  18136. /* Detectable browser names (order is important). */
  18137. var name = getName([
  18138. 'Adobe AIR',
  18139. 'Arora',
  18140. 'Avant Browser',
  18141. 'Breach',
  18142. 'Camino',
  18143. 'Electron',
  18144. 'Epiphany',
  18145. 'Fennec',
  18146. 'Flock',
  18147. 'Galeon',
  18148. 'GreenBrowser',
  18149. 'iCab',
  18150. 'Iceweasel',
  18151. 'K-Meleon',
  18152. 'Konqueror',
  18153. 'Lunascape',
  18154. 'Maxthon',
  18155. { 'label': 'Microsoft Edge', 'pattern': '(?:Edge|Edg|EdgA|EdgiOS)' },
  18156. 'Midori',
  18157. 'Nook Browser',
  18158. 'PaleMoon',
  18159. 'PhantomJS',
  18160. 'Raven',
  18161. 'Rekonq',
  18162. 'RockMelt',
  18163. { 'label': 'Samsung Internet', 'pattern': 'SamsungBrowser' },
  18164. 'SeaMonkey',
  18165. { 'label': 'Silk', 'pattern': '(?:Cloud9|Silk-Accelerated)' },
  18166. 'Sleipnir',
  18167. 'SlimBrowser',
  18168. { 'label': 'SRWare Iron', 'pattern': 'Iron' },
  18169. 'Sunrise',
  18170. 'Swiftfox',
  18171. 'Vivaldi',
  18172. 'Waterfox',
  18173. 'WebPositive',
  18174. { 'label': 'Yandex Browser', 'pattern': 'YaBrowser' },
  18175. { 'label': 'UC Browser', 'pattern': 'UCBrowser' },
  18176. 'Opera Mini',
  18177. { 'label': 'Opera Mini', 'pattern': 'OPiOS' },
  18178. 'Opera',
  18179. { 'label': 'Opera', 'pattern': 'OPR' },
  18180. 'Chromium',
  18181. 'Chrome',
  18182. { 'label': 'Chrome', 'pattern': '(?:HeadlessChrome)' },
  18183. { 'label': 'Chrome Mobile', 'pattern': '(?:CriOS|CrMo)' },
  18184. { 'label': 'Firefox', 'pattern': '(?:Firefox|Minefield)' },
  18185. { 'label': 'Firefox for iOS', 'pattern': 'FxiOS' },
  18186. { 'label': 'IE', 'pattern': 'IEMobile' },
  18187. { 'label': 'IE', 'pattern': 'MSIE' },
  18188. 'Safari'
  18189. ]);
  18190. /* Detectable products (order is important). */
  18191. var product = getProduct([
  18192. { 'label': 'BlackBerry', 'pattern': 'BB10' },
  18193. 'BlackBerry',
  18194. { 'label': 'Galaxy S', 'pattern': 'GT-I9000' },
  18195. { 'label': 'Galaxy S2', 'pattern': 'GT-I9100' },
  18196. { 'label': 'Galaxy S3', 'pattern': 'GT-I9300' },
  18197. { 'label': 'Galaxy S4', 'pattern': 'GT-I9500' },
  18198. { 'label': 'Galaxy S5', 'pattern': 'SM-G900' },
  18199. { 'label': 'Galaxy S6', 'pattern': 'SM-G920' },
  18200. { 'label': 'Galaxy S6 Edge', 'pattern': 'SM-G925' },
  18201. { 'label': 'Galaxy S7', 'pattern': 'SM-G930' },
  18202. { 'label': 'Galaxy S7 Edge', 'pattern': 'SM-G935' },
  18203. 'Google TV',
  18204. 'Lumia',
  18205. 'iPad',
  18206. 'iPod',
  18207. 'iPhone',
  18208. 'Kindle',
  18209. { 'label': 'Kindle Fire', 'pattern': '(?:Cloud9|Silk-Accelerated)' },
  18210. 'Nexus',
  18211. 'Nook',
  18212. 'PlayBook',
  18213. 'PlayStation Vita',
  18214. 'PlayStation',
  18215. 'TouchPad',
  18216. 'Transformer',
  18217. { 'label': 'Wii U', 'pattern': 'WiiU' },
  18218. 'Wii',
  18219. 'Xbox One',
  18220. { 'label': 'Xbox 360', 'pattern': 'Xbox' },
  18221. 'Xoom'
  18222. ]);
  18223. /* Detectable manufacturers. */
  18224. var manufacturer = getManufacturer({
  18225. 'Apple': { 'iPad': 1, 'iPhone': 1, 'iPod': 1 },
  18226. 'Alcatel': {},
  18227. 'Archos': {},
  18228. 'Amazon': { 'Kindle': 1, 'Kindle Fire': 1 },
  18229. 'Asus': { 'Transformer': 1 },
  18230. 'Barnes & Noble': { 'Nook': 1 },
  18231. 'BlackBerry': { 'PlayBook': 1 },
  18232. 'Google': { 'Google TV': 1, 'Nexus': 1 },
  18233. 'HP': { 'TouchPad': 1 },
  18234. 'HTC': {},
  18235. 'Huawei': {},
  18236. 'Lenovo': {},
  18237. 'LG': {},
  18238. 'Microsoft': { 'Xbox': 1, 'Xbox One': 1 },
  18239. 'Motorola': { 'Xoom': 1 },
  18240. 'Nintendo': { 'Wii U': 1, 'Wii': 1 },
  18241. 'Nokia': { 'Lumia': 1 },
  18242. 'Oppo': {},
  18243. 'Samsung': { 'Galaxy S': 1, 'Galaxy S2': 1, 'Galaxy S3': 1, 'Galaxy S4': 1 },
  18244. 'Sony': { 'PlayStation': 1, 'PlayStation Vita': 1 },
  18245. 'Xiaomi': { 'Mi': 1, 'Redmi': 1 }
  18246. });
  18247. /* Detectable operating systems (order is important). */
  18248. var os = getOS([
  18249. 'Windows Phone',
  18250. 'KaiOS',
  18251. 'Android',
  18252. 'CentOS',
  18253. { 'label': 'Chrome OS', 'pattern': 'CrOS' },
  18254. 'Debian',
  18255. { 'label': 'DragonFly BSD', 'pattern': 'DragonFly' },
  18256. 'Fedora',
  18257. 'FreeBSD',
  18258. 'Gentoo',
  18259. 'Haiku',
  18260. 'Kubuntu',
  18261. 'Linux Mint',
  18262. 'OpenBSD',
  18263. 'Red Hat',
  18264. 'SuSE',
  18265. 'Ubuntu',
  18266. 'Xubuntu',
  18267. 'Cygwin',
  18268. 'Symbian OS',
  18269. 'hpwOS',
  18270. 'webOS ',
  18271. 'webOS',
  18272. 'Tablet OS',
  18273. 'Tizen',
  18274. 'Linux',
  18275. 'Mac OS X',
  18276. 'Macintosh',
  18277. 'Mac',
  18278. 'Windows 98;',
  18279. 'Windows '
  18280. ]);
  18281. /*------------------------------------------------------------------------*/
  18282. /**
  18283. * Picks the layout engine from an array of guesses.
  18284. *
  18285. * @private
  18286. * @param {Array} guesses An array of guesses.
  18287. * @returns {null|string} The detected layout engine.
  18288. */
  18289. function getLayout(guesses) {
  18290. return reduce(guesses, function(result, guess) {
  18291. return result || RegExp('\\b' + (
  18292. guess.pattern || qualify(guess)
  18293. ) + '\\b', 'i').exec(ua) && (guess.label || guess);
  18294. });
  18295. }
  18296. /**
  18297. * Picks the manufacturer from an array of guesses.
  18298. *
  18299. * @private
  18300. * @param {Array} guesses An object of guesses.
  18301. * @returns {null|string} The detected manufacturer.
  18302. */
  18303. function getManufacturer(guesses) {
  18304. return reduce(guesses, function(result, value, key) {
  18305. // Lookup the manufacturer by product or scan the UA for the manufacturer.
  18306. return result || (
  18307. value[product] ||
  18308. value[/^[a-z]+(?: +[a-z]+\b)*/i.exec(product)] ||
  18309. RegExp('\\b' + qualify(key) + '(?:\\b|\\w*\\d)', 'i').exec(ua)
  18310. ) && key;
  18311. });
  18312. }
  18313. /**
  18314. * Picks the browser name from an array of guesses.
  18315. *
  18316. * @private
  18317. * @param {Array} guesses An array of guesses.
  18318. * @returns {null|string} The detected browser name.
  18319. */
  18320. function getName(guesses) {
  18321. return reduce(guesses, function(result, guess) {
  18322. return result || RegExp('\\b' + (
  18323. guess.pattern || qualify(guess)
  18324. ) + '\\b', 'i').exec(ua) && (guess.label || guess);
  18325. });
  18326. }
  18327. /**
  18328. * Picks the OS name from an array of guesses.
  18329. *
  18330. * @private
  18331. * @param {Array} guesses An array of guesses.
  18332. * @returns {null|string} The detected OS name.
  18333. */
  18334. function getOS(guesses) {
  18335. return reduce(guesses, function(result, guess) {
  18336. var pattern = guess.pattern || qualify(guess);
  18337. if (!result && (result =
  18338. RegExp('\\b' + pattern + '(?:/[\\d.]+|[ \\w.]*)', 'i').exec(ua)
  18339. )) {
  18340. result = cleanupOS(result, pattern, guess.label || guess);
  18341. }
  18342. return result;
  18343. });
  18344. }
  18345. /**
  18346. * Picks the product name from an array of guesses.
  18347. *
  18348. * @private
  18349. * @param {Array} guesses An array of guesses.
  18350. * @returns {null|string} The detected product name.
  18351. */
  18352. function getProduct(guesses) {
  18353. return reduce(guesses, function(result, guess) {
  18354. var pattern = guess.pattern || qualify(guess);
  18355. if (!result && (result =
  18356. RegExp('\\b' + pattern + ' *\\d+[.\\w_]*', 'i').exec(ua) ||
  18357. RegExp('\\b' + pattern + ' *\\w+-[\\w]*', 'i').exec(ua) ||
  18358. RegExp('\\b' + pattern + '(?:; *(?:[a-z]+[_-])?[a-z]+\\d+|[^ ();-]*)', 'i').exec(ua)
  18359. )) {
  18360. // Split by forward slash and append product version if needed.
  18361. if ((result = String((guess.label && !RegExp(pattern, 'i').test(guess.label)) ? guess.label : result).split('/'))[1] && !/[\d.]+/.test(result[0])) {
  18362. result[0] += ' ' + result[1];
  18363. }
  18364. // Correct character case and cleanup string.
  18365. guess = guess.label || guess;
  18366. result = format(result[0]
  18367. .replace(RegExp(pattern, 'i'), guess)
  18368. .replace(RegExp('; *(?:' + guess + '[_-])?', 'i'), ' ')
  18369. .replace(RegExp('(' + guess + ')[-_.]?(\\w)', 'i'), '$1 $2'));
  18370. }
  18371. return result;
  18372. });
  18373. }
  18374. /**
  18375. * Resolves the version using an array of UA patterns.
  18376. *
  18377. * @private
  18378. * @param {Array} patterns An array of UA patterns.
  18379. * @returns {null|string} The detected version.
  18380. */
  18381. function getVersion(patterns) {
  18382. return reduce(patterns, function(result, pattern) {
  18383. return result || (RegExp(pattern +
  18384. '(?:-[\\d.]+/|(?: for [\\w-]+)?[ /-])([\\d.]+[^ ();/_-]*)', 'i').exec(ua) || 0)[1] || null;
  18385. });
  18386. }
  18387. /**
  18388. * Returns `platform.description` when the platform object is coerced to a string.
  18389. *
  18390. * @name toString
  18391. * @memberOf platform
  18392. * @returns {string} Returns `platform.description` if available, else an empty string.
  18393. */
  18394. function toStringPlatform() {
  18395. return this.description || '';
  18396. }
  18397. /*------------------------------------------------------------------------*/
  18398. // Convert layout to an array so we can add extra details.
  18399. layout && (layout = [layout]);
  18400. // Detect Android products.
  18401. // Browsers on Android devices typically provide their product IDS after "Android;"
  18402. // up to "Build" or ") AppleWebKit".
  18403. // Example:
  18404. // "Mozilla/5.0 (Linux; Android 8.1.0; Moto G (5) Plus) AppleWebKit/537.36
  18405. // (KHTML, like Gecko) Chrome/70.0.3538.80 Mobile Safari/537.36"
  18406. if (/\bAndroid\b/.test(os) && !product &&
  18407. (data = /\bAndroid[^;]*;(.*?)(?:Build|\) AppleWebKit)\b/i.exec(ua))) {
  18408. product = trim(data[1])
  18409. // Replace any language codes (eg. "en-US").
  18410. .replace(/^[a-z]{2}-[a-z]{2};\s*/i, '')
  18411. || null;
  18412. }
  18413. // Detect product names that contain their manufacturer's name.
  18414. if (manufacturer && !product) {
  18415. product = getProduct([manufacturer]);
  18416. } else if (manufacturer && product) {
  18417. product = product
  18418. .replace(RegExp('^(' + qualify(manufacturer) + ')[-_.\\s]', 'i'), manufacturer + ' ')
  18419. .replace(RegExp('^(' + qualify(manufacturer) + ')[-_.]?(\\w)', 'i'), manufacturer + ' $2');
  18420. }
  18421. // Clean up Google TV.
  18422. if ((data = /\bGoogle TV\b/.exec(product))) {
  18423. product = data[0];
  18424. }
  18425. // Detect simulators.
  18426. if (/\bSimulator\b/i.test(ua)) {
  18427. product = (product ? product + ' ' : '') + 'Simulator';
  18428. }
  18429. // Detect Opera Mini 8+ running in Turbo/Uncompressed mode on iOS.
  18430. if (name == 'Opera Mini' && /\bOPiOS\b/.test(ua)) {
  18431. description.push('running in Turbo/Uncompressed mode');
  18432. }
  18433. // Detect IE Mobile 11.
  18434. if (name == 'IE' && /\blike iPhone OS\b/.test(ua)) {
  18435. data = parse(ua.replace(/like iPhone OS/, ''));
  18436. manufacturer = data.manufacturer;
  18437. product = data.product;
  18438. }
  18439. // Detect iOS.
  18440. else if (/^iP/.test(product)) {
  18441. name || (name = 'Safari');
  18442. os = 'iOS' + ((data = / OS ([\d_]+)/i.exec(ua))
  18443. ? ' ' + data[1].replace(/_/g, '.')
  18444. : '');
  18445. }
  18446. // Detect Kubuntu.
  18447. else if (name == 'Konqueror' && /^Linux\b/i.test(os)) {
  18448. os = 'Kubuntu';
  18449. }
  18450. // Detect Android browsers.
  18451. else if ((manufacturer && manufacturer != 'Google' &&
  18452. ((/Chrome/.test(name) && !/\bMobile Safari\b/i.test(ua)) || /\bVita\b/.test(product))) ||
  18453. (/\bAndroid\b/.test(os) && /^Chrome/.test(name) && /\bVersion\//i.test(ua))) {
  18454. name = 'Android Browser';
  18455. os = /\bAndroid\b/.test(os) ? os : 'Android';
  18456. }
  18457. // Detect Silk desktop/accelerated modes.
  18458. else if (name == 'Silk') {
  18459. if (!/\bMobi/i.test(ua)) {
  18460. os = 'Android';
  18461. description.unshift('desktop mode');
  18462. }
  18463. if (/Accelerated *= *true/i.test(ua)) {
  18464. description.unshift('accelerated');
  18465. }
  18466. }
  18467. // Detect UC Browser speed mode.
  18468. else if (name == 'UC Browser' && /\bUCWEB\b/.test(ua)) {
  18469. description.push('speed mode');
  18470. }
  18471. // Detect PaleMoon identifying as Firefox.
  18472. else if (name == 'PaleMoon' && (data = /\bFirefox\/([\d.]+)\b/.exec(ua))) {
  18473. description.push('identifying as Firefox ' + data[1]);
  18474. }
  18475. // Detect Firefox OS and products running Firefox.
  18476. else if (name == 'Firefox' && (data = /\b(Mobile|Tablet|TV)\b/i.exec(ua))) {
  18477. os || (os = 'Firefox OS');
  18478. product || (product = data[1]);
  18479. }
  18480. // Detect false positives for Firefox/Safari.
  18481. else if (!name || (data = !/\bMinefield\b/i.test(ua) && /\b(?:Firefox|Safari)\b/.exec(name))) {
  18482. // Escape the `/` for Firefox 1.
  18483. if (name && !product && /[\/,]|^[^(]+?\)/.test(ua.slice(ua.indexOf(data + '/') + 8))) {
  18484. // Clear name of false positives.
  18485. name = null;
  18486. }
  18487. // Reassign a generic name.
  18488. if ((data = product || manufacturer || os) &&
  18489. (product || manufacturer || /\b(?:Android|Symbian OS|Tablet OS|webOS)\b/.test(os))) {
  18490. name = /[a-z]+(?: Hat)?/i.exec(/\bAndroid\b/.test(os) ? os : data) + ' Browser';
  18491. }
  18492. }
  18493. // Add Chrome version to description for Electron.
  18494. else if (name == 'Electron' && (data = (/\bChrome\/([\d.]+)\b/.exec(ua) || 0)[1])) {
  18495. description.push('Chromium ' + data);
  18496. }
  18497. // Detect non-Opera (Presto-based) versions (order is important).
  18498. if (!version) {
  18499. version = getVersion([
  18500. '(?:Cloud9|CriOS|CrMo|Edge|Edg|EdgA|EdgiOS|FxiOS|HeadlessChrome|IEMobile|Iron|Opera ?Mini|OPiOS|OPR|Raven|SamsungBrowser|Silk(?!/[\\d.]+$)|UCBrowser|YaBrowser)',
  18501. 'Version',
  18502. qualify(name),
  18503. '(?:Firefox|Minefield|NetFront)'
  18504. ]);
  18505. }
  18506. // Detect stubborn layout engines.
  18507. if ((data =
  18508. layout == 'iCab' && parseFloat(version) > 3 && 'WebKit' ||
  18509. /\bOpera\b/.test(name) && (/\bOPR\b/.test(ua) ? 'Blink' : 'Presto') ||
  18510. /\b(?:Midori|Nook|Safari)\b/i.test(ua) && !/^(?:Trident|EdgeHTML)$/.test(layout) && 'WebKit' ||
  18511. !layout && /\bMSIE\b/i.test(ua) && (os == 'Mac OS' ? 'Tasman' : 'Trident') ||
  18512. layout == 'WebKit' && /\bPlayStation\b(?! Vita\b)/i.test(name) && 'NetFront'
  18513. )) {
  18514. layout = [data];
  18515. }
  18516. // Detect Windows Phone 7 desktop mode.
  18517. if (name == 'IE' && (data = (/; *(?:XBLWP|ZuneWP)(\d+)/i.exec(ua) || 0)[1])) {
  18518. name += ' Mobile';
  18519. os = 'Windows Phone ' + (/\+$/.test(data) ? data : data + '.x');
  18520. description.unshift('desktop mode');
  18521. }
  18522. // Detect Windows Phone 8.x desktop mode.
  18523. else if (/\bWPDesktop\b/i.test(ua)) {
  18524. name = 'IE Mobile';
  18525. os = 'Windows Phone 8.x';
  18526. description.unshift('desktop mode');
  18527. version || (version = (/\brv:([\d.]+)/.exec(ua) || 0)[1]);
  18528. }
  18529. // Detect IE 11 identifying as other browsers.
  18530. else if (name != 'IE' && layout == 'Trident' && (data = /\brv:([\d.]+)/.exec(ua))) {
  18531. if (name) {
  18532. description.push('identifying as ' + name + (version ? ' ' + version : ''));
  18533. }
  18534. name = 'IE';
  18535. version = data[1];
  18536. }
  18537. // Leverage environment features.
  18538. if (useFeatures) {
  18539. // Detect server-side environments.
  18540. // Rhino has a global function while others have a global object.
  18541. if (isHostType(context, 'global')) {
  18542. if (java) {
  18543. data = java.lang.System;
  18544. arch = data.getProperty('os.arch');
  18545. os = os || data.getProperty('os.name') + ' ' + data.getProperty('os.version');
  18546. }
  18547. if (rhino) {
  18548. try {
  18549. version = context.require('ringo/engine').version.join('.');
  18550. name = 'RingoJS';
  18551. } catch(e) {
  18552. if ((data = context.system) && data.global.system == context.system) {
  18553. name = 'Narwhal';
  18554. os || (os = data[0].os || null);
  18555. }
  18556. }
  18557. if (!name) {
  18558. name = 'Rhino';
  18559. }
  18560. }
  18561. else if (
  18562. typeof context.process == 'object' && !context.process.browser &&
  18563. (data = context.process)
  18564. ) {
  18565. if (typeof data.versions == 'object') {
  18566. if (typeof data.versions.electron == 'string') {
  18567. description.push('Node ' + data.versions.node);
  18568. name = 'Electron';
  18569. version = data.versions.electron;
  18570. } else if (typeof data.versions.nw == 'string') {
  18571. description.push('Chromium ' + version, 'Node ' + data.versions.node);
  18572. name = 'NW.js';
  18573. version = data.versions.nw;
  18574. }
  18575. }
  18576. if (!name) {
  18577. name = 'Node.js';
  18578. arch = data.arch;
  18579. os = data.platform;
  18580. version = /[\d.]+/.exec(data.version);
  18581. version = version ? version[0] : null;
  18582. }
  18583. }
  18584. }
  18585. // Detect Adobe AIR.
  18586. else if (getClassOf((data = context.runtime)) == airRuntimeClass) {
  18587. name = 'Adobe AIR';
  18588. os = data.flash.system.Capabilities.os;
  18589. }
  18590. // Detect PhantomJS.
  18591. else if (getClassOf((data = context.phantom)) == phantomClass) {
  18592. name = 'PhantomJS';
  18593. version = (data = data.version || null) && (data.major + '.' + data.minor + '.' + data.patch);
  18594. }
  18595. // Detect IE compatibility modes.
  18596. else if (typeof doc.documentMode == 'number' && (data = /\bTrident\/(\d+)/i.exec(ua))) {
  18597. // We're in compatibility mode when the Trident version + 4 doesn't
  18598. // equal the document mode.
  18599. version = [version, doc.documentMode];
  18600. if ((data = +data[1] + 4) != version[1]) {
  18601. description.push('IE ' + version[1] + ' mode');
  18602. layout && (layout[1] = '');
  18603. version[1] = data;
  18604. }
  18605. version = name == 'IE' ? String(version[1].toFixed(1)) : version[0];
  18606. }
  18607. // Detect IE 11 masking as other browsers.
  18608. else if (typeof doc.documentMode == 'number' && /^(?:Chrome|Firefox)\b/.test(name)) {
  18609. description.push('masking as ' + name + ' ' + version);
  18610. name = 'IE';
  18611. version = '11.0';
  18612. layout = ['Trident'];
  18613. os = 'Windows';
  18614. }
  18615. os = os && format(os);
  18616. }
  18617. // Detect prerelease phases.
  18618. if (version && (data =
  18619. /(?:[ab]|dp|pre|[ab]\d+pre)(?:\d+\+?)?$/i.exec(version) ||
  18620. /(?:alpha|beta)(?: ?\d)?/i.exec(ua + ';' + (useFeatures && nav.appMinorVersion)) ||
  18621. /\bMinefield\b/i.test(ua) && 'a'
  18622. )) {
  18623. prerelease = /b/i.test(data) ? 'beta' : 'alpha';
  18624. version = version.replace(RegExp(data + '\\+?$'), '') +
  18625. (prerelease == 'beta' ? beta : alpha) + (/\d+\+?/.exec(data) || '');
  18626. }
  18627. // Detect Firefox Mobile.
  18628. if (name == 'Fennec' || name == 'Firefox' && /\b(?:Android|Firefox OS|KaiOS)\b/.test(os)) {
  18629. name = 'Firefox Mobile';
  18630. }
  18631. // Obscure Maxthon's unreliable version.
  18632. else if (name == 'Maxthon' && version) {
  18633. version = version.replace(/\.[\d.]+/, '.x');
  18634. }
  18635. // Detect Xbox 360 and Xbox One.
  18636. else if (/\bXbox\b/i.test(product)) {
  18637. if (product == 'Xbox 360') {
  18638. os = null;
  18639. }
  18640. if (product == 'Xbox 360' && /\bIEMobile\b/.test(ua)) {
  18641. description.unshift('mobile mode');
  18642. }
  18643. }
  18644. // Add mobile postfix.
  18645. else if ((/^(?:Chrome|IE|Opera)$/.test(name) || name && !product && !/Browser|Mobi/.test(name)) &&
  18646. (os == 'Windows CE' || /Mobi/i.test(ua))) {
  18647. name += ' Mobile';
  18648. }
  18649. // Detect IE platform preview.
  18650. else if (name == 'IE' && useFeatures) {
  18651. try {
  18652. if (context.external === null) {
  18653. description.unshift('platform preview');
  18654. }
  18655. } catch(e) {
  18656. description.unshift('embedded');
  18657. }
  18658. }
  18659. // Detect BlackBerry OS version.
  18660. // http://docs.blackberry.com/en/developers/deliverables/18169/HTTP_headers_sent_by_BB_Browser_1234911_11.jsp
  18661. else if ((/\bBlackBerry\b/.test(product) || /\bBB10\b/.test(ua)) && (data =
  18662. (RegExp(product.replace(/ +/g, ' *') + '/([.\\d]+)', 'i').exec(ua) || 0)[1] ||
  18663. version
  18664. )) {
  18665. data = [data, /BB10/.test(ua)];
  18666. os = (data[1] ? (product = null, manufacturer = 'BlackBerry') : 'Device Software') + ' ' + data[0];
  18667. version = null;
  18668. }
  18669. // Detect Opera identifying/masking itself as another browser.
  18670. // http://www.opera.com/support/kb/view/843/
  18671. else if (this != forOwn && product != 'Wii' && (
  18672. (useFeatures && opera) ||
  18673. (/Opera/.test(name) && /\b(?:MSIE|Firefox)\b/i.test(ua)) ||
  18674. (name == 'Firefox' && /\bOS X (?:\d+\.){2,}/.test(os)) ||
  18675. (name == 'IE' && (
  18676. (os && !/^Win/.test(os) && version > 5.5) ||
  18677. /\bWindows XP\b/.test(os) && version > 8 ||
  18678. version == 8 && !/\bTrident\b/.test(ua)
  18679. ))
  18680. ) && !reOpera.test((data = parse.call(forOwn, ua.replace(reOpera, '') + ';'))) && data.name) {
  18681. // When "identifying", the UA contains both Opera and the other browser's name.
  18682. data = 'ing as ' + data.name + ((data = data.version) ? ' ' + data : '');
  18683. if (reOpera.test(name)) {
  18684. if (/\bIE\b/.test(data) && os == 'Mac OS') {
  18685. os = null;
  18686. }
  18687. data = 'identify' + data;
  18688. }
  18689. // When "masking", the UA contains only the other browser's name.
  18690. else {
  18691. data = 'mask' + data;
  18692. if (operaClass) {
  18693. name = format(operaClass.replace(/([a-z])([A-Z])/g, '$1 $2'));
  18694. } else {
  18695. name = 'Opera';
  18696. }
  18697. if (/\bIE\b/.test(data)) {
  18698. os = null;
  18699. }
  18700. if (!useFeatures) {
  18701. version = null;
  18702. }
  18703. }
  18704. layout = ['Presto'];
  18705. description.push(data);
  18706. }
  18707. // Detect WebKit Nightly and approximate Chrome/Safari versions.
  18708. if ((data = (/\bAppleWebKit\/([\d.]+\+?)/i.exec(ua) || 0)[1])) {
  18709. // Correct build number for numeric comparison.
  18710. // (e.g. "532.5" becomes "532.05")
  18711. data = [parseFloat(data.replace(/\.(\d)$/, '.0$1')), data];
  18712. // Nightly builds are postfixed with a "+".
  18713. if (name == 'Safari' && data[1].slice(-1) == '+') {
  18714. name = 'WebKit Nightly';
  18715. prerelease = 'alpha';
  18716. version = data[1].slice(0, -1);
  18717. }
  18718. // Clear incorrect browser versions.
  18719. else if (version == data[1] ||
  18720. version == (data[2] = (/\bSafari\/([\d.]+\+?)/i.exec(ua) || 0)[1])) {
  18721. version = null;
  18722. }
  18723. // Use the full Chrome version when available.
  18724. data[1] = (/\b(?:Headless)?Chrome\/([\d.]+)/i.exec(ua) || 0)[1];
  18725. // Detect Blink layout engine.
  18726. if (data[0] == 537.36 && data[2] == 537.36 && parseFloat(data[1]) >= 28 && layout == 'WebKit') {
  18727. layout = ['Blink'];
  18728. }
  18729. // Detect JavaScriptCore.
  18730. // http://stackoverflow.com/questions/6768474/how-can-i-detect-which-javascript-engine-v8-or-jsc-is-used-at-runtime-in-androi
  18731. if (!useFeatures || (!likeChrome && !data[1])) {
  18732. layout && (layout[1] = 'like Safari');
  18733. data = (data = data[0], data < 400 ? 1 : data < 500 ? 2 : data < 526 ? 3 : data < 533 ? 4 : data < 534 ? '4+' : data < 535 ? 5 : data < 537 ? 6 : data < 538 ? 7 : data < 601 ? 8 : data < 602 ? 9 : data < 604 ? 10 : data < 606 ? 11 : data < 608 ? 12 : '12');
  18734. } else {
  18735. layout && (layout[1] = 'like Chrome');
  18736. data = data[1] || (data = data[0], data < 530 ? 1 : data < 532 ? 2 : data < 532.05 ? 3 : data < 533 ? 4 : data < 534.03 ? 5 : data < 534.07 ? 6 : data < 534.10 ? 7 : data < 534.13 ? 8 : data < 534.16 ? 9 : data < 534.24 ? 10 : data < 534.30 ? 11 : data < 535.01 ? 12 : data < 535.02 ? '13+' : data < 535.07 ? 15 : data < 535.11 ? 16 : data < 535.19 ? 17 : data < 536.05 ? 18 : data < 536.10 ? 19 : data < 537.01 ? 20 : data < 537.11 ? '21+' : data < 537.13 ? 23 : data < 537.18 ? 24 : data < 537.24 ? 25 : data < 537.36 ? 26 : layout != 'Blink' ? '27' : '28');
  18737. }
  18738. // Add the postfix of ".x" or "+" for approximate versions.
  18739. layout && (layout[1] += ' ' + (data += typeof data == 'number' ? '.x' : /[.+]/.test(data) ? '' : '+'));
  18740. // Obscure version for some Safari 1-2 releases.
  18741. if (name == 'Safari' && (!version || parseInt(version) > 45)) {
  18742. version = data;
  18743. } else if (name == 'Chrome' && /\bHeadlessChrome/i.test(ua)) {
  18744. description.unshift('headless');
  18745. }
  18746. }
  18747. // Detect Opera desktop modes.
  18748. if (name == 'Opera' && (data = /\bzbov|zvav$/.exec(os))) {
  18749. name += ' ';
  18750. description.unshift('desktop mode');
  18751. if (data == 'zvav') {
  18752. name += 'Mini';
  18753. version = null;
  18754. } else {
  18755. name += 'Mobile';
  18756. }
  18757. os = os.replace(RegExp(' *' + data + '$'), '');
  18758. }
  18759. // Detect Chrome desktop mode.
  18760. else if (name == 'Safari' && /\bChrome\b/.exec(layout && layout[1])) {
  18761. description.unshift('desktop mode');
  18762. name = 'Chrome Mobile';
  18763. version = null;
  18764. if (/\bOS X\b/.test(os)) {
  18765. manufacturer = 'Apple';
  18766. os = 'iOS 4.3+';
  18767. } else {
  18768. os = null;
  18769. }
  18770. }
  18771. // Newer versions of SRWare Iron uses the Chrome tag to indicate its version number.
  18772. else if (/\bSRWare Iron\b/.test(name) && !version) {
  18773. version = getVersion('Chrome');
  18774. }
  18775. // Strip incorrect OS versions.
  18776. if (version && version.indexOf((data = /[\d.]+$/.exec(os))) == 0 &&
  18777. ua.indexOf('/' + data + '-') > -1) {
  18778. os = trim(os.replace(data, ''));
  18779. }
  18780. // Ensure OS does not include the browser name.
  18781. if (os && os.indexOf(name) != -1 && !RegExp(name + ' OS').test(os)) {
  18782. os = os.replace(RegExp(' *' + qualify(name) + ' *'), '');
  18783. }
  18784. // Add layout engine.
  18785. if (layout && !/\b(?:Avant|Nook)\b/.test(name) && (
  18786. /Browser|Lunascape|Maxthon/.test(name) ||
  18787. name != 'Safari' && /^iOS/.test(os) && /\bSafari\b/.test(layout[1]) ||
  18788. /^(?:Adobe|Arora|Breach|Midori|Opera|Phantom|Rekonq|Rock|Samsung Internet|Sleipnir|SRWare Iron|Vivaldi|Web)/.test(name) && layout[1])) {
  18789. // Don't add layout details to description if they are falsey.
  18790. (data = layout[layout.length - 1]) && description.push(data);
  18791. }
  18792. // Combine contextual information.
  18793. if (description.length) {
  18794. description = ['(' + description.join('; ') + ')'];
  18795. }
  18796. // Append manufacturer to description.
  18797. if (manufacturer && product && product.indexOf(manufacturer) < 0) {
  18798. description.push('on ' + manufacturer);
  18799. }
  18800. // Append product to description.
  18801. if (product) {
  18802. description.push((/^on /.test(description[description.length - 1]) ? '' : 'on ') + product);
  18803. }
  18804. // Parse the OS into an object.
  18805. if (os) {
  18806. data = / ([\d.+]+)$/.exec(os);
  18807. isSpecialCasedOS = data && os.charAt(os.length - data[0].length - 1) == '/';
  18808. os = {
  18809. 'architecture': 32,
  18810. 'family': (data && !isSpecialCasedOS) ? os.replace(data[0], '') : os,
  18811. 'version': data ? data[1] : null,
  18812. 'toString': function() {
  18813. var version = this.version;
  18814. return this.family + ((version && !isSpecialCasedOS) ? ' ' + version : '') + (this.architecture == 64 ? ' 64-bit' : '');
  18815. }
  18816. };
  18817. }
  18818. // Add browser/OS architecture.
  18819. if ((data = /\b(?:AMD|IA|Win|WOW|x86_|x)64\b/i.exec(arch)) && !/\bi686\b/i.test(arch)) {
  18820. if (os) {
  18821. os.architecture = 64;
  18822. os.family = os.family.replace(RegExp(' *' + data), '');
  18823. }
  18824. if (
  18825. name && (/\bWOW64\b/i.test(ua) ||
  18826. (useFeatures && /\w(?:86|32)$/.test(nav.cpuClass || nav.platform) && !/\bWin64; x64\b/i.test(ua)))
  18827. ) {
  18828. description.unshift('32-bit');
  18829. }
  18830. }
  18831. // Chrome 39 and above on OS X is always 64-bit.
  18832. else if (
  18833. os && /^OS X/.test(os.family) &&
  18834. name == 'Chrome' && parseFloat(version) >= 39
  18835. ) {
  18836. os.architecture = 64;
  18837. }
  18838. ua || (ua = null);
  18839. /*------------------------------------------------------------------------*/
  18840. /**
  18841. * The platform object.
  18842. *
  18843. * @name platform
  18844. * @type Object
  18845. */
  18846. var platform = {};
  18847. /**
  18848. * The platform description.
  18849. *
  18850. * @memberOf platform
  18851. * @type string|null
  18852. */
  18853. platform.description = ua;
  18854. /**
  18855. * The name of the browser's layout engine.
  18856. *
  18857. * The list of common layout engines include:
  18858. * "Blink", "EdgeHTML", "Gecko", "Trident" and "WebKit"
  18859. *
  18860. * @memberOf platform
  18861. * @type string|null
  18862. */
  18863. platform.layout = layout && layout[0];
  18864. /**
  18865. * The name of the product's manufacturer.
  18866. *
  18867. * The list of manufacturers include:
  18868. * "Apple", "Archos", "Amazon", "Asus", "Barnes & Noble", "BlackBerry",
  18869. * "Google", "HP", "HTC", "LG", "Microsoft", "Motorola", "Nintendo",
  18870. * "Nokia", "Samsung" and "Sony"
  18871. *
  18872. * @memberOf platform
  18873. * @type string|null
  18874. */
  18875. platform.manufacturer = manufacturer;
  18876. /**
  18877. * The name of the browser/environment.
  18878. *
  18879. * The list of common browser names include:
  18880. * "Chrome", "Electron", "Firefox", "Firefox for iOS", "IE",
  18881. * "Microsoft Edge", "PhantomJS", "Safari", "SeaMonkey", "Silk",
  18882. * "Opera Mini" and "Opera"
  18883. *
  18884. * Mobile versions of some browsers have "Mobile" appended to their name:
  18885. * eg. "Chrome Mobile", "Firefox Mobile", "IE Mobile" and "Opera Mobile"
  18886. *
  18887. * @memberOf platform
  18888. * @type string|null
  18889. */
  18890. platform.name = name;
  18891. /**
  18892. * The alpha/beta release indicator.
  18893. *
  18894. * @memberOf platform
  18895. * @type string|null
  18896. */
  18897. platform.prerelease = prerelease;
  18898. /**
  18899. * The name of the product hosting the browser.
  18900. *
  18901. * The list of common products include:
  18902. *
  18903. * "BlackBerry", "Galaxy S4", "Lumia", "iPad", "iPod", "iPhone", "Kindle",
  18904. * "Kindle Fire", "Nexus", "Nook", "PlayBook", "TouchPad" and "Transformer"
  18905. *
  18906. * @memberOf platform
  18907. * @type string|null
  18908. */
  18909. platform.product = product;
  18910. /**
  18911. * The browser's user agent string.
  18912. *
  18913. * @memberOf platform
  18914. * @type string|null
  18915. */
  18916. platform.ua = ua;
  18917. /**
  18918. * The browser/environment version.
  18919. *
  18920. * @memberOf platform
  18921. * @type string|null
  18922. */
  18923. platform.version = name && version;
  18924. /**
  18925. * The name of the operating system.
  18926. *
  18927. * @memberOf platform
  18928. * @type Object
  18929. */
  18930. platform.os = os || {
  18931. /**
  18932. * The CPU architecture the OS is built for.
  18933. *
  18934. * @memberOf platform.os
  18935. * @type number|null
  18936. */
  18937. 'architecture': null,
  18938. /**
  18939. * The family of the OS.
  18940. *
  18941. * Common values include:
  18942. * "Windows", "Windows Server 2008 R2 / 7", "Windows Server 2008 / Vista",
  18943. * "Windows XP", "OS X", "Linux", "Ubuntu", "Debian", "Fedora", "Red Hat",
  18944. * "SuSE", "Android", "iOS" and "Windows Phone"
  18945. *
  18946. * @memberOf platform.os
  18947. * @type string|null
  18948. */
  18949. 'family': null,
  18950. /**
  18951. * The version of the OS.
  18952. *
  18953. * @memberOf platform.os
  18954. * @type string|null
  18955. */
  18956. 'version': null,
  18957. /**
  18958. * Returns the OS string.
  18959. *
  18960. * @memberOf platform.os
  18961. * @returns {string} The OS string.
  18962. */
  18963. 'toString': function() { return 'null'; }
  18964. };
  18965. platform.parse = parse;
  18966. platform.toString = toStringPlatform;
  18967. if (platform.version) {
  18968. description.unshift(version);
  18969. }
  18970. if (platform.name) {
  18971. description.unshift(name);
  18972. }
  18973. if (os && name && !(os == String(os).split(' ')[0] && (os == name.split(' ')[0] || product))) {
  18974. description.push(product ? '(' + os + ')' : 'on ' + os);
  18975. }
  18976. if (description.length) {
  18977. platform.description = description.join(' ');
  18978. }
  18979. return platform;
  18980. }
  18981. /*--------------------------------------------------------------------------*/
  18982. // Export platform.
  18983. var platform = parse();
  18984. // Some AMD build optimizers, like r.js, check for condition patterns like the following:
  18985. if (typeof define == 'function' && typeof define.amd == 'object' && define.amd) {
  18986. // Expose platform on the global object to prevent errors when platform is
  18987. // loaded by a script tag in the presence of an AMD loader.
  18988. // See http://requirejs.org/docs/errors.html#mismatch for more details.
  18989. root.platform = platform;
  18990. // Define as an anonymous module so platform can be aliased through path mapping.
  18991. define(function() {
  18992. return platform;
  18993. });
  18994. }
  18995. // Check for `exports` after `define` in case a build optimizer adds an `exports` object.
  18996. else if (freeExports && freeModule) {
  18997. // Export for CommonJS support.
  18998. forOwn(platform, function(value, key) {
  18999. freeExports[key] = value;
  19000. });
  19001. }
  19002. else {
  19003. // Export to the global object.
  19004. root.platform = platform;
  19005. }
  19006. }.call(this));
  19007. }).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
  19008. },{}],323:[function(require,module,exports){
  19009. (function (process){(function (){
  19010. 'use strict';
  19011. if (typeof process === 'undefined' ||
  19012. !process.version ||
  19013. process.version.indexOf('v0.') === 0 ||
  19014. process.version.indexOf('v1.') === 0 && process.version.indexOf('v1.8.') !== 0) {
  19015. module.exports = { nextTick: nextTick };
  19016. } else {
  19017. module.exports = process
  19018. }
  19019. function nextTick(fn, arg1, arg2, arg3) {
  19020. if (typeof fn !== 'function') {
  19021. throw new TypeError('"callback" argument must be a function');
  19022. }
  19023. var len = arguments.length;
  19024. var args, i;
  19025. switch (len) {
  19026. case 0:
  19027. case 1:
  19028. return process.nextTick(fn);
  19029. case 2:
  19030. return process.nextTick(function afterTickOne() {
  19031. fn.call(null, arg1);
  19032. });
  19033. case 3:
  19034. return process.nextTick(function afterTickTwo() {
  19035. fn.call(null, arg1, arg2);
  19036. });
  19037. case 4:
  19038. return process.nextTick(function afterTickThree() {
  19039. fn.call(null, arg1, arg2, arg3);
  19040. });
  19041. default:
  19042. args = new Array(len - 1);
  19043. i = 0;
  19044. while (i < args.length) {
  19045. args[i++] = arguments[i];
  19046. }
  19047. return process.nextTick(function afterTick() {
  19048. fn.apply(null, args);
  19049. });
  19050. }
  19051. }
  19052. }).call(this)}).call(this,require('_process'))
  19053. },{"_process":399}],324:[function(require,module,exports){
  19054. // shim for using process in browser
  19055. var process = module.exports = {};
  19056. // cached from whatever global is present so that test runners that stub it
  19057. // don't break things. But we need to wrap it in a try catch in case it is
  19058. // wrapped in strict mode code which doesn't define any globals. It's inside a
  19059. // function because try/catches deoptimize in certain engines.
  19060. var cachedSetTimeout;
  19061. var cachedClearTimeout;
  19062. function defaultSetTimout() {
  19063. throw new Error('setTimeout has not been defined');
  19064. }
  19065. function defaultClearTimeout () {
  19066. throw new Error('clearTimeout has not been defined');
  19067. }
  19068. (function () {
  19069. try {
  19070. if (typeof setTimeout === 'function') {
  19071. cachedSetTimeout = setTimeout;
  19072. } else {
  19073. cachedSetTimeout = defaultSetTimout;
  19074. }
  19075. } catch (e) {
  19076. cachedSetTimeout = defaultSetTimout;
  19077. }
  19078. try {
  19079. if (typeof clearTimeout === 'function') {
  19080. cachedClearTimeout = clearTimeout;
  19081. } else {
  19082. cachedClearTimeout = defaultClearTimeout;
  19083. }
  19084. } catch (e) {
  19085. cachedClearTimeout = defaultClearTimeout;
  19086. }
  19087. } ())
  19088. function runTimeout(fun) {
  19089. if (cachedSetTimeout === setTimeout) {
  19090. //normal enviroments in sane situations
  19091. return setTimeout(fun, 0);
  19092. }
  19093. // if setTimeout wasn't available but was latter defined
  19094. if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
  19095. cachedSetTimeout = setTimeout;
  19096. return setTimeout(fun, 0);
  19097. }
  19098. try {
  19099. // when when somebody has screwed with setTimeout but no I.E. maddness
  19100. return cachedSetTimeout(fun, 0);
  19101. } catch(e){
  19102. try {
  19103. // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
  19104. return cachedSetTimeout.call(null, fun, 0);
  19105. } catch(e){
  19106. // 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
  19107. return cachedSetTimeout.call(this, fun, 0);
  19108. }
  19109. }
  19110. }
  19111. function runClearTimeout(marker) {
  19112. if (cachedClearTimeout === clearTimeout) {
  19113. //normal enviroments in sane situations
  19114. return clearTimeout(marker);
  19115. }
  19116. // if clearTimeout wasn't available but was latter defined
  19117. if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
  19118. cachedClearTimeout = clearTimeout;
  19119. return clearTimeout(marker);
  19120. }
  19121. try {
  19122. // when when somebody has screwed with setTimeout but no I.E. maddness
  19123. return cachedClearTimeout(marker);
  19124. } catch (e){
  19125. try {
  19126. // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
  19127. return cachedClearTimeout.call(null, marker);
  19128. } catch (e){
  19129. // 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.
  19130. // Some versions of I.E. have different rules for clearTimeout vs setTimeout
  19131. return cachedClearTimeout.call(this, marker);
  19132. }
  19133. }
  19134. }
  19135. var queue = [];
  19136. var draining = false;
  19137. var currentQueue;
  19138. var queueIndex = -1;
  19139. function cleanUpNextTick() {
  19140. if (!draining || !currentQueue) {
  19141. return;
  19142. }
  19143. draining = false;
  19144. if (currentQueue.length) {
  19145. queue = currentQueue.concat(queue);
  19146. } else {
  19147. queueIndex = -1;
  19148. }
  19149. if (queue.length) {
  19150. drainQueue();
  19151. }
  19152. }
  19153. function drainQueue() {
  19154. if (draining) {
  19155. return;
  19156. }
  19157. var timeout = runTimeout(cleanUpNextTick);
  19158. draining = true;
  19159. var len = queue.length;
  19160. while(len) {
  19161. currentQueue = queue;
  19162. queue = [];
  19163. while (++queueIndex < len) {
  19164. if (currentQueue) {
  19165. currentQueue[queueIndex].run();
  19166. }
  19167. }
  19168. queueIndex = -1;
  19169. len = queue.length;
  19170. }
  19171. currentQueue = null;
  19172. draining = false;
  19173. runClearTimeout(timeout);
  19174. }
  19175. process.nextTick = function (fun) {
  19176. var args = new Array(arguments.length - 1);
  19177. if (arguments.length > 1) {
  19178. for (var i = 1; i < arguments.length; i++) {
  19179. args[i - 1] = arguments[i];
  19180. }
  19181. }
  19182. queue.push(new Item(fun, args));
  19183. if (queue.length === 1 && !draining) {
  19184. runTimeout(drainQueue);
  19185. }
  19186. };
  19187. // v8 likes predictible objects
  19188. function Item(fun, array) {
  19189. this.fun = fun;
  19190. this.array = array;
  19191. }
  19192. Item.prototype.run = function () {
  19193. this.fun.apply(null, this.array);
  19194. };
  19195. process.title = 'browser';
  19196. process.browser = true;
  19197. process.env = {};
  19198. process.argv = [];
  19199. process.version = ''; // empty string to avoid regexp issues
  19200. process.versions = {};
  19201. function noop() {}
  19202. process.on = noop;
  19203. process.addListener = noop;
  19204. process.once = noop;
  19205. process.off = noop;
  19206. process.removeListener = noop;
  19207. process.removeAllListeners = noop;
  19208. process.emit = noop;
  19209. process.prependListener = noop;
  19210. process.prependOnceListener = noop;
  19211. process.listeners = function (name) { return [] }
  19212. process.binding = function (name) {
  19213. throw new Error('process.binding is not supported');
  19214. };
  19215. process.cwd = function () { return '/' };
  19216. process.chdir = function (dir) {
  19217. throw new Error('process.chdir is not supported');
  19218. };
  19219. process.umask = function() { return 0; };
  19220. },{}],325:[function(require,module,exports){
  19221. (function (global){(function (){
  19222. /*! https://mths.be/punycode v1.4.1 by @mathias */
  19223. ;(function(root) {
  19224. /** Detect free variables */
  19225. var freeExports = typeof exports == 'object' && exports &&
  19226. !exports.nodeType && exports;
  19227. var freeModule = typeof module == 'object' && module &&
  19228. !module.nodeType && module;
  19229. var freeGlobal = typeof global == 'object' && global;
  19230. if (
  19231. freeGlobal.global === freeGlobal ||
  19232. freeGlobal.window === freeGlobal ||
  19233. freeGlobal.self === freeGlobal
  19234. ) {
  19235. root = freeGlobal;
  19236. }
  19237. /**
  19238. * The `punycode` object.
  19239. * @name punycode
  19240. * @type Object
  19241. */
  19242. var punycode,
  19243. /** Highest positive signed 32-bit float value */
  19244. maxInt = 2147483647, // aka. 0x7FFFFFFF or 2^31-1
  19245. /** Bootstring parameters */
  19246. base = 36,
  19247. tMin = 1,
  19248. tMax = 26,
  19249. skew = 38,
  19250. damp = 700,
  19251. initialBias = 72,
  19252. initialN = 128, // 0x80
  19253. delimiter = '-', // '\x2D'
  19254. /** Regular expressions */
  19255. regexPunycode = /^xn--/,
  19256. regexNonASCII = /[^\x20-\x7E]/, // unprintable ASCII chars + non-ASCII chars
  19257. regexSeparators = /[\x2E\u3002\uFF0E\uFF61]/g, // RFC 3490 separators
  19258. /** Error messages */
  19259. errors = {
  19260. 'overflow': 'Overflow: input needs wider integers to process',
  19261. 'not-basic': 'Illegal input >= 0x80 (not a basic code point)',
  19262. 'invalid-input': 'Invalid input'
  19263. },
  19264. /** Convenience shortcuts */
  19265. baseMinusTMin = base - tMin,
  19266. floor = Math.floor,
  19267. stringFromCharCode = String.fromCharCode,
  19268. /** Temporary variable */
  19269. key;
  19270. /*--------------------------------------------------------------------------*/
  19271. /**
  19272. * A generic error utility function.
  19273. * @private
  19274. * @param {String} type The error type.
  19275. * @returns {Error} Throws a `RangeError` with the applicable error message.
  19276. */
  19277. function error(type) {
  19278. throw new RangeError(errors[type]);
  19279. }
  19280. /**
  19281. * A generic `Array#map` utility function.
  19282. * @private
  19283. * @param {Array} array The array to iterate over.
  19284. * @param {Function} callback The function that gets called for every array
  19285. * item.
  19286. * @returns {Array} A new array of values returned by the callback function.
  19287. */
  19288. function map(array, fn) {
  19289. var length = array.length;
  19290. var result = [];
  19291. while (length--) {
  19292. result[length] = fn(array[length]);
  19293. }
  19294. return result;
  19295. }
  19296. /**
  19297. * A simple `Array#map`-like wrapper to work with domain name strings or email
  19298. * addresses.
  19299. * @private
  19300. * @param {String} domain The domain name or email address.
  19301. * @param {Function} callback The function that gets called for every
  19302. * character.
  19303. * @returns {Array} A new string of characters returned by the callback
  19304. * function.
  19305. */
  19306. function mapDomain(string, fn) {
  19307. var parts = string.split('@');
  19308. var result = '';
  19309. if (parts.length > 1) {
  19310. // In email addresses, only the domain name should be punycoded. Leave
  19311. // the local part (i.e. everything up to `@`) intact.
  19312. result = parts[0] + '@';
  19313. string = parts[1];
  19314. }
  19315. // Avoid `split(regex)` for IE8 compatibility. See #17.
  19316. string = string.replace(regexSeparators, '\x2E');
  19317. var labels = string.split('.');
  19318. var encoded = map(labels, fn).join('.');
  19319. return result + encoded;
  19320. }
  19321. /**
  19322. * Creates an array containing the numeric code points of each Unicode
  19323. * character in the string. While JavaScript uses UCS-2 internally,
  19324. * this function will convert a pair of surrogate halves (each of which
  19325. * UCS-2 exposes as separate characters) into a single code point,
  19326. * matching UTF-16.
  19327. * @see `punycode.ucs2.encode`
  19328. * @see <https://mathiasbynens.be/notes/javascript-encoding>
  19329. * @memberOf punycode.ucs2
  19330. * @name decode
  19331. * @param {String} string The Unicode input string (UCS-2).
  19332. * @returns {Array} The new array of code points.
  19333. */
  19334. function ucs2decode(string) {
  19335. var output = [],
  19336. counter = 0,
  19337. length = string.length,
  19338. value,
  19339. extra;
  19340. while (counter < length) {
  19341. value = string.charCodeAt(counter++);
  19342. if (value >= 0xD800 && value <= 0xDBFF && counter < length) {
  19343. // high surrogate, and there is a next character
  19344. extra = string.charCodeAt(counter++);
  19345. if ((extra & 0xFC00) == 0xDC00) { // low surrogate
  19346. output.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000);
  19347. } else {
  19348. // unmatched surrogate; only append this code unit, in case the next
  19349. // code unit is the high surrogate of a surrogate pair
  19350. output.push(value);
  19351. counter--;
  19352. }
  19353. } else {
  19354. output.push(value);
  19355. }
  19356. }
  19357. return output;
  19358. }
  19359. /**
  19360. * Creates a string based on an array of numeric code points.
  19361. * @see `punycode.ucs2.decode`
  19362. * @memberOf punycode.ucs2
  19363. * @name encode
  19364. * @param {Array} codePoints The array of numeric code points.
  19365. * @returns {String} The new Unicode string (UCS-2).
  19366. */
  19367. function ucs2encode(array) {
  19368. return map(array, function(value) {
  19369. var output = '';
  19370. if (value > 0xFFFF) {
  19371. value -= 0x10000;
  19372. output += stringFromCharCode(value >>> 10 & 0x3FF | 0xD800);
  19373. value = 0xDC00 | value & 0x3FF;
  19374. }
  19375. output += stringFromCharCode(value);
  19376. return output;
  19377. }).join('');
  19378. }
  19379. /**
  19380. * Converts a basic code point into a digit/integer.
  19381. * @see `digitToBasic()`
  19382. * @private
  19383. * @param {Number} codePoint The basic numeric code point value.
  19384. * @returns {Number} The numeric value of a basic code point (for use in
  19385. * representing integers) in the range `0` to `base - 1`, or `base` if
  19386. * the code point does not represent a value.
  19387. */
  19388. function basicToDigit(codePoint) {
  19389. if (codePoint - 48 < 10) {
  19390. return codePoint - 22;
  19391. }
  19392. if (codePoint - 65 < 26) {
  19393. return codePoint - 65;
  19394. }
  19395. if (codePoint - 97 < 26) {
  19396. return codePoint - 97;
  19397. }
  19398. return base;
  19399. }
  19400. /**
  19401. * Converts a digit/integer into a basic code point.
  19402. * @see `basicToDigit()`
  19403. * @private
  19404. * @param {Number} digit The numeric value of a basic code point.
  19405. * @returns {Number} The basic code point whose value (when used for
  19406. * representing integers) is `digit`, which needs to be in the range
  19407. * `0` to `base - 1`. If `flag` is non-zero, the uppercase form is
  19408. * used; else, the lowercase form is used. The behavior is undefined
  19409. * if `flag` is non-zero and `digit` has no uppercase form.
  19410. */
  19411. function digitToBasic(digit, flag) {
  19412. // 0..25 map to ASCII a..z or A..Z
  19413. // 26..35 map to ASCII 0..9
  19414. return digit + 22 + 75 * (digit < 26) - ((flag != 0) << 5);
  19415. }
  19416. /**
  19417. * Bias adaptation function as per section 3.4 of RFC 3492.
  19418. * https://tools.ietf.org/html/rfc3492#section-3.4
  19419. * @private
  19420. */
  19421. function adapt(delta, numPoints, firstTime) {
  19422. var k = 0;
  19423. delta = firstTime ? floor(delta / damp) : delta >> 1;
  19424. delta += floor(delta / numPoints);
  19425. for (/* no initialization */; delta > baseMinusTMin * tMax >> 1; k += base) {
  19426. delta = floor(delta / baseMinusTMin);
  19427. }
  19428. return floor(k + (baseMinusTMin + 1) * delta / (delta + skew));
  19429. }
  19430. /**
  19431. * Converts a Punycode string of ASCII-only symbols to a string of Unicode
  19432. * symbols.
  19433. * @memberOf punycode
  19434. * @param {String} input The Punycode string of ASCII-only symbols.
  19435. * @returns {String} The resulting string of Unicode symbols.
  19436. */
  19437. function decode(input) {
  19438. // Don't use UCS-2
  19439. var output = [],
  19440. inputLength = input.length,
  19441. out,
  19442. i = 0,
  19443. n = initialN,
  19444. bias = initialBias,
  19445. basic,
  19446. j,
  19447. index,
  19448. oldi,
  19449. w,
  19450. k,
  19451. digit,
  19452. t,
  19453. /** Cached calculation results */
  19454. baseMinusT;
  19455. // Handle the basic code points: let `basic` be the number of input code
  19456. // points before the last delimiter, or `0` if there is none, then copy
  19457. // the first basic code points to the output.
  19458. basic = input.lastIndexOf(delimiter);
  19459. if (basic < 0) {
  19460. basic = 0;
  19461. }
  19462. for (j = 0; j < basic; ++j) {
  19463. // if it's not a basic code point
  19464. if (input.charCodeAt(j) >= 0x80) {
  19465. error('not-basic');
  19466. }
  19467. output.push(input.charCodeAt(j));
  19468. }
  19469. // Main decoding loop: start just after the last delimiter if any basic code
  19470. // points were copied; start at the beginning otherwise.
  19471. for (index = basic > 0 ? basic + 1 : 0; index < inputLength; /* no final expression */) {
  19472. // `index` is the index of the next character to be consumed.
  19473. // Decode a generalized variable-length integer into `delta`,
  19474. // which gets added to `i`. The overflow checking is easier
  19475. // if we increase `i` as we go, then subtract off its starting
  19476. // value at the end to obtain `delta`.
  19477. for (oldi = i, w = 1, k = base; /* no condition */; k += base) {
  19478. if (index >= inputLength) {
  19479. error('invalid-input');
  19480. }
  19481. digit = basicToDigit(input.charCodeAt(index++));
  19482. if (digit >= base || digit > floor((maxInt - i) / w)) {
  19483. error('overflow');
  19484. }
  19485. i += digit * w;
  19486. t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias);
  19487. if (digit < t) {
  19488. break;
  19489. }
  19490. baseMinusT = base - t;
  19491. if (w > floor(maxInt / baseMinusT)) {
  19492. error('overflow');
  19493. }
  19494. w *= baseMinusT;
  19495. }
  19496. out = output.length + 1;
  19497. bias = adapt(i - oldi, out, oldi == 0);
  19498. // `i` was supposed to wrap around from `out` to `0`,
  19499. // incrementing `n` each time, so we'll fix that now:
  19500. if (floor(i / out) > maxInt - n) {
  19501. error('overflow');
  19502. }
  19503. n += floor(i / out);
  19504. i %= out;
  19505. // Insert `n` at position `i` of the output
  19506. output.splice(i++, 0, n);
  19507. }
  19508. return ucs2encode(output);
  19509. }
  19510. /**
  19511. * Converts a string of Unicode symbols (e.g. a domain name label) to a
  19512. * Punycode string of ASCII-only symbols.
  19513. * @memberOf punycode
  19514. * @param {String} input The string of Unicode symbols.
  19515. * @returns {String} The resulting Punycode string of ASCII-only symbols.
  19516. */
  19517. function encode(input) {
  19518. var n,
  19519. delta,
  19520. handledCPCount,
  19521. basicLength,
  19522. bias,
  19523. j,
  19524. m,
  19525. q,
  19526. k,
  19527. t,
  19528. currentValue,
  19529. output = [],
  19530. /** `inputLength` will hold the number of code points in `input`. */
  19531. inputLength,
  19532. /** Cached calculation results */
  19533. handledCPCountPlusOne,
  19534. baseMinusT,
  19535. qMinusT;
  19536. // Convert the input in UCS-2 to Unicode
  19537. input = ucs2decode(input);
  19538. // Cache the length
  19539. inputLength = input.length;
  19540. // Initialize the state
  19541. n = initialN;
  19542. delta = 0;
  19543. bias = initialBias;
  19544. // Handle the basic code points
  19545. for (j = 0; j < inputLength; ++j) {
  19546. currentValue = input[j];
  19547. if (currentValue < 0x80) {
  19548. output.push(stringFromCharCode(currentValue));
  19549. }
  19550. }
  19551. handledCPCount = basicLength = output.length;
  19552. // `handledCPCount` is the number of code points that have been handled;
  19553. // `basicLength` is the number of basic code points.
  19554. // Finish the basic string - if it is not empty - with a delimiter
  19555. if (basicLength) {
  19556. output.push(delimiter);
  19557. }
  19558. // Main encoding loop:
  19559. while (handledCPCount < inputLength) {
  19560. // All non-basic code points < n have been handled already. Find the next
  19561. // larger one:
  19562. for (m = maxInt, j = 0; j < inputLength; ++j) {
  19563. currentValue = input[j];
  19564. if (currentValue >= n && currentValue < m) {
  19565. m = currentValue;
  19566. }
  19567. }
  19568. // Increase `delta` enough to advance the decoder's <n,i> state to <m,0>,
  19569. // but guard against overflow
  19570. handledCPCountPlusOne = handledCPCount + 1;
  19571. if (m - n > floor((maxInt - delta) / handledCPCountPlusOne)) {
  19572. error('overflow');
  19573. }
  19574. delta += (m - n) * handledCPCountPlusOne;
  19575. n = m;
  19576. for (j = 0; j < inputLength; ++j) {
  19577. currentValue = input[j];
  19578. if (currentValue < n && ++delta > maxInt) {
  19579. error('overflow');
  19580. }
  19581. if (currentValue == n) {
  19582. // Represent delta as a generalized variable-length integer
  19583. for (q = delta, k = base; /* no condition */; k += base) {
  19584. t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias);
  19585. if (q < t) {
  19586. break;
  19587. }
  19588. qMinusT = q - t;
  19589. baseMinusT = base - t;
  19590. output.push(
  19591. stringFromCharCode(digitToBasic(t + qMinusT % baseMinusT, 0))
  19592. );
  19593. q = floor(qMinusT / baseMinusT);
  19594. }
  19595. output.push(stringFromCharCode(digitToBasic(q, 0)));
  19596. bias = adapt(delta, handledCPCountPlusOne, handledCPCount == basicLength);
  19597. delta = 0;
  19598. ++handledCPCount;
  19599. }
  19600. }
  19601. ++delta;
  19602. ++n;
  19603. }
  19604. return output.join('');
  19605. }
  19606. /**
  19607. * Converts a Punycode string representing a domain name or an email address
  19608. * to Unicode. Only the Punycoded parts of the input will be converted, i.e.
  19609. * it doesn't matter if you call it on a string that has already been
  19610. * converted to Unicode.
  19611. * @memberOf punycode
  19612. * @param {String} input The Punycoded domain name or email address to
  19613. * convert to Unicode.
  19614. * @returns {String} The Unicode representation of the given Punycode
  19615. * string.
  19616. */
  19617. function toUnicode(input) {
  19618. return mapDomain(input, function(string) {
  19619. return regexPunycode.test(string)
  19620. ? decode(string.slice(4).toLowerCase())
  19621. : string;
  19622. });
  19623. }
  19624. /**
  19625. * Converts a Unicode string representing a domain name or an email address to
  19626. * Punycode. Only the non-ASCII parts of the domain name will be converted,
  19627. * i.e. it doesn't matter if you call it with a domain that's already in
  19628. * ASCII.
  19629. * @memberOf punycode
  19630. * @param {String} input The domain name or email address to convert, as a
  19631. * Unicode string.
  19632. * @returns {String} The Punycode representation of the given domain name or
  19633. * email address.
  19634. */
  19635. function toASCII(input) {
  19636. return mapDomain(input, function(string) {
  19637. return regexNonASCII.test(string)
  19638. ? 'xn--' + encode(string)
  19639. : string;
  19640. });
  19641. }
  19642. /*--------------------------------------------------------------------------*/
  19643. /** Define the public API */
  19644. punycode = {
  19645. /**
  19646. * A string representing the current Punycode.js version number.
  19647. * @memberOf punycode
  19648. * @type String
  19649. */
  19650. 'version': '1.4.1',
  19651. /**
  19652. * An object of methods to convert from JavaScript's internal character
  19653. * representation (UCS-2) to Unicode code points, and back.
  19654. * @see <https://mathiasbynens.be/notes/javascript-encoding>
  19655. * @memberOf punycode
  19656. * @type Object
  19657. */
  19658. 'ucs2': {
  19659. 'decode': ucs2decode,
  19660. 'encode': ucs2encode
  19661. },
  19662. 'decode': decode,
  19663. 'encode': encode,
  19664. 'toASCII': toASCII,
  19665. 'toUnicode': toUnicode
  19666. };
  19667. /** Expose `punycode` */
  19668. // Some AMD build optimizers, like r.js, check for specific condition patterns
  19669. // like the following:
  19670. if (
  19671. typeof define == 'function' &&
  19672. typeof define.amd == 'object' &&
  19673. define.amd
  19674. ) {
  19675. define('punycode', function() {
  19676. return punycode;
  19677. });
  19678. } else if (freeExports && freeModule) {
  19679. if (module.exports == freeExports) {
  19680. // in Node.js, io.js, or RingoJS v0.8.0+
  19681. freeModule.exports = punycode;
  19682. } else {
  19683. // in Narwhal or RingoJS v0.7.0-
  19684. for (key in punycode) {
  19685. punycode.hasOwnProperty(key) && (freeExports[key] = punycode[key]);
  19686. }
  19687. }
  19688. } else {
  19689. // in Rhino or a web browser
  19690. root.punycode = punycode;
  19691. }
  19692. }(this));
  19693. }).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
  19694. },{}],326:[function(require,module,exports){
  19695. // Copyright Joyent, Inc. and other Node contributors.
  19696. //
  19697. // Permission is hereby granted, free of charge, to any person obtaining a
  19698. // copy of this software and associated documentation files (the
  19699. // "Software"), to deal in the Software without restriction, including
  19700. // without limitation the rights to use, copy, modify, merge, publish,
  19701. // distribute, sublicense, and/or sell copies of the Software, and to permit
  19702. // persons to whom the Software is furnished to do so, subject to the
  19703. // following conditions:
  19704. //
  19705. // The above copyright notice and this permission notice shall be included
  19706. // in all copies or substantial portions of the Software.
  19707. //
  19708. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  19709. // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  19710. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  19711. // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  19712. // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  19713. // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  19714. // USE OR OTHER DEALINGS IN THE SOFTWARE.
  19715. 'use strict';
  19716. // If obj.hasOwnProperty has been overridden, then calling
  19717. // obj.hasOwnProperty(prop) will break.
  19718. // See: https://github.com/joyent/node/issues/1707
  19719. function hasOwnProperty(obj, prop) {
  19720. return Object.prototype.hasOwnProperty.call(obj, prop);
  19721. }
  19722. module.exports = function(qs, sep, eq, options) {
  19723. sep = sep || '&';
  19724. eq = eq || '=';
  19725. var obj = {};
  19726. if (typeof qs !== 'string' || qs.length === 0) {
  19727. return obj;
  19728. }
  19729. var regexp = /\+/g;
  19730. qs = qs.split(sep);
  19731. var maxKeys = 1000;
  19732. if (options && typeof options.maxKeys === 'number') {
  19733. maxKeys = options.maxKeys;
  19734. }
  19735. var len = qs.length;
  19736. // maxKeys <= 0 means that we should not limit keys count
  19737. if (maxKeys > 0 && len > maxKeys) {
  19738. len = maxKeys;
  19739. }
  19740. for (var i = 0; i < len; ++i) {
  19741. var x = qs[i].replace(regexp, '%20'),
  19742. idx = x.indexOf(eq),
  19743. kstr, vstr, k, v;
  19744. if (idx >= 0) {
  19745. kstr = x.substr(0, idx);
  19746. vstr = x.substr(idx + 1);
  19747. } else {
  19748. kstr = x;
  19749. vstr = '';
  19750. }
  19751. k = decodeURIComponent(kstr);
  19752. v = decodeURIComponent(vstr);
  19753. if (!hasOwnProperty(obj, k)) {
  19754. obj[k] = v;
  19755. } else if (isArray(obj[k])) {
  19756. obj[k].push(v);
  19757. } else {
  19758. obj[k] = [obj[k], v];
  19759. }
  19760. }
  19761. return obj;
  19762. };
  19763. var isArray = Array.isArray || function (xs) {
  19764. return Object.prototype.toString.call(xs) === '[object Array]';
  19765. };
  19766. },{}],327:[function(require,module,exports){
  19767. // Copyright Joyent, Inc. and other Node contributors.
  19768. //
  19769. // Permission is hereby granted, free of charge, to any person obtaining a
  19770. // copy of this software and associated documentation files (the
  19771. // "Software"), to deal in the Software without restriction, including
  19772. // without limitation the rights to use, copy, modify, merge, publish,
  19773. // distribute, sublicense, and/or sell copies of the Software, and to permit
  19774. // persons to whom the Software is furnished to do so, subject to the
  19775. // following conditions:
  19776. //
  19777. // The above copyright notice and this permission notice shall be included
  19778. // in all copies or substantial portions of the Software.
  19779. //
  19780. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  19781. // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  19782. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  19783. // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  19784. // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  19785. // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  19786. // USE OR OTHER DEALINGS IN THE SOFTWARE.
  19787. 'use strict';
  19788. var stringifyPrimitive = function(v) {
  19789. switch (typeof v) {
  19790. case 'string':
  19791. return v;
  19792. case 'boolean':
  19793. return v ? 'true' : 'false';
  19794. case 'number':
  19795. return isFinite(v) ? v : '';
  19796. default:
  19797. return '';
  19798. }
  19799. };
  19800. module.exports = function(obj, sep, eq, name) {
  19801. sep = sep || '&';
  19802. eq = eq || '=';
  19803. if (obj === null) {
  19804. obj = undefined;
  19805. }
  19806. if (typeof obj === 'object') {
  19807. return map(objectKeys(obj), function(k) {
  19808. var ks = encodeURIComponent(stringifyPrimitive(k)) + eq;
  19809. if (isArray(obj[k])) {
  19810. return map(obj[k], function(v) {
  19811. return ks + encodeURIComponent(stringifyPrimitive(v));
  19812. }).join(sep);
  19813. } else {
  19814. return ks + encodeURIComponent(stringifyPrimitive(obj[k]));
  19815. }
  19816. }).join(sep);
  19817. }
  19818. if (!name) return '';
  19819. return encodeURIComponent(stringifyPrimitive(name)) + eq +
  19820. encodeURIComponent(stringifyPrimitive(obj));
  19821. };
  19822. var isArray = Array.isArray || function (xs) {
  19823. return Object.prototype.toString.call(xs) === '[object Array]';
  19824. };
  19825. function map (xs, f) {
  19826. if (xs.map) return xs.map(f);
  19827. var res = [];
  19828. for (var i = 0; i < xs.length; i++) {
  19829. res.push(f(xs[i], i));
  19830. }
  19831. return res;
  19832. }
  19833. var objectKeys = Object.keys || function (obj) {
  19834. var res = [];
  19835. for (var key in obj) {
  19836. if (Object.prototype.hasOwnProperty.call(obj, key)) res.push(key);
  19837. }
  19838. return res;
  19839. };
  19840. },{}],328:[function(require,module,exports){
  19841. 'use strict';
  19842. exports.decode = exports.parse = require('./decode');
  19843. exports.encode = exports.stringify = require('./encode');
  19844. },{"./decode":326,"./encode":327}],329:[function(require,module,exports){
  19845. module.exports = require('./lib/_stream_duplex.js');
  19846. },{"./lib/_stream_duplex.js":330}],330:[function(require,module,exports){
  19847. // Copyright Joyent, Inc. and other Node contributors.
  19848. //
  19849. // Permission is hereby granted, free of charge, to any person obtaining a
  19850. // copy of this software and associated documentation files (the
  19851. // "Software"), to deal in the Software without restriction, including
  19852. // without limitation the rights to use, copy, modify, merge, publish,
  19853. // distribute, sublicense, and/or sell copies of the Software, and to permit
  19854. // persons to whom the Software is furnished to do so, subject to the
  19855. // following conditions:
  19856. //
  19857. // The above copyright notice and this permission notice shall be included
  19858. // in all copies or substantial portions of the Software.
  19859. //
  19860. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  19861. // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  19862. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  19863. // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  19864. // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  19865. // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  19866. // USE OR OTHER DEALINGS IN THE SOFTWARE.
  19867. // a duplex stream is just a stream that is both readable and writable.
  19868. // Since JS doesn't have multiple prototypal inheritance, this class
  19869. // prototypally inherits from Readable, and then parasitically from
  19870. // Writable.
  19871. 'use strict';
  19872. /*<replacement>*/
  19873. var pna = require('process-nextick-args');
  19874. /*</replacement>*/
  19875. /*<replacement>*/
  19876. var objectKeys = Object.keys || function (obj) {
  19877. var keys = [];
  19878. for (var key in obj) {
  19879. keys.push(key);
  19880. }return keys;
  19881. };
  19882. /*</replacement>*/
  19883. module.exports = Duplex;
  19884. /*<replacement>*/
  19885. var util = Object.create(require('core-util-is'));
  19886. util.inherits = require('inherits');
  19887. /*</replacement>*/
  19888. var Readable = require('./_stream_readable');
  19889. var Writable = require('./_stream_writable');
  19890. util.inherits(Duplex, Readable);
  19891. {
  19892. // avoid scope creep, the keys array can then be collected
  19893. var keys = objectKeys(Writable.prototype);
  19894. for (var v = 0; v < keys.length; v++) {
  19895. var method = keys[v];
  19896. if (!Duplex.prototype[method]) Duplex.prototype[method] = Writable.prototype[method];
  19897. }
  19898. }
  19899. function Duplex(options) {
  19900. if (!(this instanceof Duplex)) return new Duplex(options);
  19901. Readable.call(this, options);
  19902. Writable.call(this, options);
  19903. if (options && options.readable === false) this.readable = false;
  19904. if (options && options.writable === false) this.writable = false;
  19905. this.allowHalfOpen = true;
  19906. if (options && options.allowHalfOpen === false) this.allowHalfOpen = false;
  19907. this.once('end', onend);
  19908. }
  19909. Object.defineProperty(Duplex.prototype, 'writableHighWaterMark', {
  19910. // making it explicit this property is not enumerable
  19911. // because otherwise some prototype manipulation in
  19912. // userland will fail
  19913. enumerable: false,
  19914. get: function () {
  19915. return this._writableState.highWaterMark;
  19916. }
  19917. });
  19918. // the no-half-open enforcer
  19919. function onend() {
  19920. // if we allow half-open state, or if the writable side ended,
  19921. // then we're ok.
  19922. if (this.allowHalfOpen || this._writableState.ended) return;
  19923. // no more data can be written.
  19924. // But allow more writes to happen in this tick.
  19925. pna.nextTick(onEndNT, this);
  19926. }
  19927. function onEndNT(self) {
  19928. self.end();
  19929. }
  19930. Object.defineProperty(Duplex.prototype, 'destroyed', {
  19931. get: function () {
  19932. if (this._readableState === undefined || this._writableState === undefined) {
  19933. return false;
  19934. }
  19935. return this._readableState.destroyed && this._writableState.destroyed;
  19936. },
  19937. set: function (value) {
  19938. // we ignore the value if the stream
  19939. // has not been initialized yet
  19940. if (this._readableState === undefined || this._writableState === undefined) {
  19941. return;
  19942. }
  19943. // backward compatibility, the user is explicitly
  19944. // managing destroyed
  19945. this._readableState.destroyed = value;
  19946. this._writableState.destroyed = value;
  19947. }
  19948. });
  19949. Duplex.prototype._destroy = function (err, cb) {
  19950. this.push(null);
  19951. this.end();
  19952. pna.nextTick(cb, err);
  19953. };
  19954. },{"./_stream_readable":332,"./_stream_writable":334,"core-util-is":298,"inherits":311,"process-nextick-args":323}],331:[function(require,module,exports){
  19955. // Copyright Joyent, Inc. and other Node contributors.
  19956. //
  19957. // Permission is hereby granted, free of charge, to any person obtaining a
  19958. // copy of this software and associated documentation files (the
  19959. // "Software"), to deal in the Software without restriction, including
  19960. // without limitation the rights to use, copy, modify, merge, publish,
  19961. // distribute, sublicense, and/or sell copies of the Software, and to permit
  19962. // persons to whom the Software is furnished to do so, subject to the
  19963. // following conditions:
  19964. //
  19965. // The above copyright notice and this permission notice shall be included
  19966. // in all copies or substantial portions of the Software.
  19967. //
  19968. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  19969. // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  19970. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  19971. // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  19972. // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  19973. // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  19974. // USE OR OTHER DEALINGS IN THE SOFTWARE.
  19975. // a passthrough stream.
  19976. // basically just the most minimal sort of Transform stream.
  19977. // Every written chunk gets output as-is.
  19978. 'use strict';
  19979. module.exports = PassThrough;
  19980. var Transform = require('./_stream_transform');
  19981. /*<replacement>*/
  19982. var util = Object.create(require('core-util-is'));
  19983. util.inherits = require('inherits');
  19984. /*</replacement>*/
  19985. util.inherits(PassThrough, Transform);
  19986. function PassThrough(options) {
  19987. if (!(this instanceof PassThrough)) return new PassThrough(options);
  19988. Transform.call(this, options);
  19989. }
  19990. PassThrough.prototype._transform = function (chunk, encoding, cb) {
  19991. cb(null, chunk);
  19992. };
  19993. },{"./_stream_transform":333,"core-util-is":298,"inherits":311}],332:[function(require,module,exports){
  19994. (function (process,global){(function (){
  19995. // Copyright Joyent, Inc. and other Node contributors.
  19996. //
  19997. // Permission is hereby granted, free of charge, to any person obtaining a
  19998. // copy of this software and associated documentation files (the
  19999. // "Software"), to deal in the Software without restriction, including
  20000. // without limitation the rights to use, copy, modify, merge, publish,
  20001. // distribute, sublicense, and/or sell copies of the Software, and to permit
  20002. // persons to whom the Software is furnished to do so, subject to the
  20003. // following conditions:
  20004. //
  20005. // The above copyright notice and this permission notice shall be included
  20006. // in all copies or substantial portions of the Software.
  20007. //
  20008. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  20009. // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  20010. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  20011. // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  20012. // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  20013. // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  20014. // USE OR OTHER DEALINGS IN THE SOFTWARE.
  20015. 'use strict';
  20016. /*<replacement>*/
  20017. var pna = require('process-nextick-args');
  20018. /*</replacement>*/
  20019. module.exports = Readable;
  20020. /*<replacement>*/
  20021. var isArray = require('isarray');
  20022. /*</replacement>*/
  20023. /*<replacement>*/
  20024. var Duplex;
  20025. /*</replacement>*/
  20026. Readable.ReadableState = ReadableState;
  20027. /*<replacement>*/
  20028. var EE = require('events').EventEmitter;
  20029. var EElistenerCount = function (emitter, type) {
  20030. return emitter.listeners(type).length;
  20031. };
  20032. /*</replacement>*/
  20033. /*<replacement>*/
  20034. var Stream = require('./internal/streams/stream');
  20035. /*</replacement>*/
  20036. /*<replacement>*/
  20037. var Buffer = require('safe-buffer').Buffer;
  20038. var OurUint8Array = global.Uint8Array || function () {};
  20039. function _uint8ArrayToBuffer(chunk) {
  20040. return Buffer.from(chunk);
  20041. }
  20042. function _isUint8Array(obj) {
  20043. return Buffer.isBuffer(obj) || obj instanceof OurUint8Array;
  20044. }
  20045. /*</replacement>*/
  20046. /*<replacement>*/
  20047. var util = Object.create(require('core-util-is'));
  20048. util.inherits = require('inherits');
  20049. /*</replacement>*/
  20050. /*<replacement>*/
  20051. var debugUtil = require('util');
  20052. var debug = void 0;
  20053. if (debugUtil && debugUtil.debuglog) {
  20054. debug = debugUtil.debuglog('stream');
  20055. } else {
  20056. debug = function () {};
  20057. }
  20058. /*</replacement>*/
  20059. var BufferList = require('./internal/streams/BufferList');
  20060. var destroyImpl = require('./internal/streams/destroy');
  20061. var StringDecoder;
  20062. util.inherits(Readable, Stream);
  20063. var kProxyEvents = ['error', 'close', 'destroy', 'pause', 'resume'];
  20064. function prependListener(emitter, event, fn) {
  20065. // Sadly this is not cacheable as some libraries bundle their own
  20066. // event emitter implementation with them.
  20067. if (typeof emitter.prependListener === 'function') return emitter.prependListener(event, fn);
  20068. // This is a hack to make sure that our error handler is attached before any
  20069. // userland ones. NEVER DO THIS. This is here only because this code needs
  20070. // to continue to work with older versions of Node.js that do not include
  20071. // the prependListener() method. The goal is to eventually remove this hack.
  20072. 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]];
  20073. }
  20074. function ReadableState(options, stream) {
  20075. Duplex = Duplex || require('./_stream_duplex');
  20076. options = options || {};
  20077. // Duplex streams are both readable and writable, but share
  20078. // the same options object.
  20079. // However, some cases require setting options to different
  20080. // values for the readable and the writable sides of the duplex stream.
  20081. // These options can be provided separately as readableXXX and writableXXX.
  20082. var isDuplex = stream instanceof Duplex;
  20083. // object stream flag. Used to make read(n) ignore n and to
  20084. // make all the buffer merging and length checks go away
  20085. this.objectMode = !!options.objectMode;
  20086. if (isDuplex) this.objectMode = this.objectMode || !!options.readableObjectMode;
  20087. // the point at which it stops calling _read() to fill the buffer
  20088. // Note: 0 is a valid value, means "don't call _read preemptively ever"
  20089. var hwm = options.highWaterMark;
  20090. var readableHwm = options.readableHighWaterMark;
  20091. var defaultHwm = this.objectMode ? 16 : 16 * 1024;
  20092. if (hwm || hwm === 0) this.highWaterMark = hwm;else if (isDuplex && (readableHwm || readableHwm === 0)) this.highWaterMark = readableHwm;else this.highWaterMark = defaultHwm;
  20093. // cast to ints.
  20094. this.highWaterMark = Math.floor(this.highWaterMark);
  20095. // A linked list is used to store data chunks instead of an array because the
  20096. // linked list can remove elements from the beginning faster than
  20097. // array.shift()
  20098. this.buffer = new BufferList();
  20099. this.length = 0;
  20100. this.pipes = null;
  20101. this.pipesCount = 0;
  20102. this.flowing = null;
  20103. this.ended = false;
  20104. this.endEmitted = false;
  20105. this.reading = false;
  20106. // a flag to be able to tell if the event 'readable'/'data' is emitted
  20107. // immediately, or on a later tick. We set this to true at first, because
  20108. // any actions that shouldn't happen until "later" should generally also
  20109. // not happen before the first read call.
  20110. this.sync = true;
  20111. // whenever we return null, then we set a flag to say
  20112. // that we're awaiting a 'readable' event emission.
  20113. this.needReadable = false;
  20114. this.emittedReadable = false;
  20115. this.readableListening = false;
  20116. this.resumeScheduled = false;
  20117. // has it been destroyed
  20118. this.destroyed = false;
  20119. // Crypto is kind of old and crusty. Historically, its default string
  20120. // encoding is 'binary' so we have to make this configurable.
  20121. // Everything else in the universe uses 'utf8', though.
  20122. this.defaultEncoding = options.defaultEncoding || 'utf8';
  20123. // the number of writers that are awaiting a drain event in .pipe()s
  20124. this.awaitDrain = 0;
  20125. // if true, a maybeReadMore has been scheduled
  20126. this.readingMore = false;
  20127. this.decoder = null;
  20128. this.encoding = null;
  20129. if (options.encoding) {
  20130. if (!StringDecoder) StringDecoder = require('string_decoder/').StringDecoder;
  20131. this.decoder = new StringDecoder(options.encoding);
  20132. this.encoding = options.encoding;
  20133. }
  20134. }
  20135. function Readable(options) {
  20136. Duplex = Duplex || require('./_stream_duplex');
  20137. if (!(this instanceof Readable)) return new Readable(options);
  20138. this._readableState = new ReadableState(options, this);
  20139. // legacy
  20140. this.readable = true;
  20141. if (options) {
  20142. if (typeof options.read === 'function') this._read = options.read;
  20143. if (typeof options.destroy === 'function') this._destroy = options.destroy;
  20144. }
  20145. Stream.call(this);
  20146. }
  20147. Object.defineProperty(Readable.prototype, 'destroyed', {
  20148. get: function () {
  20149. if (this._readableState === undefined) {
  20150. return false;
  20151. }
  20152. return this._readableState.destroyed;
  20153. },
  20154. set: function (value) {
  20155. // we ignore the value if the stream
  20156. // has not been initialized yet
  20157. if (!this._readableState) {
  20158. return;
  20159. }
  20160. // backward compatibility, the user is explicitly
  20161. // managing destroyed
  20162. this._readableState.destroyed = value;
  20163. }
  20164. });
  20165. Readable.prototype.destroy = destroyImpl.destroy;
  20166. Readable.prototype._undestroy = destroyImpl.undestroy;
  20167. Readable.prototype._destroy = function (err, cb) {
  20168. this.push(null);
  20169. cb(err);
  20170. };
  20171. // Manually shove something into the read() buffer.
  20172. // This returns true if the highWaterMark has not been hit yet,
  20173. // similar to how Writable.write() returns true if you should
  20174. // write() some more.
  20175. Readable.prototype.push = function (chunk, encoding) {
  20176. var state = this._readableState;
  20177. var skipChunkCheck;
  20178. if (!state.objectMode) {
  20179. if (typeof chunk === 'string') {
  20180. encoding = encoding || state.defaultEncoding;
  20181. if (encoding !== state.encoding) {
  20182. chunk = Buffer.from(chunk, encoding);
  20183. encoding = '';
  20184. }
  20185. skipChunkCheck = true;
  20186. }
  20187. } else {
  20188. skipChunkCheck = true;
  20189. }
  20190. return readableAddChunk(this, chunk, encoding, false, skipChunkCheck);
  20191. };
  20192. // Unshift should *always* be something directly out of read()
  20193. Readable.prototype.unshift = function (chunk) {
  20194. return readableAddChunk(this, chunk, null, true, false);
  20195. };
  20196. function readableAddChunk(stream, chunk, encoding, addToFront, skipChunkCheck) {
  20197. var state = stream._readableState;
  20198. if (chunk === null) {
  20199. state.reading = false;
  20200. onEofChunk(stream, state);
  20201. } else {
  20202. var er;
  20203. if (!skipChunkCheck) er = chunkInvalid(state, chunk);
  20204. if (er) {
  20205. stream.emit('error', er);
  20206. } else if (state.objectMode || chunk && chunk.length > 0) {
  20207. if (typeof chunk !== 'string' && !state.objectMode && Object.getPrototypeOf(chunk) !== Buffer.prototype) {
  20208. chunk = _uint8ArrayToBuffer(chunk);
  20209. }
  20210. if (addToFront) {
  20211. if (state.endEmitted) stream.emit('error', new Error('stream.unshift() after end event'));else addChunk(stream, state, chunk, true);
  20212. } else if (state.ended) {
  20213. stream.emit('error', new Error('stream.push() after EOF'));
  20214. } else {
  20215. state.reading = false;
  20216. if (state.decoder && !encoding) {
  20217. chunk = state.decoder.write(chunk);
  20218. if (state.objectMode || chunk.length !== 0) addChunk(stream, state, chunk, false);else maybeReadMore(stream, state);
  20219. } else {
  20220. addChunk(stream, state, chunk, false);
  20221. }
  20222. }
  20223. } else if (!addToFront) {
  20224. state.reading = false;
  20225. }
  20226. }
  20227. return needMoreData(state);
  20228. }
  20229. function addChunk(stream, state, chunk, addToFront) {
  20230. if (state.flowing && state.length === 0 && !state.sync) {
  20231. stream.emit('data', chunk);
  20232. stream.read(0);
  20233. } else {
  20234. // update the buffer info.
  20235. state.length += state.objectMode ? 1 : chunk.length;
  20236. if (addToFront) state.buffer.unshift(chunk);else state.buffer.push(chunk);
  20237. if (state.needReadable) emitReadable(stream);
  20238. }
  20239. maybeReadMore(stream, state);
  20240. }
  20241. function chunkInvalid(state, chunk) {
  20242. var er;
  20243. if (!_isUint8Array(chunk) && typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) {
  20244. er = new TypeError('Invalid non-string/buffer chunk');
  20245. }
  20246. return er;
  20247. }
  20248. // if it's past the high water mark, we can push in some more.
  20249. // Also, if we have no data yet, we can stand some
  20250. // more bytes. This is to work around cases where hwm=0,
  20251. // such as the repl. Also, if the push() triggered a
  20252. // readable event, and the user called read(largeNumber) such that
  20253. // needReadable was set, then we ought to push more, so that another
  20254. // 'readable' event will be triggered.
  20255. function needMoreData(state) {
  20256. return !state.ended && (state.needReadable || state.length < state.highWaterMark || state.length === 0);
  20257. }
  20258. Readable.prototype.isPaused = function () {
  20259. return this._readableState.flowing === false;
  20260. };
  20261. // backwards compatibility.
  20262. Readable.prototype.setEncoding = function (enc) {
  20263. if (!StringDecoder) StringDecoder = require('string_decoder/').StringDecoder;
  20264. this._readableState.decoder = new StringDecoder(enc);
  20265. this._readableState.encoding = enc;
  20266. return this;
  20267. };
  20268. // Don't raise the hwm > 8MB
  20269. var MAX_HWM = 0x800000;
  20270. function computeNewHighWaterMark(n) {
  20271. if (n >= MAX_HWM) {
  20272. n = MAX_HWM;
  20273. } else {
  20274. // Get the next highest power of 2 to prevent increasing hwm excessively in
  20275. // tiny amounts
  20276. n--;
  20277. n |= n >>> 1;
  20278. n |= n >>> 2;
  20279. n |= n >>> 4;
  20280. n |= n >>> 8;
  20281. n |= n >>> 16;
  20282. n++;
  20283. }
  20284. return n;
  20285. }
  20286. // This function is designed to be inlinable, so please take care when making
  20287. // changes to the function body.
  20288. function howMuchToRead(n, state) {
  20289. if (n <= 0 || state.length === 0 && state.ended) return 0;
  20290. if (state.objectMode) return 1;
  20291. if (n !== n) {
  20292. // Only flow one buffer at a time
  20293. if (state.flowing && state.length) return state.buffer.head.data.length;else return state.length;
  20294. }
  20295. // If we're asking for more than the current hwm, then raise the hwm.
  20296. if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n);
  20297. if (n <= state.length) return n;
  20298. // Don't have enough
  20299. if (!state.ended) {
  20300. state.needReadable = true;
  20301. return 0;
  20302. }
  20303. return state.length;
  20304. }
  20305. // you can override either this method, or the async _read(n) below.
  20306. Readable.prototype.read = function (n) {
  20307. debug('read', n);
  20308. n = parseInt(n, 10);
  20309. var state = this._readableState;
  20310. var nOrig = n;
  20311. if (n !== 0) state.emittedReadable = false;
  20312. // if we're doing read(0) to trigger a readable event, but we
  20313. // already have a bunch of data in the buffer, then just trigger
  20314. // the 'readable' event and move on.
  20315. if (n === 0 && state.needReadable && (state.length >= state.highWaterMark || state.ended)) {
  20316. debug('read: emitReadable', state.length, state.ended);
  20317. if (state.length === 0 && state.ended) endReadable(this);else emitReadable(this);
  20318. return null;
  20319. }
  20320. n = howMuchToRead(n, state);
  20321. // if we've ended, and we're now clear, then finish it up.
  20322. if (n === 0 && state.ended) {
  20323. if (state.length === 0) endReadable(this);
  20324. return null;
  20325. }
  20326. // All the actual chunk generation logic needs to be
  20327. // *below* the call to _read. The reason is that in certain
  20328. // synthetic stream cases, such as passthrough streams, _read
  20329. // may be a completely synchronous operation which may change
  20330. // the state of the read buffer, providing enough data when
  20331. // before there was *not* enough.
  20332. //
  20333. // So, the steps are:
  20334. // 1. Figure out what the state of things will be after we do
  20335. // a read from the buffer.
  20336. //
  20337. // 2. If that resulting state will trigger a _read, then call _read.
  20338. // Note that this may be asynchronous, or synchronous. Yes, it is
  20339. // deeply ugly to write APIs this way, but that still doesn't mean
  20340. // that the Readable class should behave improperly, as streams are
  20341. // designed to be sync/async agnostic.
  20342. // Take note if the _read call is sync or async (ie, if the read call
  20343. // has returned yet), so that we know whether or not it's safe to emit
  20344. // 'readable' etc.
  20345. //
  20346. // 3. Actually pull the requested chunks out of the buffer and return.
  20347. // if we need a readable event, then we need to do some reading.
  20348. var doRead = state.needReadable;
  20349. debug('need readable', doRead);
  20350. // if we currently have less than the highWaterMark, then also read some
  20351. if (state.length === 0 || state.length - n < state.highWaterMark) {
  20352. doRead = true;
  20353. debug('length less than watermark', doRead);
  20354. }
  20355. // however, if we've ended, then there's no point, and if we're already
  20356. // reading, then it's unnecessary.
  20357. if (state.ended || state.reading) {
  20358. doRead = false;
  20359. debug('reading or ended', doRead);
  20360. } else if (doRead) {
  20361. debug('do read');
  20362. state.reading = true;
  20363. state.sync = true;
  20364. // if the length is currently zero, then we *need* a readable event.
  20365. if (state.length === 0) state.needReadable = true;
  20366. // call internal read method
  20367. this._read(state.highWaterMark);
  20368. state.sync = false;
  20369. // If _read pushed data synchronously, then `reading` will be false,
  20370. // and we need to re-evaluate how much data we can return to the user.
  20371. if (!state.reading) n = howMuchToRead(nOrig, state);
  20372. }
  20373. var ret;
  20374. if (n > 0) ret = fromList(n, state);else ret = null;
  20375. if (ret === null) {
  20376. state.needReadable = true;
  20377. n = 0;
  20378. } else {
  20379. state.length -= n;
  20380. }
  20381. if (state.length === 0) {
  20382. // If we have nothing in the buffer, then we want to know
  20383. // as soon as we *do* get something into the buffer.
  20384. if (!state.ended) state.needReadable = true;
  20385. // If we tried to read() past the EOF, then emit end on the next tick.
  20386. if (nOrig !== n && state.ended) endReadable(this);
  20387. }
  20388. if (ret !== null) this.emit('data', ret);
  20389. return ret;
  20390. };
  20391. function onEofChunk(stream, state) {
  20392. if (state.ended) return;
  20393. if (state.decoder) {
  20394. var chunk = state.decoder.end();
  20395. if (chunk && chunk.length) {
  20396. state.buffer.push(chunk);
  20397. state.length += state.objectMode ? 1 : chunk.length;
  20398. }
  20399. }
  20400. state.ended = true;
  20401. // emit 'readable' now to make sure it gets picked up.
  20402. emitReadable(stream);
  20403. }
  20404. // Don't emit readable right away in sync mode, because this can trigger
  20405. // another read() call => stack overflow. This way, it might trigger
  20406. // a nextTick recursion warning, but that's not so bad.
  20407. function emitReadable(stream) {
  20408. var state = stream._readableState;
  20409. state.needReadable = false;
  20410. if (!state.emittedReadable) {
  20411. debug('emitReadable', state.flowing);
  20412. state.emittedReadable = true;
  20413. if (state.sync) pna.nextTick(emitReadable_, stream);else emitReadable_(stream);
  20414. }
  20415. }
  20416. function emitReadable_(stream) {
  20417. debug('emit readable');
  20418. stream.emit('readable');
  20419. flow(stream);
  20420. }
  20421. // at this point, the user has presumably seen the 'readable' event,
  20422. // and called read() to consume some data. that may have triggered
  20423. // in turn another _read(n) call, in which case reading = true if
  20424. // it's in progress.
  20425. // However, if we're not ended, or reading, and the length < hwm,
  20426. // then go ahead and try to read some more preemptively.
  20427. function maybeReadMore(stream, state) {
  20428. if (!state.readingMore) {
  20429. state.readingMore = true;
  20430. pna.nextTick(maybeReadMore_, stream, state);
  20431. }
  20432. }
  20433. function maybeReadMore_(stream, state) {
  20434. var len = state.length;
  20435. while (!state.reading && !state.flowing && !state.ended && state.length < state.highWaterMark) {
  20436. debug('maybeReadMore read 0');
  20437. stream.read(0);
  20438. if (len === state.length)
  20439. // didn't get any data, stop spinning.
  20440. break;else len = state.length;
  20441. }
  20442. state.readingMore = false;
  20443. }
  20444. // abstract method. to be overridden in specific implementation classes.
  20445. // call cb(er, data) where data is <= n in length.
  20446. // for virtual (non-string, non-buffer) streams, "length" is somewhat
  20447. // arbitrary, and perhaps not very meaningful.
  20448. Readable.prototype._read = function (n) {
  20449. this.emit('error', new Error('_read() is not implemented'));
  20450. };
  20451. Readable.prototype.pipe = function (dest, pipeOpts) {
  20452. var src = this;
  20453. var state = this._readableState;
  20454. switch (state.pipesCount) {
  20455. case 0:
  20456. state.pipes = dest;
  20457. break;
  20458. case 1:
  20459. state.pipes = [state.pipes, dest];
  20460. break;
  20461. default:
  20462. state.pipes.push(dest);
  20463. break;
  20464. }
  20465. state.pipesCount += 1;
  20466. debug('pipe count=%d opts=%j', state.pipesCount, pipeOpts);
  20467. var doEnd = (!pipeOpts || pipeOpts.end !== false) && dest !== process.stdout && dest !== process.stderr;
  20468. var endFn = doEnd ? onend : unpipe;
  20469. if (state.endEmitted) pna.nextTick(endFn);else src.once('end', endFn);
  20470. dest.on('unpipe', onunpipe);
  20471. function onunpipe(readable, unpipeInfo) {
  20472. debug('onunpipe');
  20473. if (readable === src) {
  20474. if (unpipeInfo && unpipeInfo.hasUnpiped === false) {
  20475. unpipeInfo.hasUnpiped = true;
  20476. cleanup();
  20477. }
  20478. }
  20479. }
  20480. function onend() {
  20481. debug('onend');
  20482. dest.end();
  20483. }
  20484. // when the dest drains, it reduces the awaitDrain counter
  20485. // on the source. This would be more elegant with a .once()
  20486. // handler in flow(), but adding and removing repeatedly is
  20487. // too slow.
  20488. var ondrain = pipeOnDrain(src);
  20489. dest.on('drain', ondrain);
  20490. var cleanedUp = false;
  20491. function cleanup() {
  20492. debug('cleanup');
  20493. // cleanup event handlers once the pipe is broken
  20494. dest.removeListener('close', onclose);
  20495. dest.removeListener('finish', onfinish);
  20496. dest.removeListener('drain', ondrain);
  20497. dest.removeListener('error', onerror);
  20498. dest.removeListener('unpipe', onunpipe);
  20499. src.removeListener('end', onend);
  20500. src.removeListener('end', unpipe);
  20501. src.removeListener('data', ondata);
  20502. cleanedUp = true;
  20503. // if the reader is waiting for a drain event from this
  20504. // specific writer, then it would cause it to never start
  20505. // flowing again.
  20506. // So, if this is awaiting a drain, then we just call it now.
  20507. // If we don't know, then assume that we are waiting for one.
  20508. if (state.awaitDrain && (!dest._writableState || dest._writableState.needDrain)) ondrain();
  20509. }
  20510. // If the user pushes more data while we're writing to dest then we'll end up
  20511. // in ondata again. However, we only want to increase awaitDrain once because
  20512. // dest will only emit one 'drain' event for the multiple writes.
  20513. // => Introduce a guard on increasing awaitDrain.
  20514. var increasedAwaitDrain = false;
  20515. src.on('data', ondata);
  20516. function ondata(chunk) {
  20517. debug('ondata');
  20518. increasedAwaitDrain = false;
  20519. var ret = dest.write(chunk);
  20520. if (false === ret && !increasedAwaitDrain) {
  20521. // If the user unpiped during `dest.write()`, it is possible
  20522. // to get stuck in a permanently paused state if that write
  20523. // also returned false.
  20524. // => Check whether `dest` is still a piping destination.
  20525. if ((state.pipesCount === 1 && state.pipes === dest || state.pipesCount > 1 && indexOf(state.pipes, dest) !== -1) && !cleanedUp) {
  20526. debug('false write response, pause', src._readableState.awaitDrain);
  20527. src._readableState.awaitDrain++;
  20528. increasedAwaitDrain = true;
  20529. }
  20530. src.pause();
  20531. }
  20532. }
  20533. // if the dest has an error, then stop piping into it.
  20534. // however, don't suppress the throwing behavior for this.
  20535. function onerror(er) {
  20536. debug('onerror', er);
  20537. unpipe();
  20538. dest.removeListener('error', onerror);
  20539. if (EElistenerCount(dest, 'error') === 0) dest.emit('error', er);
  20540. }
  20541. // Make sure our error handler is attached before userland ones.
  20542. prependListener(dest, 'error', onerror);
  20543. // Both close and finish should trigger unpipe, but only once.
  20544. function onclose() {
  20545. dest.removeListener('finish', onfinish);
  20546. unpipe();
  20547. }
  20548. dest.once('close', onclose);
  20549. function onfinish() {
  20550. debug('onfinish');
  20551. dest.removeListener('close', onclose);
  20552. unpipe();
  20553. }
  20554. dest.once('finish', onfinish);
  20555. function unpipe() {
  20556. debug('unpipe');
  20557. src.unpipe(dest);
  20558. }
  20559. // tell the dest that it's being piped to
  20560. dest.emit('pipe', src);
  20561. // start the flow if it hasn't been started already.
  20562. if (!state.flowing) {
  20563. debug('pipe resume');
  20564. src.resume();
  20565. }
  20566. return dest;
  20567. };
  20568. function pipeOnDrain(src) {
  20569. return function () {
  20570. var state = src._readableState;
  20571. debug('pipeOnDrain', state.awaitDrain);
  20572. if (state.awaitDrain) state.awaitDrain--;
  20573. if (state.awaitDrain === 0 && EElistenerCount(src, 'data')) {
  20574. state.flowing = true;
  20575. flow(src);
  20576. }
  20577. };
  20578. }
  20579. Readable.prototype.unpipe = function (dest) {
  20580. var state = this._readableState;
  20581. var unpipeInfo = { hasUnpiped: false };
  20582. // if we're not piping anywhere, then do nothing.
  20583. if (state.pipesCount === 0) return this;
  20584. // just one destination. most common case.
  20585. if (state.pipesCount === 1) {
  20586. // passed in one, but it's not the right one.
  20587. if (dest && dest !== state.pipes) return this;
  20588. if (!dest) dest = state.pipes;
  20589. // got a match.
  20590. state.pipes = null;
  20591. state.pipesCount = 0;
  20592. state.flowing = false;
  20593. if (dest) dest.emit('unpipe', this, unpipeInfo);
  20594. return this;
  20595. }
  20596. // slow case. multiple pipe destinations.
  20597. if (!dest) {
  20598. // remove all.
  20599. var dests = state.pipes;
  20600. var len = state.pipesCount;
  20601. state.pipes = null;
  20602. state.pipesCount = 0;
  20603. state.flowing = false;
  20604. for (var i = 0; i < len; i++) {
  20605. dests[i].emit('unpipe', this, unpipeInfo);
  20606. }return this;
  20607. }
  20608. // try to find the right one.
  20609. var index = indexOf(state.pipes, dest);
  20610. if (index === -1) return this;
  20611. state.pipes.splice(index, 1);
  20612. state.pipesCount -= 1;
  20613. if (state.pipesCount === 1) state.pipes = state.pipes[0];
  20614. dest.emit('unpipe', this, unpipeInfo);
  20615. return this;
  20616. };
  20617. // set up data events if they are asked for
  20618. // Ensure readable listeners eventually get something
  20619. Readable.prototype.on = function (ev, fn) {
  20620. var res = Stream.prototype.on.call(this, ev, fn);
  20621. if (ev === 'data') {
  20622. // Start flowing on next tick if stream isn't explicitly paused
  20623. if (this._readableState.flowing !== false) this.resume();
  20624. } else if (ev === 'readable') {
  20625. var state = this._readableState;
  20626. if (!state.endEmitted && !state.readableListening) {
  20627. state.readableListening = state.needReadable = true;
  20628. state.emittedReadable = false;
  20629. if (!state.reading) {
  20630. pna.nextTick(nReadingNextTick, this);
  20631. } else if (state.length) {
  20632. emitReadable(this);
  20633. }
  20634. }
  20635. }
  20636. return res;
  20637. };
  20638. Readable.prototype.addListener = Readable.prototype.on;
  20639. function nReadingNextTick(self) {
  20640. debug('readable nexttick read 0');
  20641. self.read(0);
  20642. }
  20643. // pause() and resume() are remnants of the legacy readable stream API
  20644. // If the user uses them, then switch into old mode.
  20645. Readable.prototype.resume = function () {
  20646. var state = this._readableState;
  20647. if (!state.flowing) {
  20648. debug('resume');
  20649. state.flowing = true;
  20650. resume(this, state);
  20651. }
  20652. return this;
  20653. };
  20654. function resume(stream, state) {
  20655. if (!state.resumeScheduled) {
  20656. state.resumeScheduled = true;
  20657. pna.nextTick(resume_, stream, state);
  20658. }
  20659. }
  20660. function resume_(stream, state) {
  20661. if (!state.reading) {
  20662. debug('resume read 0');
  20663. stream.read(0);
  20664. }
  20665. state.resumeScheduled = false;
  20666. state.awaitDrain = 0;
  20667. stream.emit('resume');
  20668. flow(stream);
  20669. if (state.flowing && !state.reading) stream.read(0);
  20670. }
  20671. Readable.prototype.pause = function () {
  20672. debug('call pause flowing=%j', this._readableState.flowing);
  20673. if (false !== this._readableState.flowing) {
  20674. debug('pause');
  20675. this._readableState.flowing = false;
  20676. this.emit('pause');
  20677. }
  20678. return this;
  20679. };
  20680. function flow(stream) {
  20681. var state = stream._readableState;
  20682. debug('flow', state.flowing);
  20683. while (state.flowing && stream.read() !== null) {}
  20684. }
  20685. // wrap an old-style stream as the async data source.
  20686. // This is *not* part of the readable stream interface.
  20687. // It is an ugly unfortunate mess of history.
  20688. Readable.prototype.wrap = function (stream) {
  20689. var _this = this;
  20690. var state = this._readableState;
  20691. var paused = false;
  20692. stream.on('end', function () {
  20693. debug('wrapped end');
  20694. if (state.decoder && !state.ended) {
  20695. var chunk = state.decoder.end();
  20696. if (chunk && chunk.length) _this.push(chunk);
  20697. }
  20698. _this.push(null);
  20699. });
  20700. stream.on('data', function (chunk) {
  20701. debug('wrapped data');
  20702. if (state.decoder) chunk = state.decoder.write(chunk);
  20703. // don't skip over falsy values in objectMode
  20704. if (state.objectMode && (chunk === null || chunk === undefined)) return;else if (!state.objectMode && (!chunk || !chunk.length)) return;
  20705. var ret = _this.push(chunk);
  20706. if (!ret) {
  20707. paused = true;
  20708. stream.pause();
  20709. }
  20710. });
  20711. // proxy all the other methods.
  20712. // important when wrapping filters and duplexes.
  20713. for (var i in stream) {
  20714. if (this[i] === undefined && typeof stream[i] === 'function') {
  20715. this[i] = function (method) {
  20716. return function () {
  20717. return stream[method].apply(stream, arguments);
  20718. };
  20719. }(i);
  20720. }
  20721. }
  20722. // proxy certain important events.
  20723. for (var n = 0; n < kProxyEvents.length; n++) {
  20724. stream.on(kProxyEvents[n], this.emit.bind(this, kProxyEvents[n]));
  20725. }
  20726. // when we try to consume some more bytes, simply unpause the
  20727. // underlying stream.
  20728. this._read = function (n) {
  20729. debug('wrapped _read', n);
  20730. if (paused) {
  20731. paused = false;
  20732. stream.resume();
  20733. }
  20734. };
  20735. return this;
  20736. };
  20737. Object.defineProperty(Readable.prototype, 'readableHighWaterMark', {
  20738. // making it explicit this property is not enumerable
  20739. // because otherwise some prototype manipulation in
  20740. // userland will fail
  20741. enumerable: false,
  20742. get: function () {
  20743. return this._readableState.highWaterMark;
  20744. }
  20745. });
  20746. // exposed for testing purposes only.
  20747. Readable._fromList = fromList;
  20748. // Pluck off n bytes from an array of buffers.
  20749. // Length is the combined lengths of all the buffers in the list.
  20750. // This function is designed to be inlinable, so please take care when making
  20751. // changes to the function body.
  20752. function fromList(n, state) {
  20753. // nothing buffered
  20754. if (state.length === 0) return null;
  20755. var ret;
  20756. if (state.objectMode) ret = state.buffer.shift();else if (!n || n >= state.length) {
  20757. // read it all, truncate the list
  20758. 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);
  20759. state.buffer.clear();
  20760. } else {
  20761. // read part of list
  20762. ret = fromListPartial(n, state.buffer, state.decoder);
  20763. }
  20764. return ret;
  20765. }
  20766. // Extracts only enough buffered data to satisfy the amount requested.
  20767. // This function is designed to be inlinable, so please take care when making
  20768. // changes to the function body.
  20769. function fromListPartial(n, list, hasStrings) {
  20770. var ret;
  20771. if (n < list.head.data.length) {
  20772. // slice is the same for buffers and strings
  20773. ret = list.head.data.slice(0, n);
  20774. list.head.data = list.head.data.slice(n);
  20775. } else if (n === list.head.data.length) {
  20776. // first chunk is a perfect match
  20777. ret = list.shift();
  20778. } else {
  20779. // result spans more than one buffer
  20780. ret = hasStrings ? copyFromBufferString(n, list) : copyFromBuffer(n, list);
  20781. }
  20782. return ret;
  20783. }
  20784. // Copies a specified amount of characters from the list of buffered data
  20785. // chunks.
  20786. // This function is designed to be inlinable, so please take care when making
  20787. // changes to the function body.
  20788. function copyFromBufferString(n, list) {
  20789. var p = list.head;
  20790. var c = 1;
  20791. var ret = p.data;
  20792. n -= ret.length;
  20793. while (p = p.next) {
  20794. var str = p.data;
  20795. var nb = n > str.length ? str.length : n;
  20796. if (nb === str.length) ret += str;else ret += str.slice(0, n);
  20797. n -= nb;
  20798. if (n === 0) {
  20799. if (nb === str.length) {
  20800. ++c;
  20801. if (p.next) list.head = p.next;else list.head = list.tail = null;
  20802. } else {
  20803. list.head = p;
  20804. p.data = str.slice(nb);
  20805. }
  20806. break;
  20807. }
  20808. ++c;
  20809. }
  20810. list.length -= c;
  20811. return ret;
  20812. }
  20813. // Copies a specified amount of bytes from the list of buffered data chunks.
  20814. // This function is designed to be inlinable, so please take care when making
  20815. // changes to the function body.
  20816. function copyFromBuffer(n, list) {
  20817. var ret = Buffer.allocUnsafe(n);
  20818. var p = list.head;
  20819. var c = 1;
  20820. p.data.copy(ret);
  20821. n -= p.data.length;
  20822. while (p = p.next) {
  20823. var buf = p.data;
  20824. var nb = n > buf.length ? buf.length : n;
  20825. buf.copy(ret, ret.length - n, 0, nb);
  20826. n -= nb;
  20827. if (n === 0) {
  20828. if (nb === buf.length) {
  20829. ++c;
  20830. if (p.next) list.head = p.next;else list.head = list.tail = null;
  20831. } else {
  20832. list.head = p;
  20833. p.data = buf.slice(nb);
  20834. }
  20835. break;
  20836. }
  20837. ++c;
  20838. }
  20839. list.length -= c;
  20840. return ret;
  20841. }
  20842. function endReadable(stream) {
  20843. var state = stream._readableState;
  20844. // If we get here before consuming all the bytes, then that is a
  20845. // bug in node. Should never happen.
  20846. if (state.length > 0) throw new Error('"endReadable()" called on non-empty stream');
  20847. if (!state.endEmitted) {
  20848. state.ended = true;
  20849. pna.nextTick(endReadableNT, state, stream);
  20850. }
  20851. }
  20852. function endReadableNT(state, stream) {
  20853. // Check that we didn't get one last unshift.
  20854. if (!state.endEmitted && state.length === 0) {
  20855. state.endEmitted = true;
  20856. stream.readable = false;
  20857. stream.emit('end');
  20858. }
  20859. }
  20860. function indexOf(xs, x) {
  20861. for (var i = 0, l = xs.length; i < l; i++) {
  20862. if (xs[i] === x) return i;
  20863. }
  20864. return -1;
  20865. }
  20866. }).call(this)}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
  20867. },{"./_stream_duplex":330,"./internal/streams/BufferList":335,"./internal/streams/destroy":336,"./internal/streams/stream":337,"_process":399,"core-util-is":298,"events":301,"inherits":311,"isarray":313,"process-nextick-args":323,"safe-buffer":343,"string_decoder/":346,"util":84}],333:[function(require,module,exports){
  20868. // Copyright Joyent, Inc. and other Node contributors.
  20869. //
  20870. // Permission is hereby granted, free of charge, to any person obtaining a
  20871. // copy of this software and associated documentation files (the
  20872. // "Software"), to deal in the Software without restriction, including
  20873. // without limitation the rights to use, copy, modify, merge, publish,
  20874. // distribute, sublicense, and/or sell copies of the Software, and to permit
  20875. // persons to whom the Software is furnished to do so, subject to the
  20876. // following conditions:
  20877. //
  20878. // The above copyright notice and this permission notice shall be included
  20879. // in all copies or substantial portions of the Software.
  20880. //
  20881. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  20882. // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  20883. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  20884. // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  20885. // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  20886. // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  20887. // USE OR OTHER DEALINGS IN THE SOFTWARE.
  20888. // a transform stream is a readable/writable stream where you do
  20889. // something with the data. Sometimes it's called a "filter",
  20890. // but that's not a great name for it, since that implies a thing where
  20891. // some bits pass through, and others are simply ignored. (That would
  20892. // be a valid example of a transform, of course.)
  20893. //
  20894. // While the output is causally related to the input, it's not a
  20895. // necessarily symmetric or synchronous transformation. For example,
  20896. // a zlib stream might take multiple plain-text writes(), and then
  20897. // emit a single compressed chunk some time in the future.
  20898. //
  20899. // Here's how this works:
  20900. //
  20901. // The Transform stream has all the aspects of the readable and writable
  20902. // stream classes. When you write(chunk), that calls _write(chunk,cb)
  20903. // internally, and returns false if there's a lot of pending writes
  20904. // buffered up. When you call read(), that calls _read(n) until
  20905. // there's enough pending readable data buffered up.
  20906. //
  20907. // In a transform stream, the written data is placed in a buffer. When
  20908. // _read(n) is called, it transforms the queued up data, calling the
  20909. // buffered _write cb's as it consumes chunks. If consuming a single
  20910. // written chunk would result in multiple output chunks, then the first
  20911. // outputted bit calls the readcb, and subsequent chunks just go into
  20912. // the read buffer, and will cause it to emit 'readable' if necessary.
  20913. //
  20914. // This way, back-pressure is actually determined by the reading side,
  20915. // since _read has to be called to start processing a new chunk. However,
  20916. // a pathological inflate type of transform can cause excessive buffering
  20917. // here. For example, imagine a stream where every byte of input is
  20918. // interpreted as an integer from 0-255, and then results in that many
  20919. // bytes of output. Writing the 4 bytes {ff,ff,ff,ff} would result in
  20920. // 1kb of data being output. In this case, you could write a very small
  20921. // amount of input, and end up with a very large amount of output. In
  20922. // such a pathological inflating mechanism, there'd be no way to tell
  20923. // the system to stop doing the transform. A single 4MB write could
  20924. // cause the system to run out of memory.
  20925. //
  20926. // However, even in such a pathological case, only a single written chunk
  20927. // would be consumed, and then the rest would wait (un-transformed) until
  20928. // the results of the previous transformed chunk were consumed.
  20929. 'use strict';
  20930. module.exports = Transform;
  20931. var Duplex = require('./_stream_duplex');
  20932. /*<replacement>*/
  20933. var util = Object.create(require('core-util-is'));
  20934. util.inherits = require('inherits');
  20935. /*</replacement>*/
  20936. util.inherits(Transform, Duplex);
  20937. function afterTransform(er, data) {
  20938. var ts = this._transformState;
  20939. ts.transforming = false;
  20940. var cb = ts.writecb;
  20941. if (!cb) {
  20942. return this.emit('error', new Error('write callback called multiple times'));
  20943. }
  20944. ts.writechunk = null;
  20945. ts.writecb = null;
  20946. if (data != null) // single equals check for both `null` and `undefined`
  20947. this.push(data);
  20948. cb(er);
  20949. var rs = this._readableState;
  20950. rs.reading = false;
  20951. if (rs.needReadable || rs.length < rs.highWaterMark) {
  20952. this._read(rs.highWaterMark);
  20953. }
  20954. }
  20955. function Transform(options) {
  20956. if (!(this instanceof Transform)) return new Transform(options);
  20957. Duplex.call(this, options);
  20958. this._transformState = {
  20959. afterTransform: afterTransform.bind(this),
  20960. needTransform: false,
  20961. transforming: false,
  20962. writecb: null,
  20963. writechunk: null,
  20964. writeencoding: null
  20965. };
  20966. // start out asking for a readable event once data is transformed.
  20967. this._readableState.needReadable = true;
  20968. // we have implemented the _read method, and done the other things
  20969. // that Readable wants before the first _read call, so unset the
  20970. // sync guard flag.
  20971. this._readableState.sync = false;
  20972. if (options) {
  20973. if (typeof options.transform === 'function') this._transform = options.transform;
  20974. if (typeof options.flush === 'function') this._flush = options.flush;
  20975. }
  20976. // When the writable side finishes, then flush out anything remaining.
  20977. this.on('prefinish', prefinish);
  20978. }
  20979. function prefinish() {
  20980. var _this = this;
  20981. if (typeof this._flush === 'function') {
  20982. this._flush(function (er, data) {
  20983. done(_this, er, data);
  20984. });
  20985. } else {
  20986. done(this, null, null);
  20987. }
  20988. }
  20989. Transform.prototype.push = function (chunk, encoding) {
  20990. this._transformState.needTransform = false;
  20991. return Duplex.prototype.push.call(this, chunk, encoding);
  20992. };
  20993. // This is the part where you do stuff!
  20994. // override this function in implementation classes.
  20995. // 'chunk' is an input chunk.
  20996. //
  20997. // Call `push(newChunk)` to pass along transformed output
  20998. // to the readable side. You may call 'push' zero or more times.
  20999. //
  21000. // Call `cb(err)` when you are done with this chunk. If you pass
  21001. // an error, then that'll put the hurt on the whole operation. If you
  21002. // never call cb(), then you'll never get another chunk.
  21003. Transform.prototype._transform = function (chunk, encoding, cb) {
  21004. throw new Error('_transform() is not implemented');
  21005. };
  21006. Transform.prototype._write = function (chunk, encoding, cb) {
  21007. var ts = this._transformState;
  21008. ts.writecb = cb;
  21009. ts.writechunk = chunk;
  21010. ts.writeencoding = encoding;
  21011. if (!ts.transforming) {
  21012. var rs = this._readableState;
  21013. if (ts.needTransform || rs.needReadable || rs.length < rs.highWaterMark) this._read(rs.highWaterMark);
  21014. }
  21015. };
  21016. // Doesn't matter what the args are here.
  21017. // _transform does all the work.
  21018. // That we got here means that the readable side wants more data.
  21019. Transform.prototype._read = function (n) {
  21020. var ts = this._transformState;
  21021. if (ts.writechunk !== null && ts.writecb && !ts.transforming) {
  21022. ts.transforming = true;
  21023. this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform);
  21024. } else {
  21025. // mark that we need a transform, so that any data that comes in
  21026. // will get processed, now that we've asked for it.
  21027. ts.needTransform = true;
  21028. }
  21029. };
  21030. Transform.prototype._destroy = function (err, cb) {
  21031. var _this2 = this;
  21032. Duplex.prototype._destroy.call(this, err, function (err2) {
  21033. cb(err2);
  21034. _this2.emit('close');
  21035. });
  21036. };
  21037. function done(stream, er, data) {
  21038. if (er) return stream.emit('error', er);
  21039. if (data != null) // single equals check for both `null` and `undefined`
  21040. stream.push(data);
  21041. // if there's nothing in the write buffer, then that means
  21042. // that nothing more will ever be provided
  21043. if (stream._writableState.length) throw new Error('Calling transform done when ws.length != 0');
  21044. if (stream._transformState.transforming) throw new Error('Calling transform done when still transforming');
  21045. return stream.push(null);
  21046. }
  21047. },{"./_stream_duplex":330,"core-util-is":298,"inherits":311}],334:[function(require,module,exports){
  21048. (function (process,global,setImmediate){(function (){
  21049. // Copyright Joyent, Inc. and other Node contributors.
  21050. //
  21051. // Permission is hereby granted, free of charge, to any person obtaining a
  21052. // copy of this software and associated documentation files (the
  21053. // "Software"), to deal in the Software without restriction, including
  21054. // without limitation the rights to use, copy, modify, merge, publish,
  21055. // distribute, sublicense, and/or sell copies of the Software, and to permit
  21056. // persons to whom the Software is furnished to do so, subject to the
  21057. // following conditions:
  21058. //
  21059. // The above copyright notice and this permission notice shall be included
  21060. // in all copies or substantial portions of the Software.
  21061. //
  21062. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  21063. // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  21064. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  21065. // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  21066. // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  21067. // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  21068. // USE OR OTHER DEALINGS IN THE SOFTWARE.
  21069. // A bit simpler than readable streams.
  21070. // Implement an async ._write(chunk, encoding, cb), and it'll handle all
  21071. // the drain event emission and buffering.
  21072. 'use strict';
  21073. /*<replacement>*/
  21074. var pna = require('process-nextick-args');
  21075. /*</replacement>*/
  21076. module.exports = Writable;
  21077. /* <replacement> */
  21078. function WriteReq(chunk, encoding, cb) {
  21079. this.chunk = chunk;
  21080. this.encoding = encoding;
  21081. this.callback = cb;
  21082. this.next = null;
  21083. }
  21084. // It seems a linked list but it is not
  21085. // there will be only 2 of these for each stream
  21086. function CorkedRequest(state) {
  21087. var _this = this;
  21088. this.next = null;
  21089. this.entry = null;
  21090. this.finish = function () {
  21091. onCorkedFinish(_this, state);
  21092. };
  21093. }
  21094. /* </replacement> */
  21095. /*<replacement>*/
  21096. var asyncWrite = !process.browser && ['v0.10', 'v0.9.'].indexOf(process.version.slice(0, 5)) > -1 ? setImmediate : pna.nextTick;
  21097. /*</replacement>*/
  21098. /*<replacement>*/
  21099. var Duplex;
  21100. /*</replacement>*/
  21101. Writable.WritableState = WritableState;
  21102. /*<replacement>*/
  21103. var util = Object.create(require('core-util-is'));
  21104. util.inherits = require('inherits');
  21105. /*</replacement>*/
  21106. /*<replacement>*/
  21107. var internalUtil = {
  21108. deprecate: require('util-deprecate')
  21109. };
  21110. /*</replacement>*/
  21111. /*<replacement>*/
  21112. var Stream = require('./internal/streams/stream');
  21113. /*</replacement>*/
  21114. /*<replacement>*/
  21115. var Buffer = require('safe-buffer').Buffer;
  21116. var OurUint8Array = global.Uint8Array || function () {};
  21117. function _uint8ArrayToBuffer(chunk) {
  21118. return Buffer.from(chunk);
  21119. }
  21120. function _isUint8Array(obj) {
  21121. return Buffer.isBuffer(obj) || obj instanceof OurUint8Array;
  21122. }
  21123. /*</replacement>*/
  21124. var destroyImpl = require('./internal/streams/destroy');
  21125. util.inherits(Writable, Stream);
  21126. function nop() {}
  21127. function WritableState(options, stream) {
  21128. Duplex = Duplex || require('./_stream_duplex');
  21129. options = options || {};
  21130. // Duplex streams are both readable and writable, but share
  21131. // the same options object.
  21132. // However, some cases require setting options to different
  21133. // values for the readable and the writable sides of the duplex stream.
  21134. // These options can be provided separately as readableXXX and writableXXX.
  21135. var isDuplex = stream instanceof Duplex;
  21136. // object stream flag to indicate whether or not this stream
  21137. // contains buffers or objects.
  21138. this.objectMode = !!options.objectMode;
  21139. if (isDuplex) this.objectMode = this.objectMode || !!options.writableObjectMode;
  21140. // the point at which write() starts returning false
  21141. // Note: 0 is a valid value, means that we always return false if
  21142. // the entire buffer is not flushed immediately on write()
  21143. var hwm = options.highWaterMark;
  21144. var writableHwm = options.writableHighWaterMark;
  21145. var defaultHwm = this.objectMode ? 16 : 16 * 1024;
  21146. if (hwm || hwm === 0) this.highWaterMark = hwm;else if (isDuplex && (writableHwm || writableHwm === 0)) this.highWaterMark = writableHwm;else this.highWaterMark = defaultHwm;
  21147. // cast to ints.
  21148. this.highWaterMark = Math.floor(this.highWaterMark);
  21149. // if _final has been called
  21150. this.finalCalled = false;
  21151. // drain event flag.
  21152. this.needDrain = false;
  21153. // at the start of calling end()
  21154. this.ending = false;
  21155. // when end() has been called, and returned
  21156. this.ended = false;
  21157. // when 'finish' is emitted
  21158. this.finished = false;
  21159. // has it been destroyed
  21160. this.destroyed = false;
  21161. // should we decode strings into buffers before passing to _write?
  21162. // this is here so that some node-core streams can optimize string
  21163. // handling at a lower level.
  21164. var noDecode = options.decodeStrings === false;
  21165. this.decodeStrings = !noDecode;
  21166. // Crypto is kind of old and crusty. Historically, its default string
  21167. // encoding is 'binary' so we have to make this configurable.
  21168. // Everything else in the universe uses 'utf8', though.
  21169. this.defaultEncoding = options.defaultEncoding || 'utf8';
  21170. // not an actual buffer we keep track of, but a measurement
  21171. // of how much we're waiting to get pushed to some underlying
  21172. // socket or file.
  21173. this.length = 0;
  21174. // a flag to see when we're in the middle of a write.
  21175. this.writing = false;
  21176. // when true all writes will be buffered until .uncork() call
  21177. this.corked = 0;
  21178. // a flag to be able to tell if the onwrite cb is called immediately,
  21179. // or on a later tick. We set this to true at first, because any
  21180. // actions that shouldn't happen until "later" should generally also
  21181. // not happen before the first write call.
  21182. this.sync = true;
  21183. // a flag to know if we're processing previously buffered items, which
  21184. // may call the _write() callback in the same tick, so that we don't
  21185. // end up in an overlapped onwrite situation.
  21186. this.bufferProcessing = false;
  21187. // the callback that's passed to _write(chunk,cb)
  21188. this.onwrite = function (er) {
  21189. onwrite(stream, er);
  21190. };
  21191. // the callback that the user supplies to write(chunk,encoding,cb)
  21192. this.writecb = null;
  21193. // the amount that is being written when _write is called.
  21194. this.writelen = 0;
  21195. this.bufferedRequest = null;
  21196. this.lastBufferedRequest = null;
  21197. // number of pending user-supplied write callbacks
  21198. // this must be 0 before 'finish' can be emitted
  21199. this.pendingcb = 0;
  21200. // emit prefinish if the only thing we're waiting for is _write cbs
  21201. // This is relevant for synchronous Transform streams
  21202. this.prefinished = false;
  21203. // True if the error was already emitted and should not be thrown again
  21204. this.errorEmitted = false;
  21205. // count buffered requests
  21206. this.bufferedRequestCount = 0;
  21207. // allocate the first CorkedRequest, there is always
  21208. // one allocated and free to use, and we maintain at most two
  21209. this.corkedRequestsFree = new CorkedRequest(this);
  21210. }
  21211. WritableState.prototype.getBuffer = function getBuffer() {
  21212. var current = this.bufferedRequest;
  21213. var out = [];
  21214. while (current) {
  21215. out.push(current);
  21216. current = current.next;
  21217. }
  21218. return out;
  21219. };
  21220. (function () {
  21221. try {
  21222. Object.defineProperty(WritableState.prototype, 'buffer', {
  21223. get: internalUtil.deprecate(function () {
  21224. return this.getBuffer();
  21225. }, '_writableState.buffer is deprecated. Use _writableState.getBuffer ' + 'instead.', 'DEP0003')
  21226. });
  21227. } catch (_) {}
  21228. })();
  21229. // Test _writableState for inheritance to account for Duplex streams,
  21230. // whose prototype chain only points to Readable.
  21231. var realHasInstance;
  21232. if (typeof Symbol === 'function' && Symbol.hasInstance && typeof Function.prototype[Symbol.hasInstance] === 'function') {
  21233. realHasInstance = Function.prototype[Symbol.hasInstance];
  21234. Object.defineProperty(Writable, Symbol.hasInstance, {
  21235. value: function (object) {
  21236. if (realHasInstance.call(this, object)) return true;
  21237. if (this !== Writable) return false;
  21238. return object && object._writableState instanceof WritableState;
  21239. }
  21240. });
  21241. } else {
  21242. realHasInstance = function (object) {
  21243. return object instanceof this;
  21244. };
  21245. }
  21246. function Writable(options) {
  21247. Duplex = Duplex || require('./_stream_duplex');
  21248. // Writable ctor is applied to Duplexes, too.
  21249. // `realHasInstance` is necessary because using plain `instanceof`
  21250. // would return false, as no `_writableState` property is attached.
  21251. // Trying to use the custom `instanceof` for Writable here will also break the
  21252. // Node.js LazyTransform implementation, which has a non-trivial getter for
  21253. // `_writableState` that would lead to infinite recursion.
  21254. if (!realHasInstance.call(Writable, this) && !(this instanceof Duplex)) {
  21255. return new Writable(options);
  21256. }
  21257. this._writableState = new WritableState(options, this);
  21258. // legacy.
  21259. this.writable = true;
  21260. if (options) {
  21261. if (typeof options.write === 'function') this._write = options.write;
  21262. if (typeof options.writev === 'function') this._writev = options.writev;
  21263. if (typeof options.destroy === 'function') this._destroy = options.destroy;
  21264. if (typeof options.final === 'function') this._final = options.final;
  21265. }
  21266. Stream.call(this);
  21267. }
  21268. // Otherwise people can pipe Writable streams, which is just wrong.
  21269. Writable.prototype.pipe = function () {
  21270. this.emit('error', new Error('Cannot pipe, not readable'));
  21271. };
  21272. function writeAfterEnd(stream, cb) {
  21273. var er = new Error('write after end');
  21274. // TODO: defer error events consistently everywhere, not just the cb
  21275. stream.emit('error', er);
  21276. pna.nextTick(cb, er);
  21277. }
  21278. // Checks that a user-supplied chunk is valid, especially for the particular
  21279. // mode the stream is in. Currently this means that `null` is never accepted
  21280. // and undefined/non-string values are only allowed in object mode.
  21281. function validChunk(stream, state, chunk, cb) {
  21282. var valid = true;
  21283. var er = false;
  21284. if (chunk === null) {
  21285. er = new TypeError('May not write null values to stream');
  21286. } else if (typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) {
  21287. er = new TypeError('Invalid non-string/buffer chunk');
  21288. }
  21289. if (er) {
  21290. stream.emit('error', er);
  21291. pna.nextTick(cb, er);
  21292. valid = false;
  21293. }
  21294. return valid;
  21295. }
  21296. Writable.prototype.write = function (chunk, encoding, cb) {
  21297. var state = this._writableState;
  21298. var ret = false;
  21299. var isBuf = !state.objectMode && _isUint8Array(chunk);
  21300. if (isBuf && !Buffer.isBuffer(chunk)) {
  21301. chunk = _uint8ArrayToBuffer(chunk);
  21302. }
  21303. if (typeof encoding === 'function') {
  21304. cb = encoding;
  21305. encoding = null;
  21306. }
  21307. if (isBuf) encoding = 'buffer';else if (!encoding) encoding = state.defaultEncoding;
  21308. if (typeof cb !== 'function') cb = nop;
  21309. if (state.ended) writeAfterEnd(this, cb);else if (isBuf || validChunk(this, state, chunk, cb)) {
  21310. state.pendingcb++;
  21311. ret = writeOrBuffer(this, state, isBuf, chunk, encoding, cb);
  21312. }
  21313. return ret;
  21314. };
  21315. Writable.prototype.cork = function () {
  21316. var state = this._writableState;
  21317. state.corked++;
  21318. };
  21319. Writable.prototype.uncork = function () {
  21320. var state = this._writableState;
  21321. if (state.corked) {
  21322. state.corked--;
  21323. if (!state.writing && !state.corked && !state.finished && !state.bufferProcessing && state.bufferedRequest) clearBuffer(this, state);
  21324. }
  21325. };
  21326. Writable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) {
  21327. // node::ParseEncoding() requires lower case.
  21328. if (typeof encoding === 'string') encoding = encoding.toLowerCase();
  21329. 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);
  21330. this._writableState.defaultEncoding = encoding;
  21331. return this;
  21332. };
  21333. function decodeChunk(state, chunk, encoding) {
  21334. if (!state.objectMode && state.decodeStrings !== false && typeof chunk === 'string') {
  21335. chunk = Buffer.from(chunk, encoding);
  21336. }
  21337. return chunk;
  21338. }
  21339. Object.defineProperty(Writable.prototype, 'writableHighWaterMark', {
  21340. // making it explicit this property is not enumerable
  21341. // because otherwise some prototype manipulation in
  21342. // userland will fail
  21343. enumerable: false,
  21344. get: function () {
  21345. return this._writableState.highWaterMark;
  21346. }
  21347. });
  21348. // if we're already writing something, then just put this
  21349. // in the queue, and wait our turn. Otherwise, call _write
  21350. // If we return false, then we need a drain event, so set that flag.
  21351. function writeOrBuffer(stream, state, isBuf, chunk, encoding, cb) {
  21352. if (!isBuf) {
  21353. var newChunk = decodeChunk(state, chunk, encoding);
  21354. if (chunk !== newChunk) {
  21355. isBuf = true;
  21356. encoding = 'buffer';
  21357. chunk = newChunk;
  21358. }
  21359. }
  21360. var len = state.objectMode ? 1 : chunk.length;
  21361. state.length += len;
  21362. var ret = state.length < state.highWaterMark;
  21363. // we must ensure that previous needDrain will not be reset to false.
  21364. if (!ret) state.needDrain = true;
  21365. if (state.writing || state.corked) {
  21366. var last = state.lastBufferedRequest;
  21367. state.lastBufferedRequest = {
  21368. chunk: chunk,
  21369. encoding: encoding,
  21370. isBuf: isBuf,
  21371. callback: cb,
  21372. next: null
  21373. };
  21374. if (last) {
  21375. last.next = state.lastBufferedRequest;
  21376. } else {
  21377. state.bufferedRequest = state.lastBufferedRequest;
  21378. }
  21379. state.bufferedRequestCount += 1;
  21380. } else {
  21381. doWrite(stream, state, false, len, chunk, encoding, cb);
  21382. }
  21383. return ret;
  21384. }
  21385. function doWrite(stream, state, writev, len, chunk, encoding, cb) {
  21386. state.writelen = len;
  21387. state.writecb = cb;
  21388. state.writing = true;
  21389. state.sync = true;
  21390. if (writev) stream._writev(chunk, state.onwrite);else stream._write(chunk, encoding, state.onwrite);
  21391. state.sync = false;
  21392. }
  21393. function onwriteError(stream, state, sync, er, cb) {
  21394. --state.pendingcb;
  21395. if (sync) {
  21396. // defer the callback if we are being called synchronously
  21397. // to avoid piling up things on the stack
  21398. pna.nextTick(cb, er);
  21399. // this can emit finish, and it will always happen
  21400. // after error
  21401. pna.nextTick(finishMaybe, stream, state);
  21402. stream._writableState.errorEmitted = true;
  21403. stream.emit('error', er);
  21404. } else {
  21405. // the caller expect this to happen before if
  21406. // it is async
  21407. cb(er);
  21408. stream._writableState.errorEmitted = true;
  21409. stream.emit('error', er);
  21410. // this can emit finish, but finish must
  21411. // always follow error
  21412. finishMaybe(stream, state);
  21413. }
  21414. }
  21415. function onwriteStateUpdate(state) {
  21416. state.writing = false;
  21417. state.writecb = null;
  21418. state.length -= state.writelen;
  21419. state.writelen = 0;
  21420. }
  21421. function onwrite(stream, er) {
  21422. var state = stream._writableState;
  21423. var sync = state.sync;
  21424. var cb = state.writecb;
  21425. onwriteStateUpdate(state);
  21426. if (er) onwriteError(stream, state, sync, er, cb);else {
  21427. // Check if we're actually ready to finish, but don't emit yet
  21428. var finished = needFinish(state);
  21429. if (!finished && !state.corked && !state.bufferProcessing && state.bufferedRequest) {
  21430. clearBuffer(stream, state);
  21431. }
  21432. if (sync) {
  21433. /*<replacement>*/
  21434. asyncWrite(afterWrite, stream, state, finished, cb);
  21435. /*</replacement>*/
  21436. } else {
  21437. afterWrite(stream, state, finished, cb);
  21438. }
  21439. }
  21440. }
  21441. function afterWrite(stream, state, finished, cb) {
  21442. if (!finished) onwriteDrain(stream, state);
  21443. state.pendingcb--;
  21444. cb();
  21445. finishMaybe(stream, state);
  21446. }
  21447. // Must force callback to be called on nextTick, so that we don't
  21448. // emit 'drain' before the write() consumer gets the 'false' return
  21449. // value, and has a chance to attach a 'drain' listener.
  21450. function onwriteDrain(stream, state) {
  21451. if (state.length === 0 && state.needDrain) {
  21452. state.needDrain = false;
  21453. stream.emit('drain');
  21454. }
  21455. }
  21456. // if there's something in the buffer waiting, then process it
  21457. function clearBuffer(stream, state) {
  21458. state.bufferProcessing = true;
  21459. var entry = state.bufferedRequest;
  21460. if (stream._writev && entry && entry.next) {
  21461. // Fast case, write everything using _writev()
  21462. var l = state.bufferedRequestCount;
  21463. var buffer = new Array(l);
  21464. var holder = state.corkedRequestsFree;
  21465. holder.entry = entry;
  21466. var count = 0;
  21467. var allBuffers = true;
  21468. while (entry) {
  21469. buffer[count] = entry;
  21470. if (!entry.isBuf) allBuffers = false;
  21471. entry = entry.next;
  21472. count += 1;
  21473. }
  21474. buffer.allBuffers = allBuffers;
  21475. doWrite(stream, state, true, state.length, buffer, '', holder.finish);
  21476. // doWrite is almost always async, defer these to save a bit of time
  21477. // as the hot path ends with doWrite
  21478. state.pendingcb++;
  21479. state.lastBufferedRequest = null;
  21480. if (holder.next) {
  21481. state.corkedRequestsFree = holder.next;
  21482. holder.next = null;
  21483. } else {
  21484. state.corkedRequestsFree = new CorkedRequest(state);
  21485. }
  21486. state.bufferedRequestCount = 0;
  21487. } else {
  21488. // Slow case, write chunks one-by-one
  21489. while (entry) {
  21490. var chunk = entry.chunk;
  21491. var encoding = entry.encoding;
  21492. var cb = entry.callback;
  21493. var len = state.objectMode ? 1 : chunk.length;
  21494. doWrite(stream, state, false, len, chunk, encoding, cb);
  21495. entry = entry.next;
  21496. state.bufferedRequestCount--;
  21497. // if we didn't call the onwrite immediately, then
  21498. // it means that we need to wait until it does.
  21499. // also, that means that the chunk and cb are currently
  21500. // being processed, so move the buffer counter past them.
  21501. if (state.writing) {
  21502. break;
  21503. }
  21504. }
  21505. if (entry === null) state.lastBufferedRequest = null;
  21506. }
  21507. state.bufferedRequest = entry;
  21508. state.bufferProcessing = false;
  21509. }
  21510. Writable.prototype._write = function (chunk, encoding, cb) {
  21511. cb(new Error('_write() is not implemented'));
  21512. };
  21513. Writable.prototype._writev = null;
  21514. Writable.prototype.end = function (chunk, encoding, cb) {
  21515. var state = this._writableState;
  21516. if (typeof chunk === 'function') {
  21517. cb = chunk;
  21518. chunk = null;
  21519. encoding = null;
  21520. } else if (typeof encoding === 'function') {
  21521. cb = encoding;
  21522. encoding = null;
  21523. }
  21524. if (chunk !== null && chunk !== undefined) this.write(chunk, encoding);
  21525. // .end() fully uncorks
  21526. if (state.corked) {
  21527. state.corked = 1;
  21528. this.uncork();
  21529. }
  21530. // ignore unnecessary end() calls.
  21531. if (!state.ending && !state.finished) endWritable(this, state, cb);
  21532. };
  21533. function needFinish(state) {
  21534. return state.ending && state.length === 0 && state.bufferedRequest === null && !state.finished && !state.writing;
  21535. }
  21536. function callFinal(stream, state) {
  21537. stream._final(function (err) {
  21538. state.pendingcb--;
  21539. if (err) {
  21540. stream.emit('error', err);
  21541. }
  21542. state.prefinished = true;
  21543. stream.emit('prefinish');
  21544. finishMaybe(stream, state);
  21545. });
  21546. }
  21547. function prefinish(stream, state) {
  21548. if (!state.prefinished && !state.finalCalled) {
  21549. if (typeof stream._final === 'function') {
  21550. state.pendingcb++;
  21551. state.finalCalled = true;
  21552. pna.nextTick(callFinal, stream, state);
  21553. } else {
  21554. state.prefinished = true;
  21555. stream.emit('prefinish');
  21556. }
  21557. }
  21558. }
  21559. function finishMaybe(stream, state) {
  21560. var need = needFinish(state);
  21561. if (need) {
  21562. prefinish(stream, state);
  21563. if (state.pendingcb === 0) {
  21564. state.finished = true;
  21565. stream.emit('finish');
  21566. }
  21567. }
  21568. return need;
  21569. }
  21570. function endWritable(stream, state, cb) {
  21571. state.ending = true;
  21572. finishMaybe(stream, state);
  21573. if (cb) {
  21574. if (state.finished) pna.nextTick(cb);else stream.once('finish', cb);
  21575. }
  21576. state.ended = true;
  21577. stream.writable = false;
  21578. }
  21579. function onCorkedFinish(corkReq, state, err) {
  21580. var entry = corkReq.entry;
  21581. corkReq.entry = null;
  21582. while (entry) {
  21583. var cb = entry.callback;
  21584. state.pendingcb--;
  21585. cb(err);
  21586. entry = entry.next;
  21587. }
  21588. if (state.corkedRequestsFree) {
  21589. state.corkedRequestsFree.next = corkReq;
  21590. } else {
  21591. state.corkedRequestsFree = corkReq;
  21592. }
  21593. }
  21594. Object.defineProperty(Writable.prototype, 'destroyed', {
  21595. get: function () {
  21596. if (this._writableState === undefined) {
  21597. return false;
  21598. }
  21599. return this._writableState.destroyed;
  21600. },
  21601. set: function (value) {
  21602. // we ignore the value if the stream
  21603. // has not been initialized yet
  21604. if (!this._writableState) {
  21605. return;
  21606. }
  21607. // backward compatibility, the user is explicitly
  21608. // managing destroyed
  21609. this._writableState.destroyed = value;
  21610. }
  21611. });
  21612. Writable.prototype.destroy = destroyImpl.destroy;
  21613. Writable.prototype._undestroy = destroyImpl.undestroy;
  21614. Writable.prototype._destroy = function (err, cb) {
  21615. this.end();
  21616. cb(err);
  21617. };
  21618. }).call(this)}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {},require("timers").setImmediate)
  21619. },{"./_stream_duplex":330,"./internal/streams/destroy":336,"./internal/streams/stream":337,"_process":399,"core-util-is":298,"inherits":311,"process-nextick-args":323,"safe-buffer":343,"timers":347,"util-deprecate":349}],335:[function(require,module,exports){
  21620. 'use strict';
  21621. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  21622. var Buffer = require('safe-buffer').Buffer;
  21623. var util = require('util');
  21624. function copyBuffer(src, target, offset) {
  21625. src.copy(target, offset);
  21626. }
  21627. module.exports = function () {
  21628. function BufferList() {
  21629. _classCallCheck(this, BufferList);
  21630. this.head = null;
  21631. this.tail = null;
  21632. this.length = 0;
  21633. }
  21634. BufferList.prototype.push = function push(v) {
  21635. var entry = { data: v, next: null };
  21636. if (this.length > 0) this.tail.next = entry;else this.head = entry;
  21637. this.tail = entry;
  21638. ++this.length;
  21639. };
  21640. BufferList.prototype.unshift = function unshift(v) {
  21641. var entry = { data: v, next: this.head };
  21642. if (this.length === 0) this.tail = entry;
  21643. this.head = entry;
  21644. ++this.length;
  21645. };
  21646. BufferList.prototype.shift = function shift() {
  21647. if (this.length === 0) return;
  21648. var ret = this.head.data;
  21649. if (this.length === 1) this.head = this.tail = null;else this.head = this.head.next;
  21650. --this.length;
  21651. return ret;
  21652. };
  21653. BufferList.prototype.clear = function clear() {
  21654. this.head = this.tail = null;
  21655. this.length = 0;
  21656. };
  21657. BufferList.prototype.join = function join(s) {
  21658. if (this.length === 0) return '';
  21659. var p = this.head;
  21660. var ret = '' + p.data;
  21661. while (p = p.next) {
  21662. ret += s + p.data;
  21663. }return ret;
  21664. };
  21665. BufferList.prototype.concat = function concat(n) {
  21666. if (this.length === 0) return Buffer.alloc(0);
  21667. if (this.length === 1) return this.head.data;
  21668. var ret = Buffer.allocUnsafe(n >>> 0);
  21669. var p = this.head;
  21670. var i = 0;
  21671. while (p) {
  21672. copyBuffer(p.data, ret, i);
  21673. i += p.data.length;
  21674. p = p.next;
  21675. }
  21676. return ret;
  21677. };
  21678. return BufferList;
  21679. }();
  21680. if (util && util.inspect && util.inspect.custom) {
  21681. module.exports.prototype[util.inspect.custom] = function () {
  21682. var obj = util.inspect({ length: this.length });
  21683. return this.constructor.name + ' ' + obj;
  21684. };
  21685. }
  21686. },{"safe-buffer":343,"util":84}],336:[function(require,module,exports){
  21687. 'use strict';
  21688. /*<replacement>*/
  21689. var pna = require('process-nextick-args');
  21690. /*</replacement>*/
  21691. // undocumented cb() API, needed for core, not for public API
  21692. function destroy(err, cb) {
  21693. var _this = this;
  21694. var readableDestroyed = this._readableState && this._readableState.destroyed;
  21695. var writableDestroyed = this._writableState && this._writableState.destroyed;
  21696. if (readableDestroyed || writableDestroyed) {
  21697. if (cb) {
  21698. cb(err);
  21699. } else if (err && (!this._writableState || !this._writableState.errorEmitted)) {
  21700. pna.nextTick(emitErrorNT, this, err);
  21701. }
  21702. return this;
  21703. }
  21704. // we set destroyed to true before firing error callbacks in order
  21705. // to make it re-entrance safe in case destroy() is called within callbacks
  21706. if (this._readableState) {
  21707. this._readableState.destroyed = true;
  21708. }
  21709. // if this is a duplex stream mark the writable part as destroyed as well
  21710. if (this._writableState) {
  21711. this._writableState.destroyed = true;
  21712. }
  21713. this._destroy(err || null, function (err) {
  21714. if (!cb && err) {
  21715. pna.nextTick(emitErrorNT, _this, err);
  21716. if (_this._writableState) {
  21717. _this._writableState.errorEmitted = true;
  21718. }
  21719. } else if (cb) {
  21720. cb(err);
  21721. }
  21722. });
  21723. return this;
  21724. }
  21725. function undestroy() {
  21726. if (this._readableState) {
  21727. this._readableState.destroyed = false;
  21728. this._readableState.reading = false;
  21729. this._readableState.ended = false;
  21730. this._readableState.endEmitted = false;
  21731. }
  21732. if (this._writableState) {
  21733. this._writableState.destroyed = false;
  21734. this._writableState.ended = false;
  21735. this._writableState.ending = false;
  21736. this._writableState.finished = false;
  21737. this._writableState.errorEmitted = false;
  21738. }
  21739. }
  21740. function emitErrorNT(self, err) {
  21741. self.emit('error', err);
  21742. }
  21743. module.exports = {
  21744. destroy: destroy,
  21745. undestroy: undestroy
  21746. };
  21747. },{"process-nextick-args":323}],337:[function(require,module,exports){
  21748. module.exports = require('events').EventEmitter;
  21749. },{"events":301}],338:[function(require,module,exports){
  21750. module.exports = require('./readable').PassThrough
  21751. },{"./readable":339}],339:[function(require,module,exports){
  21752. exports = module.exports = require('./lib/_stream_readable.js');
  21753. exports.Stream = exports;
  21754. exports.Readable = exports;
  21755. exports.Writable = require('./lib/_stream_writable.js');
  21756. exports.Duplex = require('./lib/_stream_duplex.js');
  21757. exports.Transform = require('./lib/_stream_transform.js');
  21758. exports.PassThrough = require('./lib/_stream_passthrough.js');
  21759. },{"./lib/_stream_duplex.js":330,"./lib/_stream_passthrough.js":331,"./lib/_stream_readable.js":332,"./lib/_stream_transform.js":333,"./lib/_stream_writable.js":334}],340:[function(require,module,exports){
  21760. module.exports = require('./readable').Transform
  21761. },{"./readable":339}],341:[function(require,module,exports){
  21762. module.exports = require('./lib/_stream_writable.js');
  21763. },{"./lib/_stream_writable.js":334}],342:[function(require,module,exports){
  21764. /**
  21765. * Copyright (c) 2014-present, Facebook, Inc.
  21766. *
  21767. * This source code is licensed under the MIT license found in the
  21768. * LICENSE file in the root directory of this source tree.
  21769. */
  21770. var runtime = (function (exports) {
  21771. "use strict";
  21772. var Op = Object.prototype;
  21773. var hasOwn = Op.hasOwnProperty;
  21774. var undefined; // More compressible than void 0.
  21775. var $Symbol = typeof Symbol === "function" ? Symbol : {};
  21776. var iteratorSymbol = $Symbol.iterator || "@@iterator";
  21777. var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator";
  21778. var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
  21779. function define(obj, key, value) {
  21780. Object.defineProperty(obj, key, {
  21781. value: value,
  21782. enumerable: true,
  21783. configurable: true,
  21784. writable: true
  21785. });
  21786. return obj[key];
  21787. }
  21788. try {
  21789. // IE 8 has a broken Object.defineProperty that only works on DOM objects.
  21790. define({}, "");
  21791. } catch (err) {
  21792. define = function(obj, key, value) {
  21793. return obj[key] = value;
  21794. };
  21795. }
  21796. function wrap(innerFn, outerFn, self, tryLocsList) {
  21797. // If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator.
  21798. var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;
  21799. var generator = Object.create(protoGenerator.prototype);
  21800. var context = new Context(tryLocsList || []);
  21801. // The ._invoke method unifies the implementations of the .next,
  21802. // .throw, and .return methods.
  21803. generator._invoke = makeInvokeMethod(innerFn, self, context);
  21804. return generator;
  21805. }
  21806. exports.wrap = wrap;
  21807. // Try/catch helper to minimize deoptimizations. Returns a completion
  21808. // record like context.tryEntries[i].completion. This interface could
  21809. // have been (and was previously) designed to take a closure to be
  21810. // invoked without arguments, but in all the cases we care about we
  21811. // already have an existing method we want to call, so there's no need
  21812. // to create a new function object. We can even get away with assuming
  21813. // the method takes exactly one argument, since that happens to be true
  21814. // in every case, so we don't have to touch the arguments object. The
  21815. // only additional allocation required is the completion record, which
  21816. // has a stable shape and so hopefully should be cheap to allocate.
  21817. function tryCatch(fn, obj, arg) {
  21818. try {
  21819. return { type: "normal", arg: fn.call(obj, arg) };
  21820. } catch (err) {
  21821. return { type: "throw", arg: err };
  21822. }
  21823. }
  21824. var GenStateSuspendedStart = "suspendedStart";
  21825. var GenStateSuspendedYield = "suspendedYield";
  21826. var GenStateExecuting = "executing";
  21827. var GenStateCompleted = "completed";
  21828. // Returning this object from the innerFn has the same effect as
  21829. // breaking out of the dispatch switch statement.
  21830. var ContinueSentinel = {};
  21831. // Dummy constructor functions that we use as the .constructor and
  21832. // .constructor.prototype properties for functions that return Generator
  21833. // objects. For full spec compliance, you may wish to configure your
  21834. // minifier not to mangle the names of these two functions.
  21835. function Generator() {}
  21836. function GeneratorFunction() {}
  21837. function GeneratorFunctionPrototype() {}
  21838. // This is a polyfill for %IteratorPrototype% for environments that
  21839. // don't natively support it.
  21840. var IteratorPrototype = {};
  21841. define(IteratorPrototype, iteratorSymbol, function () {
  21842. return this;
  21843. });
  21844. var getProto = Object.getPrototypeOf;
  21845. var NativeIteratorPrototype = getProto && getProto(getProto(values([])));
  21846. if (NativeIteratorPrototype &&
  21847. NativeIteratorPrototype !== Op &&
  21848. hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {
  21849. // This environment has a native %IteratorPrototype%; use it instead
  21850. // of the polyfill.
  21851. IteratorPrototype = NativeIteratorPrototype;
  21852. }
  21853. var Gp = GeneratorFunctionPrototype.prototype =
  21854. Generator.prototype = Object.create(IteratorPrototype);
  21855. GeneratorFunction.prototype = GeneratorFunctionPrototype;
  21856. define(Gp, "constructor", GeneratorFunctionPrototype);
  21857. define(GeneratorFunctionPrototype, "constructor", GeneratorFunction);
  21858. GeneratorFunction.displayName = define(
  21859. GeneratorFunctionPrototype,
  21860. toStringTagSymbol,
  21861. "GeneratorFunction"
  21862. );
  21863. // Helper for defining the .next, .throw, and .return methods of the
  21864. // Iterator interface in terms of a single ._invoke method.
  21865. function defineIteratorMethods(prototype) {
  21866. ["next", "throw", "return"].forEach(function(method) {
  21867. define(prototype, method, function(arg) {
  21868. return this._invoke(method, arg);
  21869. });
  21870. });
  21871. }
  21872. exports.isGeneratorFunction = function(genFun) {
  21873. var ctor = typeof genFun === "function" && genFun.constructor;
  21874. return ctor
  21875. ? ctor === GeneratorFunction ||
  21876. // For the native GeneratorFunction constructor, the best we can
  21877. // do is to check its .name property.
  21878. (ctor.displayName || ctor.name) === "GeneratorFunction"
  21879. : false;
  21880. };
  21881. exports.mark = function(genFun) {
  21882. if (Object.setPrototypeOf) {
  21883. Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);
  21884. } else {
  21885. genFun.__proto__ = GeneratorFunctionPrototype;
  21886. define(genFun, toStringTagSymbol, "GeneratorFunction");
  21887. }
  21888. genFun.prototype = Object.create(Gp);
  21889. return genFun;
  21890. };
  21891. // Within the body of any async function, `await x` is transformed to
  21892. // `yield regeneratorRuntime.awrap(x)`, so that the runtime can test
  21893. // `hasOwn.call(value, "__await")` to determine if the yielded value is
  21894. // meant to be awaited.
  21895. exports.awrap = function(arg) {
  21896. return { __await: arg };
  21897. };
  21898. function AsyncIterator(generator, PromiseImpl) {
  21899. function invoke(method, arg, resolve, reject) {
  21900. var record = tryCatch(generator[method], generator, arg);
  21901. if (record.type === "throw") {
  21902. reject(record.arg);
  21903. } else {
  21904. var result = record.arg;
  21905. var value = result.value;
  21906. if (value &&
  21907. typeof value === "object" &&
  21908. hasOwn.call(value, "__await")) {
  21909. return PromiseImpl.resolve(value.__await).then(function(value) {
  21910. invoke("next", value, resolve, reject);
  21911. }, function(err) {
  21912. invoke("throw", err, resolve, reject);
  21913. });
  21914. }
  21915. return PromiseImpl.resolve(value).then(function(unwrapped) {
  21916. // When a yielded Promise is resolved, its final value becomes
  21917. // the .value of the Promise<{value,done}> result for the
  21918. // current iteration.
  21919. result.value = unwrapped;
  21920. resolve(result);
  21921. }, function(error) {
  21922. // If a rejected Promise was yielded, throw the rejection back
  21923. // into the async generator function so it can be handled there.
  21924. return invoke("throw", error, resolve, reject);
  21925. });
  21926. }
  21927. }
  21928. var previousPromise;
  21929. function enqueue(method, arg) {
  21930. function callInvokeWithMethodAndArg() {
  21931. return new PromiseImpl(function(resolve, reject) {
  21932. invoke(method, arg, resolve, reject);
  21933. });
  21934. }
  21935. return previousPromise =
  21936. // If enqueue has been called before, then we want to wait until
  21937. // all previous Promises have been resolved before calling invoke,
  21938. // so that results are always delivered in the correct order. If
  21939. // enqueue has not been called before, then it is important to
  21940. // call invoke immediately, without waiting on a callback to fire,
  21941. // so that the async generator function has the opportunity to do
  21942. // any necessary setup in a predictable way. This predictability
  21943. // is why the Promise constructor synchronously invokes its
  21944. // executor callback, and why async functions synchronously
  21945. // execute code before the first await. Since we implement simple
  21946. // async functions in terms of async generators, it is especially
  21947. // important to get this right, even though it requires care.
  21948. previousPromise ? previousPromise.then(
  21949. callInvokeWithMethodAndArg,
  21950. // Avoid propagating failures to Promises returned by later
  21951. // invocations of the iterator.
  21952. callInvokeWithMethodAndArg
  21953. ) : callInvokeWithMethodAndArg();
  21954. }
  21955. // Define the unified helper method that is used to implement .next,
  21956. // .throw, and .return (see defineIteratorMethods).
  21957. this._invoke = enqueue;
  21958. }
  21959. defineIteratorMethods(AsyncIterator.prototype);
  21960. define(AsyncIterator.prototype, asyncIteratorSymbol, function () {
  21961. return this;
  21962. });
  21963. exports.AsyncIterator = AsyncIterator;
  21964. // Note that simple async functions are implemented on top of
  21965. // AsyncIterator objects; they just return a Promise for the value of
  21966. // the final result produced by the iterator.
  21967. exports.async = function(innerFn, outerFn, self, tryLocsList, PromiseImpl) {
  21968. if (PromiseImpl === void 0) PromiseImpl = Promise;
  21969. var iter = new AsyncIterator(
  21970. wrap(innerFn, outerFn, self, tryLocsList),
  21971. PromiseImpl
  21972. );
  21973. return exports.isGeneratorFunction(outerFn)
  21974. ? iter // If outerFn is a generator, return the full iterator.
  21975. : iter.next().then(function(result) {
  21976. return result.done ? result.value : iter.next();
  21977. });
  21978. };
  21979. function makeInvokeMethod(innerFn, self, context) {
  21980. var state = GenStateSuspendedStart;
  21981. return function invoke(method, arg) {
  21982. if (state === GenStateExecuting) {
  21983. throw new Error("Generator is already running");
  21984. }
  21985. if (state === GenStateCompleted) {
  21986. if (method === "throw") {
  21987. throw arg;
  21988. }
  21989. // Be forgiving, per 25.3.3.3.3 of the spec:
  21990. // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume
  21991. return doneResult();
  21992. }
  21993. context.method = method;
  21994. context.arg = arg;
  21995. while (true) {
  21996. var delegate = context.delegate;
  21997. if (delegate) {
  21998. var delegateResult = maybeInvokeDelegate(delegate, context);
  21999. if (delegateResult) {
  22000. if (delegateResult === ContinueSentinel) continue;
  22001. return delegateResult;
  22002. }
  22003. }
  22004. if (context.method === "next") {
  22005. // Setting context._sent for legacy support of Babel's
  22006. // function.sent implementation.
  22007. context.sent = context._sent = context.arg;
  22008. } else if (context.method === "throw") {
  22009. if (state === GenStateSuspendedStart) {
  22010. state = GenStateCompleted;
  22011. throw context.arg;
  22012. }
  22013. context.dispatchException(context.arg);
  22014. } else if (context.method === "return") {
  22015. context.abrupt("return", context.arg);
  22016. }
  22017. state = GenStateExecuting;
  22018. var record = tryCatch(innerFn, self, context);
  22019. if (record.type === "normal") {
  22020. // If an exception is thrown from innerFn, we leave state ===
  22021. // GenStateExecuting and loop back for another invocation.
  22022. state = context.done
  22023. ? GenStateCompleted
  22024. : GenStateSuspendedYield;
  22025. if (record.arg === ContinueSentinel) {
  22026. continue;
  22027. }
  22028. return {
  22029. value: record.arg,
  22030. done: context.done
  22031. };
  22032. } else if (record.type === "throw") {
  22033. state = GenStateCompleted;
  22034. // Dispatch the exception by looping back around to the
  22035. // context.dispatchException(context.arg) call above.
  22036. context.method = "throw";
  22037. context.arg = record.arg;
  22038. }
  22039. }
  22040. };
  22041. }
  22042. // Call delegate.iterator[context.method](context.arg) and handle the
  22043. // result, either by returning a { value, done } result from the
  22044. // delegate iterator, or by modifying context.method and context.arg,
  22045. // setting context.delegate to null, and returning the ContinueSentinel.
  22046. function maybeInvokeDelegate(delegate, context) {
  22047. var method = delegate.iterator[context.method];
  22048. if (method === undefined) {
  22049. // A .throw or .return when the delegate iterator has no .throw
  22050. // method always terminates the yield* loop.
  22051. context.delegate = null;
  22052. if (context.method === "throw") {
  22053. // Note: ["return"] must be used for ES3 parsing compatibility.
  22054. if (delegate.iterator["return"]) {
  22055. // If the delegate iterator has a return method, give it a
  22056. // chance to clean up.
  22057. context.method = "return";
  22058. context.arg = undefined;
  22059. maybeInvokeDelegate(delegate, context);
  22060. if (context.method === "throw") {
  22061. // If maybeInvokeDelegate(context) changed context.method from
  22062. // "return" to "throw", let that override the TypeError below.
  22063. return ContinueSentinel;
  22064. }
  22065. }
  22066. context.method = "throw";
  22067. context.arg = new TypeError(
  22068. "The iterator does not provide a 'throw' method");
  22069. }
  22070. return ContinueSentinel;
  22071. }
  22072. var record = tryCatch(method, delegate.iterator, context.arg);
  22073. if (record.type === "throw") {
  22074. context.method = "throw";
  22075. context.arg = record.arg;
  22076. context.delegate = null;
  22077. return ContinueSentinel;
  22078. }
  22079. var info = record.arg;
  22080. if (! info) {
  22081. context.method = "throw";
  22082. context.arg = new TypeError("iterator result is not an object");
  22083. context.delegate = null;
  22084. return ContinueSentinel;
  22085. }
  22086. if (info.done) {
  22087. // Assign the result of the finished delegate to the temporary
  22088. // variable specified by delegate.resultName (see delegateYield).
  22089. context[delegate.resultName] = info.value;
  22090. // Resume execution at the desired location (see delegateYield).
  22091. context.next = delegate.nextLoc;
  22092. // If context.method was "throw" but the delegate handled the
  22093. // exception, let the outer generator proceed normally. If
  22094. // context.method was "next", forget context.arg since it has been
  22095. // "consumed" by the delegate iterator. If context.method was
  22096. // "return", allow the original .return call to continue in the
  22097. // outer generator.
  22098. if (context.method !== "return") {
  22099. context.method = "next";
  22100. context.arg = undefined;
  22101. }
  22102. } else {
  22103. // Re-yield the result returned by the delegate method.
  22104. return info;
  22105. }
  22106. // The delegate iterator is finished, so forget it and continue with
  22107. // the outer generator.
  22108. context.delegate = null;
  22109. return ContinueSentinel;
  22110. }
  22111. // Define Generator.prototype.{next,throw,return} in terms of the
  22112. // unified ._invoke helper method.
  22113. defineIteratorMethods(Gp);
  22114. define(Gp, toStringTagSymbol, "Generator");
  22115. // A Generator should always return itself as the iterator object when the
  22116. // @@iterator function is called on it. Some browsers' implementations of the
  22117. // iterator prototype chain incorrectly implement this, causing the Generator
  22118. // object to not be returned from this call. This ensures that doesn't happen.
  22119. // See https://github.com/facebook/regenerator/issues/274 for more details.
  22120. define(Gp, iteratorSymbol, function() {
  22121. return this;
  22122. });
  22123. define(Gp, "toString", function() {
  22124. return "[object Generator]";
  22125. });
  22126. function pushTryEntry(locs) {
  22127. var entry = { tryLoc: locs[0] };
  22128. if (1 in locs) {
  22129. entry.catchLoc = locs[1];
  22130. }
  22131. if (2 in locs) {
  22132. entry.finallyLoc = locs[2];
  22133. entry.afterLoc = locs[3];
  22134. }
  22135. this.tryEntries.push(entry);
  22136. }
  22137. function resetTryEntry(entry) {
  22138. var record = entry.completion || {};
  22139. record.type = "normal";
  22140. delete record.arg;
  22141. entry.completion = record;
  22142. }
  22143. function Context(tryLocsList) {
  22144. // The root entry object (effectively a try statement without a catch
  22145. // or a finally block) gives us a place to store values thrown from
  22146. // locations where there is no enclosing try statement.
  22147. this.tryEntries = [{ tryLoc: "root" }];
  22148. tryLocsList.forEach(pushTryEntry, this);
  22149. this.reset(true);
  22150. }
  22151. exports.keys = function(object) {
  22152. var keys = [];
  22153. for (var key in object) {
  22154. keys.push(key);
  22155. }
  22156. keys.reverse();
  22157. // Rather than returning an object with a next method, we keep
  22158. // things simple and return the next function itself.
  22159. return function next() {
  22160. while (keys.length) {
  22161. var key = keys.pop();
  22162. if (key in object) {
  22163. next.value = key;
  22164. next.done = false;
  22165. return next;
  22166. }
  22167. }
  22168. // To avoid creating an additional object, we just hang the .value
  22169. // and .done properties off the next function object itself. This
  22170. // also ensures that the minifier will not anonymize the function.
  22171. next.done = true;
  22172. return next;
  22173. };
  22174. };
  22175. function values(iterable) {
  22176. if (iterable) {
  22177. var iteratorMethod = iterable[iteratorSymbol];
  22178. if (iteratorMethod) {
  22179. return iteratorMethod.call(iterable);
  22180. }
  22181. if (typeof iterable.next === "function") {
  22182. return iterable;
  22183. }
  22184. if (!isNaN(iterable.length)) {
  22185. var i = -1, next = function next() {
  22186. while (++i < iterable.length) {
  22187. if (hasOwn.call(iterable, i)) {
  22188. next.value = iterable[i];
  22189. next.done = false;
  22190. return next;
  22191. }
  22192. }
  22193. next.value = undefined;
  22194. next.done = true;
  22195. return next;
  22196. };
  22197. return next.next = next;
  22198. }
  22199. }
  22200. // Return an iterator with no values.
  22201. return { next: doneResult };
  22202. }
  22203. exports.values = values;
  22204. function doneResult() {
  22205. return { value: undefined, done: true };
  22206. }
  22207. Context.prototype = {
  22208. constructor: Context,
  22209. reset: function(skipTempReset) {
  22210. this.prev = 0;
  22211. this.next = 0;
  22212. // Resetting context._sent for legacy support of Babel's
  22213. // function.sent implementation.
  22214. this.sent = this._sent = undefined;
  22215. this.done = false;
  22216. this.delegate = null;
  22217. this.method = "next";
  22218. this.arg = undefined;
  22219. this.tryEntries.forEach(resetTryEntry);
  22220. if (!skipTempReset) {
  22221. for (var name in this) {
  22222. // Not sure about the optimal order of these conditions:
  22223. if (name.charAt(0) === "t" &&
  22224. hasOwn.call(this, name) &&
  22225. !isNaN(+name.slice(1))) {
  22226. this[name] = undefined;
  22227. }
  22228. }
  22229. }
  22230. },
  22231. stop: function() {
  22232. this.done = true;
  22233. var rootEntry = this.tryEntries[0];
  22234. var rootRecord = rootEntry.completion;
  22235. if (rootRecord.type === "throw") {
  22236. throw rootRecord.arg;
  22237. }
  22238. return this.rval;
  22239. },
  22240. dispatchException: function(exception) {
  22241. if (this.done) {
  22242. throw exception;
  22243. }
  22244. var context = this;
  22245. function handle(loc, caught) {
  22246. record.type = "throw";
  22247. record.arg = exception;
  22248. context.next = loc;
  22249. if (caught) {
  22250. // If the dispatched exception was caught by a catch block,
  22251. // then let that catch block handle the exception normally.
  22252. context.method = "next";
  22253. context.arg = undefined;
  22254. }
  22255. return !! caught;
  22256. }
  22257. for (var i = this.tryEntries.length - 1; i >= 0; --i) {
  22258. var entry = this.tryEntries[i];
  22259. var record = entry.completion;
  22260. if (entry.tryLoc === "root") {
  22261. // Exception thrown outside of any try block that could handle
  22262. // it, so set the completion value of the entire function to
  22263. // throw the exception.
  22264. return handle("end");
  22265. }
  22266. if (entry.tryLoc <= this.prev) {
  22267. var hasCatch = hasOwn.call(entry, "catchLoc");
  22268. var hasFinally = hasOwn.call(entry, "finallyLoc");
  22269. if (hasCatch && hasFinally) {
  22270. if (this.prev < entry.catchLoc) {
  22271. return handle(entry.catchLoc, true);
  22272. } else if (this.prev < entry.finallyLoc) {
  22273. return handle(entry.finallyLoc);
  22274. }
  22275. } else if (hasCatch) {
  22276. if (this.prev < entry.catchLoc) {
  22277. return handle(entry.catchLoc, true);
  22278. }
  22279. } else if (hasFinally) {
  22280. if (this.prev < entry.finallyLoc) {
  22281. return handle(entry.finallyLoc);
  22282. }
  22283. } else {
  22284. throw new Error("try statement without catch or finally");
  22285. }
  22286. }
  22287. }
  22288. },
  22289. abrupt: function(type, arg) {
  22290. for (var i = this.tryEntries.length - 1; i >= 0; --i) {
  22291. var entry = this.tryEntries[i];
  22292. if (entry.tryLoc <= this.prev &&
  22293. hasOwn.call(entry, "finallyLoc") &&
  22294. this.prev < entry.finallyLoc) {
  22295. var finallyEntry = entry;
  22296. break;
  22297. }
  22298. }
  22299. if (finallyEntry &&
  22300. (type === "break" ||
  22301. type === "continue") &&
  22302. finallyEntry.tryLoc <= arg &&
  22303. arg <= finallyEntry.finallyLoc) {
  22304. // Ignore the finally entry if control is not jumping to a
  22305. // location outside the try/catch block.
  22306. finallyEntry = null;
  22307. }
  22308. var record = finallyEntry ? finallyEntry.completion : {};
  22309. record.type = type;
  22310. record.arg = arg;
  22311. if (finallyEntry) {
  22312. this.method = "next";
  22313. this.next = finallyEntry.finallyLoc;
  22314. return ContinueSentinel;
  22315. }
  22316. return this.complete(record);
  22317. },
  22318. complete: function(record, afterLoc) {
  22319. if (record.type === "throw") {
  22320. throw record.arg;
  22321. }
  22322. if (record.type === "break" ||
  22323. record.type === "continue") {
  22324. this.next = record.arg;
  22325. } else if (record.type === "return") {
  22326. this.rval = this.arg = record.arg;
  22327. this.method = "return";
  22328. this.next = "end";
  22329. } else if (record.type === "normal" && afterLoc) {
  22330. this.next = afterLoc;
  22331. }
  22332. return ContinueSentinel;
  22333. },
  22334. finish: function(finallyLoc) {
  22335. for (var i = this.tryEntries.length - 1; i >= 0; --i) {
  22336. var entry = this.tryEntries[i];
  22337. if (entry.finallyLoc === finallyLoc) {
  22338. this.complete(entry.completion, entry.afterLoc);
  22339. resetTryEntry(entry);
  22340. return ContinueSentinel;
  22341. }
  22342. }
  22343. },
  22344. "catch": function(tryLoc) {
  22345. for (var i = this.tryEntries.length - 1; i >= 0; --i) {
  22346. var entry = this.tryEntries[i];
  22347. if (entry.tryLoc === tryLoc) {
  22348. var record = entry.completion;
  22349. if (record.type === "throw") {
  22350. var thrown = record.arg;
  22351. resetTryEntry(entry);
  22352. }
  22353. return thrown;
  22354. }
  22355. }
  22356. // The context.catch method must only be called with a location
  22357. // argument that corresponds to a known catch block.
  22358. throw new Error("illegal catch attempt");
  22359. },
  22360. delegateYield: function(iterable, resultName, nextLoc) {
  22361. this.delegate = {
  22362. iterator: values(iterable),
  22363. resultName: resultName,
  22364. nextLoc: nextLoc
  22365. };
  22366. if (this.method === "next") {
  22367. // Deliberately forget the last sent value so that we don't
  22368. // accidentally pass it on to the delegate.
  22369. this.arg = undefined;
  22370. }
  22371. return ContinueSentinel;
  22372. }
  22373. };
  22374. // Regardless of whether this script is executing as a CommonJS module
  22375. // or not, return the runtime object so that we can declare the variable
  22376. // regeneratorRuntime in the outer scope, which allows this module to be
  22377. // injected easily by `bin/regenerator --include-runtime script.js`.
  22378. return exports;
  22379. }(
  22380. // If this script is executing as a CommonJS module, use module.exports
  22381. // as the regeneratorRuntime namespace. Otherwise create a new empty
  22382. // object. Either way, the resulting object will be used to initialize
  22383. // the regeneratorRuntime variable at the top of this file.
  22384. typeof module === "object" ? module.exports : {}
  22385. ));
  22386. try {
  22387. regeneratorRuntime = runtime;
  22388. } catch (accidentalStrictMode) {
  22389. // This module should not be running in strict mode, so the above
  22390. // assignment should always work unless something is misconfigured. Just
  22391. // in case runtime.js accidentally runs in strict mode, in modern engines
  22392. // we can explicitly access globalThis. In older engines we can escape
  22393. // strict mode using a global Function call. This could conceivably fail
  22394. // if a Content Security Policy forbids using Function, but in that case
  22395. // the proper solution is to fix the accidental strict mode problem. If
  22396. // you've misconfigured your bundler to force strict mode and applied a
  22397. // CSP to forbid Function, and you're not willing to fix either of those
  22398. // problems, please detail your unique predicament in a GitHub issue.
  22399. if (typeof globalThis === "object") {
  22400. globalThis.regeneratorRuntime = runtime;
  22401. } else {
  22402. Function("r", "regeneratorRuntime = r")(runtime);
  22403. }
  22404. }
  22405. },{}],343:[function(require,module,exports){
  22406. /* eslint-disable node/no-deprecated-api */
  22407. var buffer = require('buffer')
  22408. var Buffer = buffer.Buffer
  22409. // alternative to using Object.keys for old browsers
  22410. function copyProps (src, dst) {
  22411. for (var key in src) {
  22412. dst[key] = src[key]
  22413. }
  22414. }
  22415. if (Buffer.from && Buffer.alloc && Buffer.allocUnsafe && Buffer.allocUnsafeSlow) {
  22416. module.exports = buffer
  22417. } else {
  22418. // Copy properties from require('buffer')
  22419. copyProps(buffer, exports)
  22420. exports.Buffer = SafeBuffer
  22421. }
  22422. function SafeBuffer (arg, encodingOrOffset, length) {
  22423. return Buffer(arg, encodingOrOffset, length)
  22424. }
  22425. // Copy static methods from Buffer
  22426. copyProps(Buffer, SafeBuffer)
  22427. SafeBuffer.from = function (arg, encodingOrOffset, length) {
  22428. if (typeof arg === 'number') {
  22429. throw new TypeError('Argument must not be a number')
  22430. }
  22431. return Buffer(arg, encodingOrOffset, length)
  22432. }
  22433. SafeBuffer.alloc = function (size, fill, encoding) {
  22434. if (typeof size !== 'number') {
  22435. throw new TypeError('Argument must be a number')
  22436. }
  22437. var buf = Buffer(size)
  22438. if (fill !== undefined) {
  22439. if (typeof encoding === 'string') {
  22440. buf.fill(fill, encoding)
  22441. } else {
  22442. buf.fill(fill)
  22443. }
  22444. } else {
  22445. buf.fill(0)
  22446. }
  22447. return buf
  22448. }
  22449. SafeBuffer.allocUnsafe = function (size) {
  22450. if (typeof size !== 'number') {
  22451. throw new TypeError('Argument must be a number')
  22452. }
  22453. return Buffer(size)
  22454. }
  22455. SafeBuffer.allocUnsafeSlow = function (size) {
  22456. if (typeof size !== 'number') {
  22457. throw new TypeError('Argument must be a number')
  22458. }
  22459. return buffer.SlowBuffer(size)
  22460. }
  22461. },{"buffer":85}],344:[function(require,module,exports){
  22462. (function (Buffer){(function (){
  22463. ;(function (sax) { // wrapper for non-node envs
  22464. sax.parser = function (strict, opt) { return new SAXParser(strict, opt) }
  22465. sax.SAXParser = SAXParser
  22466. sax.SAXStream = SAXStream
  22467. sax.createStream = createStream
  22468. // When we pass the MAX_BUFFER_LENGTH position, start checking for buffer overruns.
  22469. // When we check, schedule the next check for MAX_BUFFER_LENGTH - (max(buffer lengths)),
  22470. // since that's the earliest that a buffer overrun could occur. This way, checks are
  22471. // as rare as required, but as often as necessary to ensure never crossing this bound.
  22472. // Furthermore, buffers are only tested at most once per write(), so passing a very
  22473. // large string into write() might have undesirable effects, but this is manageable by
  22474. // the caller, so it is assumed to be safe. Thus, a call to write() may, in the extreme
  22475. // edge case, result in creating at most one complete copy of the string passed in.
  22476. // Set to Infinity to have unlimited buffers.
  22477. sax.MAX_BUFFER_LENGTH = 64 * 1024
  22478. var buffers = [
  22479. 'comment', 'sgmlDecl', 'textNode', 'tagName', 'doctype',
  22480. 'procInstName', 'procInstBody', 'entity', 'attribName',
  22481. 'attribValue', 'cdata', 'script'
  22482. ]
  22483. sax.EVENTS = [
  22484. 'text',
  22485. 'processinginstruction',
  22486. 'sgmldeclaration',
  22487. 'doctype',
  22488. 'comment',
  22489. 'opentagstart',
  22490. 'attribute',
  22491. 'opentag',
  22492. 'closetag',
  22493. 'opencdata',
  22494. 'cdata',
  22495. 'closecdata',
  22496. 'error',
  22497. 'end',
  22498. 'ready',
  22499. 'script',
  22500. 'opennamespace',
  22501. 'closenamespace'
  22502. ]
  22503. function SAXParser (strict, opt) {
  22504. if (!(this instanceof SAXParser)) {
  22505. return new SAXParser(strict, opt)
  22506. }
  22507. var parser = this
  22508. clearBuffers(parser)
  22509. parser.q = parser.c = ''
  22510. parser.bufferCheckPosition = sax.MAX_BUFFER_LENGTH
  22511. parser.opt = opt || {}
  22512. parser.opt.lowercase = parser.opt.lowercase || parser.opt.lowercasetags
  22513. parser.looseCase = parser.opt.lowercase ? 'toLowerCase' : 'toUpperCase'
  22514. parser.tags = []
  22515. parser.closed = parser.closedRoot = parser.sawRoot = false
  22516. parser.tag = parser.error = null
  22517. parser.strict = !!strict
  22518. parser.noscript = !!(strict || parser.opt.noscript)
  22519. parser.state = S.BEGIN
  22520. parser.strictEntities = parser.opt.strictEntities
  22521. parser.ENTITIES = parser.strictEntities ? Object.create(sax.XML_ENTITIES) : Object.create(sax.ENTITIES)
  22522. parser.attribList = []
  22523. // namespaces form a prototype chain.
  22524. // it always points at the current tag,
  22525. // which protos to its parent tag.
  22526. if (parser.opt.xmlns) {
  22527. parser.ns = Object.create(rootNS)
  22528. }
  22529. // mostly just for error reporting
  22530. parser.trackPosition = parser.opt.position !== false
  22531. if (parser.trackPosition) {
  22532. parser.position = parser.line = parser.column = 0
  22533. }
  22534. emit(parser, 'onready')
  22535. }
  22536. if (!Object.create) {
  22537. Object.create = function (o) {
  22538. function F () {}
  22539. F.prototype = o
  22540. var newf = new F()
  22541. return newf
  22542. }
  22543. }
  22544. if (!Object.keys) {
  22545. Object.keys = function (o) {
  22546. var a = []
  22547. for (var i in o) if (o.hasOwnProperty(i)) a.push(i)
  22548. return a
  22549. }
  22550. }
  22551. function checkBufferLength (parser) {
  22552. var maxAllowed = Math.max(sax.MAX_BUFFER_LENGTH, 10)
  22553. var maxActual = 0
  22554. for (var i = 0, l = buffers.length; i < l; i++) {
  22555. var len = parser[buffers[i]].length
  22556. if (len > maxAllowed) {
  22557. // Text/cdata nodes can get big, and since they're buffered,
  22558. // we can get here under normal conditions.
  22559. // Avoid issues by emitting the text node now,
  22560. // so at least it won't get any bigger.
  22561. switch (buffers[i]) {
  22562. case 'textNode':
  22563. closeText(parser)
  22564. break
  22565. case 'cdata':
  22566. emitNode(parser, 'oncdata', parser.cdata)
  22567. parser.cdata = ''
  22568. break
  22569. case 'script':
  22570. emitNode(parser, 'onscript', parser.script)
  22571. parser.script = ''
  22572. break
  22573. default:
  22574. error(parser, 'Max buffer length exceeded: ' + buffers[i])
  22575. }
  22576. }
  22577. maxActual = Math.max(maxActual, len)
  22578. }
  22579. // schedule the next check for the earliest possible buffer overrun.
  22580. var m = sax.MAX_BUFFER_LENGTH - maxActual
  22581. parser.bufferCheckPosition = m + parser.position
  22582. }
  22583. function clearBuffers (parser) {
  22584. for (var i = 0, l = buffers.length; i < l; i++) {
  22585. parser[buffers[i]] = ''
  22586. }
  22587. }
  22588. function flushBuffers (parser) {
  22589. closeText(parser)
  22590. if (parser.cdata !== '') {
  22591. emitNode(parser, 'oncdata', parser.cdata)
  22592. parser.cdata = ''
  22593. }
  22594. if (parser.script !== '') {
  22595. emitNode(parser, 'onscript', parser.script)
  22596. parser.script = ''
  22597. }
  22598. }
  22599. SAXParser.prototype = {
  22600. end: function () { end(this) },
  22601. write: write,
  22602. resume: function () { this.error = null; return this },
  22603. close: function () { return this.write(null) },
  22604. flush: function () { flushBuffers(this) }
  22605. }
  22606. var Stream
  22607. try {
  22608. Stream = require('stream').Stream
  22609. } catch (ex) {
  22610. Stream = function () {}
  22611. }
  22612. var streamWraps = sax.EVENTS.filter(function (ev) {
  22613. return ev !== 'error' && ev !== 'end'
  22614. })
  22615. function createStream (strict, opt) {
  22616. return new SAXStream(strict, opt)
  22617. }
  22618. function SAXStream (strict, opt) {
  22619. if (!(this instanceof SAXStream)) {
  22620. return new SAXStream(strict, opt)
  22621. }
  22622. Stream.apply(this)
  22623. this._parser = new SAXParser(strict, opt)
  22624. this.writable = true
  22625. this.readable = true
  22626. var me = this
  22627. this._parser.onend = function () {
  22628. me.emit('end')
  22629. }
  22630. this._parser.onerror = function (er) {
  22631. me.emit('error', er)
  22632. // if didn't throw, then means error was handled.
  22633. // go ahead and clear error, so we can write again.
  22634. me._parser.error = null
  22635. }
  22636. this._decoder = null
  22637. streamWraps.forEach(function (ev) {
  22638. Object.defineProperty(me, 'on' + ev, {
  22639. get: function () {
  22640. return me._parser['on' + ev]
  22641. },
  22642. set: function (h) {
  22643. if (!h) {
  22644. me.removeAllListeners(ev)
  22645. me._parser['on' + ev] = h
  22646. return h
  22647. }
  22648. me.on(ev, h)
  22649. },
  22650. enumerable: true,
  22651. configurable: false
  22652. })
  22653. })
  22654. }
  22655. SAXStream.prototype = Object.create(Stream.prototype, {
  22656. constructor: {
  22657. value: SAXStream
  22658. }
  22659. })
  22660. SAXStream.prototype.write = function (data) {
  22661. if (typeof Buffer === 'function' &&
  22662. typeof Buffer.isBuffer === 'function' &&
  22663. Buffer.isBuffer(data)) {
  22664. if (!this._decoder) {
  22665. var SD = require('string_decoder').StringDecoder
  22666. this._decoder = new SD('utf8')
  22667. }
  22668. data = this._decoder.write(data)
  22669. }
  22670. this._parser.write(data.toString())
  22671. this.emit('data', data)
  22672. return true
  22673. }
  22674. SAXStream.prototype.end = function (chunk) {
  22675. if (chunk && chunk.length) {
  22676. this.write(chunk)
  22677. }
  22678. this._parser.end()
  22679. return true
  22680. }
  22681. SAXStream.prototype.on = function (ev, handler) {
  22682. var me = this
  22683. if (!me._parser['on' + ev] && streamWraps.indexOf(ev) !== -1) {
  22684. me._parser['on' + ev] = function () {
  22685. var args = arguments.length === 1 ? [arguments[0]] : Array.apply(null, arguments)
  22686. args.splice(0, 0, ev)
  22687. me.emit.apply(me, args)
  22688. }
  22689. }
  22690. return Stream.prototype.on.call(me, ev, handler)
  22691. }
  22692. // this really needs to be replaced with character classes.
  22693. // XML allows all manner of ridiculous numbers and digits.
  22694. var CDATA = '[CDATA['
  22695. var DOCTYPE = 'DOCTYPE'
  22696. var XML_NAMESPACE = 'http://www.w3.org/XML/1998/namespace'
  22697. var XMLNS_NAMESPACE = 'http://www.w3.org/2000/xmlns/'
  22698. var rootNS = { xml: XML_NAMESPACE, xmlns: XMLNS_NAMESPACE }
  22699. // http://www.w3.org/TR/REC-xml/#NT-NameStartChar
  22700. // This implementation works on strings, a single character at a time
  22701. // as such, it cannot ever support astral-plane characters (10000-EFFFF)
  22702. // without a significant breaking change to either this parser, or the
  22703. // JavaScript language. Implementation of an emoji-capable xml parser
  22704. // is left as an exercise for the reader.
  22705. var nameStart = /[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/
  22706. var nameBody = /[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040.\d-]/
  22707. var entityStart = /[#:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/
  22708. var entityBody = /[#:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040.\d-]/
  22709. function isWhitespace (c) {
  22710. return c === ' ' || c === '\n' || c === '\r' || c === '\t'
  22711. }
  22712. function isQuote (c) {
  22713. return c === '"' || c === '\''
  22714. }
  22715. function isAttribEnd (c) {
  22716. return c === '>' || isWhitespace(c)
  22717. }
  22718. function isMatch (regex, c) {
  22719. return regex.test(c)
  22720. }
  22721. function notMatch (regex, c) {
  22722. return !isMatch(regex, c)
  22723. }
  22724. var S = 0
  22725. sax.STATE = {
  22726. BEGIN: S++, // leading byte order mark or whitespace
  22727. BEGIN_WHITESPACE: S++, // leading whitespace
  22728. TEXT: S++, // general stuff
  22729. TEXT_ENTITY: S++, // &amp and such.
  22730. OPEN_WAKA: S++, // <
  22731. SGML_DECL: S++, // <!BLARG
  22732. SGML_DECL_QUOTED: S++, // <!BLARG foo "bar
  22733. DOCTYPE: S++, // <!DOCTYPE
  22734. DOCTYPE_QUOTED: S++, // <!DOCTYPE "//blah
  22735. DOCTYPE_DTD: S++, // <!DOCTYPE "//blah" [ ...
  22736. DOCTYPE_DTD_QUOTED: S++, // <!DOCTYPE "//blah" [ "foo
  22737. COMMENT_STARTING: S++, // <!-
  22738. COMMENT: S++, // <!--
  22739. COMMENT_ENDING: S++, // <!-- blah -
  22740. COMMENT_ENDED: S++, // <!-- blah --
  22741. CDATA: S++, // <![CDATA[ something
  22742. CDATA_ENDING: S++, // ]
  22743. CDATA_ENDING_2: S++, // ]]
  22744. PROC_INST: S++, // <?hi
  22745. PROC_INST_BODY: S++, // <?hi there
  22746. PROC_INST_ENDING: S++, // <?hi "there" ?
  22747. OPEN_TAG: S++, // <strong
  22748. OPEN_TAG_SLASH: S++, // <strong /
  22749. ATTRIB: S++, // <a
  22750. ATTRIB_NAME: S++, // <a foo
  22751. ATTRIB_NAME_SAW_WHITE: S++, // <a foo _
  22752. ATTRIB_VALUE: S++, // <a foo=
  22753. ATTRIB_VALUE_QUOTED: S++, // <a foo="bar
  22754. ATTRIB_VALUE_CLOSED: S++, // <a foo="bar"
  22755. ATTRIB_VALUE_UNQUOTED: S++, // <a foo=bar
  22756. ATTRIB_VALUE_ENTITY_Q: S++, // <foo bar="&quot;"
  22757. ATTRIB_VALUE_ENTITY_U: S++, // <foo bar=&quot
  22758. CLOSE_TAG: S++, // </a
  22759. CLOSE_TAG_SAW_WHITE: S++, // </a >
  22760. SCRIPT: S++, // <script> ...
  22761. SCRIPT_ENDING: S++ // <script> ... <
  22762. }
  22763. sax.XML_ENTITIES = {
  22764. 'amp': '&',
  22765. 'gt': '>',
  22766. 'lt': '<',
  22767. 'quot': '"',
  22768. 'apos': "'"
  22769. }
  22770. sax.ENTITIES = {
  22771. 'amp': '&',
  22772. 'gt': '>',
  22773. 'lt': '<',
  22774. 'quot': '"',
  22775. 'apos': "'",
  22776. 'AElig': 198,
  22777. 'Aacute': 193,
  22778. 'Acirc': 194,
  22779. 'Agrave': 192,
  22780. 'Aring': 197,
  22781. 'Atilde': 195,
  22782. 'Auml': 196,
  22783. 'Ccedil': 199,
  22784. 'ETH': 208,
  22785. 'Eacute': 201,
  22786. 'Ecirc': 202,
  22787. 'Egrave': 200,
  22788. 'Euml': 203,
  22789. 'Iacute': 205,
  22790. 'Icirc': 206,
  22791. 'Igrave': 204,
  22792. 'Iuml': 207,
  22793. 'Ntilde': 209,
  22794. 'Oacute': 211,
  22795. 'Ocirc': 212,
  22796. 'Ograve': 210,
  22797. 'Oslash': 216,
  22798. 'Otilde': 213,
  22799. 'Ouml': 214,
  22800. 'THORN': 222,
  22801. 'Uacute': 218,
  22802. 'Ucirc': 219,
  22803. 'Ugrave': 217,
  22804. 'Uuml': 220,
  22805. 'Yacute': 221,
  22806. 'aacute': 225,
  22807. 'acirc': 226,
  22808. 'aelig': 230,
  22809. 'agrave': 224,
  22810. 'aring': 229,
  22811. 'atilde': 227,
  22812. 'auml': 228,
  22813. 'ccedil': 231,
  22814. 'eacute': 233,
  22815. 'ecirc': 234,
  22816. 'egrave': 232,
  22817. 'eth': 240,
  22818. 'euml': 235,
  22819. 'iacute': 237,
  22820. 'icirc': 238,
  22821. 'igrave': 236,
  22822. 'iuml': 239,
  22823. 'ntilde': 241,
  22824. 'oacute': 243,
  22825. 'ocirc': 244,
  22826. 'ograve': 242,
  22827. 'oslash': 248,
  22828. 'otilde': 245,
  22829. 'ouml': 246,
  22830. 'szlig': 223,
  22831. 'thorn': 254,
  22832. 'uacute': 250,
  22833. 'ucirc': 251,
  22834. 'ugrave': 249,
  22835. 'uuml': 252,
  22836. 'yacute': 253,
  22837. 'yuml': 255,
  22838. 'copy': 169,
  22839. 'reg': 174,
  22840. 'nbsp': 160,
  22841. 'iexcl': 161,
  22842. 'cent': 162,
  22843. 'pound': 163,
  22844. 'curren': 164,
  22845. 'yen': 165,
  22846. 'brvbar': 166,
  22847. 'sect': 167,
  22848. 'uml': 168,
  22849. 'ordf': 170,
  22850. 'laquo': 171,
  22851. 'not': 172,
  22852. 'shy': 173,
  22853. 'macr': 175,
  22854. 'deg': 176,
  22855. 'plusmn': 177,
  22856. 'sup1': 185,
  22857. 'sup2': 178,
  22858. 'sup3': 179,
  22859. 'acute': 180,
  22860. 'micro': 181,
  22861. 'para': 182,
  22862. 'middot': 183,
  22863. 'cedil': 184,
  22864. 'ordm': 186,
  22865. 'raquo': 187,
  22866. 'frac14': 188,
  22867. 'frac12': 189,
  22868. 'frac34': 190,
  22869. 'iquest': 191,
  22870. 'times': 215,
  22871. 'divide': 247,
  22872. 'OElig': 338,
  22873. 'oelig': 339,
  22874. 'Scaron': 352,
  22875. 'scaron': 353,
  22876. 'Yuml': 376,
  22877. 'fnof': 402,
  22878. 'circ': 710,
  22879. 'tilde': 732,
  22880. 'Alpha': 913,
  22881. 'Beta': 914,
  22882. 'Gamma': 915,
  22883. 'Delta': 916,
  22884. 'Epsilon': 917,
  22885. 'Zeta': 918,
  22886. 'Eta': 919,
  22887. 'Theta': 920,
  22888. 'Iota': 921,
  22889. 'Kappa': 922,
  22890. 'Lambda': 923,
  22891. 'Mu': 924,
  22892. 'Nu': 925,
  22893. 'Xi': 926,
  22894. 'Omicron': 927,
  22895. 'Pi': 928,
  22896. 'Rho': 929,
  22897. 'Sigma': 931,
  22898. 'Tau': 932,
  22899. 'Upsilon': 933,
  22900. 'Phi': 934,
  22901. 'Chi': 935,
  22902. 'Psi': 936,
  22903. 'Omega': 937,
  22904. 'alpha': 945,
  22905. 'beta': 946,
  22906. 'gamma': 947,
  22907. 'delta': 948,
  22908. 'epsilon': 949,
  22909. 'zeta': 950,
  22910. 'eta': 951,
  22911. 'theta': 952,
  22912. 'iota': 953,
  22913. 'kappa': 954,
  22914. 'lambda': 955,
  22915. 'mu': 956,
  22916. 'nu': 957,
  22917. 'xi': 958,
  22918. 'omicron': 959,
  22919. 'pi': 960,
  22920. 'rho': 961,
  22921. 'sigmaf': 962,
  22922. 'sigma': 963,
  22923. 'tau': 964,
  22924. 'upsilon': 965,
  22925. 'phi': 966,
  22926. 'chi': 967,
  22927. 'psi': 968,
  22928. 'omega': 969,
  22929. 'thetasym': 977,
  22930. 'upsih': 978,
  22931. 'piv': 982,
  22932. 'ensp': 8194,
  22933. 'emsp': 8195,
  22934. 'thinsp': 8201,
  22935. 'zwnj': 8204,
  22936. 'zwj': 8205,
  22937. 'lrm': 8206,
  22938. 'rlm': 8207,
  22939. 'ndash': 8211,
  22940. 'mdash': 8212,
  22941. 'lsquo': 8216,
  22942. 'rsquo': 8217,
  22943. 'sbquo': 8218,
  22944. 'ldquo': 8220,
  22945. 'rdquo': 8221,
  22946. 'bdquo': 8222,
  22947. 'dagger': 8224,
  22948. 'Dagger': 8225,
  22949. 'bull': 8226,
  22950. 'hellip': 8230,
  22951. 'permil': 8240,
  22952. 'prime': 8242,
  22953. 'Prime': 8243,
  22954. 'lsaquo': 8249,
  22955. 'rsaquo': 8250,
  22956. 'oline': 8254,
  22957. 'frasl': 8260,
  22958. 'euro': 8364,
  22959. 'image': 8465,
  22960. 'weierp': 8472,
  22961. 'real': 8476,
  22962. 'trade': 8482,
  22963. 'alefsym': 8501,
  22964. 'larr': 8592,
  22965. 'uarr': 8593,
  22966. 'rarr': 8594,
  22967. 'darr': 8595,
  22968. 'harr': 8596,
  22969. 'crarr': 8629,
  22970. 'lArr': 8656,
  22971. 'uArr': 8657,
  22972. 'rArr': 8658,
  22973. 'dArr': 8659,
  22974. 'hArr': 8660,
  22975. 'forall': 8704,
  22976. 'part': 8706,
  22977. 'exist': 8707,
  22978. 'empty': 8709,
  22979. 'nabla': 8711,
  22980. 'isin': 8712,
  22981. 'notin': 8713,
  22982. 'ni': 8715,
  22983. 'prod': 8719,
  22984. 'sum': 8721,
  22985. 'minus': 8722,
  22986. 'lowast': 8727,
  22987. 'radic': 8730,
  22988. 'prop': 8733,
  22989. 'infin': 8734,
  22990. 'ang': 8736,
  22991. 'and': 8743,
  22992. 'or': 8744,
  22993. 'cap': 8745,
  22994. 'cup': 8746,
  22995. 'int': 8747,
  22996. 'there4': 8756,
  22997. 'sim': 8764,
  22998. 'cong': 8773,
  22999. 'asymp': 8776,
  23000. 'ne': 8800,
  23001. 'equiv': 8801,
  23002. 'le': 8804,
  23003. 'ge': 8805,
  23004. 'sub': 8834,
  23005. 'sup': 8835,
  23006. 'nsub': 8836,
  23007. 'sube': 8838,
  23008. 'supe': 8839,
  23009. 'oplus': 8853,
  23010. 'otimes': 8855,
  23011. 'perp': 8869,
  23012. 'sdot': 8901,
  23013. 'lceil': 8968,
  23014. 'rceil': 8969,
  23015. 'lfloor': 8970,
  23016. 'rfloor': 8971,
  23017. 'lang': 9001,
  23018. 'rang': 9002,
  23019. 'loz': 9674,
  23020. 'spades': 9824,
  23021. 'clubs': 9827,
  23022. 'hearts': 9829,
  23023. 'diams': 9830
  23024. }
  23025. Object.keys(sax.ENTITIES).forEach(function (key) {
  23026. var e = sax.ENTITIES[key]
  23027. var s = typeof e === 'number' ? String.fromCharCode(e) : e
  23028. sax.ENTITIES[key] = s
  23029. })
  23030. for (var s in sax.STATE) {
  23031. sax.STATE[sax.STATE[s]] = s
  23032. }
  23033. // shorthand
  23034. S = sax.STATE
  23035. function emit (parser, event, data) {
  23036. parser[event] && parser[event](data)
  23037. }
  23038. function emitNode (parser, nodeType, data) {
  23039. if (parser.textNode) closeText(parser)
  23040. emit(parser, nodeType, data)
  23041. }
  23042. function closeText (parser) {
  23043. parser.textNode = textopts(parser.opt, parser.textNode)
  23044. if (parser.textNode) emit(parser, 'ontext', parser.textNode)
  23045. parser.textNode = ''
  23046. }
  23047. function textopts (opt, text) {
  23048. if (opt.trim) text = text.trim()
  23049. if (opt.normalize) text = text.replace(/\s+/g, ' ')
  23050. return text
  23051. }
  23052. function error (parser, er) {
  23053. closeText(parser)
  23054. if (parser.trackPosition) {
  23055. er += '\nLine: ' + parser.line +
  23056. '\nColumn: ' + parser.column +
  23057. '\nChar: ' + parser.c
  23058. }
  23059. er = new Error(er)
  23060. parser.error = er
  23061. emit(parser, 'onerror', er)
  23062. return parser
  23063. }
  23064. function end (parser) {
  23065. if (parser.sawRoot && !parser.closedRoot) strictFail(parser, 'Unclosed root tag')
  23066. if ((parser.state !== S.BEGIN) &&
  23067. (parser.state !== S.BEGIN_WHITESPACE) &&
  23068. (parser.state !== S.TEXT)) {
  23069. error(parser, 'Unexpected end')
  23070. }
  23071. closeText(parser)
  23072. parser.c = ''
  23073. parser.closed = true
  23074. emit(parser, 'onend')
  23075. SAXParser.call(parser, parser.strict, parser.opt)
  23076. return parser
  23077. }
  23078. function strictFail (parser, message) {
  23079. if (typeof parser !== 'object' || !(parser instanceof SAXParser)) {
  23080. throw new Error('bad call to strictFail')
  23081. }
  23082. if (parser.strict) {
  23083. error(parser, message)
  23084. }
  23085. }
  23086. function newTag (parser) {
  23087. if (!parser.strict) parser.tagName = parser.tagName[parser.looseCase]()
  23088. var parent = parser.tags[parser.tags.length - 1] || parser
  23089. var tag = parser.tag = { name: parser.tagName, attributes: {} }
  23090. // will be overridden if tag contails an xmlns="foo" or xmlns:foo="bar"
  23091. if (parser.opt.xmlns) {
  23092. tag.ns = parent.ns
  23093. }
  23094. parser.attribList.length = 0
  23095. emitNode(parser, 'onopentagstart', tag)
  23096. }
  23097. function qname (name, attribute) {
  23098. var i = name.indexOf(':')
  23099. var qualName = i < 0 ? [ '', name ] : name.split(':')
  23100. var prefix = qualName[0]
  23101. var local = qualName[1]
  23102. // <x "xmlns"="http://foo">
  23103. if (attribute && name === 'xmlns') {
  23104. prefix = 'xmlns'
  23105. local = ''
  23106. }
  23107. return { prefix: prefix, local: local }
  23108. }
  23109. function attrib (parser) {
  23110. if (!parser.strict) {
  23111. parser.attribName = parser.attribName[parser.looseCase]()
  23112. }
  23113. if (parser.attribList.indexOf(parser.attribName) !== -1 ||
  23114. parser.tag.attributes.hasOwnProperty(parser.attribName)) {
  23115. parser.attribName = parser.attribValue = ''
  23116. return
  23117. }
  23118. if (parser.opt.xmlns) {
  23119. var qn = qname(parser.attribName, true)
  23120. var prefix = qn.prefix
  23121. var local = qn.local
  23122. if (prefix === 'xmlns') {
  23123. // namespace binding attribute. push the binding into scope
  23124. if (local === 'xml' && parser.attribValue !== XML_NAMESPACE) {
  23125. strictFail(parser,
  23126. 'xml: prefix must be bound to ' + XML_NAMESPACE + '\n' +
  23127. 'Actual: ' + parser.attribValue)
  23128. } else if (local === 'xmlns' && parser.attribValue !== XMLNS_NAMESPACE) {
  23129. strictFail(parser,
  23130. 'xmlns: prefix must be bound to ' + XMLNS_NAMESPACE + '\n' +
  23131. 'Actual: ' + parser.attribValue)
  23132. } else {
  23133. var tag = parser.tag
  23134. var parent = parser.tags[parser.tags.length - 1] || parser
  23135. if (tag.ns === parent.ns) {
  23136. tag.ns = Object.create(parent.ns)
  23137. }
  23138. tag.ns[local] = parser.attribValue
  23139. }
  23140. }
  23141. // defer onattribute events until all attributes have been seen
  23142. // so any new bindings can take effect. preserve attribute order
  23143. // so deferred events can be emitted in document order
  23144. parser.attribList.push([parser.attribName, parser.attribValue])
  23145. } else {
  23146. // in non-xmlns mode, we can emit the event right away
  23147. parser.tag.attributes[parser.attribName] = parser.attribValue
  23148. emitNode(parser, 'onattribute', {
  23149. name: parser.attribName,
  23150. value: parser.attribValue
  23151. })
  23152. }
  23153. parser.attribName = parser.attribValue = ''
  23154. }
  23155. function openTag (parser, selfClosing) {
  23156. if (parser.opt.xmlns) {
  23157. // emit namespace binding events
  23158. var tag = parser.tag
  23159. // add namespace info to tag
  23160. var qn = qname(parser.tagName)
  23161. tag.prefix = qn.prefix
  23162. tag.local = qn.local
  23163. tag.uri = tag.ns[qn.prefix] || ''
  23164. if (tag.prefix && !tag.uri) {
  23165. strictFail(parser, 'Unbound namespace prefix: ' +
  23166. JSON.stringify(parser.tagName))
  23167. tag.uri = qn.prefix
  23168. }
  23169. var parent = parser.tags[parser.tags.length - 1] || parser
  23170. if (tag.ns && parent.ns !== tag.ns) {
  23171. Object.keys(tag.ns).forEach(function (p) {
  23172. emitNode(parser, 'onopennamespace', {
  23173. prefix: p,
  23174. uri: tag.ns[p]
  23175. })
  23176. })
  23177. }
  23178. // handle deferred onattribute events
  23179. // Note: do not apply default ns to attributes:
  23180. // http://www.w3.org/TR/REC-xml-names/#defaulting
  23181. for (var i = 0, l = parser.attribList.length; i < l; i++) {
  23182. var nv = parser.attribList[i]
  23183. var name = nv[0]
  23184. var value = nv[1]
  23185. var qualName = qname(name, true)
  23186. var prefix = qualName.prefix
  23187. var local = qualName.local
  23188. var uri = prefix === '' ? '' : (tag.ns[prefix] || '')
  23189. var a = {
  23190. name: name,
  23191. value: value,
  23192. prefix: prefix,
  23193. local: local,
  23194. uri: uri
  23195. }
  23196. // if there's any attributes with an undefined namespace,
  23197. // then fail on them now.
  23198. if (prefix && prefix !== 'xmlns' && !uri) {
  23199. strictFail(parser, 'Unbound namespace prefix: ' +
  23200. JSON.stringify(prefix))
  23201. a.uri = prefix
  23202. }
  23203. parser.tag.attributes[name] = a
  23204. emitNode(parser, 'onattribute', a)
  23205. }
  23206. parser.attribList.length = 0
  23207. }
  23208. parser.tag.isSelfClosing = !!selfClosing
  23209. // process the tag
  23210. parser.sawRoot = true
  23211. parser.tags.push(parser.tag)
  23212. emitNode(parser, 'onopentag', parser.tag)
  23213. if (!selfClosing) {
  23214. // special case for <script> in non-strict mode.
  23215. if (!parser.noscript && parser.tagName.toLowerCase() === 'script') {
  23216. parser.state = S.SCRIPT
  23217. } else {
  23218. parser.state = S.TEXT
  23219. }
  23220. parser.tag = null
  23221. parser.tagName = ''
  23222. }
  23223. parser.attribName = parser.attribValue = ''
  23224. parser.attribList.length = 0
  23225. }
  23226. function closeTag (parser) {
  23227. if (!parser.tagName) {
  23228. strictFail(parser, 'Weird empty close tag.')
  23229. parser.textNode += '</>'
  23230. parser.state = S.TEXT
  23231. return
  23232. }
  23233. if (parser.script) {
  23234. if (parser.tagName !== 'script') {
  23235. parser.script += '</' + parser.tagName + '>'
  23236. parser.tagName = ''
  23237. parser.state = S.SCRIPT
  23238. return
  23239. }
  23240. emitNode(parser, 'onscript', parser.script)
  23241. parser.script = ''
  23242. }
  23243. // first make sure that the closing tag actually exists.
  23244. // <a><b></c></b></a> will close everything, otherwise.
  23245. var t = parser.tags.length
  23246. var tagName = parser.tagName
  23247. if (!parser.strict) {
  23248. tagName = tagName[parser.looseCase]()
  23249. }
  23250. var closeTo = tagName
  23251. while (t--) {
  23252. var close = parser.tags[t]
  23253. if (close.name !== closeTo) {
  23254. // fail the first time in strict mode
  23255. strictFail(parser, 'Unexpected close tag')
  23256. } else {
  23257. break
  23258. }
  23259. }
  23260. // didn't find it. we already failed for strict, so just abort.
  23261. if (t < 0) {
  23262. strictFail(parser, 'Unmatched closing tag: ' + parser.tagName)
  23263. parser.textNode += '</' + parser.tagName + '>'
  23264. parser.state = S.TEXT
  23265. return
  23266. }
  23267. parser.tagName = tagName
  23268. var s = parser.tags.length
  23269. while (s-- > t) {
  23270. var tag = parser.tag = parser.tags.pop()
  23271. parser.tagName = parser.tag.name
  23272. emitNode(parser, 'onclosetag', parser.tagName)
  23273. var x = {}
  23274. for (var i in tag.ns) {
  23275. x[i] = tag.ns[i]
  23276. }
  23277. var parent = parser.tags[parser.tags.length - 1] || parser
  23278. if (parser.opt.xmlns && tag.ns !== parent.ns) {
  23279. // remove namespace bindings introduced by tag
  23280. Object.keys(tag.ns).forEach(function (p) {
  23281. var n = tag.ns[p]
  23282. emitNode(parser, 'onclosenamespace', { prefix: p, uri: n })
  23283. })
  23284. }
  23285. }
  23286. if (t === 0) parser.closedRoot = true
  23287. parser.tagName = parser.attribValue = parser.attribName = ''
  23288. parser.attribList.length = 0
  23289. parser.state = S.TEXT
  23290. }
  23291. function parseEntity (parser) {
  23292. var entity = parser.entity
  23293. var entityLC = entity.toLowerCase()
  23294. var num
  23295. var numStr = ''
  23296. if (parser.ENTITIES[entity]) {
  23297. return parser.ENTITIES[entity]
  23298. }
  23299. if (parser.ENTITIES[entityLC]) {
  23300. return parser.ENTITIES[entityLC]
  23301. }
  23302. entity = entityLC
  23303. if (entity.charAt(0) === '#') {
  23304. if (entity.charAt(1) === 'x') {
  23305. entity = entity.slice(2)
  23306. num = parseInt(entity, 16)
  23307. numStr = num.toString(16)
  23308. } else {
  23309. entity = entity.slice(1)
  23310. num = parseInt(entity, 10)
  23311. numStr = num.toString(10)
  23312. }
  23313. }
  23314. entity = entity.replace(/^0+/, '')
  23315. if (isNaN(num) || numStr.toLowerCase() !== entity) {
  23316. strictFail(parser, 'Invalid character entity')
  23317. return '&' + parser.entity + ';'
  23318. }
  23319. return String.fromCodePoint(num)
  23320. }
  23321. function beginWhiteSpace (parser, c) {
  23322. if (c === '<') {
  23323. parser.state = S.OPEN_WAKA
  23324. parser.startTagPosition = parser.position
  23325. } else if (!isWhitespace(c)) {
  23326. // have to process this as a text node.
  23327. // weird, but happens.
  23328. strictFail(parser, 'Non-whitespace before first tag.')
  23329. parser.textNode = c
  23330. parser.state = S.TEXT
  23331. }
  23332. }
  23333. function charAt (chunk, i) {
  23334. var result = ''
  23335. if (i < chunk.length) {
  23336. result = chunk.charAt(i)
  23337. }
  23338. return result
  23339. }
  23340. function write (chunk) {
  23341. var parser = this
  23342. if (this.error) {
  23343. throw this.error
  23344. }
  23345. if (parser.closed) {
  23346. return error(parser,
  23347. 'Cannot write after close. Assign an onready handler.')
  23348. }
  23349. if (chunk === null) {
  23350. return end(parser)
  23351. }
  23352. if (typeof chunk === 'object') {
  23353. chunk = chunk.toString()
  23354. }
  23355. var i = 0
  23356. var c = ''
  23357. while (true) {
  23358. c = charAt(chunk, i++)
  23359. parser.c = c
  23360. if (!c) {
  23361. break
  23362. }
  23363. if (parser.trackPosition) {
  23364. parser.position++
  23365. if (c === '\n') {
  23366. parser.line++
  23367. parser.column = 0
  23368. } else {
  23369. parser.column++
  23370. }
  23371. }
  23372. switch (parser.state) {
  23373. case S.BEGIN:
  23374. parser.state = S.BEGIN_WHITESPACE
  23375. if (c === '\uFEFF') {
  23376. continue
  23377. }
  23378. beginWhiteSpace(parser, c)
  23379. continue
  23380. case S.BEGIN_WHITESPACE:
  23381. beginWhiteSpace(parser, c)
  23382. continue
  23383. case S.TEXT:
  23384. if (parser.sawRoot && !parser.closedRoot) {
  23385. var starti = i - 1
  23386. while (c && c !== '<' && c !== '&') {
  23387. c = charAt(chunk, i++)
  23388. if (c && parser.trackPosition) {
  23389. parser.position++
  23390. if (c === '\n') {
  23391. parser.line++
  23392. parser.column = 0
  23393. } else {
  23394. parser.column++
  23395. }
  23396. }
  23397. }
  23398. parser.textNode += chunk.substring(starti, i - 1)
  23399. }
  23400. if (c === '<' && !(parser.sawRoot && parser.closedRoot && !parser.strict)) {
  23401. parser.state = S.OPEN_WAKA
  23402. parser.startTagPosition = parser.position
  23403. } else {
  23404. if (!isWhitespace(c) && (!parser.sawRoot || parser.closedRoot)) {
  23405. strictFail(parser, 'Text data outside of root node.')
  23406. }
  23407. if (c === '&') {
  23408. parser.state = S.TEXT_ENTITY
  23409. } else {
  23410. parser.textNode += c
  23411. }
  23412. }
  23413. continue
  23414. case S.SCRIPT:
  23415. // only non-strict
  23416. if (c === '<') {
  23417. parser.state = S.SCRIPT_ENDING
  23418. } else {
  23419. parser.script += c
  23420. }
  23421. continue
  23422. case S.SCRIPT_ENDING:
  23423. if (c === '/') {
  23424. parser.state = S.CLOSE_TAG
  23425. } else {
  23426. parser.script += '<' + c
  23427. parser.state = S.SCRIPT
  23428. }
  23429. continue
  23430. case S.OPEN_WAKA:
  23431. // either a /, ?, !, or text is coming next.
  23432. if (c === '!') {
  23433. parser.state = S.SGML_DECL
  23434. parser.sgmlDecl = ''
  23435. } else if (isWhitespace(c)) {
  23436. // wait for it...
  23437. } else if (isMatch(nameStart, c)) {
  23438. parser.state = S.OPEN_TAG
  23439. parser.tagName = c
  23440. } else if (c === '/') {
  23441. parser.state = S.CLOSE_TAG
  23442. parser.tagName = ''
  23443. } else if (c === '?') {
  23444. parser.state = S.PROC_INST
  23445. parser.procInstName = parser.procInstBody = ''
  23446. } else {
  23447. strictFail(parser, 'Unencoded <')
  23448. // if there was some whitespace, then add that in.
  23449. if (parser.startTagPosition + 1 < parser.position) {
  23450. var pad = parser.position - parser.startTagPosition
  23451. c = new Array(pad).join(' ') + c
  23452. }
  23453. parser.textNode += '<' + c
  23454. parser.state = S.TEXT
  23455. }
  23456. continue
  23457. case S.SGML_DECL:
  23458. if ((parser.sgmlDecl + c).toUpperCase() === CDATA) {
  23459. emitNode(parser, 'onopencdata')
  23460. parser.state = S.CDATA
  23461. parser.sgmlDecl = ''
  23462. parser.cdata = ''
  23463. } else if (parser.sgmlDecl + c === '--') {
  23464. parser.state = S.COMMENT
  23465. parser.comment = ''
  23466. parser.sgmlDecl = ''
  23467. } else if ((parser.sgmlDecl + c).toUpperCase() === DOCTYPE) {
  23468. parser.state = S.DOCTYPE
  23469. if (parser.doctype || parser.sawRoot) {
  23470. strictFail(parser,
  23471. 'Inappropriately located doctype declaration')
  23472. }
  23473. parser.doctype = ''
  23474. parser.sgmlDecl = ''
  23475. } else if (c === '>') {
  23476. emitNode(parser, 'onsgmldeclaration', parser.sgmlDecl)
  23477. parser.sgmlDecl = ''
  23478. parser.state = S.TEXT
  23479. } else if (isQuote(c)) {
  23480. parser.state = S.SGML_DECL_QUOTED
  23481. parser.sgmlDecl += c
  23482. } else {
  23483. parser.sgmlDecl += c
  23484. }
  23485. continue
  23486. case S.SGML_DECL_QUOTED:
  23487. if (c === parser.q) {
  23488. parser.state = S.SGML_DECL
  23489. parser.q = ''
  23490. }
  23491. parser.sgmlDecl += c
  23492. continue
  23493. case S.DOCTYPE:
  23494. if (c === '>') {
  23495. parser.state = S.TEXT
  23496. emitNode(parser, 'ondoctype', parser.doctype)
  23497. parser.doctype = true // just remember that we saw it.
  23498. } else {
  23499. parser.doctype += c
  23500. if (c === '[') {
  23501. parser.state = S.DOCTYPE_DTD
  23502. } else if (isQuote(c)) {
  23503. parser.state = S.DOCTYPE_QUOTED
  23504. parser.q = c
  23505. }
  23506. }
  23507. continue
  23508. case S.DOCTYPE_QUOTED:
  23509. parser.doctype += c
  23510. if (c === parser.q) {
  23511. parser.q = ''
  23512. parser.state = S.DOCTYPE
  23513. }
  23514. continue
  23515. case S.DOCTYPE_DTD:
  23516. parser.doctype += c
  23517. if (c === ']') {
  23518. parser.state = S.DOCTYPE
  23519. } else if (isQuote(c)) {
  23520. parser.state = S.DOCTYPE_DTD_QUOTED
  23521. parser.q = c
  23522. }
  23523. continue
  23524. case S.DOCTYPE_DTD_QUOTED:
  23525. parser.doctype += c
  23526. if (c === parser.q) {
  23527. parser.state = S.DOCTYPE_DTD
  23528. parser.q = ''
  23529. }
  23530. continue
  23531. case S.COMMENT:
  23532. if (c === '-') {
  23533. parser.state = S.COMMENT_ENDING
  23534. } else {
  23535. parser.comment += c
  23536. }
  23537. continue
  23538. case S.COMMENT_ENDING:
  23539. if (c === '-') {
  23540. parser.state = S.COMMENT_ENDED
  23541. parser.comment = textopts(parser.opt, parser.comment)
  23542. if (parser.comment) {
  23543. emitNode(parser, 'oncomment', parser.comment)
  23544. }
  23545. parser.comment = ''
  23546. } else {
  23547. parser.comment += '-' + c
  23548. parser.state = S.COMMENT
  23549. }
  23550. continue
  23551. case S.COMMENT_ENDED:
  23552. if (c !== '>') {
  23553. strictFail(parser, 'Malformed comment')
  23554. // allow <!-- blah -- bloo --> in non-strict mode,
  23555. // which is a comment of " blah -- bloo "
  23556. parser.comment += '--' + c
  23557. parser.state = S.COMMENT
  23558. } else {
  23559. parser.state = S.TEXT
  23560. }
  23561. continue
  23562. case S.CDATA:
  23563. if (c === ']') {
  23564. parser.state = S.CDATA_ENDING
  23565. } else {
  23566. parser.cdata += c
  23567. }
  23568. continue
  23569. case S.CDATA_ENDING:
  23570. if (c === ']') {
  23571. parser.state = S.CDATA_ENDING_2
  23572. } else {
  23573. parser.cdata += ']' + c
  23574. parser.state = S.CDATA
  23575. }
  23576. continue
  23577. case S.CDATA_ENDING_2:
  23578. if (c === '>') {
  23579. if (parser.cdata) {
  23580. emitNode(parser, 'oncdata', parser.cdata)
  23581. }
  23582. emitNode(parser, 'onclosecdata')
  23583. parser.cdata = ''
  23584. parser.state = S.TEXT
  23585. } else if (c === ']') {
  23586. parser.cdata += ']'
  23587. } else {
  23588. parser.cdata += ']]' + c
  23589. parser.state = S.CDATA
  23590. }
  23591. continue
  23592. case S.PROC_INST:
  23593. if (c === '?') {
  23594. parser.state = S.PROC_INST_ENDING
  23595. } else if (isWhitespace(c)) {
  23596. parser.state = S.PROC_INST_BODY
  23597. } else {
  23598. parser.procInstName += c
  23599. }
  23600. continue
  23601. case S.PROC_INST_BODY:
  23602. if (!parser.procInstBody && isWhitespace(c)) {
  23603. continue
  23604. } else if (c === '?') {
  23605. parser.state = S.PROC_INST_ENDING
  23606. } else {
  23607. parser.procInstBody += c
  23608. }
  23609. continue
  23610. case S.PROC_INST_ENDING:
  23611. if (c === '>') {
  23612. emitNode(parser, 'onprocessinginstruction', {
  23613. name: parser.procInstName,
  23614. body: parser.procInstBody
  23615. })
  23616. parser.procInstName = parser.procInstBody = ''
  23617. parser.state = S.TEXT
  23618. } else {
  23619. parser.procInstBody += '?' + c
  23620. parser.state = S.PROC_INST_BODY
  23621. }
  23622. continue
  23623. case S.OPEN_TAG:
  23624. if (isMatch(nameBody, c)) {
  23625. parser.tagName += c
  23626. } else {
  23627. newTag(parser)
  23628. if (c === '>') {
  23629. openTag(parser)
  23630. } else if (c === '/') {
  23631. parser.state = S.OPEN_TAG_SLASH
  23632. } else {
  23633. if (!isWhitespace(c)) {
  23634. strictFail(parser, 'Invalid character in tag name')
  23635. }
  23636. parser.state = S.ATTRIB
  23637. }
  23638. }
  23639. continue
  23640. case S.OPEN_TAG_SLASH:
  23641. if (c === '>') {
  23642. openTag(parser, true)
  23643. closeTag(parser)
  23644. } else {
  23645. strictFail(parser, 'Forward-slash in opening tag not followed by >')
  23646. parser.state = S.ATTRIB
  23647. }
  23648. continue
  23649. case S.ATTRIB:
  23650. // haven't read the attribute name yet.
  23651. if (isWhitespace(c)) {
  23652. continue
  23653. } else if (c === '>') {
  23654. openTag(parser)
  23655. } else if (c === '/') {
  23656. parser.state = S.OPEN_TAG_SLASH
  23657. } else if (isMatch(nameStart, c)) {
  23658. parser.attribName = c
  23659. parser.attribValue = ''
  23660. parser.state = S.ATTRIB_NAME
  23661. } else {
  23662. strictFail(parser, 'Invalid attribute name')
  23663. }
  23664. continue
  23665. case S.ATTRIB_NAME:
  23666. if (c === '=') {
  23667. parser.state = S.ATTRIB_VALUE
  23668. } else if (c === '>') {
  23669. strictFail(parser, 'Attribute without value')
  23670. parser.attribValue = parser.attribName
  23671. attrib(parser)
  23672. openTag(parser)
  23673. } else if (isWhitespace(c)) {
  23674. parser.state = S.ATTRIB_NAME_SAW_WHITE
  23675. } else if (isMatch(nameBody, c)) {
  23676. parser.attribName += c
  23677. } else {
  23678. strictFail(parser, 'Invalid attribute name')
  23679. }
  23680. continue
  23681. case S.ATTRIB_NAME_SAW_WHITE:
  23682. if (c === '=') {
  23683. parser.state = S.ATTRIB_VALUE
  23684. } else if (isWhitespace(c)) {
  23685. continue
  23686. } else {
  23687. strictFail(parser, 'Attribute without value')
  23688. parser.tag.attributes[parser.attribName] = ''
  23689. parser.attribValue = ''
  23690. emitNode(parser, 'onattribute', {
  23691. name: parser.attribName,
  23692. value: ''
  23693. })
  23694. parser.attribName = ''
  23695. if (c === '>') {
  23696. openTag(parser)
  23697. } else if (isMatch(nameStart, c)) {
  23698. parser.attribName = c
  23699. parser.state = S.ATTRIB_NAME
  23700. } else {
  23701. strictFail(parser, 'Invalid attribute name')
  23702. parser.state = S.ATTRIB
  23703. }
  23704. }
  23705. continue
  23706. case S.ATTRIB_VALUE:
  23707. if (isWhitespace(c)) {
  23708. continue
  23709. } else if (isQuote(c)) {
  23710. parser.q = c
  23711. parser.state = S.ATTRIB_VALUE_QUOTED
  23712. } else {
  23713. strictFail(parser, 'Unquoted attribute value')
  23714. parser.state = S.ATTRIB_VALUE_UNQUOTED
  23715. parser.attribValue = c
  23716. }
  23717. continue
  23718. case S.ATTRIB_VALUE_QUOTED:
  23719. if (c !== parser.q) {
  23720. if (c === '&') {
  23721. parser.state = S.ATTRIB_VALUE_ENTITY_Q
  23722. } else {
  23723. parser.attribValue += c
  23724. }
  23725. continue
  23726. }
  23727. attrib(parser)
  23728. parser.q = ''
  23729. parser.state = S.ATTRIB_VALUE_CLOSED
  23730. continue
  23731. case S.ATTRIB_VALUE_CLOSED:
  23732. if (isWhitespace(c)) {
  23733. parser.state = S.ATTRIB
  23734. } else if (c === '>') {
  23735. openTag(parser)
  23736. } else if (c === '/') {
  23737. parser.state = S.OPEN_TAG_SLASH
  23738. } else if (isMatch(nameStart, c)) {
  23739. strictFail(parser, 'No whitespace between attributes')
  23740. parser.attribName = c
  23741. parser.attribValue = ''
  23742. parser.state = S.ATTRIB_NAME
  23743. } else {
  23744. strictFail(parser, 'Invalid attribute name')
  23745. }
  23746. continue
  23747. case S.ATTRIB_VALUE_UNQUOTED:
  23748. if (!isAttribEnd(c)) {
  23749. if (c === '&') {
  23750. parser.state = S.ATTRIB_VALUE_ENTITY_U
  23751. } else {
  23752. parser.attribValue += c
  23753. }
  23754. continue
  23755. }
  23756. attrib(parser)
  23757. if (c === '>') {
  23758. openTag(parser)
  23759. } else {
  23760. parser.state = S.ATTRIB
  23761. }
  23762. continue
  23763. case S.CLOSE_TAG:
  23764. if (!parser.tagName) {
  23765. if (isWhitespace(c)) {
  23766. continue
  23767. } else if (notMatch(nameStart, c)) {
  23768. if (parser.script) {
  23769. parser.script += '</' + c
  23770. parser.state = S.SCRIPT
  23771. } else {
  23772. strictFail(parser, 'Invalid tagname in closing tag.')
  23773. }
  23774. } else {
  23775. parser.tagName = c
  23776. }
  23777. } else if (c === '>') {
  23778. closeTag(parser)
  23779. } else if (isMatch(nameBody, c)) {
  23780. parser.tagName += c
  23781. } else if (parser.script) {
  23782. parser.script += '</' + parser.tagName
  23783. parser.tagName = ''
  23784. parser.state = S.SCRIPT
  23785. } else {
  23786. if (!isWhitespace(c)) {
  23787. strictFail(parser, 'Invalid tagname in closing tag')
  23788. }
  23789. parser.state = S.CLOSE_TAG_SAW_WHITE
  23790. }
  23791. continue
  23792. case S.CLOSE_TAG_SAW_WHITE:
  23793. if (isWhitespace(c)) {
  23794. continue
  23795. }
  23796. if (c === '>') {
  23797. closeTag(parser)
  23798. } else {
  23799. strictFail(parser, 'Invalid characters in closing tag')
  23800. }
  23801. continue
  23802. case S.TEXT_ENTITY:
  23803. case S.ATTRIB_VALUE_ENTITY_Q:
  23804. case S.ATTRIB_VALUE_ENTITY_U:
  23805. var returnState
  23806. var buffer
  23807. switch (parser.state) {
  23808. case S.TEXT_ENTITY:
  23809. returnState = S.TEXT
  23810. buffer = 'textNode'
  23811. break
  23812. case S.ATTRIB_VALUE_ENTITY_Q:
  23813. returnState = S.ATTRIB_VALUE_QUOTED
  23814. buffer = 'attribValue'
  23815. break
  23816. case S.ATTRIB_VALUE_ENTITY_U:
  23817. returnState = S.ATTRIB_VALUE_UNQUOTED
  23818. buffer = 'attribValue'
  23819. break
  23820. }
  23821. if (c === ';') {
  23822. parser[buffer] += parseEntity(parser)
  23823. parser.entity = ''
  23824. parser.state = returnState
  23825. } else if (isMatch(parser.entity.length ? entityBody : entityStart, c)) {
  23826. parser.entity += c
  23827. } else {
  23828. strictFail(parser, 'Invalid character in entity name')
  23829. parser[buffer] += '&' + parser.entity + c
  23830. parser.entity = ''
  23831. parser.state = returnState
  23832. }
  23833. continue
  23834. default:
  23835. throw new Error(parser, 'Unknown state: ' + parser.state)
  23836. }
  23837. } // while
  23838. if (parser.position >= parser.bufferCheckPosition) {
  23839. checkBufferLength(parser)
  23840. }
  23841. return parser
  23842. }
  23843. /*! http://mths.be/fromcodepoint v0.1.0 by @mathias */
  23844. /* istanbul ignore next */
  23845. if (!String.fromCodePoint) {
  23846. (function () {
  23847. var stringFromCharCode = String.fromCharCode
  23848. var floor = Math.floor
  23849. var fromCodePoint = function () {
  23850. var MAX_SIZE = 0x4000
  23851. var codeUnits = []
  23852. var highSurrogate
  23853. var lowSurrogate
  23854. var index = -1
  23855. var length = arguments.length
  23856. if (!length) {
  23857. return ''
  23858. }
  23859. var result = ''
  23860. while (++index < length) {
  23861. var codePoint = Number(arguments[index])
  23862. if (
  23863. !isFinite(codePoint) || // `NaN`, `+Infinity`, or `-Infinity`
  23864. codePoint < 0 || // not a valid Unicode code point
  23865. codePoint > 0x10FFFF || // not a valid Unicode code point
  23866. floor(codePoint) !== codePoint // not an integer
  23867. ) {
  23868. throw RangeError('Invalid code point: ' + codePoint)
  23869. }
  23870. if (codePoint <= 0xFFFF) { // BMP code point
  23871. codeUnits.push(codePoint)
  23872. } else { // Astral code point; split in surrogate halves
  23873. // http://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae
  23874. codePoint -= 0x10000
  23875. highSurrogate = (codePoint >> 10) + 0xD800
  23876. lowSurrogate = (codePoint % 0x400) + 0xDC00
  23877. codeUnits.push(highSurrogate, lowSurrogate)
  23878. }
  23879. if (index + 1 === length || codeUnits.length > MAX_SIZE) {
  23880. result += stringFromCharCode.apply(null, codeUnits)
  23881. codeUnits.length = 0
  23882. }
  23883. }
  23884. return result
  23885. }
  23886. /* istanbul ignore next */
  23887. if (Object.defineProperty) {
  23888. Object.defineProperty(String, 'fromCodePoint', {
  23889. value: fromCodePoint,
  23890. configurable: true,
  23891. writable: true
  23892. })
  23893. } else {
  23894. String.fromCodePoint = fromCodePoint
  23895. }
  23896. }())
  23897. }
  23898. })(typeof exports === 'undefined' ? this.sax = {} : exports)
  23899. }).call(this)}).call(this,require("buffer").Buffer)
  23900. },{"buffer":85,"stream":345,"string_decoder":86}],345:[function(require,module,exports){
  23901. // Copyright Joyent, Inc. and other Node contributors.
  23902. //
  23903. // Permission is hereby granted, free of charge, to any person obtaining a
  23904. // copy of this software and associated documentation files (the
  23905. // "Software"), to deal in the Software without restriction, including
  23906. // without limitation the rights to use, copy, modify, merge, publish,
  23907. // distribute, sublicense, and/or sell copies of the Software, and to permit
  23908. // persons to whom the Software is furnished to do so, subject to the
  23909. // following conditions:
  23910. //
  23911. // The above copyright notice and this permission notice shall be included
  23912. // in all copies or substantial portions of the Software.
  23913. //
  23914. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  23915. // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  23916. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  23917. // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  23918. // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  23919. // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  23920. // USE OR OTHER DEALINGS IN THE SOFTWARE.
  23921. module.exports = Stream;
  23922. var EE = require('events').EventEmitter;
  23923. var inherits = require('inherits');
  23924. inherits(Stream, EE);
  23925. Stream.Readable = require('readable-stream/readable.js');
  23926. Stream.Writable = require('readable-stream/writable.js');
  23927. Stream.Duplex = require('readable-stream/duplex.js');
  23928. Stream.Transform = require('readable-stream/transform.js');
  23929. Stream.PassThrough = require('readable-stream/passthrough.js');
  23930. // Backwards-compat with node 0.4.x
  23931. Stream.Stream = Stream;
  23932. // old-style streams. Note that the pipe method (the only relevant
  23933. // part of this class) is overridden in the Readable class.
  23934. function Stream() {
  23935. EE.call(this);
  23936. }
  23937. Stream.prototype.pipe = function(dest, options) {
  23938. var source = this;
  23939. function ondata(chunk) {
  23940. if (dest.writable) {
  23941. if (false === dest.write(chunk) && source.pause) {
  23942. source.pause();
  23943. }
  23944. }
  23945. }
  23946. source.on('data', ondata);
  23947. function ondrain() {
  23948. if (source.readable && source.resume) {
  23949. source.resume();
  23950. }
  23951. }
  23952. dest.on('drain', ondrain);
  23953. // If the 'end' option is not supplied, dest.end() will be called when
  23954. // source gets the 'end' or 'close' events. Only dest.end() once.
  23955. if (!dest._isStdio && (!options || options.end !== false)) {
  23956. source.on('end', onend);
  23957. source.on('close', onclose);
  23958. }
  23959. var didOnEnd = false;
  23960. function onend() {
  23961. if (didOnEnd) return;
  23962. didOnEnd = true;
  23963. dest.end();
  23964. }
  23965. function onclose() {
  23966. if (didOnEnd) return;
  23967. didOnEnd = true;
  23968. if (typeof dest.destroy === 'function') dest.destroy();
  23969. }
  23970. // don't leave dangling pipes when there are errors.
  23971. function onerror(er) {
  23972. cleanup();
  23973. if (EE.listenerCount(this, 'error') === 0) {
  23974. throw er; // Unhandled stream error in pipe.
  23975. }
  23976. }
  23977. source.on('error', onerror);
  23978. dest.on('error', onerror);
  23979. // remove all the event listeners that were added.
  23980. function cleanup() {
  23981. source.removeListener('data', ondata);
  23982. dest.removeListener('drain', ondrain);
  23983. source.removeListener('end', onend);
  23984. source.removeListener('close', onclose);
  23985. source.removeListener('error', onerror);
  23986. dest.removeListener('error', onerror);
  23987. source.removeListener('end', cleanup);
  23988. source.removeListener('close', cleanup);
  23989. dest.removeListener('close', cleanup);
  23990. }
  23991. source.on('end', cleanup);
  23992. source.on('close', cleanup);
  23993. dest.on('close', cleanup);
  23994. dest.emit('pipe', source);
  23995. // Allow for unix-like usage: A.pipe(B).pipe(C)
  23996. return dest;
  23997. };
  23998. },{"events":301,"inherits":311,"readable-stream/duplex.js":329,"readable-stream/passthrough.js":338,"readable-stream/readable.js":339,"readable-stream/transform.js":340,"readable-stream/writable.js":341}],346:[function(require,module,exports){
  23999. // Copyright Joyent, Inc. and other Node contributors.
  24000. //
  24001. // Permission is hereby granted, free of charge, to any person obtaining a
  24002. // copy of this software and associated documentation files (the
  24003. // "Software"), to deal in the Software without restriction, including
  24004. // without limitation the rights to use, copy, modify, merge, publish,
  24005. // distribute, sublicense, and/or sell copies of the Software, and to permit
  24006. // persons to whom the Software is furnished to do so, subject to the
  24007. // following conditions:
  24008. //
  24009. // The above copyright notice and this permission notice shall be included
  24010. // in all copies or substantial portions of the Software.
  24011. //
  24012. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  24013. // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  24014. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  24015. // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  24016. // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  24017. // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  24018. // USE OR OTHER DEALINGS IN THE SOFTWARE.
  24019. 'use strict';
  24020. /*<replacement>*/
  24021. var Buffer = require('safe-buffer').Buffer;
  24022. /*</replacement>*/
  24023. var isEncoding = Buffer.isEncoding || function (encoding) {
  24024. encoding = '' + encoding;
  24025. switch (encoding && encoding.toLowerCase()) {
  24026. 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':
  24027. return true;
  24028. default:
  24029. return false;
  24030. }
  24031. };
  24032. function _normalizeEncoding(enc) {
  24033. if (!enc) return 'utf8';
  24034. var retried;
  24035. while (true) {
  24036. switch (enc) {
  24037. case 'utf8':
  24038. case 'utf-8':
  24039. return 'utf8';
  24040. case 'ucs2':
  24041. case 'ucs-2':
  24042. case 'utf16le':
  24043. case 'utf-16le':
  24044. return 'utf16le';
  24045. case 'latin1':
  24046. case 'binary':
  24047. return 'latin1';
  24048. case 'base64':
  24049. case 'ascii':
  24050. case 'hex':
  24051. return enc;
  24052. default:
  24053. if (retried) return; // undefined
  24054. enc = ('' + enc).toLowerCase();
  24055. retried = true;
  24056. }
  24057. }
  24058. };
  24059. // Do not cache `Buffer.isEncoding` when checking encoding names as some
  24060. // modules monkey-patch it to support additional encodings
  24061. function normalizeEncoding(enc) {
  24062. var nenc = _normalizeEncoding(enc);
  24063. if (typeof nenc !== 'string' && (Buffer.isEncoding === isEncoding || !isEncoding(enc))) throw new Error('Unknown encoding: ' + enc);
  24064. return nenc || enc;
  24065. }
  24066. // StringDecoder provides an interface for efficiently splitting a series of
  24067. // buffers into a series of JS strings without breaking apart multi-byte
  24068. // characters.
  24069. exports.StringDecoder = StringDecoder;
  24070. function StringDecoder(encoding) {
  24071. this.encoding = normalizeEncoding(encoding);
  24072. var nb;
  24073. switch (this.encoding) {
  24074. case 'utf16le':
  24075. this.text = utf16Text;
  24076. this.end = utf16End;
  24077. nb = 4;
  24078. break;
  24079. case 'utf8':
  24080. this.fillLast = utf8FillLast;
  24081. nb = 4;
  24082. break;
  24083. case 'base64':
  24084. this.text = base64Text;
  24085. this.end = base64End;
  24086. nb = 3;
  24087. break;
  24088. default:
  24089. this.write = simpleWrite;
  24090. this.end = simpleEnd;
  24091. return;
  24092. }
  24093. this.lastNeed = 0;
  24094. this.lastTotal = 0;
  24095. this.lastChar = Buffer.allocUnsafe(nb);
  24096. }
  24097. StringDecoder.prototype.write = function (buf) {
  24098. if (buf.length === 0) return '';
  24099. var r;
  24100. var i;
  24101. if (this.lastNeed) {
  24102. r = this.fillLast(buf);
  24103. if (r === undefined) return '';
  24104. i = this.lastNeed;
  24105. this.lastNeed = 0;
  24106. } else {
  24107. i = 0;
  24108. }
  24109. if (i < buf.length) return r ? r + this.text(buf, i) : this.text(buf, i);
  24110. return r || '';
  24111. };
  24112. StringDecoder.prototype.end = utf8End;
  24113. // Returns only complete characters in a Buffer
  24114. StringDecoder.prototype.text = utf8Text;
  24115. // Attempts to complete a partial non-UTF-8 character using bytes from a Buffer
  24116. StringDecoder.prototype.fillLast = function (buf) {
  24117. if (this.lastNeed <= buf.length) {
  24118. buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, this.lastNeed);
  24119. return this.lastChar.toString(this.encoding, 0, this.lastTotal);
  24120. }
  24121. buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, buf.length);
  24122. this.lastNeed -= buf.length;
  24123. };
  24124. // Checks the type of a UTF-8 byte, whether it's ASCII, a leading byte, or a
  24125. // continuation byte. If an invalid byte is detected, -2 is returned.
  24126. function utf8CheckByte(byte) {
  24127. 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;
  24128. return byte >> 6 === 0x02 ? -1 : -2;
  24129. }
  24130. // Checks at most 3 bytes at the end of a Buffer in order to detect an
  24131. // incomplete multi-byte UTF-8 character. The total number of bytes (2, 3, or 4)
  24132. // needed to complete the UTF-8 character (if applicable) are returned.
  24133. function utf8CheckIncomplete(self, buf, i) {
  24134. var j = buf.length - 1;
  24135. if (j < i) return 0;
  24136. var nb = utf8CheckByte(buf[j]);
  24137. if (nb >= 0) {
  24138. if (nb > 0) self.lastNeed = nb - 1;
  24139. return nb;
  24140. }
  24141. if (--j < i || nb === -2) return 0;
  24142. nb = utf8CheckByte(buf[j]);
  24143. if (nb >= 0) {
  24144. if (nb > 0) self.lastNeed = nb - 2;
  24145. return nb;
  24146. }
  24147. if (--j < i || nb === -2) return 0;
  24148. nb = utf8CheckByte(buf[j]);
  24149. if (nb >= 0) {
  24150. if (nb > 0) {
  24151. if (nb === 2) nb = 0;else self.lastNeed = nb - 3;
  24152. }
  24153. return nb;
  24154. }
  24155. return 0;
  24156. }
  24157. // Validates as many continuation bytes for a multi-byte UTF-8 character as
  24158. // needed or are available. If we see a non-continuation byte where we expect
  24159. // one, we "replace" the validated continuation bytes we've seen so far with
  24160. // a single UTF-8 replacement character ('\ufffd'), to match v8's UTF-8 decoding
  24161. // behavior. The continuation byte check is included three times in the case
  24162. // where all of the continuation bytes for a character exist in the same buffer.
  24163. // It is also done this way as a slight performance increase instead of using a
  24164. // loop.
  24165. function utf8CheckExtraBytes(self, buf, p) {
  24166. if ((buf[0] & 0xC0) !== 0x80) {
  24167. self.lastNeed = 0;
  24168. return '\ufffd';
  24169. }
  24170. if (self.lastNeed > 1 && buf.length > 1) {
  24171. if ((buf[1] & 0xC0) !== 0x80) {
  24172. self.lastNeed = 1;
  24173. return '\ufffd';
  24174. }
  24175. if (self.lastNeed > 2 && buf.length > 2) {
  24176. if ((buf[2] & 0xC0) !== 0x80) {
  24177. self.lastNeed = 2;
  24178. return '\ufffd';
  24179. }
  24180. }
  24181. }
  24182. }
  24183. // Attempts to complete a multi-byte UTF-8 character using bytes from a Buffer.
  24184. function utf8FillLast(buf) {
  24185. var p = this.lastTotal - this.lastNeed;
  24186. var r = utf8CheckExtraBytes(this, buf, p);
  24187. if (r !== undefined) return r;
  24188. if (this.lastNeed <= buf.length) {
  24189. buf.copy(this.lastChar, p, 0, this.lastNeed);
  24190. return this.lastChar.toString(this.encoding, 0, this.lastTotal);
  24191. }
  24192. buf.copy(this.lastChar, p, 0, buf.length);
  24193. this.lastNeed -= buf.length;
  24194. }
  24195. // Returns all complete UTF-8 characters in a Buffer. If the Buffer ended on a
  24196. // partial character, the character's bytes are buffered until the required
  24197. // number of bytes are available.
  24198. function utf8Text(buf, i) {
  24199. var total = utf8CheckIncomplete(this, buf, i);
  24200. if (!this.lastNeed) return buf.toString('utf8', i);
  24201. this.lastTotal = total;
  24202. var end = buf.length - (total - this.lastNeed);
  24203. buf.copy(this.lastChar, 0, end);
  24204. return buf.toString('utf8', i, end);
  24205. }
  24206. // For UTF-8, a replacement character is added when ending on a partial
  24207. // character.
  24208. function utf8End(buf) {
  24209. var r = buf && buf.length ? this.write(buf) : '';
  24210. if (this.lastNeed) return r + '\ufffd';
  24211. return r;
  24212. }
  24213. // UTF-16LE typically needs two bytes per character, but even if we have an even
  24214. // number of bytes available, we need to check if we end on a leading/high
  24215. // surrogate. In that case, we need to wait for the next two bytes in order to
  24216. // decode the last character properly.
  24217. function utf16Text(buf, i) {
  24218. if ((buf.length - i) % 2 === 0) {
  24219. var r = buf.toString('utf16le', i);
  24220. if (r) {
  24221. var c = r.charCodeAt(r.length - 1);
  24222. if (c >= 0xD800 && c <= 0xDBFF) {
  24223. this.lastNeed = 2;
  24224. this.lastTotal = 4;
  24225. this.lastChar[0] = buf[buf.length - 2];
  24226. this.lastChar[1] = buf[buf.length - 1];
  24227. return r.slice(0, -1);
  24228. }
  24229. }
  24230. return r;
  24231. }
  24232. this.lastNeed = 1;
  24233. this.lastTotal = 2;
  24234. this.lastChar[0] = buf[buf.length - 1];
  24235. return buf.toString('utf16le', i, buf.length - 1);
  24236. }
  24237. // For UTF-16LE we do not explicitly append special replacement characters if we
  24238. // end on a partial character, we simply let v8 handle that.
  24239. function utf16End(buf) {
  24240. var r = buf && buf.length ? this.write(buf) : '';
  24241. if (this.lastNeed) {
  24242. var end = this.lastTotal - this.lastNeed;
  24243. return r + this.lastChar.toString('utf16le', 0, end);
  24244. }
  24245. return r;
  24246. }
  24247. function base64Text(buf, i) {
  24248. var n = (buf.length - i) % 3;
  24249. if (n === 0) return buf.toString('base64', i);
  24250. this.lastNeed = 3 - n;
  24251. this.lastTotal = 3;
  24252. if (n === 1) {
  24253. this.lastChar[0] = buf[buf.length - 1];
  24254. } else {
  24255. this.lastChar[0] = buf[buf.length - 2];
  24256. this.lastChar[1] = buf[buf.length - 1];
  24257. }
  24258. return buf.toString('base64', i, buf.length - n);
  24259. }
  24260. function base64End(buf) {
  24261. var r = buf && buf.length ? this.write(buf) : '';
  24262. if (this.lastNeed) return r + this.lastChar.toString('base64', 0, 3 - this.lastNeed);
  24263. return r;
  24264. }
  24265. // Pass bytes on through for single-byte encodings (e.g. ascii, latin1, hex)
  24266. function simpleWrite(buf) {
  24267. return buf.toString(this.encoding);
  24268. }
  24269. function simpleEnd(buf) {
  24270. return buf && buf.length ? this.write(buf) : '';
  24271. }
  24272. },{"safe-buffer":343}],347:[function(require,module,exports){
  24273. (function (setImmediate,clearImmediate){(function (){
  24274. var nextTick = require('process/browser.js').nextTick;
  24275. var apply = Function.prototype.apply;
  24276. var slice = Array.prototype.slice;
  24277. var immediateIds = {};
  24278. var nextImmediateId = 0;
  24279. // DOM APIs, for completeness
  24280. exports.setTimeout = function() {
  24281. return new Timeout(apply.call(setTimeout, window, arguments), clearTimeout);
  24282. };
  24283. exports.setInterval = function() {
  24284. return new Timeout(apply.call(setInterval, window, arguments), clearInterval);
  24285. };
  24286. exports.clearTimeout =
  24287. exports.clearInterval = function(timeout) { timeout.close(); };
  24288. function Timeout(id, clearFn) {
  24289. this._id = id;
  24290. this._clearFn = clearFn;
  24291. }
  24292. Timeout.prototype.unref = Timeout.prototype.ref = function() {};
  24293. Timeout.prototype.close = function() {
  24294. this._clearFn.call(window, this._id);
  24295. };
  24296. // Does not start the time, just sets up the members needed.
  24297. exports.enroll = function(item, msecs) {
  24298. clearTimeout(item._idleTimeoutId);
  24299. item._idleTimeout = msecs;
  24300. };
  24301. exports.unenroll = function(item) {
  24302. clearTimeout(item._idleTimeoutId);
  24303. item._idleTimeout = -1;
  24304. };
  24305. exports._unrefActive = exports.active = function(item) {
  24306. clearTimeout(item._idleTimeoutId);
  24307. var msecs = item._idleTimeout;
  24308. if (msecs >= 0) {
  24309. item._idleTimeoutId = setTimeout(function onTimeout() {
  24310. if (item._onTimeout)
  24311. item._onTimeout();
  24312. }, msecs);
  24313. }
  24314. };
  24315. // That's not how node.js implements it but the exposed api is the same.
  24316. exports.setImmediate = typeof setImmediate === "function" ? setImmediate : function(fn) {
  24317. var id = nextImmediateId++;
  24318. var args = arguments.length < 2 ? false : slice.call(arguments, 1);
  24319. immediateIds[id] = true;
  24320. nextTick(function onNextTick() {
  24321. if (immediateIds[id]) {
  24322. // fn.call() is faster so we optimize for the common use-case
  24323. // @see http://jsperf.com/call-apply-segu
  24324. if (args) {
  24325. fn.apply(null, args);
  24326. } else {
  24327. fn.call(null);
  24328. }
  24329. // Prevent ids from leaking
  24330. exports.clearImmediate(id);
  24331. }
  24332. });
  24333. return id;
  24334. };
  24335. exports.clearImmediate = typeof clearImmediate === "function" ? clearImmediate : function(id) {
  24336. delete immediateIds[id];
  24337. };
  24338. }).call(this)}).call(this,require("timers").setImmediate,require("timers").clearImmediate)
  24339. },{"process/browser.js":324,"timers":347}],348:[function(require,module,exports){
  24340. var Buffer = require('buffer').Buffer
  24341. module.exports = function (buf) {
  24342. // If the buffer is backed by a Uint8Array, a faster version will work
  24343. if (buf instanceof Uint8Array) {
  24344. // If the buffer isn't a subarray, return the underlying ArrayBuffer
  24345. if (buf.byteOffset === 0 && buf.byteLength === buf.buffer.byteLength) {
  24346. return buf.buffer
  24347. } else if (typeof buf.buffer.slice === 'function') {
  24348. // Otherwise we need to get a proper copy
  24349. return buf.buffer.slice(buf.byteOffset, buf.byteOffset + buf.byteLength)
  24350. }
  24351. }
  24352. if (Buffer.isBuffer(buf)) {
  24353. // This is the slow version that will work with any Buffer
  24354. // implementation (even in old browsers)
  24355. var arrayCopy = new Uint8Array(buf.length)
  24356. var len = buf.length
  24357. for (var i = 0; i < len; i++) {
  24358. arrayCopy[i] = buf[i]
  24359. }
  24360. return arrayCopy.buffer
  24361. } else {
  24362. throw new Error('Argument must be a Buffer')
  24363. }
  24364. }
  24365. },{"buffer":85}],349:[function(require,module,exports){
  24366. (function (global){(function (){
  24367. /**
  24368. * Module exports.
  24369. */
  24370. module.exports = deprecate;
  24371. /**
  24372. * Mark that a method should not be used.
  24373. * Returns a modified function which warns once by default.
  24374. *
  24375. * If `localStorage.noDeprecation = true` is set, then it is a no-op.
  24376. *
  24377. * If `localStorage.throwDeprecation = true` is set, then deprecated functions
  24378. * will throw an Error when invoked.
  24379. *
  24380. * If `localStorage.traceDeprecation = true` is set, then deprecated functions
  24381. * will invoke `console.trace()` instead of `console.error()`.
  24382. *
  24383. * @param {Function} fn - the function to deprecate
  24384. * @param {String} msg - the string to print to the console when `fn` is invoked
  24385. * @returns {Function} a new "deprecated" version of `fn`
  24386. * @api public
  24387. */
  24388. function deprecate (fn, msg) {
  24389. if (config('noDeprecation')) {
  24390. return fn;
  24391. }
  24392. var warned = false;
  24393. function deprecated() {
  24394. if (!warned) {
  24395. if (config('throwDeprecation')) {
  24396. throw new Error(msg);
  24397. } else if (config('traceDeprecation')) {
  24398. console.trace(msg);
  24399. } else {
  24400. console.warn(msg);
  24401. }
  24402. warned = true;
  24403. }
  24404. return fn.apply(this, arguments);
  24405. }
  24406. return deprecated;
  24407. }
  24408. /**
  24409. * Checks `localStorage` for boolean values for the given `name`.
  24410. *
  24411. * @param {String} name
  24412. * @returns {Boolean}
  24413. * @api private
  24414. */
  24415. function config (name) {
  24416. // accessing global.localStorage can trigger a DOMException in sandboxed iframes
  24417. try {
  24418. if (!global.localStorage) return false;
  24419. } catch (_) {
  24420. return false;
  24421. }
  24422. var val = global.localStorage[name];
  24423. if (null == val) return false;
  24424. return String(val).toLowerCase() === 'true';
  24425. }
  24426. }).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
  24427. },{}],350:[function(require,module,exports){
  24428. arguments[4][79][0].apply(exports,arguments)
  24429. },{"dup":79}],351:[function(require,module,exports){
  24430. arguments[4][80][0].apply(exports,arguments)
  24431. },{"dup":80}],352:[function(require,module,exports){
  24432. arguments[4][81][0].apply(exports,arguments)
  24433. },{"./support/isBuffer":351,"_process":399,"dup":81,"inherits":350}],353:[function(require,module,exports){
  24434. // Generated by CoffeeScript 1.12.7
  24435. (function() {
  24436. "use strict";
  24437. exports.stripBOM = function(str) {
  24438. if (str[0] === '\uFEFF') {
  24439. return str.substring(1);
  24440. } else {
  24441. return str;
  24442. }
  24443. };
  24444. }).call(this);
  24445. },{}],354:[function(require,module,exports){
  24446. // Generated by CoffeeScript 1.12.7
  24447. (function() {
  24448. "use strict";
  24449. var builder, defaults, escapeCDATA, requiresCDATA, wrapCDATA,
  24450. hasProp = {}.hasOwnProperty;
  24451. builder = require('xmlbuilder');
  24452. defaults = require('./defaults').defaults;
  24453. requiresCDATA = function(entry) {
  24454. return typeof entry === "string" && (entry.indexOf('&') >= 0 || entry.indexOf('>') >= 0 || entry.indexOf('<') >= 0);
  24455. };
  24456. wrapCDATA = function(entry) {
  24457. return "<![CDATA[" + (escapeCDATA(entry)) + "]]>";
  24458. };
  24459. escapeCDATA = function(entry) {
  24460. return entry.replace(']]>', ']]]]><![CDATA[>');
  24461. };
  24462. exports.Builder = (function() {
  24463. function Builder(opts) {
  24464. var key, ref, value;
  24465. this.options = {};
  24466. ref = defaults["0.2"];
  24467. for (key in ref) {
  24468. if (!hasProp.call(ref, key)) continue;
  24469. value = ref[key];
  24470. this.options[key] = value;
  24471. }
  24472. for (key in opts) {
  24473. if (!hasProp.call(opts, key)) continue;
  24474. value = opts[key];
  24475. this.options[key] = value;
  24476. }
  24477. }
  24478. Builder.prototype.buildObject = function(rootObj) {
  24479. var attrkey, charkey, render, rootElement, rootName;
  24480. attrkey = this.options.attrkey;
  24481. charkey = this.options.charkey;
  24482. if ((Object.keys(rootObj).length === 1) && (this.options.rootName === defaults['0.2'].rootName)) {
  24483. rootName = Object.keys(rootObj)[0];
  24484. rootObj = rootObj[rootName];
  24485. } else {
  24486. rootName = this.options.rootName;
  24487. }
  24488. render = (function(_this) {
  24489. return function(element, obj) {
  24490. var attr, child, entry, index, key, value;
  24491. if (typeof obj !== 'object') {
  24492. if (_this.options.cdata && requiresCDATA(obj)) {
  24493. element.raw(wrapCDATA(obj));
  24494. } else {
  24495. element.txt(obj);
  24496. }
  24497. } else if (Array.isArray(obj)) {
  24498. for (index in obj) {
  24499. if (!hasProp.call(obj, index)) continue;
  24500. child = obj[index];
  24501. for (key in child) {
  24502. entry = child[key];
  24503. element = render(element.ele(key), entry).up();
  24504. }
  24505. }
  24506. } else {
  24507. for (key in obj) {
  24508. if (!hasProp.call(obj, key)) continue;
  24509. child = obj[key];
  24510. if (key === attrkey) {
  24511. if (typeof child === "object") {
  24512. for (attr in child) {
  24513. value = child[attr];
  24514. element = element.att(attr, value);
  24515. }
  24516. }
  24517. } else if (key === charkey) {
  24518. if (_this.options.cdata && requiresCDATA(child)) {
  24519. element = element.raw(wrapCDATA(child));
  24520. } else {
  24521. element = element.txt(child);
  24522. }
  24523. } else if (Array.isArray(child)) {
  24524. for (index in child) {
  24525. if (!hasProp.call(child, index)) continue;
  24526. entry = child[index];
  24527. if (typeof entry === 'string') {
  24528. if (_this.options.cdata && requiresCDATA(entry)) {
  24529. element = element.ele(key).raw(wrapCDATA(entry)).up();
  24530. } else {
  24531. element = element.ele(key, entry).up();
  24532. }
  24533. } else {
  24534. element = render(element.ele(key), entry).up();
  24535. }
  24536. }
  24537. } else if (typeof child === "object") {
  24538. element = render(element.ele(key), child).up();
  24539. } else {
  24540. if (typeof child === 'string' && _this.options.cdata && requiresCDATA(child)) {
  24541. element = element.ele(key).raw(wrapCDATA(child)).up();
  24542. } else {
  24543. if (child == null) {
  24544. child = '';
  24545. }
  24546. element = element.ele(key, child.toString()).up();
  24547. }
  24548. }
  24549. }
  24550. }
  24551. return element;
  24552. };
  24553. })(this);
  24554. rootElement = builder.create(rootName, this.options.xmldec, this.options.doctype, {
  24555. headless: this.options.headless,
  24556. allowSurrogateChars: this.options.allowSurrogateChars
  24557. });
  24558. return render(rootElement, rootObj).end(this.options.renderOpts);
  24559. };
  24560. return Builder;
  24561. })();
  24562. }).call(this);
  24563. },{"./defaults":355,"xmlbuilder":391}],355:[function(require,module,exports){
  24564. // Generated by CoffeeScript 1.12.7
  24565. (function() {
  24566. exports.defaults = {
  24567. "0.1": {
  24568. explicitCharkey: false,
  24569. trim: true,
  24570. normalize: true,
  24571. normalizeTags: false,
  24572. attrkey: "@",
  24573. charkey: "#",
  24574. explicitArray: false,
  24575. ignoreAttrs: false,
  24576. mergeAttrs: false,
  24577. explicitRoot: false,
  24578. validator: null,
  24579. xmlns: false,
  24580. explicitChildren: false,
  24581. childkey: '@@',
  24582. charsAsChildren: false,
  24583. includeWhiteChars: false,
  24584. async: false,
  24585. strict: true,
  24586. attrNameProcessors: null,
  24587. attrValueProcessors: null,
  24588. tagNameProcessors: null,
  24589. valueProcessors: null,
  24590. emptyTag: ''
  24591. },
  24592. "0.2": {
  24593. explicitCharkey: false,
  24594. trim: false,
  24595. normalize: false,
  24596. normalizeTags: false,
  24597. attrkey: "$",
  24598. charkey: "_",
  24599. explicitArray: true,
  24600. ignoreAttrs: false,
  24601. mergeAttrs: false,
  24602. explicitRoot: true,
  24603. validator: null,
  24604. xmlns: false,
  24605. explicitChildren: false,
  24606. preserveChildrenOrder: false,
  24607. childkey: '$$',
  24608. charsAsChildren: false,
  24609. includeWhiteChars: false,
  24610. async: false,
  24611. strict: true,
  24612. attrNameProcessors: null,
  24613. attrValueProcessors: null,
  24614. tagNameProcessors: null,
  24615. valueProcessors: null,
  24616. rootName: 'root',
  24617. xmldec: {
  24618. 'version': '1.0',
  24619. 'encoding': 'UTF-8',
  24620. 'standalone': true
  24621. },
  24622. doctype: null,
  24623. renderOpts: {
  24624. 'pretty': true,
  24625. 'indent': ' ',
  24626. 'newline': '\n'
  24627. },
  24628. headless: false,
  24629. chunkSize: 10000,
  24630. emptyTag: '',
  24631. cdata: false
  24632. }
  24633. };
  24634. }).call(this);
  24635. },{}],356:[function(require,module,exports){
  24636. // Generated by CoffeeScript 1.12.7
  24637. (function() {
  24638. "use strict";
  24639. var bom, defaults, events, isEmpty, processItem, processors, sax, setImmediate,
  24640. bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
  24641. extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
  24642. hasProp = {}.hasOwnProperty;
  24643. sax = require('sax');
  24644. events = require('events');
  24645. bom = require('./bom');
  24646. processors = require('./processors');
  24647. setImmediate = require('timers').setImmediate;
  24648. defaults = require('./defaults').defaults;
  24649. isEmpty = function(thing) {
  24650. return typeof thing === "object" && (thing != null) && Object.keys(thing).length === 0;
  24651. };
  24652. processItem = function(processors, item, key) {
  24653. var i, len, process;
  24654. for (i = 0, len = processors.length; i < len; i++) {
  24655. process = processors[i];
  24656. item = process(item, key);
  24657. }
  24658. return item;
  24659. };
  24660. exports.Parser = (function(superClass) {
  24661. extend(Parser, superClass);
  24662. function Parser(opts) {
  24663. this.parseStringPromise = bind(this.parseStringPromise, this);
  24664. this.parseString = bind(this.parseString, this);
  24665. this.reset = bind(this.reset, this);
  24666. this.assignOrPush = bind(this.assignOrPush, this);
  24667. this.processAsync = bind(this.processAsync, this);
  24668. var key, ref, value;
  24669. if (!(this instanceof exports.Parser)) {
  24670. return new exports.Parser(opts);
  24671. }
  24672. this.options = {};
  24673. ref = defaults["0.2"];
  24674. for (key in ref) {
  24675. if (!hasProp.call(ref, key)) continue;
  24676. value = ref[key];
  24677. this.options[key] = value;
  24678. }
  24679. for (key in opts) {
  24680. if (!hasProp.call(opts, key)) continue;
  24681. value = opts[key];
  24682. this.options[key] = value;
  24683. }
  24684. if (this.options.xmlns) {
  24685. this.options.xmlnskey = this.options.attrkey + "ns";
  24686. }
  24687. if (this.options.normalizeTags) {
  24688. if (!this.options.tagNameProcessors) {
  24689. this.options.tagNameProcessors = [];
  24690. }
  24691. this.options.tagNameProcessors.unshift(processors.normalize);
  24692. }
  24693. this.reset();
  24694. }
  24695. Parser.prototype.processAsync = function() {
  24696. var chunk, err;
  24697. try {
  24698. if (this.remaining.length <= this.options.chunkSize) {
  24699. chunk = this.remaining;
  24700. this.remaining = '';
  24701. this.saxParser = this.saxParser.write(chunk);
  24702. return this.saxParser.close();
  24703. } else {
  24704. chunk = this.remaining.substr(0, this.options.chunkSize);
  24705. this.remaining = this.remaining.substr(this.options.chunkSize, this.remaining.length);
  24706. this.saxParser = this.saxParser.write(chunk);
  24707. return setImmediate(this.processAsync);
  24708. }
  24709. } catch (error1) {
  24710. err = error1;
  24711. if (!this.saxParser.errThrown) {
  24712. this.saxParser.errThrown = true;
  24713. return this.emit(err);
  24714. }
  24715. }
  24716. };
  24717. Parser.prototype.assignOrPush = function(obj, key, newValue) {
  24718. if (!(key in obj)) {
  24719. if (!this.options.explicitArray) {
  24720. return obj[key] = newValue;
  24721. } else {
  24722. return obj[key] = [newValue];
  24723. }
  24724. } else {
  24725. if (!(obj[key] instanceof Array)) {
  24726. obj[key] = [obj[key]];
  24727. }
  24728. return obj[key].push(newValue);
  24729. }
  24730. };
  24731. Parser.prototype.reset = function() {
  24732. var attrkey, charkey, ontext, stack;
  24733. this.removeAllListeners();
  24734. this.saxParser = sax.parser(this.options.strict, {
  24735. trim: false,
  24736. normalize: false,
  24737. xmlns: this.options.xmlns
  24738. });
  24739. this.saxParser.errThrown = false;
  24740. this.saxParser.onerror = (function(_this) {
  24741. return function(error) {
  24742. _this.saxParser.resume();
  24743. if (!_this.saxParser.errThrown) {
  24744. _this.saxParser.errThrown = true;
  24745. return _this.emit("error", error);
  24746. }
  24747. };
  24748. })(this);
  24749. this.saxParser.onend = (function(_this) {
  24750. return function() {
  24751. if (!_this.saxParser.ended) {
  24752. _this.saxParser.ended = true;
  24753. return _this.emit("end", _this.resultObject);
  24754. }
  24755. };
  24756. })(this);
  24757. this.saxParser.ended = false;
  24758. this.EXPLICIT_CHARKEY = this.options.explicitCharkey;
  24759. this.resultObject = null;
  24760. stack = [];
  24761. attrkey = this.options.attrkey;
  24762. charkey = this.options.charkey;
  24763. this.saxParser.onopentag = (function(_this) {
  24764. return function(node) {
  24765. var key, newValue, obj, processedKey, ref;
  24766. obj = {};
  24767. obj[charkey] = "";
  24768. if (!_this.options.ignoreAttrs) {
  24769. ref = node.attributes;
  24770. for (key in ref) {
  24771. if (!hasProp.call(ref, key)) continue;
  24772. if (!(attrkey in obj) && !_this.options.mergeAttrs) {
  24773. obj[attrkey] = {};
  24774. }
  24775. newValue = _this.options.attrValueProcessors ? processItem(_this.options.attrValueProcessors, node.attributes[key], key) : node.attributes[key];
  24776. processedKey = _this.options.attrNameProcessors ? processItem(_this.options.attrNameProcessors, key) : key;
  24777. if (_this.options.mergeAttrs) {
  24778. _this.assignOrPush(obj, processedKey, newValue);
  24779. } else {
  24780. obj[attrkey][processedKey] = newValue;
  24781. }
  24782. }
  24783. }
  24784. obj["#name"] = _this.options.tagNameProcessors ? processItem(_this.options.tagNameProcessors, node.name) : node.name;
  24785. if (_this.options.xmlns) {
  24786. obj[_this.options.xmlnskey] = {
  24787. uri: node.uri,
  24788. local: node.local
  24789. };
  24790. }
  24791. return stack.push(obj);
  24792. };
  24793. })(this);
  24794. this.saxParser.onclosetag = (function(_this) {
  24795. return function() {
  24796. var cdata, emptyStr, key, node, nodeName, obj, objClone, old, s, xpath;
  24797. obj = stack.pop();
  24798. nodeName = obj["#name"];
  24799. if (!_this.options.explicitChildren || !_this.options.preserveChildrenOrder) {
  24800. delete obj["#name"];
  24801. }
  24802. if (obj.cdata === true) {
  24803. cdata = obj.cdata;
  24804. delete obj.cdata;
  24805. }
  24806. s = stack[stack.length - 1];
  24807. if (obj[charkey].match(/^\s*$/) && !cdata) {
  24808. emptyStr = obj[charkey];
  24809. delete obj[charkey];
  24810. } else {
  24811. if (_this.options.trim) {
  24812. obj[charkey] = obj[charkey].trim();
  24813. }
  24814. if (_this.options.normalize) {
  24815. obj[charkey] = obj[charkey].replace(/\s{2,}/g, " ").trim();
  24816. }
  24817. obj[charkey] = _this.options.valueProcessors ? processItem(_this.options.valueProcessors, obj[charkey], nodeName) : obj[charkey];
  24818. if (Object.keys(obj).length === 1 && charkey in obj && !_this.EXPLICIT_CHARKEY) {
  24819. obj = obj[charkey];
  24820. }
  24821. }
  24822. if (isEmpty(obj)) {
  24823. obj = _this.options.emptyTag !== '' ? _this.options.emptyTag : emptyStr;
  24824. }
  24825. if (_this.options.validator != null) {
  24826. xpath = "/" + ((function() {
  24827. var i, len, results;
  24828. results = [];
  24829. for (i = 0, len = stack.length; i < len; i++) {
  24830. node = stack[i];
  24831. results.push(node["#name"]);
  24832. }
  24833. return results;
  24834. })()).concat(nodeName).join("/");
  24835. (function() {
  24836. var err;
  24837. try {
  24838. return obj = _this.options.validator(xpath, s && s[nodeName], obj);
  24839. } catch (error1) {
  24840. err = error1;
  24841. return _this.emit("error", err);
  24842. }
  24843. })();
  24844. }
  24845. if (_this.options.explicitChildren && !_this.options.mergeAttrs && typeof obj === 'object') {
  24846. if (!_this.options.preserveChildrenOrder) {
  24847. node = {};
  24848. if (_this.options.attrkey in obj) {
  24849. node[_this.options.attrkey] = obj[_this.options.attrkey];
  24850. delete obj[_this.options.attrkey];
  24851. }
  24852. if (!_this.options.charsAsChildren && _this.options.charkey in obj) {
  24853. node[_this.options.charkey] = obj[_this.options.charkey];
  24854. delete obj[_this.options.charkey];
  24855. }
  24856. if (Object.getOwnPropertyNames(obj).length > 0) {
  24857. node[_this.options.childkey] = obj;
  24858. }
  24859. obj = node;
  24860. } else if (s) {
  24861. s[_this.options.childkey] = s[_this.options.childkey] || [];
  24862. objClone = {};
  24863. for (key in obj) {
  24864. if (!hasProp.call(obj, key)) continue;
  24865. objClone[key] = obj[key];
  24866. }
  24867. s[_this.options.childkey].push(objClone);
  24868. delete obj["#name"];
  24869. if (Object.keys(obj).length === 1 && charkey in obj && !_this.EXPLICIT_CHARKEY) {
  24870. obj = obj[charkey];
  24871. }
  24872. }
  24873. }
  24874. if (stack.length > 0) {
  24875. return _this.assignOrPush(s, nodeName, obj);
  24876. } else {
  24877. if (_this.options.explicitRoot) {
  24878. old = obj;
  24879. obj = {};
  24880. obj[nodeName] = old;
  24881. }
  24882. _this.resultObject = obj;
  24883. _this.saxParser.ended = true;
  24884. return _this.emit("end", _this.resultObject);
  24885. }
  24886. };
  24887. })(this);
  24888. ontext = (function(_this) {
  24889. return function(text) {
  24890. var charChild, s;
  24891. s = stack[stack.length - 1];
  24892. if (s) {
  24893. s[charkey] += text;
  24894. if (_this.options.explicitChildren && _this.options.preserveChildrenOrder && _this.options.charsAsChildren && (_this.options.includeWhiteChars || text.replace(/\\n/g, '').trim() !== '')) {
  24895. s[_this.options.childkey] = s[_this.options.childkey] || [];
  24896. charChild = {
  24897. '#name': '__text__'
  24898. };
  24899. charChild[charkey] = text;
  24900. if (_this.options.normalize) {
  24901. charChild[charkey] = charChild[charkey].replace(/\s{2,}/g, " ").trim();
  24902. }
  24903. s[_this.options.childkey].push(charChild);
  24904. }
  24905. return s;
  24906. }
  24907. };
  24908. })(this);
  24909. this.saxParser.ontext = ontext;
  24910. return this.saxParser.oncdata = (function(_this) {
  24911. return function(text) {
  24912. var s;
  24913. s = ontext(text);
  24914. if (s) {
  24915. return s.cdata = true;
  24916. }
  24917. };
  24918. })(this);
  24919. };
  24920. Parser.prototype.parseString = function(str, cb) {
  24921. var err;
  24922. if ((cb != null) && typeof cb === "function") {
  24923. this.on("end", function(result) {
  24924. this.reset();
  24925. return cb(null, result);
  24926. });
  24927. this.on("error", function(err) {
  24928. this.reset();
  24929. return cb(err);
  24930. });
  24931. }
  24932. try {
  24933. str = str.toString();
  24934. if (str.trim() === '') {
  24935. this.emit("end", null);
  24936. return true;
  24937. }
  24938. str = bom.stripBOM(str);
  24939. if (this.options.async) {
  24940. this.remaining = str;
  24941. setImmediate(this.processAsync);
  24942. return this.saxParser;
  24943. }
  24944. return this.saxParser.write(str).close();
  24945. } catch (error1) {
  24946. err = error1;
  24947. if (!(this.saxParser.errThrown || this.saxParser.ended)) {
  24948. this.emit('error', err);
  24949. return this.saxParser.errThrown = true;
  24950. } else if (this.saxParser.ended) {
  24951. throw err;
  24952. }
  24953. }
  24954. };
  24955. Parser.prototype.parseStringPromise = function(str) {
  24956. return new Promise((function(_this) {
  24957. return function(resolve, reject) {
  24958. return _this.parseString(str, function(err, value) {
  24959. if (err) {
  24960. return reject(err);
  24961. } else {
  24962. return resolve(value);
  24963. }
  24964. });
  24965. };
  24966. })(this));
  24967. };
  24968. return Parser;
  24969. })(events);
  24970. exports.parseString = function(str, a, b) {
  24971. var cb, options, parser;
  24972. if (b != null) {
  24973. if (typeof b === 'function') {
  24974. cb = b;
  24975. }
  24976. if (typeof a === 'object') {
  24977. options = a;
  24978. }
  24979. } else {
  24980. if (typeof a === 'function') {
  24981. cb = a;
  24982. }
  24983. options = {};
  24984. }
  24985. parser = new exports.Parser(options);
  24986. return parser.parseString(str, cb);
  24987. };
  24988. exports.parseStringPromise = function(str, a) {
  24989. var options, parser;
  24990. if (typeof a === 'object') {
  24991. options = a;
  24992. }
  24993. parser = new exports.Parser(options);
  24994. return parser.parseStringPromise(str);
  24995. };
  24996. }).call(this);
  24997. },{"./bom":353,"./defaults":355,"./processors":357,"events":301,"sax":344,"timers":347}],357:[function(require,module,exports){
  24998. // Generated by CoffeeScript 1.12.7
  24999. (function() {
  25000. "use strict";
  25001. var prefixMatch;
  25002. prefixMatch = new RegExp(/(?!xmlns)^.*:/);
  25003. exports.normalize = function(str) {
  25004. return str.toLowerCase();
  25005. };
  25006. exports.firstCharLowerCase = function(str) {
  25007. return str.charAt(0).toLowerCase() + str.slice(1);
  25008. };
  25009. exports.stripPrefix = function(str) {
  25010. return str.replace(prefixMatch, '');
  25011. };
  25012. exports.parseNumbers = function(str) {
  25013. if (!isNaN(str)) {
  25014. str = str % 1 === 0 ? parseInt(str, 10) : parseFloat(str);
  25015. }
  25016. return str;
  25017. };
  25018. exports.parseBooleans = function(str) {
  25019. if (/^(?:true|false)$/i.test(str)) {
  25020. str = str.toLowerCase() === 'true';
  25021. }
  25022. return str;
  25023. };
  25024. }).call(this);
  25025. },{}],358:[function(require,module,exports){
  25026. // Generated by CoffeeScript 1.12.7
  25027. (function() {
  25028. "use strict";
  25029. var builder, defaults, parser, processors,
  25030. extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
  25031. hasProp = {}.hasOwnProperty;
  25032. defaults = require('./defaults');
  25033. builder = require('./builder');
  25034. parser = require('./parser');
  25035. processors = require('./processors');
  25036. exports.defaults = defaults.defaults;
  25037. exports.processors = processors;
  25038. exports.ValidationError = (function(superClass) {
  25039. extend(ValidationError, superClass);
  25040. function ValidationError(message) {
  25041. this.message = message;
  25042. }
  25043. return ValidationError;
  25044. })(Error);
  25045. exports.Builder = builder.Builder;
  25046. exports.Parser = parser.Parser;
  25047. exports.parseString = parser.parseString;
  25048. exports.parseStringPromise = parser.parseStringPromise;
  25049. }).call(this);
  25050. },{"./builder":354,"./defaults":355,"./parser":356,"./processors":357}],359:[function(require,module,exports){
  25051. // Generated by CoffeeScript 1.12.7
  25052. (function() {
  25053. module.exports = {
  25054. Disconnected: 1,
  25055. Preceding: 2,
  25056. Following: 4,
  25057. Contains: 8,
  25058. ContainedBy: 16,
  25059. ImplementationSpecific: 32
  25060. };
  25061. }).call(this);
  25062. },{}],360:[function(require,module,exports){
  25063. // Generated by CoffeeScript 1.12.7
  25064. (function() {
  25065. module.exports = {
  25066. Element: 1,
  25067. Attribute: 2,
  25068. Text: 3,
  25069. CData: 4,
  25070. EntityReference: 5,
  25071. EntityDeclaration: 6,
  25072. ProcessingInstruction: 7,
  25073. Comment: 8,
  25074. Document: 9,
  25075. DocType: 10,
  25076. DocumentFragment: 11,
  25077. NotationDeclaration: 12,
  25078. Declaration: 201,
  25079. Raw: 202,
  25080. AttributeDeclaration: 203,
  25081. ElementDeclaration: 204,
  25082. Dummy: 205
  25083. };
  25084. }).call(this);
  25085. },{}],361:[function(require,module,exports){
  25086. // Generated by CoffeeScript 1.12.7
  25087. (function() {
  25088. var assign, getValue, isArray, isEmpty, isFunction, isObject, isPlainObject,
  25089. slice = [].slice,
  25090. hasProp = {}.hasOwnProperty;
  25091. assign = function() {
  25092. var i, key, len, source, sources, target;
  25093. target = arguments[0], sources = 2 <= arguments.length ? slice.call(arguments, 1) : [];
  25094. if (isFunction(Object.assign)) {
  25095. Object.assign.apply(null, arguments);
  25096. } else {
  25097. for (i = 0, len = sources.length; i < len; i++) {
  25098. source = sources[i];
  25099. if (source != null) {
  25100. for (key in source) {
  25101. if (!hasProp.call(source, key)) continue;
  25102. target[key] = source[key];
  25103. }
  25104. }
  25105. }
  25106. }
  25107. return target;
  25108. };
  25109. isFunction = function(val) {
  25110. return !!val && Object.prototype.toString.call(val) === '[object Function]';
  25111. };
  25112. isObject = function(val) {
  25113. var ref;
  25114. return !!val && ((ref = typeof val) === 'function' || ref === 'object');
  25115. };
  25116. isArray = function(val) {
  25117. if (isFunction(Array.isArray)) {
  25118. return Array.isArray(val);
  25119. } else {
  25120. return Object.prototype.toString.call(val) === '[object Array]';
  25121. }
  25122. };
  25123. isEmpty = function(val) {
  25124. var key;
  25125. if (isArray(val)) {
  25126. return !val.length;
  25127. } else {
  25128. for (key in val) {
  25129. if (!hasProp.call(val, key)) continue;
  25130. return false;
  25131. }
  25132. return true;
  25133. }
  25134. };
  25135. isPlainObject = function(val) {
  25136. var ctor, proto;
  25137. return isObject(val) && (proto = Object.getPrototypeOf(val)) && (ctor = proto.constructor) && (typeof ctor === 'function') && (ctor instanceof ctor) && (Function.prototype.toString.call(ctor) === Function.prototype.toString.call(Object));
  25138. };
  25139. getValue = function(obj) {
  25140. if (isFunction(obj.valueOf)) {
  25141. return obj.valueOf();
  25142. } else {
  25143. return obj;
  25144. }
  25145. };
  25146. module.exports.assign = assign;
  25147. module.exports.isFunction = isFunction;
  25148. module.exports.isObject = isObject;
  25149. module.exports.isArray = isArray;
  25150. module.exports.isEmpty = isEmpty;
  25151. module.exports.isPlainObject = isPlainObject;
  25152. module.exports.getValue = getValue;
  25153. }).call(this);
  25154. },{}],362:[function(require,module,exports){
  25155. // Generated by CoffeeScript 1.12.7
  25156. (function() {
  25157. module.exports = {
  25158. None: 0,
  25159. OpenTag: 1,
  25160. InsideTag: 2,
  25161. CloseTag: 3
  25162. };
  25163. }).call(this);
  25164. },{}],363:[function(require,module,exports){
  25165. // Generated by CoffeeScript 1.12.7
  25166. (function() {
  25167. var NodeType, XMLAttribute, XMLNode;
  25168. NodeType = require('./NodeType');
  25169. XMLNode = require('./XMLNode');
  25170. module.exports = XMLAttribute = (function() {
  25171. function XMLAttribute(parent, name, value) {
  25172. this.parent = parent;
  25173. if (this.parent) {
  25174. this.options = this.parent.options;
  25175. this.stringify = this.parent.stringify;
  25176. }
  25177. if (name == null) {
  25178. throw new Error("Missing attribute name. " + this.debugInfo(name));
  25179. }
  25180. this.name = this.stringify.name(name);
  25181. this.value = this.stringify.attValue(value);
  25182. this.type = NodeType.Attribute;
  25183. this.isId = false;
  25184. this.schemaTypeInfo = null;
  25185. }
  25186. Object.defineProperty(XMLAttribute.prototype, 'nodeType', {
  25187. get: function() {
  25188. return this.type;
  25189. }
  25190. });
  25191. Object.defineProperty(XMLAttribute.prototype, 'ownerElement', {
  25192. get: function() {
  25193. return this.parent;
  25194. }
  25195. });
  25196. Object.defineProperty(XMLAttribute.prototype, 'textContent', {
  25197. get: function() {
  25198. return this.value;
  25199. },
  25200. set: function(value) {
  25201. return this.value = value || '';
  25202. }
  25203. });
  25204. Object.defineProperty(XMLAttribute.prototype, 'namespaceURI', {
  25205. get: function() {
  25206. return '';
  25207. }
  25208. });
  25209. Object.defineProperty(XMLAttribute.prototype, 'prefix', {
  25210. get: function() {
  25211. return '';
  25212. }
  25213. });
  25214. Object.defineProperty(XMLAttribute.prototype, 'localName', {
  25215. get: function() {
  25216. return this.name;
  25217. }
  25218. });
  25219. Object.defineProperty(XMLAttribute.prototype, 'specified', {
  25220. get: function() {
  25221. return true;
  25222. }
  25223. });
  25224. XMLAttribute.prototype.clone = function() {
  25225. return Object.create(this);
  25226. };
  25227. XMLAttribute.prototype.toString = function(options) {
  25228. return this.options.writer.attribute(this, this.options.writer.filterOptions(options));
  25229. };
  25230. XMLAttribute.prototype.debugInfo = function(name) {
  25231. name = name || this.name;
  25232. if (name == null) {
  25233. return "parent: <" + this.parent.name + ">";
  25234. } else {
  25235. return "attribute: {" + name + "}, parent: <" + this.parent.name + ">";
  25236. }
  25237. };
  25238. XMLAttribute.prototype.isEqualNode = function(node) {
  25239. if (node.namespaceURI !== this.namespaceURI) {
  25240. return false;
  25241. }
  25242. if (node.prefix !== this.prefix) {
  25243. return false;
  25244. }
  25245. if (node.localName !== this.localName) {
  25246. return false;
  25247. }
  25248. if (node.value !== this.value) {
  25249. return false;
  25250. }
  25251. return true;
  25252. };
  25253. return XMLAttribute;
  25254. })();
  25255. }).call(this);
  25256. },{"./NodeType":360,"./XMLNode":382}],364:[function(require,module,exports){
  25257. // Generated by CoffeeScript 1.12.7
  25258. (function() {
  25259. var NodeType, XMLCData, XMLCharacterData,
  25260. extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
  25261. hasProp = {}.hasOwnProperty;
  25262. NodeType = require('./NodeType');
  25263. XMLCharacterData = require('./XMLCharacterData');
  25264. module.exports = XMLCData = (function(superClass) {
  25265. extend(XMLCData, superClass);
  25266. function XMLCData(parent, text) {
  25267. XMLCData.__super__.constructor.call(this, parent);
  25268. if (text == null) {
  25269. throw new Error("Missing CDATA text. " + this.debugInfo());
  25270. }
  25271. this.name = "#cdata-section";
  25272. this.type = NodeType.CData;
  25273. this.value = this.stringify.cdata(text);
  25274. }
  25275. XMLCData.prototype.clone = function() {
  25276. return Object.create(this);
  25277. };
  25278. XMLCData.prototype.toString = function(options) {
  25279. return this.options.writer.cdata(this, this.options.writer.filterOptions(options));
  25280. };
  25281. return XMLCData;
  25282. })(XMLCharacterData);
  25283. }).call(this);
  25284. },{"./NodeType":360,"./XMLCharacterData":365}],365:[function(require,module,exports){
  25285. // Generated by CoffeeScript 1.12.7
  25286. (function() {
  25287. var XMLCharacterData, XMLNode,
  25288. extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
  25289. hasProp = {}.hasOwnProperty;
  25290. XMLNode = require('./XMLNode');
  25291. module.exports = XMLCharacterData = (function(superClass) {
  25292. extend(XMLCharacterData, superClass);
  25293. function XMLCharacterData(parent) {
  25294. XMLCharacterData.__super__.constructor.call(this, parent);
  25295. this.value = '';
  25296. }
  25297. Object.defineProperty(XMLCharacterData.prototype, 'data', {
  25298. get: function() {
  25299. return this.value;
  25300. },
  25301. set: function(value) {
  25302. return this.value = value || '';
  25303. }
  25304. });
  25305. Object.defineProperty(XMLCharacterData.prototype, 'length', {
  25306. get: function() {
  25307. return this.value.length;
  25308. }
  25309. });
  25310. Object.defineProperty(XMLCharacterData.prototype, 'textContent', {
  25311. get: function() {
  25312. return this.value;
  25313. },
  25314. set: function(value) {
  25315. return this.value = value || '';
  25316. }
  25317. });
  25318. XMLCharacterData.prototype.clone = function() {
  25319. return Object.create(this);
  25320. };
  25321. XMLCharacterData.prototype.substringData = function(offset, count) {
  25322. throw new Error("This DOM method is not implemented." + this.debugInfo());
  25323. };
  25324. XMLCharacterData.prototype.appendData = function(arg) {
  25325. throw new Error("This DOM method is not implemented." + this.debugInfo());
  25326. };
  25327. XMLCharacterData.prototype.insertData = function(offset, arg) {
  25328. throw new Error("This DOM method is not implemented." + this.debugInfo());
  25329. };
  25330. XMLCharacterData.prototype.deleteData = function(offset, count) {
  25331. throw new Error("This DOM method is not implemented." + this.debugInfo());
  25332. };
  25333. XMLCharacterData.prototype.replaceData = function(offset, count, arg) {
  25334. throw new Error("This DOM method is not implemented." + this.debugInfo());
  25335. };
  25336. XMLCharacterData.prototype.isEqualNode = function(node) {
  25337. if (!XMLCharacterData.__super__.isEqualNode.apply(this, arguments).isEqualNode(node)) {
  25338. return false;
  25339. }
  25340. if (node.data !== this.data) {
  25341. return false;
  25342. }
  25343. return true;
  25344. };
  25345. return XMLCharacterData;
  25346. })(XMLNode);
  25347. }).call(this);
  25348. },{"./XMLNode":382}],366:[function(require,module,exports){
  25349. // Generated by CoffeeScript 1.12.7
  25350. (function() {
  25351. var NodeType, XMLCharacterData, XMLComment,
  25352. extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
  25353. hasProp = {}.hasOwnProperty;
  25354. NodeType = require('./NodeType');
  25355. XMLCharacterData = require('./XMLCharacterData');
  25356. module.exports = XMLComment = (function(superClass) {
  25357. extend(XMLComment, superClass);
  25358. function XMLComment(parent, text) {
  25359. XMLComment.__super__.constructor.call(this, parent);
  25360. if (text == null) {
  25361. throw new Error("Missing comment text. " + this.debugInfo());
  25362. }
  25363. this.name = "#comment";
  25364. this.type = NodeType.Comment;
  25365. this.value = this.stringify.comment(text);
  25366. }
  25367. XMLComment.prototype.clone = function() {
  25368. return Object.create(this);
  25369. };
  25370. XMLComment.prototype.toString = function(options) {
  25371. return this.options.writer.comment(this, this.options.writer.filterOptions(options));
  25372. };
  25373. return XMLComment;
  25374. })(XMLCharacterData);
  25375. }).call(this);
  25376. },{"./NodeType":360,"./XMLCharacterData":365}],367:[function(require,module,exports){
  25377. // Generated by CoffeeScript 1.12.7
  25378. (function() {
  25379. var XMLDOMConfiguration, XMLDOMErrorHandler, XMLDOMStringList;
  25380. XMLDOMErrorHandler = require('./XMLDOMErrorHandler');
  25381. XMLDOMStringList = require('./XMLDOMStringList');
  25382. module.exports = XMLDOMConfiguration = (function() {
  25383. function XMLDOMConfiguration() {
  25384. var clonedSelf;
  25385. this.defaultParams = {
  25386. "canonical-form": false,
  25387. "cdata-sections": false,
  25388. "comments": false,
  25389. "datatype-normalization": false,
  25390. "element-content-whitespace": true,
  25391. "entities": true,
  25392. "error-handler": new XMLDOMErrorHandler(),
  25393. "infoset": true,
  25394. "validate-if-schema": false,
  25395. "namespaces": true,
  25396. "namespace-declarations": true,
  25397. "normalize-characters": false,
  25398. "schema-location": '',
  25399. "schema-type": '',
  25400. "split-cdata-sections": true,
  25401. "validate": false,
  25402. "well-formed": true
  25403. };
  25404. this.params = clonedSelf = Object.create(this.defaultParams);
  25405. }
  25406. Object.defineProperty(XMLDOMConfiguration.prototype, 'parameterNames', {
  25407. get: function() {
  25408. return new XMLDOMStringList(Object.keys(this.defaultParams));
  25409. }
  25410. });
  25411. XMLDOMConfiguration.prototype.getParameter = function(name) {
  25412. if (this.params.hasOwnProperty(name)) {
  25413. return this.params[name];
  25414. } else {
  25415. return null;
  25416. }
  25417. };
  25418. XMLDOMConfiguration.prototype.canSetParameter = function(name, value) {
  25419. return true;
  25420. };
  25421. XMLDOMConfiguration.prototype.setParameter = function(name, value) {
  25422. if (value != null) {
  25423. return this.params[name] = value;
  25424. } else {
  25425. return delete this.params[name];
  25426. }
  25427. };
  25428. return XMLDOMConfiguration;
  25429. })();
  25430. }).call(this);
  25431. },{"./XMLDOMErrorHandler":368,"./XMLDOMStringList":370}],368:[function(require,module,exports){
  25432. // Generated by CoffeeScript 1.12.7
  25433. (function() {
  25434. var XMLDOMErrorHandler;
  25435. module.exports = XMLDOMErrorHandler = (function() {
  25436. function XMLDOMErrorHandler() {}
  25437. XMLDOMErrorHandler.prototype.handleError = function(error) {
  25438. throw new Error(error);
  25439. };
  25440. return XMLDOMErrorHandler;
  25441. })();
  25442. }).call(this);
  25443. },{}],369:[function(require,module,exports){
  25444. // Generated by CoffeeScript 1.12.7
  25445. (function() {
  25446. var XMLDOMImplementation;
  25447. module.exports = XMLDOMImplementation = (function() {
  25448. function XMLDOMImplementation() {}
  25449. XMLDOMImplementation.prototype.hasFeature = function(feature, version) {
  25450. return true;
  25451. };
  25452. XMLDOMImplementation.prototype.createDocumentType = function(qualifiedName, publicId, systemId) {
  25453. throw new Error("This DOM method is not implemented.");
  25454. };
  25455. XMLDOMImplementation.prototype.createDocument = function(namespaceURI, qualifiedName, doctype) {
  25456. throw new Error("This DOM method is not implemented.");
  25457. };
  25458. XMLDOMImplementation.prototype.createHTMLDocument = function(title) {
  25459. throw new Error("This DOM method is not implemented.");
  25460. };
  25461. XMLDOMImplementation.prototype.getFeature = function(feature, version) {
  25462. throw new Error("This DOM method is not implemented.");
  25463. };
  25464. return XMLDOMImplementation;
  25465. })();
  25466. }).call(this);
  25467. },{}],370:[function(require,module,exports){
  25468. // Generated by CoffeeScript 1.12.7
  25469. (function() {
  25470. var XMLDOMStringList;
  25471. module.exports = XMLDOMStringList = (function() {
  25472. function XMLDOMStringList(arr) {
  25473. this.arr = arr || [];
  25474. }
  25475. Object.defineProperty(XMLDOMStringList.prototype, 'length', {
  25476. get: function() {
  25477. return this.arr.length;
  25478. }
  25479. });
  25480. XMLDOMStringList.prototype.item = function(index) {
  25481. return this.arr[index] || null;
  25482. };
  25483. XMLDOMStringList.prototype.contains = function(str) {
  25484. return this.arr.indexOf(str) !== -1;
  25485. };
  25486. return XMLDOMStringList;
  25487. })();
  25488. }).call(this);
  25489. },{}],371:[function(require,module,exports){
  25490. // Generated by CoffeeScript 1.12.7
  25491. (function() {
  25492. var NodeType, XMLDTDAttList, XMLNode,
  25493. extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
  25494. hasProp = {}.hasOwnProperty;
  25495. XMLNode = require('./XMLNode');
  25496. NodeType = require('./NodeType');
  25497. module.exports = XMLDTDAttList = (function(superClass) {
  25498. extend(XMLDTDAttList, superClass);
  25499. function XMLDTDAttList(parent, elementName, attributeName, attributeType, defaultValueType, defaultValue) {
  25500. XMLDTDAttList.__super__.constructor.call(this, parent);
  25501. if (elementName == null) {
  25502. throw new Error("Missing DTD element name. " + this.debugInfo());
  25503. }
  25504. if (attributeName == null) {
  25505. throw new Error("Missing DTD attribute name. " + this.debugInfo(elementName));
  25506. }
  25507. if (!attributeType) {
  25508. throw new Error("Missing DTD attribute type. " + this.debugInfo(elementName));
  25509. }
  25510. if (!defaultValueType) {
  25511. throw new Error("Missing DTD attribute default. " + this.debugInfo(elementName));
  25512. }
  25513. if (defaultValueType.indexOf('#') !== 0) {
  25514. defaultValueType = '#' + defaultValueType;
  25515. }
  25516. if (!defaultValueType.match(/^(#REQUIRED|#IMPLIED|#FIXED|#DEFAULT)$/)) {
  25517. throw new Error("Invalid default value type; expected: #REQUIRED, #IMPLIED, #FIXED or #DEFAULT. " + this.debugInfo(elementName));
  25518. }
  25519. if (defaultValue && !defaultValueType.match(/^(#FIXED|#DEFAULT)$/)) {
  25520. throw new Error("Default value only applies to #FIXED or #DEFAULT. " + this.debugInfo(elementName));
  25521. }
  25522. this.elementName = this.stringify.name(elementName);
  25523. this.type = NodeType.AttributeDeclaration;
  25524. this.attributeName = this.stringify.name(attributeName);
  25525. this.attributeType = this.stringify.dtdAttType(attributeType);
  25526. if (defaultValue) {
  25527. this.defaultValue = this.stringify.dtdAttDefault(defaultValue);
  25528. }
  25529. this.defaultValueType = defaultValueType;
  25530. }
  25531. XMLDTDAttList.prototype.toString = function(options) {
  25532. return this.options.writer.dtdAttList(this, this.options.writer.filterOptions(options));
  25533. };
  25534. return XMLDTDAttList;
  25535. })(XMLNode);
  25536. }).call(this);
  25537. },{"./NodeType":360,"./XMLNode":382}],372:[function(require,module,exports){
  25538. // Generated by CoffeeScript 1.12.7
  25539. (function() {
  25540. var NodeType, XMLDTDElement, XMLNode,
  25541. extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
  25542. hasProp = {}.hasOwnProperty;
  25543. XMLNode = require('./XMLNode');
  25544. NodeType = require('./NodeType');
  25545. module.exports = XMLDTDElement = (function(superClass) {
  25546. extend(XMLDTDElement, superClass);
  25547. function XMLDTDElement(parent, name, value) {
  25548. XMLDTDElement.__super__.constructor.call(this, parent);
  25549. if (name == null) {
  25550. throw new Error("Missing DTD element name. " + this.debugInfo());
  25551. }
  25552. if (!value) {
  25553. value = '(#PCDATA)';
  25554. }
  25555. if (Array.isArray(value)) {
  25556. value = '(' + value.join(',') + ')';
  25557. }
  25558. this.name = this.stringify.name(name);
  25559. this.type = NodeType.ElementDeclaration;
  25560. this.value = this.stringify.dtdElementValue(value);
  25561. }
  25562. XMLDTDElement.prototype.toString = function(options) {
  25563. return this.options.writer.dtdElement(this, this.options.writer.filterOptions(options));
  25564. };
  25565. return XMLDTDElement;
  25566. })(XMLNode);
  25567. }).call(this);
  25568. },{"./NodeType":360,"./XMLNode":382}],373:[function(require,module,exports){
  25569. // Generated by CoffeeScript 1.12.7
  25570. (function() {
  25571. var NodeType, XMLDTDEntity, XMLNode, isObject,
  25572. extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
  25573. hasProp = {}.hasOwnProperty;
  25574. isObject = require('./Utility').isObject;
  25575. XMLNode = require('./XMLNode');
  25576. NodeType = require('./NodeType');
  25577. module.exports = XMLDTDEntity = (function(superClass) {
  25578. extend(XMLDTDEntity, superClass);
  25579. function XMLDTDEntity(parent, pe, name, value) {
  25580. XMLDTDEntity.__super__.constructor.call(this, parent);
  25581. if (name == null) {
  25582. throw new Error("Missing DTD entity name. " + this.debugInfo(name));
  25583. }
  25584. if (value == null) {
  25585. throw new Error("Missing DTD entity value. " + this.debugInfo(name));
  25586. }
  25587. this.pe = !!pe;
  25588. this.name = this.stringify.name(name);
  25589. this.type = NodeType.EntityDeclaration;
  25590. if (!isObject(value)) {
  25591. this.value = this.stringify.dtdEntityValue(value);
  25592. this.internal = true;
  25593. } else {
  25594. if (!value.pubID && !value.sysID) {
  25595. throw new Error("Public and/or system identifiers are required for an external entity. " + this.debugInfo(name));
  25596. }
  25597. if (value.pubID && !value.sysID) {
  25598. throw new Error("System identifier is required for a public external entity. " + this.debugInfo(name));
  25599. }
  25600. this.internal = false;
  25601. if (value.pubID != null) {
  25602. this.pubID = this.stringify.dtdPubID(value.pubID);
  25603. }
  25604. if (value.sysID != null) {
  25605. this.sysID = this.stringify.dtdSysID(value.sysID);
  25606. }
  25607. if (value.nData != null) {
  25608. this.nData = this.stringify.dtdNData(value.nData);
  25609. }
  25610. if (this.pe && this.nData) {
  25611. throw new Error("Notation declaration is not allowed in a parameter entity. " + this.debugInfo(name));
  25612. }
  25613. }
  25614. }
  25615. Object.defineProperty(XMLDTDEntity.prototype, 'publicId', {
  25616. get: function() {
  25617. return this.pubID;
  25618. }
  25619. });
  25620. Object.defineProperty(XMLDTDEntity.prototype, 'systemId', {
  25621. get: function() {
  25622. return this.sysID;
  25623. }
  25624. });
  25625. Object.defineProperty(XMLDTDEntity.prototype, 'notationName', {
  25626. get: function() {
  25627. return this.nData || null;
  25628. }
  25629. });
  25630. Object.defineProperty(XMLDTDEntity.prototype, 'inputEncoding', {
  25631. get: function() {
  25632. return null;
  25633. }
  25634. });
  25635. Object.defineProperty(XMLDTDEntity.prototype, 'xmlEncoding', {
  25636. get: function() {
  25637. return null;
  25638. }
  25639. });
  25640. Object.defineProperty(XMLDTDEntity.prototype, 'xmlVersion', {
  25641. get: function() {
  25642. return null;
  25643. }
  25644. });
  25645. XMLDTDEntity.prototype.toString = function(options) {
  25646. return this.options.writer.dtdEntity(this, this.options.writer.filterOptions(options));
  25647. };
  25648. return XMLDTDEntity;
  25649. })(XMLNode);
  25650. }).call(this);
  25651. },{"./NodeType":360,"./Utility":361,"./XMLNode":382}],374:[function(require,module,exports){
  25652. // Generated by CoffeeScript 1.12.7
  25653. (function() {
  25654. var NodeType, XMLDTDNotation, XMLNode,
  25655. extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
  25656. hasProp = {}.hasOwnProperty;
  25657. XMLNode = require('./XMLNode');
  25658. NodeType = require('./NodeType');
  25659. module.exports = XMLDTDNotation = (function(superClass) {
  25660. extend(XMLDTDNotation, superClass);
  25661. function XMLDTDNotation(parent, name, value) {
  25662. XMLDTDNotation.__super__.constructor.call(this, parent);
  25663. if (name == null) {
  25664. throw new Error("Missing DTD notation name. " + this.debugInfo(name));
  25665. }
  25666. if (!value.pubID && !value.sysID) {
  25667. throw new Error("Public or system identifiers are required for an external entity. " + this.debugInfo(name));
  25668. }
  25669. this.name = this.stringify.name(name);
  25670. this.type = NodeType.NotationDeclaration;
  25671. if (value.pubID != null) {
  25672. this.pubID = this.stringify.dtdPubID(value.pubID);
  25673. }
  25674. if (value.sysID != null) {
  25675. this.sysID = this.stringify.dtdSysID(value.sysID);
  25676. }
  25677. }
  25678. Object.defineProperty(XMLDTDNotation.prototype, 'publicId', {
  25679. get: function() {
  25680. return this.pubID;
  25681. }
  25682. });
  25683. Object.defineProperty(XMLDTDNotation.prototype, 'systemId', {
  25684. get: function() {
  25685. return this.sysID;
  25686. }
  25687. });
  25688. XMLDTDNotation.prototype.toString = function(options) {
  25689. return this.options.writer.dtdNotation(this, this.options.writer.filterOptions(options));
  25690. };
  25691. return XMLDTDNotation;
  25692. })(XMLNode);
  25693. }).call(this);
  25694. },{"./NodeType":360,"./XMLNode":382}],375:[function(require,module,exports){
  25695. // Generated by CoffeeScript 1.12.7
  25696. (function() {
  25697. var NodeType, XMLDeclaration, XMLNode, isObject,
  25698. extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
  25699. hasProp = {}.hasOwnProperty;
  25700. isObject = require('./Utility').isObject;
  25701. XMLNode = require('./XMLNode');
  25702. NodeType = require('./NodeType');
  25703. module.exports = XMLDeclaration = (function(superClass) {
  25704. extend(XMLDeclaration, superClass);
  25705. function XMLDeclaration(parent, version, encoding, standalone) {
  25706. var ref;
  25707. XMLDeclaration.__super__.constructor.call(this, parent);
  25708. if (isObject(version)) {
  25709. ref = version, version = ref.version, encoding = ref.encoding, standalone = ref.standalone;
  25710. }
  25711. if (!version) {
  25712. version = '1.0';
  25713. }
  25714. this.type = NodeType.Declaration;
  25715. this.version = this.stringify.xmlVersion(version);
  25716. if (encoding != null) {
  25717. this.encoding = this.stringify.xmlEncoding(encoding);
  25718. }
  25719. if (standalone != null) {
  25720. this.standalone = this.stringify.xmlStandalone(standalone);
  25721. }
  25722. }
  25723. XMLDeclaration.prototype.toString = function(options) {
  25724. return this.options.writer.declaration(this, this.options.writer.filterOptions(options));
  25725. };
  25726. return XMLDeclaration;
  25727. })(XMLNode);
  25728. }).call(this);
  25729. },{"./NodeType":360,"./Utility":361,"./XMLNode":382}],376:[function(require,module,exports){
  25730. // Generated by CoffeeScript 1.12.7
  25731. (function() {
  25732. var NodeType, XMLDTDAttList, XMLDTDElement, XMLDTDEntity, XMLDTDNotation, XMLDocType, XMLNamedNodeMap, XMLNode, isObject,
  25733. extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
  25734. hasProp = {}.hasOwnProperty;
  25735. isObject = require('./Utility').isObject;
  25736. XMLNode = require('./XMLNode');
  25737. NodeType = require('./NodeType');
  25738. XMLDTDAttList = require('./XMLDTDAttList');
  25739. XMLDTDEntity = require('./XMLDTDEntity');
  25740. XMLDTDElement = require('./XMLDTDElement');
  25741. XMLDTDNotation = require('./XMLDTDNotation');
  25742. XMLNamedNodeMap = require('./XMLNamedNodeMap');
  25743. module.exports = XMLDocType = (function(superClass) {
  25744. extend(XMLDocType, superClass);
  25745. function XMLDocType(parent, pubID, sysID) {
  25746. var child, i, len, ref, ref1, ref2;
  25747. XMLDocType.__super__.constructor.call(this, parent);
  25748. this.type = NodeType.DocType;
  25749. if (parent.children) {
  25750. ref = parent.children;
  25751. for (i = 0, len = ref.length; i < len; i++) {
  25752. child = ref[i];
  25753. if (child.type === NodeType.Element) {
  25754. this.name = child.name;
  25755. break;
  25756. }
  25757. }
  25758. }
  25759. this.documentObject = parent;
  25760. if (isObject(pubID)) {
  25761. ref1 = pubID, pubID = ref1.pubID, sysID = ref1.sysID;
  25762. }
  25763. if (sysID == null) {
  25764. ref2 = [pubID, sysID], sysID = ref2[0], pubID = ref2[1];
  25765. }
  25766. if (pubID != null) {
  25767. this.pubID = this.stringify.dtdPubID(pubID);
  25768. }
  25769. if (sysID != null) {
  25770. this.sysID = this.stringify.dtdSysID(sysID);
  25771. }
  25772. }
  25773. Object.defineProperty(XMLDocType.prototype, 'entities', {
  25774. get: function() {
  25775. var child, i, len, nodes, ref;
  25776. nodes = {};
  25777. ref = this.children;
  25778. for (i = 0, len = ref.length; i < len; i++) {
  25779. child = ref[i];
  25780. if ((child.type === NodeType.EntityDeclaration) && !child.pe) {
  25781. nodes[child.name] = child;
  25782. }
  25783. }
  25784. return new XMLNamedNodeMap(nodes);
  25785. }
  25786. });
  25787. Object.defineProperty(XMLDocType.prototype, 'notations', {
  25788. get: function() {
  25789. var child, i, len, nodes, ref;
  25790. nodes = {};
  25791. ref = this.children;
  25792. for (i = 0, len = ref.length; i < len; i++) {
  25793. child = ref[i];
  25794. if (child.type === NodeType.NotationDeclaration) {
  25795. nodes[child.name] = child;
  25796. }
  25797. }
  25798. return new XMLNamedNodeMap(nodes);
  25799. }
  25800. });
  25801. Object.defineProperty(XMLDocType.prototype, 'publicId', {
  25802. get: function() {
  25803. return this.pubID;
  25804. }
  25805. });
  25806. Object.defineProperty(XMLDocType.prototype, 'systemId', {
  25807. get: function() {
  25808. return this.sysID;
  25809. }
  25810. });
  25811. Object.defineProperty(XMLDocType.prototype, 'internalSubset', {
  25812. get: function() {
  25813. throw new Error("This DOM method is not implemented." + this.debugInfo());
  25814. }
  25815. });
  25816. XMLDocType.prototype.element = function(name, value) {
  25817. var child;
  25818. child = new XMLDTDElement(this, name, value);
  25819. this.children.push(child);
  25820. return this;
  25821. };
  25822. XMLDocType.prototype.attList = function(elementName, attributeName, attributeType, defaultValueType, defaultValue) {
  25823. var child;
  25824. child = new XMLDTDAttList(this, elementName, attributeName, attributeType, defaultValueType, defaultValue);
  25825. this.children.push(child);
  25826. return this;
  25827. };
  25828. XMLDocType.prototype.entity = function(name, value) {
  25829. var child;
  25830. child = new XMLDTDEntity(this, false, name, value);
  25831. this.children.push(child);
  25832. return this;
  25833. };
  25834. XMLDocType.prototype.pEntity = function(name, value) {
  25835. var child;
  25836. child = new XMLDTDEntity(this, true, name, value);
  25837. this.children.push(child);
  25838. return this;
  25839. };
  25840. XMLDocType.prototype.notation = function(name, value) {
  25841. var child;
  25842. child = new XMLDTDNotation(this, name, value);
  25843. this.children.push(child);
  25844. return this;
  25845. };
  25846. XMLDocType.prototype.toString = function(options) {
  25847. return this.options.writer.docType(this, this.options.writer.filterOptions(options));
  25848. };
  25849. XMLDocType.prototype.ele = function(name, value) {
  25850. return this.element(name, value);
  25851. };
  25852. XMLDocType.prototype.att = function(elementName, attributeName, attributeType, defaultValueType, defaultValue) {
  25853. return this.attList(elementName, attributeName, attributeType, defaultValueType, defaultValue);
  25854. };
  25855. XMLDocType.prototype.ent = function(name, value) {
  25856. return this.entity(name, value);
  25857. };
  25858. XMLDocType.prototype.pent = function(name, value) {
  25859. return this.pEntity(name, value);
  25860. };
  25861. XMLDocType.prototype.not = function(name, value) {
  25862. return this.notation(name, value);
  25863. };
  25864. XMLDocType.prototype.up = function() {
  25865. return this.root() || this.documentObject;
  25866. };
  25867. XMLDocType.prototype.isEqualNode = function(node) {
  25868. if (!XMLDocType.__super__.isEqualNode.apply(this, arguments).isEqualNode(node)) {
  25869. return false;
  25870. }
  25871. if (node.name !== this.name) {
  25872. return false;
  25873. }
  25874. if (node.publicId !== this.publicId) {
  25875. return false;
  25876. }
  25877. if (node.systemId !== this.systemId) {
  25878. return false;
  25879. }
  25880. return true;
  25881. };
  25882. return XMLDocType;
  25883. })(XMLNode);
  25884. }).call(this);
  25885. },{"./NodeType":360,"./Utility":361,"./XMLDTDAttList":371,"./XMLDTDElement":372,"./XMLDTDEntity":373,"./XMLDTDNotation":374,"./XMLNamedNodeMap":381,"./XMLNode":382}],377:[function(require,module,exports){
  25886. // Generated by CoffeeScript 1.12.7
  25887. (function() {
  25888. var NodeType, XMLDOMConfiguration, XMLDOMImplementation, XMLDocument, XMLNode, XMLStringWriter, XMLStringifier, isPlainObject,
  25889. extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
  25890. hasProp = {}.hasOwnProperty;
  25891. isPlainObject = require('./Utility').isPlainObject;
  25892. XMLDOMImplementation = require('./XMLDOMImplementation');
  25893. XMLDOMConfiguration = require('./XMLDOMConfiguration');
  25894. XMLNode = require('./XMLNode');
  25895. NodeType = require('./NodeType');
  25896. XMLStringifier = require('./XMLStringifier');
  25897. XMLStringWriter = require('./XMLStringWriter');
  25898. module.exports = XMLDocument = (function(superClass) {
  25899. extend(XMLDocument, superClass);
  25900. function XMLDocument(options) {
  25901. XMLDocument.__super__.constructor.call(this, null);
  25902. this.name = "#document";
  25903. this.type = NodeType.Document;
  25904. this.documentURI = null;
  25905. this.domConfig = new XMLDOMConfiguration();
  25906. options || (options = {});
  25907. if (!options.writer) {
  25908. options.writer = new XMLStringWriter();
  25909. }
  25910. this.options = options;
  25911. this.stringify = new XMLStringifier(options);
  25912. }
  25913. Object.defineProperty(XMLDocument.prototype, 'implementation', {
  25914. value: new XMLDOMImplementation()
  25915. });
  25916. Object.defineProperty(XMLDocument.prototype, 'doctype', {
  25917. get: function() {
  25918. var child, i, len, ref;
  25919. ref = this.children;
  25920. for (i = 0, len = ref.length; i < len; i++) {
  25921. child = ref[i];
  25922. if (child.type === NodeType.DocType) {
  25923. return child;
  25924. }
  25925. }
  25926. return null;
  25927. }
  25928. });
  25929. Object.defineProperty(XMLDocument.prototype, 'documentElement', {
  25930. get: function() {
  25931. return this.rootObject || null;
  25932. }
  25933. });
  25934. Object.defineProperty(XMLDocument.prototype, 'inputEncoding', {
  25935. get: function() {
  25936. return null;
  25937. }
  25938. });
  25939. Object.defineProperty(XMLDocument.prototype, 'strictErrorChecking', {
  25940. get: function() {
  25941. return false;
  25942. }
  25943. });
  25944. Object.defineProperty(XMLDocument.prototype, 'xmlEncoding', {
  25945. get: function() {
  25946. if (this.children.length !== 0 && this.children[0].type === NodeType.Declaration) {
  25947. return this.children[0].encoding;
  25948. } else {
  25949. return null;
  25950. }
  25951. }
  25952. });
  25953. Object.defineProperty(XMLDocument.prototype, 'xmlStandalone', {
  25954. get: function() {
  25955. if (this.children.length !== 0 && this.children[0].type === NodeType.Declaration) {
  25956. return this.children[0].standalone === 'yes';
  25957. } else {
  25958. return false;
  25959. }
  25960. }
  25961. });
  25962. Object.defineProperty(XMLDocument.prototype, 'xmlVersion', {
  25963. get: function() {
  25964. if (this.children.length !== 0 && this.children[0].type === NodeType.Declaration) {
  25965. return this.children[0].version;
  25966. } else {
  25967. return "1.0";
  25968. }
  25969. }
  25970. });
  25971. Object.defineProperty(XMLDocument.prototype, 'URL', {
  25972. get: function() {
  25973. return this.documentURI;
  25974. }
  25975. });
  25976. Object.defineProperty(XMLDocument.prototype, 'origin', {
  25977. get: function() {
  25978. return null;
  25979. }
  25980. });
  25981. Object.defineProperty(XMLDocument.prototype, 'compatMode', {
  25982. get: function() {
  25983. return null;
  25984. }
  25985. });
  25986. Object.defineProperty(XMLDocument.prototype, 'characterSet', {
  25987. get: function() {
  25988. return null;
  25989. }
  25990. });
  25991. Object.defineProperty(XMLDocument.prototype, 'contentType', {
  25992. get: function() {
  25993. return null;
  25994. }
  25995. });
  25996. XMLDocument.prototype.end = function(writer) {
  25997. var writerOptions;
  25998. writerOptions = {};
  25999. if (!writer) {
  26000. writer = this.options.writer;
  26001. } else if (isPlainObject(writer)) {
  26002. writerOptions = writer;
  26003. writer = this.options.writer;
  26004. }
  26005. return writer.document(this, writer.filterOptions(writerOptions));
  26006. };
  26007. XMLDocument.prototype.toString = function(options) {
  26008. return this.options.writer.document(this, this.options.writer.filterOptions(options));
  26009. };
  26010. XMLDocument.prototype.createElement = function(tagName) {
  26011. throw new Error("This DOM method is not implemented." + this.debugInfo());
  26012. };
  26013. XMLDocument.prototype.createDocumentFragment = function() {
  26014. throw new Error("This DOM method is not implemented." + this.debugInfo());
  26015. };
  26016. XMLDocument.prototype.createTextNode = function(data) {
  26017. throw new Error("This DOM method is not implemented." + this.debugInfo());
  26018. };
  26019. XMLDocument.prototype.createComment = function(data) {
  26020. throw new Error("This DOM method is not implemented." + this.debugInfo());
  26021. };
  26022. XMLDocument.prototype.createCDATASection = function(data) {
  26023. throw new Error("This DOM method is not implemented." + this.debugInfo());
  26024. };
  26025. XMLDocument.prototype.createProcessingInstruction = function(target, data) {
  26026. throw new Error("This DOM method is not implemented." + this.debugInfo());
  26027. };
  26028. XMLDocument.prototype.createAttribute = function(name) {
  26029. throw new Error("This DOM method is not implemented." + this.debugInfo());
  26030. };
  26031. XMLDocument.prototype.createEntityReference = function(name) {
  26032. throw new Error("This DOM method is not implemented." + this.debugInfo());
  26033. };
  26034. XMLDocument.prototype.getElementsByTagName = function(tagname) {
  26035. throw new Error("This DOM method is not implemented." + this.debugInfo());
  26036. };
  26037. XMLDocument.prototype.importNode = function(importedNode, deep) {
  26038. throw new Error("This DOM method is not implemented." + this.debugInfo());
  26039. };
  26040. XMLDocument.prototype.createElementNS = function(namespaceURI, qualifiedName) {
  26041. throw new Error("This DOM method is not implemented." + this.debugInfo());
  26042. };
  26043. XMLDocument.prototype.createAttributeNS = function(namespaceURI, qualifiedName) {
  26044. throw new Error("This DOM method is not implemented." + this.debugInfo());
  26045. };
  26046. XMLDocument.prototype.getElementsByTagNameNS = function(namespaceURI, localName) {
  26047. throw new Error("This DOM method is not implemented." + this.debugInfo());
  26048. };
  26049. XMLDocument.prototype.getElementById = function(elementId) {
  26050. throw new Error("This DOM method is not implemented." + this.debugInfo());
  26051. };
  26052. XMLDocument.prototype.adoptNode = function(source) {
  26053. throw new Error("This DOM method is not implemented." + this.debugInfo());
  26054. };
  26055. XMLDocument.prototype.normalizeDocument = function() {
  26056. throw new Error("This DOM method is not implemented." + this.debugInfo());
  26057. };
  26058. XMLDocument.prototype.renameNode = function(node, namespaceURI, qualifiedName) {
  26059. throw new Error("This DOM method is not implemented." + this.debugInfo());
  26060. };
  26061. XMLDocument.prototype.getElementsByClassName = function(classNames) {
  26062. throw new Error("This DOM method is not implemented." + this.debugInfo());
  26063. };
  26064. XMLDocument.prototype.createEvent = function(eventInterface) {
  26065. throw new Error("This DOM method is not implemented." + this.debugInfo());
  26066. };
  26067. XMLDocument.prototype.createRange = function() {
  26068. throw new Error("This DOM method is not implemented." + this.debugInfo());
  26069. };
  26070. XMLDocument.prototype.createNodeIterator = function(root, whatToShow, filter) {
  26071. throw new Error("This DOM method is not implemented." + this.debugInfo());
  26072. };
  26073. XMLDocument.prototype.createTreeWalker = function(root, whatToShow, filter) {
  26074. throw new Error("This DOM method is not implemented." + this.debugInfo());
  26075. };
  26076. return XMLDocument;
  26077. })(XMLNode);
  26078. }).call(this);
  26079. },{"./NodeType":360,"./Utility":361,"./XMLDOMConfiguration":367,"./XMLDOMImplementation":369,"./XMLNode":382,"./XMLStringWriter":387,"./XMLStringifier":388}],378:[function(require,module,exports){
  26080. // Generated by CoffeeScript 1.12.7
  26081. (function() {
  26082. var NodeType, WriterState, XMLAttribute, XMLCData, XMLComment, XMLDTDAttList, XMLDTDElement, XMLDTDEntity, XMLDTDNotation, XMLDeclaration, XMLDocType, XMLDocument, XMLDocumentCB, XMLElement, XMLProcessingInstruction, XMLRaw, XMLStringWriter, XMLStringifier, XMLText, getValue, isFunction, isObject, isPlainObject, ref,
  26083. hasProp = {}.hasOwnProperty;
  26084. ref = require('./Utility'), isObject = ref.isObject, isFunction = ref.isFunction, isPlainObject = ref.isPlainObject, getValue = ref.getValue;
  26085. NodeType = require('./NodeType');
  26086. XMLDocument = require('./XMLDocument');
  26087. XMLElement = require('./XMLElement');
  26088. XMLCData = require('./XMLCData');
  26089. XMLComment = require('./XMLComment');
  26090. XMLRaw = require('./XMLRaw');
  26091. XMLText = require('./XMLText');
  26092. XMLProcessingInstruction = require('./XMLProcessingInstruction');
  26093. XMLDeclaration = require('./XMLDeclaration');
  26094. XMLDocType = require('./XMLDocType');
  26095. XMLDTDAttList = require('./XMLDTDAttList');
  26096. XMLDTDEntity = require('./XMLDTDEntity');
  26097. XMLDTDElement = require('./XMLDTDElement');
  26098. XMLDTDNotation = require('./XMLDTDNotation');
  26099. XMLAttribute = require('./XMLAttribute');
  26100. XMLStringifier = require('./XMLStringifier');
  26101. XMLStringWriter = require('./XMLStringWriter');
  26102. WriterState = require('./WriterState');
  26103. module.exports = XMLDocumentCB = (function() {
  26104. function XMLDocumentCB(options, onData, onEnd) {
  26105. var writerOptions;
  26106. this.name = "?xml";
  26107. this.type = NodeType.Document;
  26108. options || (options = {});
  26109. writerOptions = {};
  26110. if (!options.writer) {
  26111. options.writer = new XMLStringWriter();
  26112. } else if (isPlainObject(options.writer)) {
  26113. writerOptions = options.writer;
  26114. options.writer = new XMLStringWriter();
  26115. }
  26116. this.options = options;
  26117. this.writer = options.writer;
  26118. this.writerOptions = this.writer.filterOptions(writerOptions);
  26119. this.stringify = new XMLStringifier(options);
  26120. this.onDataCallback = onData || function() {};
  26121. this.onEndCallback = onEnd || function() {};
  26122. this.currentNode = null;
  26123. this.currentLevel = -1;
  26124. this.openTags = {};
  26125. this.documentStarted = false;
  26126. this.documentCompleted = false;
  26127. this.root = null;
  26128. }
  26129. XMLDocumentCB.prototype.createChildNode = function(node) {
  26130. var att, attName, attributes, child, i, len, ref1, ref2;
  26131. switch (node.type) {
  26132. case NodeType.CData:
  26133. this.cdata(node.value);
  26134. break;
  26135. case NodeType.Comment:
  26136. this.comment(node.value);
  26137. break;
  26138. case NodeType.Element:
  26139. attributes = {};
  26140. ref1 = node.attribs;
  26141. for (attName in ref1) {
  26142. if (!hasProp.call(ref1, attName)) continue;
  26143. att = ref1[attName];
  26144. attributes[attName] = att.value;
  26145. }
  26146. this.node(node.name, attributes);
  26147. break;
  26148. case NodeType.Dummy:
  26149. this.dummy();
  26150. break;
  26151. case NodeType.Raw:
  26152. this.raw(node.value);
  26153. break;
  26154. case NodeType.Text:
  26155. this.text(node.value);
  26156. break;
  26157. case NodeType.ProcessingInstruction:
  26158. this.instruction(node.target, node.value);
  26159. break;
  26160. default:
  26161. throw new Error("This XML node type is not supported in a JS object: " + node.constructor.name);
  26162. }
  26163. ref2 = node.children;
  26164. for (i = 0, len = ref2.length; i < len; i++) {
  26165. child = ref2[i];
  26166. this.createChildNode(child);
  26167. if (child.type === NodeType.Element) {
  26168. this.up();
  26169. }
  26170. }
  26171. return this;
  26172. };
  26173. XMLDocumentCB.prototype.dummy = function() {
  26174. return this;
  26175. };
  26176. XMLDocumentCB.prototype.node = function(name, attributes, text) {
  26177. var ref1;
  26178. if (name == null) {
  26179. throw new Error("Missing node name.");
  26180. }
  26181. if (this.root && this.currentLevel === -1) {
  26182. throw new Error("Document can only have one root node. " + this.debugInfo(name));
  26183. }
  26184. this.openCurrent();
  26185. name = getValue(name);
  26186. if (attributes == null) {
  26187. attributes = {};
  26188. }
  26189. attributes = getValue(attributes);
  26190. if (!isObject(attributes)) {
  26191. ref1 = [attributes, text], text = ref1[0], attributes = ref1[1];
  26192. }
  26193. this.currentNode = new XMLElement(this, name, attributes);
  26194. this.currentNode.children = false;
  26195. this.currentLevel++;
  26196. this.openTags[this.currentLevel] = this.currentNode;
  26197. if (text != null) {
  26198. this.text(text);
  26199. }
  26200. return this;
  26201. };
  26202. XMLDocumentCB.prototype.element = function(name, attributes, text) {
  26203. var child, i, len, oldValidationFlag, ref1, root;
  26204. if (this.currentNode && this.currentNode.type === NodeType.DocType) {
  26205. this.dtdElement.apply(this, arguments);
  26206. } else {
  26207. if (Array.isArray(name) || isObject(name) || isFunction(name)) {
  26208. oldValidationFlag = this.options.noValidation;
  26209. this.options.noValidation = true;
  26210. root = new XMLDocument(this.options).element('TEMP_ROOT');
  26211. root.element(name);
  26212. this.options.noValidation = oldValidationFlag;
  26213. ref1 = root.children;
  26214. for (i = 0, len = ref1.length; i < len; i++) {
  26215. child = ref1[i];
  26216. this.createChildNode(child);
  26217. if (child.type === NodeType.Element) {
  26218. this.up();
  26219. }
  26220. }
  26221. } else {
  26222. this.node(name, attributes, text);
  26223. }
  26224. }
  26225. return this;
  26226. };
  26227. XMLDocumentCB.prototype.attribute = function(name, value) {
  26228. var attName, attValue;
  26229. if (!this.currentNode || this.currentNode.children) {
  26230. throw new Error("att() can only be used immediately after an ele() call in callback mode. " + this.debugInfo(name));
  26231. }
  26232. if (name != null) {
  26233. name = getValue(name);
  26234. }
  26235. if (isObject(name)) {
  26236. for (attName in name) {
  26237. if (!hasProp.call(name, attName)) continue;
  26238. attValue = name[attName];
  26239. this.attribute(attName, attValue);
  26240. }
  26241. } else {
  26242. if (isFunction(value)) {
  26243. value = value.apply();
  26244. }
  26245. if (this.options.keepNullAttributes && (value == null)) {
  26246. this.currentNode.attribs[name] = new XMLAttribute(this, name, "");
  26247. } else if (value != null) {
  26248. this.currentNode.attribs[name] = new XMLAttribute(this, name, value);
  26249. }
  26250. }
  26251. return this;
  26252. };
  26253. XMLDocumentCB.prototype.text = function(value) {
  26254. var node;
  26255. this.openCurrent();
  26256. node = new XMLText(this, value);
  26257. this.onData(this.writer.text(node, this.writerOptions, this.currentLevel + 1), this.currentLevel + 1);
  26258. return this;
  26259. };
  26260. XMLDocumentCB.prototype.cdata = function(value) {
  26261. var node;
  26262. this.openCurrent();
  26263. node = new XMLCData(this, value);
  26264. this.onData(this.writer.cdata(node, this.writerOptions, this.currentLevel + 1), this.currentLevel + 1);
  26265. return this;
  26266. };
  26267. XMLDocumentCB.prototype.comment = function(value) {
  26268. var node;
  26269. this.openCurrent();
  26270. node = new XMLComment(this, value);
  26271. this.onData(this.writer.comment(node, this.writerOptions, this.currentLevel + 1), this.currentLevel + 1);
  26272. return this;
  26273. };
  26274. XMLDocumentCB.prototype.raw = function(value) {
  26275. var node;
  26276. this.openCurrent();
  26277. node = new XMLRaw(this, value);
  26278. this.onData(this.writer.raw(node, this.writerOptions, this.currentLevel + 1), this.currentLevel + 1);
  26279. return this;
  26280. };
  26281. XMLDocumentCB.prototype.instruction = function(target, value) {
  26282. var i, insTarget, insValue, len, node;
  26283. this.openCurrent();
  26284. if (target != null) {
  26285. target = getValue(target);
  26286. }
  26287. if (value != null) {
  26288. value = getValue(value);
  26289. }
  26290. if (Array.isArray(target)) {
  26291. for (i = 0, len = target.length; i < len; i++) {
  26292. insTarget = target[i];
  26293. this.instruction(insTarget);
  26294. }
  26295. } else if (isObject(target)) {
  26296. for (insTarget in target) {
  26297. if (!hasProp.call(target, insTarget)) continue;
  26298. insValue = target[insTarget];
  26299. this.instruction(insTarget, insValue);
  26300. }
  26301. } else {
  26302. if (isFunction(value)) {
  26303. value = value.apply();
  26304. }
  26305. node = new XMLProcessingInstruction(this, target, value);
  26306. this.onData(this.writer.processingInstruction(node, this.writerOptions, this.currentLevel + 1), this.currentLevel + 1);
  26307. }
  26308. return this;
  26309. };
  26310. XMLDocumentCB.prototype.declaration = function(version, encoding, standalone) {
  26311. var node;
  26312. this.openCurrent();
  26313. if (this.documentStarted) {
  26314. throw new Error("declaration() must be the first node.");
  26315. }
  26316. node = new XMLDeclaration(this, version, encoding, standalone);
  26317. this.onData(this.writer.declaration(node, this.writerOptions, this.currentLevel + 1), this.currentLevel + 1);
  26318. return this;
  26319. };
  26320. XMLDocumentCB.prototype.doctype = function(root, pubID, sysID) {
  26321. this.openCurrent();
  26322. if (root == null) {
  26323. throw new Error("Missing root node name.");
  26324. }
  26325. if (this.root) {
  26326. throw new Error("dtd() must come before the root node.");
  26327. }
  26328. this.currentNode = new XMLDocType(this, pubID, sysID);
  26329. this.currentNode.rootNodeName = root;
  26330. this.currentNode.children = false;
  26331. this.currentLevel++;
  26332. this.openTags[this.currentLevel] = this.currentNode;
  26333. return this;
  26334. };
  26335. XMLDocumentCB.prototype.dtdElement = function(name, value) {
  26336. var node;
  26337. this.openCurrent();
  26338. node = new XMLDTDElement(this, name, value);
  26339. this.onData(this.writer.dtdElement(node, this.writerOptions, this.currentLevel + 1), this.currentLevel + 1);
  26340. return this;
  26341. };
  26342. XMLDocumentCB.prototype.attList = function(elementName, attributeName, attributeType, defaultValueType, defaultValue) {
  26343. var node;
  26344. this.openCurrent();
  26345. node = new XMLDTDAttList(this, elementName, attributeName, attributeType, defaultValueType, defaultValue);
  26346. this.onData(this.writer.dtdAttList(node, this.writerOptions, this.currentLevel + 1), this.currentLevel + 1);
  26347. return this;
  26348. };
  26349. XMLDocumentCB.prototype.entity = function(name, value) {
  26350. var node;
  26351. this.openCurrent();
  26352. node = new XMLDTDEntity(this, false, name, value);
  26353. this.onData(this.writer.dtdEntity(node, this.writerOptions, this.currentLevel + 1), this.currentLevel + 1);
  26354. return this;
  26355. };
  26356. XMLDocumentCB.prototype.pEntity = function(name, value) {
  26357. var node;
  26358. this.openCurrent();
  26359. node = new XMLDTDEntity(this, true, name, value);
  26360. this.onData(this.writer.dtdEntity(node, this.writerOptions, this.currentLevel + 1), this.currentLevel + 1);
  26361. return this;
  26362. };
  26363. XMLDocumentCB.prototype.notation = function(name, value) {
  26364. var node;
  26365. this.openCurrent();
  26366. node = new XMLDTDNotation(this, name, value);
  26367. this.onData(this.writer.dtdNotation(node, this.writerOptions, this.currentLevel + 1), this.currentLevel + 1);
  26368. return this;
  26369. };
  26370. XMLDocumentCB.prototype.up = function() {
  26371. if (this.currentLevel < 0) {
  26372. throw new Error("The document node has no parent.");
  26373. }
  26374. if (this.currentNode) {
  26375. if (this.currentNode.children) {
  26376. this.closeNode(this.currentNode);
  26377. } else {
  26378. this.openNode(this.currentNode);
  26379. }
  26380. this.currentNode = null;
  26381. } else {
  26382. this.closeNode(this.openTags[this.currentLevel]);
  26383. }
  26384. delete this.openTags[this.currentLevel];
  26385. this.currentLevel--;
  26386. return this;
  26387. };
  26388. XMLDocumentCB.prototype.end = function() {
  26389. while (this.currentLevel >= 0) {
  26390. this.up();
  26391. }
  26392. return this.onEnd();
  26393. };
  26394. XMLDocumentCB.prototype.openCurrent = function() {
  26395. if (this.currentNode) {
  26396. this.currentNode.children = true;
  26397. return this.openNode(this.currentNode);
  26398. }
  26399. };
  26400. XMLDocumentCB.prototype.openNode = function(node) {
  26401. var att, chunk, name, ref1;
  26402. if (!node.isOpen) {
  26403. if (!this.root && this.currentLevel === 0 && node.type === NodeType.Element) {
  26404. this.root = node;
  26405. }
  26406. chunk = '';
  26407. if (node.type === NodeType.Element) {
  26408. this.writerOptions.state = WriterState.OpenTag;
  26409. chunk = this.writer.indent(node, this.writerOptions, this.currentLevel) + '<' + node.name;
  26410. ref1 = node.attribs;
  26411. for (name in ref1) {
  26412. if (!hasProp.call(ref1, name)) continue;
  26413. att = ref1[name];
  26414. chunk += this.writer.attribute(att, this.writerOptions, this.currentLevel);
  26415. }
  26416. chunk += (node.children ? '>' : '/>') + this.writer.endline(node, this.writerOptions, this.currentLevel);
  26417. this.writerOptions.state = WriterState.InsideTag;
  26418. } else {
  26419. this.writerOptions.state = WriterState.OpenTag;
  26420. chunk = this.writer.indent(node, this.writerOptions, this.currentLevel) + '<!DOCTYPE ' + node.rootNodeName;
  26421. if (node.pubID && node.sysID) {
  26422. chunk += ' PUBLIC "' + node.pubID + '" "' + node.sysID + '"';
  26423. } else if (node.sysID) {
  26424. chunk += ' SYSTEM "' + node.sysID + '"';
  26425. }
  26426. if (node.children) {
  26427. chunk += ' [';
  26428. this.writerOptions.state = WriterState.InsideTag;
  26429. } else {
  26430. this.writerOptions.state = WriterState.CloseTag;
  26431. chunk += '>';
  26432. }
  26433. chunk += this.writer.endline(node, this.writerOptions, this.currentLevel);
  26434. }
  26435. this.onData(chunk, this.currentLevel);
  26436. return node.isOpen = true;
  26437. }
  26438. };
  26439. XMLDocumentCB.prototype.closeNode = function(node) {
  26440. var chunk;
  26441. if (!node.isClosed) {
  26442. chunk = '';
  26443. this.writerOptions.state = WriterState.CloseTag;
  26444. if (node.type === NodeType.Element) {
  26445. chunk = this.writer.indent(node, this.writerOptions, this.currentLevel) + '</' + node.name + '>' + this.writer.endline(node, this.writerOptions, this.currentLevel);
  26446. } else {
  26447. chunk = this.writer.indent(node, this.writerOptions, this.currentLevel) + ']>' + this.writer.endline(node, this.writerOptions, this.currentLevel);
  26448. }
  26449. this.writerOptions.state = WriterState.None;
  26450. this.onData(chunk, this.currentLevel);
  26451. return node.isClosed = true;
  26452. }
  26453. };
  26454. XMLDocumentCB.prototype.onData = function(chunk, level) {
  26455. this.documentStarted = true;
  26456. return this.onDataCallback(chunk, level + 1);
  26457. };
  26458. XMLDocumentCB.prototype.onEnd = function() {
  26459. this.documentCompleted = true;
  26460. return this.onEndCallback();
  26461. };
  26462. XMLDocumentCB.prototype.debugInfo = function(name) {
  26463. if (name == null) {
  26464. return "";
  26465. } else {
  26466. return "node: <" + name + ">";
  26467. }
  26468. };
  26469. XMLDocumentCB.prototype.ele = function() {
  26470. return this.element.apply(this, arguments);
  26471. };
  26472. XMLDocumentCB.prototype.nod = function(name, attributes, text) {
  26473. return this.node(name, attributes, text);
  26474. };
  26475. XMLDocumentCB.prototype.txt = function(value) {
  26476. return this.text(value);
  26477. };
  26478. XMLDocumentCB.prototype.dat = function(value) {
  26479. return this.cdata(value);
  26480. };
  26481. XMLDocumentCB.prototype.com = function(value) {
  26482. return this.comment(value);
  26483. };
  26484. XMLDocumentCB.prototype.ins = function(target, value) {
  26485. return this.instruction(target, value);
  26486. };
  26487. XMLDocumentCB.prototype.dec = function(version, encoding, standalone) {
  26488. return this.declaration(version, encoding, standalone);
  26489. };
  26490. XMLDocumentCB.prototype.dtd = function(root, pubID, sysID) {
  26491. return this.doctype(root, pubID, sysID);
  26492. };
  26493. XMLDocumentCB.prototype.e = function(name, attributes, text) {
  26494. return this.element(name, attributes, text);
  26495. };
  26496. XMLDocumentCB.prototype.n = function(name, attributes, text) {
  26497. return this.node(name, attributes, text);
  26498. };
  26499. XMLDocumentCB.prototype.t = function(value) {
  26500. return this.text(value);
  26501. };
  26502. XMLDocumentCB.prototype.d = function(value) {
  26503. return this.cdata(value);
  26504. };
  26505. XMLDocumentCB.prototype.c = function(value) {
  26506. return this.comment(value);
  26507. };
  26508. XMLDocumentCB.prototype.r = function(value) {
  26509. return this.raw(value);
  26510. };
  26511. XMLDocumentCB.prototype.i = function(target, value) {
  26512. return this.instruction(target, value);
  26513. };
  26514. XMLDocumentCB.prototype.att = function() {
  26515. if (this.currentNode && this.currentNode.type === NodeType.DocType) {
  26516. return this.attList.apply(this, arguments);
  26517. } else {
  26518. return this.attribute.apply(this, arguments);
  26519. }
  26520. };
  26521. XMLDocumentCB.prototype.a = function() {
  26522. if (this.currentNode && this.currentNode.type === NodeType.DocType) {
  26523. return this.attList.apply(this, arguments);
  26524. } else {
  26525. return this.attribute.apply(this, arguments);
  26526. }
  26527. };
  26528. XMLDocumentCB.prototype.ent = function(name, value) {
  26529. return this.entity(name, value);
  26530. };
  26531. XMLDocumentCB.prototype.pent = function(name, value) {
  26532. return this.pEntity(name, value);
  26533. };
  26534. XMLDocumentCB.prototype.not = function(name, value) {
  26535. return this.notation(name, value);
  26536. };
  26537. return XMLDocumentCB;
  26538. })();
  26539. }).call(this);
  26540. },{"./NodeType":360,"./Utility":361,"./WriterState":362,"./XMLAttribute":363,"./XMLCData":364,"./XMLComment":366,"./XMLDTDAttList":371,"./XMLDTDElement":372,"./XMLDTDEntity":373,"./XMLDTDNotation":374,"./XMLDeclaration":375,"./XMLDocType":376,"./XMLDocument":377,"./XMLElement":380,"./XMLProcessingInstruction":384,"./XMLRaw":385,"./XMLStringWriter":387,"./XMLStringifier":388,"./XMLText":389}],379:[function(require,module,exports){
  26541. // Generated by CoffeeScript 1.12.7
  26542. (function() {
  26543. var NodeType, XMLDummy, XMLNode,
  26544. extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
  26545. hasProp = {}.hasOwnProperty;
  26546. XMLNode = require('./XMLNode');
  26547. NodeType = require('./NodeType');
  26548. module.exports = XMLDummy = (function(superClass) {
  26549. extend(XMLDummy, superClass);
  26550. function XMLDummy(parent) {
  26551. XMLDummy.__super__.constructor.call(this, parent);
  26552. this.type = NodeType.Dummy;
  26553. }
  26554. XMLDummy.prototype.clone = function() {
  26555. return Object.create(this);
  26556. };
  26557. XMLDummy.prototype.toString = function(options) {
  26558. return '';
  26559. };
  26560. return XMLDummy;
  26561. })(XMLNode);
  26562. }).call(this);
  26563. },{"./NodeType":360,"./XMLNode":382}],380:[function(require,module,exports){
  26564. // Generated by CoffeeScript 1.12.7
  26565. (function() {
  26566. var NodeType, XMLAttribute, XMLElement, XMLNamedNodeMap, XMLNode, getValue, isFunction, isObject, ref,
  26567. extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
  26568. hasProp = {}.hasOwnProperty;
  26569. ref = require('./Utility'), isObject = ref.isObject, isFunction = ref.isFunction, getValue = ref.getValue;
  26570. XMLNode = require('./XMLNode');
  26571. NodeType = require('./NodeType');
  26572. XMLAttribute = require('./XMLAttribute');
  26573. XMLNamedNodeMap = require('./XMLNamedNodeMap');
  26574. module.exports = XMLElement = (function(superClass) {
  26575. extend(XMLElement, superClass);
  26576. function XMLElement(parent, name, attributes) {
  26577. var child, j, len, ref1;
  26578. XMLElement.__super__.constructor.call(this, parent);
  26579. if (name == null) {
  26580. throw new Error("Missing element name. " + this.debugInfo());
  26581. }
  26582. this.name = this.stringify.name(name);
  26583. this.type = NodeType.Element;
  26584. this.attribs = {};
  26585. this.schemaTypeInfo = null;
  26586. if (attributes != null) {
  26587. this.attribute(attributes);
  26588. }
  26589. if (parent.type === NodeType.Document) {
  26590. this.isRoot = true;
  26591. this.documentObject = parent;
  26592. parent.rootObject = this;
  26593. if (parent.children) {
  26594. ref1 = parent.children;
  26595. for (j = 0, len = ref1.length; j < len; j++) {
  26596. child = ref1[j];
  26597. if (child.type === NodeType.DocType) {
  26598. child.name = this.name;
  26599. break;
  26600. }
  26601. }
  26602. }
  26603. }
  26604. }
  26605. Object.defineProperty(XMLElement.prototype, 'tagName', {
  26606. get: function() {
  26607. return this.name;
  26608. }
  26609. });
  26610. Object.defineProperty(XMLElement.prototype, 'namespaceURI', {
  26611. get: function() {
  26612. return '';
  26613. }
  26614. });
  26615. Object.defineProperty(XMLElement.prototype, 'prefix', {
  26616. get: function() {
  26617. return '';
  26618. }
  26619. });
  26620. Object.defineProperty(XMLElement.prototype, 'localName', {
  26621. get: function() {
  26622. return this.name;
  26623. }
  26624. });
  26625. Object.defineProperty(XMLElement.prototype, 'id', {
  26626. get: function() {
  26627. throw new Error("This DOM method is not implemented." + this.debugInfo());
  26628. }
  26629. });
  26630. Object.defineProperty(XMLElement.prototype, 'className', {
  26631. get: function() {
  26632. throw new Error("This DOM method is not implemented." + this.debugInfo());
  26633. }
  26634. });
  26635. Object.defineProperty(XMLElement.prototype, 'classList', {
  26636. get: function() {
  26637. throw new Error("This DOM method is not implemented." + this.debugInfo());
  26638. }
  26639. });
  26640. Object.defineProperty(XMLElement.prototype, 'attributes', {
  26641. get: function() {
  26642. if (!this.attributeMap || !this.attributeMap.nodes) {
  26643. this.attributeMap = new XMLNamedNodeMap(this.attribs);
  26644. }
  26645. return this.attributeMap;
  26646. }
  26647. });
  26648. XMLElement.prototype.clone = function() {
  26649. var att, attName, clonedSelf, ref1;
  26650. clonedSelf = Object.create(this);
  26651. if (clonedSelf.isRoot) {
  26652. clonedSelf.documentObject = null;
  26653. }
  26654. clonedSelf.attribs = {};
  26655. ref1 = this.attribs;
  26656. for (attName in ref1) {
  26657. if (!hasProp.call(ref1, attName)) continue;
  26658. att = ref1[attName];
  26659. clonedSelf.attribs[attName] = att.clone();
  26660. }
  26661. clonedSelf.children = [];
  26662. this.children.forEach(function(child) {
  26663. var clonedChild;
  26664. clonedChild = child.clone();
  26665. clonedChild.parent = clonedSelf;
  26666. return clonedSelf.children.push(clonedChild);
  26667. });
  26668. return clonedSelf;
  26669. };
  26670. XMLElement.prototype.attribute = function(name, value) {
  26671. var attName, attValue;
  26672. if (name != null) {
  26673. name = getValue(name);
  26674. }
  26675. if (isObject(name)) {
  26676. for (attName in name) {
  26677. if (!hasProp.call(name, attName)) continue;
  26678. attValue = name[attName];
  26679. this.attribute(attName, attValue);
  26680. }
  26681. } else {
  26682. if (isFunction(value)) {
  26683. value = value.apply();
  26684. }
  26685. if (this.options.keepNullAttributes && (value == null)) {
  26686. this.attribs[name] = new XMLAttribute(this, name, "");
  26687. } else if (value != null) {
  26688. this.attribs[name] = new XMLAttribute(this, name, value);
  26689. }
  26690. }
  26691. return this;
  26692. };
  26693. XMLElement.prototype.removeAttribute = function(name) {
  26694. var attName, j, len;
  26695. if (name == null) {
  26696. throw new Error("Missing attribute name. " + this.debugInfo());
  26697. }
  26698. name = getValue(name);
  26699. if (Array.isArray(name)) {
  26700. for (j = 0, len = name.length; j < len; j++) {
  26701. attName = name[j];
  26702. delete this.attribs[attName];
  26703. }
  26704. } else {
  26705. delete this.attribs[name];
  26706. }
  26707. return this;
  26708. };
  26709. XMLElement.prototype.toString = function(options) {
  26710. return this.options.writer.element(this, this.options.writer.filterOptions(options));
  26711. };
  26712. XMLElement.prototype.att = function(name, value) {
  26713. return this.attribute(name, value);
  26714. };
  26715. XMLElement.prototype.a = function(name, value) {
  26716. return this.attribute(name, value);
  26717. };
  26718. XMLElement.prototype.getAttribute = function(name) {
  26719. if (this.attribs.hasOwnProperty(name)) {
  26720. return this.attribs[name].value;
  26721. } else {
  26722. return null;
  26723. }
  26724. };
  26725. XMLElement.prototype.setAttribute = function(name, value) {
  26726. throw new Error("This DOM method is not implemented." + this.debugInfo());
  26727. };
  26728. XMLElement.prototype.getAttributeNode = function(name) {
  26729. if (this.attribs.hasOwnProperty(name)) {
  26730. return this.attribs[name];
  26731. } else {
  26732. return null;
  26733. }
  26734. };
  26735. XMLElement.prototype.setAttributeNode = function(newAttr) {
  26736. throw new Error("This DOM method is not implemented." + this.debugInfo());
  26737. };
  26738. XMLElement.prototype.removeAttributeNode = function(oldAttr) {
  26739. throw new Error("This DOM method is not implemented." + this.debugInfo());
  26740. };
  26741. XMLElement.prototype.getElementsByTagName = function(name) {
  26742. throw new Error("This DOM method is not implemented." + this.debugInfo());
  26743. };
  26744. XMLElement.prototype.getAttributeNS = function(namespaceURI, localName) {
  26745. throw new Error("This DOM method is not implemented." + this.debugInfo());
  26746. };
  26747. XMLElement.prototype.setAttributeNS = function(namespaceURI, qualifiedName, value) {
  26748. throw new Error("This DOM method is not implemented." + this.debugInfo());
  26749. };
  26750. XMLElement.prototype.removeAttributeNS = function(namespaceURI, localName) {
  26751. throw new Error("This DOM method is not implemented." + this.debugInfo());
  26752. };
  26753. XMLElement.prototype.getAttributeNodeNS = function(namespaceURI, localName) {
  26754. throw new Error("This DOM method is not implemented." + this.debugInfo());
  26755. };
  26756. XMLElement.prototype.setAttributeNodeNS = function(newAttr) {
  26757. throw new Error("This DOM method is not implemented." + this.debugInfo());
  26758. };
  26759. XMLElement.prototype.getElementsByTagNameNS = function(namespaceURI, localName) {
  26760. throw new Error("This DOM method is not implemented." + this.debugInfo());
  26761. };
  26762. XMLElement.prototype.hasAttribute = function(name) {
  26763. return this.attribs.hasOwnProperty(name);
  26764. };
  26765. XMLElement.prototype.hasAttributeNS = function(namespaceURI, localName) {
  26766. throw new Error("This DOM method is not implemented." + this.debugInfo());
  26767. };
  26768. XMLElement.prototype.setIdAttribute = function(name, isId) {
  26769. if (this.attribs.hasOwnProperty(name)) {
  26770. return this.attribs[name].isId;
  26771. } else {
  26772. return isId;
  26773. }
  26774. };
  26775. XMLElement.prototype.setIdAttributeNS = function(namespaceURI, localName, isId) {
  26776. throw new Error("This DOM method is not implemented." + this.debugInfo());
  26777. };
  26778. XMLElement.prototype.setIdAttributeNode = function(idAttr, isId) {
  26779. throw new Error("This DOM method is not implemented." + this.debugInfo());
  26780. };
  26781. XMLElement.prototype.getElementsByTagName = function(tagname) {
  26782. throw new Error("This DOM method is not implemented." + this.debugInfo());
  26783. };
  26784. XMLElement.prototype.getElementsByTagNameNS = function(namespaceURI, localName) {
  26785. throw new Error("This DOM method is not implemented." + this.debugInfo());
  26786. };
  26787. XMLElement.prototype.getElementsByClassName = function(classNames) {
  26788. throw new Error("This DOM method is not implemented." + this.debugInfo());
  26789. };
  26790. XMLElement.prototype.isEqualNode = function(node) {
  26791. var i, j, ref1;
  26792. if (!XMLElement.__super__.isEqualNode.apply(this, arguments).isEqualNode(node)) {
  26793. return false;
  26794. }
  26795. if (node.namespaceURI !== this.namespaceURI) {
  26796. return false;
  26797. }
  26798. if (node.prefix !== this.prefix) {
  26799. return false;
  26800. }
  26801. if (node.localName !== this.localName) {
  26802. return false;
  26803. }
  26804. if (node.attribs.length !== this.attribs.length) {
  26805. return false;
  26806. }
  26807. for (i = j = 0, ref1 = this.attribs.length - 1; 0 <= ref1 ? j <= ref1 : j >= ref1; i = 0 <= ref1 ? ++j : --j) {
  26808. if (!this.attribs[i].isEqualNode(node.attribs[i])) {
  26809. return false;
  26810. }
  26811. }
  26812. return true;
  26813. };
  26814. return XMLElement;
  26815. })(XMLNode);
  26816. }).call(this);
  26817. },{"./NodeType":360,"./Utility":361,"./XMLAttribute":363,"./XMLNamedNodeMap":381,"./XMLNode":382}],381:[function(require,module,exports){
  26818. // Generated by CoffeeScript 1.12.7
  26819. (function() {
  26820. var XMLNamedNodeMap;
  26821. module.exports = XMLNamedNodeMap = (function() {
  26822. function XMLNamedNodeMap(nodes) {
  26823. this.nodes = nodes;
  26824. }
  26825. Object.defineProperty(XMLNamedNodeMap.prototype, 'length', {
  26826. get: function() {
  26827. return Object.keys(this.nodes).length || 0;
  26828. }
  26829. });
  26830. XMLNamedNodeMap.prototype.clone = function() {
  26831. return this.nodes = null;
  26832. };
  26833. XMLNamedNodeMap.prototype.getNamedItem = function(name) {
  26834. return this.nodes[name];
  26835. };
  26836. XMLNamedNodeMap.prototype.setNamedItem = function(node) {
  26837. var oldNode;
  26838. oldNode = this.nodes[node.nodeName];
  26839. this.nodes[node.nodeName] = node;
  26840. return oldNode || null;
  26841. };
  26842. XMLNamedNodeMap.prototype.removeNamedItem = function(name) {
  26843. var oldNode;
  26844. oldNode = this.nodes[name];
  26845. delete this.nodes[name];
  26846. return oldNode || null;
  26847. };
  26848. XMLNamedNodeMap.prototype.item = function(index) {
  26849. return this.nodes[Object.keys(this.nodes)[index]] || null;
  26850. };
  26851. XMLNamedNodeMap.prototype.getNamedItemNS = function(namespaceURI, localName) {
  26852. throw new Error("This DOM method is not implemented.");
  26853. };
  26854. XMLNamedNodeMap.prototype.setNamedItemNS = function(node) {
  26855. throw new Error("This DOM method is not implemented.");
  26856. };
  26857. XMLNamedNodeMap.prototype.removeNamedItemNS = function(namespaceURI, localName) {
  26858. throw new Error("This DOM method is not implemented.");
  26859. };
  26860. return XMLNamedNodeMap;
  26861. })();
  26862. }).call(this);
  26863. },{}],382:[function(require,module,exports){
  26864. // Generated by CoffeeScript 1.12.7
  26865. (function() {
  26866. var DocumentPosition, NodeType, XMLCData, XMLComment, XMLDeclaration, XMLDocType, XMLDummy, XMLElement, XMLNamedNodeMap, XMLNode, XMLNodeList, XMLProcessingInstruction, XMLRaw, XMLText, getValue, isEmpty, isFunction, isObject, ref1,
  26867. hasProp = {}.hasOwnProperty;
  26868. ref1 = require('./Utility'), isObject = ref1.isObject, isFunction = ref1.isFunction, isEmpty = ref1.isEmpty, getValue = ref1.getValue;
  26869. XMLElement = null;
  26870. XMLCData = null;
  26871. XMLComment = null;
  26872. XMLDeclaration = null;
  26873. XMLDocType = null;
  26874. XMLRaw = null;
  26875. XMLText = null;
  26876. XMLProcessingInstruction = null;
  26877. XMLDummy = null;
  26878. NodeType = null;
  26879. XMLNodeList = null;
  26880. XMLNamedNodeMap = null;
  26881. DocumentPosition = null;
  26882. module.exports = XMLNode = (function() {
  26883. function XMLNode(parent1) {
  26884. this.parent = parent1;
  26885. if (this.parent) {
  26886. this.options = this.parent.options;
  26887. this.stringify = this.parent.stringify;
  26888. }
  26889. this.value = null;
  26890. this.children = [];
  26891. this.baseURI = null;
  26892. if (!XMLElement) {
  26893. XMLElement = require('./XMLElement');
  26894. XMLCData = require('./XMLCData');
  26895. XMLComment = require('./XMLComment');
  26896. XMLDeclaration = require('./XMLDeclaration');
  26897. XMLDocType = require('./XMLDocType');
  26898. XMLRaw = require('./XMLRaw');
  26899. XMLText = require('./XMLText');
  26900. XMLProcessingInstruction = require('./XMLProcessingInstruction');
  26901. XMLDummy = require('./XMLDummy');
  26902. NodeType = require('./NodeType');
  26903. XMLNodeList = require('./XMLNodeList');
  26904. XMLNamedNodeMap = require('./XMLNamedNodeMap');
  26905. DocumentPosition = require('./DocumentPosition');
  26906. }
  26907. }
  26908. Object.defineProperty(XMLNode.prototype, 'nodeName', {
  26909. get: function() {
  26910. return this.name;
  26911. }
  26912. });
  26913. Object.defineProperty(XMLNode.prototype, 'nodeType', {
  26914. get: function() {
  26915. return this.type;
  26916. }
  26917. });
  26918. Object.defineProperty(XMLNode.prototype, 'nodeValue', {
  26919. get: function() {
  26920. return this.value;
  26921. }
  26922. });
  26923. Object.defineProperty(XMLNode.prototype, 'parentNode', {
  26924. get: function() {
  26925. return this.parent;
  26926. }
  26927. });
  26928. Object.defineProperty(XMLNode.prototype, 'childNodes', {
  26929. get: function() {
  26930. if (!this.childNodeList || !this.childNodeList.nodes) {
  26931. this.childNodeList = new XMLNodeList(this.children);
  26932. }
  26933. return this.childNodeList;
  26934. }
  26935. });
  26936. Object.defineProperty(XMLNode.prototype, 'firstChild', {
  26937. get: function() {
  26938. return this.children[0] || null;
  26939. }
  26940. });
  26941. Object.defineProperty(XMLNode.prototype, 'lastChild', {
  26942. get: function() {
  26943. return this.children[this.children.length - 1] || null;
  26944. }
  26945. });
  26946. Object.defineProperty(XMLNode.prototype, 'previousSibling', {
  26947. get: function() {
  26948. var i;
  26949. i = this.parent.children.indexOf(this);
  26950. return this.parent.children[i - 1] || null;
  26951. }
  26952. });
  26953. Object.defineProperty(XMLNode.prototype, 'nextSibling', {
  26954. get: function() {
  26955. var i;
  26956. i = this.parent.children.indexOf(this);
  26957. return this.parent.children[i + 1] || null;
  26958. }
  26959. });
  26960. Object.defineProperty(XMLNode.prototype, 'ownerDocument', {
  26961. get: function() {
  26962. return this.document() || null;
  26963. }
  26964. });
  26965. Object.defineProperty(XMLNode.prototype, 'textContent', {
  26966. get: function() {
  26967. var child, j, len, ref2, str;
  26968. if (this.nodeType === NodeType.Element || this.nodeType === NodeType.DocumentFragment) {
  26969. str = '';
  26970. ref2 = this.children;
  26971. for (j = 0, len = ref2.length; j < len; j++) {
  26972. child = ref2[j];
  26973. if (child.textContent) {
  26974. str += child.textContent;
  26975. }
  26976. }
  26977. return str;
  26978. } else {
  26979. return null;
  26980. }
  26981. },
  26982. set: function(value) {
  26983. throw new Error("This DOM method is not implemented." + this.debugInfo());
  26984. }
  26985. });
  26986. XMLNode.prototype.setParent = function(parent) {
  26987. var child, j, len, ref2, results;
  26988. this.parent = parent;
  26989. if (parent) {
  26990. this.options = parent.options;
  26991. this.stringify = parent.stringify;
  26992. }
  26993. ref2 = this.children;
  26994. results = [];
  26995. for (j = 0, len = ref2.length; j < len; j++) {
  26996. child = ref2[j];
  26997. results.push(child.setParent(this));
  26998. }
  26999. return results;
  27000. };
  27001. XMLNode.prototype.element = function(name, attributes, text) {
  27002. var childNode, item, j, k, key, lastChild, len, len1, ref2, ref3, val;
  27003. lastChild = null;
  27004. if (attributes === null && (text == null)) {
  27005. ref2 = [{}, null], attributes = ref2[0], text = ref2[1];
  27006. }
  27007. if (attributes == null) {
  27008. attributes = {};
  27009. }
  27010. attributes = getValue(attributes);
  27011. if (!isObject(attributes)) {
  27012. ref3 = [attributes, text], text = ref3[0], attributes = ref3[1];
  27013. }
  27014. if (name != null) {
  27015. name = getValue(name);
  27016. }
  27017. if (Array.isArray(name)) {
  27018. for (j = 0, len = name.length; j < len; j++) {
  27019. item = name[j];
  27020. lastChild = this.element(item);
  27021. }
  27022. } else if (isFunction(name)) {
  27023. lastChild = this.element(name.apply());
  27024. } else if (isObject(name)) {
  27025. for (key in name) {
  27026. if (!hasProp.call(name, key)) continue;
  27027. val = name[key];
  27028. if (isFunction(val)) {
  27029. val = val.apply();
  27030. }
  27031. if (!this.options.ignoreDecorators && this.stringify.convertAttKey && key.indexOf(this.stringify.convertAttKey) === 0) {
  27032. lastChild = this.attribute(key.substr(this.stringify.convertAttKey.length), val);
  27033. } else if (!this.options.separateArrayItems && Array.isArray(val) && isEmpty(val)) {
  27034. lastChild = this.dummy();
  27035. } else if (isObject(val) && isEmpty(val)) {
  27036. lastChild = this.element(key);
  27037. } else if (!this.options.keepNullNodes && (val == null)) {
  27038. lastChild = this.dummy();
  27039. } else if (!this.options.separateArrayItems && Array.isArray(val)) {
  27040. for (k = 0, len1 = val.length; k < len1; k++) {
  27041. item = val[k];
  27042. childNode = {};
  27043. childNode[key] = item;
  27044. lastChild = this.element(childNode);
  27045. }
  27046. } else if (isObject(val)) {
  27047. if (!this.options.ignoreDecorators && this.stringify.convertTextKey && key.indexOf(this.stringify.convertTextKey) === 0) {
  27048. lastChild = this.element(val);
  27049. } else {
  27050. lastChild = this.element(key);
  27051. lastChild.element(val);
  27052. }
  27053. } else {
  27054. lastChild = this.element(key, val);
  27055. }
  27056. }
  27057. } else if (!this.options.keepNullNodes && text === null) {
  27058. lastChild = this.dummy();
  27059. } else {
  27060. if (!this.options.ignoreDecorators && this.stringify.convertTextKey && name.indexOf(this.stringify.convertTextKey) === 0) {
  27061. lastChild = this.text(text);
  27062. } else if (!this.options.ignoreDecorators && this.stringify.convertCDataKey && name.indexOf(this.stringify.convertCDataKey) === 0) {
  27063. lastChild = this.cdata(text);
  27064. } else if (!this.options.ignoreDecorators && this.stringify.convertCommentKey && name.indexOf(this.stringify.convertCommentKey) === 0) {
  27065. lastChild = this.comment(text);
  27066. } else if (!this.options.ignoreDecorators && this.stringify.convertRawKey && name.indexOf(this.stringify.convertRawKey) === 0) {
  27067. lastChild = this.raw(text);
  27068. } else if (!this.options.ignoreDecorators && this.stringify.convertPIKey && name.indexOf(this.stringify.convertPIKey) === 0) {
  27069. lastChild = this.instruction(name.substr(this.stringify.convertPIKey.length), text);
  27070. } else {
  27071. lastChild = this.node(name, attributes, text);
  27072. }
  27073. }
  27074. if (lastChild == null) {
  27075. throw new Error("Could not create any elements with: " + name + ". " + this.debugInfo());
  27076. }
  27077. return lastChild;
  27078. };
  27079. XMLNode.prototype.insertBefore = function(name, attributes, text) {
  27080. var child, i, newChild, refChild, removed;
  27081. if (name != null ? name.type : void 0) {
  27082. newChild = name;
  27083. refChild = attributes;
  27084. newChild.setParent(this);
  27085. if (refChild) {
  27086. i = children.indexOf(refChild);
  27087. removed = children.splice(i);
  27088. children.push(newChild);
  27089. Array.prototype.push.apply(children, removed);
  27090. } else {
  27091. children.push(newChild);
  27092. }
  27093. return newChild;
  27094. } else {
  27095. if (this.isRoot) {
  27096. throw new Error("Cannot insert elements at root level. " + this.debugInfo(name));
  27097. }
  27098. i = this.parent.children.indexOf(this);
  27099. removed = this.parent.children.splice(i);
  27100. child = this.parent.element(name, attributes, text);
  27101. Array.prototype.push.apply(this.parent.children, removed);
  27102. return child;
  27103. }
  27104. };
  27105. XMLNode.prototype.insertAfter = function(name, attributes, text) {
  27106. var child, i, removed;
  27107. if (this.isRoot) {
  27108. throw new Error("Cannot insert elements at root level. " + this.debugInfo(name));
  27109. }
  27110. i = this.parent.children.indexOf(this);
  27111. removed = this.parent.children.splice(i + 1);
  27112. child = this.parent.element(name, attributes, text);
  27113. Array.prototype.push.apply(this.parent.children, removed);
  27114. return child;
  27115. };
  27116. XMLNode.prototype.remove = function() {
  27117. var i, ref2;
  27118. if (this.isRoot) {
  27119. throw new Error("Cannot remove the root element. " + this.debugInfo());
  27120. }
  27121. i = this.parent.children.indexOf(this);
  27122. [].splice.apply(this.parent.children, [i, i - i + 1].concat(ref2 = [])), ref2;
  27123. return this.parent;
  27124. };
  27125. XMLNode.prototype.node = function(name, attributes, text) {
  27126. var child, ref2;
  27127. if (name != null) {
  27128. name = getValue(name);
  27129. }
  27130. attributes || (attributes = {});
  27131. attributes = getValue(attributes);
  27132. if (!isObject(attributes)) {
  27133. ref2 = [attributes, text], text = ref2[0], attributes = ref2[1];
  27134. }
  27135. child = new XMLElement(this, name, attributes);
  27136. if (text != null) {
  27137. child.text(text);
  27138. }
  27139. this.children.push(child);
  27140. return child;
  27141. };
  27142. XMLNode.prototype.text = function(value) {
  27143. var child;
  27144. if (isObject(value)) {
  27145. this.element(value);
  27146. }
  27147. child = new XMLText(this, value);
  27148. this.children.push(child);
  27149. return this;
  27150. };
  27151. XMLNode.prototype.cdata = function(value) {
  27152. var child;
  27153. child = new XMLCData(this, value);
  27154. this.children.push(child);
  27155. return this;
  27156. };
  27157. XMLNode.prototype.comment = function(value) {
  27158. var child;
  27159. child = new XMLComment(this, value);
  27160. this.children.push(child);
  27161. return this;
  27162. };
  27163. XMLNode.prototype.commentBefore = function(value) {
  27164. var child, i, removed;
  27165. i = this.parent.children.indexOf(this);
  27166. removed = this.parent.children.splice(i);
  27167. child = this.parent.comment(value);
  27168. Array.prototype.push.apply(this.parent.children, removed);
  27169. return this;
  27170. };
  27171. XMLNode.prototype.commentAfter = function(value) {
  27172. var child, i, removed;
  27173. i = this.parent.children.indexOf(this);
  27174. removed = this.parent.children.splice(i + 1);
  27175. child = this.parent.comment(value);
  27176. Array.prototype.push.apply(this.parent.children, removed);
  27177. return this;
  27178. };
  27179. XMLNode.prototype.raw = function(value) {
  27180. var child;
  27181. child = new XMLRaw(this, value);
  27182. this.children.push(child);
  27183. return this;
  27184. };
  27185. XMLNode.prototype.dummy = function() {
  27186. var child;
  27187. child = new XMLDummy(this);
  27188. return child;
  27189. };
  27190. XMLNode.prototype.instruction = function(target, value) {
  27191. var insTarget, insValue, instruction, j, len;
  27192. if (target != null) {
  27193. target = getValue(target);
  27194. }
  27195. if (value != null) {
  27196. value = getValue(value);
  27197. }
  27198. if (Array.isArray(target)) {
  27199. for (j = 0, len = target.length; j < len; j++) {
  27200. insTarget = target[j];
  27201. this.instruction(insTarget);
  27202. }
  27203. } else if (isObject(target)) {
  27204. for (insTarget in target) {
  27205. if (!hasProp.call(target, insTarget)) continue;
  27206. insValue = target[insTarget];
  27207. this.instruction(insTarget, insValue);
  27208. }
  27209. } else {
  27210. if (isFunction(value)) {
  27211. value = value.apply();
  27212. }
  27213. instruction = new XMLProcessingInstruction(this, target, value);
  27214. this.children.push(instruction);
  27215. }
  27216. return this;
  27217. };
  27218. XMLNode.prototype.instructionBefore = function(target, value) {
  27219. var child, i, removed;
  27220. i = this.parent.children.indexOf(this);
  27221. removed = this.parent.children.splice(i);
  27222. child = this.parent.instruction(target, value);
  27223. Array.prototype.push.apply(this.parent.children, removed);
  27224. return this;
  27225. };
  27226. XMLNode.prototype.instructionAfter = function(target, value) {
  27227. var child, i, removed;
  27228. i = this.parent.children.indexOf(this);
  27229. removed = this.parent.children.splice(i + 1);
  27230. child = this.parent.instruction(target, value);
  27231. Array.prototype.push.apply(this.parent.children, removed);
  27232. return this;
  27233. };
  27234. XMLNode.prototype.declaration = function(version, encoding, standalone) {
  27235. var doc, xmldec;
  27236. doc = this.document();
  27237. xmldec = new XMLDeclaration(doc, version, encoding, standalone);
  27238. if (doc.children.length === 0) {
  27239. doc.children.unshift(xmldec);
  27240. } else if (doc.children[0].type === NodeType.Declaration) {
  27241. doc.children[0] = xmldec;
  27242. } else {
  27243. doc.children.unshift(xmldec);
  27244. }
  27245. return doc.root() || doc;
  27246. };
  27247. XMLNode.prototype.dtd = function(pubID, sysID) {
  27248. var child, doc, doctype, i, j, k, len, len1, ref2, ref3;
  27249. doc = this.document();
  27250. doctype = new XMLDocType(doc, pubID, sysID);
  27251. ref2 = doc.children;
  27252. for (i = j = 0, len = ref2.length; j < len; i = ++j) {
  27253. child = ref2[i];
  27254. if (child.type === NodeType.DocType) {
  27255. doc.children[i] = doctype;
  27256. return doctype;
  27257. }
  27258. }
  27259. ref3 = doc.children;
  27260. for (i = k = 0, len1 = ref3.length; k < len1; i = ++k) {
  27261. child = ref3[i];
  27262. if (child.isRoot) {
  27263. doc.children.splice(i, 0, doctype);
  27264. return doctype;
  27265. }
  27266. }
  27267. doc.children.push(doctype);
  27268. return doctype;
  27269. };
  27270. XMLNode.prototype.up = function() {
  27271. if (this.isRoot) {
  27272. throw new Error("The root node has no parent. Use doc() if you need to get the document object.");
  27273. }
  27274. return this.parent;
  27275. };
  27276. XMLNode.prototype.root = function() {
  27277. var node;
  27278. node = this;
  27279. while (node) {
  27280. if (node.type === NodeType.Document) {
  27281. return node.rootObject;
  27282. } else if (node.isRoot) {
  27283. return node;
  27284. } else {
  27285. node = node.parent;
  27286. }
  27287. }
  27288. };
  27289. XMLNode.prototype.document = function() {
  27290. var node;
  27291. node = this;
  27292. while (node) {
  27293. if (node.type === NodeType.Document) {
  27294. return node;
  27295. } else {
  27296. node = node.parent;
  27297. }
  27298. }
  27299. };
  27300. XMLNode.prototype.end = function(options) {
  27301. return this.document().end(options);
  27302. };
  27303. XMLNode.prototype.prev = function() {
  27304. var i;
  27305. i = this.parent.children.indexOf(this);
  27306. if (i < 1) {
  27307. throw new Error("Already at the first node. " + this.debugInfo());
  27308. }
  27309. return this.parent.children[i - 1];
  27310. };
  27311. XMLNode.prototype.next = function() {
  27312. var i;
  27313. i = this.parent.children.indexOf(this);
  27314. if (i === -1 || i === this.parent.children.length - 1) {
  27315. throw new Error("Already at the last node. " + this.debugInfo());
  27316. }
  27317. return this.parent.children[i + 1];
  27318. };
  27319. XMLNode.prototype.importDocument = function(doc) {
  27320. var clonedRoot;
  27321. clonedRoot = doc.root().clone();
  27322. clonedRoot.parent = this;
  27323. clonedRoot.isRoot = false;
  27324. this.children.push(clonedRoot);
  27325. return this;
  27326. };
  27327. XMLNode.prototype.debugInfo = function(name) {
  27328. var ref2, ref3;
  27329. name = name || this.name;
  27330. if ((name == null) && !((ref2 = this.parent) != null ? ref2.name : void 0)) {
  27331. return "";
  27332. } else if (name == null) {
  27333. return "parent: <" + this.parent.name + ">";
  27334. } else if (!((ref3 = this.parent) != null ? ref3.name : void 0)) {
  27335. return "node: <" + name + ">";
  27336. } else {
  27337. return "node: <" + name + ">, parent: <" + this.parent.name + ">";
  27338. }
  27339. };
  27340. XMLNode.prototype.ele = function(name, attributes, text) {
  27341. return this.element(name, attributes, text);
  27342. };
  27343. XMLNode.prototype.nod = function(name, attributes, text) {
  27344. return this.node(name, attributes, text);
  27345. };
  27346. XMLNode.prototype.txt = function(value) {
  27347. return this.text(value);
  27348. };
  27349. XMLNode.prototype.dat = function(value) {
  27350. return this.cdata(value);
  27351. };
  27352. XMLNode.prototype.com = function(value) {
  27353. return this.comment(value);
  27354. };
  27355. XMLNode.prototype.ins = function(target, value) {
  27356. return this.instruction(target, value);
  27357. };
  27358. XMLNode.prototype.doc = function() {
  27359. return this.document();
  27360. };
  27361. XMLNode.prototype.dec = function(version, encoding, standalone) {
  27362. return this.declaration(version, encoding, standalone);
  27363. };
  27364. XMLNode.prototype.e = function(name, attributes, text) {
  27365. return this.element(name, attributes, text);
  27366. };
  27367. XMLNode.prototype.n = function(name, attributes, text) {
  27368. return this.node(name, attributes, text);
  27369. };
  27370. XMLNode.prototype.t = function(value) {
  27371. return this.text(value);
  27372. };
  27373. XMLNode.prototype.d = function(value) {
  27374. return this.cdata(value);
  27375. };
  27376. XMLNode.prototype.c = function(value) {
  27377. return this.comment(value);
  27378. };
  27379. XMLNode.prototype.r = function(value) {
  27380. return this.raw(value);
  27381. };
  27382. XMLNode.prototype.i = function(target, value) {
  27383. return this.instruction(target, value);
  27384. };
  27385. XMLNode.prototype.u = function() {
  27386. return this.up();
  27387. };
  27388. XMLNode.prototype.importXMLBuilder = function(doc) {
  27389. return this.importDocument(doc);
  27390. };
  27391. XMLNode.prototype.replaceChild = function(newChild, oldChild) {
  27392. throw new Error("This DOM method is not implemented." + this.debugInfo());
  27393. };
  27394. XMLNode.prototype.removeChild = function(oldChild) {
  27395. throw new Error("This DOM method is not implemented." + this.debugInfo());
  27396. };
  27397. XMLNode.prototype.appendChild = function(newChild) {
  27398. throw new Error("This DOM method is not implemented." + this.debugInfo());
  27399. };
  27400. XMLNode.prototype.hasChildNodes = function() {
  27401. return this.children.length !== 0;
  27402. };
  27403. XMLNode.prototype.cloneNode = function(deep) {
  27404. throw new Error("This DOM method is not implemented." + this.debugInfo());
  27405. };
  27406. XMLNode.prototype.normalize = function() {
  27407. throw new Error("This DOM method is not implemented." + this.debugInfo());
  27408. };
  27409. XMLNode.prototype.isSupported = function(feature, version) {
  27410. return true;
  27411. };
  27412. XMLNode.prototype.hasAttributes = function() {
  27413. return this.attribs.length !== 0;
  27414. };
  27415. XMLNode.prototype.compareDocumentPosition = function(other) {
  27416. var ref, res;
  27417. ref = this;
  27418. if (ref === other) {
  27419. return 0;
  27420. } else if (this.document() !== other.document()) {
  27421. res = DocumentPosition.Disconnected | DocumentPosition.ImplementationSpecific;
  27422. if (Math.random() < 0.5) {
  27423. res |= DocumentPosition.Preceding;
  27424. } else {
  27425. res |= DocumentPosition.Following;
  27426. }
  27427. return res;
  27428. } else if (ref.isAncestor(other)) {
  27429. return DocumentPosition.Contains | DocumentPosition.Preceding;
  27430. } else if (ref.isDescendant(other)) {
  27431. return DocumentPosition.Contains | DocumentPosition.Following;
  27432. } else if (ref.isPreceding(other)) {
  27433. return DocumentPosition.Preceding;
  27434. } else {
  27435. return DocumentPosition.Following;
  27436. }
  27437. };
  27438. XMLNode.prototype.isSameNode = function(other) {
  27439. throw new Error("This DOM method is not implemented." + this.debugInfo());
  27440. };
  27441. XMLNode.prototype.lookupPrefix = function(namespaceURI) {
  27442. throw new Error("This DOM method is not implemented." + this.debugInfo());
  27443. };
  27444. XMLNode.prototype.isDefaultNamespace = function(namespaceURI) {
  27445. throw new Error("This DOM method is not implemented." + this.debugInfo());
  27446. };
  27447. XMLNode.prototype.lookupNamespaceURI = function(prefix) {
  27448. throw new Error("This DOM method is not implemented." + this.debugInfo());
  27449. };
  27450. XMLNode.prototype.isEqualNode = function(node) {
  27451. var i, j, ref2;
  27452. if (node.nodeType !== this.nodeType) {
  27453. return false;
  27454. }
  27455. if (node.children.length !== this.children.length) {
  27456. return false;
  27457. }
  27458. for (i = j = 0, ref2 = this.children.length - 1; 0 <= ref2 ? j <= ref2 : j >= ref2; i = 0 <= ref2 ? ++j : --j) {
  27459. if (!this.children[i].isEqualNode(node.children[i])) {
  27460. return false;
  27461. }
  27462. }
  27463. return true;
  27464. };
  27465. XMLNode.prototype.getFeature = function(feature, version) {
  27466. throw new Error("This DOM method is not implemented." + this.debugInfo());
  27467. };
  27468. XMLNode.prototype.setUserData = function(key, data, handler) {
  27469. throw new Error("This DOM method is not implemented." + this.debugInfo());
  27470. };
  27471. XMLNode.prototype.getUserData = function(key) {
  27472. throw new Error("This DOM method is not implemented." + this.debugInfo());
  27473. };
  27474. XMLNode.prototype.contains = function(other) {
  27475. if (!other) {
  27476. return false;
  27477. }
  27478. return other === this || this.isDescendant(other);
  27479. };
  27480. XMLNode.prototype.isDescendant = function(node) {
  27481. var child, isDescendantChild, j, len, ref2;
  27482. ref2 = this.children;
  27483. for (j = 0, len = ref2.length; j < len; j++) {
  27484. child = ref2[j];
  27485. if (node === child) {
  27486. return true;
  27487. }
  27488. isDescendantChild = child.isDescendant(node);
  27489. if (isDescendantChild) {
  27490. return true;
  27491. }
  27492. }
  27493. return false;
  27494. };
  27495. XMLNode.prototype.isAncestor = function(node) {
  27496. return node.isDescendant(this);
  27497. };
  27498. XMLNode.prototype.isPreceding = function(node) {
  27499. var nodePos, thisPos;
  27500. nodePos = this.treePosition(node);
  27501. thisPos = this.treePosition(this);
  27502. if (nodePos === -1 || thisPos === -1) {
  27503. return false;
  27504. } else {
  27505. return nodePos < thisPos;
  27506. }
  27507. };
  27508. XMLNode.prototype.isFollowing = function(node) {
  27509. var nodePos, thisPos;
  27510. nodePos = this.treePosition(node);
  27511. thisPos = this.treePosition(this);
  27512. if (nodePos === -1 || thisPos === -1) {
  27513. return false;
  27514. } else {
  27515. return nodePos > thisPos;
  27516. }
  27517. };
  27518. XMLNode.prototype.treePosition = function(node) {
  27519. var found, pos;
  27520. pos = 0;
  27521. found = false;
  27522. this.foreachTreeNode(this.document(), function(childNode) {
  27523. pos++;
  27524. if (!found && childNode === node) {
  27525. return found = true;
  27526. }
  27527. });
  27528. if (found) {
  27529. return pos;
  27530. } else {
  27531. return -1;
  27532. }
  27533. };
  27534. XMLNode.prototype.foreachTreeNode = function(node, func) {
  27535. var child, j, len, ref2, res;
  27536. node || (node = this.document());
  27537. ref2 = node.children;
  27538. for (j = 0, len = ref2.length; j < len; j++) {
  27539. child = ref2[j];
  27540. if (res = func(child)) {
  27541. return res;
  27542. } else {
  27543. res = this.foreachTreeNode(child, func);
  27544. if (res) {
  27545. return res;
  27546. }
  27547. }
  27548. }
  27549. };
  27550. return XMLNode;
  27551. })();
  27552. }).call(this);
  27553. },{"./DocumentPosition":359,"./NodeType":360,"./Utility":361,"./XMLCData":364,"./XMLComment":366,"./XMLDeclaration":375,"./XMLDocType":376,"./XMLDummy":379,"./XMLElement":380,"./XMLNamedNodeMap":381,"./XMLNodeList":383,"./XMLProcessingInstruction":384,"./XMLRaw":385,"./XMLText":389}],383:[function(require,module,exports){
  27554. // Generated by CoffeeScript 1.12.7
  27555. (function() {
  27556. var XMLNodeList;
  27557. module.exports = XMLNodeList = (function() {
  27558. function XMLNodeList(nodes) {
  27559. this.nodes = nodes;
  27560. }
  27561. Object.defineProperty(XMLNodeList.prototype, 'length', {
  27562. get: function() {
  27563. return this.nodes.length || 0;
  27564. }
  27565. });
  27566. XMLNodeList.prototype.clone = function() {
  27567. return this.nodes = null;
  27568. };
  27569. XMLNodeList.prototype.item = function(index) {
  27570. return this.nodes[index] || null;
  27571. };
  27572. return XMLNodeList;
  27573. })();
  27574. }).call(this);
  27575. },{}],384:[function(require,module,exports){
  27576. // Generated by CoffeeScript 1.12.7
  27577. (function() {
  27578. var NodeType, XMLCharacterData, XMLProcessingInstruction,
  27579. extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
  27580. hasProp = {}.hasOwnProperty;
  27581. NodeType = require('./NodeType');
  27582. XMLCharacterData = require('./XMLCharacterData');
  27583. module.exports = XMLProcessingInstruction = (function(superClass) {
  27584. extend(XMLProcessingInstruction, superClass);
  27585. function XMLProcessingInstruction(parent, target, value) {
  27586. XMLProcessingInstruction.__super__.constructor.call(this, parent);
  27587. if (target == null) {
  27588. throw new Error("Missing instruction target. " + this.debugInfo());
  27589. }
  27590. this.type = NodeType.ProcessingInstruction;
  27591. this.target = this.stringify.insTarget(target);
  27592. this.name = this.target;
  27593. if (value) {
  27594. this.value = this.stringify.insValue(value);
  27595. }
  27596. }
  27597. XMLProcessingInstruction.prototype.clone = function() {
  27598. return Object.create(this);
  27599. };
  27600. XMLProcessingInstruction.prototype.toString = function(options) {
  27601. return this.options.writer.processingInstruction(this, this.options.writer.filterOptions(options));
  27602. };
  27603. XMLProcessingInstruction.prototype.isEqualNode = function(node) {
  27604. if (!XMLProcessingInstruction.__super__.isEqualNode.apply(this, arguments).isEqualNode(node)) {
  27605. return false;
  27606. }
  27607. if (node.target !== this.target) {
  27608. return false;
  27609. }
  27610. return true;
  27611. };
  27612. return XMLProcessingInstruction;
  27613. })(XMLCharacterData);
  27614. }).call(this);
  27615. },{"./NodeType":360,"./XMLCharacterData":365}],385:[function(require,module,exports){
  27616. // Generated by CoffeeScript 1.12.7
  27617. (function() {
  27618. var NodeType, XMLNode, XMLRaw,
  27619. extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
  27620. hasProp = {}.hasOwnProperty;
  27621. NodeType = require('./NodeType');
  27622. XMLNode = require('./XMLNode');
  27623. module.exports = XMLRaw = (function(superClass) {
  27624. extend(XMLRaw, superClass);
  27625. function XMLRaw(parent, text) {
  27626. XMLRaw.__super__.constructor.call(this, parent);
  27627. if (text == null) {
  27628. throw new Error("Missing raw text. " + this.debugInfo());
  27629. }
  27630. this.type = NodeType.Raw;
  27631. this.value = this.stringify.raw(text);
  27632. }
  27633. XMLRaw.prototype.clone = function() {
  27634. return Object.create(this);
  27635. };
  27636. XMLRaw.prototype.toString = function(options) {
  27637. return this.options.writer.raw(this, this.options.writer.filterOptions(options));
  27638. };
  27639. return XMLRaw;
  27640. })(XMLNode);
  27641. }).call(this);
  27642. },{"./NodeType":360,"./XMLNode":382}],386:[function(require,module,exports){
  27643. // Generated by CoffeeScript 1.12.7
  27644. (function() {
  27645. var NodeType, WriterState, XMLStreamWriter, XMLWriterBase,
  27646. extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
  27647. hasProp = {}.hasOwnProperty;
  27648. NodeType = require('./NodeType');
  27649. XMLWriterBase = require('./XMLWriterBase');
  27650. WriterState = require('./WriterState');
  27651. module.exports = XMLStreamWriter = (function(superClass) {
  27652. extend(XMLStreamWriter, superClass);
  27653. function XMLStreamWriter(stream, options) {
  27654. this.stream = stream;
  27655. XMLStreamWriter.__super__.constructor.call(this, options);
  27656. }
  27657. XMLStreamWriter.prototype.endline = function(node, options, level) {
  27658. if (node.isLastRootNode && options.state === WriterState.CloseTag) {
  27659. return '';
  27660. } else {
  27661. return XMLStreamWriter.__super__.endline.call(this, node, options, level);
  27662. }
  27663. };
  27664. XMLStreamWriter.prototype.document = function(doc, options) {
  27665. var child, i, j, k, len, len1, ref, ref1, results;
  27666. ref = doc.children;
  27667. for (i = j = 0, len = ref.length; j < len; i = ++j) {
  27668. child = ref[i];
  27669. child.isLastRootNode = i === doc.children.length - 1;
  27670. }
  27671. options = this.filterOptions(options);
  27672. ref1 = doc.children;
  27673. results = [];
  27674. for (k = 0, len1 = ref1.length; k < len1; k++) {
  27675. child = ref1[k];
  27676. results.push(this.writeChildNode(child, options, 0));
  27677. }
  27678. return results;
  27679. };
  27680. XMLStreamWriter.prototype.attribute = function(att, options, level) {
  27681. return this.stream.write(XMLStreamWriter.__super__.attribute.call(this, att, options, level));
  27682. };
  27683. XMLStreamWriter.prototype.cdata = function(node, options, level) {
  27684. return this.stream.write(XMLStreamWriter.__super__.cdata.call(this, node, options, level));
  27685. };
  27686. XMLStreamWriter.prototype.comment = function(node, options, level) {
  27687. return this.stream.write(XMLStreamWriter.__super__.comment.call(this, node, options, level));
  27688. };
  27689. XMLStreamWriter.prototype.declaration = function(node, options, level) {
  27690. return this.stream.write(XMLStreamWriter.__super__.declaration.call(this, node, options, level));
  27691. };
  27692. XMLStreamWriter.prototype.docType = function(node, options, level) {
  27693. var child, j, len, ref;
  27694. level || (level = 0);
  27695. this.openNode(node, options, level);
  27696. options.state = WriterState.OpenTag;
  27697. this.stream.write(this.indent(node, options, level));
  27698. this.stream.write('<!DOCTYPE ' + node.root().name);
  27699. if (node.pubID && node.sysID) {
  27700. this.stream.write(' PUBLIC "' + node.pubID + '" "' + node.sysID + '"');
  27701. } else if (node.sysID) {
  27702. this.stream.write(' SYSTEM "' + node.sysID + '"');
  27703. }
  27704. if (node.children.length > 0) {
  27705. this.stream.write(' [');
  27706. this.stream.write(this.endline(node, options, level));
  27707. options.state = WriterState.InsideTag;
  27708. ref = node.children;
  27709. for (j = 0, len = ref.length; j < len; j++) {
  27710. child = ref[j];
  27711. this.writeChildNode(child, options, level + 1);
  27712. }
  27713. options.state = WriterState.CloseTag;
  27714. this.stream.write(']');
  27715. }
  27716. options.state = WriterState.CloseTag;
  27717. this.stream.write(options.spaceBeforeSlash + '>');
  27718. this.stream.write(this.endline(node, options, level));
  27719. options.state = WriterState.None;
  27720. return this.closeNode(node, options, level);
  27721. };
  27722. XMLStreamWriter.prototype.element = function(node, options, level) {
  27723. var att, child, childNodeCount, firstChildNode, j, len, name, prettySuppressed, ref, ref1;
  27724. level || (level = 0);
  27725. this.openNode(node, options, level);
  27726. options.state = WriterState.OpenTag;
  27727. this.stream.write(this.indent(node, options, level) + '<' + node.name);
  27728. ref = node.attribs;
  27729. for (name in ref) {
  27730. if (!hasProp.call(ref, name)) continue;
  27731. att = ref[name];
  27732. this.attribute(att, options, level);
  27733. }
  27734. childNodeCount = node.children.length;
  27735. firstChildNode = childNodeCount === 0 ? null : node.children[0];
  27736. if (childNodeCount === 0 || node.children.every(function(e) {
  27737. return (e.type === NodeType.Text || e.type === NodeType.Raw) && e.value === '';
  27738. })) {
  27739. if (options.allowEmpty) {
  27740. this.stream.write('>');
  27741. options.state = WriterState.CloseTag;
  27742. this.stream.write('</' + node.name + '>');
  27743. } else {
  27744. options.state = WriterState.CloseTag;
  27745. this.stream.write(options.spaceBeforeSlash + '/>');
  27746. }
  27747. } else if (options.pretty && childNodeCount === 1 && (firstChildNode.type === NodeType.Text || firstChildNode.type === NodeType.Raw) && (firstChildNode.value != null)) {
  27748. this.stream.write('>');
  27749. options.state = WriterState.InsideTag;
  27750. options.suppressPrettyCount++;
  27751. prettySuppressed = true;
  27752. this.writeChildNode(firstChildNode, options, level + 1);
  27753. options.suppressPrettyCount--;
  27754. prettySuppressed = false;
  27755. options.state = WriterState.CloseTag;
  27756. this.stream.write('</' + node.name + '>');
  27757. } else {
  27758. this.stream.write('>' + this.endline(node, options, level));
  27759. options.state = WriterState.InsideTag;
  27760. ref1 = node.children;
  27761. for (j = 0, len = ref1.length; j < len; j++) {
  27762. child = ref1[j];
  27763. this.writeChildNode(child, options, level + 1);
  27764. }
  27765. options.state = WriterState.CloseTag;
  27766. this.stream.write(this.indent(node, options, level) + '</' + node.name + '>');
  27767. }
  27768. this.stream.write(this.endline(node, options, level));
  27769. options.state = WriterState.None;
  27770. return this.closeNode(node, options, level);
  27771. };
  27772. XMLStreamWriter.prototype.processingInstruction = function(node, options, level) {
  27773. return this.stream.write(XMLStreamWriter.__super__.processingInstruction.call(this, node, options, level));
  27774. };
  27775. XMLStreamWriter.prototype.raw = function(node, options, level) {
  27776. return this.stream.write(XMLStreamWriter.__super__.raw.call(this, node, options, level));
  27777. };
  27778. XMLStreamWriter.prototype.text = function(node, options, level) {
  27779. return this.stream.write(XMLStreamWriter.__super__.text.call(this, node, options, level));
  27780. };
  27781. XMLStreamWriter.prototype.dtdAttList = function(node, options, level) {
  27782. return this.stream.write(XMLStreamWriter.__super__.dtdAttList.call(this, node, options, level));
  27783. };
  27784. XMLStreamWriter.prototype.dtdElement = function(node, options, level) {
  27785. return this.stream.write(XMLStreamWriter.__super__.dtdElement.call(this, node, options, level));
  27786. };
  27787. XMLStreamWriter.prototype.dtdEntity = function(node, options, level) {
  27788. return this.stream.write(XMLStreamWriter.__super__.dtdEntity.call(this, node, options, level));
  27789. };
  27790. XMLStreamWriter.prototype.dtdNotation = function(node, options, level) {
  27791. return this.stream.write(XMLStreamWriter.__super__.dtdNotation.call(this, node, options, level));
  27792. };
  27793. return XMLStreamWriter;
  27794. })(XMLWriterBase);
  27795. }).call(this);
  27796. },{"./NodeType":360,"./WriterState":362,"./XMLWriterBase":390}],387:[function(require,module,exports){
  27797. // Generated by CoffeeScript 1.12.7
  27798. (function() {
  27799. var XMLStringWriter, XMLWriterBase,
  27800. extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
  27801. hasProp = {}.hasOwnProperty;
  27802. XMLWriterBase = require('./XMLWriterBase');
  27803. module.exports = XMLStringWriter = (function(superClass) {
  27804. extend(XMLStringWriter, superClass);
  27805. function XMLStringWriter(options) {
  27806. XMLStringWriter.__super__.constructor.call(this, options);
  27807. }
  27808. XMLStringWriter.prototype.document = function(doc, options) {
  27809. var child, i, len, r, ref;
  27810. options = this.filterOptions(options);
  27811. r = '';
  27812. ref = doc.children;
  27813. for (i = 0, len = ref.length; i < len; i++) {
  27814. child = ref[i];
  27815. r += this.writeChildNode(child, options, 0);
  27816. }
  27817. if (options.pretty && r.slice(-options.newline.length) === options.newline) {
  27818. r = r.slice(0, -options.newline.length);
  27819. }
  27820. return r;
  27821. };
  27822. return XMLStringWriter;
  27823. })(XMLWriterBase);
  27824. }).call(this);
  27825. },{"./XMLWriterBase":390}],388:[function(require,module,exports){
  27826. // Generated by CoffeeScript 1.12.7
  27827. (function() {
  27828. var XMLStringifier,
  27829. bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
  27830. hasProp = {}.hasOwnProperty;
  27831. module.exports = XMLStringifier = (function() {
  27832. function XMLStringifier(options) {
  27833. this.assertLegalName = bind(this.assertLegalName, this);
  27834. this.assertLegalChar = bind(this.assertLegalChar, this);
  27835. var key, ref, value;
  27836. options || (options = {});
  27837. this.options = options;
  27838. if (!this.options.version) {
  27839. this.options.version = '1.0';
  27840. }
  27841. ref = options.stringify || {};
  27842. for (key in ref) {
  27843. if (!hasProp.call(ref, key)) continue;
  27844. value = ref[key];
  27845. this[key] = value;
  27846. }
  27847. }
  27848. XMLStringifier.prototype.name = function(val) {
  27849. if (this.options.noValidation) {
  27850. return val;
  27851. }
  27852. return this.assertLegalName('' + val || '');
  27853. };
  27854. XMLStringifier.prototype.text = function(val) {
  27855. if (this.options.noValidation) {
  27856. return val;
  27857. }
  27858. return this.assertLegalChar(this.textEscape('' + val || ''));
  27859. };
  27860. XMLStringifier.prototype.cdata = function(val) {
  27861. if (this.options.noValidation) {
  27862. return val;
  27863. }
  27864. val = '' + val || '';
  27865. val = val.replace(']]>', ']]]]><![CDATA[>');
  27866. return this.assertLegalChar(val);
  27867. };
  27868. XMLStringifier.prototype.comment = function(val) {
  27869. if (this.options.noValidation) {
  27870. return val;
  27871. }
  27872. val = '' + val || '';
  27873. if (val.match(/--/)) {
  27874. throw new Error("Comment text cannot contain double-hypen: " + val);
  27875. }
  27876. return this.assertLegalChar(val);
  27877. };
  27878. XMLStringifier.prototype.raw = function(val) {
  27879. if (this.options.noValidation) {
  27880. return val;
  27881. }
  27882. return '' + val || '';
  27883. };
  27884. XMLStringifier.prototype.attValue = function(val) {
  27885. if (this.options.noValidation) {
  27886. return val;
  27887. }
  27888. return this.assertLegalChar(this.attEscape(val = '' + val || ''));
  27889. };
  27890. XMLStringifier.prototype.insTarget = function(val) {
  27891. if (this.options.noValidation) {
  27892. return val;
  27893. }
  27894. return this.assertLegalChar('' + val || '');
  27895. };
  27896. XMLStringifier.prototype.insValue = function(val) {
  27897. if (this.options.noValidation) {
  27898. return val;
  27899. }
  27900. val = '' + val || '';
  27901. if (val.match(/\?>/)) {
  27902. throw new Error("Invalid processing instruction value: " + val);
  27903. }
  27904. return this.assertLegalChar(val);
  27905. };
  27906. XMLStringifier.prototype.xmlVersion = function(val) {
  27907. if (this.options.noValidation) {
  27908. return val;
  27909. }
  27910. val = '' + val || '';
  27911. if (!val.match(/1\.[0-9]+/)) {
  27912. throw new Error("Invalid version number: " + val);
  27913. }
  27914. return val;
  27915. };
  27916. XMLStringifier.prototype.xmlEncoding = function(val) {
  27917. if (this.options.noValidation) {
  27918. return val;
  27919. }
  27920. val = '' + val || '';
  27921. if (!val.match(/^[A-Za-z](?:[A-Za-z0-9._-])*$/)) {
  27922. throw new Error("Invalid encoding: " + val);
  27923. }
  27924. return this.assertLegalChar(val);
  27925. };
  27926. XMLStringifier.prototype.xmlStandalone = function(val) {
  27927. if (this.options.noValidation) {
  27928. return val;
  27929. }
  27930. if (val) {
  27931. return "yes";
  27932. } else {
  27933. return "no";
  27934. }
  27935. };
  27936. XMLStringifier.prototype.dtdPubID = function(val) {
  27937. if (this.options.noValidation) {
  27938. return val;
  27939. }
  27940. return this.assertLegalChar('' + val || '');
  27941. };
  27942. XMLStringifier.prototype.dtdSysID = function(val) {
  27943. if (this.options.noValidation) {
  27944. return val;
  27945. }
  27946. return this.assertLegalChar('' + val || '');
  27947. };
  27948. XMLStringifier.prototype.dtdElementValue = function(val) {
  27949. if (this.options.noValidation) {
  27950. return val;
  27951. }
  27952. return this.assertLegalChar('' + val || '');
  27953. };
  27954. XMLStringifier.prototype.dtdAttType = function(val) {
  27955. if (this.options.noValidation) {
  27956. return val;
  27957. }
  27958. return this.assertLegalChar('' + val || '');
  27959. };
  27960. XMLStringifier.prototype.dtdAttDefault = function(val) {
  27961. if (this.options.noValidation) {
  27962. return val;
  27963. }
  27964. return this.assertLegalChar('' + val || '');
  27965. };
  27966. XMLStringifier.prototype.dtdEntityValue = function(val) {
  27967. if (this.options.noValidation) {
  27968. return val;
  27969. }
  27970. return this.assertLegalChar('' + val || '');
  27971. };
  27972. XMLStringifier.prototype.dtdNData = function(val) {
  27973. if (this.options.noValidation) {
  27974. return val;
  27975. }
  27976. return this.assertLegalChar('' + val || '');
  27977. };
  27978. XMLStringifier.prototype.convertAttKey = '@';
  27979. XMLStringifier.prototype.convertPIKey = '?';
  27980. XMLStringifier.prototype.convertTextKey = '#text';
  27981. XMLStringifier.prototype.convertCDataKey = '#cdata';
  27982. XMLStringifier.prototype.convertCommentKey = '#comment';
  27983. XMLStringifier.prototype.convertRawKey = '#raw';
  27984. XMLStringifier.prototype.assertLegalChar = function(str) {
  27985. var regex, res;
  27986. if (this.options.noValidation) {
  27987. return str;
  27988. }
  27989. regex = '';
  27990. if (this.options.version === '1.0') {
  27991. regex = /[\0-\x08\x0B\f\x0E-\x1F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/;
  27992. if (res = str.match(regex)) {
  27993. throw new Error("Invalid character in string: " + str + " at index " + res.index);
  27994. }
  27995. } else if (this.options.version === '1.1') {
  27996. regex = /[\0\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/;
  27997. if (res = str.match(regex)) {
  27998. throw new Error("Invalid character in string: " + str + " at index " + res.index);
  27999. }
  28000. }
  28001. return str;
  28002. };
  28003. XMLStringifier.prototype.assertLegalName = function(str) {
  28004. var regex;
  28005. if (this.options.noValidation) {
  28006. return str;
  28007. }
  28008. this.assertLegalChar(str);
  28009. regex = /^([:A-Z_a-z\xC0-\xD6\xD8-\xF6\xF8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])([\x2D\.0-:A-Z_a-z\xB7\xC0-\xD6\xD8-\xF6\xF8-\u037D\u037F-\u1FFF\u200C\u200D\u203F\u2040\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])*$/;
  28010. if (!str.match(regex)) {
  28011. throw new Error("Invalid character in name");
  28012. }
  28013. return str;
  28014. };
  28015. XMLStringifier.prototype.textEscape = function(str) {
  28016. var ampregex;
  28017. if (this.options.noValidation) {
  28018. return str;
  28019. }
  28020. ampregex = this.options.noDoubleEncoding ? /(?!&\S+;)&/g : /&/g;
  28021. return str.replace(ampregex, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/\r/g, '&#xD;');
  28022. };
  28023. XMLStringifier.prototype.attEscape = function(str) {
  28024. var ampregex;
  28025. if (this.options.noValidation) {
  28026. return str;
  28027. }
  28028. ampregex = this.options.noDoubleEncoding ? /(?!&\S+;)&/g : /&/g;
  28029. return str.replace(ampregex, '&amp;').replace(/</g, '&lt;').replace(/"/g, '&quot;').replace(/\t/g, '&#x9;').replace(/\n/g, '&#xA;').replace(/\r/g, '&#xD;');
  28030. };
  28031. return XMLStringifier;
  28032. })();
  28033. }).call(this);
  28034. },{}],389:[function(require,module,exports){
  28035. // Generated by CoffeeScript 1.12.7
  28036. (function() {
  28037. var NodeType, XMLCharacterData, XMLText,
  28038. extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
  28039. hasProp = {}.hasOwnProperty;
  28040. NodeType = require('./NodeType');
  28041. XMLCharacterData = require('./XMLCharacterData');
  28042. module.exports = XMLText = (function(superClass) {
  28043. extend(XMLText, superClass);
  28044. function XMLText(parent, text) {
  28045. XMLText.__super__.constructor.call(this, parent);
  28046. if (text == null) {
  28047. throw new Error("Missing element text. " + this.debugInfo());
  28048. }
  28049. this.name = "#text";
  28050. this.type = NodeType.Text;
  28051. this.value = this.stringify.text(text);
  28052. }
  28053. Object.defineProperty(XMLText.prototype, 'isElementContentWhitespace', {
  28054. get: function() {
  28055. throw new Error("This DOM method is not implemented." + this.debugInfo());
  28056. }
  28057. });
  28058. Object.defineProperty(XMLText.prototype, 'wholeText', {
  28059. get: function() {
  28060. var next, prev, str;
  28061. str = '';
  28062. prev = this.previousSibling;
  28063. while (prev) {
  28064. str = prev.data + str;
  28065. prev = prev.previousSibling;
  28066. }
  28067. str += this.data;
  28068. next = this.nextSibling;
  28069. while (next) {
  28070. str = str + next.data;
  28071. next = next.nextSibling;
  28072. }
  28073. return str;
  28074. }
  28075. });
  28076. XMLText.prototype.clone = function() {
  28077. return Object.create(this);
  28078. };
  28079. XMLText.prototype.toString = function(options) {
  28080. return this.options.writer.text(this, this.options.writer.filterOptions(options));
  28081. };
  28082. XMLText.prototype.splitText = function(offset) {
  28083. throw new Error("This DOM method is not implemented." + this.debugInfo());
  28084. };
  28085. XMLText.prototype.replaceWholeText = function(content) {
  28086. throw new Error("This DOM method is not implemented." + this.debugInfo());
  28087. };
  28088. return XMLText;
  28089. })(XMLCharacterData);
  28090. }).call(this);
  28091. },{"./NodeType":360,"./XMLCharacterData":365}],390:[function(require,module,exports){
  28092. // Generated by CoffeeScript 1.12.7
  28093. (function() {
  28094. var NodeType, WriterState, XMLCData, XMLComment, XMLDTDAttList, XMLDTDElement, XMLDTDEntity, XMLDTDNotation, XMLDeclaration, XMLDocType, XMLDummy, XMLElement, XMLProcessingInstruction, XMLRaw, XMLText, XMLWriterBase, assign,
  28095. hasProp = {}.hasOwnProperty;
  28096. assign = require('./Utility').assign;
  28097. NodeType = require('./NodeType');
  28098. XMLDeclaration = require('./XMLDeclaration');
  28099. XMLDocType = require('./XMLDocType');
  28100. XMLCData = require('./XMLCData');
  28101. XMLComment = require('./XMLComment');
  28102. XMLElement = require('./XMLElement');
  28103. XMLRaw = require('./XMLRaw');
  28104. XMLText = require('./XMLText');
  28105. XMLProcessingInstruction = require('./XMLProcessingInstruction');
  28106. XMLDummy = require('./XMLDummy');
  28107. XMLDTDAttList = require('./XMLDTDAttList');
  28108. XMLDTDElement = require('./XMLDTDElement');
  28109. XMLDTDEntity = require('./XMLDTDEntity');
  28110. XMLDTDNotation = require('./XMLDTDNotation');
  28111. WriterState = require('./WriterState');
  28112. module.exports = XMLWriterBase = (function() {
  28113. function XMLWriterBase(options) {
  28114. var key, ref, value;
  28115. options || (options = {});
  28116. this.options = options;
  28117. ref = options.writer || {};
  28118. for (key in ref) {
  28119. if (!hasProp.call(ref, key)) continue;
  28120. value = ref[key];
  28121. this["_" + key] = this[key];
  28122. this[key] = value;
  28123. }
  28124. }
  28125. XMLWriterBase.prototype.filterOptions = function(options) {
  28126. var filteredOptions, ref, ref1, ref2, ref3, ref4, ref5, ref6;
  28127. options || (options = {});
  28128. options = assign({}, this.options, options);
  28129. filteredOptions = {
  28130. writer: this
  28131. };
  28132. filteredOptions.pretty = options.pretty || false;
  28133. filteredOptions.allowEmpty = options.allowEmpty || false;
  28134. filteredOptions.indent = (ref = options.indent) != null ? ref : ' ';
  28135. filteredOptions.newline = (ref1 = options.newline) != null ? ref1 : '\n';
  28136. filteredOptions.offset = (ref2 = options.offset) != null ? ref2 : 0;
  28137. filteredOptions.dontPrettyTextNodes = (ref3 = (ref4 = options.dontPrettyTextNodes) != null ? ref4 : options.dontprettytextnodes) != null ? ref3 : 0;
  28138. filteredOptions.spaceBeforeSlash = (ref5 = (ref6 = options.spaceBeforeSlash) != null ? ref6 : options.spacebeforeslash) != null ? ref5 : '';
  28139. if (filteredOptions.spaceBeforeSlash === true) {
  28140. filteredOptions.spaceBeforeSlash = ' ';
  28141. }
  28142. filteredOptions.suppressPrettyCount = 0;
  28143. filteredOptions.user = {};
  28144. filteredOptions.state = WriterState.None;
  28145. return filteredOptions;
  28146. };
  28147. XMLWriterBase.prototype.indent = function(node, options, level) {
  28148. var indentLevel;
  28149. if (!options.pretty || options.suppressPrettyCount) {
  28150. return '';
  28151. } else if (options.pretty) {
  28152. indentLevel = (level || 0) + options.offset + 1;
  28153. if (indentLevel > 0) {
  28154. return new Array(indentLevel).join(options.indent);
  28155. }
  28156. }
  28157. return '';
  28158. };
  28159. XMLWriterBase.prototype.endline = function(node, options, level) {
  28160. if (!options.pretty || options.suppressPrettyCount) {
  28161. return '';
  28162. } else {
  28163. return options.newline;
  28164. }
  28165. };
  28166. XMLWriterBase.prototype.attribute = function(att, options, level) {
  28167. var r;
  28168. this.openAttribute(att, options, level);
  28169. r = ' ' + att.name + '="' + att.value + '"';
  28170. this.closeAttribute(att, options, level);
  28171. return r;
  28172. };
  28173. XMLWriterBase.prototype.cdata = function(node, options, level) {
  28174. var r;
  28175. this.openNode(node, options, level);
  28176. options.state = WriterState.OpenTag;
  28177. r = this.indent(node, options, level) + '<![CDATA[';
  28178. options.state = WriterState.InsideTag;
  28179. r += node.value;
  28180. options.state = WriterState.CloseTag;
  28181. r += ']]>' + this.endline(node, options, level);
  28182. options.state = WriterState.None;
  28183. this.closeNode(node, options, level);
  28184. return r;
  28185. };
  28186. XMLWriterBase.prototype.comment = function(node, options, level) {
  28187. var r;
  28188. this.openNode(node, options, level);
  28189. options.state = WriterState.OpenTag;
  28190. r = this.indent(node, options, level) + '<!-- ';
  28191. options.state = WriterState.InsideTag;
  28192. r += node.value;
  28193. options.state = WriterState.CloseTag;
  28194. r += ' -->' + this.endline(node, options, level);
  28195. options.state = WriterState.None;
  28196. this.closeNode(node, options, level);
  28197. return r;
  28198. };
  28199. XMLWriterBase.prototype.declaration = function(node, options, level) {
  28200. var r;
  28201. this.openNode(node, options, level);
  28202. options.state = WriterState.OpenTag;
  28203. r = this.indent(node, options, level) + '<?xml';
  28204. options.state = WriterState.InsideTag;
  28205. r += ' version="' + node.version + '"';
  28206. if (node.encoding != null) {
  28207. r += ' encoding="' + node.encoding + '"';
  28208. }
  28209. if (node.standalone != null) {
  28210. r += ' standalone="' + node.standalone + '"';
  28211. }
  28212. options.state = WriterState.CloseTag;
  28213. r += options.spaceBeforeSlash + '?>';
  28214. r += this.endline(node, options, level);
  28215. options.state = WriterState.None;
  28216. this.closeNode(node, options, level);
  28217. return r;
  28218. };
  28219. XMLWriterBase.prototype.docType = function(node, options, level) {
  28220. var child, i, len, r, ref;
  28221. level || (level = 0);
  28222. this.openNode(node, options, level);
  28223. options.state = WriterState.OpenTag;
  28224. r = this.indent(node, options, level);
  28225. r += '<!DOCTYPE ' + node.root().name;
  28226. if (node.pubID && node.sysID) {
  28227. r += ' PUBLIC "' + node.pubID + '" "' + node.sysID + '"';
  28228. } else if (node.sysID) {
  28229. r += ' SYSTEM "' + node.sysID + '"';
  28230. }
  28231. if (node.children.length > 0) {
  28232. r += ' [';
  28233. r += this.endline(node, options, level);
  28234. options.state = WriterState.InsideTag;
  28235. ref = node.children;
  28236. for (i = 0, len = ref.length; i < len; i++) {
  28237. child = ref[i];
  28238. r += this.writeChildNode(child, options, level + 1);
  28239. }
  28240. options.state = WriterState.CloseTag;
  28241. r += ']';
  28242. }
  28243. options.state = WriterState.CloseTag;
  28244. r += options.spaceBeforeSlash + '>';
  28245. r += this.endline(node, options, level);
  28246. options.state = WriterState.None;
  28247. this.closeNode(node, options, level);
  28248. return r;
  28249. };
  28250. XMLWriterBase.prototype.element = function(node, options, level) {
  28251. var att, child, childNodeCount, firstChildNode, i, j, len, len1, name, prettySuppressed, r, ref, ref1, ref2;
  28252. level || (level = 0);
  28253. prettySuppressed = false;
  28254. r = '';
  28255. this.openNode(node, options, level);
  28256. options.state = WriterState.OpenTag;
  28257. r += this.indent(node, options, level) + '<' + node.name;
  28258. ref = node.attribs;
  28259. for (name in ref) {
  28260. if (!hasProp.call(ref, name)) continue;
  28261. att = ref[name];
  28262. r += this.attribute(att, options, level);
  28263. }
  28264. childNodeCount = node.children.length;
  28265. firstChildNode = childNodeCount === 0 ? null : node.children[0];
  28266. if (childNodeCount === 0 || node.children.every(function(e) {
  28267. return (e.type === NodeType.Text || e.type === NodeType.Raw) && e.value === '';
  28268. })) {
  28269. if (options.allowEmpty) {
  28270. r += '>';
  28271. options.state = WriterState.CloseTag;
  28272. r += '</' + node.name + '>' + this.endline(node, options, level);
  28273. } else {
  28274. options.state = WriterState.CloseTag;
  28275. r += options.spaceBeforeSlash + '/>' + this.endline(node, options, level);
  28276. }
  28277. } else if (options.pretty && childNodeCount === 1 && (firstChildNode.type === NodeType.Text || firstChildNode.type === NodeType.Raw) && (firstChildNode.value != null)) {
  28278. r += '>';
  28279. options.state = WriterState.InsideTag;
  28280. options.suppressPrettyCount++;
  28281. prettySuppressed = true;
  28282. r += this.writeChildNode(firstChildNode, options, level + 1);
  28283. options.suppressPrettyCount--;
  28284. prettySuppressed = false;
  28285. options.state = WriterState.CloseTag;
  28286. r += '</' + node.name + '>' + this.endline(node, options, level);
  28287. } else {
  28288. if (options.dontPrettyTextNodes) {
  28289. ref1 = node.children;
  28290. for (i = 0, len = ref1.length; i < len; i++) {
  28291. child = ref1[i];
  28292. if ((child.type === NodeType.Text || child.type === NodeType.Raw) && (child.value != null)) {
  28293. options.suppressPrettyCount++;
  28294. prettySuppressed = true;
  28295. break;
  28296. }
  28297. }
  28298. }
  28299. r += '>' + this.endline(node, options, level);
  28300. options.state = WriterState.InsideTag;
  28301. ref2 = node.children;
  28302. for (j = 0, len1 = ref2.length; j < len1; j++) {
  28303. child = ref2[j];
  28304. r += this.writeChildNode(child, options, level + 1);
  28305. }
  28306. options.state = WriterState.CloseTag;
  28307. r += this.indent(node, options, level) + '</' + node.name + '>';
  28308. if (prettySuppressed) {
  28309. options.suppressPrettyCount--;
  28310. }
  28311. r += this.endline(node, options, level);
  28312. options.state = WriterState.None;
  28313. }
  28314. this.closeNode(node, options, level);
  28315. return r;
  28316. };
  28317. XMLWriterBase.prototype.writeChildNode = function(node, options, level) {
  28318. switch (node.type) {
  28319. case NodeType.CData:
  28320. return this.cdata(node, options, level);
  28321. case NodeType.Comment:
  28322. return this.comment(node, options, level);
  28323. case NodeType.Element:
  28324. return this.element(node, options, level);
  28325. case NodeType.Raw:
  28326. return this.raw(node, options, level);
  28327. case NodeType.Text:
  28328. return this.text(node, options, level);
  28329. case NodeType.ProcessingInstruction:
  28330. return this.processingInstruction(node, options, level);
  28331. case NodeType.Dummy:
  28332. return '';
  28333. case NodeType.Declaration:
  28334. return this.declaration(node, options, level);
  28335. case NodeType.DocType:
  28336. return this.docType(node, options, level);
  28337. case NodeType.AttributeDeclaration:
  28338. return this.dtdAttList(node, options, level);
  28339. case NodeType.ElementDeclaration:
  28340. return this.dtdElement(node, options, level);
  28341. case NodeType.EntityDeclaration:
  28342. return this.dtdEntity(node, options, level);
  28343. case NodeType.NotationDeclaration:
  28344. return this.dtdNotation(node, options, level);
  28345. default:
  28346. throw new Error("Unknown XML node type: " + node.constructor.name);
  28347. }
  28348. };
  28349. XMLWriterBase.prototype.processingInstruction = function(node, options, level) {
  28350. var r;
  28351. this.openNode(node, options, level);
  28352. options.state = WriterState.OpenTag;
  28353. r = this.indent(node, options, level) + '<?';
  28354. options.state = WriterState.InsideTag;
  28355. r += node.target;
  28356. if (node.value) {
  28357. r += ' ' + node.value;
  28358. }
  28359. options.state = WriterState.CloseTag;
  28360. r += options.spaceBeforeSlash + '?>';
  28361. r += this.endline(node, options, level);
  28362. options.state = WriterState.None;
  28363. this.closeNode(node, options, level);
  28364. return r;
  28365. };
  28366. XMLWriterBase.prototype.raw = function(node, options, level) {
  28367. var r;
  28368. this.openNode(node, options, level);
  28369. options.state = WriterState.OpenTag;
  28370. r = this.indent(node, options, level);
  28371. options.state = WriterState.InsideTag;
  28372. r += node.value;
  28373. options.state = WriterState.CloseTag;
  28374. r += this.endline(node, options, level);
  28375. options.state = WriterState.None;
  28376. this.closeNode(node, options, level);
  28377. return r;
  28378. };
  28379. XMLWriterBase.prototype.text = function(node, options, level) {
  28380. var r;
  28381. this.openNode(node, options, level);
  28382. options.state = WriterState.OpenTag;
  28383. r = this.indent(node, options, level);
  28384. options.state = WriterState.InsideTag;
  28385. r += node.value;
  28386. options.state = WriterState.CloseTag;
  28387. r += this.endline(node, options, level);
  28388. options.state = WriterState.None;
  28389. this.closeNode(node, options, level);
  28390. return r;
  28391. };
  28392. XMLWriterBase.prototype.dtdAttList = function(node, options, level) {
  28393. var r;
  28394. this.openNode(node, options, level);
  28395. options.state = WriterState.OpenTag;
  28396. r = this.indent(node, options, level) + '<!ATTLIST';
  28397. options.state = WriterState.InsideTag;
  28398. r += ' ' + node.elementName + ' ' + node.attributeName + ' ' + node.attributeType;
  28399. if (node.defaultValueType !== '#DEFAULT') {
  28400. r += ' ' + node.defaultValueType;
  28401. }
  28402. if (node.defaultValue) {
  28403. r += ' "' + node.defaultValue + '"';
  28404. }
  28405. options.state = WriterState.CloseTag;
  28406. r += options.spaceBeforeSlash + '>' + this.endline(node, options, level);
  28407. options.state = WriterState.None;
  28408. this.closeNode(node, options, level);
  28409. return r;
  28410. };
  28411. XMLWriterBase.prototype.dtdElement = function(node, options, level) {
  28412. var r;
  28413. this.openNode(node, options, level);
  28414. options.state = WriterState.OpenTag;
  28415. r = this.indent(node, options, level) + '<!ELEMENT';
  28416. options.state = WriterState.InsideTag;
  28417. r += ' ' + node.name + ' ' + node.value;
  28418. options.state = WriterState.CloseTag;
  28419. r += options.spaceBeforeSlash + '>' + this.endline(node, options, level);
  28420. options.state = WriterState.None;
  28421. this.closeNode(node, options, level);
  28422. return r;
  28423. };
  28424. XMLWriterBase.prototype.dtdEntity = function(node, options, level) {
  28425. var r;
  28426. this.openNode(node, options, level);
  28427. options.state = WriterState.OpenTag;
  28428. r = this.indent(node, options, level) + '<!ENTITY';
  28429. options.state = WriterState.InsideTag;
  28430. if (node.pe) {
  28431. r += ' %';
  28432. }
  28433. r += ' ' + node.name;
  28434. if (node.value) {
  28435. r += ' "' + node.value + '"';
  28436. } else {
  28437. if (node.pubID && node.sysID) {
  28438. r += ' PUBLIC "' + node.pubID + '" "' + node.sysID + '"';
  28439. } else if (node.sysID) {
  28440. r += ' SYSTEM "' + node.sysID + '"';
  28441. }
  28442. if (node.nData) {
  28443. r += ' NDATA ' + node.nData;
  28444. }
  28445. }
  28446. options.state = WriterState.CloseTag;
  28447. r += options.spaceBeforeSlash + '>' + this.endline(node, options, level);
  28448. options.state = WriterState.None;
  28449. this.closeNode(node, options, level);
  28450. return r;
  28451. };
  28452. XMLWriterBase.prototype.dtdNotation = function(node, options, level) {
  28453. var r;
  28454. this.openNode(node, options, level);
  28455. options.state = WriterState.OpenTag;
  28456. r = this.indent(node, options, level) + '<!NOTATION';
  28457. options.state = WriterState.InsideTag;
  28458. r += ' ' + node.name;
  28459. if (node.pubID && node.sysID) {
  28460. r += ' PUBLIC "' + node.pubID + '" "' + node.sysID + '"';
  28461. } else if (node.pubID) {
  28462. r += ' PUBLIC "' + node.pubID + '"';
  28463. } else if (node.sysID) {
  28464. r += ' SYSTEM "' + node.sysID + '"';
  28465. }
  28466. options.state = WriterState.CloseTag;
  28467. r += options.spaceBeforeSlash + '>' + this.endline(node, options, level);
  28468. options.state = WriterState.None;
  28469. this.closeNode(node, options, level);
  28470. return r;
  28471. };
  28472. XMLWriterBase.prototype.openNode = function(node, options, level) {};
  28473. XMLWriterBase.prototype.closeNode = function(node, options, level) {};
  28474. XMLWriterBase.prototype.openAttribute = function(att, options, level) {};
  28475. XMLWriterBase.prototype.closeAttribute = function(att, options, level) {};
  28476. return XMLWriterBase;
  28477. })();
  28478. }).call(this);
  28479. },{"./NodeType":360,"./Utility":361,"./WriterState":362,"./XMLCData":364,"./XMLComment":366,"./XMLDTDAttList":371,"./XMLDTDElement":372,"./XMLDTDEntity":373,"./XMLDTDNotation":374,"./XMLDeclaration":375,"./XMLDocType":376,"./XMLDummy":379,"./XMLElement":380,"./XMLProcessingInstruction":384,"./XMLRaw":385,"./XMLText":389}],391:[function(require,module,exports){
  28480. // Generated by CoffeeScript 1.12.7
  28481. (function() {
  28482. var NodeType, WriterState, XMLDOMImplementation, XMLDocument, XMLDocumentCB, XMLStreamWriter, XMLStringWriter, assign, isFunction, ref;
  28483. ref = require('./Utility'), assign = ref.assign, isFunction = ref.isFunction;
  28484. XMLDOMImplementation = require('./XMLDOMImplementation');
  28485. XMLDocument = require('./XMLDocument');
  28486. XMLDocumentCB = require('./XMLDocumentCB');
  28487. XMLStringWriter = require('./XMLStringWriter');
  28488. XMLStreamWriter = require('./XMLStreamWriter');
  28489. NodeType = require('./NodeType');
  28490. WriterState = require('./WriterState');
  28491. module.exports.create = function(name, xmldec, doctype, options) {
  28492. var doc, root;
  28493. if (name == null) {
  28494. throw new Error("Root element needs a name.");
  28495. }
  28496. options = assign({}, xmldec, doctype, options);
  28497. doc = new XMLDocument(options);
  28498. root = doc.element(name);
  28499. if (!options.headless) {
  28500. doc.declaration(options);
  28501. if ((options.pubID != null) || (options.sysID != null)) {
  28502. doc.dtd(options);
  28503. }
  28504. }
  28505. return root;
  28506. };
  28507. module.exports.begin = function(options, onData, onEnd) {
  28508. var ref1;
  28509. if (isFunction(options)) {
  28510. ref1 = [options, onData], onData = ref1[0], onEnd = ref1[1];
  28511. options = {};
  28512. }
  28513. if (onData) {
  28514. return new XMLDocumentCB(options, onData, onEnd);
  28515. } else {
  28516. return new XMLDocument(options);
  28517. }
  28518. };
  28519. module.exports.stringWriter = function(options) {
  28520. return new XMLStringWriter(options);
  28521. };
  28522. module.exports.streamWriter = function(stream, options) {
  28523. return new XMLStreamWriter(stream, options);
  28524. };
  28525. module.exports.implementation = new XMLDOMImplementation();
  28526. module.exports.nodeType = NodeType;
  28527. module.exports.writerState = WriterState;
  28528. }).call(this);
  28529. },{"./NodeType":360,"./Utility":361,"./WriterState":362,"./XMLDOMImplementation":369,"./XMLDocument":377,"./XMLDocumentCB":378,"./XMLStreamWriter":386,"./XMLStringWriter":387}],392:[function(require,module,exports){
  28530. module.exports = extend
  28531. var hasOwnProperty = Object.prototype.hasOwnProperty;
  28532. function extend() {
  28533. var target = {}
  28534. for (var i = 0; i < arguments.length; i++) {
  28535. var source = arguments[i]
  28536. for (var key in source) {
  28537. if (hasOwnProperty.call(source, key)) {
  28538. target[key] = source[key]
  28539. }
  28540. }
  28541. }
  28542. return target
  28543. }
  28544. },{}],393:[function(require,module,exports){
  28545. "use strict";
  28546. require("core-js/modules/es.array.fill.js");
  28547. require("core-js/modules/es.array.concat.js");
  28548. require("core-js/modules/es.object.to-string.js");
  28549. require("core-js/modules/es.regexp.to-string.js");
  28550. require("core-js/modules/es.array.join.js");
  28551. require("core-js/modules/es.array.slice.js");
  28552. var Buffer = require('buffer').Buffer;
  28553. var sha = require('./sha');
  28554. var md5 = require('./md5');
  28555. var algorithms = {
  28556. sha1: sha,
  28557. md5: md5
  28558. };
  28559. var blocksize = 64;
  28560. var zeroBuffer = Buffer.alloc(blocksize);
  28561. zeroBuffer.fill(0);
  28562. function hmac(fn, key, data) {
  28563. if (!Buffer.isBuffer(key)) key = Buffer.from(key);
  28564. if (!Buffer.isBuffer(data)) data = Buffer.from(data);
  28565. if (key.length > blocksize) {
  28566. key = fn(key);
  28567. } else if (key.length < blocksize) {
  28568. key = Buffer.concat([key, zeroBuffer], blocksize);
  28569. }
  28570. var ipad = Buffer.alloc(blocksize),
  28571. opad = Buffer.alloc(blocksize);
  28572. for (var i = 0; i < blocksize; i++) {
  28573. ipad[i] = key[i] ^ 0x36;
  28574. opad[i] = key[i] ^ 0x5C;
  28575. }
  28576. var hash = fn(Buffer.concat([ipad, data]));
  28577. return fn(Buffer.concat([opad, hash]));
  28578. }
  28579. function hash(alg, key) {
  28580. alg = alg || 'sha1';
  28581. var fn = algorithms[alg];
  28582. var bufs = [];
  28583. var length = 0;
  28584. if (!fn) error('algorithm:', alg, 'is not yet supported');
  28585. return {
  28586. update: function update(data) {
  28587. if (!Buffer.isBuffer(data)) data = Buffer.from(data);
  28588. bufs.push(data);
  28589. length += data.length;
  28590. return this;
  28591. },
  28592. digest: function digest(enc) {
  28593. var buf = Buffer.concat(bufs);
  28594. var r = key ? hmac(fn, key, buf) : fn(buf);
  28595. bufs = null;
  28596. return enc ? r.toString(enc) : r;
  28597. }
  28598. };
  28599. }
  28600. function error() {
  28601. var m = [].slice.call(arguments).join(' ');
  28602. throw new Error([m, 'we accept pull requests', 'http://github.com/dominictarr/crypto-browserify'].join('\n'));
  28603. }
  28604. exports.createHash = function (alg) {
  28605. return hash(alg);
  28606. };
  28607. exports.createHmac = function (alg, key) {
  28608. return hash(alg, key);
  28609. };
  28610. exports.createCredentials = function () {
  28611. error('sorry,createCredentials is not implemented yet');
  28612. };
  28613. exports.createCipher = function () {
  28614. error('sorry,createCipher is not implemented yet');
  28615. };
  28616. exports.createCipheriv = function () {
  28617. error('sorry,createCipheriv is not implemented yet');
  28618. };
  28619. exports.createDecipher = function () {
  28620. error('sorry,createDecipher is not implemented yet');
  28621. };
  28622. exports.createDecipheriv = function () {
  28623. error('sorry,createDecipheriv is not implemented yet');
  28624. };
  28625. exports.createSign = function () {
  28626. error('sorry,createSign is not implemented yet');
  28627. };
  28628. exports.createVerify = function () {
  28629. error('sorry,createVerify is not implemented yet');
  28630. };
  28631. exports.createDiffieHellman = function () {
  28632. error('sorry,createDiffieHellman is not implemented yet');
  28633. };
  28634. exports.pbkdf2 = function () {
  28635. error('sorry,pbkdf2 is not implemented yet');
  28636. };
  28637. },{"./md5":395,"./sha":396,"buffer":85,"core-js/modules/es.array.concat.js":241,"core-js/modules/es.array.fill.js":242,"core-js/modules/es.array.join.js":248,"core-js/modules/es.array.slice.js":250,"core-js/modules/es.object.to-string.js":258,"core-js/modules/es.regexp.to-string.js":262}],394:[function(require,module,exports){
  28638. "use strict";
  28639. require("core-js/modules/es.array.fill.js");
  28640. require("core-js/modules/es.array.concat.js");
  28641. var Buffer = require('buffer').Buffer;
  28642. var intSize = 4;
  28643. var zeroBuffer = Buffer.alloc(intSize);
  28644. zeroBuffer.fill(0);
  28645. var chrsz = 8;
  28646. function toArray(buf, bigEndian) {
  28647. if (buf.length % intSize !== 0) {
  28648. var len = buf.length + (intSize - buf.length % intSize);
  28649. buf = Buffer.concat([buf, zeroBuffer], len);
  28650. }
  28651. var arr = [];
  28652. var fn = bigEndian ? buf.readInt32BE : buf.readInt32LE;
  28653. for (var i = 0; i < buf.length; i += intSize) {
  28654. arr.push(fn.call(buf, i));
  28655. }
  28656. return arr;
  28657. }
  28658. function toBuffer(arr, size, bigEndian) {
  28659. var buf = Buffer.alloc(size);
  28660. var fn = bigEndian ? buf.writeInt32BE : buf.writeInt32LE;
  28661. for (var i = 0; i < arr.length; i++) {
  28662. fn.call(buf, arr[i], i * 4, true);
  28663. }
  28664. return buf;
  28665. }
  28666. function hash(buf, fn, hashSize, bigEndian) {
  28667. if (!Buffer.isBuffer(buf)) buf = Buffer.from(buf);
  28668. var arr = fn(toArray(buf, bigEndian), buf.length * chrsz);
  28669. return toBuffer(arr, hashSize, bigEndian);
  28670. }
  28671. module.exports = {
  28672. hash: hash
  28673. };
  28674. },{"buffer":85,"core-js/modules/es.array.concat.js":241,"core-js/modules/es.array.fill.js":242}],395:[function(require,module,exports){
  28675. "use strict";
  28676. /*
  28677. * A JavaScript implementation of the RSA Data Security, Inc. MD5 Message
  28678. * Digest Algorithm, as defined in RFC 1321.
  28679. * Version 2.1 Copyright (C) Paul Johnston 1999 - 2002.
  28680. * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet
  28681. * Distributed under the BSD License
  28682. * See http://pajhome.org.uk/crypt/md5 for more info.
  28683. */
  28684. var helpers = require('./helpers');
  28685. /*
  28686. * Perform a simple self-test to see if the VM is working
  28687. */
  28688. function md5_vm_test() {
  28689. return hex_md5("abc") == "900150983cd24fb0d6963f7d28e17f72";
  28690. }
  28691. /*
  28692. * Calculate the MD5 of an array of little-endian words, and a bit length
  28693. */
  28694. function core_md5(x, len) {
  28695. /* append padding */
  28696. x[len >> 5] |= 0x80 << len % 32;
  28697. x[(len + 64 >>> 9 << 4) + 14] = len;
  28698. var a = 1732584193;
  28699. var b = -271733879;
  28700. var c = -1732584194;
  28701. var d = 271733878;
  28702. for (var i = 0; i < x.length; i += 16) {
  28703. var olda = a;
  28704. var oldb = b;
  28705. var oldc = c;
  28706. var oldd = d;
  28707. a = md5_ff(a, b, c, d, x[i + 0], 7, -680876936);
  28708. d = md5_ff(d, a, b, c, x[i + 1], 12, -389564586);
  28709. c = md5_ff(c, d, a, b, x[i + 2], 17, 606105819);
  28710. b = md5_ff(b, c, d, a, x[i + 3], 22, -1044525330);
  28711. a = md5_ff(a, b, c, d, x[i + 4], 7, -176418897);
  28712. d = md5_ff(d, a, b, c, x[i + 5], 12, 1200080426);
  28713. c = md5_ff(c, d, a, b, x[i + 6], 17, -1473231341);
  28714. b = md5_ff(b, c, d, a, x[i + 7], 22, -45705983);
  28715. a = md5_ff(a, b, c, d, x[i + 8], 7, 1770035416);
  28716. d = md5_ff(d, a, b, c, x[i + 9], 12, -1958414417);
  28717. c = md5_ff(c, d, a, b, x[i + 10], 17, -42063);
  28718. b = md5_ff(b, c, d, a, x[i + 11], 22, -1990404162);
  28719. a = md5_ff(a, b, c, d, x[i + 12], 7, 1804603682);
  28720. d = md5_ff(d, a, b, c, x[i + 13], 12, -40341101);
  28721. c = md5_ff(c, d, a, b, x[i + 14], 17, -1502002290);
  28722. b = md5_ff(b, c, d, a, x[i + 15], 22, 1236535329);
  28723. a = md5_gg(a, b, c, d, x[i + 1], 5, -165796510);
  28724. d = md5_gg(d, a, b, c, x[i + 6], 9, -1069501632);
  28725. c = md5_gg(c, d, a, b, x[i + 11], 14, 643717713);
  28726. b = md5_gg(b, c, d, a, x[i + 0], 20, -373897302);
  28727. a = md5_gg(a, b, c, d, x[i + 5], 5, -701558691);
  28728. d = md5_gg(d, a, b, c, x[i + 10], 9, 38016083);
  28729. c = md5_gg(c, d, a, b, x[i + 15], 14, -660478335);
  28730. b = md5_gg(b, c, d, a, x[i + 4], 20, -405537848);
  28731. a = md5_gg(a, b, c, d, x[i + 9], 5, 568446438);
  28732. d = md5_gg(d, a, b, c, x[i + 14], 9, -1019803690);
  28733. c = md5_gg(c, d, a, b, x[i + 3], 14, -187363961);
  28734. b = md5_gg(b, c, d, a, x[i + 8], 20, 1163531501);
  28735. a = md5_gg(a, b, c, d, x[i + 13], 5, -1444681467);
  28736. d = md5_gg(d, a, b, c, x[i + 2], 9, -51403784);
  28737. c = md5_gg(c, d, a, b, x[i + 7], 14, 1735328473);
  28738. b = md5_gg(b, c, d, a, x[i + 12], 20, -1926607734);
  28739. a = md5_hh(a, b, c, d, x[i + 5], 4, -378558);
  28740. d = md5_hh(d, a, b, c, x[i + 8], 11, -2022574463);
  28741. c = md5_hh(c, d, a, b, x[i + 11], 16, 1839030562);
  28742. b = md5_hh(b, c, d, a, x[i + 14], 23, -35309556);
  28743. a = md5_hh(a, b, c, d, x[i + 1], 4, -1530992060);
  28744. d = md5_hh(d, a, b, c, x[i + 4], 11, 1272893353);
  28745. c = md5_hh(c, d, a, b, x[i + 7], 16, -155497632);
  28746. b = md5_hh(b, c, d, a, x[i + 10], 23, -1094730640);
  28747. a = md5_hh(a, b, c, d, x[i + 13], 4, 681279174);
  28748. d = md5_hh(d, a, b, c, x[i + 0], 11, -358537222);
  28749. c = md5_hh(c, d, a, b, x[i + 3], 16, -722521979);
  28750. b = md5_hh(b, c, d, a, x[i + 6], 23, 76029189);
  28751. a = md5_hh(a, b, c, d, x[i + 9], 4, -640364487);
  28752. d = md5_hh(d, a, b, c, x[i + 12], 11, -421815835);
  28753. c = md5_hh(c, d, a, b, x[i + 15], 16, 530742520);
  28754. b = md5_hh(b, c, d, a, x[i + 2], 23, -995338651);
  28755. a = md5_ii(a, b, c, d, x[i + 0], 6, -198630844);
  28756. d = md5_ii(d, a, b, c, x[i + 7], 10, 1126891415);
  28757. c = md5_ii(c, d, a, b, x[i + 14], 15, -1416354905);
  28758. b = md5_ii(b, c, d, a, x[i + 5], 21, -57434055);
  28759. a = md5_ii(a, b, c, d, x[i + 12], 6, 1700485571);
  28760. d = md5_ii(d, a, b, c, x[i + 3], 10, -1894986606);
  28761. c = md5_ii(c, d, a, b, x[i + 10], 15, -1051523);
  28762. b = md5_ii(b, c, d, a, x[i + 1], 21, -2054922799);
  28763. a = md5_ii(a, b, c, d, x[i + 8], 6, 1873313359);
  28764. d = md5_ii(d, a, b, c, x[i + 15], 10, -30611744);
  28765. c = md5_ii(c, d, a, b, x[i + 6], 15, -1560198380);
  28766. b = md5_ii(b, c, d, a, x[i + 13], 21, 1309151649);
  28767. a = md5_ii(a, b, c, d, x[i + 4], 6, -145523070);
  28768. d = md5_ii(d, a, b, c, x[i + 11], 10, -1120210379);
  28769. c = md5_ii(c, d, a, b, x[i + 2], 15, 718787259);
  28770. b = md5_ii(b, c, d, a, x[i + 9], 21, -343485551);
  28771. a = safe_add(a, olda);
  28772. b = safe_add(b, oldb);
  28773. c = safe_add(c, oldc);
  28774. d = safe_add(d, oldd);
  28775. }
  28776. return Array(a, b, c, d);
  28777. }
  28778. /*
  28779. * These functions implement the four basic operations the algorithm uses.
  28780. */
  28781. function md5_cmn(q, a, b, x, s, t) {
  28782. return safe_add(bit_rol(safe_add(safe_add(a, q), safe_add(x, t)), s), b);
  28783. }
  28784. function md5_ff(a, b, c, d, x, s, t) {
  28785. return md5_cmn(b & c | ~b & d, a, b, x, s, t);
  28786. }
  28787. function md5_gg(a, b, c, d, x, s, t) {
  28788. return md5_cmn(b & d | c & ~d, a, b, x, s, t);
  28789. }
  28790. function md5_hh(a, b, c, d, x, s, t) {
  28791. return md5_cmn(b ^ c ^ d, a, b, x, s, t);
  28792. }
  28793. function md5_ii(a, b, c, d, x, s, t) {
  28794. return md5_cmn(c ^ (b | ~d), a, b, x, s, t);
  28795. }
  28796. /*
  28797. * Add integers, wrapping at 2^32. This uses 16-bit operations internally
  28798. * to work around bugs in some JS interpreters.
  28799. */
  28800. function safe_add(x, y) {
  28801. var lsw = (x & 0xFFFF) + (y & 0xFFFF);
  28802. var msw = (x >> 16) + (y >> 16) + (lsw >> 16);
  28803. return msw << 16 | lsw & 0xFFFF;
  28804. }
  28805. /*
  28806. * Bitwise rotate a 32-bit number to the left.
  28807. */
  28808. function bit_rol(num, cnt) {
  28809. return num << cnt | num >>> 32 - cnt;
  28810. }
  28811. module.exports = function md5(buf) {
  28812. return helpers.hash(buf, core_md5, 16);
  28813. };
  28814. },{"./helpers":394}],396:[function(require,module,exports){
  28815. "use strict";
  28816. /*
  28817. * A JavaScript implementation of the Secure Hash Algorithm, SHA-1, as defined
  28818. * in FIPS PUB 180-1
  28819. * Version 2.1a Copyright Paul Johnston 2000 - 2002.
  28820. * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet
  28821. * Distributed under the BSD License
  28822. * See http://pajhome.org.uk/crypt/md5 for details.
  28823. */
  28824. var helpers = require('./helpers');
  28825. /*
  28826. * Calculate the SHA-1 of an array of big-endian words, and a bit length
  28827. */
  28828. function core_sha1(x, len) {
  28829. /* append padding */
  28830. x[len >> 5] |= 0x80 << 24 - len % 32;
  28831. x[(len + 64 >> 9 << 4) + 15] = len;
  28832. var w = Array(80);
  28833. var a = 1732584193;
  28834. var b = -271733879;
  28835. var c = -1732584194;
  28836. var d = 271733878;
  28837. var e = -1009589776;
  28838. for (var i = 0; i < x.length; i += 16) {
  28839. var olda = a;
  28840. var oldb = b;
  28841. var oldc = c;
  28842. var oldd = d;
  28843. var olde = e;
  28844. for (var j = 0; j < 80; j++) {
  28845. if (j < 16) w[j] = x[i + j];else w[j] = rol(w[j - 3] ^ w[j - 8] ^ w[j - 14] ^ w[j - 16], 1);
  28846. var t = safe_add(safe_add(rol(a, 5), sha1_ft(j, b, c, d)), safe_add(safe_add(e, w[j]), sha1_kt(j)));
  28847. e = d;
  28848. d = c;
  28849. c = rol(b, 30);
  28850. b = a;
  28851. a = t;
  28852. }
  28853. a = safe_add(a, olda);
  28854. b = safe_add(b, oldb);
  28855. c = safe_add(c, oldc);
  28856. d = safe_add(d, oldd);
  28857. e = safe_add(e, olde);
  28858. }
  28859. return Array(a, b, c, d, e);
  28860. }
  28861. /*
  28862. * Perform the appropriate triplet combination function for the current
  28863. * iteration
  28864. */
  28865. function sha1_ft(t, b, c, d) {
  28866. if (t < 20) return b & c | ~b & d;
  28867. if (t < 40) return b ^ c ^ d;
  28868. if (t < 60) return b & c | b & d | c & d;
  28869. return b ^ c ^ d;
  28870. }
  28871. /*
  28872. * Determine the appropriate additive constant for the current iteration
  28873. */
  28874. function sha1_kt(t) {
  28875. return t < 20 ? 1518500249 : t < 40 ? 1859775393 : t < 60 ? -1894007588 : -899497514;
  28876. }
  28877. /*
  28878. * Add integers, wrapping at 2^32. This uses 16-bit operations internally
  28879. * to work around bugs in some JS interpreters.
  28880. */
  28881. function safe_add(x, y) {
  28882. var lsw = (x & 0xFFFF) + (y & 0xFFFF);
  28883. var msw = (x >> 16) + (y >> 16) + (lsw >> 16);
  28884. return msw << 16 | lsw & 0xFFFF;
  28885. }
  28886. /*
  28887. * Bitwise rotate a 32-bit number to the left.
  28888. */
  28889. function rol(num, cnt) {
  28890. return num << cnt | num >>> 32 - cnt;
  28891. }
  28892. module.exports = function sha1(buf) {
  28893. return helpers.hash(buf, core_sha1, 20, true);
  28894. };
  28895. },{"./helpers":394}],397:[function(require,module,exports){
  28896. "use strict";
  28897. module.exports = function () {
  28898. return function () {};
  28899. };
  28900. },{}],398:[function(require,module,exports){
  28901. (function (Buffer){(function (){
  28902. "use strict";
  28903. var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
  28904. var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
  28905. var _require = require('stream'),
  28906. Stream = _require.Stream;
  28907. var _require2 = require('../lib/common/utils/isArray'),
  28908. isArray = _require2.isArray;
  28909. module.exports.string = function isString(obj) {
  28910. return typeof obj === 'string';
  28911. };
  28912. module.exports.array = isArray;
  28913. module.exports.buffer = Buffer.isBuffer;
  28914. function isStream(obj) {
  28915. return obj instanceof Stream;
  28916. }
  28917. module.exports.writableStream = function isWritableStream(obj) {
  28918. return isStream(obj) && typeof obj._write === 'function' && (0, _typeof2.default)(obj._writableState) === 'object';
  28919. };
  28920. }).call(this)}).call(this,{"isBuffer":require("../node_modules/is-buffer/index.js")})
  28921. },{"../lib/common/utils/isArray":61,"../node_modules/is-buffer/index.js":312,"@babel/runtime/helpers/interopRequireDefault":74,"@babel/runtime/helpers/typeof":75,"stream":345}],399:[function(require,module,exports){
  28922. "use strict";
  28923. var immediate = require('immediate');
  28924. var process = module.exports = {};
  28925. process.nextTick = immediate;
  28926. process.title = 'browser';
  28927. process.browser = true;
  28928. process.env = {};
  28929. process.argv = [];
  28930. process.version = ''; // empty string to avoid regexp issues
  28931. process.versions = {};
  28932. function noop() {}
  28933. process.on = noop;
  28934. process.addListener = noop;
  28935. process.once = noop;
  28936. process.off = noop;
  28937. process.removeListener = noop;
  28938. process.removeAllListeners = noop;
  28939. process.emit = noop;
  28940. process.prependListener = noop;
  28941. process.prependOnceListener = noop;
  28942. process.listeners = function (name) {
  28943. return [];
  28944. };
  28945. process.binding = function (name) {
  28946. throw new Error('process.binding is not supported');
  28947. };
  28948. process.cwd = function () {
  28949. return '/';
  28950. };
  28951. process.chdir = function (dir) {
  28952. throw new Error('process.chdir is not supported');
  28953. };
  28954. process.umask = function () {
  28955. return 0;
  28956. };
  28957. },{"immediate":305}],400:[function(require,module,exports){
  28958. (function (global){(function (){
  28959. "use strict";
  28960. require("core-js/modules/es.regexp.exec.js");
  28961. require("core-js/modules/es.string.search.js");
  28962. //"version": "2.8.2",
  28963. var ClientRequest = require('./lib/request');
  28964. var response = require('./lib/response');
  28965. var extend = require('xtend');
  28966. var statusCodes = require('builtin-status-codes');
  28967. var url = require('url');
  28968. var http = exports;
  28969. http.request = function (opts, cb) {
  28970. if (typeof opts === 'string') opts = url.parse(opts);else opts = extend(opts); // Normally, the page is loaded from http or https, so not specifying a protocol
  28971. // will result in a (valid) protocol-relative url. However, this won't work if
  28972. // the protocol is something else, like 'file:'
  28973. var defaultProtocol = global.location.protocol.search(/^https?:$/) === -1 ? 'http:' : '';
  28974. var protocol = opts.protocol || defaultProtocol;
  28975. var host = opts.hostname || opts.host;
  28976. var port = opts.port;
  28977. var path = opts.path || '/'; // Necessary for IPv6 addresses
  28978. if (host && host.indexOf(':') !== -1) host = '[' + host + ']'; // This may be a relative url. The browser should always be able to interpret it correctly.
  28979. opts.url = (host ? protocol + '//' + host : '') + (port ? ':' + port : '') + path;
  28980. opts.method = (opts.method || 'GET').toUpperCase();
  28981. opts.headers = opts.headers || {}; // Also valid opts.auth, opts.mode
  28982. var req = new ClientRequest(opts);
  28983. if (cb) req.on('response', cb);
  28984. return req;
  28985. };
  28986. http.get = function get(opts, cb) {
  28987. var req = http.request(opts, cb);
  28988. req.end();
  28989. return req;
  28990. };
  28991. http.ClientRequest = ClientRequest;
  28992. http.IncomingMessage = response.IncomingMessage;
  28993. http.Agent = function () {};
  28994. http.Agent.defaultMaxSockets = 4;
  28995. http.globalAgent = new http.Agent();
  28996. http.STATUS_CODES = statusCodes;
  28997. http.METHODS = ['CHECKOUT', 'CONNECT', 'COPY', 'DELETE', 'GET', 'HEAD', 'LOCK', 'M-SEARCH', 'MERGE', 'MKACTIVITY', 'MKCOL', 'MOVE', 'NOTIFY', 'OPTIONS', 'PATCH', 'POST', 'PROPFIND', 'PROPPATCH', 'PURGE', 'PUT', 'REPORT', 'SEARCH', 'SUBSCRIBE', 'TRACE', 'UNLOCK', 'UNSUBSCRIBE'];
  28998. }).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
  28999. },{"./lib/request":402,"./lib/response":403,"builtin-status-codes":87,"core-js/modules/es.regexp.exec.js":261,"core-js/modules/es.string.search.js":267,"url":404,"xtend":392}],401:[function(require,module,exports){
  29000. (function (global){(function (){
  29001. "use strict";
  29002. require("core-js/modules/es.object.to-string.js");
  29003. require("core-js/modules/es.promise.js");
  29004. require("core-js/modules/es.array-buffer.constructor.js");
  29005. require("core-js/modules/es.array-buffer.slice.js");
  29006. require("core-js/modules/es.array.slice.js");
  29007. exports.fetch = isFunction(global.fetch) && isFunction(global.ReadableStream);
  29008. exports.writableStream = isFunction(global.WritableStream);
  29009. exports.abortController = isFunction(global.AbortController);
  29010. exports.blobConstructor = false;
  29011. try {
  29012. new Blob([new ArrayBuffer(1)]);
  29013. exports.blobConstructor = true;
  29014. } catch (e) {} // The xhr request to example.com may violate some restrictive CSP configurations,
  29015. // so if we're running in a browser that supports `fetch`, avoid calling getXHR()
  29016. // and assume support for certain features below.
  29017. var xhr;
  29018. function getXHR() {
  29019. // Cache the xhr value
  29020. if (xhr !== undefined) return xhr;
  29021. if (global.XMLHttpRequest) {
  29022. xhr = new global.XMLHttpRequest(); // If XDomainRequest is available (ie only, where xhr might not work
  29023. // cross domain), use the page location. Otherwise use example.com
  29024. // Note: this doesn't actually make an http request.
  29025. try {
  29026. xhr.open('GET', global.XDomainRequest ? '/' : 'https://example.com');
  29027. } catch (e) {
  29028. xhr = null;
  29029. }
  29030. } else {
  29031. // Service workers don't have XHR
  29032. xhr = null;
  29033. }
  29034. return xhr;
  29035. }
  29036. function checkTypeSupport(type) {
  29037. var xhr = getXHR();
  29038. if (!xhr) return false;
  29039. try {
  29040. xhr.responseType = type;
  29041. return xhr.responseType === type;
  29042. } catch (e) {}
  29043. return false;
  29044. } // For some strange reason, Safari 7.0 reports typeof global.ArrayBuffer === 'object'.
  29045. // Safari 7.1 appears to have fixed this bug.
  29046. var haveArrayBuffer = typeof global.ArrayBuffer !== 'undefined';
  29047. var haveSlice = haveArrayBuffer && isFunction(global.ArrayBuffer.prototype.slice); // If fetch is supported, then arraybuffer will be supported too. Skip calling
  29048. // checkTypeSupport(), since that calls getXHR().
  29049. exports.arraybuffer = exports.fetch || haveArrayBuffer && checkTypeSupport('arraybuffer'); // These next two tests unavoidably show warnings in Chrome. Since fetch will always
  29050. // be used if it's available, just return false for these to avoid the warnings.
  29051. exports.msstream = !exports.fetch && haveSlice && checkTypeSupport('ms-stream');
  29052. exports.mozchunkedarraybuffer = !exports.fetch && haveArrayBuffer && checkTypeSupport('moz-chunked-arraybuffer'); // If fetch is supported, then overrideMimeType will be supported too. Skip calling
  29053. // getXHR().
  29054. exports.overrideMimeType = exports.fetch || (getXHR() ? isFunction(getXHR().overrideMimeType) : false);
  29055. exports.vbArray = isFunction(global.VBArray);
  29056. function isFunction(value) {
  29057. return typeof value === 'function';
  29058. }
  29059. xhr = null; // Help gc
  29060. }).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
  29061. },{"core-js/modules/es.array-buffer.constructor.js":239,"core-js/modules/es.array-buffer.slice.js":240,"core-js/modules/es.array.slice.js":250,"core-js/modules/es.object.to-string.js":258,"core-js/modules/es.promise.js":259}],402:[function(require,module,exports){
  29062. (function (process,global,Buffer){(function (){
  29063. "use strict";
  29064. require("core-js/modules/es.object.to-string.js");
  29065. require("core-js/modules/es.regexp.to-string.js");
  29066. require("core-js/modules/web.dom-collections.for-each.js");
  29067. require("core-js/modules/es.object.keys.js");
  29068. require("core-js/modules/es.array.concat.js");
  29069. require("core-js/modules/es.array.map.js");
  29070. require("core-js/modules/es.function.name.js");
  29071. require("core-js/modules/es.promise.js");
  29072. require("core-js/modules/es.regexp.exec.js");
  29073. require("core-js/modules/es.string.split.js");
  29074. var capability = require('./capability');
  29075. var inherits = require('inherits');
  29076. var response = require('./response');
  29077. var stream = require('readable-stream');
  29078. var toArrayBuffer = require('to-arraybuffer');
  29079. var IncomingMessage = response.IncomingMessage;
  29080. var rStates = response.readyStates;
  29081. function decideMode(preferBinary, useFetch) {
  29082. if (capability.fetch && useFetch) {
  29083. return 'fetch';
  29084. } else if (capability.mozchunkedarraybuffer) {
  29085. return 'moz-chunked-arraybuffer';
  29086. } else if (capability.msstream) {
  29087. return 'ms-stream';
  29088. } else if (capability.arraybuffer && preferBinary) {
  29089. return 'arraybuffer';
  29090. } else if (capability.vbArray && preferBinary) {
  29091. return 'text:vbarray';
  29092. } else {
  29093. return 'text';
  29094. }
  29095. }
  29096. var ClientRequest = module.exports = function (opts) {
  29097. var self = this;
  29098. stream.Writable.call(self);
  29099. self._opts = opts;
  29100. self._body = [];
  29101. self._headers = {};
  29102. if (opts.auth) self.setHeader('Authorization', 'Basic ' + new Buffer(opts.auth).toString('base64'));
  29103. Object.keys(opts.headers).forEach(function (name) {
  29104. self.setHeader(name, opts.headers[name]);
  29105. });
  29106. var preferBinary;
  29107. var useFetch = true;
  29108. if (opts.mode === 'disable-fetch' || 'requestTimeout' in opts && !capability.abortController) {
  29109. // If the use of XHR should be preferred. Not typically needed.
  29110. useFetch = false;
  29111. preferBinary = true;
  29112. } else if (opts.mode === 'prefer-streaming') {
  29113. // If streaming is a high priority but binary compatibility and
  29114. // the accuracy of the 'content-type' header aren't
  29115. preferBinary = false;
  29116. } else if (opts.mode === 'allow-wrong-content-type') {
  29117. // If streaming is more important than preserving the 'content-type' header
  29118. preferBinary = !capability.overrideMimeType;
  29119. } else if (!opts.mode || opts.mode === 'default' || opts.mode === 'prefer-fast') {
  29120. // Use binary if text streaming may corrupt data or the content-type header, or for speed
  29121. preferBinary = true;
  29122. } else {
  29123. throw new Error('Invalid value for opts.mode');
  29124. }
  29125. self._mode = decideMode(preferBinary, useFetch);
  29126. self._fetchTimer = null;
  29127. self.on('finish', function () {
  29128. self._onFinish();
  29129. });
  29130. };
  29131. inherits(ClientRequest, stream.Writable);
  29132. ClientRequest.prototype.setHeader = function (name, value) {
  29133. var self = this;
  29134. var lowerName = name.toLowerCase(); // This check is not necessary, but it prevents warnings from browsers about setting unsafe
  29135. // headers. To be honest I'm not entirely sure hiding these warnings is a good thing, but
  29136. // http-browserify did it, so I will too.
  29137. if (unsafeHeaders.indexOf(lowerName) !== -1) return;
  29138. self._headers[lowerName] = {
  29139. name: name,
  29140. value: value
  29141. };
  29142. };
  29143. ClientRequest.prototype.getHeader = function (name) {
  29144. var header = this._headers[name.toLowerCase()];
  29145. if (header) return header.value;
  29146. return null;
  29147. };
  29148. ClientRequest.prototype.removeHeader = function (name) {
  29149. var self = this;
  29150. delete self._headers[name.toLowerCase()];
  29151. };
  29152. ClientRequest.prototype._onFinish = function () {
  29153. var self = this;
  29154. if (self._destroyed) return;
  29155. var opts = self._opts;
  29156. var headersObj = self._headers;
  29157. var body = null;
  29158. if (opts.method !== 'GET' && opts.method !== 'HEAD') {
  29159. if (capability.arraybuffer) {
  29160. body = toArrayBuffer(Buffer.concat(self._body));
  29161. } else if (capability.blobConstructor) {
  29162. body = new global.Blob(self._body.map(function (buffer) {
  29163. return toArrayBuffer(buffer);
  29164. }), {
  29165. type: (headersObj['content-type'] || {}).value || ''
  29166. });
  29167. } else {
  29168. // get utf8 string
  29169. body = Buffer.concat(self._body).toString();
  29170. }
  29171. } // create flattened list of headers
  29172. var headersList = [];
  29173. Object.keys(headersObj).forEach(function (keyName) {
  29174. var name = headersObj[keyName].name;
  29175. var value = headersObj[keyName].value;
  29176. if (Array.isArray(value)) {
  29177. value.forEach(function (v) {
  29178. headersList.push([name, v]);
  29179. });
  29180. } else {
  29181. headersList.push([name, value]);
  29182. }
  29183. });
  29184. if (self._mode === 'fetch') {
  29185. var signal = null;
  29186. var fetchTimer = null;
  29187. if (capability.abortController) {
  29188. var controller = new AbortController();
  29189. signal = controller.signal;
  29190. self._fetchAbortController = controller;
  29191. if ('requestTimeout' in opts && opts.requestTimeout !== 0) {
  29192. self._fetchTimer = global.setTimeout(function () {
  29193. self.emit('requestTimeout');
  29194. if (self._fetchAbortController) self._fetchAbortController.abort();
  29195. }, opts.requestTimeout);
  29196. }
  29197. }
  29198. global.fetch(self._opts.url, {
  29199. method: self._opts.method,
  29200. headers: headersList,
  29201. body: body || undefined,
  29202. mode: 'cors',
  29203. credentials: opts.withCredentials ? 'include' : 'same-origin',
  29204. signal: signal
  29205. }).then(function (response) {
  29206. self._fetchResponse = response;
  29207. self._connect();
  29208. }, function (reason) {
  29209. global.clearTimeout(self._fetchTimer);
  29210. if (!self._destroyed) self.emit('error', reason);
  29211. });
  29212. } else {
  29213. var xhr = self._xhr = new global.XMLHttpRequest();
  29214. try {
  29215. xhr.open(self._opts.method, self._opts.url, true);
  29216. } catch (err) {
  29217. process.nextTick(function () {
  29218. self.emit('error', err);
  29219. });
  29220. return;
  29221. } // Can't set responseType on really old browsers
  29222. if ('responseType' in xhr) xhr.responseType = self._mode.split(':')[0];
  29223. if ('withCredentials' in xhr) xhr.withCredentials = !!opts.withCredentials;
  29224. if (self._mode === 'text' && 'overrideMimeType' in xhr) xhr.overrideMimeType('text/plain; charset=x-user-defined');
  29225. if ('requestTimeout' in opts) {
  29226. xhr.timeout = opts.requestTimeout;
  29227. xhr.ontimeout = function () {
  29228. self.emit('requestTimeout');
  29229. };
  29230. }
  29231. headersList.forEach(function (header) {
  29232. xhr.setRequestHeader(header[0], header[1]);
  29233. });
  29234. self._response = null;
  29235. xhr.onreadystatechange = function () {
  29236. switch (xhr.readyState) {
  29237. case rStates.LOADING:
  29238. case rStates.DONE:
  29239. self._onXHRProgress();
  29240. break;
  29241. }
  29242. }; // Necessary for streaming in Firefox, since xhr.response is ONLY defined
  29243. // in onprogress, not in onreadystatechange with xhr.readyState = 3
  29244. if (self._mode === 'moz-chunked-arraybuffer') {
  29245. xhr.onprogress = function () {
  29246. self._onXHRProgress();
  29247. };
  29248. }
  29249. xhr.onerror = function () {
  29250. if (self._destroyed) return;
  29251. self.emit('error', new Error('XHR error'));
  29252. };
  29253. try {
  29254. xhr.send(body);
  29255. } catch (err) {
  29256. process.nextTick(function () {
  29257. self.emit('error', err);
  29258. });
  29259. return;
  29260. }
  29261. }
  29262. };
  29263. /**
  29264. * Checks if xhr.status is readable and non-zero, indicating no error.
  29265. * Even though the spec says it should be available in readyState 3,
  29266. * accessing it throws an exception in IE8
  29267. */
  29268. function statusValid(xhr) {
  29269. try {
  29270. var status = xhr.status;
  29271. return status !== null && status !== 0;
  29272. } catch (e) {
  29273. return false;
  29274. }
  29275. }
  29276. ClientRequest.prototype._onXHRProgress = function () {
  29277. var self = this;
  29278. if (!statusValid(self._xhr) || self._destroyed) return;
  29279. if (!self._response) self._connect();
  29280. self._response._onXHRProgress();
  29281. };
  29282. ClientRequest.prototype._connect = function () {
  29283. var self = this;
  29284. if (self._destroyed) return;
  29285. self._response = new IncomingMessage(self._xhr, self._fetchResponse, self._mode, self._fetchTimer);
  29286. self._response.on('error', function (err) {
  29287. self.emit('error', err);
  29288. });
  29289. self.emit('response', self._response);
  29290. };
  29291. ClientRequest.prototype._write = function (chunk, encoding, cb) {
  29292. var self = this;
  29293. self._body.push(chunk);
  29294. cb();
  29295. };
  29296. ClientRequest.prototype.abort = ClientRequest.prototype.destroy = function () {
  29297. var self = this;
  29298. self._destroyed = true;
  29299. global.clearTimeout(self._fetchTimer);
  29300. if (self._response) self._response._destroyed = true;
  29301. if (self._xhr) self._xhr.abort();else if (self._fetchAbortController) self._fetchAbortController.abort();
  29302. };
  29303. ClientRequest.prototype.end = function (data, encoding, cb) {
  29304. var self = this;
  29305. if (typeof data === 'function') {
  29306. cb = data;
  29307. data = undefined;
  29308. }
  29309. stream.Writable.prototype.end.call(self, data, encoding, cb);
  29310. };
  29311. ClientRequest.prototype.flushHeaders = function () {};
  29312. ClientRequest.prototype.setTimeout = function () {};
  29313. ClientRequest.prototype.setNoDelay = function () {};
  29314. ClientRequest.prototype.setSocketKeepAlive = function () {}; // Taken from http://www.w3.org/TR/XMLHttpRequest/#the-setrequestheader%28%29-method
  29315. var unsafeHeaders = ['accept-charset', 'accept-encoding', 'access-control-request-headers', 'access-control-request-method', 'connection', 'content-length', 'cookie', 'cookie2', 'date', 'dnt', 'expect', 'host', 'keep-alive', 'origin', 'referer', 'te', 'trailer', 'transfer-encoding', 'upgrade', 'user-agent', 'via'];
  29316. }).call(this)}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {},require("buffer").Buffer)
  29317. },{"./capability":401,"./response":403,"_process":399,"buffer":85,"core-js/modules/es.array.concat.js":241,"core-js/modules/es.array.map.js":249,"core-js/modules/es.function.name.js":253,"core-js/modules/es.object.keys.js":257,"core-js/modules/es.object.to-string.js":258,"core-js/modules/es.promise.js":259,"core-js/modules/es.regexp.exec.js":261,"core-js/modules/es.regexp.to-string.js":262,"core-js/modules/es.string.split.js":268,"core-js/modules/web.dom-collections.for-each.js":296,"inherits":311,"readable-stream":339,"to-arraybuffer":348}],403:[function(require,module,exports){
  29318. (function (process,global,Buffer){(function (){
  29319. "use strict";
  29320. require("core-js/modules/web.dom-collections.for-each.js");
  29321. require("core-js/modules/es.object.to-string.js");
  29322. require("core-js/modules/es.promise.js");
  29323. require("core-js/modules/es.regexp.exec.js");
  29324. require("core-js/modules/es.string.split.js");
  29325. require("core-js/modules/es.string.match.js");
  29326. require("core-js/modules/es.array.iterator.js");
  29327. require("core-js/modules/es.array-buffer.slice.js");
  29328. require("core-js/modules/es.typed-array.uint8-array.js");
  29329. require("core-js/modules/es.typed-array.copy-within.js");
  29330. require("core-js/modules/es.typed-array.every.js");
  29331. require("core-js/modules/es.typed-array.fill.js");
  29332. require("core-js/modules/es.typed-array.filter.js");
  29333. require("core-js/modules/es.typed-array.find.js");
  29334. require("core-js/modules/es.typed-array.find-index.js");
  29335. require("core-js/modules/es.typed-array.for-each.js");
  29336. require("core-js/modules/es.typed-array.includes.js");
  29337. require("core-js/modules/es.typed-array.index-of.js");
  29338. require("core-js/modules/es.typed-array.iterator.js");
  29339. require("core-js/modules/es.typed-array.join.js");
  29340. require("core-js/modules/es.typed-array.last-index-of.js");
  29341. require("core-js/modules/es.typed-array.map.js");
  29342. require("core-js/modules/es.typed-array.reduce.js");
  29343. require("core-js/modules/es.typed-array.reduce-right.js");
  29344. require("core-js/modules/es.typed-array.reverse.js");
  29345. require("core-js/modules/es.typed-array.set.js");
  29346. require("core-js/modules/es.typed-array.slice.js");
  29347. require("core-js/modules/es.typed-array.some.js");
  29348. require("core-js/modules/es.typed-array.sort.js");
  29349. require("core-js/modules/es.typed-array.subarray.js");
  29350. require("core-js/modules/es.typed-array.to-locale-string.js");
  29351. require("core-js/modules/es.typed-array.to-string.js");
  29352. require("core-js/modules/es.array.slice.js");
  29353. var capability = require('./capability');
  29354. var inherits = require('inherits');
  29355. var stream = require('readable-stream');
  29356. var rStates = exports.readyStates = {
  29357. UNSENT: 0,
  29358. OPENED: 1,
  29359. HEADERS_RECEIVED: 2,
  29360. LOADING: 3,
  29361. DONE: 4
  29362. };
  29363. var IncomingMessage = exports.IncomingMessage = function (xhr, response, mode, fetchTimer) {
  29364. var self = this;
  29365. stream.Readable.call(self);
  29366. self._mode = mode;
  29367. self.headers = {};
  29368. self.rawHeaders = [];
  29369. self.trailers = {};
  29370. self.rawTrailers = []; // Fake the 'close' event, but only once 'end' fires
  29371. self.on('end', function () {
  29372. // The nextTick is necessary to prevent the 'request' module from causing an infinite loop
  29373. process.nextTick(function () {
  29374. self.emit('close');
  29375. });
  29376. });
  29377. if (mode === 'fetch') {
  29378. var read = function read() {
  29379. reader.read().then(function (result) {
  29380. if (self._destroyed) return;
  29381. if (result.done) {
  29382. global.clearTimeout(fetchTimer);
  29383. self.push(null);
  29384. return;
  29385. }
  29386. self.push(new Buffer(result.value));
  29387. read();
  29388. }).catch(function (err) {
  29389. global.clearTimeout(fetchTimer);
  29390. if (!self._destroyed) self.emit('error', err);
  29391. });
  29392. };
  29393. self._fetchResponse = response;
  29394. self.url = response.url;
  29395. self.statusCode = response.status;
  29396. self.statusMessage = response.statusText;
  29397. response.headers.forEach(function (header, key) {
  29398. self.headers[key.toLowerCase()] = header;
  29399. self.rawHeaders.push(key, header);
  29400. });
  29401. if (capability.writableStream) {
  29402. var writable = new WritableStream({
  29403. write: function write(chunk) {
  29404. return new Promise(function (resolve, reject) {
  29405. if (self._destroyed) {
  29406. reject();
  29407. } else if (self.push(new Buffer(chunk))) {
  29408. resolve();
  29409. } else {
  29410. self._resumeFetch = resolve;
  29411. }
  29412. });
  29413. },
  29414. close: function close() {
  29415. global.clearTimeout(fetchTimer);
  29416. if (!self._destroyed) self.push(null);
  29417. },
  29418. abort: function abort(err) {
  29419. if (!self._destroyed) self.emit('error', err);
  29420. }
  29421. });
  29422. try {
  29423. response.body.pipeTo(writable).catch(function (err) {
  29424. global.clearTimeout(fetchTimer);
  29425. if (!self._destroyed) self.emit('error', err);
  29426. });
  29427. return;
  29428. } catch (e) {} // pipeTo method isn't defined. Can't find a better way to feature test this
  29429. } // fallback for when writableStream or pipeTo aren't available
  29430. var reader = response.body.getReader();
  29431. read();
  29432. } else {
  29433. self._xhr = xhr;
  29434. self._pos = 0;
  29435. self.url = xhr.responseURL;
  29436. self.statusCode = xhr.status;
  29437. self.statusMessage = xhr.statusText;
  29438. var headers = xhr.getAllResponseHeaders().split(/\r?\n/);
  29439. headers.forEach(function (header) {
  29440. var matches = header.match(/^([^:]+):\s*(.*)/);
  29441. if (matches) {
  29442. var key = matches[1].toLowerCase();
  29443. if (key === 'set-cookie') {
  29444. if (self.headers[key] === undefined) {
  29445. self.headers[key] = [];
  29446. }
  29447. self.headers[key].push(matches[2]);
  29448. } else if (self.headers[key] !== undefined) {
  29449. self.headers[key] += ', ' + matches[2];
  29450. } else {
  29451. self.headers[key] = matches[2];
  29452. }
  29453. self.rawHeaders.push(matches[1], matches[2]);
  29454. }
  29455. });
  29456. self._charset = 'x-user-defined';
  29457. if (!capability.overrideMimeType) {
  29458. var mimeType = self.rawHeaders['mime-type'];
  29459. if (mimeType) {
  29460. var charsetMatch = mimeType.match(/;\s*charset=([^;])(;|$)/);
  29461. if (charsetMatch) {
  29462. self._charset = charsetMatch[1].toLowerCase();
  29463. }
  29464. }
  29465. if (!self._charset) self._charset = 'utf-8'; // best guess
  29466. }
  29467. }
  29468. };
  29469. inherits(IncomingMessage, stream.Readable);
  29470. IncomingMessage.prototype._read = function () {
  29471. var self = this;
  29472. var resolve = self._resumeFetch;
  29473. if (resolve) {
  29474. self._resumeFetch = null;
  29475. resolve();
  29476. }
  29477. };
  29478. IncomingMessage.prototype._onXHRProgress = function () {
  29479. var self = this;
  29480. var xhr = self._xhr;
  29481. var response = null;
  29482. switch (self._mode) {
  29483. case 'text:vbarray':
  29484. // For IE9
  29485. if (xhr.readyState !== rStates.DONE) break;
  29486. try {
  29487. // This fails in IE8
  29488. response = new global.VBArray(xhr.responseBody).toArray();
  29489. } catch (e) {}
  29490. if (response !== null) {
  29491. self.push(new Buffer(response));
  29492. break;
  29493. }
  29494. // Falls through in IE8
  29495. case 'text':
  29496. try {
  29497. // This will fail when readyState = 3 in IE9. Switch mode and wait for readyState = 4
  29498. response = xhr.responseText;
  29499. } catch (e) {
  29500. self._mode = 'text:vbarray';
  29501. break;
  29502. }
  29503. if (response.length > self._pos) {
  29504. var newData = response.substr(self._pos);
  29505. if (self._charset === 'x-user-defined') {
  29506. var buffer = new Buffer(newData.length);
  29507. for (var i = 0; i < newData.length; i++) {
  29508. buffer[i] = newData.charCodeAt(i) & 0xff;
  29509. }
  29510. self.push(buffer);
  29511. } else {
  29512. self.push(newData, self._charset);
  29513. }
  29514. self._pos = response.length;
  29515. }
  29516. break;
  29517. case 'arraybuffer':
  29518. if (xhr.readyState !== rStates.DONE || !xhr.response) break;
  29519. response = xhr.response;
  29520. self.push(new Buffer(new Uint8Array(response)));
  29521. break;
  29522. case 'moz-chunked-arraybuffer':
  29523. // take whole
  29524. response = xhr.response;
  29525. if (xhr.readyState !== rStates.LOADING || !response) break;
  29526. self.push(new Buffer(new Uint8Array(response)));
  29527. break;
  29528. case 'ms-stream':
  29529. response = xhr.response;
  29530. if (xhr.readyState !== rStates.LOADING) break;
  29531. var reader = new global.MSStreamReader();
  29532. reader.onprogress = function () {
  29533. if (reader.result.byteLength > self._pos) {
  29534. self.push(new Buffer(new Uint8Array(reader.result.slice(self._pos))));
  29535. self._pos = reader.result.byteLength;
  29536. }
  29537. };
  29538. reader.onload = function () {
  29539. self.push(null);
  29540. }; // reader.onerror = ??? // TODO: this
  29541. reader.readAsArrayBuffer(response);
  29542. break;
  29543. } // The ms-stream case handles end separately in reader.onload()
  29544. if (self._xhr.readyState === rStates.DONE && self._mode !== 'ms-stream') {
  29545. self.push(null);
  29546. }
  29547. };
  29548. }).call(this)}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {},require("buffer").Buffer)
  29549. },{"./capability":401,"_process":399,"buffer":85,"core-js/modules/es.array-buffer.slice.js":240,"core-js/modules/es.array.iterator.js":247,"core-js/modules/es.array.slice.js":250,"core-js/modules/es.object.to-string.js":258,"core-js/modules/es.promise.js":259,"core-js/modules/es.regexp.exec.js":261,"core-js/modules/es.string.match.js":265,"core-js/modules/es.string.split.js":268,"core-js/modules/es.typed-array.copy-within.js":272,"core-js/modules/es.typed-array.every.js":273,"core-js/modules/es.typed-array.fill.js":274,"core-js/modules/es.typed-array.filter.js":275,"core-js/modules/es.typed-array.find-index.js":276,"core-js/modules/es.typed-array.find.js":277,"core-js/modules/es.typed-array.for-each.js":278,"core-js/modules/es.typed-array.includes.js":279,"core-js/modules/es.typed-array.index-of.js":280,"core-js/modules/es.typed-array.iterator.js":281,"core-js/modules/es.typed-array.join.js":282,"core-js/modules/es.typed-array.last-index-of.js":283,"core-js/modules/es.typed-array.map.js":284,"core-js/modules/es.typed-array.reduce-right.js":285,"core-js/modules/es.typed-array.reduce.js":286,"core-js/modules/es.typed-array.reverse.js":287,"core-js/modules/es.typed-array.set.js":288,"core-js/modules/es.typed-array.slice.js":289,"core-js/modules/es.typed-array.some.js":290,"core-js/modules/es.typed-array.sort.js":291,"core-js/modules/es.typed-array.subarray.js":292,"core-js/modules/es.typed-array.to-locale-string.js":293,"core-js/modules/es.typed-array.to-string.js":294,"core-js/modules/es.typed-array.uint8-array.js":295,"core-js/modules/web.dom-collections.for-each.js":296,"inherits":311,"readable-stream":339}],404:[function(require,module,exports){
  29550. // Copyright Joyent, Inc. and other Node contributors.
  29551. //
  29552. // Permission is hereby granted, free of charge, to any person obtaining a
  29553. // copy of this software and associated documentation files (the
  29554. // "Software"), to deal in the Software without restriction, including
  29555. // without limitation the rights to use, copy, modify, merge, publish,
  29556. // distribute, sublicense, and/or sell copies of the Software, and to permit
  29557. // persons to whom the Software is furnished to do so, subject to the
  29558. // following conditions:
  29559. //
  29560. // The above copyright notice and this permission notice shall be included
  29561. // in all copies or substantial portions of the Software.
  29562. //
  29563. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  29564. // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  29565. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  29566. // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  29567. // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  29568. // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  29569. // USE OR OTHER DEALINGS IN THE SOFTWARE.
  29570. 'use strict';
  29571. var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
  29572. var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
  29573. require("core-js/modules/es.regexp.exec.js");
  29574. require("core-js/modules/es.string.search.js");
  29575. require("core-js/modules/es.array.concat.js");
  29576. require("core-js/modules/es.string.split.js");
  29577. require("core-js/modules/es.string.replace.js");
  29578. require("core-js/modules/es.array.join.js");
  29579. require("core-js/modules/es.string.trim.js");
  29580. require("core-js/modules/es.string.match.js");
  29581. require("core-js/modules/es.array.slice.js");
  29582. require("core-js/modules/es.object.keys.js");
  29583. require("core-js/modules/es.array.splice.js");
  29584. var punycode = require('punycode');
  29585. var util = require('./util');
  29586. exports.parse = urlParse;
  29587. exports.resolve = urlResolve;
  29588. exports.resolveObject = urlResolveObject;
  29589. exports.format = urlFormat;
  29590. exports.Url = Url;
  29591. function Url() {
  29592. this.protocol = null;
  29593. this.slashes = null;
  29594. this.auth = null;
  29595. this.host = null;
  29596. this.port = null;
  29597. this.hostname = null;
  29598. this.hash = null;
  29599. this.search = null;
  29600. this.query = null;
  29601. this.pathname = null;
  29602. this.path = null;
  29603. this.href = null;
  29604. } // Reference: RFC 3986, RFC 1808, RFC 2396
  29605. // define these here so at least they only have to be
  29606. // compiled once on the first module load.
  29607. var protocolPattern = /^([a-z0-9.+-]+:)/i,
  29608. portPattern = /:[0-9]*$/,
  29609. // Special case for a simple path URL
  29610. simplePathPattern = /^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,
  29611. // RFC 2396: characters reserved for delimiting URLs.
  29612. // We actually just auto-escape these.
  29613. delims = ['<', '>', '"', '`', ' ', '\r', '\n', '\t'],
  29614. // RFC 2396: characters not allowed for various reasons.
  29615. unwise = ['{', '}', '|', '\\', '^', '`'].concat(delims),
  29616. // Allowed by RFCs, but cause of XSS attacks. Always escape these.
  29617. autoEscape = ['\''].concat(unwise),
  29618. // Characters that are never ever allowed in a hostname.
  29619. // Note that any invalid chars are also handled, but these
  29620. // are the ones that are *expected* to be seen, so we fast-path
  29621. // them.
  29622. nonHostChars = ['%', '/', '?', ';', '#'].concat(autoEscape),
  29623. hostEndingChars = ['/', '?', '#'],
  29624. hostnameMaxLen = 255,
  29625. hostnamePartPattern = /^[+a-z0-9A-Z_-]{0,63}$/,
  29626. hostnamePartStart = /^([+a-z0-9A-Z_-]{0,63})(.*)$/,
  29627. // protocols that can allow "unsafe" and "unwise" chars.
  29628. unsafeProtocol = {
  29629. 'javascript': true,
  29630. 'javascript:': true
  29631. },
  29632. // protocols that never have a hostname.
  29633. hostlessProtocol = {
  29634. 'javascript': true,
  29635. 'javascript:': true
  29636. },
  29637. // protocols that always contain a // bit.
  29638. slashedProtocol = {
  29639. 'http': true,
  29640. 'https': true,
  29641. 'ftp': true,
  29642. 'gopher': true,
  29643. 'file': true,
  29644. 'http:': true,
  29645. 'https:': true,
  29646. 'ftp:': true,
  29647. 'gopher:': true,
  29648. 'file:': true
  29649. },
  29650. querystring = require('querystring');
  29651. function urlParse(url, parseQueryString, slashesDenoteHost) {
  29652. if (url && util.isObject(url) && url instanceof Url) return url;
  29653. var u = new Url();
  29654. u.parse(url, parseQueryString, slashesDenoteHost);
  29655. return u;
  29656. }
  29657. Url.prototype.parse = function (url, parseQueryString, slashesDenoteHost) {
  29658. if (!util.isString(url)) {
  29659. throw new TypeError("Parameter 'url' must be a string, not " + (0, _typeof2.default)(url));
  29660. } // Copy chrome, IE, opera backslash-handling behavior.
  29661. // Back slashes before the query string get converted to forward slashes
  29662. // See: https://code.google.com/p/chromium/issues/detail?id=25916
  29663. var queryIndex = url.indexOf('?'),
  29664. splitter = queryIndex !== -1 && queryIndex < url.indexOf('#') ? '?' : '#',
  29665. uSplit = url.split(splitter),
  29666. slashRegex = /\\/g;
  29667. uSplit[0] = uSplit[0].replace(slashRegex, '/');
  29668. url = uSplit.join(splitter);
  29669. var rest = url; // trim before proceeding.
  29670. // This is to support parse stuff like " http://foo.com \n"
  29671. rest = rest.trim();
  29672. if (!slashesDenoteHost && url.split('#').length === 1) {
  29673. // Try fast path regexp
  29674. var simplePath = simplePathPattern.exec(rest);
  29675. if (simplePath) {
  29676. this.path = rest;
  29677. this.href = rest;
  29678. this.pathname = simplePath[1];
  29679. if (simplePath[2]) {
  29680. this.search = simplePath[2];
  29681. if (parseQueryString) {
  29682. this.query = querystring.parse(this.search.substr(1));
  29683. } else {
  29684. this.query = this.search.substr(1);
  29685. }
  29686. } else if (parseQueryString) {
  29687. this.search = '';
  29688. this.query = {};
  29689. }
  29690. return this;
  29691. }
  29692. }
  29693. var proto = protocolPattern.exec(rest);
  29694. if (proto) {
  29695. proto = proto[0];
  29696. var lowerProto = proto.toLowerCase();
  29697. this.protocol = lowerProto;
  29698. rest = rest.substr(proto.length);
  29699. } // figure out if it's got a host
  29700. // user@server is *always* interpreted as a hostname, and url
  29701. // resolution will treat //foo/bar as host=foo,path=bar because that's
  29702. // how the browser resolves relative URLs.
  29703. if (slashesDenoteHost || proto || rest.match(/^\/\/[^@\/]+@[^@\/]+/)) {
  29704. var slashes = rest.substr(0, 2) === '//';
  29705. if (slashes && !(proto && hostlessProtocol[proto])) {
  29706. rest = rest.substr(2);
  29707. this.slashes = true;
  29708. }
  29709. }
  29710. if (!hostlessProtocol[proto] && (slashes || proto && !slashedProtocol[proto])) {
  29711. // there's a hostname.
  29712. // the first instance of /, ?, ;, or # ends the host.
  29713. //
  29714. // If there is an @ in the hostname, then non-host chars *are* allowed
  29715. // to the left of the last @ sign, unless some host-ending character
  29716. // comes *before* the @-sign.
  29717. // URLs are obnoxious.
  29718. //
  29719. // ex:
  29720. // http://a@b@c/ => user:a@b host:c
  29721. // http://a@b?@c => user:a host:c path:/?@c
  29722. // v0.12 TODO(isaacs): This is not quite how Chrome does things.
  29723. // Review our test case against browsers more comprehensively.
  29724. // find the first instance of any hostEndingChars
  29725. var hostEnd = -1;
  29726. for (var i = 0; i < hostEndingChars.length; i++) {
  29727. var hec = rest.indexOf(hostEndingChars[i]);
  29728. if (hec !== -1 && (hostEnd === -1 || hec < hostEnd)) hostEnd = hec;
  29729. } // at this point, either we have an explicit point where the
  29730. // auth portion cannot go past, or the last @ char is the decider.
  29731. var auth, atSign;
  29732. if (hostEnd === -1) {
  29733. // atSign can be anywhere.
  29734. atSign = rest.lastIndexOf('@');
  29735. } else {
  29736. // atSign must be in auth portion.
  29737. // http://a@b/c@d => host:b auth:a path:/c@d
  29738. atSign = rest.lastIndexOf('@', hostEnd);
  29739. } // Now we have a portion which is definitely the auth.
  29740. // Pull that off.
  29741. if (atSign !== -1) {
  29742. auth = rest.slice(0, atSign);
  29743. rest = rest.slice(atSign + 1);
  29744. this.auth = decodeURIComponent(auth);
  29745. } // the host is the remaining to the left of the first non-host char
  29746. hostEnd = -1;
  29747. for (var i = 0; i < nonHostChars.length; i++) {
  29748. var hec = rest.indexOf(nonHostChars[i]);
  29749. if (hec !== -1 && (hostEnd === -1 || hec < hostEnd)) hostEnd = hec;
  29750. } // if we still have not hit it, then the entire thing is a host.
  29751. if (hostEnd === -1) hostEnd = rest.length;
  29752. this.host = rest.slice(0, hostEnd);
  29753. rest = rest.slice(hostEnd); // pull out port.
  29754. this.parseHost(); // we've indicated that there is a hostname,
  29755. // so even if it's empty, it has to be present.
  29756. this.hostname = this.hostname || ''; // if hostname begins with [ and ends with ]
  29757. // assume that it's an IPv6 address.
  29758. var ipv6Hostname = this.hostname[0] === '[' && this.hostname[this.hostname.length - 1] === ']'; // validate a little.
  29759. if (!ipv6Hostname) {
  29760. var hostparts = this.hostname.split('.');
  29761. for (var i = 0, l = hostparts.length; i < l; i++) {
  29762. var part = hostparts[i];
  29763. if (!part) continue;
  29764. if (!part.match(hostnamePartPattern)) {
  29765. var newpart = '';
  29766. for (var j = 0, k = part.length; j < k; j++) {
  29767. if (part.charCodeAt(j) > 127) {
  29768. // we replace non-ASCII char with a temporary placeholder
  29769. // we need this to make sure size of hostname is not
  29770. // broken by replacing non-ASCII by nothing
  29771. newpart += 'x';
  29772. } else {
  29773. newpart += part[j];
  29774. }
  29775. } // we test again with ASCII char only
  29776. if (!newpart.match(hostnamePartPattern)) {
  29777. var validParts = hostparts.slice(0, i);
  29778. var notHost = hostparts.slice(i + 1);
  29779. var bit = part.match(hostnamePartStart);
  29780. if (bit) {
  29781. validParts.push(bit[1]);
  29782. notHost.unshift(bit[2]);
  29783. }
  29784. if (notHost.length) {
  29785. rest = '/' + notHost.join('.') + rest;
  29786. }
  29787. this.hostname = validParts.join('.');
  29788. break;
  29789. }
  29790. }
  29791. }
  29792. }
  29793. if (this.hostname.length > hostnameMaxLen) {
  29794. this.hostname = '';
  29795. } else {
  29796. // hostnames are always lower case.
  29797. this.hostname = this.hostname.toLowerCase();
  29798. }
  29799. if (!ipv6Hostname) {
  29800. // IDNA Support: Returns a punycoded representation of "domain".
  29801. // It only converts parts of the domain name that
  29802. // have non-ASCII characters, i.e. it doesn't matter if
  29803. // you call it with a domain that already is ASCII-only.
  29804. this.hostname = punycode.toASCII(this.hostname);
  29805. }
  29806. var p = this.port ? ':' + this.port : '';
  29807. var h = this.hostname || '';
  29808. this.host = h + p;
  29809. this.href += this.host; // strip [ and ] from the hostname
  29810. // the host field still retains them, though
  29811. if (ipv6Hostname) {
  29812. this.hostname = this.hostname.substr(1, this.hostname.length - 2);
  29813. if (rest[0] !== '/') {
  29814. rest = '/' + rest;
  29815. }
  29816. }
  29817. } // now rest is set to the post-host stuff.
  29818. // chop off any delim chars.
  29819. if (!unsafeProtocol[lowerProto]) {
  29820. // First, make 100% sure that any "autoEscape" chars get
  29821. // escaped, even if encodeURIComponent doesn't think they
  29822. // need to be.
  29823. for (var i = 0, l = autoEscape.length; i < l; i++) {
  29824. var ae = autoEscape[i];
  29825. if (rest.indexOf(ae) === -1) continue;
  29826. var esc = encodeURIComponent(ae);
  29827. if (esc === ae) {
  29828. esc = escape(ae);
  29829. }
  29830. rest = rest.split(ae).join(esc);
  29831. }
  29832. } // chop off from the tail first.
  29833. var hash = rest.indexOf('#');
  29834. if (hash !== -1) {
  29835. // got a fragment string.
  29836. this.hash = rest.substr(hash);
  29837. rest = rest.slice(0, hash);
  29838. }
  29839. var qm = rest.indexOf('?');
  29840. if (qm !== -1) {
  29841. this.search = rest.substr(qm);
  29842. this.query = rest.substr(qm + 1);
  29843. if (parseQueryString) {
  29844. this.query = querystring.parse(this.query);
  29845. }
  29846. rest = rest.slice(0, qm);
  29847. } else if (parseQueryString) {
  29848. // no query string, but parseQueryString still requested
  29849. this.search = '';
  29850. this.query = {};
  29851. }
  29852. if (rest) this.pathname = rest;
  29853. if (slashedProtocol[lowerProto] && this.hostname && !this.pathname) {
  29854. this.pathname = '/';
  29855. } //to support http.request
  29856. if (this.pathname || this.search) {
  29857. var p = this.pathname || '';
  29858. var s = this.search || '';
  29859. this.path = p + s;
  29860. } // finally, reconstruct the href based on what has been validated.
  29861. this.href = this.format();
  29862. return this;
  29863. }; // format a parsed object into a url string
  29864. function urlFormat(obj) {
  29865. // ensure it's an object, and not a string url.
  29866. // If it's an obj, this is a no-op.
  29867. // this way, you can call url_format() on strings
  29868. // to clean up potentially wonky urls.
  29869. if (util.isString(obj)) obj = urlParse(obj);
  29870. if (!(obj instanceof Url)) return Url.prototype.format.call(obj);
  29871. return obj.format();
  29872. }
  29873. Url.prototype.format = function () {
  29874. var auth = this.auth || '';
  29875. if (auth) {
  29876. auth = encodeURIComponent(auth);
  29877. auth = auth.replace(/%3A/i, ':');
  29878. auth += '@';
  29879. }
  29880. var protocol = this.protocol || '',
  29881. pathname = this.pathname || '',
  29882. hash = this.hash || '',
  29883. host = false,
  29884. query = '';
  29885. if (this.host) {
  29886. host = auth + this.host;
  29887. } else if (this.hostname) {
  29888. host = auth + (this.hostname.indexOf(':') === -1 ? this.hostname : '[' + this.hostname + ']');
  29889. if (this.port) {
  29890. host += ':' + this.port;
  29891. }
  29892. }
  29893. if (this.query && util.isObject(this.query) && Object.keys(this.query).length) {
  29894. query = querystring.stringify(this.query);
  29895. }
  29896. var search = this.search || query && '?' + query || '';
  29897. if (protocol && protocol.substr(-1) !== ':') protocol += ':'; // only the slashedProtocols get the //. Not mailto:, xmpp:, etc.
  29898. // unless they had them to begin with.
  29899. if (this.slashes || (!protocol || slashedProtocol[protocol]) && host !== false) {
  29900. host = '//' + (host || '');
  29901. if (pathname && pathname.charAt(0) !== '/') pathname = '/' + pathname;
  29902. } else if (!host) {
  29903. host = '';
  29904. }
  29905. if (hash && hash.charAt(0) !== '#') hash = '#' + hash;
  29906. if (search && search.charAt(0) !== '?') search = '?' + search;
  29907. pathname = pathname.replace(/[?#]/g, function (match) {
  29908. return encodeURIComponent(match);
  29909. });
  29910. search = search.replace('#', '%23');
  29911. return protocol + host + pathname + search + hash;
  29912. };
  29913. function urlResolve(source, relative) {
  29914. return urlParse(source, false, true).resolve(relative);
  29915. }
  29916. Url.prototype.resolve = function (relative) {
  29917. return this.resolveObject(urlParse(relative, false, true)).format();
  29918. };
  29919. function urlResolveObject(source, relative) {
  29920. if (!source) return relative;
  29921. return urlParse(source, false, true).resolveObject(relative);
  29922. }
  29923. Url.prototype.resolveObject = function (relative) {
  29924. if (util.isString(relative)) {
  29925. var rel = new Url();
  29926. rel.parse(relative, false, true);
  29927. relative = rel;
  29928. }
  29929. var result = new Url();
  29930. var tkeys = Object.keys(this);
  29931. for (var tk = 0; tk < tkeys.length; tk++) {
  29932. var tkey = tkeys[tk];
  29933. result[tkey] = this[tkey];
  29934. } // hash is always overridden, no matter what.
  29935. // even href="" will remove it.
  29936. result.hash = relative.hash; // if the relative url is empty, then there's nothing left to do here.
  29937. if (relative.href === '') {
  29938. result.href = result.format();
  29939. return result;
  29940. } // hrefs like //foo/bar always cut to the protocol.
  29941. if (relative.slashes && !relative.protocol) {
  29942. // take everything except the protocol from relative
  29943. var rkeys = Object.keys(relative);
  29944. for (var rk = 0; rk < rkeys.length; rk++) {
  29945. var rkey = rkeys[rk];
  29946. if (rkey !== 'protocol') result[rkey] = relative[rkey];
  29947. } //urlParse appends trailing / to urls like http://www.example.com
  29948. if (slashedProtocol[result.protocol] && result.hostname && !result.pathname) {
  29949. result.path = result.pathname = '/';
  29950. }
  29951. result.href = result.format();
  29952. return result;
  29953. }
  29954. if (relative.protocol && relative.protocol !== result.protocol) {
  29955. // if it's a known url protocol, then changing
  29956. // the protocol does weird things
  29957. // first, if it's not file:, then we MUST have a host,
  29958. // and if there was a path
  29959. // to begin with, then we MUST have a path.
  29960. // if it is file:, then the host is dropped,
  29961. // because that's known to be hostless.
  29962. // anything else is assumed to be absolute.
  29963. if (!slashedProtocol[relative.protocol]) {
  29964. var keys = Object.keys(relative);
  29965. for (var v = 0; v < keys.length; v++) {
  29966. var k = keys[v];
  29967. result[k] = relative[k];
  29968. }
  29969. result.href = result.format();
  29970. return result;
  29971. }
  29972. result.protocol = relative.protocol;
  29973. if (!relative.host && !hostlessProtocol[relative.protocol]) {
  29974. var relPath = (relative.pathname || '').split('/');
  29975. while (relPath.length && !(relative.host = relPath.shift())) {
  29976. ;
  29977. }
  29978. if (!relative.host) relative.host = '';
  29979. if (!relative.hostname) relative.hostname = '';
  29980. if (relPath[0] !== '') relPath.unshift('');
  29981. if (relPath.length < 2) relPath.unshift('');
  29982. result.pathname = relPath.join('/');
  29983. } else {
  29984. result.pathname = relative.pathname;
  29985. }
  29986. result.search = relative.search;
  29987. result.query = relative.query;
  29988. result.host = relative.host || '';
  29989. result.auth = relative.auth;
  29990. result.hostname = relative.hostname || relative.host;
  29991. result.port = relative.port; // to support http.request
  29992. if (result.pathname || result.search) {
  29993. var p = result.pathname || '';
  29994. var s = result.search || '';
  29995. result.path = p + s;
  29996. }
  29997. result.slashes = result.slashes || relative.slashes;
  29998. result.href = result.format();
  29999. return result;
  30000. }
  30001. var isSourceAbs = result.pathname && result.pathname.charAt(0) === '/',
  30002. isRelAbs = relative.host || relative.pathname && relative.pathname.charAt(0) === '/',
  30003. mustEndAbs = isRelAbs || isSourceAbs || result.host && relative.pathname,
  30004. removeAllDots = mustEndAbs,
  30005. srcPath = result.pathname && result.pathname.split('/') || [],
  30006. relPath = relative.pathname && relative.pathname.split('/') || [],
  30007. psychotic = result.protocol && !slashedProtocol[result.protocol]; // if the url is a non-slashed url, then relative
  30008. // links like ../.. should be able
  30009. // to crawl up to the hostname, as well. This is strange.
  30010. // result.protocol has already been set by now.
  30011. // Later on, put the first path part into the host field.
  30012. if (psychotic) {
  30013. result.hostname = '';
  30014. result.port = null;
  30015. if (result.host) {
  30016. if (srcPath[0] === '') srcPath[0] = result.host;else srcPath.unshift(result.host);
  30017. }
  30018. result.host = '';
  30019. if (relative.protocol) {
  30020. relative.hostname = null;
  30021. relative.port = null;
  30022. if (relative.host) {
  30023. if (relPath[0] === '') relPath[0] = relative.host;else relPath.unshift(relative.host);
  30024. }
  30025. relative.host = null;
  30026. }
  30027. mustEndAbs = mustEndAbs && (relPath[0] === '' || srcPath[0] === '');
  30028. }
  30029. if (isRelAbs) {
  30030. // it's absolute.
  30031. result.host = relative.host || relative.host === '' ? relative.host : result.host;
  30032. result.hostname = relative.hostname || relative.hostname === '' ? relative.hostname : result.hostname;
  30033. result.search = relative.search;
  30034. result.query = relative.query;
  30035. srcPath = relPath; // fall through to the dot-handling below.
  30036. } else if (relPath.length) {
  30037. // it's relative
  30038. // throw away the existing file, and take the new path instead.
  30039. if (!srcPath) srcPath = [];
  30040. srcPath.pop();
  30041. srcPath = srcPath.concat(relPath);
  30042. result.search = relative.search;
  30043. result.query = relative.query;
  30044. } else if (!util.isNullOrUndefined(relative.search)) {
  30045. // just pull out the search.
  30046. // like href='?foo'.
  30047. // Put this after the other two cases because it simplifies the booleans
  30048. if (psychotic) {
  30049. result.hostname = result.host = srcPath.shift(); //occationaly the auth can get stuck only in host
  30050. //this especially happens in cases like
  30051. //url.resolveObject('mailto:local1@domain1', 'local2@domain2')
  30052. var authInHost = result.host && result.host.indexOf('@') > 0 ? result.host.split('@') : false;
  30053. if (authInHost) {
  30054. result.auth = authInHost.shift();
  30055. result.host = result.hostname = authInHost.shift();
  30056. }
  30057. }
  30058. result.search = relative.search;
  30059. result.query = relative.query; //to support http.request
  30060. if (!util.isNull(result.pathname) || !util.isNull(result.search)) {
  30061. result.path = (result.pathname ? result.pathname : '') + (result.search ? result.search : '');
  30062. }
  30063. result.href = result.format();
  30064. return result;
  30065. }
  30066. if (!srcPath.length) {
  30067. // no path at all. easy.
  30068. // we've already handled the other stuff above.
  30069. result.pathname = null; //to support http.request
  30070. if (result.search) {
  30071. result.path = '/' + result.search;
  30072. } else {
  30073. result.path = null;
  30074. }
  30075. result.href = result.format();
  30076. return result;
  30077. } // if a url ENDs in . or .., then it must get a trailing slash.
  30078. // however, if it ends in anything else non-slashy,
  30079. // then it must NOT get a trailing slash.
  30080. var last = srcPath.slice(-1)[0];
  30081. var hasTrailingSlash = (result.host || relative.host || srcPath.length > 1) && (last === '.' || last === '..') || last === ''; // strip single dots, resolve double dots to parent dir
  30082. // if the path tries to go above the root, `up` ends up > 0
  30083. var up = 0;
  30084. for (var i = srcPath.length; i >= 0; i--) {
  30085. last = srcPath[i];
  30086. if (last === '.') {
  30087. srcPath.splice(i, 1);
  30088. } else if (last === '..') {
  30089. srcPath.splice(i, 1);
  30090. up++;
  30091. } else if (up) {
  30092. srcPath.splice(i, 1);
  30093. up--;
  30094. }
  30095. } // if the path is allowed to go above the root, restore leading ..s
  30096. if (!mustEndAbs && !removeAllDots) {
  30097. for (; up--; up) {
  30098. srcPath.unshift('..');
  30099. }
  30100. }
  30101. if (mustEndAbs && srcPath[0] !== '' && (!srcPath[0] || srcPath[0].charAt(0) !== '/')) {
  30102. srcPath.unshift('');
  30103. }
  30104. if (hasTrailingSlash && srcPath.join('/').substr(-1) !== '/') {
  30105. srcPath.push('');
  30106. }
  30107. var isAbsolute = srcPath[0] === '' || srcPath[0] && srcPath[0].charAt(0) === '/'; // put the host back
  30108. if (psychotic) {
  30109. result.hostname = result.host = isAbsolute ? '' : srcPath.length ? srcPath.shift() : ''; //occationaly the auth can get stuck only in host
  30110. //this especially happens in cases like
  30111. //url.resolveObject('mailto:local1@domain1', 'local2@domain2')
  30112. var authInHost = result.host && result.host.indexOf('@') > 0 ? result.host.split('@') : false;
  30113. if (authInHost) {
  30114. result.auth = authInHost.shift();
  30115. result.host = result.hostname = authInHost.shift();
  30116. }
  30117. }
  30118. mustEndAbs = mustEndAbs || result.host && srcPath.length;
  30119. if (mustEndAbs && !isAbsolute) {
  30120. srcPath.unshift('');
  30121. }
  30122. if (!srcPath.length) {
  30123. result.pathname = null;
  30124. result.path = null;
  30125. } else {
  30126. result.pathname = srcPath.join('/');
  30127. } //to support request.http
  30128. if (!util.isNull(result.pathname) || !util.isNull(result.search)) {
  30129. result.path = (result.pathname ? result.pathname : '') + (result.search ? result.search : '');
  30130. }
  30131. result.auth = relative.auth || result.auth;
  30132. result.slashes = result.slashes || relative.slashes;
  30133. result.href = result.format();
  30134. return result;
  30135. };
  30136. Url.prototype.parseHost = function () {
  30137. var host = this.host;
  30138. var port = portPattern.exec(host);
  30139. if (port) {
  30140. port = port[0];
  30141. if (port !== ':') {
  30142. this.port = port.substr(1);
  30143. }
  30144. host = host.substr(0, host.length - port.length);
  30145. }
  30146. if (host) this.hostname = host;
  30147. };
  30148. },{"./util":405,"@babel/runtime/helpers/interopRequireDefault":74,"@babel/runtime/helpers/typeof":75,"core-js/modules/es.array.concat.js":241,"core-js/modules/es.array.join.js":248,"core-js/modules/es.array.slice.js":250,"core-js/modules/es.array.splice.js":252,"core-js/modules/es.object.keys.js":257,"core-js/modules/es.regexp.exec.js":261,"core-js/modules/es.string.match.js":265,"core-js/modules/es.string.replace.js":266,"core-js/modules/es.string.search.js":267,"core-js/modules/es.string.split.js":268,"core-js/modules/es.string.trim.js":269,"punycode":325,"querystring":328}],405:[function(require,module,exports){
  30149. 'use strict';
  30150. var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
  30151. var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
  30152. module.exports = {
  30153. isString: function isString(arg) {
  30154. return typeof arg === 'string';
  30155. },
  30156. isObject: function isObject(arg) {
  30157. return (0, _typeof2.default)(arg) === 'object' && arg !== null;
  30158. },
  30159. isNull: function isNull(arg) {
  30160. return arg === null;
  30161. },
  30162. isNullOrUndefined: function isNullOrUndefined(arg) {
  30163. return arg == null;
  30164. }
  30165. };
  30166. },{"@babel/runtime/helpers/interopRequireDefault":74,"@babel/runtime/helpers/typeof":75}],406:[function(require,module,exports){
  30167. "use strict";
  30168. require("core-js/modules/es.number.constructor.js");
  30169. // copy from https://github.com/node-modules/utility for browser
  30170. exports.encodeURIComponent = function (text) {
  30171. try {
  30172. return encodeURIComponent(text);
  30173. } catch (e) {
  30174. return text;
  30175. }
  30176. };
  30177. exports.escape = require('escape-html');
  30178. exports.timestamp = function timestamp(t) {
  30179. if (t) {
  30180. var v = t;
  30181. if (typeof v === 'string') {
  30182. v = Number(v);
  30183. }
  30184. if (String(t).length === 10) {
  30185. v *= 1000;
  30186. }
  30187. return new Date(v);
  30188. }
  30189. return Math.round(Date.now() / 1000);
  30190. };
  30191. },{"core-js/modules/es.number.constructor.js":254,"escape-html":300}],407:[function(require,module,exports){
  30192. (function (process,Buffer){(function (){
  30193. 'use strict';
  30194. var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
  30195. var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
  30196. require("core-js/modules/es.string.trim.js");
  30197. require("core-js/modules/es.regexp.exec.js");
  30198. require("core-js/modules/es.string.split.js");
  30199. require("core-js/modules/es.object.to-string.js");
  30200. require("core-js/modules/es.promise.js");
  30201. require("core-js/modules/es.function.name.js");
  30202. require("core-js/modules/es.array.concat.js");
  30203. var util = require('util');
  30204. var urlutil = require('url');
  30205. var http = require('http');
  30206. var https = require('https');
  30207. var debug = require('debug')('urllib');
  30208. var ms = require('humanize-ms');
  30209. var REQUEST_ID = 0;
  30210. var MAX_VALUE = Math.pow(2, 31) - 10;
  30211. var PROTO_RE = /^https?:\/\//i;
  30212. function getAgent(agent, defaultAgent) {
  30213. return agent === undefined ? defaultAgent : agent;
  30214. }
  30215. function parseContentType(str) {
  30216. if (!str) {
  30217. return '';
  30218. }
  30219. return str.split(';')[0].trim().toLowerCase();
  30220. }
  30221. function makeCallback(resolve, reject) {
  30222. return function (err, data, res) {
  30223. if (err) {
  30224. return reject(err);
  30225. }
  30226. resolve({
  30227. data: data,
  30228. status: res.statusCode,
  30229. headers: res.headers,
  30230. res: res
  30231. });
  30232. };
  30233. } // exports.TIMEOUT = ms('5s');
  30234. exports.TIMEOUTS = [ms('300s'), ms('300s')];
  30235. var TEXT_DATA_TYPES = ['json', 'text'];
  30236. exports.request = function request(url, args, callback) {
  30237. // request(url, callback)
  30238. if (arguments.length === 2 && typeof args === 'function') {
  30239. callback = args;
  30240. args = null;
  30241. }
  30242. if (typeof callback === 'function') {
  30243. return exports.requestWithCallback(url, args, callback);
  30244. }
  30245. return new Promise(function (resolve, reject) {
  30246. exports.requestWithCallback(url, args, makeCallback(resolve, reject));
  30247. });
  30248. };
  30249. exports.requestWithCallback = function requestWithCallback(url, args, callback) {
  30250. if (!url || typeof url !== 'string' && (0, _typeof2.default)(url) !== 'object') {
  30251. var msg = util.format('expect request url to be a string or a http request options, but got' + ' %j', url);
  30252. throw new Error(msg);
  30253. }
  30254. if (arguments.length === 2 && typeof args === 'function') {
  30255. callback = args;
  30256. args = null;
  30257. }
  30258. args = args || {};
  30259. if (REQUEST_ID >= MAX_VALUE) {
  30260. REQUEST_ID = 0;
  30261. }
  30262. var reqId = ++REQUEST_ID;
  30263. args.requestUrls = args.requestUrls || [];
  30264. var reqMeta = {
  30265. requestId: reqId,
  30266. url: url,
  30267. args: args,
  30268. ctx: args.ctx
  30269. };
  30270. if (args.emitter) {
  30271. args.emitter.emit('request', reqMeta);
  30272. }
  30273. args.timeout = args.timeout || exports.TIMEOUTS;
  30274. args.maxRedirects = args.maxRedirects || 10;
  30275. args.streaming = args.streaming || args.customResponse;
  30276. var requestStartTime = Date.now();
  30277. var parsedUrl;
  30278. if (typeof url === 'string') {
  30279. if (!PROTO_RE.test(url)) {
  30280. // Support `request('www.server.com')`
  30281. url = 'https://' + url;
  30282. }
  30283. parsedUrl = urlutil.parse(url);
  30284. } else {
  30285. parsedUrl = url;
  30286. }
  30287. var method = (args.type || args.method || parsedUrl.method || 'GET').toUpperCase();
  30288. var port = parsedUrl.port || 80;
  30289. var httplib = http;
  30290. var agent = getAgent(args.agent, exports.agent);
  30291. var fixJSONCtlChars = args.fixJSONCtlChars;
  30292. if (parsedUrl.protocol === 'https:') {
  30293. httplib = https;
  30294. agent = getAgent(args.httpsAgent, exports.httpsAgent);
  30295. if (!parsedUrl.port) {
  30296. port = 443;
  30297. }
  30298. } // request through proxy tunnel
  30299. // var proxyTunnelAgent = detectProxyAgent(parsedUrl, args);
  30300. // if (proxyTunnelAgent) {
  30301. // agent = proxyTunnelAgent;
  30302. // }
  30303. var options = {
  30304. host: parsedUrl.hostname || parsedUrl.host || 'localhost',
  30305. path: parsedUrl.path || '/',
  30306. method: method,
  30307. port: port,
  30308. agent: agent,
  30309. headers: args.headers || {},
  30310. // default is dns.lookup
  30311. // https://github.com/nodejs/node/blob/master/lib/net.js#L986
  30312. // custom dnslookup require node >= 4.0.0
  30313. // https://github.com/nodejs/node/blob/archived-io.js-v0.12/lib/net.js#L952
  30314. lookup: args.lookup
  30315. };
  30316. if (Array.isArray(args.timeout)) {
  30317. options.requestTimeout = args.timeout[args.timeout.length - 1];
  30318. } else if (typeof args.timeout !== 'undefined') {
  30319. options.requestTimeout = args.timeout;
  30320. } // const sslNames = [
  30321. // 'pfx',
  30322. // 'key',
  30323. // 'passphrase',
  30324. // 'cert',
  30325. // 'ca',
  30326. // 'ciphers',
  30327. // 'rejectUnauthorized',
  30328. // 'secureProtocol',
  30329. // 'secureOptions',
  30330. // ];
  30331. // for (let i = 0; i < sslNames.length; i++) {
  30332. // const name = sslNames[i];
  30333. // if (args.hasOwnProperty(name)) {
  30334. // options[name] = args[name];
  30335. // }
  30336. // }
  30337. // don't check ssl
  30338. // if (options.rejectUnauthorized === false && !options.hasOwnProperty('secureOptions')) {
  30339. // options.secureOptions = require('constants').SSL_OP_NO_TLSv1_2;
  30340. // }
  30341. var auth = args.auth || parsedUrl.auth;
  30342. if (auth) {
  30343. options.auth = auth;
  30344. } // content undefined data 有值
  30345. var body = args.content || args.data;
  30346. var dataAsQueryString = method === 'GET' || method === 'HEAD' || args.dataAsQueryString;
  30347. if (!args.content) {
  30348. if (body && !(typeof body === 'string' || Buffer.isBuffer(body))) {
  30349. if (dataAsQueryString) {
  30350. // read: GET, HEAD, use query string
  30351. body = args.nestedQuerystring ? qs.stringify(body) : querystring.stringify(body);
  30352. } else {
  30353. var contentType = options.headers['Content-Type'] || options.headers['content-type']; // auto add application/x-www-form-urlencoded when using urlencode form request
  30354. if (!contentType) {
  30355. if (args.contentType === 'json') {
  30356. contentType = 'application/json';
  30357. } else {
  30358. contentType = 'application/x-www-form-urlencoded';
  30359. }
  30360. options.headers['Content-Type'] = contentType;
  30361. }
  30362. if (parseContentType(contentType) === 'application/json') {
  30363. body = JSON.stringify(body);
  30364. } else {
  30365. // 'application/x-www-form-urlencoded'
  30366. body = args.nestedQuerystring ? qs.stringify(body) : querystring.stringify(body);
  30367. }
  30368. }
  30369. }
  30370. } // if it's a GET or HEAD request, data should be sent as query string
  30371. if (dataAsQueryString && body) {
  30372. options.path += (parsedUrl.query ? '&' : '?') + body;
  30373. body = null;
  30374. }
  30375. var requestSize = 0;
  30376. if (body) {
  30377. var length = body.length;
  30378. if (!Buffer.isBuffer(body)) {
  30379. length = Buffer.byteLength(body);
  30380. }
  30381. requestSize = options.headers['Content-Length'] = length;
  30382. }
  30383. if (args.dataType === 'json') {
  30384. options.headers.Accept = 'application/json';
  30385. }
  30386. if (typeof args.beforeRequest === 'function') {
  30387. // you can use this hook to change every thing.
  30388. args.beforeRequest(options);
  30389. }
  30390. var connectTimer = null;
  30391. var responseTimer = null;
  30392. var __err = null;
  30393. var connected = false; // socket connected or not
  30394. var keepAliveSocket = false; // request with keepalive socket
  30395. var responseSize = 0;
  30396. var statusCode = -1;
  30397. var responseAborted = false;
  30398. var remoteAddress = '';
  30399. var remotePort = '';
  30400. var timing = null;
  30401. if (args.timing) {
  30402. timing = {
  30403. // socket assigned
  30404. queuing: 0,
  30405. // dns lookup time
  30406. dnslookup: 0,
  30407. // socket connected
  30408. connected: 0,
  30409. // request sent
  30410. requestSent: 0,
  30411. // Time to first byte (TTFB)
  30412. waiting: 0,
  30413. contentDownload: 0
  30414. };
  30415. }
  30416. function cancelConnectTimer() {
  30417. if (connectTimer) {
  30418. clearTimeout(connectTimer);
  30419. connectTimer = null;
  30420. }
  30421. }
  30422. function cancelResponseTimer() {
  30423. if (responseTimer) {
  30424. clearTimeout(responseTimer);
  30425. responseTimer = null;
  30426. }
  30427. }
  30428. function done(err, data, res) {
  30429. cancelResponseTimer();
  30430. if (!callback) {
  30431. console.warn('[urllib:warn] [%s] [%s] [worker:%s] %s %s callback twice!!!', Date(), reqId, process.pid, options.method, url); // https://github.com/node-modules/urllib/pull/30
  30432. if (err) {
  30433. console.warn('[urllib:warn] [%s] [%s] [worker:%s] %s: %s\nstack: %s', Date(), reqId, process.pid, err.name, err.message, err.stack);
  30434. }
  30435. return;
  30436. }
  30437. var cb = callback;
  30438. callback = null;
  30439. var headers = {};
  30440. if (res) {
  30441. statusCode = res.statusCode;
  30442. headers = res.headers;
  30443. } // handle digest auth
  30444. // if (statusCode === 401 && headers['www-authenticate']
  30445. // && (!args.headers || !args.headers.Authorization) && args.digestAuth) {
  30446. // const authenticate = headers['www-authenticate'];
  30447. // if (authenticate.indexOf('Digest ') >= 0) {
  30448. // debug('Request#%d %s: got digest auth header WWW-Authenticate: %s', reqId, url, authenticate);
  30449. // args.headers = args.headers || {};
  30450. // args.headers.Authorization = digestAuthHeader(options.method, options.path, authenticate, args.digestAuth);
  30451. // debug('Request#%d %s: auth with digest header: %s', reqId, url, args.headers.Authorization);
  30452. // if (res.headers['set-cookie']) {
  30453. // args.headers.Cookie = res.headers['set-cookie'].join(';');
  30454. // }
  30455. // return exports.requestWithCallback(url, args, cb);
  30456. // }
  30457. // }
  30458. var requestUseTime = Date.now() - requestStartTime;
  30459. if (timing) {
  30460. timing.contentDownload = requestUseTime;
  30461. }
  30462. debug('[%sms] done, %s bytes HTTP %s %s %s %s, keepAliveSocket: %s, timing: %j', requestUseTime, responseSize, statusCode, options.method, options.host, options.path, keepAliveSocket, timing);
  30463. var response = {
  30464. status: statusCode,
  30465. statusCode: statusCode,
  30466. headers: headers,
  30467. size: responseSize,
  30468. aborted: responseAborted,
  30469. rt: requestUseTime,
  30470. keepAliveSocket: keepAliveSocket,
  30471. data: data,
  30472. requestUrls: args.requestUrls,
  30473. timing: timing,
  30474. remoteAddress: remoteAddress,
  30475. remotePort: remotePort
  30476. };
  30477. if (err) {
  30478. var agentStatus = '';
  30479. if (agent && typeof agent.getCurrentStatus === 'function') {
  30480. // add current agent status to error message for logging and debug
  30481. agentStatus = ', agent status: ' + JSON.stringify(agent.getCurrentStatus());
  30482. }
  30483. err.message += ', ' + options.method + ' ' + url + ' ' + statusCode + ' (connected: ' + connected + ', keepalive socket: ' + keepAliveSocket + agentStatus + ')' + '\nheaders: ' + JSON.stringify(headers);
  30484. err.data = data;
  30485. err.path = options.path;
  30486. err.status = statusCode;
  30487. err.headers = headers;
  30488. err.res = response;
  30489. }
  30490. cb(err, data, args.streaming ? res : response);
  30491. if (args.emitter) {
  30492. // keep to use the same reqMeta object on request event before
  30493. reqMeta.url = url;
  30494. reqMeta.socket = req && req.connection;
  30495. reqMeta.options = options;
  30496. reqMeta.size = requestSize;
  30497. args.emitter.emit('response', {
  30498. requestId: reqId,
  30499. error: err,
  30500. ctx: args.ctx,
  30501. req: reqMeta,
  30502. res: response
  30503. });
  30504. }
  30505. }
  30506. function handleRedirect(res) {
  30507. var err = null;
  30508. if (args.followRedirect && statuses.redirect[res.statusCode]) {
  30509. // handle redirect
  30510. args._followRedirectCount = (args._followRedirectCount || 0) + 1;
  30511. var location = res.headers.location;
  30512. if (!location) {
  30513. err = new Error('Got statusCode ' + res.statusCode + ' but cannot resolve next location from headers');
  30514. err.name = 'FollowRedirectError';
  30515. } else if (args._followRedirectCount > args.maxRedirects) {
  30516. err = new Error('Exceeded maxRedirects. Probably stuck in a redirect loop ' + url);
  30517. err.name = 'MaxRedirectError';
  30518. } else {
  30519. var newUrl = args.formatRedirectUrl ? args.formatRedirectUrl(url, location) : urlutil.resolve(url, location);
  30520. debug('Request#%d %s: `redirected` from %s to %s', reqId, options.path, url, newUrl); // make sure timer stop
  30521. cancelResponseTimer(); // should clean up headers.Host on `location: http://other-domain/url`
  30522. if (args.headers && args.headers.Host && PROTO_RE.test(location)) {
  30523. args.headers.Host = null;
  30524. } // avoid done will be execute in the future change.
  30525. var cb = callback;
  30526. callback = null;
  30527. exports.requestWithCallback(newUrl, args, cb);
  30528. return {
  30529. redirect: true,
  30530. error: null
  30531. };
  30532. }
  30533. }
  30534. return {
  30535. redirect: false,
  30536. error: err
  30537. };
  30538. }
  30539. if (args.gzip) {
  30540. if (!options.headers['Accept-Encoding'] && !options.headers['accept-encoding']) {
  30541. options.headers['Accept-Encoding'] = 'gzip';
  30542. }
  30543. }
  30544. function decodeContent(res, body, cb) {
  30545. var encoding = res.headers['content-encoding']; // if (body.length === 0) {
  30546. // return cb(null, body, encoding);
  30547. // }
  30548. // if (!encoding || encoding.toLowerCase() !== 'gzip') {
  30549. return cb(null, body, encoding); // }
  30550. // debug('gunzip %d length body', body.length);
  30551. // zlib.gunzip(body, cb);
  30552. }
  30553. var writeStream = args.writeStream;
  30554. debug('Request#%d %s %s with headers %j, options.path: %s', reqId, method, url, options.headers, options.path);
  30555. args.requestUrls.push(url);
  30556. function onResponse(res) {
  30557. if (timing) {
  30558. timing.waiting = Date.now() - requestStartTime;
  30559. }
  30560. debug('Request#%d %s `req response` event emit: status %d, headers: %j', reqId, url, res.statusCode, res.headers);
  30561. if (args.streaming) {
  30562. var result = handleRedirect(res);
  30563. if (result.redirect) {
  30564. res.resume();
  30565. return;
  30566. }
  30567. if (result.error) {
  30568. res.resume();
  30569. return done(result.error, null, res);
  30570. }
  30571. return done(null, null, res);
  30572. }
  30573. res.on('close', function () {
  30574. debug('Request#%d %s: `res close` event emit, total size %d', reqId, url, responseSize);
  30575. });
  30576. res.on('error', function () {
  30577. debug('Request#%d %s: `res error` event emit, total size %d', reqId, url, responseSize);
  30578. });
  30579. res.on('aborted', function () {
  30580. responseAborted = true;
  30581. debug('Request#%d %s: `res aborted` event emit, total size %d', reqId, url, responseSize);
  30582. });
  30583. if (writeStream) {
  30584. // If there's a writable stream to recieve the response data, just pipe the
  30585. // response stream to that writable stream and call the callback when it has
  30586. // finished writing.
  30587. //
  30588. // NOTE that when the response stream `res` emits an 'end' event it just
  30589. // means that it has finished piping data to another stream. In the
  30590. // meanwhile that writable stream may still writing data to the disk until
  30591. // it emits a 'close' event.
  30592. //
  30593. // That means that we should not apply callback until the 'close' of the
  30594. // writable stream is emited.
  30595. //
  30596. // See also:
  30597. // - https://github.com/TBEDP/urllib/commit/959ac3365821e0e028c231a5e8efca6af410eabb
  30598. // - http://nodejs.org/api/stream.html#stream_event_end
  30599. // - http://nodejs.org/api/stream.html#stream_event_close_1
  30600. var _result = handleRedirect(res);
  30601. if (_result.redirect) {
  30602. res.resume();
  30603. return;
  30604. }
  30605. if (_result.error) {
  30606. res.resume(); // end ths stream first
  30607. writeStream.end();
  30608. return done(_result.error, null, res);
  30609. } // you can set consumeWriteStream false that only wait response end
  30610. if (args.consumeWriteStream === false) {
  30611. res.on('end', done.bind(null, null, null, res));
  30612. } else {
  30613. // node 0.10, 0.12: only emit res aborted, writeStream close not fired
  30614. // if (isNode010 || isNode012) {
  30615. // first([
  30616. // [ writeStream, 'close' ],
  30617. // [ res, 'aborted' ],
  30618. // ], function(_, stream, event) {
  30619. // debug('Request#%d %s: writeStream or res %s event emitted', reqId, url, event);
  30620. // done(__err || null, null, res);
  30621. // });
  30622. if (false) {} else {
  30623. writeStream.on('close', function () {
  30624. debug('Request#%d %s: writeStream close event emitted', reqId, url);
  30625. done(__err || null, null, res);
  30626. });
  30627. }
  30628. }
  30629. return res.pipe(writeStream);
  30630. } // Otherwise, just concat those buffers.
  30631. //
  30632. // NOTE that the `chunk` is not a String but a Buffer. It means that if
  30633. // you simply concat two chunk with `+` you're actually converting both
  30634. // Buffers into Strings before concating them. It'll cause problems when
  30635. // dealing with multi-byte characters.
  30636. //
  30637. // The solution is to store each chunk in an array and concat them with
  30638. // 'buffer-concat' when all chunks is recieved.
  30639. //
  30640. // See also:
  30641. // http://cnodejs.org/topic/4faf65852e8fb5bc65113403
  30642. var chunks = [];
  30643. res.on('data', function (chunk) {
  30644. debug('Request#%d %s: `res data` event emit, size %d', reqId, url, chunk.length);
  30645. responseSize += chunk.length;
  30646. chunks.push(chunk);
  30647. });
  30648. res.on('end', function () {
  30649. var body = Buffer.concat(chunks, responseSize);
  30650. debug('Request#%d %s: `res end` event emit, total size %d, _dumped: %s', reqId, url, responseSize, res._dumped);
  30651. if (__err) {
  30652. // req.abort() after `res data` event emit.
  30653. return done(__err, body, res);
  30654. }
  30655. var result = handleRedirect(res);
  30656. if (result.error) {
  30657. return done(result.error, body, res);
  30658. }
  30659. if (result.redirect) {
  30660. return;
  30661. }
  30662. decodeContent(res, body, function (err, data, encoding) {
  30663. if (err) {
  30664. return done(err, body, res);
  30665. } // if body not decode, dont touch it
  30666. if (!encoding && TEXT_DATA_TYPES.indexOf(args.dataType) >= 0) {
  30667. // try to decode charset
  30668. try {
  30669. data = decodeBodyByCharset(data, res);
  30670. } catch (e) {
  30671. debug('decodeBodyByCharset error: %s', e); // if error, dont touch it
  30672. return done(null, data, res);
  30673. }
  30674. if (args.dataType === 'json') {
  30675. if (responseSize === 0) {
  30676. data = null;
  30677. } else {
  30678. var r = parseJSON(data, fixJSONCtlChars);
  30679. if (r.error) {
  30680. err = r.error;
  30681. } else {
  30682. data = r.data;
  30683. }
  30684. }
  30685. }
  30686. }
  30687. if (responseAborted) {
  30688. // err = new Error('Remote socket was terminated before `response.end()` was called');
  30689. // err.name = 'RemoteSocketClosedError';
  30690. debug('Request#%d %s: Remote socket was terminated before `response.end()` was called', reqId, url);
  30691. }
  30692. done(err, data, res);
  30693. });
  30694. });
  30695. }
  30696. var connectTimeout, responseTimeout;
  30697. if (Array.isArray(args.timeout)) {
  30698. connectTimeout = ms(args.timeout[0]);
  30699. responseTimeout = ms(args.timeout[1]);
  30700. } else {
  30701. // set both timeout equal
  30702. connectTimeout = responseTimeout = ms(args.timeout);
  30703. }
  30704. debug('ConnectTimeout: %d, ResponseTimeout: %d', connectTimeout, responseTimeout);
  30705. function startConnectTimer() {
  30706. debug('Connect timer ticking, timeout: %d', connectTimeout);
  30707. connectTimer = setTimeout(function () {
  30708. connectTimer = null;
  30709. if (statusCode === -1) {
  30710. statusCode = -2;
  30711. }
  30712. var msg = 'Connect timeout for ' + connectTimeout + 'ms';
  30713. var errorName = 'ConnectionTimeoutError';
  30714. if (!req.socket) {
  30715. errorName = 'SocketAssignTimeoutError';
  30716. msg += ', working sockets is full';
  30717. }
  30718. __err = new Error(msg);
  30719. __err.name = errorName;
  30720. __err.requestId = reqId;
  30721. debug('ConnectTimeout: Request#%d %s %s: %s, connected: %s', reqId, url, __err.name, msg, connected);
  30722. abortRequest();
  30723. }, connectTimeout);
  30724. }
  30725. function startResposneTimer() {
  30726. debug('Response timer ticking, timeout: %d', responseTimeout);
  30727. responseTimer = setTimeout(function () {
  30728. responseTimer = null;
  30729. var msg = 'Response timeout for ' + responseTimeout + 'ms';
  30730. var errorName = 'ResponseTimeoutError';
  30731. __err = new Error(msg);
  30732. __err.name = errorName;
  30733. __err.requestId = reqId;
  30734. debug('ResponseTimeout: Request#%d %s %s: %s, connected: %s', reqId, url, __err.name, msg, connected);
  30735. abortRequest();
  30736. }, responseTimeout);
  30737. }
  30738. var req; // request headers checker will throw error
  30739. options.mode = args.mode ? args.mode : '';
  30740. try {
  30741. req = httplib.request(options, onResponse);
  30742. } catch (err) {
  30743. return done(err);
  30744. } // environment detection: browser or nodejs
  30745. if (typeof window === 'undefined') {
  30746. // start connect timer just after `request` return, and just in nodejs environment
  30747. startConnectTimer();
  30748. } else {
  30749. req.on('requestTimeout', function () {
  30750. if (statusCode === -1) {
  30751. statusCode = -2;
  30752. }
  30753. var msg = 'Connect timeout for ' + connectTimeout + 'ms';
  30754. var errorName = 'ConnectionTimeoutError';
  30755. __err = new Error(msg);
  30756. __err.name = errorName;
  30757. __err.requestId = reqId;
  30758. abortRequest();
  30759. });
  30760. }
  30761. function abortRequest() {
  30762. debug('Request#%d %s abort, connected: %s', reqId, url, connected); // it wont case error event when req haven't been assigned a socket yet.
  30763. if (!req.socket) {
  30764. __err.noSocket = true;
  30765. done(__err);
  30766. }
  30767. req.abort();
  30768. }
  30769. if (timing) {
  30770. // request sent
  30771. req.on('finish', function () {
  30772. timing.requestSent = Date.now() - requestStartTime;
  30773. });
  30774. }
  30775. req.once('socket', function (socket) {
  30776. if (timing) {
  30777. // socket queuing time
  30778. timing.queuing = Date.now() - requestStartTime;
  30779. } // https://github.com/nodejs/node/blob/master/lib/net.js#L377
  30780. // https://github.com/nodejs/node/blob/v0.10.40-release/lib/net.js#L352
  30781. // should use socket.socket on 0.10.x
  30782. // if (isNode010 && socket.socket) {
  30783. // socket = socket.socket;
  30784. // }
  30785. var readyState = socket.readyState;
  30786. if (readyState === 'opening') {
  30787. socket.once('lookup', function (err, ip, addressType) {
  30788. debug('Request#%d %s lookup: %s, %s, %s', reqId, url, err, ip, addressType);
  30789. if (timing) {
  30790. timing.dnslookup = Date.now() - requestStartTime;
  30791. }
  30792. if (ip) {
  30793. remoteAddress = ip;
  30794. }
  30795. });
  30796. socket.once('connect', function () {
  30797. if (timing) {
  30798. // socket connected
  30799. timing.connected = Date.now() - requestStartTime;
  30800. } // cancel socket timer at first and start tick for TTFB
  30801. cancelConnectTimer();
  30802. startResposneTimer();
  30803. debug('Request#%d %s new socket connected', reqId, url);
  30804. connected = true;
  30805. if (!remoteAddress) {
  30806. remoteAddress = socket.remoteAddress;
  30807. }
  30808. remotePort = socket.remotePort;
  30809. });
  30810. return;
  30811. }
  30812. debug('Request#%d %s reuse socket connected, readyState: %s', reqId, url, readyState);
  30813. connected = true;
  30814. keepAliveSocket = true;
  30815. if (!remoteAddress) {
  30816. remoteAddress = socket.remoteAddress;
  30817. }
  30818. remotePort = socket.remotePort; // reuse socket, timer should be canceled.
  30819. cancelConnectTimer();
  30820. startResposneTimer();
  30821. });
  30822. req.on('error', function (err) {
  30823. //TypeError for browser fetch api, Error for browser xmlhttprequest api
  30824. if (err.name === 'Error' || err.name === 'TypeError') {
  30825. err.name = connected ? 'ResponseError' : 'RequestError';
  30826. }
  30827. err.message += ' (req "error")';
  30828. debug('Request#%d %s `req error` event emit, %s: %s', reqId, url, err.name, err.message);
  30829. done(__err || err);
  30830. });
  30831. if (writeStream) {
  30832. writeStream.once('error', function (err) {
  30833. err.message += ' (writeStream "error")';
  30834. __err = err;
  30835. debug('Request#%d %s `writeStream error` event emit, %s: %s', reqId, url, err.name, err.message);
  30836. abortRequest();
  30837. });
  30838. }
  30839. if (args.stream) {
  30840. args.stream.pipe(req);
  30841. args.stream.once('error', function (err) {
  30842. err.message += ' (stream "error")';
  30843. __err = err;
  30844. debug('Request#%d %s `readStream error` event emit, %s: %s', reqId, url, err.name, err.message);
  30845. abortRequest();
  30846. });
  30847. } else {
  30848. req.end(body);
  30849. }
  30850. req.requestId = reqId;
  30851. return req;
  30852. };
  30853. }).call(this)}).call(this,require('_process'),require("buffer").Buffer)
  30854. },{"@babel/runtime/helpers/interopRequireDefault":74,"@babel/runtime/helpers/typeof":75,"_process":399,"buffer":85,"core-js/modules/es.array.concat.js":241,"core-js/modules/es.function.name.js":253,"core-js/modules/es.object.to-string.js":258,"core-js/modules/es.promise.js":259,"core-js/modules/es.regexp.exec.js":261,"core-js/modules/es.string.split.js":268,"core-js/modules/es.string.trim.js":269,"debug":397,"http":400,"https":302,"humanize-ms":303,"url":404,"util":352}]},{},[1])(1)
  30855. });