| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279152801528115282152831528415285152861528715288152891529015291152921529315294152951529615297152981529915300153011530215303153041530515306153071530815309153101531115312153131531415315153161531715318153191532015321153221532315324153251532615327153281532915330153311533215333153341533515336153371533815339153401534115342153431534415345153461534715348153491535015351153521535315354153551535615357153581535915360153611536215363153641536515366153671536815369153701537115372153731537415375153761537715378153791538015381153821538315384153851538615387153881538915390153911539215393153941539515396153971539815399154001540115402154031540415405154061540715408154091541015411154121541315414154151541615417154181541915420154211542215423154241542515426154271542815429154301543115432154331543415435154361543715438154391544015441154421544315444154451544615447154481544915450154511545215453154541545515456154571545815459154601546115462154631546415465154661546715468154691547015471154721547315474154751547615477154781547915480154811548215483154841548515486154871548815489154901549115492154931549415495154961549715498154991550015501155021550315504155051550615507155081550915510155111551215513155141551515516155171551815519155201552115522155231552415525155261552715528155291553015531155321553315534155351553615537155381553915540155411554215543155441554515546155471554815549155501555115552155531555415555155561555715558155591556015561155621556315564155651556615567155681556915570155711557215573155741557515576155771557815579155801558115582155831558415585155861558715588155891559015591155921559315594155951559615597155981559915600156011560215603156041560515606156071560815609156101561115612156131561415615156161561715618156191562015621156221562315624156251562615627156281562915630156311563215633156341563515636156371563815639156401564115642156431564415645156461564715648156491565015651156521565315654156551565615657156581565915660156611566215663156641566515666156671566815669156701567115672156731567415675156761567715678156791568015681156821568315684156851568615687156881568915690156911569215693156941569515696156971569815699157001570115702157031570415705157061570715708157091571015711157121571315714157151571615717157181571915720157211572215723157241572515726157271572815729157301573115732157331573415735157361573715738157391574015741157421574315744157451574615747157481574915750157511575215753157541575515756157571575815759157601576115762157631576415765157661576715768157691577015771157721577315774157751577615777157781577915780157811578215783157841578515786157871578815789157901579115792157931579415795157961579715798157991580015801158021580315804158051580615807158081580915810158111581215813158141581515816158171581815819158201582115822158231582415825158261582715828158291583015831158321583315834158351583615837158381583915840158411584215843158441584515846158471584815849158501585115852158531585415855158561585715858158591586015861158621586315864158651586615867158681586915870158711587215873158741587515876158771587815879158801588115882158831588415885158861588715888158891589015891158921589315894158951589615897158981589915900159011590215903159041590515906159071590815909159101591115912159131591415915159161591715918159191592015921159221592315924159251592615927159281592915930159311593215933159341593515936159371593815939159401594115942159431594415945159461594715948159491595015951159521595315954159551595615957159581595915960159611596215963159641596515966159671596815969159701597115972159731597415975159761597715978159791598015981159821598315984159851598615987159881598915990159911599215993159941599515996159971599815999160001600116002160031600416005160061600716008160091601016011160121601316014160151601616017160181601916020160211602216023160241602516026160271602816029160301603116032160331603416035160361603716038160391604016041160421604316044160451604616047160481604916050160511605216053160541605516056160571605816059160601606116062160631606416065160661606716068160691607016071160721607316074160751607616077160781607916080160811608216083160841608516086160871608816089160901609116092160931609416095160961609716098160991610016101161021610316104161051610616107161081610916110161111611216113161141611516116161171611816119161201612116122161231612416125161261612716128161291613016131161321613316134161351613616137161381613916140161411614216143161441614516146161471614816149161501615116152161531615416155161561615716158161591616016161161621616316164161651616616167161681616916170161711617216173161741617516176161771617816179161801618116182161831618416185161861618716188161891619016191161921619316194161951619616197161981619916200162011620216203162041620516206162071620816209162101621116212162131621416215162161621716218162191622016221162221622316224162251622616227162281622916230162311623216233162341623516236162371623816239162401624116242162431624416245162461624716248162491625016251162521625316254162551625616257162581625916260162611626216263162641626516266162671626816269162701627116272162731627416275162761627716278162791628016281162821628316284162851628616287162881628916290162911629216293162941629516296162971629816299163001630116302163031630416305163061630716308163091631016311163121631316314163151631616317163181631916320163211632216323163241632516326163271632816329163301633116332163331633416335163361633716338163391634016341163421634316344163451634616347163481634916350163511635216353163541635516356163571635816359163601636116362163631636416365163661636716368163691637016371163721637316374163751637616377163781637916380163811638216383163841638516386163871638816389163901639116392163931639416395163961639716398163991640016401164021640316404164051640616407164081640916410164111641216413164141641516416164171641816419164201642116422164231642416425164261642716428164291643016431164321643316434164351643616437164381643916440164411644216443164441644516446164471644816449164501645116452164531645416455164561645716458164591646016461164621646316464164651646616467164681646916470164711647216473164741647516476164771647816479164801648116482164831648416485164861648716488164891649016491164921649316494164951649616497164981649916500165011650216503165041650516506165071650816509165101651116512165131651416515165161651716518165191652016521165221652316524165251652616527165281652916530165311653216533165341653516536165371653816539165401654116542165431654416545165461654716548165491655016551165521655316554165551655616557165581655916560165611656216563165641656516566165671656816569165701657116572165731657416575165761657716578165791658016581165821658316584165851658616587165881658916590165911659216593165941659516596165971659816599166001660116602166031660416605166061660716608166091661016611166121661316614166151661616617166181661916620166211662216623166241662516626166271662816629166301663116632166331663416635166361663716638166391664016641166421664316644166451664616647166481664916650166511665216653166541665516656166571665816659166601666116662166631666416665166661666716668166691667016671166721667316674166751667616677166781667916680166811668216683166841668516686166871668816689166901669116692166931669416695166961669716698166991670016701167021670316704167051670616707167081670916710167111671216713167141671516716167171671816719167201672116722167231672416725167261672716728167291673016731167321673316734167351673616737167381673916740167411674216743167441674516746167471674816749167501675116752167531675416755167561675716758167591676016761167621676316764167651676616767167681676916770167711677216773167741677516776167771677816779167801678116782167831678416785167861678716788167891679016791167921679316794167951679616797167981679916800168011680216803168041680516806168071680816809168101681116812168131681416815168161681716818168191682016821168221682316824168251682616827168281682916830168311683216833168341683516836168371683816839168401684116842168431684416845168461684716848168491685016851168521685316854168551685616857168581685916860168611686216863168641686516866168671686816869168701687116872168731687416875168761687716878168791688016881168821688316884168851688616887168881688916890168911689216893168941689516896168971689816899169001690116902169031690416905169061690716908169091691016911169121691316914169151691616917169181691916920169211692216923169241692516926169271692816929169301693116932169331693416935169361693716938169391694016941169421694316944169451694616947169481694916950169511695216953169541695516956169571695816959169601696116962169631696416965169661696716968169691697016971169721697316974169751697616977169781697916980169811698216983169841698516986169871698816989169901699116992169931699416995169961699716998169991700017001170021700317004170051700617007170081700917010170111701217013170141701517016170171701817019170201702117022170231702417025170261702717028170291703017031170321703317034170351703617037170381703917040170411704217043170441704517046170471704817049170501705117052170531705417055170561705717058170591706017061170621706317064170651706617067170681706917070170711707217073170741707517076170771707817079170801708117082170831708417085170861708717088170891709017091170921709317094170951709617097170981709917100171011710217103171041710517106171071710817109171101711117112171131711417115171161711717118171191712017121171221712317124171251712617127171281712917130171311713217133171341713517136171371713817139171401714117142171431714417145171461714717148171491715017151171521715317154171551715617157171581715917160171611716217163171641716517166171671716817169171701717117172171731717417175171761717717178171791718017181171821718317184171851718617187171881718917190171911719217193171941719517196171971719817199172001720117202172031720417205172061720717208172091721017211172121721317214172151721617217172181721917220172211722217223172241722517226172271722817229172301723117232172331723417235172361723717238172391724017241172421724317244172451724617247172481724917250172511725217253172541725517256172571725817259172601726117262172631726417265172661726717268172691727017271172721727317274172751727617277172781727917280172811728217283172841728517286172871728817289172901729117292172931729417295172961729717298172991730017301173021730317304173051730617307173081730917310173111731217313173141731517316173171731817319173201732117322173231732417325173261732717328173291733017331173321733317334173351733617337173381733917340173411734217343173441734517346173471734817349173501735117352173531735417355173561735717358173591736017361173621736317364173651736617367173681736917370173711737217373173741737517376173771737817379173801738117382173831738417385173861738717388173891739017391173921739317394173951739617397173981739917400174011740217403174041740517406174071740817409174101741117412174131741417415174161741717418174191742017421174221742317424174251742617427174281742917430174311743217433174341743517436174371743817439174401744117442174431744417445174461744717448174491745017451174521745317454174551745617457174581745917460174611746217463174641746517466174671746817469174701747117472174731747417475174761747717478174791748017481174821748317484174851748617487174881748917490174911749217493174941749517496174971749817499175001750117502175031750417505175061750717508175091751017511175121751317514175151751617517175181751917520175211752217523175241752517526175271752817529175301753117532175331753417535175361753717538175391754017541175421754317544175451754617547175481754917550175511755217553175541755517556175571755817559175601756117562175631756417565175661756717568175691757017571175721757317574175751757617577175781757917580175811758217583175841758517586175871758817589175901759117592175931759417595175961759717598175991760017601176021760317604176051760617607176081760917610176111761217613176141761517616176171761817619176201762117622176231762417625176261762717628176291763017631176321763317634176351763617637176381763917640176411764217643176441764517646176471764817649176501765117652176531765417655176561765717658176591766017661176621766317664176651766617667176681766917670176711767217673176741767517676176771767817679176801768117682176831768417685176861768717688176891769017691176921769317694176951769617697176981769917700177011770217703177041770517706177071770817709177101771117712177131771417715177161771717718177191772017721177221772317724177251772617727177281772917730177311773217733177341773517736177371773817739177401774117742177431774417745177461774717748177491775017751177521775317754177551775617757177581775917760177611776217763177641776517766177671776817769177701777117772177731777417775177761777717778177791778017781177821778317784177851778617787177881778917790177911779217793177941779517796177971779817799178001780117802178031780417805178061780717808178091781017811178121781317814178151781617817178181781917820178211782217823178241782517826178271782817829178301783117832178331783417835178361783717838178391784017841178421784317844178451784617847178481784917850178511785217853178541785517856178571785817859178601786117862178631786417865178661786717868178691787017871178721787317874178751787617877178781787917880178811788217883178841788517886178871788817889178901789117892178931789417895178961789717898178991790017901179021790317904179051790617907179081790917910179111791217913179141791517916179171791817919179201792117922179231792417925179261792717928179291793017931179321793317934179351793617937179381793917940179411794217943179441794517946179471794817949179501795117952179531795417955179561795717958179591796017961179621796317964179651796617967179681796917970179711797217973179741797517976179771797817979179801798117982179831798417985179861798717988179891799017991179921799317994179951799617997179981799918000180011800218003180041800518006180071800818009180101801118012180131801418015180161801718018180191802018021180221802318024180251802618027180281802918030180311803218033180341803518036180371803818039180401804118042180431804418045180461804718048180491805018051180521805318054180551805618057180581805918060180611806218063180641806518066180671806818069180701807118072180731807418075180761807718078180791808018081180821808318084180851808618087180881808918090180911809218093180941809518096180971809818099181001810118102181031810418105181061810718108181091811018111181121811318114181151811618117181181811918120181211812218123181241812518126181271812818129181301813118132181331813418135181361813718138181391814018141181421814318144181451814618147181481814918150181511815218153181541815518156181571815818159181601816118162181631816418165181661816718168181691817018171181721817318174181751817618177181781817918180181811818218183181841818518186181871818818189181901819118192181931819418195181961819718198181991820018201182021820318204182051820618207182081820918210182111821218213182141821518216182171821818219182201822118222182231822418225182261822718228182291823018231182321823318234182351823618237182381823918240182411824218243182441824518246182471824818249182501825118252182531825418255182561825718258182591826018261182621826318264182651826618267182681826918270182711827218273182741827518276182771827818279182801828118282182831828418285182861828718288182891829018291182921829318294182951829618297182981829918300183011830218303183041830518306183071830818309183101831118312183131831418315183161831718318183191832018321183221832318324183251832618327183281832918330183311833218333183341833518336183371833818339183401834118342183431834418345183461834718348183491835018351183521835318354183551835618357183581835918360183611836218363183641836518366183671836818369183701837118372183731837418375183761837718378183791838018381183821838318384183851838618387183881838918390183911839218393183941839518396183971839818399184001840118402184031840418405184061840718408184091841018411184121841318414184151841618417184181841918420184211842218423184241842518426184271842818429184301843118432184331843418435184361843718438184391844018441184421844318444184451844618447184481844918450184511845218453184541845518456184571845818459184601846118462184631846418465184661846718468184691847018471184721847318474184751847618477184781847918480184811848218483184841848518486184871848818489184901849118492184931849418495184961849718498184991850018501185021850318504185051850618507185081850918510185111851218513185141851518516185171851818519185201852118522185231852418525185261852718528185291853018531185321853318534185351853618537185381853918540185411854218543185441854518546185471854818549185501855118552185531855418555185561855718558185591856018561185621856318564185651856618567185681856918570185711857218573185741857518576185771857818579185801858118582185831858418585185861858718588185891859018591185921859318594185951859618597185981859918600186011860218603186041860518606186071860818609186101861118612186131861418615186161861718618186191862018621186221862318624186251862618627186281862918630186311863218633186341863518636186371863818639186401864118642186431864418645186461864718648186491865018651186521865318654186551865618657186581865918660186611866218663186641866518666186671866818669186701867118672186731867418675186761867718678186791868018681186821868318684186851868618687186881868918690186911869218693186941869518696186971869818699187001870118702187031870418705187061870718708187091871018711187121871318714187151871618717187181871918720187211872218723187241872518726187271872818729187301873118732187331873418735187361873718738187391874018741187421874318744187451874618747187481874918750187511875218753187541875518756187571875818759187601876118762187631876418765187661876718768187691877018771187721877318774187751877618777187781877918780187811878218783187841878518786187871878818789187901879118792187931879418795187961879718798187991880018801188021880318804188051880618807188081880918810188111881218813188141881518816188171881818819188201882118822188231882418825188261882718828188291883018831188321883318834188351883618837188381883918840188411884218843188441884518846188471884818849188501885118852188531885418855188561885718858188591886018861188621886318864188651886618867188681886918870188711887218873188741887518876188771887818879188801888118882188831888418885188861888718888188891889018891188921889318894188951889618897188981889918900189011890218903189041890518906189071890818909189101891118912189131891418915189161891718918189191892018921189221892318924189251892618927189281892918930189311893218933189341893518936189371893818939189401894118942189431894418945189461894718948189491895018951189521895318954189551895618957189581895918960189611896218963189641896518966189671896818969189701897118972189731897418975189761897718978189791898018981189821898318984189851898618987189881898918990189911899218993189941899518996189971899818999190001900119002190031900419005190061900719008190091901019011190121901319014190151901619017190181901919020190211902219023190241902519026190271902819029190301903119032190331903419035190361903719038190391904019041190421904319044190451904619047190481904919050190511905219053190541905519056190571905819059190601906119062190631906419065190661906719068190691907019071190721907319074190751907619077190781907919080190811908219083190841908519086190871908819089190901909119092190931909419095190961909719098190991910019101191021910319104191051910619107191081910919110191111911219113191141911519116191171911819119191201912119122191231912419125191261912719128191291913019131191321913319134191351913619137191381913919140191411914219143191441914519146191471914819149191501915119152191531915419155191561915719158191591916019161191621916319164191651916619167191681916919170191711917219173191741917519176191771917819179191801918119182191831918419185191861918719188191891919019191191921919319194191951919619197191981919919200192011920219203192041920519206192071920819209192101921119212192131921419215192161921719218192191922019221192221922319224192251922619227192281922919230192311923219233192341923519236192371923819239192401924119242192431924419245192461924719248192491925019251192521925319254192551925619257192581925919260192611926219263192641926519266192671926819269192701927119272192731927419275192761927719278192791928019281192821928319284192851928619287192881928919290192911929219293192941929519296192971929819299193001930119302193031930419305193061930719308193091931019311193121931319314193151931619317193181931919320193211932219323193241932519326193271932819329193301933119332193331933419335193361933719338193391934019341193421934319344193451934619347193481934919350193511935219353193541935519356193571935819359193601936119362193631936419365193661936719368193691937019371193721937319374193751937619377193781937919380193811938219383193841938519386193871938819389193901939119392193931939419395193961939719398193991940019401194021940319404194051940619407194081940919410194111941219413194141941519416194171941819419194201942119422194231942419425194261942719428194291943019431194321943319434194351943619437194381943919440194411944219443194441944519446194471944819449194501945119452194531945419455194561945719458194591946019461194621946319464194651946619467194681946919470194711947219473194741947519476194771947819479194801948119482194831948419485194861948719488194891949019491194921949319494194951949619497194981949919500195011950219503195041950519506195071950819509195101951119512195131951419515195161951719518195191952019521195221952319524195251952619527195281952919530195311953219533195341953519536195371953819539195401954119542195431954419545195461954719548195491955019551195521955319554195551955619557195581955919560195611956219563195641956519566195671956819569195701957119572195731957419575195761957719578195791958019581195821958319584195851958619587195881958919590195911959219593195941959519596195971959819599196001960119602196031960419605196061960719608196091961019611196121961319614196151961619617196181961919620196211962219623196241962519626196271962819629196301963119632196331963419635196361963719638196391964019641196421964319644196451964619647196481964919650196511965219653196541965519656196571965819659196601966119662196631966419665196661966719668196691967019671196721967319674196751967619677196781967919680196811968219683196841968519686196871968819689196901969119692196931969419695196961969719698196991970019701197021970319704197051970619707197081970919710197111971219713197141971519716197171971819719197201972119722197231972419725197261972719728197291973019731197321973319734197351973619737197381973919740197411974219743197441974519746197471974819749197501975119752197531975419755197561975719758197591976019761197621976319764197651976619767197681976919770197711977219773197741977519776197771977819779197801978119782197831978419785197861978719788197891979019791197921979319794197951979619797197981979919800198011980219803198041980519806198071980819809198101981119812198131981419815198161981719818198191982019821198221982319824198251982619827198281982919830198311983219833198341983519836198371983819839198401984119842198431984419845198461984719848198491985019851198521985319854198551985619857198581985919860198611986219863198641986519866198671986819869198701987119872198731987419875198761987719878198791988019881198821988319884198851988619887198881988919890198911989219893198941989519896198971989819899199001990119902199031990419905199061990719908199091991019911199121991319914199151991619917199181991919920199211992219923199241992519926199271992819929199301993119932199331993419935199361993719938199391994019941199421994319944199451994619947199481994919950199511995219953199541995519956199571995819959199601996119962199631996419965199661996719968199691997019971199721997319974199751997619977199781997919980199811998219983199841998519986199871998819989199901999119992199931999419995199961999719998199992000020001200022000320004200052000620007200082000920010200112001220013200142001520016200172001820019200202002120022200232002420025200262002720028200292003020031200322003320034200352003620037200382003920040200412004220043200442004520046200472004820049200502005120052200532005420055200562005720058200592006020061200622006320064200652006620067200682006920070200712007220073200742007520076200772007820079200802008120082200832008420085200862008720088200892009020091200922009320094200952009620097200982009920100201012010220103201042010520106201072010820109201102011120112201132011420115201162011720118201192012020121201222012320124201252012620127201282012920130201312013220133201342013520136201372013820139201402014120142201432014420145201462014720148201492015020151201522015320154201552015620157201582015920160201612016220163201642016520166201672016820169201702017120172201732017420175201762017720178201792018020181201822018320184201852018620187201882018920190201912019220193201942019520196201972019820199202002020120202202032020420205202062020720208202092021020211202122021320214202152021620217202182021920220202212022220223202242022520226202272022820229202302023120232202332023420235202362023720238202392024020241202422024320244202452024620247202482024920250202512025220253202542025520256202572025820259202602026120262202632026420265202662026720268202692027020271202722027320274202752027620277202782027920280202812028220283202842028520286202872028820289202902029120292202932029420295202962029720298202992030020301203022030320304203052030620307203082030920310203112031220313203142031520316203172031820319203202032120322203232032420325203262032720328203292033020331203322033320334203352033620337203382033920340203412034220343203442034520346203472034820349203502035120352203532035420355203562035720358203592036020361203622036320364203652036620367203682036920370203712037220373203742037520376203772037820379203802038120382203832038420385203862038720388203892039020391203922039320394203952039620397203982039920400204012040220403204042040520406204072040820409204102041120412204132041420415204162041720418204192042020421204222042320424204252042620427204282042920430204312043220433204342043520436204372043820439204402044120442204432044420445204462044720448204492045020451204522045320454204552045620457204582045920460204612046220463204642046520466204672046820469204702047120472204732047420475204762047720478204792048020481204822048320484204852048620487204882048920490204912049220493204942049520496204972049820499205002050120502205032050420505205062050720508205092051020511205122051320514205152051620517205182051920520205212052220523205242052520526205272052820529205302053120532205332053420535205362053720538205392054020541205422054320544205452054620547205482054920550205512055220553205542055520556205572055820559205602056120562205632056420565205662056720568205692057020571205722057320574205752057620577205782057920580205812058220583205842058520586205872058820589205902059120592205932059420595205962059720598205992060020601206022060320604206052060620607206082060920610206112061220613206142061520616206172061820619206202062120622206232062420625206262062720628206292063020631206322063320634206352063620637206382063920640206412064220643206442064520646206472064820649206502065120652206532065420655206562065720658206592066020661206622066320664206652066620667206682066920670206712067220673206742067520676206772067820679206802068120682206832068420685206862068720688206892069020691206922069320694206952069620697206982069920700207012070220703207042070520706207072070820709207102071120712207132071420715207162071720718207192072020721207222072320724207252072620727207282072920730207312073220733207342073520736207372073820739207402074120742207432074420745207462074720748207492075020751207522075320754207552075620757207582075920760207612076220763207642076520766207672076820769207702077120772207732077420775207762077720778207792078020781207822078320784207852078620787207882078920790207912079220793207942079520796207972079820799208002080120802208032080420805208062080720808208092081020811208122081320814208152081620817208182081920820208212082220823208242082520826208272082820829208302083120832208332083420835208362083720838208392084020841208422084320844208452084620847208482084920850208512085220853208542085520856208572085820859208602086120862208632086420865208662086720868208692087020871208722087320874208752087620877208782087920880208812088220883208842088520886208872088820889208902089120892208932089420895208962089720898208992090020901209022090320904209052090620907209082090920910209112091220913209142091520916209172091820919209202092120922209232092420925209262092720928209292093020931209322093320934209352093620937209382093920940209412094220943209442094520946209472094820949209502095120952209532095420955209562095720958209592096020961209622096320964209652096620967209682096920970209712097220973209742097520976209772097820979209802098120982209832098420985209862098720988209892099020991209922099320994209952099620997209982099921000210012100221003210042100521006210072100821009210102101121012210132101421015210162101721018210192102021021210222102321024210252102621027210282102921030210312103221033210342103521036210372103821039210402104121042210432104421045210462104721048210492105021051210522105321054210552105621057210582105921060210612106221063210642106521066210672106821069210702107121072210732107421075210762107721078210792108021081210822108321084210852108621087210882108921090210912109221093210942109521096210972109821099211002110121102211032110421105211062110721108211092111021111211122111321114211152111621117211182111921120211212112221123211242112521126211272112821129211302113121132211332113421135211362113721138211392114021141211422114321144211452114621147211482114921150211512115221153211542115521156211572115821159211602116121162211632116421165211662116721168211692117021171211722117321174211752117621177211782117921180211812118221183211842118521186211872118821189211902119121192211932119421195211962119721198211992120021201212022120321204212052120621207212082120921210212112121221213212142121521216212172121821219212202122121222212232122421225212262122721228212292123021231212322123321234212352123621237212382123921240212412124221243212442124521246212472124821249212502125121252212532125421255212562125721258212592126021261212622126321264212652126621267212682126921270212712127221273212742127521276212772127821279212802128121282212832128421285212862128721288212892129021291212922129321294212952129621297212982129921300213012130221303213042130521306213072130821309213102131121312213132131421315213162131721318213192132021321213222132321324213252132621327213282132921330213312133221333213342133521336213372133821339213402134121342213432134421345213462134721348213492135021351213522135321354213552135621357213582135921360213612136221363213642136521366213672136821369213702137121372213732137421375213762137721378213792138021381213822138321384213852138621387213882138921390213912139221393213942139521396213972139821399214002140121402214032140421405214062140721408214092141021411214122141321414214152141621417214182141921420214212142221423214242142521426214272142821429214302143121432214332143421435214362143721438214392144021441214422144321444214452144621447214482144921450214512145221453214542145521456214572145821459214602146121462214632146421465214662146721468214692147021471214722147321474214752147621477214782147921480214812148221483214842148521486214872148821489214902149121492214932149421495214962149721498214992150021501215022150321504215052150621507215082150921510215112151221513215142151521516215172151821519215202152121522215232152421525215262152721528215292153021531215322153321534215352153621537215382153921540215412154221543215442154521546215472154821549215502155121552215532155421555215562155721558215592156021561215622156321564215652156621567215682156921570215712157221573215742157521576215772157821579215802158121582215832158421585215862158721588215892159021591215922159321594215952159621597215982159921600216012160221603216042160521606216072160821609216102161121612216132161421615216162161721618216192162021621216222162321624216252162621627216282162921630216312163221633216342163521636216372163821639216402164121642216432164421645216462164721648216492165021651216522165321654216552165621657216582165921660216612166221663216642166521666216672166821669216702167121672216732167421675216762167721678216792168021681216822168321684216852168621687216882168921690216912169221693216942169521696216972169821699217002170121702217032170421705217062170721708217092171021711217122171321714217152171621717217182171921720217212172221723217242172521726217272172821729217302173121732217332173421735217362173721738217392174021741217422174321744217452174621747217482174921750217512175221753217542175521756217572175821759217602176121762217632176421765217662176721768217692177021771217722177321774217752177621777217782177921780217812178221783217842178521786217872178821789217902179121792217932179421795217962179721798217992180021801218022180321804218052180621807218082180921810218112181221813218142181521816218172181821819218202182121822218232182421825218262182721828218292183021831218322183321834218352183621837218382183921840218412184221843218442184521846218472184821849218502185121852218532185421855218562185721858218592186021861218622186321864218652186621867218682186921870218712187221873218742187521876218772187821879218802188121882218832188421885218862188721888218892189021891218922189321894218952189621897218982189921900219012190221903219042190521906219072190821909219102191121912219132191421915219162191721918219192192021921219222192321924219252192621927219282192921930219312193221933219342193521936219372193821939219402194121942219432194421945219462194721948219492195021951219522195321954219552195621957219582195921960219612196221963219642196521966219672196821969219702197121972219732197421975219762197721978219792198021981219822198321984219852198621987219882198921990219912199221993219942199521996219972199821999220002200122002220032200422005220062200722008220092201022011220122201322014220152201622017220182201922020220212202222023220242202522026220272202822029220302203122032220332203422035220362203722038220392204022041220422204322044220452204622047220482204922050220512205222053220542205522056220572205822059220602206122062220632206422065220662206722068220692207022071220722207322074220752207622077220782207922080220812208222083220842208522086220872208822089220902209122092220932209422095220962209722098220992210022101221022210322104221052210622107221082210922110221112211222113221142211522116221172211822119221202212122122221232212422125221262212722128221292213022131221322213322134221352213622137221382213922140221412214222143221442214522146221472214822149221502215122152221532215422155221562215722158221592216022161221622216322164221652216622167221682216922170221712217222173221742217522176221772217822179221802218122182221832218422185221862218722188221892219022191221922219322194221952219622197221982219922200222012220222203222042220522206222072220822209222102221122212222132221422215222162221722218222192222022221222222222322224222252222622227222282222922230222312223222233222342223522236222372223822239222402224122242222432224422245222462224722248222492225022251222522225322254222552225622257222582225922260222612226222263222642226522266222672226822269222702227122272222732227422275222762227722278222792228022281222822228322284222852228622287222882228922290222912229222293222942229522296222972229822299223002230122302223032230422305223062230722308223092231022311223122231322314223152231622317223182231922320223212232222323223242232522326223272232822329223302233122332223332233422335223362233722338223392234022341223422234322344223452234622347223482234922350223512235222353223542235522356223572235822359223602236122362223632236422365223662236722368223692237022371223722237322374223752237622377223782237922380223812238222383223842238522386223872238822389223902239122392223932239422395223962239722398223992240022401224022240322404224052240622407224082240922410224112241222413224142241522416224172241822419224202242122422224232242422425224262242722428224292243022431224322243322434224352243622437224382243922440224412244222443224442244522446224472244822449224502245122452224532245422455224562245722458224592246022461224622246322464224652246622467224682246922470224712247222473224742247522476224772247822479224802248122482224832248422485224862248722488224892249022491224922249322494224952249622497224982249922500225012250222503225042250522506225072250822509225102251122512225132251422515225162251722518225192252022521225222252322524225252252622527225282252922530225312253222533225342253522536225372253822539225402254122542225432254422545225462254722548225492255022551225522255322554225552255622557225582255922560225612256222563225642256522566225672256822569225702257122572225732257422575225762257722578225792258022581225822258322584225852258622587225882258922590225912259222593225942259522596225972259822599226002260122602226032260422605226062260722608226092261022611226122261322614226152261622617226182261922620226212262222623226242262522626226272262822629226302263122632226332263422635226362263722638226392264022641226422264322644226452264622647226482264922650226512265222653226542265522656226572265822659226602266122662226632266422665226662266722668226692267022671226722267322674226752267622677226782267922680226812268222683226842268522686226872268822689226902269122692226932269422695226962269722698226992270022701227022270322704227052270622707227082270922710227112271222713227142271522716227172271822719227202272122722227232272422725227262272722728227292273022731227322273322734227352273622737227382273922740227412274222743227442274522746227472274822749227502275122752227532275422755227562275722758227592276022761227622276322764227652276622767227682276922770227712277222773227742277522776227772277822779227802278122782227832278422785227862278722788227892279022791227922279322794227952279622797227982279922800228012280222803228042280522806228072280822809228102281122812228132281422815228162281722818228192282022821228222282322824228252282622827228282282922830228312283222833228342283522836228372283822839228402284122842228432284422845228462284722848228492285022851228522285322854228552285622857228582285922860228612286222863228642286522866228672286822869228702287122872228732287422875228762287722878228792288022881228822288322884228852288622887228882288922890228912289222893228942289522896228972289822899229002290122902229032290422905229062290722908229092291022911229122291322914229152291622917229182291922920229212292222923229242292522926229272292822929229302293122932229332293422935229362293722938229392294022941229422294322944229452294622947229482294922950229512295222953229542295522956229572295822959229602296122962229632296422965229662296722968229692297022971229722297322974229752297622977229782297922980229812298222983229842298522986229872298822989229902299122992229932299422995229962299722998229992300023001230022300323004230052300623007230082300923010230112301223013230142301523016230172301823019230202302123022230232302423025230262302723028230292303023031230322303323034230352303623037230382303923040230412304223043230442304523046230472304823049230502305123052230532305423055230562305723058230592306023061230622306323064230652306623067230682306923070230712307223073230742307523076230772307823079230802308123082230832308423085230862308723088230892309023091230922309323094230952309623097230982309923100231012310223103231042310523106231072310823109231102311123112231132311423115231162311723118231192312023121231222312323124231252312623127231282312923130231312313223133231342313523136231372313823139231402314123142231432314423145231462314723148231492315023151231522315323154231552315623157231582315923160231612316223163231642316523166231672316823169231702317123172231732317423175231762317723178231792318023181231822318323184231852318623187231882318923190231912319223193231942319523196231972319823199232002320123202232032320423205232062320723208232092321023211232122321323214232152321623217232182321923220232212322223223232242322523226232272322823229232302323123232232332323423235232362323723238232392324023241232422324323244232452324623247232482324923250232512325223253232542325523256232572325823259232602326123262232632326423265232662326723268232692327023271232722327323274232752327623277232782327923280232812328223283232842328523286232872328823289232902329123292232932329423295232962329723298232992330023301233022330323304233052330623307233082330923310233112331223313233142331523316233172331823319233202332123322233232332423325233262332723328233292333023331233322333323334233352333623337233382333923340233412334223343233442334523346233472334823349233502335123352233532335423355233562335723358233592336023361233622336323364233652336623367233682336923370233712337223373233742337523376233772337823379233802338123382233832338423385233862338723388233892339023391233922339323394233952339623397233982339923400234012340223403234042340523406234072340823409234102341123412234132341423415234162341723418234192342023421234222342323424234252342623427234282342923430234312343223433234342343523436234372343823439234402344123442234432344423445234462344723448234492345023451234522345323454234552345623457234582345923460234612346223463234642346523466234672346823469234702347123472234732347423475234762347723478234792348023481234822348323484234852348623487234882348923490234912349223493234942349523496234972349823499235002350123502235032350423505235062350723508235092351023511235122351323514235152351623517235182351923520235212352223523235242352523526235272352823529235302353123532235332353423535235362353723538235392354023541235422354323544235452354623547235482354923550235512355223553235542355523556235572355823559235602356123562235632356423565235662356723568235692357023571235722357323574235752357623577235782357923580235812358223583235842358523586235872358823589235902359123592235932359423595235962359723598235992360023601236022360323604236052360623607236082360923610236112361223613236142361523616236172361823619236202362123622236232362423625236262362723628236292363023631236322363323634236352363623637236382363923640236412364223643236442364523646236472364823649236502365123652236532365423655236562365723658236592366023661236622366323664236652366623667236682366923670236712367223673236742367523676236772367823679236802368123682236832368423685236862368723688236892369023691236922369323694236952369623697236982369923700237012370223703237042370523706237072370823709237102371123712237132371423715237162371723718237192372023721237222372323724237252372623727237282372923730237312373223733237342373523736237372373823739237402374123742237432374423745237462374723748237492375023751237522375323754237552375623757237582375923760237612376223763237642376523766237672376823769237702377123772237732377423775237762377723778237792378023781237822378323784237852378623787237882378923790237912379223793237942379523796237972379823799238002380123802238032380423805238062380723808238092381023811238122381323814238152381623817238182381923820238212382223823238242382523826238272382823829238302383123832238332383423835238362383723838238392384023841238422384323844238452384623847238482384923850238512385223853238542385523856238572385823859238602386123862238632386423865238662386723868238692387023871238722387323874238752387623877238782387923880238812388223883238842388523886238872388823889238902389123892238932389423895238962389723898238992390023901239022390323904239052390623907239082390923910239112391223913239142391523916239172391823919239202392123922239232392423925239262392723928239292393023931239322393323934239352393623937239382393923940239412394223943239442394523946239472394823949239502395123952239532395423955239562395723958239592396023961239622396323964239652396623967239682396923970239712397223973239742397523976239772397823979239802398123982239832398423985239862398723988239892399023991239922399323994239952399623997239982399924000240012400224003240042400524006240072400824009240102401124012240132401424015240162401724018240192402024021240222402324024240252402624027240282402924030240312403224033240342403524036240372403824039240402404124042240432404424045240462404724048240492405024051240522405324054240552405624057240582405924060240612406224063240642406524066240672406824069240702407124072240732407424075240762407724078240792408024081240822408324084240852408624087240882408924090240912409224093240942409524096240972409824099241002410124102241032410424105241062410724108241092411024111241122411324114241152411624117241182411924120241212412224123241242412524126241272412824129241302413124132241332413424135241362413724138241392414024141241422414324144241452414624147241482414924150241512415224153241542415524156241572415824159241602416124162241632416424165241662416724168241692417024171241722417324174241752417624177241782417924180241812418224183241842418524186241872418824189241902419124192241932419424195241962419724198241992420024201242022420324204242052420624207242082420924210242112421224213242142421524216242172421824219242202422124222242232422424225242262422724228242292423024231242322423324234242352423624237242382423924240242412424224243242442424524246242472424824249242502425124252242532425424255242562425724258242592426024261242622426324264242652426624267242682426924270242712427224273242742427524276242772427824279242802428124282242832428424285242862428724288242892429024291242922429324294242952429624297242982429924300243012430224303243042430524306243072430824309243102431124312243132431424315243162431724318243192432024321243222432324324243252432624327243282432924330243312433224333243342433524336243372433824339243402434124342243432434424345243462434724348243492435024351243522435324354243552435624357243582435924360243612436224363243642436524366243672436824369243702437124372243732437424375243762437724378243792438024381243822438324384243852438624387243882438924390243912439224393243942439524396243972439824399244002440124402244032440424405244062440724408244092441024411244122441324414244152441624417244182441924420244212442224423244242442524426244272442824429244302443124432244332443424435244362443724438244392444024441244422444324444244452444624447244482444924450244512445224453244542445524456244572445824459244602446124462244632446424465244662446724468244692447024471244722447324474244752447624477244782447924480244812448224483244842448524486244872448824489244902449124492244932449424495244962449724498244992450024501245022450324504245052450624507245082450924510245112451224513245142451524516245172451824519245202452124522245232452424525245262452724528245292453024531245322453324534245352453624537245382453924540245412454224543245442454524546245472454824549245502455124552245532455424555245562455724558245592456024561245622456324564245652456624567245682456924570245712457224573245742457524576245772457824579245802458124582245832458424585245862458724588245892459024591245922459324594245952459624597245982459924600246012460224603246042460524606246072460824609246102461124612246132461424615246162461724618246192462024621246222462324624246252462624627246282462924630246312463224633246342463524636246372463824639246402464124642246432464424645246462464724648246492465024651246522465324654246552465624657246582465924660246612466224663246642466524666246672466824669246702467124672246732467424675246762467724678246792468024681246822468324684246852468624687246882468924690246912469224693246942469524696246972469824699247002470124702247032470424705247062470724708247092471024711247122471324714247152471624717247182471924720247212472224723247242472524726247272472824729247302473124732247332473424735247362473724738247392474024741247422474324744247452474624747247482474924750247512475224753247542475524756247572475824759247602476124762247632476424765247662476724768247692477024771247722477324774247752477624777247782477924780247812478224783247842478524786247872478824789247902479124792247932479424795247962479724798247992480024801248022480324804248052480624807248082480924810248112481224813248142481524816248172481824819248202482124822248232482424825248262482724828248292483024831248322483324834248352483624837248382483924840248412484224843248442484524846248472484824849248502485124852248532485424855248562485724858248592486024861248622486324864248652486624867248682486924870248712487224873248742487524876248772487824879248802488124882248832488424885248862488724888248892489024891248922489324894248952489624897248982489924900249012490224903249042490524906249072490824909249102491124912249132491424915249162491724918249192492024921249222492324924249252492624927249282492924930249312493224933249342493524936249372493824939249402494124942249432494424945249462494724948249492495024951249522495324954249552495624957249582495924960249612496224963249642496524966249672496824969249702497124972249732497424975249762497724978249792498024981249822498324984249852498624987249882498924990249912499224993249942499524996249972499824999250002500125002250032500425005250062500725008250092501025011250122501325014250152501625017250182501925020250212502225023250242502525026250272502825029250302503125032250332503425035250362503725038250392504025041250422504325044250452504625047250482504925050250512505225053250542505525056250572505825059250602506125062250632506425065250662506725068250692507025071250722507325074250752507625077250782507925080250812508225083250842508525086250872508825089250902509125092250932509425095250962509725098250992510025101251022510325104251052510625107251082510925110251112511225113251142511525116251172511825119251202512125122251232512425125251262512725128251292513025131251322513325134251352513625137251382513925140251412514225143251442514525146251472514825149251502515125152251532515425155251562515725158251592516025161251622516325164251652516625167251682516925170251712517225173251742517525176251772517825179251802518125182251832518425185251862518725188251892519025191251922519325194251952519625197251982519925200252012520225203252042520525206252072520825209252102521125212252132521425215252162521725218252192522025221252222522325224252252522625227252282522925230252312523225233252342523525236252372523825239252402524125242252432524425245252462524725248252492525025251252522525325254252552525625257252582525925260252612526225263252642526525266252672526825269252702527125272252732527425275252762527725278252792528025281252822528325284252852528625287252882528925290252912529225293252942529525296252972529825299253002530125302253032530425305253062530725308253092531025311253122531325314253152531625317253182531925320253212532225323253242532525326253272532825329253302533125332253332533425335253362533725338253392534025341253422534325344253452534625347253482534925350253512535225353253542535525356253572535825359253602536125362253632536425365253662536725368253692537025371253722537325374253752537625377253782537925380253812538225383253842538525386253872538825389253902539125392253932539425395253962539725398253992540025401254022540325404254052540625407254082540925410254112541225413254142541525416254172541825419254202542125422254232542425425254262542725428254292543025431254322543325434254352543625437254382543925440254412544225443254442544525446254472544825449254502545125452254532545425455254562545725458254592546025461254622546325464254652546625467254682546925470254712547225473254742547525476254772547825479254802548125482254832548425485254862548725488254892549025491254922549325494254952549625497254982549925500255012550225503255042550525506255072550825509255102551125512255132551425515255162551725518255192552025521255222552325524255252552625527255282552925530255312553225533255342553525536255372553825539255402554125542255432554425545255462554725548255492555025551255522555325554255552555625557255582555925560255612556225563255642556525566255672556825569255702557125572255732557425575255762557725578255792558025581255822558325584255852558625587255882558925590255912559225593255942559525596255972559825599256002560125602256032560425605256062560725608256092561025611256122561325614256152561625617256182561925620256212562225623256242562525626256272562825629256302563125632256332563425635256362563725638256392564025641256422564325644256452564625647256482564925650256512565225653256542565525656256572565825659256602566125662256632566425665256662566725668256692567025671256722567325674256752567625677256782567925680256812568225683256842568525686256872568825689256902569125692256932569425695256962569725698256992570025701257022570325704257052570625707257082570925710257112571225713257142571525716257172571825719257202572125722257232572425725257262572725728257292573025731257322573325734257352573625737257382573925740257412574225743257442574525746257472574825749257502575125752257532575425755257562575725758257592576025761257622576325764257652576625767257682576925770257712577225773257742577525776257772577825779257802578125782257832578425785257862578725788257892579025791257922579325794257952579625797257982579925800258012580225803258042580525806258072580825809258102581125812258132581425815258162581725818258192582025821258222582325824258252582625827258282582925830258312583225833258342583525836258372583825839258402584125842258432584425845258462584725848258492585025851258522585325854258552585625857258582585925860258612586225863258642586525866258672586825869258702587125872258732587425875258762587725878258792588025881258822588325884258852588625887258882588925890258912589225893258942589525896258972589825899259002590125902259032590425905259062590725908259092591025911259122591325914259152591625917259182591925920259212592225923259242592525926259272592825929259302593125932259332593425935259362593725938259392594025941259422594325944259452594625947259482594925950259512595225953259542595525956259572595825959259602596125962259632596425965259662596725968259692597025971259722597325974259752597625977259782597925980259812598225983259842598525986259872598825989259902599125992259932599425995259962599725998259992600026001260022600326004260052600626007260082600926010260112601226013260142601526016260172601826019260202602126022260232602426025260262602726028260292603026031260322603326034260352603626037260382603926040260412604226043260442604526046260472604826049260502605126052260532605426055260562605726058260592606026061260622606326064260652606626067260682606926070260712607226073260742607526076260772607826079260802608126082260832608426085260862608726088260892609026091260922609326094260952609626097260982609926100261012610226103261042610526106261072610826109261102611126112261132611426115261162611726118261192612026121261222612326124261252612626127261282612926130261312613226133261342613526136261372613826139261402614126142261432614426145261462614726148261492615026151261522615326154261552615626157261582615926160261612616226163261642616526166261672616826169261702617126172261732617426175261762617726178261792618026181261822618326184261852618626187261882618926190261912619226193261942619526196261972619826199262002620126202262032620426205262062620726208262092621026211262122621326214262152621626217262182621926220262212622226223262242622526226262272622826229262302623126232262332623426235262362623726238262392624026241262422624326244262452624626247262482624926250262512625226253262542625526256262572625826259262602626126262262632626426265262662626726268262692627026271262722627326274262752627626277262782627926280262812628226283262842628526286262872628826289262902629126292262932629426295262962629726298262992630026301263022630326304263052630626307263082630926310263112631226313263142631526316263172631826319263202632126322263232632426325263262632726328263292633026331263322633326334263352633626337263382633926340263412634226343263442634526346263472634826349263502635126352263532635426355263562635726358263592636026361263622636326364263652636626367263682636926370263712637226373263742637526376263772637826379263802638126382263832638426385263862638726388263892639026391263922639326394263952639626397263982639926400264012640226403264042640526406264072640826409264102641126412264132641426415264162641726418264192642026421264222642326424264252642626427264282642926430264312643226433264342643526436264372643826439264402644126442264432644426445264462644726448264492645026451264522645326454264552645626457264582645926460264612646226463264642646526466264672646826469264702647126472264732647426475264762647726478264792648026481264822648326484264852648626487264882648926490264912649226493264942649526496264972649826499265002650126502265032650426505265062650726508265092651026511265122651326514265152651626517265182651926520265212652226523265242652526526265272652826529265302653126532265332653426535265362653726538265392654026541265422654326544265452654626547265482654926550265512655226553265542655526556265572655826559265602656126562265632656426565265662656726568265692657026571265722657326574265752657626577265782657926580265812658226583265842658526586265872658826589265902659126592265932659426595265962659726598265992660026601266022660326604266052660626607266082660926610266112661226613266142661526616266172661826619266202662126622266232662426625266262662726628266292663026631266322663326634266352663626637266382663926640266412664226643266442664526646266472664826649266502665126652266532665426655266562665726658266592666026661266622666326664266652666626667266682666926670266712667226673266742667526676266772667826679266802668126682266832668426685266862668726688266892669026691266922669326694266952669626697266982669926700267012670226703267042670526706267072670826709267102671126712267132671426715267162671726718267192672026721267222672326724267252672626727267282672926730267312673226733267342673526736267372673826739267402674126742267432674426745267462674726748267492675026751267522675326754267552675626757267582675926760267612676226763267642676526766267672676826769267702677126772267732677426775267762677726778267792678026781267822678326784267852678626787267882678926790267912679226793267942679526796267972679826799268002680126802268032680426805268062680726808268092681026811268122681326814268152681626817268182681926820268212682226823268242682526826268272682826829268302683126832268332683426835268362683726838268392684026841268422684326844268452684626847268482684926850268512685226853268542685526856268572685826859268602686126862268632686426865268662686726868268692687026871268722687326874268752687626877268782687926880268812688226883268842688526886268872688826889268902689126892268932689426895268962689726898268992690026901269022690326904269052690626907269082690926910269112691226913269142691526916269172691826919269202692126922269232692426925269262692726928269292693026931269322693326934269352693626937269382693926940269412694226943269442694526946269472694826949269502695126952269532695426955269562695726958269592696026961269622696326964269652696626967269682696926970269712697226973269742697526976269772697826979269802698126982269832698426985269862698726988269892699026991269922699326994269952699626997269982699927000270012700227003270042700527006270072700827009270102701127012270132701427015270162701727018270192702027021270222702327024270252702627027270282702927030270312703227033270342703527036270372703827039270402704127042270432704427045270462704727048270492705027051270522705327054270552705627057270582705927060270612706227063270642706527066270672706827069270702707127072270732707427075270762707727078270792708027081270822708327084270852708627087270882708927090270912709227093270942709527096270972709827099271002710127102271032710427105271062710727108271092711027111271122711327114271152711627117271182711927120271212712227123271242712527126271272712827129271302713127132271332713427135271362713727138271392714027141271422714327144271452714627147271482714927150271512715227153271542715527156271572715827159271602716127162271632716427165271662716727168271692717027171271722717327174271752717627177271782717927180271812718227183271842718527186271872718827189271902719127192271932719427195271962719727198271992720027201272022720327204272052720627207272082720927210272112721227213272142721527216272172721827219272202722127222272232722427225272262722727228272292723027231272322723327234272352723627237272382723927240272412724227243272442724527246272472724827249272502725127252272532725427255272562725727258272592726027261272622726327264272652726627267272682726927270272712727227273272742727527276272772727827279272802728127282272832728427285272862728727288272892729027291272922729327294272952729627297272982729927300273012730227303273042730527306273072730827309273102731127312273132731427315273162731727318273192732027321273222732327324273252732627327273282732927330273312733227333273342733527336273372733827339273402734127342273432734427345273462734727348273492735027351273522735327354273552735627357273582735927360273612736227363273642736527366273672736827369273702737127372273732737427375273762737727378273792738027381273822738327384273852738627387273882738927390273912739227393273942739527396273972739827399274002740127402274032740427405274062740727408274092741027411274122741327414274152741627417274182741927420274212742227423274242742527426274272742827429274302743127432274332743427435274362743727438274392744027441274422744327444274452744627447274482744927450274512745227453274542745527456274572745827459274602746127462274632746427465274662746727468274692747027471274722747327474274752747627477274782747927480274812748227483274842748527486274872748827489274902749127492274932749427495274962749727498274992750027501275022750327504275052750627507275082750927510275112751227513275142751527516275172751827519275202752127522275232752427525275262752727528275292753027531275322753327534275352753627537275382753927540275412754227543275442754527546275472754827549275502755127552275532755427555275562755727558275592756027561275622756327564275652756627567275682756927570275712757227573275742757527576275772757827579275802758127582275832758427585275862758727588275892759027591275922759327594275952759627597275982759927600276012760227603276042760527606276072760827609276102761127612276132761427615276162761727618276192762027621276222762327624276252762627627276282762927630276312763227633276342763527636276372763827639276402764127642276432764427645276462764727648276492765027651276522765327654276552765627657276582765927660276612766227663276642766527666276672766827669276702767127672276732767427675276762767727678276792768027681276822768327684276852768627687276882768927690276912769227693276942769527696276972769827699277002770127702277032770427705277062770727708277092771027711277122771327714277152771627717277182771927720277212772227723277242772527726277272772827729277302773127732277332773427735277362773727738277392774027741277422774327744277452774627747277482774927750277512775227753277542775527756277572775827759277602776127762277632776427765277662776727768277692777027771277722777327774277752777627777277782777927780277812778227783277842778527786277872778827789277902779127792277932779427795277962779727798277992780027801278022780327804278052780627807278082780927810278112781227813278142781527816278172781827819278202782127822278232782427825278262782727828278292783027831278322783327834278352783627837278382783927840278412784227843278442784527846278472784827849278502785127852278532785427855278562785727858278592786027861278622786327864278652786627867278682786927870278712787227873278742787527876278772787827879278802788127882278832788427885278862788727888278892789027891278922789327894278952789627897278982789927900279012790227903279042790527906279072790827909279102791127912279132791427915279162791727918279192792027921279222792327924279252792627927279282792927930279312793227933279342793527936279372793827939279402794127942279432794427945279462794727948279492795027951279522795327954279552795627957279582795927960279612796227963279642796527966279672796827969279702797127972279732797427975279762797727978279792798027981279822798327984279852798627987279882798927990279912799227993279942799527996279972799827999280002800128002280032800428005280062800728008280092801028011280122801328014280152801628017280182801928020280212802228023280242802528026280272802828029280302803128032280332803428035280362803728038280392804028041280422804328044280452804628047280482804928050280512805228053280542805528056280572805828059280602806128062280632806428065280662806728068280692807028071280722807328074280752807628077280782807928080280812808228083280842808528086280872808828089280902809128092280932809428095280962809728098280992810028101281022810328104281052810628107281082810928110281112811228113281142811528116281172811828119281202812128122281232812428125281262812728128281292813028131281322813328134281352813628137281382813928140281412814228143281442814528146281472814828149281502815128152281532815428155281562815728158281592816028161281622816328164281652816628167281682816928170281712817228173281742817528176281772817828179281802818128182281832818428185281862818728188281892819028191281922819328194281952819628197281982819928200282012820228203282042820528206282072820828209282102821128212282132821428215282162821728218282192822028221282222822328224282252822628227282282822928230282312823228233282342823528236282372823828239282402824128242282432824428245282462824728248282492825028251282522825328254282552825628257282582825928260282612826228263282642826528266282672826828269282702827128272282732827428275282762827728278282792828028281282822828328284282852828628287282882828928290282912829228293282942829528296282972829828299283002830128302283032830428305283062830728308283092831028311283122831328314283152831628317283182831928320283212832228323283242832528326283272832828329283302833128332283332833428335283362833728338283392834028341283422834328344283452834628347283482834928350283512835228353283542835528356283572835828359283602836128362283632836428365283662836728368283692837028371283722837328374283752837628377283782837928380283812838228383283842838528386283872838828389283902839128392283932839428395283962839728398283992840028401284022840328404284052840628407284082840928410284112841228413284142841528416284172841828419284202842128422284232842428425284262842728428284292843028431284322843328434284352843628437284382843928440284412844228443284442844528446284472844828449284502845128452284532845428455284562845728458284592846028461284622846328464284652846628467284682846928470284712847228473284742847528476284772847828479284802848128482284832848428485284862848728488284892849028491284922849328494284952849628497284982849928500285012850228503285042850528506285072850828509285102851128512285132851428515285162851728518285192852028521285222852328524285252852628527285282852928530285312853228533285342853528536285372853828539285402854128542285432854428545285462854728548285492855028551285522855328554285552855628557285582855928560285612856228563285642856528566285672856828569285702857128572285732857428575285762857728578285792858028581285822858328584285852858628587285882858928590285912859228593285942859528596285972859828599286002860128602286032860428605286062860728608286092861028611286122861328614286152861628617286182861928620286212862228623286242862528626286272862828629286302863128632286332863428635286362863728638286392864028641286422864328644286452864628647286482864928650286512865228653286542865528656286572865828659286602866128662286632866428665286662866728668286692867028671286722867328674286752867628677286782867928680286812868228683286842868528686286872868828689286902869128692286932869428695286962869728698286992870028701287022870328704287052870628707287082870928710287112871228713287142871528716287172871828719287202872128722287232872428725287262872728728287292873028731287322873328734287352873628737287382873928740287412874228743287442874528746287472874828749287502875128752287532875428755287562875728758287592876028761287622876328764287652876628767287682876928770287712877228773287742877528776287772877828779287802878128782287832878428785287862878728788287892879028791287922879328794287952879628797287982879928800288012880228803288042880528806288072880828809288102881128812288132881428815288162881728818288192882028821288222882328824288252882628827288282882928830288312883228833288342883528836288372883828839288402884128842288432884428845288462884728848288492885028851288522885328854288552885628857288582885928860288612886228863288642886528866288672886828869288702887128872288732887428875288762887728878288792888028881288822888328884288852888628887288882888928890288912889228893288942889528896288972889828899289002890128902289032890428905289062890728908289092891028911289122891328914289152891628917289182891928920289212892228923289242892528926289272892828929289302893128932289332893428935289362893728938289392894028941289422894328944289452894628947289482894928950289512895228953289542895528956289572895828959289602896128962289632896428965289662896728968289692897028971289722897328974289752897628977289782897928980289812898228983289842898528986289872898828989289902899128992289932899428995289962899728998289992900029001290022900329004290052900629007290082900929010290112901229013290142901529016290172901829019290202902129022290232902429025290262902729028290292903029031290322903329034290352903629037290382903929040290412904229043290442904529046290472904829049290502905129052290532905429055290562905729058290592906029061290622906329064290652906629067290682906929070290712907229073290742907529076290772907829079290802908129082290832908429085290862908729088290892909029091290922909329094290952909629097290982909929100291012910229103291042910529106291072910829109291102911129112291132911429115291162911729118291192912029121291222912329124291252912629127291282912929130291312913229133291342913529136291372913829139291402914129142291432914429145291462914729148291492915029151291522915329154291552915629157291582915929160291612916229163291642916529166291672916829169291702917129172291732917429175291762917729178291792918029181291822918329184291852918629187291882918929190291912919229193291942919529196291972919829199292002920129202292032920429205292062920729208292092921029211292122921329214292152921629217292182921929220292212922229223292242922529226292272922829229292302923129232292332923429235292362923729238292392924029241292422924329244292452924629247292482924929250292512925229253292542925529256292572925829259292602926129262292632926429265292662926729268292692927029271292722927329274292752927629277292782927929280292812928229283292842928529286292872928829289292902929129292292932929429295292962929729298292992930029301293022930329304293052930629307293082930929310293112931229313293142931529316293172931829319293202932129322293232932429325293262932729328293292933029331293322933329334293352933629337293382933929340293412934229343293442934529346293472934829349293502935129352293532935429355293562935729358293592936029361293622936329364293652936629367293682936929370293712937229373293742937529376293772937829379293802938129382293832938429385293862938729388293892939029391293922939329394293952939629397293982939929400294012940229403294042940529406294072940829409294102941129412294132941429415294162941729418294192942029421294222942329424294252942629427294282942929430294312943229433294342943529436294372943829439294402944129442294432944429445294462944729448294492945029451294522945329454294552945629457294582945929460294612946229463294642946529466294672946829469294702947129472294732947429475294762947729478294792948029481294822948329484294852948629487294882948929490294912949229493294942949529496294972949829499295002950129502295032950429505295062950729508295092951029511295122951329514295152951629517295182951929520295212952229523295242952529526295272952829529295302953129532295332953429535295362953729538295392954029541295422954329544295452954629547295482954929550295512955229553295542955529556295572955829559295602956129562295632956429565295662956729568295692957029571295722957329574295752957629577295782957929580295812958229583295842958529586295872958829589295902959129592295932959429595295962959729598295992960029601296022960329604296052960629607296082960929610296112961229613296142961529616296172961829619296202962129622296232962429625296262962729628296292963029631296322963329634296352963629637296382963929640296412964229643296442964529646296472964829649296502965129652296532965429655296562965729658296592966029661296622966329664296652966629667296682966929670296712967229673296742967529676296772967829679296802968129682296832968429685296862968729688296892969029691296922969329694296952969629697296982969929700297012970229703297042970529706297072970829709297102971129712297132971429715297162971729718297192972029721297222972329724297252972629727297282972929730297312973229733297342973529736297372973829739297402974129742297432974429745297462974729748297492975029751297522975329754297552975629757297582975929760297612976229763297642976529766297672976829769297702977129772297732977429775297762977729778297792978029781297822978329784297852978629787297882978929790297912979229793297942979529796297972979829799298002980129802298032980429805298062980729808298092981029811298122981329814298152981629817298182981929820298212982229823298242982529826298272982829829298302983129832298332983429835298362983729838298392984029841298422984329844298452984629847298482984929850298512985229853298542985529856298572985829859298602986129862298632986429865298662986729868298692987029871298722987329874298752987629877298782987929880298812988229883298842988529886298872988829889298902989129892298932989429895298962989729898298992990029901299022990329904299052990629907299082990929910299112991229913299142991529916299172991829919299202992129922299232992429925299262992729928299292993029931299322993329934299352993629937299382993929940299412994229943299442994529946299472994829949299502995129952299532995429955299562995729958299592996029961299622996329964299652996629967299682996929970299712997229973299742997529976299772997829979299802998129982299832998429985299862998729988299892999029991299922999329994299952999629997299982999930000300013000230003300043000530006300073000830009300103001130012300133001430015300163001730018300193002030021300223002330024300253002630027300283002930030300313003230033300343003530036300373003830039300403004130042300433004430045300463004730048300493005030051300523005330054300553005630057300583005930060300613006230063300643006530066300673006830069300703007130072300733007430075300763007730078300793008030081300823008330084300853008630087300883008930090300913009230093300943009530096300973009830099301003010130102301033010430105301063010730108301093011030111301123011330114301153011630117301183011930120301213012230123301243012530126301273012830129301303013130132301333013430135301363013730138301393014030141301423014330144301453014630147301483014930150301513015230153301543015530156301573015830159301603016130162301633016430165301663016730168301693017030171301723017330174301753017630177301783017930180301813018230183301843018530186301873018830189301903019130192301933019430195301963019730198301993020030201302023020330204302053020630207302083020930210302113021230213302143021530216302173021830219302203022130222302233022430225302263022730228302293023030231302323023330234302353023630237302383023930240302413024230243302443024530246302473024830249302503025130252302533025430255302563025730258302593026030261302623026330264302653026630267302683026930270302713027230273302743027530276302773027830279302803028130282302833028430285302863028730288302893029030291302923029330294302953029630297302983029930300303013030230303303043030530306303073030830309303103031130312303133031430315303163031730318303193032030321303223032330324303253032630327303283032930330303313033230333303343033530336303373033830339303403034130342303433034430345303463034730348303493035030351303523035330354303553035630357303583035930360303613036230363303643036530366303673036830369303703037130372303733037430375303763037730378303793038030381303823038330384303853038630387303883038930390303913039230393303943039530396303973039830399304003040130402304033040430405304063040730408304093041030411304123041330414304153041630417304183041930420304213042230423304243042530426304273042830429304303043130432304333043430435304363043730438304393044030441304423044330444304453044630447304483044930450304513045230453304543045530456304573045830459304603046130462304633046430465304663046730468304693047030471304723047330474304753047630477304783047930480304813048230483304843048530486304873048830489304903049130492304933049430495304963049730498304993050030501305023050330504305053050630507305083050930510305113051230513305143051530516305173051830519305203052130522305233052430525305263052730528305293053030531305323053330534305353053630537305383053930540305413054230543305443054530546305473054830549305503055130552305533055430555305563055730558305593056030561305623056330564305653056630567305683056930570305713057230573305743057530576305773057830579305803058130582305833058430585305863058730588305893059030591305923059330594305953059630597305983059930600306013060230603306043060530606306073060830609306103061130612306133061430615306163061730618306193062030621306223062330624306253062630627306283062930630306313063230633306343063530636306373063830639306403064130642306433064430645306463064730648306493065030651306523065330654306553065630657306583065930660306613066230663306643066530666306673066830669306703067130672306733067430675306763067730678306793068030681306823068330684306853068630687306883068930690306913069230693306943069530696306973069830699307003070130702307033070430705307063070730708307093071030711307123071330714307153071630717307183071930720307213072230723307243072530726307273072830729307303073130732307333073430735307363073730738307393074030741307423074330744307453074630747307483074930750307513075230753307543075530756307573075830759307603076130762307633076430765307663076730768307693077030771307723077330774307753077630777307783077930780307813078230783307843078530786307873078830789307903079130792307933079430795307963079730798307993080030801308023080330804308053080630807308083080930810308113081230813308143081530816308173081830819308203082130822308233082430825308263082730828308293083030831308323083330834308353083630837308383083930840308413084230843308443084530846308473084830849308503085130852308533085430855308563085730858308593086030861308623086330864308653086630867308683086930870308713087230873308743087530876308773087830879308803088130882308833088430885308863088730888308893089030891308923089330894308953089630897308983089930900309013090230903309043090530906309073090830909309103091130912309133091430915309163091730918309193092030921309223092330924309253092630927309283092930930309313093230933309343093530936309373093830939309403094130942309433094430945309463094730948309493095030951309523095330954309553095630957309583095930960309613096230963309643096530966309673096830969309703097130972309733097430975309763097730978309793098030981309823098330984309853098630987309883098930990309913099230993309943099530996309973099830999310003100131002310033100431005310063100731008310093101031011310123101331014310153101631017310183101931020310213102231023310243102531026310273102831029310303103131032310333103431035310363103731038310393104031041310423104331044310453104631047310483104931050310513105231053310543105531056310573105831059310603106131062310633106431065310663106731068310693107031071310723107331074310753107631077310783107931080310813108231083310843108531086310873108831089310903109131092310933109431095310963109731098310993110031101311023110331104311053110631107311083110931110311113111231113311143111531116311173111831119311203112131122311233112431125311263112731128311293113031131311323113331134311353113631137311383113931140311413114231143311443114531146311473114831149311503115131152311533115431155311563115731158311593116031161311623116331164311653116631167311683116931170311713117231173311743117531176311773117831179311803118131182311833118431185311863118731188311893119031191311923119331194311953119631197311983119931200312013120231203312043120531206312073120831209312103121131212312133121431215312163121731218312193122031221312223122331224312253122631227312283122931230312313123231233312343123531236312373123831239312403124131242312433124431245312463124731248312493125031251312523125331254312553125631257312583125931260312613126231263312643126531266312673126831269312703127131272312733127431275312763127731278312793128031281312823128331284312853128631287312883128931290312913129231293312943129531296312973129831299313003130131302313033130431305313063130731308313093131031311313123131331314313153131631317313183131931320313213132231323313243132531326313273132831329313303133131332313333133431335313363133731338313393134031341313423134331344313453134631347313483134931350313513135231353313543135531356313573135831359313603136131362313633136431365313663136731368313693137031371313723137331374313753137631377313783137931380313813138231383313843138531386313873138831389313903139131392313933139431395313963139731398313993140031401314023140331404314053140631407314083140931410314113141231413314143141531416314173141831419314203142131422314233142431425314263142731428314293143031431314323143331434314353143631437314383143931440314413144231443314443144531446314473144831449314503145131452314533145431455314563145731458314593146031461314623146331464314653146631467314683146931470314713147231473314743147531476314773147831479314803148131482314833148431485314863148731488314893149031491314923149331494314953149631497314983149931500315013150231503315043150531506315073150831509315103151131512315133151431515315163151731518315193152031521315223152331524315253152631527315283152931530315313153231533315343153531536315373153831539315403154131542315433154431545315463154731548315493155031551315523155331554315553155631557315583155931560315613156231563315643156531566315673156831569315703157131572315733157431575315763157731578315793158031581315823158331584315853158631587315883158931590315913159231593315943159531596315973159831599316003160131602316033160431605316063160731608316093161031611316123161331614316153161631617316183161931620316213162231623316243162531626316273162831629316303163131632316333163431635316363163731638316393164031641316423164331644316453164631647316483164931650316513165231653316543165531656316573165831659316603166131662316633166431665316663166731668316693167031671316723167331674316753167631677316783167931680316813168231683316843168531686316873168831689316903169131692316933169431695316963169731698316993170031701317023170331704317053170631707317083170931710317113171231713317143171531716317173171831719317203172131722317233172431725317263172731728317293173031731317323173331734317353173631737317383173931740317413174231743317443174531746317473174831749317503175131752317533175431755317563175731758317593176031761317623176331764317653176631767317683176931770317713177231773317743177531776317773177831779317803178131782317833178431785317863178731788317893179031791317923179331794317953179631797317983179931800318013180231803318043180531806318073180831809318103181131812318133181431815318163181731818318193182031821318223182331824318253182631827318283182931830318313183231833318343183531836318373183831839318403184131842318433184431845318463184731848318493185031851318523185331854318553185631857318583185931860318613186231863318643186531866318673186831869318703187131872318733187431875318763187731878318793188031881318823188331884318853188631887318883188931890318913189231893318943189531896318973189831899319003190131902319033190431905319063190731908319093191031911319123191331914319153191631917319183191931920319213192231923319243192531926319273192831929319303193131932319333193431935319363193731938319393194031941319423194331944319453194631947319483194931950319513195231953319543195531956319573195831959319603196131962319633196431965319663196731968319693197031971319723197331974319753197631977319783197931980319813198231983319843198531986319873198831989319903199131992319933199431995319963199731998319993200032001320023200332004320053200632007320083200932010320113201232013320143201532016320173201832019320203202132022320233202432025320263202732028320293203032031320323203332034320353203632037320383203932040320413204232043320443204532046320473204832049320503205132052320533205432055320563205732058320593206032061320623206332064320653206632067320683206932070320713207232073320743207532076320773207832079320803208132082320833208432085320863208732088320893209032091320923209332094320953209632097320983209932100321013210232103321043210532106321073210832109321103211132112321133211432115321163211732118321193212032121321223212332124321253212632127321283212932130321313213232133321343213532136321373213832139321403214132142321433214432145321463214732148321493215032151321523215332154321553215632157321583215932160321613216232163321643216532166321673216832169321703217132172321733217432175321763217732178321793218032181321823218332184321853218632187321883218932190321913219232193321943219532196321973219832199322003220132202322033220432205322063220732208322093221032211322123221332214322153221632217322183221932220322213222232223322243222532226322273222832229322303223132232322333223432235322363223732238322393224032241322423224332244322453224632247322483224932250322513225232253322543225532256322573225832259322603226132262322633226432265322663226732268322693227032271322723227332274322753227632277322783227932280322813228232283322843228532286322873228832289322903229132292322933229432295322963229732298322993230032301323023230332304323053230632307323083230932310323113231232313323143231532316323173231832319323203232132322323233232432325323263232732328323293233032331323323233332334323353233632337323383233932340323413234232343323443234532346323473234832349323503235132352323533235432355323563235732358323593236032361323623236332364323653236632367323683236932370323713237232373323743237532376323773237832379323803238132382323833238432385323863238732388323893239032391323923239332394323953239632397323983239932400324013240232403324043240532406324073240832409324103241132412324133241432415324163241732418324193242032421324223242332424324253242632427324283242932430324313243232433324343243532436324373243832439324403244132442324433244432445324463244732448324493245032451324523245332454324553245632457324583245932460324613246232463324643246532466324673246832469324703247132472324733247432475324763247732478324793248032481324823248332484324853248632487324883248932490324913249232493324943249532496324973249832499325003250132502325033250432505325063250732508325093251032511325123251332514325153251632517325183251932520325213252232523325243252532526325273252832529325303253132532325333253432535325363253732538325393254032541325423254332544325453254632547325483254932550325513255232553325543255532556325573255832559325603256132562325633256432565325663256732568325693257032571325723257332574325753257632577325783257932580325813258232583325843258532586325873258832589325903259132592325933259432595325963259732598325993260032601326023260332604326053260632607326083260932610326113261232613326143261532616326173261832619326203262132622326233262432625326263262732628326293263032631326323263332634326353263632637326383263932640326413264232643326443264532646326473264832649326503265132652326533265432655326563265732658326593266032661326623266332664326653266632667326683266932670326713267232673326743267532676326773267832679326803268132682326833268432685326863268732688326893269032691326923269332694326953269632697326983269932700327013270232703327043270532706327073270832709327103271132712327133271432715327163271732718327193272032721327223272332724327253272632727327283272932730327313273232733327343273532736327373273832739327403274132742327433274432745327463274732748327493275032751327523275332754327553275632757327583275932760327613276232763327643276532766327673276832769327703277132772327733277432775327763277732778327793278032781327823278332784327853278632787327883278932790327913279232793327943279532796327973279832799328003280132802328033280432805328063280732808328093281032811328123281332814328153281632817328183281932820328213282232823328243282532826328273282832829328303283132832328333283432835328363283732838328393284032841328423284332844328453284632847328483284932850328513285232853328543285532856328573285832859328603286132862328633286432865328663286732868328693287032871328723287332874328753287632877328783287932880328813288232883328843288532886328873288832889328903289132892328933289432895328963289732898328993290032901329023290332904329053290632907329083290932910329113291232913329143291532916329173291832919329203292132922329233292432925329263292732928329293293032931329323293332934329353293632937329383293932940329413294232943329443294532946329473294832949329503295132952329533295432955329563295732958329593296032961329623296332964329653296632967329683296932970329713297232973329743297532976329773297832979329803298132982329833298432985329863298732988329893299032991329923299332994329953299632997329983299933000330013300233003330043300533006330073300833009330103301133012330133301433015330163301733018330193302033021330223302333024330253302633027330283302933030330313303233033330343303533036330373303833039330403304133042330433304433045330463304733048330493305033051330523305333054330553305633057330583305933060330613306233063330643306533066330673306833069330703307133072330733307433075330763307733078330793308033081330823308333084330853308633087330883308933090330913309233093330943309533096330973309833099331003310133102331033310433105331063310733108331093311033111331123311333114331153311633117331183311933120331213312233123331243312533126331273312833129331303313133132331333313433135331363313733138331393314033141331423314333144331453314633147331483314933150331513315233153331543315533156331573315833159331603316133162331633316433165331663316733168331693317033171331723317333174331753317633177331783317933180331813318233183331843318533186331873318833189331903319133192331933319433195331963319733198331993320033201332023320333204332053320633207332083320933210332113321233213332143321533216332173321833219332203322133222332233322433225332263322733228332293323033231332323323333234332353323633237332383323933240332413324233243332443324533246332473324833249332503325133252332533325433255332563325733258332593326033261332623326333264332653326633267332683326933270332713327233273332743327533276332773327833279332803328133282332833328433285332863328733288332893329033291332923329333294332953329633297332983329933300333013330233303333043330533306333073330833309333103331133312333133331433315333163331733318333193332033321333223332333324333253332633327333283332933330333313333233333333343333533336333373333833339333403334133342333433334433345333463334733348333493335033351333523335333354333553335633357333583335933360333613336233363333643336533366333673336833369333703337133372333733337433375333763337733378333793338033381333823338333384333853338633387333883338933390333913339233393333943339533396333973339833399334003340133402334033340433405334063340733408334093341033411334123341333414334153341633417334183341933420334213342233423334243342533426334273342833429334303343133432334333343433435334363343733438334393344033441334423344333444334453344633447334483344933450334513345233453334543345533456334573345833459334603346133462334633346433465334663346733468334693347033471334723347333474334753347633477334783347933480334813348233483334843348533486334873348833489334903349133492334933349433495334963349733498334993350033501335023350333504335053350633507335083350933510335113351233513335143351533516335173351833519335203352133522335233352433525335263352733528335293353033531335323353333534335353353633537335383353933540335413354233543335443354533546335473354833549335503355133552335533355433555335563355733558335593356033561335623356333564335653356633567335683356933570335713357233573335743357533576335773357833579335803358133582335833358433585335863358733588335893359033591335923359333594335953359633597335983359933600336013360233603336043360533606336073360833609336103361133612336133361433615336163361733618336193362033621336223362333624336253362633627336283362933630336313363233633336343363533636336373363833639336403364133642336433364433645336463364733648336493365033651336523365333654336553365633657336583365933660336613366233663336643366533666336673366833669336703367133672336733367433675336763367733678336793368033681336823368333684336853368633687336883368933690336913369233693336943369533696336973369833699337003370133702337033370433705337063370733708337093371033711337123371333714337153371633717337183371933720337213372233723337243372533726337273372833729337303373133732337333373433735337363373733738337393374033741337423374333744337453374633747337483374933750337513375233753337543375533756337573375833759337603376133762337633376433765337663376733768337693377033771337723377333774337753377633777337783377933780337813378233783337843378533786337873378833789337903379133792337933379433795337963379733798337993380033801338023380333804338053380633807338083380933810338113381233813338143381533816338173381833819338203382133822338233382433825338263382733828338293383033831338323383333834338353383633837338383383933840338413384233843338443384533846338473384833849338503385133852338533385433855338563385733858338593386033861338623386333864338653386633867338683386933870338713387233873338743387533876338773387833879338803388133882338833388433885338863388733888338893389033891338923389333894338953389633897338983389933900339013390233903339043390533906339073390833909339103391133912339133391433915339163391733918339193392033921339223392333924339253392633927339283392933930339313393233933339343393533936339373393833939339403394133942339433394433945339463394733948339493395033951339523395333954339553395633957339583395933960339613396233963339643396533966339673396833969339703397133972339733397433975339763397733978339793398033981339823398333984339853398633987339883398933990339913399233993339943399533996339973399833999340003400134002340033400434005340063400734008340093401034011340123401334014340153401634017340183401934020340213402234023340243402534026340273402834029340303403134032340333403434035340363403734038340393404034041340423404334044340453404634047340483404934050340513405234053340543405534056340573405834059340603406134062340633406434065340663406734068340693407034071340723407334074340753407634077340783407934080340813408234083340843408534086340873408834089340903409134092340933409434095340963409734098340993410034101341023410334104341053410634107341083410934110341113411234113341143411534116341173411834119341203412134122341233412434125341263412734128341293413034131341323413334134341353413634137341383413934140341413414234143341443414534146341473414834149341503415134152341533415434155341563415734158341593416034161341623416334164341653416634167341683416934170341713417234173341743417534176341773417834179341803418134182341833418434185341863418734188341893419034191341923419334194341953419634197341983419934200342013420234203342043420534206342073420834209342103421134212342133421434215342163421734218342193422034221342223422334224342253422634227342283422934230342313423234233342343423534236342373423834239342403424134242342433424434245342463424734248342493425034251342523425334254342553425634257342583425934260342613426234263342643426534266342673426834269342703427134272342733427434275342763427734278342793428034281342823428334284342853428634287342883428934290342913429234293342943429534296342973429834299343003430134302343033430434305343063430734308343093431034311343123431334314343153431634317343183431934320343213432234323343243432534326343273432834329343303433134332343333433434335343363433734338343393434034341343423434334344343453434634347343483434934350343513435234353343543435534356343573435834359343603436134362343633436434365343663436734368343693437034371343723437334374343753437634377343783437934380343813438234383343843438534386343873438834389343903439134392343933439434395343963439734398343993440034401344023440334404344053440634407344083440934410344113441234413344143441534416344173441834419344203442134422344233442434425344263442734428344293443034431344323443334434344353443634437344383443934440344413444234443344443444534446344473444834449344503445134452344533445434455344563445734458344593446034461344623446334464344653446634467344683446934470344713447234473344743447534476344773447834479344803448134482344833448434485344863448734488344893449034491344923449334494344953449634497344983449934500345013450234503345043450534506345073450834509345103451134512345133451434515345163451734518345193452034521345223452334524345253452634527345283452934530345313453234533345343453534536345373453834539345403454134542345433454434545345463454734548345493455034551345523455334554345553455634557345583455934560345613456234563345643456534566345673456834569345703457134572345733457434575345763457734578345793458034581345823458334584345853458634587345883458934590345913459234593345943459534596345973459834599346003460134602346033460434605346063460734608346093461034611346123461334614346153461634617346183461934620346213462234623346243462534626346273462834629346303463134632346333463434635346363463734638346393464034641346423464334644346453464634647346483464934650346513465234653346543465534656346573465834659346603466134662346633466434665346663466734668346693467034671346723467334674346753467634677346783467934680346813468234683346843468534686346873468834689346903469134692346933469434695346963469734698346993470034701347023470334704347053470634707347083470934710347113471234713347143471534716347173471834719347203472134722347233472434725347263472734728347293473034731347323473334734347353473634737347383473934740347413474234743347443474534746347473474834749347503475134752347533475434755347563475734758347593476034761347623476334764347653476634767347683476934770347713477234773347743477534776347773477834779347803478134782347833478434785347863478734788347893479034791347923479334794347953479634797347983479934800348013480234803348043480534806348073480834809348103481134812348133481434815348163481734818348193482034821348223482334824348253482634827348283482934830348313483234833348343483534836348373483834839348403484134842348433484434845348463484734848348493485034851348523485334854348553485634857348583485934860348613486234863348643486534866348673486834869348703487134872348733487434875348763487734878348793488034881348823488334884348853488634887348883488934890348913489234893348943489534896348973489834899349003490134902349033490434905349063490734908349093491034911349123491334914349153491634917349183491934920349213492234923349243492534926349273492834929349303493134932349333493434935349363493734938349393494034941349423494334944349453494634947349483494934950349513495234953349543495534956349573495834959349603496134962349633496434965349663496734968349693497034971349723497334974349753497634977349783497934980349813498234983349843498534986349873498834989349903499134992349933499434995349963499734998349993500035001350023500335004350053500635007350083500935010350113501235013350143501535016350173501835019350203502135022350233502435025350263502735028350293503035031350323503335034350353503635037350383503935040350413504235043350443504535046350473504835049350503505135052350533505435055350563505735058350593506035061350623506335064350653506635067350683506935070350713507235073350743507535076350773507835079350803508135082350833508435085350863508735088350893509035091350923509335094350953509635097350983509935100351013510235103351043510535106351073510835109351103511135112351133511435115351163511735118351193512035121351223512335124351253512635127351283512935130351313513235133351343513535136351373513835139351403514135142351433514435145351463514735148351493515035151351523515335154351553515635157351583515935160351613516235163351643516535166351673516835169351703517135172351733517435175351763517735178351793518035181351823518335184351853518635187351883518935190351913519235193351943519535196351973519835199352003520135202352033520435205352063520735208352093521035211352123521335214352153521635217352183521935220352213522235223352243522535226352273522835229352303523135232352333523435235352363523735238352393524035241352423524335244352453524635247352483524935250352513525235253352543525535256352573525835259352603526135262352633526435265352663526735268352693527035271352723527335274352753527635277352783527935280352813528235283352843528535286352873528835289352903529135292352933529435295352963529735298352993530035301353023530335304353053530635307353083530935310353113531235313353143531535316353173531835319353203532135322353233532435325353263532735328353293533035331353323533335334353353533635337353383533935340353413534235343353443534535346353473534835349353503535135352353533535435355353563535735358353593536035361353623536335364353653536635367353683536935370353713537235373353743537535376353773537835379353803538135382353833538435385353863538735388353893539035391353923539335394353953539635397353983539935400354013540235403354043540535406354073540835409354103541135412354133541435415354163541735418354193542035421354223542335424354253542635427354283542935430354313543235433354343543535436354373543835439354403544135442354433544435445354463544735448354493545035451354523545335454354553545635457354583545935460354613546235463354643546535466354673546835469354703547135472354733547435475354763547735478354793548035481354823548335484354853548635487354883548935490354913549235493354943549535496354973549835499355003550135502355033550435505355063550735508355093551035511355123551335514355153551635517355183551935520355213552235523355243552535526355273552835529355303553135532355333553435535355363553735538355393554035541355423554335544355453554635547355483554935550355513555235553355543555535556355573555835559355603556135562355633556435565355663556735568355693557035571355723557335574355753557635577355783557935580355813558235583355843558535586355873558835589355903559135592355933559435595355963559735598355993560035601356023560335604356053560635607356083560935610356113561235613356143561535616356173561835619356203562135622356233562435625356263562735628356293563035631356323563335634356353563635637356383563935640356413564235643356443564535646356473564835649356503565135652356533565435655356563565735658356593566035661356623566335664356653566635667356683566935670356713567235673356743567535676356773567835679356803568135682356833568435685356863568735688356893569035691356923569335694356953569635697356983569935700357013570235703357043570535706357073570835709357103571135712357133571435715357163571735718357193572035721357223572335724357253572635727357283572935730357313573235733357343573535736357373573835739357403574135742357433574435745357463574735748357493575035751357523575335754357553575635757357583575935760357613576235763357643576535766357673576835769357703577135772357733577435775357763577735778357793578035781357823578335784357853578635787357883578935790357913579235793357943579535796357973579835799358003580135802358033580435805358063580735808358093581035811358123581335814358153581635817358183581935820358213582235823358243582535826358273582835829358303583135832358333583435835358363583735838358393584035841358423584335844358453584635847358483584935850358513585235853358543585535856358573585835859358603586135862358633586435865358663586735868358693587035871358723587335874358753587635877358783587935880358813588235883358843588535886358873588835889358903589135892358933589435895358963589735898358993590035901359023590335904359053590635907359083590935910359113591235913359143591535916359173591835919359203592135922359233592435925359263592735928359293593035931359323593335934359353593635937359383593935940359413594235943359443594535946359473594835949359503595135952359533595435955359563595735958359593596035961359623596335964359653596635967359683596935970359713597235973359743597535976359773597835979359803598135982359833598435985359863598735988359893599035991359923599335994359953599635997359983599936000360013600236003360043600536006360073600836009360103601136012360133601436015360163601736018360193602036021360223602336024360253602636027360283602936030360313603236033360343603536036360373603836039360403604136042360433604436045360463604736048360493605036051360523605336054360553605636057360583605936060360613606236063360643606536066360673606836069360703607136072360733607436075360763607736078360793608036081360823608336084360853608636087360883608936090360913609236093360943609536096360973609836099361003610136102361033610436105361063610736108361093611036111361123611336114361153611636117361183611936120361213612236123361243612536126361273612836129361303613136132361333613436135361363613736138361393614036141361423614336144361453614636147361483614936150361513615236153361543615536156361573615836159361603616136162361633616436165361663616736168361693617036171361723617336174361753617636177361783617936180361813618236183361843618536186361873618836189361903619136192361933619436195361963619736198361993620036201362023620336204362053620636207362083620936210362113621236213362143621536216362173621836219362203622136222362233622436225362263622736228362293623036231362323623336234362353623636237362383623936240362413624236243362443624536246362473624836249362503625136252362533625436255362563625736258362593626036261362623626336264362653626636267362683626936270362713627236273362743627536276362773627836279362803628136282362833628436285362863628736288362893629036291362923629336294362953629636297362983629936300363013630236303363043630536306363073630836309363103631136312363133631436315363163631736318363193632036321363223632336324363253632636327363283632936330363313633236333363343633536336363373633836339363403634136342363433634436345363463634736348363493635036351363523635336354363553635636357363583635936360363613636236363363643636536366363673636836369363703637136372363733637436375363763637736378363793638036381363823638336384363853638636387363883638936390363913639236393363943639536396363973639836399364003640136402364033640436405364063640736408364093641036411364123641336414364153641636417364183641936420364213642236423 |
- // Aliyun OSS SDK for JavaScript v6.17.1
- // Copyright Aliyun.com, Inc. or its affiliates. All Rights Reserved.
- // License at https://github.com/ali-sdk/ali-oss/blob/master/LICENSE
- (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){
- "use strict";
- var OSS = require('./browser/client');
- OSS.Buffer = require('buffer').Buffer;
- OSS.urllib = require('../shims/xhr');
- OSS.version = require('./browser/version').version;
- module.exports = OSS;
- },{"../shims/xhr":407,"./browser/client":3,"./browser/version":6,"buffer":85}],2:[function(require,module,exports){
- "use strict";
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
- var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
- var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
- require("core-js/modules/es.object.to-string.js");
- require("core-js/modules/web.dom-collections.for-each.js");
- require("core-js/modules/es.object.keys.js");
- require("core-js/modules/es.array.slice.js");
- var assert = require('assert');
- var _require = require('../common/utils/checkBucketName'),
- _checkBucketName = _require.checkBucketName;
- var proto = exports;
- function isArray(arr) {
- if (Array.isArray) return Array.isArray(arr);
- return Object.prototype.toString.call(arr) === '[object Array]';
- }
- function toArray(obj) {
- if (!obj) return [];
- if (isArray(obj)) return obj;
- return [obj];
- }
- /**
- * Bucket opertaions
- */
- // TODO: OSS server currently do not support CORS requests for bucket operations
- // proto.listBuckets = function* listBuckets(query, options) {
- // // prefix, marker, max-keys
- // var result = yield this.request({
- // method: 'GET',
- // query: query,
- // timeout: options && options.timeout,
- // ctx: options && options.ctx,
- // });
- //
- // if (result.status === 200) {
- // var data = yield this.parseXML(result.data);
- // var buckets = data.Buckets || null;
- // if (buckets) {
- // if (buckets.Bucket) {
- // buckets = buckets.Bucket;
- // }
- // if (!isArray(buckets)) {
- // buckets = [buckets];
- // }
- // buckets = buckets.map(function (item) {
- // return {
- // name: item.Name,
- // region: item.Location,
- // creationDate: item.CreationDate,
- // };
- // });
- // }
- // return {
- // buckets: buckets,
- // owner: {
- // id: data.Owner.ID,
- // displayName: data.Owner.DisplayName,
- // },
- // isTruncated: data.IsTruncated === 'true',
- // nextMarker: data.NextMarker || null,
- // res: result.res
- // };
- // }
- //
- // throw yield this.requestError(result);
- // };
- proto.useBucket = function useBucket(name) {
- _checkBucketName(name);
- this.options.bucket = name;
- return this;
- };
- proto.setBucket = function useBucket(name) {
- _checkBucketName(name);
- this.options.bucket = name;
- return this;
- };
- proto.getBucket = function getBucket() {
- return this.options.bucket;
- };
- proto.deleteBucket = /*#__PURE__*/function () {
- var _deleteBucket = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(name, options) {
- var params, result;
- return _regenerator.default.wrap(function _callee$(_context) {
- while (1) {
- switch (_context.prev = _context.next) {
- case 0:
- params = this._bucketRequestParams('DELETE', name, '', options);
- _context.next = 3;
- return this.request(params);
- case 3:
- result = _context.sent;
- if (!(result.status === 200 || result.status === 204)) {
- _context.next = 6;
- break;
- }
- return _context.abrupt("return", {
- res: result.res
- });
- case 6:
- _context.next = 8;
- return this.requestError(result);
- case 8:
- throw _context.sent;
- case 9:
- case "end":
- return _context.stop();
- }
- }
- }, _callee, this);
- }));
- function deleteBucket(_x, _x2) {
- return _deleteBucket.apply(this, arguments);
- }
- return deleteBucket;
- }(); // acl
- proto.putBucketACL = /*#__PURE__*/function () {
- var _putBucketACL = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(name, acl, options) {
- var params, result;
- return _regenerator.default.wrap(function _callee2$(_context2) {
- while (1) {
- switch (_context2.prev = _context2.next) {
- case 0:
- params = this._bucketRequestParams('PUT', name, 'acl', options);
- params.headers = {
- 'x-oss-acl': acl
- };
- params.successStatuses = [200];
- _context2.next = 5;
- return this.request(params);
- case 5:
- result = _context2.sent;
- return _context2.abrupt("return", {
- bucket: result.headers.location && result.headers.location.substring(1) || null,
- res: result.res
- });
- case 7:
- case "end":
- return _context2.stop();
- }
- }
- }, _callee2, this);
- }));
- function putBucketACL(_x3, _x4, _x5) {
- return _putBucketACL.apply(this, arguments);
- }
- return putBucketACL;
- }();
- proto.getBucketACL = /*#__PURE__*/function () {
- var _getBucketACL = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3(name, options) {
- var params, result;
- return _regenerator.default.wrap(function _callee3$(_context3) {
- while (1) {
- switch (_context3.prev = _context3.next) {
- case 0:
- params = this._bucketRequestParams('GET', name, 'acl', options);
- params.successStatuses = [200];
- params.xmlResponse = true;
- _context3.next = 5;
- return this.request(params);
- case 5:
- result = _context3.sent;
- return _context3.abrupt("return", {
- acl: result.data.AccessControlList.Grant,
- owner: {
- id: result.data.Owner.ID,
- displayName: result.data.Owner.DisplayName
- },
- res: result.res
- });
- case 7:
- case "end":
- return _context3.stop();
- }
- }
- }, _callee3, this);
- }));
- function getBucketACL(_x6, _x7) {
- return _getBucketACL.apply(this, arguments);
- }
- return getBucketACL;
- }(); // logging
- proto.putBucketLogging = /*#__PURE__*/function () {
- var _putBucketLogging = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4(name, prefix, options) {
- var params, xml, result;
- return _regenerator.default.wrap(function _callee4$(_context4) {
- while (1) {
- switch (_context4.prev = _context4.next) {
- case 0:
- params = this._bucketRequestParams('PUT', name, 'logging', options);
- xml = "".concat('<?xml version="1.0" encoding="UTF-8"?>\n<BucketLoggingStatus>\n' + '<LoggingEnabled>\n<TargetBucket>').concat(name, "</TargetBucket>\n");
- if (prefix) {
- xml += "<TargetPrefix>".concat(prefix, "</TargetPrefix>\n");
- }
- xml += '</LoggingEnabled>\n</BucketLoggingStatus>';
- params.content = xml;
- params.mime = 'xml';
- params.successStatuses = [200];
- _context4.next = 9;
- return this.request(params);
- case 9:
- result = _context4.sent;
- return _context4.abrupt("return", {
- res: result.res
- });
- case 11:
- case "end":
- return _context4.stop();
- }
- }
- }, _callee4, this);
- }));
- function putBucketLogging(_x8, _x9, _x10) {
- return _putBucketLogging.apply(this, arguments);
- }
- return putBucketLogging;
- }();
- proto.getBucketLogging = /*#__PURE__*/function () {
- var _getBucketLogging = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5(name, options) {
- var params, result, enable;
- return _regenerator.default.wrap(function _callee5$(_context5) {
- while (1) {
- switch (_context5.prev = _context5.next) {
- case 0:
- params = this._bucketRequestParams('GET', name, 'logging', options);
- params.successStatuses = [200];
- params.xmlResponse = true;
- _context5.next = 5;
- return this.request(params);
- case 5:
- result = _context5.sent;
- enable = result.data.LoggingEnabled;
- return _context5.abrupt("return", {
- enable: !!enable,
- prefix: enable && enable.TargetPrefix || null,
- res: result.res
- });
- case 8:
- case "end":
- return _context5.stop();
- }
- }
- }, _callee5, this);
- }));
- function getBucketLogging(_x11, _x12) {
- return _getBucketLogging.apply(this, arguments);
- }
- return getBucketLogging;
- }();
- proto.deleteBucketLogging = /*#__PURE__*/function () {
- var _deleteBucketLogging = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6(name, options) {
- var params, result;
- return _regenerator.default.wrap(function _callee6$(_context6) {
- while (1) {
- switch (_context6.prev = _context6.next) {
- case 0:
- params = this._bucketRequestParams('DELETE', name, 'logging', options);
- params.successStatuses = [204, 200];
- _context6.next = 4;
- return this.request(params);
- case 4:
- result = _context6.sent;
- return _context6.abrupt("return", {
- res: result.res
- });
- case 6:
- case "end":
- return _context6.stop();
- }
- }
- }, _callee6, this);
- }));
- function deleteBucketLogging(_x13, _x14) {
- return _deleteBucketLogging.apply(this, arguments);
- }
- return deleteBucketLogging;
- }();
- proto.putBucketCORS = /*#__PURE__*/function () {
- var _putBucketCORS = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee7(name, rules, options) {
- var params, xml, parseOrigin, parseMethod, parseHeader, parseExposeHeader, i, l, rule, result;
- return _regenerator.default.wrap(function _callee7$(_context7) {
- while (1) {
- switch (_context7.prev = _context7.next) {
- case 0:
- rules = rules || [];
- assert(rules.length, 'rules is required');
- rules.forEach(function (rule) {
- assert(rule.allowedOrigin, 'allowedOrigin is required');
- assert(rule.allowedMethod, 'allowedMethod is required');
- });
- params = this._bucketRequestParams('PUT', name, 'cors', options);
- xml = '<?xml version="1.0" encoding="UTF-8"?>\n<CORSConfiguration>';
- parseOrigin = function parseOrigin(val) {
- xml += "<AllowedOrigin>".concat(val, "</AllowedOrigin>");
- };
- parseMethod = function parseMethod(val) {
- xml += "<AllowedMethod>".concat(val, "</AllowedMethod>");
- };
- parseHeader = function parseHeader(val) {
- xml += "<AllowedHeader>".concat(val, "</AllowedHeader>");
- };
- parseExposeHeader = function parseExposeHeader(val) {
- xml += "<ExposeHeader>".concat(val, "</ExposeHeader>");
- };
- for (i = 0, l = rules.length; i < l; i++) {
- rule = rules[i];
- xml += '<CORSRule>';
- toArray(rule.allowedOrigin).forEach(parseOrigin);
- toArray(rule.allowedMethod).forEach(parseMethod);
- toArray(rule.allowedHeader).forEach(parseHeader);
- toArray(rule.exposeHeader).forEach(parseExposeHeader);
- if (rule.maxAgeSeconds) {
- xml += "<MaxAgeSeconds>".concat(rule.maxAgeSeconds, "</MaxAgeSeconds>");
- }
- xml += '</CORSRule>';
- }
- xml += '</CORSConfiguration>';
- params.content = xml;
- params.mime = 'xml';
- params.successStatuses = [200];
- _context7.next = 16;
- return this.request(params);
- case 16:
- result = _context7.sent;
- return _context7.abrupt("return", {
- res: result.res
- });
- case 18:
- case "end":
- return _context7.stop();
- }
- }
- }, _callee7, this);
- }));
- function putBucketCORS(_x15, _x16, _x17) {
- return _putBucketCORS.apply(this, arguments);
- }
- return putBucketCORS;
- }();
- proto.getBucketCORS = /*#__PURE__*/function () {
- var _getBucketCORS = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee8(name, options) {
- var params, result, rules, CORSRule;
- return _regenerator.default.wrap(function _callee8$(_context8) {
- while (1) {
- switch (_context8.prev = _context8.next) {
- case 0:
- params = this._bucketRequestParams('GET', name, 'cors', options);
- params.successStatuses = [200];
- params.xmlResponse = true;
- _context8.next = 5;
- return this.request(params);
- case 5:
- result = _context8.sent;
- rules = [];
- if (result.data && result.data.CORSRule) {
- CORSRule = result.data.CORSRule;
- if (!isArray(CORSRule)) CORSRule = [CORSRule];
- CORSRule.forEach(function (rule) {
- var r = {};
- Object.keys(rule).forEach(function (key) {
- r[key.slice(0, 1).toLowerCase() + key.slice(1, key.length)] = rule[key];
- });
- rules.push(r);
- });
- }
- return _context8.abrupt("return", {
- rules: rules,
- res: result.res
- });
- case 9:
- case "end":
- return _context8.stop();
- }
- }
- }, _callee8, this);
- }));
- function getBucketCORS(_x18, _x19) {
- return _getBucketCORS.apply(this, arguments);
- }
- return getBucketCORS;
- }();
- proto.deleteBucketCORS = /*#__PURE__*/function () {
- var _deleteBucketCORS = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee9(name, options) {
- var params, result;
- return _regenerator.default.wrap(function _callee9$(_context9) {
- while (1) {
- switch (_context9.prev = _context9.next) {
- case 0:
- params = this._bucketRequestParams('DELETE', name, 'cors', options);
- params.successStatuses = [204];
- _context9.next = 4;
- return this.request(params);
- case 4:
- result = _context9.sent;
- return _context9.abrupt("return", {
- res: result.res
- });
- case 6:
- case "end":
- return _context9.stop();
- }
- }
- }, _callee9, this);
- }));
- function deleteBucketCORS(_x20, _x21) {
- return _deleteBucketCORS.apply(this, arguments);
- }
- return deleteBucketCORS;
- }(); // referer
- proto.putBucketReferer = /*#__PURE__*/function () {
- var _putBucketReferer = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee10(name, allowEmpty, referers, options) {
- var params, xml, i, result;
- return _regenerator.default.wrap(function _callee10$(_context10) {
- while (1) {
- switch (_context10.prev = _context10.next) {
- case 0:
- params = this._bucketRequestParams('PUT', name, 'referer', options);
- xml = '<?xml version="1.0" encoding="UTF-8"?>\n<RefererConfiguration>\n';
- xml += " <AllowEmptyReferer>".concat(allowEmpty ? 'true' : 'false', "</AllowEmptyReferer>\n");
- if (referers && referers.length > 0) {
- xml += ' <RefererList>\n';
- for (i = 0; i < referers.length; i++) {
- xml += " <Referer>".concat(referers[i], "</Referer>\n");
- }
- xml += ' </RefererList>\n';
- } else {
- xml += ' <RefererList />\n';
- }
- xml += '</RefererConfiguration>';
- params.content = xml;
- params.mime = 'xml';
- params.successStatuses = [200];
- _context10.next = 10;
- return this.request(params);
- case 10:
- result = _context10.sent;
- return _context10.abrupt("return", {
- res: result.res
- });
- case 12:
- case "end":
- return _context10.stop();
- }
- }
- }, _callee10, this);
- }));
- function putBucketReferer(_x22, _x23, _x24, _x25) {
- return _putBucketReferer.apply(this, arguments);
- }
- return putBucketReferer;
- }();
- proto.getBucketReferer = /*#__PURE__*/function () {
- var _getBucketReferer = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee11(name, options) {
- var params, result, referers;
- return _regenerator.default.wrap(function _callee11$(_context11) {
- while (1) {
- switch (_context11.prev = _context11.next) {
- case 0:
- params = this._bucketRequestParams('GET', name, 'referer', options);
- params.successStatuses = [200];
- params.xmlResponse = true;
- _context11.next = 5;
- return this.request(params);
- case 5:
- result = _context11.sent;
- referers = result.data.RefererList.Referer || null;
- if (referers) {
- if (!isArray(referers)) {
- referers = [referers];
- }
- }
- return _context11.abrupt("return", {
- allowEmpty: result.data.AllowEmptyReferer === 'true',
- referers: referers,
- res: result.res
- });
- case 9:
- case "end":
- return _context11.stop();
- }
- }
- }, _callee11, this);
- }));
- function getBucketReferer(_x26, _x27) {
- return _getBucketReferer.apply(this, arguments);
- }
- return getBucketReferer;
- }();
- proto.deleteBucketReferer = /*#__PURE__*/function () {
- var _deleteBucketReferer = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee12(name, options) {
- return _regenerator.default.wrap(function _callee12$(_context12) {
- while (1) {
- switch (_context12.prev = _context12.next) {
- case 0:
- _context12.next = 2;
- return this.putBucketReferer(name, true, null, options);
- case 2:
- return _context12.abrupt("return", _context12.sent);
- case 3:
- case "end":
- return _context12.stop();
- }
- }
- }, _callee12, this);
- }));
- function deleteBucketReferer(_x28, _x29) {
- return _deleteBucketReferer.apply(this, arguments);
- }
- return deleteBucketReferer;
- }(); // private apis
- proto._bucketRequestParams = function _bucketRequestParams(method, bucket, subres, options) {
- return {
- method: method,
- bucket: bucket,
- subres: subres,
- timeout: options && options.timeout,
- ctx: options && options.ctx
- };
- };
- },{"../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){
- (function (Buffer,process){(function (){
- "use strict";
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
- var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
- var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
- require("core-js/modules/es.function.name.js");
- require("core-js/modules/es.regexp.exec.js");
- require("core-js/modules/es.string.split.js");
- require("core-js/modules/es.object.assign.js");
- require("core-js/modules/es.array.includes.js");
- require("core-js/modules/es.string.replace.js");
- require("core-js/modules/es.array.concat.js");
- require("core-js/modules/es.symbol.js");
- require("core-js/modules/es.symbol.description.js");
- require("core-js/modules/es.array.slice.js");
- require("core-js/modules/es.object.to-string.js");
- require("core-js/modules/es.promise.js");
- require("core-js/modules/es.regexp.to-string.js");
- var debug = require('debug')('ali-oss');
- var xml = require('xml2js');
- var AgentKeepalive = require('agentkeepalive');
- var merge = require('merge-descriptors');
- var platform = require('platform');
- var utility = require('utility');
- var urllib = require('urllib');
- var pkg = require('./version');
- var bowser = require('bowser');
- var signUtils = require('../common/signUtils');
- var _initOptions = require('../common/client/initOptions');
- var _require = require('../common/utils/createRequest'),
- createRequest = _require.createRequest;
- var _require2 = require('../common/utils/encoder'),
- encoder = _require2.encoder;
- var _require3 = require('../common/client/getReqUrl'),
- getReqUrl = _require3.getReqUrl;
- var _require4 = require('../common/utils/setSTSToken'),
- setSTSToken = _require4.setSTSToken;
- var _require5 = require('../common/utils/retry'),
- retry = _require5.retry;
- var _require6 = require('../common/utils/isFunction'),
- isFunction = _require6.isFunction;
- var globalHttpAgent = new AgentKeepalive();
- function _unSupportBrowserTip() {
- var name = platform.name,
- version = platform.version;
- if (name && name.toLowerCase && name.toLowerCase() === 'ie' && version.split('.')[0] < 10) {
- // eslint-disable-next-line no-console
- console.warn('ali-oss does not support the current browser');
- }
- } // check local web protocol,if https secure default set true , if http secure default set false
- function isHttpsWebProtocol() {
- // for web worker not use window.location.
- // eslint-disable-next-line no-restricted-globals
- return location && location.protocol === 'https:';
- }
- function Client(options, ctx) {
- _unSupportBrowserTip();
- if (!(this instanceof Client)) {
- return new Client(options, ctx);
- }
- if (options && options.inited) {
- this.options = options;
- } else {
- this.options = Client.initOptions(options);
- }
- this.options.cancelFlag = false; // cancel flag: if true need to be cancelled, default false
- // support custom agent and urllib client
- if (this.options.urllib) {
- this.urllib = this.options.urllib;
- } else {
- this.urllib = urllib;
- this.agent = this.options.agent || globalHttpAgent;
- }
- this.ctx = ctx;
- this.userAgent = this._getUserAgent();
- this.stsTokenFreshTime = new Date(); // record the time difference between client and server
- this.options.amendTimeSkewed = 0;
- }
- /**
- * Expose `Client`
- */
- module.exports = Client;
- Client.initOptions = function initOptions(options) {
- if (!options.stsToken) {
- console.warn('Please use STS Token for safety, see more details at https://help.aliyun.com/document_detail/32077.html');
- }
- var opts = Object.assign({
- secure: isHttpsWebProtocol(),
- // for browser compatibility disable fetch.
- useFetch: false
- }, options);
- return _initOptions(opts);
- };
- /**
- * prototype
- */
- var proto = Client.prototype; // mount debug on proto
- proto.debug = debug;
- /**
- * Object operations
- */
- merge(proto, require('./object'));
- /**
- * Bucket operations
- */
- merge(proto, require('./bucket'));
- merge(proto, require('../common/bucket/getBucketWebsite'));
- merge(proto, require('../common/bucket/putBucketWebsite'));
- merge(proto, require('../common/bucket/deleteBucketWebsite')); // lifecycle
- merge(proto, require('../common/bucket/getBucketLifecycle'));
- merge(proto, require('../common/bucket/putBucketLifecycle'));
- merge(proto, require('../common/bucket/deleteBucketLifecycle')); // multiversion
- merge(proto, require('../common/bucket/putBucketVersioning'));
- merge(proto, require('../common/bucket/getBucketVersioning')); // inventory
- merge(proto, require('../common/bucket/getBucketInventory'));
- merge(proto, require('../common/bucket/deleteBucketInventory'));
- merge(proto, require('../common/bucket/listBucketInventory'));
- merge(proto, require('../common/bucket/putBucketInventory')); // worm
- merge(proto, require('../common/bucket/abortBucketWorm'));
- merge(proto, require('../common/bucket/completeBucketWorm'));
- merge(proto, require('../common/bucket/extendBucketWorm'));
- merge(proto, require('../common/bucket/getBucketWorm'));
- merge(proto, require('../common/bucket/initiateBucketWorm')); // multipart upload
- merge(proto, require('./managed-upload'));
- /**
- * common multipart-copy support node and browser
- */
- merge(proto, require('../common/multipart-copy'));
- /**
- * Multipart operations
- */
- merge(proto, require('../common/multipart'));
- /**
- * Common module parallel
- */
- merge(proto, require('../common/parallel'));
- /**
- * get OSS signature
- * @param {String} stringToSign
- * @return {String} the signature
- */
- proto.signature = function signature(stringToSign) {
- this.debug('authorization stringToSign: %s', stringToSign, 'info');
- return signUtils.computeSignature(this.options.accessKeySecret, stringToSign, this.options.headerEncoding);
- };
- proto._getReqUrl = getReqUrl;
- /**
- * get author header
- *
- * "Authorization: OSS " + Access Key Id + ":" + Signature
- *
- * Signature = base64(hmac-sha1(Access Key Secret + "\n"
- * + VERB + "\n"
- * + CONTENT-MD5 + "\n"
- * + CONTENT-TYPE + "\n"
- * + DATE + "\n"
- * + CanonicalizedOSSHeaders
- * + CanonicalizedResource))
- *
- * @param {String} method
- * @param {String} resource
- * @param {Object} header
- * @return {String}
- *
- * @api private
- */
- proto.authorization = function authorization(method, resource, subres, headers) {
- var stringToSign = signUtils.buildCanonicalString(method.toUpperCase(), resource, {
- headers: headers,
- parameters: subres
- });
- return signUtils.authorization(this.options.accessKeyId, this.options.accessKeySecret, stringToSign, this.options.headerEncoding);
- };
- /**
- * request oss server
- * @param {Object} params
- * - {String} object
- * - {String} bucket
- * - {Object} [headers]
- * - {Object} [query]
- * - {Buffer} [content]
- * - {Stream} [stream]
- * - {Stream} [writeStream]
- * - {String} [mime]
- * - {Boolean} [xmlResponse]
- * - {Boolean} [customResponse]
- * - {Number} [timeout]
- * - {Object} [ctx] request context, default is `this.ctx`
- *
- * @api private
- */
- proto.request = /*#__PURE__*/function () {
- var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(params) {
- var _this = this;
- return _regenerator.default.wrap(function _callee$(_context) {
- while (1) {
- switch (_context.prev = _context.next) {
- case 0:
- if (!this.options.retryMax) {
- _context.next = 6;
- break;
- }
- _context.next = 3;
- return retry(request.bind(this), this.options.retryMax, {
- errorHandler: function errorHandler(err) {
- var _errHandle = function _errHandle(_err) {
- if (params.stream) return false;
- var statusErr = [-1, -2].includes(_err.status);
- var requestErrorRetryHandle = _this.options.requestErrorRetryHandle || function () {
- return true;
- };
- return statusErr && requestErrorRetryHandle(_err);
- };
- if (_errHandle(err)) return true;
- return false;
- }
- })(params);
- case 3:
- return _context.abrupt("return", _context.sent);
- case 6:
- return _context.abrupt("return", request.call(this, params));
- case 7:
- case "end":
- return _context.stop();
- }
- }
- }, _callee, this);
- }));
- return function (_x) {
- return _ref.apply(this, arguments);
- };
- }();
- function request(_x2) {
- return _request.apply(this, arguments);
- }
- function _request() {
- _request = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3(params) {
- var reqParams, result, reqErr, useStream, err, parseData;
- return _regenerator.default.wrap(function _callee3$(_context3) {
- while (1) {
- switch (_context3.prev = _context3.next) {
- case 0:
- if (!(this.options.stsToken && isFunction(this.options.refreshSTSToken))) {
- _context3.next = 3;
- break;
- }
- _context3.next = 3;
- return setSTSToken.call(this);
- case 3:
- reqParams = createRequest.call(this, params);
- if (!this.options.useFetch) {
- reqParams.params.mode = 'disable-fetch';
- }
- useStream = !!params.stream;
- _context3.prev = 6;
- _context3.next = 9;
- return this.urllib.request(reqParams.url, reqParams.params);
- case 9:
- result = _context3.sent;
- this.debug('response %s %s, got %s, headers: %j', params.method, reqParams.url, result.status, result.headers, 'info');
- _context3.next = 16;
- break;
- case 13:
- _context3.prev = 13;
- _context3.t0 = _context3["catch"](6);
- reqErr = _context3.t0;
- case 16:
- if (!(result && params.successStatuses && params.successStatuses.indexOf(result.status) === -1)) {
- _context3.next = 28;
- break;
- }
- _context3.next = 19;
- return this.requestError(result);
- case 19:
- err = _context3.sent;
- if (!(err.code === 'RequestTimeTooSkewed' && !useStream)) {
- _context3.next = 25;
- break;
- }
- this.options.amendTimeSkewed = +new Date(err.serverTime) - new Date();
- _context3.next = 24;
- return this.request(params);
- case 24:
- return _context3.abrupt("return", _context3.sent);
- case 25:
- err.params = params;
- _context3.next = 32;
- break;
- case 28:
- if (!reqErr) {
- _context3.next = 32;
- break;
- }
- _context3.next = 31;
- return this.requestError(reqErr);
- case 31:
- err = _context3.sent;
- case 32:
- if (!err) {
- _context3.next = 34;
- break;
- }
- throw err;
- case 34:
- if (!params.xmlResponse) {
- _context3.next = 39;
- break;
- }
- _context3.next = 37;
- return this.parseXML(result.data);
- case 37:
- parseData = _context3.sent;
- result.data = parseData;
- case 39:
- return _context3.abrupt("return", result);
- case 40:
- case "end":
- return _context3.stop();
- }
- }
- }, _callee3, this, [[6, 13]]);
- }));
- return _request.apply(this, arguments);
- }
- proto._getResource = function _getResource(params) {
- var resource = '/';
- if (params.bucket) resource += "".concat(params.bucket, "/");
- if (params.object) resource += encoder(params.object, this.options.headerEncoding);
- return resource;
- };
- proto._escape = function _escape(name) {
- return utility.encodeURIComponent(name).replace(/%2F/g, '/');
- };
- /*
- * Get User-Agent for browser & node.js
- * @example
- * aliyun-sdk-nodejs/4.1.2 Node.js 5.3.0 on Darwin 64-bit
- * aliyun-sdk-js/4.1.2 Safari 9.0 on Apple iPhone(iOS 9.2.1)
- * aliyun-sdk-js/4.1.2 Chrome 43.0.2357.134 32-bit on Windows Server 2008 R2 / 7 64-bit
- */
- proto._getUserAgent = function _getUserAgent() {
- var agent = process && process.browser ? 'js' : 'nodejs';
- var sdk = "aliyun-sdk-".concat(agent, "/").concat(pkg.version);
- var plat = platform.description;
- if (!plat && process) {
- plat = "Node.js ".concat(process.version.slice(1), " on ").concat(process.platform, " ").concat(process.arch);
- }
- return this._checkUserAgent("".concat(sdk, " ").concat(plat));
- };
- proto._checkUserAgent = function _checkUserAgent(ua) {
- var userAgent = ua.replace(/\u03b1/, 'alpha').replace(/\u03b2/, 'beta');
- return userAgent;
- };
- /*
- * Check Browser And Version
- * @param {String} [name] browser name: like IE, Chrome, Firefox
- * @param {String} [version] browser major version: like 10(IE 10.x), 55(Chrome 55.x), 50(Firefox 50.x)
- * @return {Bool} true or false
- * @api private
- */
- proto.checkBrowserAndVersion = function checkBrowserAndVersion(name, version) {
- return bowser.name === name && bowser.version.split('.')[0] === version;
- };
- /**
- * thunkify xml.parseString
- * @param {String|Buffer} str
- *
- * @api private
- */
- proto.parseXML = function parseXMLThunk(str) {
- return new Promise(function (resolve, reject) {
- if (Buffer.isBuffer(str)) {
- str = str.toString();
- }
- xml.parseString(str, {
- explicitRoot: false,
- explicitArray: false
- }, function (err, result) {
- if (err) {
- reject(err);
- } else {
- resolve(result);
- }
- });
- });
- };
- /**
- * generater a request error with request response
- * @param {Object} result
- *
- * @api private
- */
- proto.requestError = /*#__PURE__*/function () {
- var _requestError = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(result) {
- var err, message, info, msg;
- return _regenerator.default.wrap(function _callee2$(_context2) {
- while (1) {
- switch (_context2.prev = _context2.next) {
- case 0:
- err = null;
- if (!(!result.data || !result.data.length)) {
- _context2.next = 5;
- break;
- }
- if (result.status === -1 || result.status === -2) {
- // -1 is net error , -2 is timeout
- err = new Error(result.message);
- err.name = result.name;
- err.status = result.status;
- err.code = result.name;
- } else {
- // HEAD not exists resource
- if (result.status === 404) {
- err = new Error('Object not exists');
- err.name = 'NoSuchKeyError';
- err.status = 404;
- err.code = 'NoSuchKey';
- } else if (result.status === 412) {
- err = new Error('Pre condition failed');
- err.name = 'PreconditionFailedError';
- err.status = 412;
- err.code = 'PreconditionFailed';
- } else {
- err = new Error("Unknow error, status: ".concat(result.status));
- err.name = 'UnknowError';
- err.status = result.status;
- }
- err.requestId = result.headers['x-oss-request-id'];
- err.host = '';
- }
- _context2.next = 32;
- break;
- case 5:
- message = String(result.data);
- this.debug('request response error data: %s', message, 'error');
- _context2.prev = 7;
- _context2.next = 10;
- return this.parseXML(message);
- case 10:
- _context2.t0 = _context2.sent;
- if (_context2.t0) {
- _context2.next = 13;
- break;
- }
- _context2.t0 = {};
- case 13:
- info = _context2.t0;
- _context2.next = 23;
- break;
- case 16:
- _context2.prev = 16;
- _context2.t1 = _context2["catch"](7);
- this.debug(message, 'error');
- _context2.t1.message += "\nraw xml: ".concat(message);
- _context2.t1.status = result.status;
- _context2.t1.requestId = result.headers['x-oss-request-id'];
- return _context2.abrupt("return", _context2.t1);
- case 23:
- msg = info.Message || "unknow request error, status: ".concat(result.status);
- if (info.Condition) {
- msg += " (condition: ".concat(info.Condition, ")");
- }
- err = new Error(msg);
- err.name = info.Code ? "".concat(info.Code, "Error") : 'UnknowError';
- err.status = result.status;
- err.code = info.Code;
- err.requestId = info.RequestId;
- err.hostId = info.HostId;
- err.serverTime = info.ServerTime;
- case 32:
- this.debug('generate error %j', err, 'error');
- return _context2.abrupt("return", err);
- case 34:
- case "end":
- return _context2.stop();
- }
- }
- }, _callee2, this, [[7, 16]]);
- }));
- function requestError(_x3) {
- return _requestError.apply(this, arguments);
- }
- return requestError;
- }();
- }).call(this)}).call(this,{"isBuffer":require("../../node_modules/is-buffer/index.js")},require('_process'))
- },{"../../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){
- (function (Buffer){(function (){
- "use strict";
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
- var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
- require("core-js/modules/es.function.name.js");
- require("core-js/modules/es.object.to-string.js");
- require("core-js/modules/es.promise.js");
- require("core-js/modules/es.array.from.js");
- require("core-js/modules/es.string.iterator.js");
- require("core-js/modules/es.array.map.js");
- require("core-js/modules/es.array.filter.js");
- require("core-js/modules/es.array.find.js");
- require("core-js/modules/es.array.concat.js");
- require("core-js/modules/es.regexp.to-string.js");
- require("core-js/modules/es.array.slice.js");
- require("core-js/modules/es.array.iterator.js");
- require("core-js/modules/es.array-buffer.slice.js");
- require("core-js/modules/es.typed-array.uint8-array.js");
- require("core-js/modules/es.typed-array.copy-within.js");
- require("core-js/modules/es.typed-array.every.js");
- require("core-js/modules/es.typed-array.fill.js");
- require("core-js/modules/es.typed-array.filter.js");
- require("core-js/modules/es.typed-array.find.js");
- require("core-js/modules/es.typed-array.find-index.js");
- require("core-js/modules/es.typed-array.for-each.js");
- require("core-js/modules/es.typed-array.includes.js");
- require("core-js/modules/es.typed-array.index-of.js");
- require("core-js/modules/es.typed-array.iterator.js");
- require("core-js/modules/es.typed-array.join.js");
- require("core-js/modules/es.typed-array.last-index-of.js");
- require("core-js/modules/es.typed-array.map.js");
- require("core-js/modules/es.typed-array.reduce.js");
- require("core-js/modules/es.typed-array.reduce-right.js");
- require("core-js/modules/es.typed-array.reverse.js");
- require("core-js/modules/es.typed-array.set.js");
- require("core-js/modules/es.typed-array.slice.js");
- require("core-js/modules/es.typed-array.some.js");
- require("core-js/modules/es.typed-array.sort.js");
- require("core-js/modules/es.typed-array.subarray.js");
- require("core-js/modules/es.typed-array.to-locale-string.js");
- require("core-js/modules/es.typed-array.to-string.js");
- var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
- // var debug = require('debug')('ali-oss:multipart');
- var util = require('util');
- var path = require('path');
- var mime = require('mime');
- var copy = require('copy-to');
- var _require = require('../common/utils/isBlob'),
- isBlob = _require.isBlob;
- var _require2 = require('../common/utils/isFile'),
- isFile = _require2.isFile;
- var _require3 = require('../common/utils/isArray'),
- isArray = _require3.isArray;
- var _require4 = require('../common/utils/isBuffer'),
- isBuffer = _require4.isBuffer;
- var _require5 = require('../common/utils/retry'),
- retry = _require5.retry;
- var proto = exports;
- /**
- * Multipart operations
- */
- /**
- * Upload a file to OSS using multipart uploads
- * @param {String} name
- * @param {String|File|Buffer} file
- * @param {Object} options
- * {Object} options.callback The callback parameter is composed of a JSON string encoded in Base64
- * {String} options.callback.url the OSS sends a callback request to this URL
- * {String} options.callback.host The host header value for initiating callback requests
- * {String} options.callback.body The value of the request body when a callback is initiated
- * {String} options.callback.contentType The Content-Type of the callback requests initiatiated
- * {Object} options.callback.customValue Custom parameters are a map of key-values, e.g:
- * customValue = {
- * key1: 'value1',
- * key2: 'value2'
- * }
- */
- proto.multipartUpload = /*#__PURE__*/function () {
- var _multipartUpload = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(name, file) {
- var options,
- minPartSize,
- fileSize,
- result,
- ret,
- initResult,
- uploadId,
- partSize,
- checkpoint,
- _args = arguments;
- return _regenerator.default.wrap(function _callee$(_context) {
- while (1) {
- switch (_context.prev = _context.next) {
- case 0:
- options = _args.length > 2 && _args[2] !== undefined ? _args[2] : {};
- this.resetCancelFlag();
- options.disabledMD5 = options.disabledMD5 === undefined ? true : !!options.disabledMD5;
- if (!(options.checkpoint && options.checkpoint.uploadId)) {
- _context.next = 8;
- break;
- }
- if (file && isFile(file)) options.checkpoint.file = file;
- _context.next = 7;
- return this._resumeMultipart(options.checkpoint, options);
- case 7:
- return _context.abrupt("return", _context.sent);
- case 8:
- minPartSize = 100 * 1024;
- if (!options.mime) {
- if (isFile(file)) {
- options.mime = mime.getType(path.extname(file.name));
- } else if (isBlob(file)) {
- options.mime = file.type;
- } else if (isBuffer(file)) {
- options.mime = '';
- } else {
- options.mime = mime.getType(path.extname(file));
- }
- }
- options.headers = options.headers || {};
- this._convertMetaToHeaders(options.meta, options.headers);
- _context.next = 14;
- return this._getFileSize(file);
- case 14:
- fileSize = _context.sent;
- if (!(fileSize < minPartSize)) {
- _context.next = 26;
- break;
- }
- options.contentLength = fileSize;
- _context.next = 19;
- return this.put(name, file, options);
- case 19:
- result = _context.sent;
- if (!(options && options.progress)) {
- _context.next = 23;
- break;
- }
- _context.next = 23;
- return options.progress(1);
- case 23:
- ret = {
- res: result.res,
- bucket: this.options.bucket,
- name: name,
- etag: result.res.headers.etag
- };
- if (options.headers && options.headers['x-oss-callback'] || options.callback) {
- ret.data = result.data;
- }
- return _context.abrupt("return", ret);
- case 26:
- if (!(options.partSize && !(parseInt(options.partSize, 10) === options.partSize))) {
- _context.next = 28;
- break;
- }
- throw new Error('partSize must be int number');
- case 28:
- if (!(options.partSize && options.partSize < minPartSize)) {
- _context.next = 30;
- break;
- }
- throw new Error("partSize must not be smaller than ".concat(minPartSize));
- case 30:
- _context.next = 32;
- return this.initMultipartUpload(name, options);
- case 32:
- initResult = _context.sent;
- uploadId = initResult.uploadId;
- partSize = this._getPartSize(fileSize, options.partSize);
- checkpoint = {
- file: file,
- name: name,
- fileSize: fileSize,
- partSize: partSize,
- uploadId: uploadId,
- doneParts: []
- };
- if (!(options && options.progress)) {
- _context.next = 39;
- break;
- }
- _context.next = 39;
- return options.progress(0, checkpoint, initResult.res);
- case 39:
- _context.next = 41;
- return this._resumeMultipart(checkpoint, options);
- case 41:
- return _context.abrupt("return", _context.sent);
- case 42:
- case "end":
- return _context.stop();
- }
- }
- }, _callee, this);
- }));
- function multipartUpload(_x, _x2) {
- return _multipartUpload.apply(this, arguments);
- }
- return multipartUpload;
- }();
- /*
- * Resume multipart upload from checkpoint. The checkpoint will be
- * updated after each successful part upload.
- * @param {Object} checkpoint the checkpoint
- * @param {Object} options
- */
- proto._resumeMultipart = /*#__PURE__*/function () {
- var _resumeMultipart2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3(checkpoint, options) {
- var that, file, fileSize, partSize, uploadId, doneParts, name, internalDoneParts, partOffs, numParts, multipartFinish, uploadPartJob, all, done, todo, defaultParallel, parallel, jobErr, abortEvent;
- return _regenerator.default.wrap(function _callee3$(_context3) {
- while (1) {
- switch (_context3.prev = _context3.next) {
- case 0:
- that = this;
- if (!this.isCancel()) {
- _context3.next = 3;
- break;
- }
- throw this._makeCancelEvent();
- case 3:
- file = checkpoint.file, fileSize = checkpoint.fileSize, partSize = checkpoint.partSize, uploadId = checkpoint.uploadId, doneParts = checkpoint.doneParts, name = checkpoint.name;
- internalDoneParts = [];
- if (doneParts.length > 0) {
- copy(doneParts).to(internalDoneParts);
- }
- partOffs = this._divideParts(fileSize, partSize);
- numParts = partOffs.length;
- multipartFinish = false;
- uploadPartJob = function uploadPartJob(self, partNo) {
- // eslint-disable-next-line no-async-promise-executor
- return new Promise( /*#__PURE__*/function () {
- var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(resolve, reject) {
- var pi, content, data, result, tempErr;
- return _regenerator.default.wrap(function _callee2$(_context2) {
- while (1) {
- switch (_context2.prev = _context2.next) {
- case 0:
- _context2.prev = 0;
- if (self.isCancel()) {
- _context2.next = 29;
- break;
- }
- pi = partOffs[partNo - 1];
- _context2.next = 5;
- return self._createBuffer(file, pi.start, pi.end);
- case 5:
- content = _context2.sent;
- data = {
- content: content,
- size: pi.end - pi.start
- };
- _context2.prev = 7;
- _context2.next = 10;
- return self._uploadPart(name, uploadId, partNo, data, {
- timeout: options.timeout,
- disabledMD5: options.disabledMD5
- });
- case 10:
- result = _context2.sent;
- _context2.next = 18;
- break;
- case 13:
- _context2.prev = 13;
- _context2.t0 = _context2["catch"](7);
- if (!(_context2.t0.status === 404)) {
- _context2.next = 17;
- break;
- }
- throw self._makeAbortEvent();
- case 17:
- throw _context2.t0;
- case 18:
- if (!(!self.isCancel() && !multipartFinish)) {
- _context2.next = 26;
- break;
- }
- checkpoint.doneParts.push({
- number: partNo,
- etag: result.res.headers.etag
- });
- if (!options.progress) {
- _context2.next = 23;
- break;
- }
- _context2.next = 23;
- return options.progress(doneParts.length / numParts, checkpoint, result.res);
- case 23:
- resolve({
- number: partNo,
- etag: result.res.headers.etag
- });
- _context2.next = 27;
- break;
- case 26:
- resolve();
- case 27:
- _context2.next = 30;
- break;
- case 29:
- resolve();
- case 30:
- _context2.next = 41;
- break;
- case 32:
- _context2.prev = 32;
- _context2.t1 = _context2["catch"](0);
- tempErr = new Error();
- tempErr.name = _context2.t1.name;
- tempErr.message = _context2.t1.message;
- tempErr.stack = _context2.t1.stack;
- tempErr.partNum = partNo;
- copy(_context2.t1).to(tempErr);
- reject(tempErr);
- case 41:
- case "end":
- return _context2.stop();
- }
- }
- }, _callee2, null, [[0, 32], [7, 13]]);
- }));
- return function (_x5, _x6) {
- return _ref.apply(this, arguments);
- };
- }());
- };
- all = Array.from(new Array(numParts), function (x, i) {
- return i + 1;
- });
- done = internalDoneParts.map(function (p) {
- return p.number;
- });
- todo = all.filter(function (p) {
- return done.indexOf(p) < 0;
- });
- defaultParallel = 5;
- parallel = options.parallel || defaultParallel; // upload in parallel
- _context3.next = 17;
- return this._parallel(todo, parallel, function (value) {
- return new Promise(function (resolve, reject) {
- uploadPartJob(that, value).then(function (result) {
- if (result) {
- internalDoneParts.push(result);
- }
- resolve();
- }).catch(function (err) {
- reject(err);
- });
- });
- });
- case 17:
- jobErr = _context3.sent;
- multipartFinish = true;
- abortEvent = jobErr.find(function (err) {
- return err.name === 'abort';
- });
- if (!abortEvent) {
- _context3.next = 22;
- break;
- }
- throw abortEvent;
- case 22:
- if (!this.isCancel()) {
- _context3.next = 25;
- break;
- }
- uploadPartJob = null;
- throw this._makeCancelEvent();
- case 25:
- if (!(jobErr && jobErr.length > 0)) {
- _context3.next = 28;
- break;
- }
- jobErr[0].message = "Failed to upload some parts with error: ".concat(jobErr[0].toString(), " part_num: ").concat(jobErr[0].partNum);
- throw jobErr[0];
- case 28:
- _context3.next = 30;
- return this.completeMultipartUpload(name, uploadId, internalDoneParts, options);
- case 30:
- return _context3.abrupt("return", _context3.sent);
- case 31:
- case "end":
- return _context3.stop();
- }
- }
- }, _callee3, this);
- }));
- function _resumeMultipart(_x3, _x4) {
- return _resumeMultipart2.apply(this, arguments);
- }
- return _resumeMultipart;
- }();
- /**
- * Get file size
- */
- proto._getFileSize = /*#__PURE__*/function () {
- var _getFileSize2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4(file) {
- return _regenerator.default.wrap(function _callee4$(_context4) {
- while (1) {
- switch (_context4.prev = _context4.next) {
- case 0:
- if (!isBuffer(file)) {
- _context4.next = 4;
- break;
- }
- return _context4.abrupt("return", file.length);
- case 4:
- if (!(isBlob(file) || isFile(file))) {
- _context4.next = 6;
- break;
- }
- return _context4.abrupt("return", file.size);
- case 6:
- throw new Error('_getFileSize requires Buffer/File/Blob.');
- case 7:
- case "end":
- return _context4.stop();
- }
- }
- }, _callee4);
- }));
- function _getFileSize(_x7) {
- return _getFileSize2.apply(this, arguments);
- }
- return _getFileSize;
- }();
- /*
- * Readable stream for Web File
- */
- var _require6 = require('stream'),
- Readable = _require6.Readable;
- function WebFileReadStream(file, options) {
- if (!(this instanceof WebFileReadStream)) {
- return new WebFileReadStream(file, options);
- }
- Readable.call(this, options);
- this.file = file;
- this.reader = new FileReader();
- this.start = 0;
- this.finish = false;
- this.fileBuffer = null;
- }
- util.inherits(WebFileReadStream, Readable);
- WebFileReadStream.prototype.readFileAndPush = function readFileAndPush(size) {
- if (this.fileBuffer) {
- var pushRet = true;
- while (pushRet && this.fileBuffer && this.start < this.fileBuffer.length) {
- var start = this.start;
- var end = start + size;
- end = end > this.fileBuffer.length ? this.fileBuffer.length : end;
- this.start = end;
- pushRet = this.push(this.fileBuffer.slice(start, end));
- }
- }
- };
- WebFileReadStream.prototype._read = function _read(size) {
- if (this.file && this.start >= this.file.size || this.fileBuffer && this.start >= this.fileBuffer.length || this.finish || this.start === 0 && !this.file) {
- if (!this.finish) {
- this.fileBuffer = null;
- this.finish = true;
- }
- this.push(null);
- return;
- }
- var defaultReadSize = 16 * 1024;
- size = size || defaultReadSize;
- var that = this;
- this.reader.onload = function onload(e) {
- that.fileBuffer = Buffer.from(new Uint8Array(e.target.result));
- that.file = null;
- that.readFileAndPush(size);
- };
- if (this.start === 0) {
- this.reader.readAsArrayBuffer(this.file);
- } else {
- this.readFileAndPush(size);
- }
- };
- function getBuffer(file) {
- // Some browsers do not support Blob.prototype.arrayBuffer, such as IE
- if (file.arrayBuffer) return file.arrayBuffer();
- return new Promise(function (resolve, reject) {
- var reader = new FileReader();
- reader.onload = function (e) {
- resolve(e.target.result);
- };
- reader.onerror = function (e) {
- reject(e);
- };
- reader.readAsArrayBuffer(file);
- });
- }
- proto._createBuffer = /*#__PURE__*/function () {
- var _createBuffer2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5(file, start, end) {
- var _file, fileContent;
- return _regenerator.default.wrap(function _callee5$(_context5) {
- while (1) {
- switch (_context5.prev = _context5.next) {
- case 0:
- if (!(isBlob(file) || isFile(file))) {
- _context5.next = 8;
- break;
- }
- _file = file.slice(start, end);
- _context5.next = 4;
- return getBuffer(_file);
- case 4:
- fileContent = _context5.sent;
- return _context5.abrupt("return", Buffer.from(fileContent));
- case 8:
- if (!isBuffer(file)) {
- _context5.next = 12;
- break;
- }
- return _context5.abrupt("return", file.subarray(start, end));
- case 12:
- throw new Error('_createBuffer requires File/Blob/Buffer.');
- case 13:
- case "end":
- return _context5.stop();
- }
- }
- }, _callee5);
- }));
- function _createBuffer(_x8, _x9, _x10) {
- return _createBuffer2.apply(this, arguments);
- }
- return _createBuffer;
- }();
- proto._getPartSize = function _getPartSize(fileSize, partSize) {
- var maxNumParts = 10 * 1000;
- var defaultPartSize = 1 * 1024 * 1024;
- if (!partSize) partSize = defaultPartSize;
- var safeSize = Math.ceil(fileSize / maxNumParts);
- if (partSize < safeSize) {
- partSize = safeSize;
- console.warn("partSize has been set to ".concat(partSize, ", because the partSize you provided causes partNumber to be greater than 10,000"));
- }
- return partSize;
- };
- proto._divideParts = function _divideParts(fileSize, partSize) {
- var numParts = Math.ceil(fileSize / partSize);
- var partOffs = [];
- for (var i = 0; i < numParts; i++) {
- var start = partSize * i;
- var end = Math.min(start + partSize, fileSize);
- partOffs.push({
- start: start,
- end: end
- });
- }
- return partOffs;
- };
- }).call(this)}).call(this,require("buffer").Buffer)
- },{"../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){
- "use strict";
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
- require("core-js/modules/es.function.name.js");
- require("core-js/modules/es.object.to-string.js");
- require("core-js/modules/es.regexp.to-string.js");
- require("core-js/modules/es.array.map.js");
- require("core-js/modules/es.number.constructor.js");
- require("core-js/modules/es.object.assign.js");
- require("core-js/modules/es.regexp.exec.js");
- require("core-js/modules/es.string.replace.js");
- require("core-js/modules/web.dom-collections.for-each.js");
- require("core-js/modules/es.object.keys.js");
- require("core-js/modules/es.promise.js");
- var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
- var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
- // const debug = require('debug')('ali-oss:object');
- var fs = require('fs');
- var copy = require('copy-to');
- var path = require('path');
- var mime = require('mime');
- var callback = require('../common/callback');
- var merge = require('merge-descriptors');
- var _require = require('../common/utils/isBlob'),
- isBlob = _require.isBlob;
- var _require2 = require('../common/utils/isFile'),
- isFile = _require2.isFile;
- var _require3 = require('../common/utils/isBuffer'),
- isBuffer = _require3.isBuffer;
- var _require4 = require('../common/utils/obj2xml'),
- obj2xml = _require4.obj2xml; // var assert = require('assert');
- var proto = exports;
- /**
- * Object operations
- */
- /**
- * append an object from String(file path)/Buffer/ReadableStream
- * @param {String} name the object key
- * @param {Mixed} file String(file path)/Buffer/ReadableStream
- * @param {Object} options
- * @return {Object}
- */
- proto.append = /*#__PURE__*/function () {
- var _append = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(name, file, options) {
- var result;
- return _regenerator.default.wrap(function _callee$(_context) {
- while (1) {
- switch (_context.prev = _context.next) {
- case 0:
- options = options || {};
- if (options.position === undefined) options.position = '0';
- options.subres = {
- append: '',
- position: options.position
- };
- options.method = 'POST';
- _context.next = 6;
- return this.put(name, file, options);
- case 6:
- result = _context.sent;
- result.nextAppendPosition = result.res.headers['x-oss-next-append-position'];
- return _context.abrupt("return", result);
- case 9:
- case "end":
- return _context.stop();
- }
- }
- }, _callee, this);
- }));
- function append(_x, _x2, _x3) {
- return _append.apply(this, arguments);
- }
- return append;
- }();
- /**
- * put an object from String(file path)/Buffer/ReadableStream
- * @param {String} name the object key
- * @param {Mixed} file String(file path)/Buffer/ReadableStream
- * @param {Object} options
- * {Object} options.callback The callback parameter is composed of a JSON string encoded in Base64
- * {String} options.callback.url the OSS sends a callback request to this URL
- * {String} options.callback.host The host header value for initiating callback requests
- * {String} options.callback.body The value of the request body when a callback is initiated
- * {String} options.callback.contentType The Content-Type of the callback requests initiatiated
- * {Object} options.callback.customValue Custom parameters are a map of key-values, e.g:
- * customValue = {
- * key1: 'value1',
- * key2: 'value2'
- * }
- * @return {Object}
- */
- proto.put = /*#__PURE__*/function () {
- var _put = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(name, file, options) {
- var content, method, params, result, ret;
- return _regenerator.default.wrap(function _callee2$(_context2) {
- while (1) {
- switch (_context2.prev = _context2.next) {
- case 0:
- options = options || {};
- options.disabledMD5 = options.disabledMD5 === undefined ? true : !!options.disabledMD5;
- options.headers = options.headers || {};
- name = this._objectName(name);
- if (!isBuffer(file)) {
- _context2.next = 8;
- break;
- }
- content = file;
- _context2.next = 19;
- break;
- case 8:
- if (!(isBlob(file) || isFile(file))) {
- _context2.next = 18;
- break;
- }
- if (!options.mime) {
- if (isFile(file)) {
- options.mime = mime.getType(path.extname(file.name));
- } else {
- options.mime = file.type;
- }
- }
- _context2.next = 12;
- return this._createBuffer(file, 0, file.size);
- case 12:
- content = _context2.sent;
- _context2.next = 15;
- return this._getFileSize(file);
- case 15:
- options.contentLength = _context2.sent;
- _context2.next = 19;
- break;
- case 18:
- throw new TypeError('Must provide Buffer/Blob/File for put.');
- case 19:
- this._convertMetaToHeaders(options.meta, options.headers);
- method = options.method || 'PUT';
- params = this._objectRequestParams(method, name, options);
- callback.encodeCallback(params, options);
- params.mime = options.mime;
- params.disabledMD5 = options.disabledMD5;
- params.content = content;
- params.successStatuses = [200];
- _context2.next = 29;
- return this.request(params);
- case 29:
- result = _context2.sent;
- ret = {
- name: name,
- url: this._objectUrl(name),
- res: result.res
- };
- if (params.headers && params.headers['x-oss-callback']) {
- ret.data = JSON.parse(result.data.toString());
- }
- return _context2.abrupt("return", ret);
- case 33:
- case "end":
- return _context2.stop();
- }
- }
- }, _callee2, this);
- }));
- function put(_x4, _x5, _x6) {
- return _put.apply(this, arguments);
- }
- return put;
- }();
- /**
- * put an object from ReadableStream. If `options.contentLength` is
- * not provided, chunked encoding is used.
- * @param {String} name the object key
- * @param {Readable} stream the ReadableStream
- * @param {Object} options
- * @return {Object}
- */
- proto.putStream = /*#__PURE__*/function () {
- var _putStream = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3(name, stream, options) {
- var method, params, result, ret;
- return _regenerator.default.wrap(function _callee3$(_context3) {
- while (1) {
- switch (_context3.prev = _context3.next) {
- case 0:
- options = options || {};
- options.headers = options.headers || {};
- name = this._objectName(name);
- if (options.contentLength) {
- options.headers['Content-Length'] = options.contentLength;
- } else {
- options.headers['Transfer-Encoding'] = 'chunked';
- }
- this._convertMetaToHeaders(options.meta, options.headers);
- method = options.method || 'PUT';
- params = this._objectRequestParams(method, name, options);
- callback.encodeCallback(params, options);
- params.mime = options.mime;
- params.stream = stream;
- params.successStatuses = [200];
- _context3.next = 13;
- return this.request(params);
- case 13:
- result = _context3.sent;
- ret = {
- name: name,
- url: this._objectUrl(name),
- res: result.res
- };
- if (params.headers && params.headers['x-oss-callback']) {
- ret.data = JSON.parse(result.data.toString());
- }
- return _context3.abrupt("return", ret);
- case 17:
- case "end":
- return _context3.stop();
- }
- }
- }, _callee3, this);
- }));
- function putStream(_x7, _x8, _x9) {
- return _putStream.apply(this, arguments);
- }
- return putStream;
- }();
- merge(proto, require('../common/object/copyObject'));
- merge(proto, require('../common/object/getObjectTagging'));
- merge(proto, require('../common/object/putObjectTagging'));
- merge(proto, require('../common/object/deleteObjectTagging'));
- merge(proto, require('../common/image'));
- merge(proto, require('../common/object/getBucketVersions'));
- merge(proto, require('../common/object/getACL'));
- merge(proto, require('../common/object/putACL'));
- merge(proto, require('../common/object/head'));
- merge(proto, require('../common/object/delete'));
- merge(proto, require('../common/object/get'));
- merge(proto, require('../common/object/putSymlink'));
- merge(proto, require('../common/object/getSymlink'));
- merge(proto, require('../common/object/deleteMulti'));
- merge(proto, require('../common/object/getObjectMeta'));
- merge(proto, require('../common/object/getObjectUrl'));
- merge(proto, require('../common/object/generateObjectUrl'));
- merge(proto, require('../common/object/signatureUrl'));
- proto.putMeta = /*#__PURE__*/function () {
- var _putMeta = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4(name, meta, options) {
- var copyResult;
- return _regenerator.default.wrap(function _callee4$(_context4) {
- while (1) {
- switch (_context4.prev = _context4.next) {
- case 0:
- _context4.next = 2;
- return this.copy(name, name, {
- meta: meta || {},
- timeout: options && options.timeout,
- ctx: options && options.ctx
- });
- case 2:
- copyResult = _context4.sent;
- return _context4.abrupt("return", copyResult);
- case 4:
- case "end":
- return _context4.stop();
- }
- }
- }, _callee4, this);
- }));
- function putMeta(_x10, _x11, _x12) {
- return _putMeta.apply(this, arguments);
- }
- return putMeta;
- }();
- proto.list = /*#__PURE__*/function () {
- var _list = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5(query, options) {
- var params, result, objects, that, prefixes;
- return _regenerator.default.wrap(function _callee5$(_context5) {
- while (1) {
- switch (_context5.prev = _context5.next) {
- case 0:
- // prefix, marker, max-keys, delimiter
- params = this._objectRequestParams('GET', '', options);
- params.query = query;
- params.xmlResponse = true;
- params.successStatuses = [200];
- _context5.next = 6;
- return this.request(params);
- case 6:
- result = _context5.sent;
- objects = result.data.Contents || [];
- that = this;
- if (objects) {
- if (!Array.isArray(objects)) {
- objects = [objects];
- }
- objects = objects.map(function (obj) {
- return {
- name: obj.Key,
- url: that._objectUrl(obj.Key),
- lastModified: obj.LastModified,
- etag: obj.ETag,
- type: obj.Type,
- size: Number(obj.Size),
- storageClass: obj.StorageClass,
- owner: {
- id: obj.Owner.ID,
- displayName: obj.Owner.DisplayName
- }
- };
- });
- }
- prefixes = result.data.CommonPrefixes || null;
- if (prefixes) {
- if (!Array.isArray(prefixes)) {
- prefixes = [prefixes];
- }
- prefixes = prefixes.map(function (item) {
- return item.Prefix;
- });
- }
- return _context5.abrupt("return", {
- res: result.res,
- objects: objects,
- prefixes: prefixes,
- nextMarker: result.data.NextMarker || null,
- isTruncated: result.data.IsTruncated === 'true'
- });
- case 13:
- case "end":
- return _context5.stop();
- }
- }
- }, _callee5, this);
- }));
- function list(_x13, _x14) {
- return _list.apply(this, arguments);
- }
- return list;
- }();
- proto.listV2 = /*#__PURE__*/function () {
- var _listV = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6(query) {
- var options,
- continuation_token,
- params,
- result,
- objects,
- that,
- prefixes,
- _args6 = arguments;
- return _regenerator.default.wrap(function _callee6$(_context6) {
- while (1) {
- switch (_context6.prev = _context6.next) {
- case 0:
- options = _args6.length > 1 && _args6[1] !== undefined ? _args6[1] : {};
- continuation_token = query['continuation-token'] || query.continuationToken;
- if (continuation_token) {
- options.subres = Object.assign({
- 'continuation-token': continuation_token
- }, options.subres);
- }
- params = this._objectRequestParams('GET', '', options);
- params.query = Object.assign({
- 'list-type': 2
- }, query);
- delete params.query['continuation-token'];
- delete params.query.continuationToken;
- params.xmlResponse = true;
- params.successStatuses = [200];
- _context6.next = 11;
- return this.request(params);
- case 11:
- result = _context6.sent;
- objects = result.data.Contents || [];
- that = this;
- if (objects) {
- if (!Array.isArray(objects)) {
- objects = [objects];
- }
- objects = objects.map(function (obj) {
- return {
- name: obj.Key,
- url: that._objectUrl(obj.Key),
- lastModified: obj.LastModified,
- etag: obj.ETag,
- type: obj.Type,
- size: Number(obj.Size),
- storageClass: obj.StorageClass,
- owner: obj.Owner ? {
- id: obj.Owner.ID,
- displayName: obj.Owner.DisplayName
- } : null
- };
- });
- }
- prefixes = result.data.CommonPrefixes || null;
- if (prefixes) {
- if (!Array.isArray(prefixes)) {
- prefixes = [prefixes];
- }
- prefixes = prefixes.map(function (item) {
- return item.Prefix;
- });
- }
- return _context6.abrupt("return", {
- res: result.res,
- objects: objects,
- prefixes: prefixes,
- isTruncated: result.data.IsTruncated === 'true',
- keyCount: +result.data.KeyCount,
- continuationToken: result.data.ContinuationToken || null,
- nextContinuationToken: result.data.NextContinuationToken || null
- });
- case 18:
- case "end":
- return _context6.stop();
- }
- }
- }, _callee6, this);
- }));
- function listV2(_x15) {
- return _listV.apply(this, arguments);
- }
- return listV2;
- }();
- /**
- * Restore Object
- * @param {String} name the object key
- * @param {Object} options
- * @returns {{res}}
- */
- proto.restore = /*#__PURE__*/function () {
- var _restore = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee7(name) {
- var options,
- params,
- paramsXMLObj,
- result,
- _args7 = arguments;
- return _regenerator.default.wrap(function _callee7$(_context7) {
- while (1) {
- switch (_context7.prev = _context7.next) {
- case 0:
- options = _args7.length > 1 && _args7[1] !== undefined ? _args7[1] : {
- type: 'Archive'
- };
- options = options || {};
- options.subres = Object.assign({
- restore: ''
- }, options.subres);
- if (options.versionId) {
- options.subres.versionId = options.versionId;
- }
- params = this._objectRequestParams('POST', name, options);
- if (options.type === 'ColdArchive') {
- paramsXMLObj = {
- RestoreRequest: {
- Days: options.Days ? options.Days : 2,
- JobParameters: {
- Tier: options.JobParameters ? options.JobParameters : 'Standard'
- }
- }
- };
- params.content = obj2xml(paramsXMLObj, {
- headers: true
- });
- params.mime = 'xml';
- }
- params.successStatuses = [202];
- _context7.next = 9;
- return this.request(params);
- case 9:
- result = _context7.sent;
- return _context7.abrupt("return", {
- res: result.res
- });
- case 11:
- case "end":
- return _context7.stop();
- }
- }
- }, _callee7, this);
- }));
- function restore(_x16) {
- return _restore.apply(this, arguments);
- }
- return restore;
- }();
- proto._objectUrl = function _objectUrl(name) {
- return this._getReqUrl({
- bucket: this.options.bucket,
- object: name
- });
- };
- /**
- * generator request params
- * @return {Object} params
- *
- * @api private
- */
- proto._objectRequestParams = function _objectRequestParams(method, name, options) {
- if (!this.options.bucket && !this.options.cname) {
- throw new Error('Please create a bucket first');
- }
- options = options || {};
- name = this._objectName(name);
- var params = {
- object: name,
- bucket: this.options.bucket,
- method: method,
- subres: options && options.subres,
- timeout: options && options.timeout,
- ctx: options && options.ctx
- };
- if (options.headers) {
- params.headers = {};
- copy(options.headers).to(params.headers);
- }
- return params;
- };
- proto._objectName = function _objectName(name) {
- return name.replace(/^\/+/, '');
- };
- proto._convertMetaToHeaders = function _convertMetaToHeaders(meta, headers) {
- if (!meta) {
- return;
- }
- Object.keys(meta).forEach(function (k) {
- headers["x-oss-meta-".concat(k)] = meta[k];
- });
- };
- proto._deleteFileSafe = function _deleteFileSafe(filepath) {
- var _this = this;
- return new Promise(function (resolve) {
- fs.exists(filepath, function (exists) {
- if (!exists) {
- resolve();
- } else {
- fs.unlink(filepath, function (err) {
- if (err) {
- _this.debug('unlink %j error: %s', filepath, err, 'error');
- }
- resolve();
- });
- }
- });
- });
- };
- },{"../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){
- "use strict";
- exports.version = "6.17.1";
- },{}],7:[function(require,module,exports){
- "use strict";
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
- var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
- var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.abortBucketWorm = void 0;
- var checkBucketName_1 = require("../utils/checkBucketName");
- function abortBucketWorm(_x, _x2) {
- return _abortBucketWorm.apply(this, arguments);
- }
- function _abortBucketWorm() {
- _abortBucketWorm = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(name, options) {
- var params, result;
- return _regenerator.default.wrap(function _callee$(_context) {
- while (1) {
- switch (_context.prev = _context.next) {
- case 0:
- checkBucketName_1.checkBucketName(name);
- params = this._bucketRequestParams('DELETE', name, 'worm', options);
- _context.next = 4;
- return this.request(params);
- case 4:
- result = _context.sent;
- return _context.abrupt("return", {
- res: result.res,
- status: result.status
- });
- case 6:
- case "end":
- return _context.stop();
- }
- }
- }, _callee, this);
- }));
- return _abortBucketWorm.apply(this, arguments);
- }
- exports.abortBucketWorm = abortBucketWorm;
- },{"../utils/checkBucketName":50,"@babel/runtime/helpers/asyncToGenerator":73,"@babel/runtime/helpers/interopRequireDefault":74,"@babel/runtime/regenerator":76}],8:[function(require,module,exports){
- "use strict";
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
- var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
- var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.completeBucketWorm = void 0;
- var checkBucketName_1 = require("../utils/checkBucketName");
- function completeBucketWorm(_x, _x2, _x3) {
- return _completeBucketWorm.apply(this, arguments);
- }
- function _completeBucketWorm() {
- _completeBucketWorm = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(name, wormId, options) {
- var params, result;
- return _regenerator.default.wrap(function _callee$(_context) {
- while (1) {
- switch (_context.prev = _context.next) {
- case 0:
- checkBucketName_1.checkBucketName(name);
- params = this._bucketRequestParams('POST', name, {
- wormId: wormId
- }, options);
- _context.next = 4;
- return this.request(params);
- case 4:
- result = _context.sent;
- return _context.abrupt("return", {
- res: result.res,
- status: result.status
- });
- case 6:
- case "end":
- return _context.stop();
- }
- }
- }, _callee, this);
- }));
- return _completeBucketWorm.apply(this, arguments);
- }
- exports.completeBucketWorm = completeBucketWorm;
- },{"../utils/checkBucketName":50,"@babel/runtime/helpers/asyncToGenerator":73,"@babel/runtime/helpers/interopRequireDefault":74,"@babel/runtime/regenerator":76}],9:[function(require,module,exports){
- "use strict";
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
- var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
- require("core-js/modules/es.object.assign.js");
- var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.deleteBucketInventory = void 0;
- var checkBucketName_1 = require("../utils/checkBucketName");
- /**
- * deleteBucketInventory
- * @param {String} bucketName - bucket name
- * @param {String} inventoryId
- * @param {Object} options
- */
- function deleteBucketInventory(_x, _x2) {
- return _deleteBucketInventory.apply(this, arguments);
- }
- function _deleteBucketInventory() {
- _deleteBucketInventory = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(bucketName, inventoryId) {
- var options,
- subres,
- params,
- result,
- _args = arguments;
- return _regenerator.default.wrap(function _callee$(_context) {
- while (1) {
- switch (_context.prev = _context.next) {
- case 0:
- options = _args.length > 2 && _args[2] !== undefined ? _args[2] : {};
- subres = Object.assign({
- inventory: '',
- inventoryId: inventoryId
- }, options.subres);
- checkBucketName_1.checkBucketName(bucketName);
- params = this._bucketRequestParams('DELETE', bucketName, subres, options);
- params.successStatuses = [204];
- _context.next = 7;
- return this.request(params);
- case 7:
- result = _context.sent;
- return _context.abrupt("return", {
- status: result.status,
- res: result.res
- });
- case 9:
- case "end":
- return _context.stop();
- }
- }
- }, _callee, this);
- }));
- return _deleteBucketInventory.apply(this, arguments);
- }
- exports.deleteBucketInventory = deleteBucketInventory;
- },{"../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){
- "use strict";
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
- var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
- var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
- var _require = require('../utils/checkBucketName'),
- _checkBucketName = _require.checkBucketName;
- var proto = exports;
- proto.deleteBucketLifecycle = /*#__PURE__*/function () {
- var _deleteBucketLifecycle = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(name, options) {
- var params, result;
- return _regenerator.default.wrap(function _callee$(_context) {
- while (1) {
- switch (_context.prev = _context.next) {
- case 0:
- _checkBucketName(name);
- params = this._bucketRequestParams('DELETE', name, 'lifecycle', options);
- params.successStatuses = [204];
- _context.next = 5;
- return this.request(params);
- case 5:
- result = _context.sent;
- return _context.abrupt("return", {
- res: result.res
- });
- case 7:
- case "end":
- return _context.stop();
- }
- }
- }, _callee, this);
- }));
- function deleteBucketLifecycle(_x, _x2) {
- return _deleteBucketLifecycle.apply(this, arguments);
- }
- return deleteBucketLifecycle;
- }();
- },{"../utils/checkBucketName":50,"@babel/runtime/helpers/asyncToGenerator":73,"@babel/runtime/helpers/interopRequireDefault":74,"@babel/runtime/regenerator":76}],11:[function(require,module,exports){
- "use strict";
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
- var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
- var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
- var _require = require('../utils/checkBucketName'),
- _checkBucketName = _require.checkBucketName;
- var proto = exports;
- proto.deleteBucketWebsite = /*#__PURE__*/function () {
- var _deleteBucketWebsite = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(name, options) {
- var params, result;
- return _regenerator.default.wrap(function _callee$(_context) {
- while (1) {
- switch (_context.prev = _context.next) {
- case 0:
- _checkBucketName(name);
- params = this._bucketRequestParams('DELETE', name, 'website', options);
- params.successStatuses = [204];
- _context.next = 5;
- return this.request(params);
- case 5:
- result = _context.sent;
- return _context.abrupt("return", {
- res: result.res
- });
- case 7:
- case "end":
- return _context.stop();
- }
- }
- }, _callee, this);
- }));
- function deleteBucketWebsite(_x, _x2) {
- return _deleteBucketWebsite.apply(this, arguments);
- }
- return deleteBucketWebsite;
- }();
- },{"../utils/checkBucketName":50,"@babel/runtime/helpers/asyncToGenerator":73,"@babel/runtime/helpers/interopRequireDefault":74,"@babel/runtime/regenerator":76}],12:[function(require,module,exports){
- "use strict";
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
- var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
- var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.extendBucketWorm = void 0;
- var checkBucketName_1 = require("../utils/checkBucketName");
- var obj2xml_1 = require("../utils/obj2xml");
- function extendBucketWorm(_x, _x2, _x3, _x4) {
- return _extendBucketWorm.apply(this, arguments);
- }
- function _extendBucketWorm() {
- _extendBucketWorm = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(name, wormId, days, options) {
- var params, paramlXMLObJ, result;
- return _regenerator.default.wrap(function _callee$(_context) {
- while (1) {
- switch (_context.prev = _context.next) {
- case 0:
- checkBucketName_1.checkBucketName(name);
- params = this._bucketRequestParams('POST', name, {
- wormExtend: '',
- wormId: wormId
- }, options);
- paramlXMLObJ = {
- ExtendWormConfiguration: {
- RetentionPeriodInDays: days
- }
- };
- params.mime = 'xml';
- params.content = obj2xml_1.obj2xml(paramlXMLObJ, {
- headers: true
- });
- params.successStatuses = [200];
- _context.next = 8;
- return this.request(params);
- case 8:
- result = _context.sent;
- return _context.abrupt("return", {
- res: result.res,
- status: result.status
- });
- case 10:
- case "end":
- return _context.stop();
- }
- }
- }, _callee, this);
- }));
- return _extendBucketWorm.apply(this, arguments);
- }
- exports.extendBucketWorm = extendBucketWorm;
- },{"../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){
- "use strict";
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
- var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
- require("core-js/modules/es.object.assign.js");
- var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.getBucketInventory = void 0;
- var checkBucketName_1 = require("../utils/checkBucketName");
- var formatInventoryConfig_1 = require("../utils/formatInventoryConfig");
- /**
- * getBucketInventory
- * @param {String} bucketName - bucket name
- * @param {String} inventoryId
- * @param {Object} options
- */
- function getBucketInventory(_x, _x2) {
- return _getBucketInventory.apply(this, arguments);
- }
- function _getBucketInventory() {
- _getBucketInventory = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(bucketName, inventoryId) {
- var options,
- subres,
- params,
- result,
- _args = arguments;
- return _regenerator.default.wrap(function _callee$(_context) {
- while (1) {
- switch (_context.prev = _context.next) {
- case 0:
- options = _args.length > 2 && _args[2] !== undefined ? _args[2] : {};
- subres = Object.assign({
- inventory: '',
- inventoryId: inventoryId
- }, options.subres);
- checkBucketName_1.checkBucketName(bucketName);
- params = this._bucketRequestParams('GET', bucketName, subres, options);
- params.successStatuses = [200];
- params.xmlResponse = true;
- _context.next = 8;
- return this.request(params);
- case 8:
- result = _context.sent;
- return _context.abrupt("return", {
- status: result.status,
- res: result.res,
- inventory: formatInventoryConfig_1.formatInventoryConfig(result.data)
- });
- case 10:
- case "end":
- return _context.stop();
- }
- }
- }, _callee, this);
- }));
- return _getBucketInventory.apply(this, arguments);
- }
- exports.getBucketInventory = getBucketInventory;
- },{"../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){
- "use strict";
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
- var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
- require("core-js/modules/es.array.map.js");
- var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
- var _require = require('../utils/checkBucketName'),
- _checkBucketName = _require.checkBucketName;
- var _require2 = require('../utils/isArray'),
- isArray = _require2.isArray;
- var _require3 = require('../utils/formatObjKey'),
- formatObjKey = _require3.formatObjKey;
- var proto = exports;
- proto.getBucketLifecycle = /*#__PURE__*/function () {
- var _getBucketLifecycle = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(name, options) {
- var params, result, rules;
- return _regenerator.default.wrap(function _callee$(_context) {
- while (1) {
- switch (_context.prev = _context.next) {
- case 0:
- _checkBucketName(name);
- params = this._bucketRequestParams('GET', name, 'lifecycle', options);
- params.successStatuses = [200];
- params.xmlResponse = true;
- _context.next = 6;
- return this.request(params);
- case 6:
- result = _context.sent;
- rules = result.data.Rule || null;
- if (rules) {
- if (!isArray(rules)) {
- rules = [rules];
- }
- rules = rules.map(function (_) {
- if (_.ID) {
- _.id = _.ID;
- delete _.ID;
- }
- if (_.Tag && !isArray(_.Tag)) {
- _.Tag = [_.Tag];
- }
- return formatObjKey(_, 'firstLowerCase');
- });
- }
- return _context.abrupt("return", {
- rules: rules,
- res: result.res
- });
- case 10:
- case "end":
- return _context.stop();
- }
- }
- }, _callee, this);
- }));
- function getBucketLifecycle(_x, _x2) {
- return _getBucketLifecycle.apply(this, arguments);
- }
- return getBucketLifecycle;
- }();
- },{"../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){
- "use strict";
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
- var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
- var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
- var _require = require('../utils/checkBucketName'),
- _checkBucketName = _require.checkBucketName;
- var proto = exports;
- /**
- * getBucketVersioning
- * @param {String} bucketName - bucket name
- */
- proto.getBucketVersioning = /*#__PURE__*/function () {
- var _getBucketVersioning = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(bucketName, options) {
- var params, result, versionStatus;
- return _regenerator.default.wrap(function _callee$(_context) {
- while (1) {
- switch (_context.prev = _context.next) {
- case 0:
- _checkBucketName(bucketName);
- params = this._bucketRequestParams('GET', bucketName, 'versioning', options);
- params.xmlResponse = true;
- params.successStatuses = [200];
- _context.next = 6;
- return this.request(params);
- case 6:
- result = _context.sent;
- versionStatus = result.data.Status;
- return _context.abrupt("return", {
- status: result.status,
- versionStatus: versionStatus,
- res: result.res
- });
- case 9:
- case "end":
- return _context.stop();
- }
- }
- }, _callee, this);
- }));
- function getBucketVersioning(_x, _x2) {
- return _getBucketVersioning.apply(this, arguments);
- }
- return getBucketVersioning;
- }();
- },{"../utils/checkBucketName":50,"@babel/runtime/helpers/asyncToGenerator":73,"@babel/runtime/helpers/interopRequireDefault":74,"@babel/runtime/regenerator":76}],16:[function(require,module,exports){
- "use strict";
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
- var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
- var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
- var _require = require('../utils/checkBucketName'),
- _checkBucketName = _require.checkBucketName;
- var _require2 = require('../utils/isObject'),
- isObject = _require2.isObject;
- var proto = exports;
- proto.getBucketWebsite = /*#__PURE__*/function () {
- var _getBucketWebsite = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(name, options) {
- var params, result, routingRules;
- return _regenerator.default.wrap(function _callee$(_context) {
- while (1) {
- switch (_context.prev = _context.next) {
- case 0:
- _checkBucketName(name);
- params = this._bucketRequestParams('GET', name, 'website', options);
- params.successStatuses = [200];
- params.xmlResponse = true;
- _context.next = 6;
- return this.request(params);
- case 6:
- result = _context.sent;
- routingRules = [];
- if (result.data.RoutingRules && result.data.RoutingRules.RoutingRule) {
- if (isObject(result.data.RoutingRules.RoutingRule)) {
- routingRules = [result.data.RoutingRules.RoutingRule];
- } else {
- routingRules = result.data.RoutingRules.RoutingRule;
- }
- }
- return _context.abrupt("return", {
- index: result.data.IndexDocument && result.data.IndexDocument.Suffix || '',
- supportSubDir: result.data.IndexDocument && result.data.IndexDocument.SupportSubDir || 'false',
- type: result.data.IndexDocument && result.data.IndexDocument.Type,
- routingRules: routingRules,
- error: result.data.ErrorDocument && result.data.ErrorDocument.Key || null,
- res: result.res
- });
- case 10:
- case "end":
- return _context.stop();
- }
- }
- }, _callee, this);
- }));
- function getBucketWebsite(_x, _x2) {
- return _getBucketWebsite.apply(this, arguments);
- }
- return getBucketWebsite;
- }();
- },{"../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){
- "use strict";
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
- var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
- require("core-js/modules/es.object.assign.js");
- var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.getBucketWorm = void 0;
- var checkBucketName_1 = require("../utils/checkBucketName");
- var dataFix_1 = require("../utils/dataFix");
- function getBucketWorm(_x, _x2) {
- return _getBucketWorm.apply(this, arguments);
- }
- function _getBucketWorm() {
- _getBucketWorm = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(name, options) {
- var params, result;
- return _regenerator.default.wrap(function _callee$(_context) {
- while (1) {
- switch (_context.prev = _context.next) {
- case 0:
- checkBucketName_1.checkBucketName(name);
- params = this._bucketRequestParams('GET', name, 'worm', options);
- params.successStatuses = [200];
- params.xmlResponse = true;
- _context.next = 6;
- return this.request(params);
- case 6:
- result = _context.sent;
- dataFix_1.dataFix(result.data, {
- lowerFirst: true,
- rename: {
- RetentionPeriodInDays: 'days'
- }
- });
- return _context.abrupt("return", Object.assign(Object.assign({}, result.data), {
- res: result.res,
- status: result.status
- }));
- case 9:
- case "end":
- return _context.stop();
- }
- }
- }, _callee, this);
- }));
- return _getBucketWorm.apply(this, arguments);
- }
- exports.getBucketWorm = getBucketWorm;
- },{"../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){
- "use strict";
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
- var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
- var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.initiateBucketWorm = void 0;
- var obj2xml_1 = require("../utils/obj2xml");
- var checkBucketName_1 = require("../utils/checkBucketName");
- function initiateBucketWorm(_x, _x2, _x3) {
- return _initiateBucketWorm.apply(this, arguments);
- }
- function _initiateBucketWorm() {
- _initiateBucketWorm = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(name, days, options) {
- var params, paramlXMLObJ, result;
- return _regenerator.default.wrap(function _callee$(_context) {
- while (1) {
- switch (_context.prev = _context.next) {
- case 0:
- checkBucketName_1.checkBucketName(name);
- params = this._bucketRequestParams('POST', name, 'worm', options);
- paramlXMLObJ = {
- InitiateWormConfiguration: {
- RetentionPeriodInDays: days
- }
- };
- params.mime = 'xml';
- params.content = obj2xml_1.obj2xml(paramlXMLObJ, {
- headers: true
- });
- params.successStatuses = [200];
- _context.next = 8;
- return this.request(params);
- case 8:
- result = _context.sent;
- return _context.abrupt("return", {
- res: result.res,
- wormId: result.res.headers['x-oss-worm-id'],
- status: result.status
- });
- case 10:
- case "end":
- return _context.stop();
- }
- }
- }, _callee, this);
- }));
- return _initiateBucketWorm.apply(this, arguments);
- }
- exports.initiateBucketWorm = initiateBucketWorm;
- },{"../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){
- "use strict";
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
- var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
- require("core-js/modules/es.object.assign.js");
- var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.listBucketInventory = void 0;
- var checkBucketName_1 = require("../utils/checkBucketName");
- var formatInventoryConfig_1 = require("../utils/formatInventoryConfig");
- /**
- * listBucketInventory
- * @param {String} bucketName - bucket name
- * @param {String} inventoryId
- * @param {Object} options
- */
- function listBucketInventory(_x) {
- return _listBucketInventory.apply(this, arguments);
- }
- function _listBucketInventory() {
- _listBucketInventory = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(bucketName) {
- var options,
- continuationToken,
- subres,
- params,
- result,
- data,
- res,
- status,
- _args = arguments;
- return _regenerator.default.wrap(function _callee$(_context) {
- while (1) {
- switch (_context.prev = _context.next) {
- case 0:
- options = _args.length > 1 && _args[1] !== undefined ? _args[1] : {};
- continuationToken = options.continuationToken;
- subres = Object.assign({
- inventory: ''
- }, continuationToken && {
- 'continuation-token': continuationToken
- }, options.subres);
- checkBucketName_1.checkBucketName(bucketName);
- params = this._bucketRequestParams('GET', bucketName, subres, options);
- params.successStatuses = [200];
- params.xmlResponse = true;
- _context.next = 9;
- return this.request(params);
- case 9:
- result = _context.sent;
- data = result.data, res = result.res, status = result.status;
- return _context.abrupt("return", {
- isTruncated: data.IsTruncated === 'true',
- nextContinuationToken: data.NextContinuationToken,
- inventoryList: formatInventoryConfig_1.formatInventoryConfig(data.InventoryConfiguration, true),
- status: status,
- res: res
- });
- case 12:
- case "end":
- return _context.stop();
- }
- }
- }, _callee, this);
- }));
- return _listBucketInventory.apply(this, arguments);
- }
- exports.listBucketInventory = listBucketInventory;
- },{"../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){
- "use strict";
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
- var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
- require("core-js/modules/es.object.assign.js");
- require("core-js/modules/es.array.concat.js");
- var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.putBucketInventory = void 0;
- var checkBucketName_1 = require("../utils/checkBucketName");
- var obj2xml_1 = require("../utils/obj2xml");
- /**
- * putBucketInventory
- * @param {String} bucketName - bucket name
- * @param {Inventory} inventory
- * @param {Object} options
- */
- function putBucketInventory(_x, _x2) {
- return _putBucketInventory.apply(this, arguments);
- }
- function _putBucketInventory() {
- _putBucketInventory = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(bucketName, inventory) {
- var options,
- subres,
- OSSBucketDestination,
- optionalFields,
- includedObjectVersions,
- destinationBucketPrefix,
- rolePrefix,
- paramXMLObj,
- paramXML,
- params,
- result,
- _args = arguments;
- return _regenerator.default.wrap(function _callee$(_context) {
- while (1) {
- switch (_context.prev = _context.next) {
- case 0:
- options = _args.length > 2 && _args[2] !== undefined ? _args[2] : {};
- subres = Object.assign({
- inventory: '',
- inventoryId: inventory.id
- }, options.subres);
- checkBucketName_1.checkBucketName(bucketName);
- OSSBucketDestination = inventory.OSSBucketDestination, optionalFields = inventory.optionalFields, includedObjectVersions = inventory.includedObjectVersions;
- destinationBucketPrefix = 'acs:oss:::';
- rolePrefix = "acs:ram::".concat(OSSBucketDestination.accountId, ":role/");
- paramXMLObj = {
- InventoryConfiguration: {
- Id: inventory.id,
- IsEnabled: inventory.isEnabled,
- Filter: {
- Prefix: inventory.prefix || ''
- },
- Destination: {
- OSSBucketDestination: {
- Format: OSSBucketDestination.format,
- AccountId: OSSBucketDestination.accountId,
- RoleArn: "".concat(rolePrefix).concat(OSSBucketDestination.rolename),
- Bucket: "".concat(destinationBucketPrefix).concat(OSSBucketDestination.bucket),
- Prefix: OSSBucketDestination.prefix || '',
- Encryption: OSSBucketDestination.encryption || ''
- }
- },
- Schedule: {
- Frequency: inventory.frequency
- },
- IncludedObjectVersions: includedObjectVersions,
- OptionalFields: {
- Field: (optionalFields === null || optionalFields === void 0 ? void 0 : optionalFields.field) || []
- }
- }
- };
- paramXML = obj2xml_1.obj2xml(paramXMLObj, {
- headers: true,
- firstUpperCase: true
- });
- params = this._bucketRequestParams('PUT', bucketName, subres, options);
- params.successStatuses = [200];
- params.mime = 'xml';
- params.content = paramXML;
- _context.next = 14;
- return this.request(params);
- case 14:
- result = _context.sent;
- return _context.abrupt("return", {
- status: result.status,
- res: result.res
- });
- case 16:
- case "end":
- return _context.stop();
- }
- }
- }, _callee, this);
- }));
- return _putBucketInventory.apply(this, arguments);
- }
- exports.putBucketInventory = putBucketInventory;
- },{"../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){
- "use strict";
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
- var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
- require("core-js/modules/web.dom-collections.for-each.js");
- require("core-js/modules/es.array.includes.js");
- var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
- /* eslint-disable no-use-before-define */
- var _require = require('../utils/checkBucketName'),
- _checkBucketName = _require.checkBucketName;
- var _require2 = require('../utils/isArray'),
- isArray = _require2.isArray;
- var _require3 = require('../utils/deepCopy'),
- deepCopy = _require3.deepCopy;
- var _require4 = require('../utils/isObject'),
- isObject = _require4.isObject;
- var _require5 = require('../utils/obj2xml'),
- obj2xml = _require5.obj2xml;
- var _require6 = require('../utils/checkObjectTag'),
- checkObjectTag = _require6.checkObjectTag;
- var _require7 = require('../utils/getStrBytesCount'),
- getStrBytesCount = _require7.getStrBytesCount;
- var proto = exports;
- proto.putBucketLifecycle = /*#__PURE__*/function () {
- var _putBucketLifecycle = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(name, rules, options) {
- var params, Rule, paramXMLObj, paramXML, result;
- return _regenerator.default.wrap(function _callee$(_context) {
- while (1) {
- switch (_context.prev = _context.next) {
- case 0:
- _checkBucketName(name);
- if (isArray(rules)) {
- _context.next = 3;
- break;
- }
- throw new Error('rules must be Array');
- case 3:
- params = this._bucketRequestParams('PUT', name, 'lifecycle', options);
- Rule = [];
- paramXMLObj = {
- LifecycleConfiguration: {
- Rule: Rule
- }
- };
- rules.forEach(function (_) {
- defaultDaysAndDate2Expiration(_); // todo delete, 兼容旧版本
- checkRule(_);
- if (_.id) {
- _.ID = _.id;
- delete _.id;
- }
- Rule.push(_);
- });
- paramXML = obj2xml(paramXMLObj, {
- headers: true,
- firstUpperCase: true
- });
- params.content = paramXML;
- params.mime = 'xml';
- params.successStatuses = [200];
- _context.next = 13;
- return this.request(params);
- case 13:
- result = _context.sent;
- return _context.abrupt("return", {
- res: result.res
- });
- case 15:
- case "end":
- return _context.stop();
- }
- }
- }, _callee, this);
- }));
- function putBucketLifecycle(_x, _x2, _x3) {
- return _putBucketLifecycle.apply(this, arguments);
- }
- return putBucketLifecycle;
- }(); // todo delete, 兼容旧版本
- function defaultDaysAndDate2Expiration(obj) {
- if (obj.days) {
- obj.expiration = {
- days: obj.days
- };
- }
- if (obj.date) {
- obj.expiration = {
- createdBeforeDate: obj.date
- };
- }
- }
- function checkDaysAndDate(obj, key) {
- var days = obj.days,
- createdBeforeDate = obj.createdBeforeDate;
- if (!days && !createdBeforeDate) {
- throw new Error("".concat(key, " must includes days or createdBeforeDate"));
- } else if (days && !/^[1-9][0-9]*$/.test(days)) {
- throw new Error('days must be a positive integer');
- } else if (createdBeforeDate && !/\d{4}-\d{2}-\d{2}T00:00:00.000Z/.test(createdBeforeDate)) {
- throw new Error('createdBeforeDate must be date and conform to iso8601 format');
- }
- }
- function handleCheckTag(tag) {
- if (!isArray(tag) && !isObject(tag)) {
- throw new Error('tag must be Object or Array');
- }
- tag = isObject(tag) ? [tag] : tag;
- var tagObj = {};
- var tagClone = deepCopy(tag);
- tagClone.forEach(function (v) {
- tagObj[v.key] = v.value;
- });
- checkObjectTag(tagObj);
- }
- function checkRule(rule) {
- if (rule.id && getStrBytesCount(rule.id) > 255) throw new Error('ID is composed of 255 bytes at most');
- if (rule.prefix === undefined) throw new Error('Rule must includes prefix');
- if (!['Enabled', 'Disabled'].includes(rule.status)) throw new Error('Status must be Enabled or Disabled');
- if (rule.transition) {
- if (!['IA', 'Archive'].includes(rule.transition.storageClass)) throw new Error('StorageClass must be IA or Archive');
- checkDaysAndDate(rule.transition, 'Transition');
- }
- if (rule.expiration) {
- if (!rule.expiration.expiredObjectDeleteMarker) {
- checkDaysAndDate(rule.expiration, 'Expiration');
- } else if (rule.expiration.days || rule.expiration.createdBeforeDate) {
- throw new Error('expiredObjectDeleteMarker cannot be used with days or createdBeforeDate');
- }
- }
- if (rule.abortMultipartUpload) {
- checkDaysAndDate(rule.abortMultipartUpload, 'AbortMultipartUpload');
- }
- if (!rule.expiration && !rule.abortMultipartUpload && !rule.transition && !rule.noncurrentVersionTransition) {
- throw new Error('Rule must includes expiration or abortMultipartUpload or transition or noncurrentVersionTransition');
- }
- if (rule.tag) {
- if (rule.abortMultipartUpload) {
- throw new Error('Tag cannot be used with abortMultipartUpload');
- }
- handleCheckTag(rule.tag);
- }
- }
- },{"../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){
- "use strict";
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
- var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
- require("core-js/modules/es.array.includes.js");
- var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
- var _require = require('../utils/checkBucketName'),
- _checkBucketName = _require.checkBucketName;
- var _require2 = require('../utils/obj2xml'),
- obj2xml = _require2.obj2xml;
- var proto = exports;
- /**
- * putBucketVersioning
- * @param {String} name - bucket name
- * @param {String} status
- * @param {Object} options
- */
- proto.putBucketVersioning = /*#__PURE__*/function () {
- var _putBucketVersioning = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(name, status) {
- var options,
- params,
- paramXMLObj,
- result,
- _args = arguments;
- return _regenerator.default.wrap(function _callee$(_context) {
- while (1) {
- switch (_context.prev = _context.next) {
- case 0:
- options = _args.length > 2 && _args[2] !== undefined ? _args[2] : {};
- _checkBucketName(name);
- if (['Enabled', 'Suspended'].includes(status)) {
- _context.next = 4;
- break;
- }
- throw new Error('status must be Enabled or Suspended');
- case 4:
- params = this._bucketRequestParams('PUT', name, 'versioning', options);
- paramXMLObj = {
- VersioningConfiguration: {
- Status: status
- }
- };
- params.mime = 'xml';
- params.content = obj2xml(paramXMLObj, {
- headers: true
- });
- _context.next = 10;
- return this.request(params);
- case 10:
- result = _context.sent;
- return _context.abrupt("return", {
- res: result.res,
- status: result.status
- });
- case 12:
- case "end":
- return _context.stop();
- }
- }
- }, _callee, this);
- }));
- function putBucketVersioning(_x, _x2) {
- return _putBucketVersioning.apply(this, arguments);
- }
- return putBucketVersioning;
- }();
- },{"../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){
- "use strict";
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
- var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
- var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
- var _require = require('../utils/checkBucketName'),
- _checkBucketName = _require.checkBucketName;
- var _require2 = require('../utils/obj2xml'),
- obj2xml = _require2.obj2xml;
- var _require3 = require('../utils/isArray'),
- isArray = _require3.isArray;
- var proto = exports;
- proto.putBucketWebsite = /*#__PURE__*/function () {
- var _putBucketWebsite = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(name) {
- var config,
- options,
- params,
- IndexDocument,
- WebsiteConfiguration,
- website,
- result,
- _args = arguments;
- return _regenerator.default.wrap(function _callee$(_context) {
- while (1) {
- switch (_context.prev = _context.next) {
- case 0:
- config = _args.length > 1 && _args[1] !== undefined ? _args[1] : {};
- options = _args.length > 2 ? _args[2] : undefined;
- _checkBucketName(name);
- params = this._bucketRequestParams('PUT', name, 'website', options);
- IndexDocument = {
- Suffix: config.index || 'index.html'
- };
- WebsiteConfiguration = {
- IndexDocument: IndexDocument
- };
- website = {
- WebsiteConfiguration: WebsiteConfiguration
- };
- if (config.supportSubDir) {
- IndexDocument.SupportSubDir = config.supportSubDir;
- }
- if (config.type) {
- IndexDocument.Type = config.type;
- }
- if (config.error) {
- WebsiteConfiguration.ErrorDocument = {
- Key: config.error
- };
- }
- if (!(config.routingRules !== undefined)) {
- _context.next = 14;
- break;
- }
- if (isArray(config.routingRules)) {
- _context.next = 13;
- break;
- }
- throw new Error('RoutingRules must be Array');
- case 13:
- WebsiteConfiguration.RoutingRules = {
- RoutingRule: config.routingRules
- };
- case 14:
- website = obj2xml(website);
- params.content = website;
- params.mime = 'xml';
- params.successStatuses = [200];
- _context.next = 20;
- return this.request(params);
- case 20:
- result = _context.sent;
- return _context.abrupt("return", {
- res: result.res
- });
- case 22:
- case "end":
- return _context.stop();
- }
- }
- }, _callee, this);
- }));
- function putBucketWebsite(_x) {
- return _putBucketWebsite.apply(this, arguments);
- }
- return putBucketWebsite;
- }();
- },{"../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){
- (function (Buffer){(function (){
- "use strict";
- require("core-js/modules/es.object.to-string.js");
- require("core-js/modules/es.regexp.to-string.js");
- require("core-js/modules/web.dom-collections.for-each.js");
- require("core-js/modules/es.object.keys.js");
- exports.encodeCallback = function encodeCallback(reqParams, options) {
- reqParams.headers = reqParams.headers || {};
- if (!Object.prototype.hasOwnProperty.call(reqParams.headers, 'x-oss-callback')) {
- if (options.callback) {
- var json = {
- callbackUrl: encodeURI(options.callback.url),
- callbackBody: options.callback.body
- };
- if (options.callback.host) {
- json.callbackHost = options.callback.host;
- }
- if (options.callback.contentType) {
- json.callbackBodyType = options.callback.contentType;
- }
- var callback = Buffer.from(JSON.stringify(json)).toString('base64');
- reqParams.headers['x-oss-callback'] = callback;
- if (options.callback.customValue) {
- var callbackVar = {};
- Object.keys(options.callback.customValue).forEach(function (key) {
- callbackVar["x:".concat(key)] = options.callback.customValue[key];
- });
- reqParams.headers['x-oss-callback-var'] = Buffer.from(JSON.stringify(callbackVar)).toString('base64');
- }
- }
- }
- };
- }).call(this)}).call(this,require("buffer").Buffer)
- },{"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){
- "use strict";
- require("core-js/modules/es.array.concat.js");
- require("core-js/modules/es.regexp.exec.js");
- require("core-js/modules/es.string.replace.js");
- require("core-js/modules/web.dom-collections.for-each.js");
- var __importDefault = void 0 && (void 0).__importDefault || function (mod) {
- return mod && mod.__esModule ? mod : {
- "default": mod
- };
- };
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.getReqUrl = void 0;
- var copy_to_1 = __importDefault(require("copy-to"));
- var url_1 = __importDefault(require("url"));
- var merge_descriptors_1 = __importDefault(require("merge-descriptors"));
- var is_type_of_1 = __importDefault(require("is-type-of"));
- var isIP_1 = require("../utils/isIP");
- var checkConfigValid_1 = require("../utils/checkConfigValid");
- function getReqUrl(params) {
- var ep = {};
- var isCname = this.options.cname;
- checkConfigValid_1.checkConfigValid(this.options.endpoint, 'endpoint');
- copy_to_1.default(this.options.endpoint, false).to(ep);
- if (params.bucket && !isCname && !isIP_1.isIP(ep.hostname) && !this.options.sldEnable) {
- ep.host = "".concat(params.bucket, ".").concat(ep.host);
- }
- var resourcePath = '/';
- if (params.bucket && this.options.sldEnable) {
- resourcePath += "".concat(params.bucket, "/");
- }
- if (params.object) {
- // Preserve '/' in result url
- resourcePath += this._escape(params.object).replace(/\+/g, '%2B');
- }
- ep.pathname = resourcePath;
- var query = {};
- if (params.query) {
- merge_descriptors_1.default(query, params.query);
- }
- if (params.subres) {
- var subresAsQuery = {};
- if (is_type_of_1.default.string(params.subres)) {
- subresAsQuery[params.subres] = '';
- } else if (is_type_of_1.default.array(params.subres)) {
- params.subres.forEach(function (k) {
- subresAsQuery[k] = '';
- });
- } else {
- subresAsQuery = params.subres;
- }
- merge_descriptors_1.default(query, subresAsQuery);
- }
- ep.query = query;
- return url_1.default.format(ep);
- }
- exports.getReqUrl = getReqUrl;
- },{"../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){
- "use strict";
- require("core-js/modules/es.array.concat.js");
- require("core-js/modules/es.object.assign.js");
- require("core-js/modules/es.string.trim.js");
- var ms = require('humanize-ms');
- var urlutil = require('url');
- var _require = require('../utils/checkBucketName'),
- _checkBucketName = _require.checkBucketName;
- var _require2 = require('../utils/setRegion'),
- setRegion = _require2.setRegion;
- var _require3 = require('../utils/checkConfigValid'),
- checkConfigValid = _require3.checkConfigValid;
- function setEndpoint(endpoint, secure) {
- checkConfigValid(endpoint, 'endpoint');
- var url = urlutil.parse(endpoint);
- if (!url.protocol) {
- url = urlutil.parse("http".concat(secure ? 's' : '', "://").concat(endpoint));
- }
- if (url.protocol !== 'http:' && url.protocol !== 'https:') {
- throw new Error('Endpoint protocol must be http or https.');
- }
- return url;
- }
- module.exports = function (options) {
- if (!options || !options.accessKeyId || !options.accessKeySecret) {
- throw new Error('require accessKeyId, accessKeySecret');
- }
- if (options.stsToken && !options.refreshSTSToken && !options.refreshSTSTokenInterval) {
- console.warn("It's recommended to set 'refreshSTSToken' and 'refreshSTSTokenInterval' to refresh" + ' stsToken、accessKeyId、accessKeySecret automatically when sts token has expired');
- }
- if (options.bucket) {
- _checkBucketName(options.bucket);
- }
- var opts = Object.assign({
- region: 'oss-cn-hangzhou',
- internal: false,
- secure: false,
- timeout: 60000,
- bucket: null,
- endpoint: null,
- cname: false,
- isRequestPay: false,
- sldEnable: false,
- headerEncoding: 'utf-8',
- refreshSTSToken: null,
- refreshSTSTokenInterval: 60000 * 5,
- retryMax: 0
- }, options);
- opts.accessKeyId = opts.accessKeyId.trim();
- opts.accessKeySecret = opts.accessKeySecret.trim();
- if (opts.timeout) {
- opts.timeout = ms(opts.timeout);
- }
- if (opts.endpoint) {
- opts.endpoint = setEndpoint(opts.endpoint, opts.secure);
- } else if (opts.region) {
- opts.endpoint = setRegion(opts.region, opts.internal, opts.secure);
- } else {
- throw new Error('require options.endpoint or options.region');
- }
- opts.inited = true;
- return opts;
- };
- },{"../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){
- "use strict";
- var merge = require('merge-descriptors');
- var proto = exports;
- merge(proto, require('./processObjectSave'));
- },{"./processObjectSave":28,"merge-descriptors":315}],28:[function(require,module,exports){
- "use strict";
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
- var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
- require("core-js/modules/es.array.concat.js");
- var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
- /* eslint-disable no-use-before-define */
- var _require = require('../utils/checkBucketName'),
- _checkBucketName = _require.checkBucketName;
- var querystring = require('querystring');
- var _require2 = require('js-base64'),
- str2Base64 = _require2.Base64.encode;
- var proto = exports;
- proto.processObjectSave = /*#__PURE__*/function () {
- var _processObjectSave = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(sourceObject, targetObject, process, targetBucket) {
- var params, bucketParam, content, result;
- return _regenerator.default.wrap(function _callee$(_context) {
- while (1) {
- switch (_context.prev = _context.next) {
- case 0:
- checkArgs(sourceObject, 'sourceObject');
- checkArgs(targetObject, 'targetObject');
- checkArgs(process, 'process');
- targetObject = this._objectName(targetObject);
- if (targetBucket) {
- _checkBucketName(targetBucket);
- }
- params = this._objectRequestParams('POST', sourceObject, {
- subres: 'x-oss-process'
- });
- bucketParam = targetBucket ? ",b_".concat(str2Base64(targetBucket)) : '';
- targetObject = str2Base64(targetObject);
- content = {
- 'x-oss-process': "".concat(process, "|sys/saveas,o_").concat(targetObject).concat(bucketParam)
- };
- params.content = querystring.stringify(content);
- _context.next = 12;
- return this.request(params);
- case 12:
- result = _context.sent;
- return _context.abrupt("return", {
- res: result.res,
- status: result.res.status
- });
- case 14:
- case "end":
- return _context.stop();
- }
- }
- }, _callee, this);
- }));
- function processObjectSave(_x, _x2, _x3, _x4) {
- return _processObjectSave.apply(this, arguments);
- }
- return processObjectSave;
- }();
- function checkArgs(name, key) {
- if (!name) {
- throw new Error("".concat(key, " is required"));
- }
- if (typeof name !== 'string') {
- throw new Error("".concat(key, " must be String"));
- }
- }
- },{"../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){
- "use strict";
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
- var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
- require("core-js/modules/es.array.concat.js");
- require("core-js/modules/es.function.name.js");
- require("core-js/modules/es.object.to-string.js");
- require("core-js/modules/es.promise.js");
- require("core-js/modules/es.array.from.js");
- require("core-js/modules/es.string.iterator.js");
- require("core-js/modules/es.array.map.js");
- require("core-js/modules/es.array.filter.js");
- require("core-js/modules/es.array.find.js");
- require("core-js/modules/es.regexp.to-string.js");
- var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
- /* eslint-disable no-async-promise-executor */
- var debug = require('debug')('ali-oss:multipart-copy');
- var copy = require('copy-to');
- var proto = exports;
- /**
- * Upload a part copy in a multipart from the source bucket/object
- * used with initMultipartUpload and completeMultipartUpload.
- * @param {String} name copy object name
- * @param {String} uploadId the upload id
- * @param {Number} partNo the part number
- * @param {String} range like 0-102400 part size need to copy
- * @param {Object} sourceData
- * {String} sourceData.sourceKey the source object name
- * {String} sourceData.sourceBucketName the source bucket name
- * @param {Object} options
- */
- /* eslint max-len: [0] */
- proto.uploadPartCopy = /*#__PURE__*/function () {
- var _uploadPartCopy = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(name, uploadId, partNo, range, sourceData) {
- var options,
- versionId,
- copySource,
- params,
- result,
- _args = arguments;
- return _regenerator.default.wrap(function _callee$(_context) {
- while (1) {
- switch (_context.prev = _context.next) {
- case 0:
- options = _args.length > 5 && _args[5] !== undefined ? _args[5] : {};
- options.headers = options.headers || {};
- versionId = options.versionId || options.subres && options.subres.versionId || null;
- if (versionId) {
- copySource = "/".concat(sourceData.sourceBucketName, "/").concat(encodeURIComponent(sourceData.sourceKey), "?versionId=").concat(versionId);
- } else {
- copySource = "/".concat(sourceData.sourceBucketName, "/").concat(encodeURIComponent(sourceData.sourceKey));
- }
- options.headers['x-oss-copy-source'] = copySource;
- if (range) {
- options.headers['x-oss-copy-source-range'] = "bytes=".concat(range);
- }
- options.subres = {
- partNumber: partNo,
- uploadId: uploadId
- };
- params = this._objectRequestParams('PUT', name, options);
- params.mime = options.mime;
- params.successStatuses = [200];
- _context.next = 12;
- return this.request(params);
- case 12:
- result = _context.sent;
- return _context.abrupt("return", {
- name: name,
- etag: result.res.headers.etag,
- res: result.res
- });
- case 14:
- case "end":
- return _context.stop();
- }
- }
- }, _callee, this);
- }));
- function uploadPartCopy(_x, _x2, _x3, _x4, _x5) {
- return _uploadPartCopy.apply(this, arguments);
- }
- return uploadPartCopy;
- }();
- /**
- * @param {String} name copy object name
- * @param {Object} sourceData
- * {String} sourceData.sourceKey the source object name
- * {String} sourceData.sourceBucketName the source bucket name
- * {Number} sourceData.startOffset data copy start byte offset, e.g: 0
- * {Number} sourceData.endOffset data copy end byte offset, e.g: 102400
- * @param {Object} options
- * {Number} options.partSize
- */
- proto.multipartUploadCopy = /*#__PURE__*/function () {
- var _multipartUploadCopy = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(name, sourceData) {
- var options,
- _options$versionId,
- versionId,
- metaOpt,
- objectMeta,
- fileSize,
- minPartSize,
- copySize,
- init,
- uploadId,
- partSize,
- checkpoint,
- _args2 = arguments;
- return _regenerator.default.wrap(function _callee2$(_context2) {
- while (1) {
- switch (_context2.prev = _context2.next) {
- case 0:
- options = _args2.length > 2 && _args2[2] !== undefined ? _args2[2] : {};
- this.resetCancelFlag();
- _options$versionId = options.versionId, versionId = _options$versionId === void 0 ? null : _options$versionId;
- metaOpt = {
- versionId: versionId
- };
- _context2.next = 6;
- return this._getObjectMeta(sourceData.sourceBucketName, sourceData.sourceKey, metaOpt);
- case 6:
- objectMeta = _context2.sent;
- fileSize = objectMeta.res.headers['content-length'];
- sourceData.startOffset = sourceData.startOffset || 0;
- sourceData.endOffset = sourceData.endOffset || fileSize;
- if (!(options.checkpoint && options.checkpoint.uploadId)) {
- _context2.next = 14;
- break;
- }
- _context2.next = 13;
- return this._resumeMultipartCopy(options.checkpoint, sourceData, options);
- case 13:
- return _context2.abrupt("return", _context2.sent);
- case 14:
- minPartSize = 100 * 1024;
- copySize = sourceData.endOffset - sourceData.startOffset;
- if (!(copySize < minPartSize)) {
- _context2.next = 18;
- break;
- }
- throw new Error("copySize must not be smaller than ".concat(minPartSize));
- case 18:
- if (!(options.partSize && options.partSize < minPartSize)) {
- _context2.next = 20;
- break;
- }
- throw new Error("partSize must not be smaller than ".concat(minPartSize));
- case 20:
- _context2.next = 22;
- return this.initMultipartUpload(name, options);
- case 22:
- init = _context2.sent;
- uploadId = init.uploadId;
- partSize = this._getPartSize(copySize, options.partSize);
- checkpoint = {
- name: name,
- copySize: copySize,
- partSize: partSize,
- uploadId: uploadId,
- doneParts: []
- };
- if (!(options && options.progress)) {
- _context2.next = 29;
- break;
- }
- _context2.next = 29;
- return options.progress(0, checkpoint, init.res);
- case 29:
- _context2.next = 31;
- return this._resumeMultipartCopy(checkpoint, sourceData, options);
- case 31:
- return _context2.abrupt("return", _context2.sent);
- case 32:
- case "end":
- return _context2.stop();
- }
- }
- }, _callee2, this);
- }));
- function multipartUploadCopy(_x6, _x7) {
- return _multipartUploadCopy.apply(this, arguments);
- }
- return multipartUploadCopy;
- }();
- /*
- * Resume multipart copy from checkpoint. The checkpoint will be
- * updated after each successful part copy.
- * @param {Object} checkpoint the checkpoint
- * @param {Object} options
- */
- proto._resumeMultipartCopy = /*#__PURE__*/function () {
- var _resumeMultipartCopy2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4(checkpoint, sourceData, options) {
- var _options$versionId2, versionId, metaOpt, copySize, partSize, uploadId, doneParts, name, partOffs, numParts, uploadPartCopyOptions, uploadPartJob, all, done, todo, defaultParallel, parallel, i, errors, abortEvent, err;
- return _regenerator.default.wrap(function _callee4$(_context4) {
- while (1) {
- switch (_context4.prev = _context4.next) {
- case 0:
- if (!this.isCancel()) {
- _context4.next = 2;
- break;
- }
- throw this._makeCancelEvent();
- case 2:
- _options$versionId2 = options.versionId, versionId = _options$versionId2 === void 0 ? null : _options$versionId2;
- metaOpt = {
- versionId: versionId
- };
- copySize = checkpoint.copySize, partSize = checkpoint.partSize, uploadId = checkpoint.uploadId, doneParts = checkpoint.doneParts, name = checkpoint.name;
- partOffs = this._divideMultipartCopyParts(copySize, partSize, sourceData.startOffset);
- numParts = partOffs.length;
- uploadPartCopyOptions = {
- headers: {}
- };
- if (options.copyheaders) {
- copy(options.copyheaders).to(uploadPartCopyOptions.headers);
- }
- if (versionId) {
- copy(metaOpt).to(uploadPartCopyOptions);
- }
- uploadPartJob = function uploadPartJob(self, partNo, source) {
- return new Promise( /*#__PURE__*/function () {
- var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3(resolve, reject) {
- var pi, range, result;
- return _regenerator.default.wrap(function _callee3$(_context3) {
- while (1) {
- switch (_context3.prev = _context3.next) {
- case 0:
- _context3.prev = 0;
- if (self.isCancel()) {
- _context3.next = 22;
- break;
- }
- pi = partOffs[partNo - 1];
- range = "".concat(pi.start, "-").concat(pi.end - 1);
- _context3.prev = 4;
- _context3.next = 7;
- return self.uploadPartCopy(name, uploadId, partNo, range, source, uploadPartCopyOptions);
- case 7:
- result = _context3.sent;
- _context3.next = 15;
- break;
- case 10:
- _context3.prev = 10;
- _context3.t0 = _context3["catch"](4);
- if (!(_context3.t0.status === 404)) {
- _context3.next = 14;
- break;
- }
- throw self._makeAbortEvent();
- case 14:
- throw _context3.t0;
- case 15:
- if (self.isCancel()) {
- _context3.next = 22;
- break;
- }
- debug("content-range ".concat(result.res.headers['content-range']));
- doneParts.push({
- number: partNo,
- etag: result.res.headers.etag
- });
- checkpoint.doneParts = doneParts;
- if (!(options && options.progress)) {
- _context3.next = 22;
- break;
- }
- _context3.next = 22;
- return options.progress(doneParts.length / numParts, checkpoint, result.res);
- case 22:
- resolve();
- _context3.next = 29;
- break;
- case 25:
- _context3.prev = 25;
- _context3.t1 = _context3["catch"](0);
- _context3.t1.partNum = partNo;
- reject(_context3.t1);
- case 29:
- case "end":
- return _context3.stop();
- }
- }
- }, _callee3, null, [[0, 25], [4, 10]]);
- }));
- return function (_x11, _x12) {
- return _ref.apply(this, arguments);
- };
- }());
- };
- all = Array.from(new Array(numParts), function (x, i) {
- return i + 1;
- });
- done = doneParts.map(function (p) {
- return p.number;
- });
- todo = all.filter(function (p) {
- return done.indexOf(p) < 0;
- });
- defaultParallel = 5;
- parallel = options.parallel || defaultParallel;
- if (!(this.checkBrowserAndVersion('Internet Explorer', '10') || parallel === 1)) {
- _context4.next = 28;
- break;
- }
- i = 0;
- case 18:
- if (!(i < todo.length)) {
- _context4.next = 26;
- break;
- }
- if (!this.isCancel()) {
- _context4.next = 21;
- break;
- }
- throw this._makeCancelEvent();
- case 21:
- _context4.next = 23;
- return uploadPartJob(this, todo[i], sourceData);
- case 23:
- i++;
- _context4.next = 18;
- break;
- case 26:
- _context4.next = 40;
- break;
- case 28:
- _context4.next = 30;
- return this._parallelNode(todo, parallel, uploadPartJob, sourceData);
- case 30:
- errors = _context4.sent;
- abortEvent = errors.find(function (err) {
- return err.name === 'abort';
- });
- if (!abortEvent) {
- _context4.next = 34;
- break;
- }
- throw abortEvent;
- case 34:
- if (!this.isCancel()) {
- _context4.next = 36;
- break;
- }
- throw this._makeCancelEvent();
- case 36:
- if (!(errors && errors.length > 0)) {
- _context4.next = 40;
- break;
- }
- err = errors[0];
- err.message = "Failed to copy some parts with error: ".concat(err.toString(), " part_num: ").concat(err.partNum);
- throw err;
- case 40:
- _context4.next = 42;
- return this.completeMultipartUpload(name, uploadId, doneParts, options);
- case 42:
- return _context4.abrupt("return", _context4.sent);
- case 43:
- case "end":
- return _context4.stop();
- }
- }
- }, _callee4, this);
- }));
- function _resumeMultipartCopy(_x8, _x9, _x10) {
- return _resumeMultipartCopy2.apply(this, arguments);
- }
- return _resumeMultipartCopy;
- }();
- proto._divideMultipartCopyParts = function _divideMultipartCopyParts(fileSize, partSize, startOffset) {
- var numParts = Math.ceil(fileSize / partSize);
- var partOffs = [];
- for (var i = 0; i < numParts; i++) {
- var start = partSize * i + startOffset;
- var end = Math.min(start + partSize, fileSize + startOffset);
- partOffs.push({
- start: start,
- end: end
- });
- }
- return partOffs;
- };
- /**
- * Get Object Meta
- * @param {String} bucket bucket name
- * @param {String} name object name
- * @param {Object} options
- */
- proto._getObjectMeta = /*#__PURE__*/function () {
- var _getObjectMeta2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5(bucket, name, options) {
- var currentBucket, data;
- return _regenerator.default.wrap(function _callee5$(_context5) {
- while (1) {
- switch (_context5.prev = _context5.next) {
- case 0:
- currentBucket = this.getBucket();
- this.setBucket(bucket);
- _context5.next = 4;
- return this.head(name, options);
- case 4:
- data = _context5.sent;
- this.setBucket(currentBucket);
- return _context5.abrupt("return", data);
- case 7:
- case "end":
- return _context5.stop();
- }
- }
- }, _callee5, this);
- }));
- function _getObjectMeta(_x13, _x14, _x15) {
- return _getObjectMeta2.apply(this, arguments);
- }
- return _getObjectMeta;
- }();
- },{"@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){
- (function (process){(function (){
- "use strict";
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
- var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
- require("core-js/modules/es.array.map.js");
- require("core-js/modules/es.array.filter.js");
- require("core-js/modules/es.array.sort.js");
- require("core-js/modules/es.array.concat.js");
- require("core-js/modules/es.object.to-string.js");
- require("core-js/modules/es.regexp.to-string.js");
- var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
- var copy = require('copy-to');
- var callback = require('./callback');
- var _require = require('./utils/deepCopy'),
- deepCopyWith = _require.deepCopyWith;
- var _require2 = require('./utils/isBuffer'),
- isBuffer = _require2.isBuffer;
- var proto = exports;
- /**
- * List the on-going multipart uploads
- * https://help.aliyun.com/document_detail/31997.html
- * @param {Object} options
- * @return {Array} the multipart uploads
- */
- proto.listUploads = /*#__PURE__*/function () {
- var _listUploads = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(query, options) {
- var opt, params, result, uploads;
- return _regenerator.default.wrap(function _callee$(_context) {
- while (1) {
- switch (_context.prev = _context.next) {
- case 0:
- options = options || {};
- opt = {};
- copy(options).to(opt);
- opt.subres = 'uploads';
- params = this._objectRequestParams('GET', '', opt);
- params.query = query;
- params.xmlResponse = true;
- params.successStatuses = [200];
- _context.next = 10;
- return this.request(params);
- case 10:
- result = _context.sent;
- uploads = result.data.Upload || [];
- if (!Array.isArray(uploads)) {
- uploads = [uploads];
- }
- uploads = uploads.map(function (up) {
- return {
- name: up.Key,
- uploadId: up.UploadId,
- initiated: up.Initiated
- };
- });
- return _context.abrupt("return", {
- res: result.res,
- uploads: uploads,
- bucket: result.data.Bucket,
- nextKeyMarker: result.data.NextKeyMarker,
- nextUploadIdMarker: result.data.NextUploadIdMarker,
- isTruncated: result.data.IsTruncated === 'true'
- });
- case 15:
- case "end":
- return _context.stop();
- }
- }
- }, _callee, this);
- }));
- function listUploads(_x, _x2) {
- return _listUploads.apply(this, arguments);
- }
- return listUploads;
- }();
- /**
- * List the done uploadPart parts
- * @param {String} name object name
- * @param {String} uploadId multipart upload id
- * @param {Object} query
- * {Number} query.max-parts The maximum part number in the response of the OSS. Default value: 1000
- * {Number} query.part-number-marker Starting position of a specific list.
- * {String} query.encoding-type Specify the encoding of the returned content and the encoding type.
- * @param {Object} options
- * @return {Object} result
- */
- proto.listParts = /*#__PURE__*/function () {
- var _listParts = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(name, uploadId, query, options) {
- var opt, params, result;
- return _regenerator.default.wrap(function _callee2$(_context2) {
- while (1) {
- switch (_context2.prev = _context2.next) {
- case 0:
- options = options || {};
- opt = {};
- copy(options).to(opt);
- opt.subres = {
- uploadId: uploadId
- };
- params = this._objectRequestParams('GET', name, opt);
- params.query = query;
- params.xmlResponse = true;
- params.successStatuses = [200];
- _context2.next = 10;
- return this.request(params);
- case 10:
- result = _context2.sent;
- return _context2.abrupt("return", {
- res: result.res,
- uploadId: result.data.UploadId,
- bucket: result.data.Bucket,
- name: result.data.Key,
- partNumberMarker: result.data.PartNumberMarker,
- nextPartNumberMarker: result.data.NextPartNumberMarker,
- maxParts: result.data.MaxParts,
- isTruncated: result.data.IsTruncated,
- parts: result.data.Part || []
- });
- case 12:
- case "end":
- return _context2.stop();
- }
- }
- }, _callee2, this);
- }));
- function listParts(_x3, _x4, _x5, _x6) {
- return _listParts.apply(this, arguments);
- }
- return listParts;
- }();
- /**
- * Abort a multipart upload transaction
- * @param {String} name the object name
- * @param {String} uploadId the upload id
- * @param {Object} options
- */
- proto.abortMultipartUpload = /*#__PURE__*/function () {
- var _abortMultipartUpload = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3(name, uploadId, options) {
- var opt, params, result;
- return _regenerator.default.wrap(function _callee3$(_context3) {
- while (1) {
- switch (_context3.prev = _context3.next) {
- case 0:
- this._stop();
- options = options || {};
- opt = {};
- copy(options).to(opt);
- opt.subres = {
- uploadId: uploadId
- };
- params = this._objectRequestParams('DELETE', name, opt);
- params.successStatuses = [204];
- _context3.next = 9;
- return this.request(params);
- case 9:
- result = _context3.sent;
- return _context3.abrupt("return", {
- res: result.res
- });
- case 11:
- case "end":
- return _context3.stop();
- }
- }
- }, _callee3, this);
- }));
- function abortMultipartUpload(_x7, _x8, _x9) {
- return _abortMultipartUpload.apply(this, arguments);
- }
- return abortMultipartUpload;
- }();
- /**
- * Initiate a multipart upload transaction
- * @param {String} name the object name
- * @param {Object} options
- * @return {String} upload id
- */
- proto.initMultipartUpload = /*#__PURE__*/function () {
- var _initMultipartUpload = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4(name, options) {
- var opt, params, result;
- return _regenerator.default.wrap(function _callee4$(_context4) {
- while (1) {
- switch (_context4.prev = _context4.next) {
- case 0:
- options = options || {};
- opt = {};
- copy(options).to(opt);
- opt.headers = opt.headers || {};
- this._convertMetaToHeaders(options.meta, opt.headers);
- opt.subres = 'uploads';
- params = this._objectRequestParams('POST', name, opt);
- params.mime = options.mime;
- params.xmlResponse = true;
- params.successStatuses = [200];
- _context4.next = 12;
- return this.request(params);
- case 12:
- result = _context4.sent;
- return _context4.abrupt("return", {
- res: result.res,
- bucket: result.data.Bucket,
- name: result.data.Key,
- uploadId: result.data.UploadId
- });
- case 14:
- case "end":
- return _context4.stop();
- }
- }
- }, _callee4, this);
- }));
- function initMultipartUpload(_x10, _x11) {
- return _initMultipartUpload.apply(this, arguments);
- }
- return initMultipartUpload;
- }();
- /**
- * Upload a part in a multipart upload transaction
- * @param {String} name the object name
- * @param {String} uploadId the upload id
- * @param {Integer} partNo the part number
- * @param {File} file upload File, whole File
- * @param {Integer} start part start bytes e.g: 102400
- * @param {Integer} end part end bytes e.g: 204800
- * @param {Object} options
- */
- proto.uploadPart = /*#__PURE__*/function () {
- var _uploadPart2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5(name, uploadId, partNo, file, start, end, options) {
- var data, isBrowserEnv;
- return _regenerator.default.wrap(function _callee5$(_context5) {
- while (1) {
- switch (_context5.prev = _context5.next) {
- case 0:
- data = {
- size: end - start
- };
- isBrowserEnv = process && process.browser;
- if (!isBrowserEnv) {
- _context5.next = 8;
- break;
- }
- _context5.next = 5;
- return this._createBuffer(file, start, end);
- case 5:
- data.content = _context5.sent;
- _context5.next = 11;
- break;
- case 8:
- _context5.next = 10;
- return this._createStream(file, start, end);
- case 10:
- data.stream = _context5.sent;
- case 11:
- _context5.next = 13;
- return this._uploadPart(name, uploadId, partNo, data, options);
- case 13:
- return _context5.abrupt("return", _context5.sent);
- case 14:
- case "end":
- return _context5.stop();
- }
- }
- }, _callee5, this);
- }));
- function uploadPart(_x12, _x13, _x14, _x15, _x16, _x17, _x18) {
- return _uploadPart2.apply(this, arguments);
- }
- return uploadPart;
- }();
- /**
- * Complete a multipart upload transaction
- * @param {String} name the object name
- * @param {String} uploadId the upload id
- * @param {Array} parts the uploaded parts, each in the structure:
- * {Integer} number partNo
- * {String} etag part etag uploadPartCopy result.res.header.etag
- * @param {Object} options
- * {Object} options.callback The callback parameter is composed of a JSON string encoded in Base64
- * {String} options.callback.url the OSS sends a callback request to this URL
- * {String} options.callback.host The host header value for initiating callback requests
- * {String} options.callback.body The value of the request body when a callback is initiated
- * {String} options.callback.contentType The Content-Type of the callback requests initiatiated
- * {Object} options.callback.customValue Custom parameters are a map of key-values, e.g:
- * customValue = {
- * key1: 'value1',
- * key2: 'value2'
- * }
- */
- proto.completeMultipartUpload = /*#__PURE__*/function () {
- var _completeMultipartUpload = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6(name, uploadId, parts, options) {
- var completeParts, xml, i, p, opt, params, result, ret;
- return _regenerator.default.wrap(function _callee6$(_context6) {
- while (1) {
- switch (_context6.prev = _context6.next) {
- case 0:
- completeParts = parts.concat().sort(function (a, b) {
- return a.number - b.number;
- }).filter(function (item, index, arr) {
- return !index || item.number !== arr[index - 1].number;
- });
- xml = '<?xml version="1.0" encoding="UTF-8"?>\n<CompleteMultipartUpload>\n';
- for (i = 0; i < completeParts.length; i++) {
- p = completeParts[i];
- xml += '<Part>\n';
- xml += "<PartNumber>".concat(p.number, "</PartNumber>\n");
- xml += "<ETag>".concat(p.etag, "</ETag>\n");
- xml += '</Part>\n';
- }
- xml += '</CompleteMultipartUpload>';
- options = options || {};
- opt = {};
- opt = deepCopyWith(options, function (_) {
- if (isBuffer(_)) return null;
- });
- if (opt.headers) delete opt.headers['x-oss-server-side-encryption'];
- opt.subres = {
- uploadId: uploadId
- };
- params = this._objectRequestParams('POST', name, opt);
- callback.encodeCallback(params, opt);
- params.mime = 'xml';
- params.content = xml;
- if (!(params.headers && params.headers['x-oss-callback'])) {
- params.xmlResponse = true;
- }
- params.successStatuses = [200];
- _context6.next = 17;
- return this.request(params);
- case 17:
- result = _context6.sent;
- ret = {
- res: result.res,
- bucket: params.bucket,
- name: name,
- etag: result.res.headers.etag
- };
- if (params.headers && params.headers['x-oss-callback']) {
- ret.data = JSON.parse(result.data.toString());
- }
- return _context6.abrupt("return", ret);
- case 21:
- case "end":
- return _context6.stop();
- }
- }
- }, _callee6, this);
- }));
- function completeMultipartUpload(_x19, _x20, _x21, _x22) {
- return _completeMultipartUpload.apply(this, arguments);
- }
- return completeMultipartUpload;
- }();
- /**
- * Upload a part in a multipart upload transaction
- * @param {String} name the object name
- * @param {String} uploadId the upload id
- * @param {Integer} partNo the part number
- * @param {Object} data the body data
- * @param {Object} options
- */
- proto._uploadPart = /*#__PURE__*/function () {
- var _uploadPart3 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee7(name, uploadId, partNo, data, options) {
- var opt, params, isBrowserEnv, result;
- return _regenerator.default.wrap(function _callee7$(_context7) {
- while (1) {
- switch (_context7.prev = _context7.next) {
- case 0:
- options = options || {};
- opt = {};
- copy(options).to(opt);
- opt.headers = {
- 'Content-Length': data.size
- };
- opt.subres = {
- partNumber: partNo,
- uploadId: uploadId
- };
- params = this._objectRequestParams('PUT', name, opt);
- params.mime = opt.mime;
- isBrowserEnv = process && process.browser;
- isBrowserEnv ? params.content = data.content : params.stream = data.stream;
- params.successStatuses = [200];
- params.disabledMD5 = options.disabledMD5;
- _context7.next = 13;
- return this.request(params);
- case 13:
- result = _context7.sent;
- if (result.res.headers.etag) {
- _context7.next = 16;
- break;
- }
- throw new Error('Please set the etag of expose-headers in OSS \n https://help.aliyun.com/document_detail/32069.html');
- case 16:
- if (data.stream) {
- data.stream = null;
- params.stream = null;
- }
- return _context7.abrupt("return", {
- name: name,
- etag: result.res.headers.etag,
- res: result.res
- });
- case 18:
- case "end":
- return _context7.stop();
- }
- }
- }, _callee7, this);
- }));
- function _uploadPart(_x23, _x24, _x25, _x26, _x27) {
- return _uploadPart3.apply(this, arguments);
- }
- return _uploadPart;
- }();
- }).call(this)}).call(this,require('_process'))
- },{"./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){
- "use strict";
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
- var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
- require("core-js/modules/web.dom-collections.for-each.js");
- require("core-js/modules/es.object.keys.js");
- require("core-js/modules/es.array.find.js");
- require("core-js/modules/es.array.includes.js");
- require("core-js/modules/es.array.concat.js");
- require("core-js/modules/es.regexp.exec.js");
- require("core-js/modules/es.string.replace.js");
- var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
- var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
- var _require = require('../utils/checkBucketName'),
- _checkBucketName = _require.checkBucketName;
- var proto = exports;
- var REPLACE_HEDERS = ['content-type', 'content-encoding', 'content-language', 'content-disposition', 'cache-control', 'expires'];
- proto.copy = /*#__PURE__*/function () {
- var _copy = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(name, sourceName, bucketName, options) {
- var params, result, data;
- return _regenerator.default.wrap(function _callee$(_context) {
- while (1) {
- switch (_context.prev = _context.next) {
- case 0:
- if ((0, _typeof2.default)(bucketName) === 'object') {
- options = bucketName; // 兼容旧版本,旧版本第三个参数为options
- }
- options = options || {};
- options.headers = options.headers || {};
- Object.keys(options.headers).forEach(function (key) {
- options.headers["x-oss-copy-source-".concat(key.toLowerCase())] = options.headers[key];
- });
- if (options.meta || Object.keys(options.headers).find(function (_) {
- return REPLACE_HEDERS.includes(_.toLowerCase());
- })) {
- options.headers['x-oss-metadata-directive'] = 'REPLACE';
- }
- this._convertMetaToHeaders(options.meta, options.headers);
- sourceName = this._getSourceName(sourceName, bucketName);
- if (options.versionId) {
- sourceName = "".concat(sourceName, "?versionId=").concat(options.versionId);
- }
- options.headers['x-oss-copy-source'] = sourceName;
- params = this._objectRequestParams('PUT', name, options);
- params.xmlResponse = true;
- params.successStatuses = [200, 304];
- _context.next = 14;
- return this.request(params);
- case 14:
- result = _context.sent;
- data = result.data;
- if (data) {
- data = {
- etag: data.ETag,
- lastModified: data.LastModified
- };
- }
- return _context.abrupt("return", {
- data: data,
- res: result.res
- });
- case 18:
- case "end":
- return _context.stop();
- }
- }
- }, _callee, this);
- }));
- function copy(_x, _x2, _x3, _x4) {
- return _copy.apply(this, arguments);
- }
- return copy;
- }(); // todo delete
- proto._getSourceName = function _getSourceName(sourceName, bucketName) {
- if (typeof bucketName === 'string') {
- sourceName = this._objectName(sourceName);
- } else if (sourceName[0] !== '/') {
- bucketName = this.options.bucket;
- } else {
- bucketName = sourceName.replace(/\/(.+?)(\/.*)/, '$1');
- sourceName = sourceName.replace(/(\/.+?\/)(.*)/, '$2');
- }
- _checkBucketName(bucketName);
- sourceName = encodeURIComponent(sourceName);
- sourceName = "/".concat(bucketName, "/").concat(sourceName);
- return sourceName;
- };
- },{"../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){
- "use strict";
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
- var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
- require("core-js/modules/es.object.assign.js");
- var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
- var proto = exports;
- /**
- * delete
- * @param {String} name - object name
- * @param {Object} options
- * @param {{res}}
- */
- proto.delete = /*#__PURE__*/function () {
- var _delete2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(name) {
- var options,
- params,
- result,
- _args = arguments;
- return _regenerator.default.wrap(function _callee$(_context) {
- while (1) {
- switch (_context.prev = _context.next) {
- case 0:
- options = _args.length > 1 && _args[1] !== undefined ? _args[1] : {};
- options.subres = Object.assign({}, options.subres);
- if (options.versionId) {
- options.subres.versionId = options.versionId;
- }
- params = this._objectRequestParams('DELETE', name, options);
- params.successStatuses = [204];
- _context.next = 7;
- return this.request(params);
- case 7:
- result = _context.sent;
- return _context.abrupt("return", {
- res: result.res
- });
- case 9:
- case "end":
- return _context.stop();
- }
- }
- }, _callee, this);
- }));
- function _delete(_x) {
- return _delete2.apply(this, arguments);
- }
- return _delete;
- }();
- },{"@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){
- "use strict";
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
- var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
- require("core-js/modules/es.object.assign.js");
- var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
- /* eslint-disable object-curly-newline */
- var utility = require('utility');
- var _require = require('../utils/obj2xml'),
- obj2xml = _require.obj2xml;
- var proto = exports;
- proto.deleteMulti = /*#__PURE__*/function () {
- var _deleteMulti = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(names) {
- var options,
- objects,
- i,
- object,
- _names$i,
- key,
- versionId,
- paramXMLObj,
- paramXML,
- params,
- result,
- r,
- deleted,
- _args = arguments;
- return _regenerator.default.wrap(function _callee$(_context) {
- while (1) {
- switch (_context.prev = _context.next) {
- case 0:
- options = _args.length > 1 && _args[1] !== undefined ? _args[1] : {};
- objects = [];
- if (!(!names || !names.length)) {
- _context.next = 4;
- break;
- }
- throw new Error('names is required');
- case 4:
- for (i = 0; i < names.length; i++) {
- object = {};
- if (typeof names[i] === 'string') {
- object.Key = utility.escape(this._objectName(names[i]));
- } else {
- _names$i = names[i], key = _names$i.key, versionId = _names$i.versionId;
- object.Key = utility.escape(this._objectName(key));
- object.VersionId = versionId;
- }
- objects.push(object);
- }
- paramXMLObj = {
- Delete: {
- Quiet: !!options.quiet,
- Object: objects
- }
- };
- paramXML = obj2xml(paramXMLObj, {
- headers: true
- });
- options.subres = Object.assign({
- delete: ''
- }, options.subres);
- if (options.versionId) {
- options.subres.versionId = options.versionId;
- }
- params = this._objectRequestParams('POST', '', options);
- params.mime = 'xml';
- params.content = paramXML;
- params.xmlResponse = true;
- params.successStatuses = [200];
- _context.next = 16;
- return this.request(params);
- case 16:
- result = _context.sent;
- r = result.data;
- deleted = r && r.Deleted || null;
- if (deleted) {
- if (!Array.isArray(deleted)) {
- deleted = [deleted];
- }
- }
- return _context.abrupt("return", {
- res: result.res,
- deleted: deleted || []
- });
- case 21:
- case "end":
- return _context.stop();
- }
- }
- }, _callee, this);
- }));
- function deleteMulti(_x) {
- return _deleteMulti.apply(this, arguments);
- }
- return deleteMulti;
- }();
- },{"../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){
- "use strict";
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
- var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
- require("core-js/modules/es.object.assign.js");
- var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
- var proto = exports;
- /**
- * deleteObjectTagging
- * @param {String} name - object name
- * @param {Object} options
- */
- proto.deleteObjectTagging = /*#__PURE__*/function () {
- var _deleteObjectTagging = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(name) {
- var options,
- params,
- result,
- _args = arguments;
- return _regenerator.default.wrap(function _callee$(_context) {
- while (1) {
- switch (_context.prev = _context.next) {
- case 0:
- options = _args.length > 1 && _args[1] !== undefined ? _args[1] : {};
- options.subres = Object.assign({
- tagging: ''
- }, options.subres);
- if (options.versionId) {
- options.subres.versionId = options.versionId;
- }
- name = this._objectName(name);
- params = this._objectRequestParams('DELETE', name, options);
- params.successStatuses = [204];
- _context.next = 8;
- return this.request(params);
- case 8:
- result = _context.sent;
- return _context.abrupt("return", {
- status: result.status,
- res: result.res
- });
- case 10:
- case "end":
- return _context.stop();
- }
- }
- }, _callee, this);
- }));
- function deleteObjectTagging(_x) {
- return _deleteObjectTagging.apply(this, arguments);
- }
- return deleteObjectTagging;
- }();
- },{"@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){
- "use strict";
- require("core-js/modules/es.array.concat.js");
- var urlutil = require('url');
- var _require = require('../utils/isIP'),
- isIP = _require.isIP;
- var proto = exports;
- /**
- * Get Object url by name
- * @param {String} name - object name
- * @param {String} [baseUrl] - If provide `baseUrl`, will use `baseUrl` instead the default `endpoint and bucket`.
- * @return {String} object url include bucket
- */
- proto.generateObjectUrl = function generateObjectUrl(name, baseUrl) {
- if (isIP(this.options.endpoint.hostname)) {
- throw new Error('can not get the object URL when endpoint is IP');
- }
- if (!baseUrl) {
- baseUrl = this.options.endpoint.format();
- var copyUrl = urlutil.parse(baseUrl);
- var bucket = this.options.bucket;
- copyUrl.hostname = "".concat(bucket, ".").concat(copyUrl.hostname);
- copyUrl.host = "".concat(bucket, ".").concat(copyUrl.host);
- baseUrl = copyUrl.format();
- } else if (baseUrl[baseUrl.length - 1] !== '/') {
- baseUrl += '/';
- }
- return baseUrl + this._escape(this._objectName(name));
- };
- },{"../utils/isIP":66,"core-js/modules/es.array.concat.js":241,"url":404}],36:[function(require,module,exports){
- (function (process){(function (){
- "use strict";
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
- var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
- require("core-js/modules/es.object.assign.js");
- var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
- var fs = require('fs');
- var is = require('is-type-of');
- var proto = exports;
- /**
- * get
- * @param {String} name - object name
- * @param {String | Stream} file
- * @param {Object} options
- * @param {{res}}
- */
- proto.get = /*#__PURE__*/function () {
- var _get = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(name, file) {
- var options,
- writeStream,
- needDestroy,
- isBrowserEnv,
- responseCacheControl,
- defaultSubresOptions,
- result,
- params,
- _args = arguments;
- return _regenerator.default.wrap(function _callee$(_context) {
- while (1) {
- switch (_context.prev = _context.next) {
- case 0:
- options = _args.length > 2 && _args[2] !== undefined ? _args[2] : {};
- writeStream = null;
- needDestroy = false;
- if (is.writableStream(file)) {
- writeStream = file;
- } else if (is.string(file)) {
- writeStream = fs.createWriteStream(file);
- needDestroy = true;
- } else {
- // get(name, options)
- options = file;
- }
- options = options || {};
- isBrowserEnv = process && process.browser;
- responseCacheControl = options.responseCacheControl === null ? '' : 'no-cache';
- defaultSubresOptions = isBrowserEnv && responseCacheControl ? {
- 'response-cache-control': responseCacheControl
- } : {};
- options.subres = Object.assign(defaultSubresOptions, options.subres);
- if (options.versionId) {
- options.subres.versionId = options.versionId;
- }
- if (options.process) {
- options.subres['x-oss-process'] = options.process;
- }
- _context.prev = 11;
- params = this._objectRequestParams('GET', name, options);
- params.writeStream = writeStream;
- params.successStatuses = [200, 206, 304];
- _context.next = 17;
- return this.request(params);
- case 17:
- result = _context.sent;
- if (needDestroy) {
- writeStream.destroy();
- }
- _context.next = 28;
- break;
- case 21:
- _context.prev = 21;
- _context.t0 = _context["catch"](11);
- if (!needDestroy) {
- _context.next = 27;
- break;
- }
- writeStream.destroy(); // should delete the exists file before throw error
- _context.next = 27;
- return this._deleteFileSafe(file);
- case 27:
- throw _context.t0;
- case 28:
- return _context.abrupt("return", {
- res: result.res,
- content: result.data
- });
- case 29:
- case "end":
- return _context.stop();
- }
- }
- }, _callee, this, [[11, 21]]);
- }));
- function get(_x, _x2) {
- return _get.apply(this, arguments);
- }
- return get;
- }();
- }).call(this)}).call(this,require('_process'))
- },{"@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){
- "use strict";
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
- var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
- require("core-js/modules/es.object.assign.js");
- var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
- var proto = exports;
- /*
- * Get object's ACL
- * @param {String} name the object key
- * @param {Object} options
- * @return {Object}
- */
- proto.getACL = /*#__PURE__*/function () {
- var _getACL = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(name) {
- var options,
- params,
- result,
- _args = arguments;
- return _regenerator.default.wrap(function _callee$(_context) {
- while (1) {
- switch (_context.prev = _context.next) {
- case 0:
- options = _args.length > 1 && _args[1] !== undefined ? _args[1] : {};
- options.subres = Object.assign({
- acl: ''
- }, options.subres);
- if (options.versionId) {
- options.subres.versionId = options.versionId;
- }
- name = this._objectName(name);
- params = this._objectRequestParams('GET', name, options);
- params.successStatuses = [200];
- params.xmlResponse = true;
- _context.next = 9;
- return this.request(params);
- case 9:
- result = _context.sent;
- return _context.abrupt("return", {
- acl: result.data.AccessControlList.Grant,
- owner: {
- id: result.data.Owner.ID,
- displayName: result.data.Owner.DisplayName
- },
- res: result.res
- });
- case 11:
- case "end":
- return _context.stop();
- }
- }
- }, _callee, this);
- }));
- function getACL(_x) {
- return _getACL.apply(this, arguments);
- }
- return getACL;
- }();
- },{"@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){
- "use strict";
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
- var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
- require("core-js/modules/es.regexp.exec.js");
- require("core-js/modules/es.string.replace.js");
- require("core-js/modules/web.dom-collections.for-each.js");
- require("core-js/modules/es.object.keys.js");
- require("core-js/modules/es.object.assign.js");
- require("core-js/modules/es.array.map.js");
- require("core-js/modules/es.number.constructor.js");
- var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
- /* eslint-disable no-use-before-define */
- var proto = exports;
- var _require = require('../utils/isObject'),
- isObject = _require.isObject;
- var _require2 = require('../utils/isArray'),
- isArray = _require2.isArray;
- proto.getBucketVersions = getBucketVersions;
- proto.listObjectVersions = getBucketVersions;
- function getBucketVersions() {
- return _getBucketVersions.apply(this, arguments);
- }
- function _getBucketVersions() {
- _getBucketVersions = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
- var query,
- options,
- params,
- result,
- objects,
- deleteMarker,
- that,
- prefixes,
- _args = arguments;
- return _regenerator.default.wrap(function _callee$(_context) {
- while (1) {
- switch (_context.prev = _context.next) {
- case 0:
- query = _args.length > 0 && _args[0] !== undefined ? _args[0] : {};
- options = _args.length > 1 && _args[1] !== undefined ? _args[1] : {};
- if (!(query.versionIdMarker && query.keyMarker === undefined)) {
- _context.next = 4;
- break;
- }
- throw new Error('A version-id marker cannot be specified without a key marker');
- case 4:
- options.subres = Object.assign({
- versions: ''
- }, options.subres);
- if (options.versionId) {
- options.subres.versionId = options.versionId;
- }
- params = this._objectRequestParams('GET', '', options);
- params.xmlResponse = true;
- params.successStatuses = [200];
- params.query = formatQuery(query);
- _context.next = 12;
- return this.request(params);
- case 12:
- result = _context.sent;
- objects = result.data.Version || [];
- deleteMarker = result.data.DeleteMarker || [];
- that = this;
- if (objects) {
- if (!Array.isArray(objects)) {
- objects = [objects];
- }
- objects = objects.map(function (obj) {
- return {
- name: obj.Key,
- url: that._objectUrl(obj.Key),
- lastModified: obj.LastModified,
- isLatest: obj.IsLatest === 'true',
- versionId: obj.VersionId,
- etag: obj.ETag,
- type: obj.Type,
- size: Number(obj.Size),
- storageClass: obj.StorageClass,
- owner: {
- id: obj.Owner.ID,
- displayName: obj.Owner.DisplayName
- }
- };
- });
- }
- if (deleteMarker) {
- if (!isArray(deleteMarker)) {
- deleteMarker = [deleteMarker];
- }
- deleteMarker = deleteMarker.map(function (obj) {
- return {
- name: obj.Key,
- lastModified: obj.LastModified,
- versionId: obj.VersionId,
- owner: {
- id: obj.Owner.ID,
- displayName: obj.Owner.DisplayName
- }
- };
- });
- }
- prefixes = result.data.CommonPrefixes || null;
- if (prefixes) {
- if (!isArray(prefixes)) {
- prefixes = [prefixes];
- }
- prefixes = prefixes.map(function (item) {
- return item.Prefix;
- });
- }
- return _context.abrupt("return", {
- res: result.res,
- objects: objects,
- deleteMarker: deleteMarker,
- prefixes: prefixes,
- // attirbute of legacy error
- nextMarker: result.data.NextKeyMarker || null,
- // attirbute of legacy error
- NextVersionIdMarker: result.data.NextVersionIdMarker || null,
- nextKeyMarker: result.data.NextKeyMarker || null,
- nextVersionIdMarker: result.data.NextVersionIdMarker || null,
- isTruncated: result.data.IsTruncated === 'true'
- });
- case 21:
- case "end":
- return _context.stop();
- }
- }
- }, _callee, this);
- }));
- return _getBucketVersions.apply(this, arguments);
- }
- function camel2Line(name) {
- return name.replace(/([A-Z])/g, '-$1').toLowerCase();
- }
- function formatQuery() {
- var query = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
- var obj = {};
- if (isObject(query)) {
- Object.keys(query).forEach(function (key) {
- obj[camel2Line(key)] = query[key];
- });
- }
- return obj;
- }
- },{"../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){
- "use strict";
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
- var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
- require("core-js/modules/es.object.assign.js");
- var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
- var proto = exports;
- /**
- * getObjectMeta
- * @param {String} name - object name
- * @param {Object} options
- * @param {{res}}
- */
- proto.getObjectMeta = /*#__PURE__*/function () {
- var _getObjectMeta = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(name, options) {
- var params, result;
- return _regenerator.default.wrap(function _callee$(_context) {
- while (1) {
- switch (_context.prev = _context.next) {
- case 0:
- options = options || {};
- name = this._objectName(name);
- options.subres = Object.assign({
- objectMeta: ''
- }, options.subres);
- if (options.versionId) {
- options.subres.versionId = options.versionId;
- }
- params = this._objectRequestParams('HEAD', name, options);
- params.successStatuses = [200];
- _context.next = 8;
- return this.request(params);
- case 8:
- result = _context.sent;
- return _context.abrupt("return", {
- status: result.status,
- res: result.res
- });
- case 10:
- case "end":
- return _context.stop();
- }
- }
- }, _callee, this);
- }));
- function getObjectMeta(_x, _x2) {
- return _getObjectMeta.apply(this, arguments);
- }
- return getObjectMeta;
- }();
- },{"@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){
- "use strict";
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
- var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
- require("core-js/modules/es.object.assign.js");
- require("core-js/modules/web.dom-collections.for-each.js");
- var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
- var proto = exports;
- var _require = require('../utils/isObject'),
- isObject = _require.isObject;
- /**
- * getObjectTagging
- * @param {String} name - object name
- * @param {Object} options
- * @return {Object}
- */
- proto.getObjectTagging = /*#__PURE__*/function () {
- var _getObjectTagging = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(name) {
- var options,
- params,
- result,
- Tagging,
- Tag,
- tag,
- _args = arguments;
- return _regenerator.default.wrap(function _callee$(_context) {
- while (1) {
- switch (_context.prev = _context.next) {
- case 0:
- options = _args.length > 1 && _args[1] !== undefined ? _args[1] : {};
- options.subres = Object.assign({
- tagging: ''
- }, options.subres);
- if (options.versionId) {
- options.subres.versionId = options.versionId;
- }
- name = this._objectName(name);
- params = this._objectRequestParams('GET', name, options);
- params.successStatuses = [200];
- _context.next = 8;
- return this.request(params);
- case 8:
- result = _context.sent;
- _context.next = 11;
- return this.parseXML(result.data);
- case 11:
- Tagging = _context.sent;
- Tag = Tagging.TagSet.Tag;
- Tag = Tag && isObject(Tag) ? [Tag] : Tag || [];
- tag = {};
- Tag.forEach(function (item) {
- tag[item.Key] = item.Value;
- });
- return _context.abrupt("return", {
- status: result.status,
- res: result.res,
- tag: tag
- });
- case 17:
- case "end":
- return _context.stop();
- }
- }
- }, _callee, this);
- }));
- function getObjectTagging(_x) {
- return _getObjectTagging.apply(this, arguments);
- }
- return getObjectTagging;
- }();
- },{"../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){
- "use strict";
- var _require = require('../utils/isIP'),
- isIP = _require.isIP;
- var proto = exports;
- /**
- * Get Object url by name
- * @param {String} name - object name
- * @param {String} [baseUrl] - If provide `baseUrl`,
- * will use `baseUrl` instead the default `endpoint`.
- * @return {String} object url
- */
- proto.getObjectUrl = function getObjectUrl(name, baseUrl) {
- if (isIP(this.options.endpoint.hostname)) {
- throw new Error('can not get the object URL when endpoint is IP');
- }
- if (!baseUrl) {
- baseUrl = this.options.endpoint.format();
- } else if (baseUrl[baseUrl.length - 1] !== '/') {
- baseUrl += '/';
- }
- return baseUrl + this._escape(this._objectName(name));
- };
- },{"../utils/isIP":66}],42:[function(require,module,exports){
- "use strict";
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
- var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
- require("core-js/modules/es.object.assign.js");
- var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
- var proto = exports;
- /**
- * getSymlink
- * @param {String} name - object name
- * @param {Object} options
- * @param {{res}}
- */
- proto.getSymlink = /*#__PURE__*/function () {
- var _getSymlink = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(name) {
- var options,
- params,
- result,
- target,
- _args = arguments;
- return _regenerator.default.wrap(function _callee$(_context) {
- while (1) {
- switch (_context.prev = _context.next) {
- case 0:
- options = _args.length > 1 && _args[1] !== undefined ? _args[1] : {};
- options.subres = Object.assign({
- symlink: ''
- }, options.subres);
- if (options.versionId) {
- options.subres.versionId = options.versionId;
- }
- name = this._objectName(name);
- params = this._objectRequestParams('GET', name, options);
- params.successStatuses = [200];
- _context.next = 8;
- return this.request(params);
- case 8:
- result = _context.sent;
- target = result.res.headers['x-oss-symlink-target'];
- return _context.abrupt("return", {
- targetName: decodeURIComponent(target),
- res: result.res
- });
- case 11:
- case "end":
- return _context.stop();
- }
- }
- }, _callee, this);
- }));
- function getSymlink(_x) {
- return _getSymlink.apply(this, arguments);
- }
- return getSymlink;
- }();
- },{"@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){
- "use strict";
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
- var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
- require("core-js/modules/es.object.assign.js");
- require("core-js/modules/web.dom-collections.for-each.js");
- require("core-js/modules/es.object.keys.js");
- var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
- var proto = exports;
- /**
- * head
- * @param {String} name - object name
- * @param {Object} options
- * @param {{res}}
- */
- proto.head = /*#__PURE__*/function () {
- var _head = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(name) {
- var options,
- params,
- result,
- data,
- _args = arguments;
- return _regenerator.default.wrap(function _callee$(_context) {
- while (1) {
- switch (_context.prev = _context.next) {
- case 0:
- options = _args.length > 1 && _args[1] !== undefined ? _args[1] : {};
- options.subres = Object.assign({}, options.subres);
- if (options.versionId) {
- options.subres.versionId = options.versionId;
- }
- params = this._objectRequestParams('HEAD', name, options);
- params.successStatuses = [200, 304];
- _context.next = 7;
- return this.request(params);
- case 7:
- result = _context.sent;
- data = {
- meta: null,
- res: result.res,
- status: result.status
- };
- if (result.status === 200) {
- Object.keys(result.headers).forEach(function (k) {
- if (k.indexOf('x-oss-meta-') === 0) {
- if (!data.meta) {
- data.meta = {};
- }
- data.meta[k.substring(11)] = result.headers[k];
- }
- });
- }
- return _context.abrupt("return", data);
- case 11:
- case "end":
- return _context.stop();
- }
- }
- }, _callee, this);
- }));
- function head(_x) {
- return _head.apply(this, arguments);
- }
- return head;
- }();
- },{"@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){
- "use strict";
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
- var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
- require("core-js/modules/es.object.assign.js");
- var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
- var proto = exports;
- /*
- * Set object's ACL
- * @param {String} name the object key
- * @param {String} acl the object ACL
- * @param {Object} options
- */
- proto.putACL = /*#__PURE__*/function () {
- var _putACL = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(name, acl, options) {
- var params, result;
- return _regenerator.default.wrap(function _callee$(_context) {
- while (1) {
- switch (_context.prev = _context.next) {
- case 0:
- options = options || {};
- options.subres = Object.assign({
- acl: ''
- }, options.subres);
- if (options.versionId) {
- options.subres.versionId = options.versionId;
- }
- options.headers = options.headers || {};
- options.headers['x-oss-object-acl'] = acl;
- name = this._objectName(name);
- params = this._objectRequestParams('PUT', name, options);
- params.successStatuses = [200];
- _context.next = 10;
- return this.request(params);
- case 10:
- result = _context.sent;
- return _context.abrupt("return", {
- res: result.res
- });
- case 12:
- case "end":
- return _context.stop();
- }
- }
- }, _callee, this);
- }));
- function putACL(_x, _x2, _x3) {
- return _putACL.apply(this, arguments);
- }
- return putACL;
- }();
- },{"@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){
- "use strict";
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
- var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
- require("core-js/modules/es.object.assign.js");
- require("core-js/modules/es.array.map.js");
- require("core-js/modules/es.object.keys.js");
- var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
- var _require = require('../utils/obj2xml'),
- obj2xml = _require.obj2xml;
- var _require2 = require('../utils/checkObjectTag'),
- checkObjectTag = _require2.checkObjectTag;
- var proto = exports;
- /**
- * putObjectTagging
- * @param {String} name - object name
- * @param {Object} tag - object tag, eg: `{a: "1", b: "2"}`
- * @param {Object} options
- */
- proto.putObjectTagging = /*#__PURE__*/function () {
- var _putObjectTagging = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(name, tag) {
- var options,
- params,
- paramXMLObj,
- result,
- _args = arguments;
- return _regenerator.default.wrap(function _callee$(_context) {
- while (1) {
- switch (_context.prev = _context.next) {
- case 0:
- options = _args.length > 2 && _args[2] !== undefined ? _args[2] : {};
- checkObjectTag(tag);
- options.subres = Object.assign({
- tagging: ''
- }, options.subres);
- if (options.versionId) {
- options.subres.versionId = options.versionId;
- }
- name = this._objectName(name);
- params = this._objectRequestParams('PUT', name, options);
- params.successStatuses = [200];
- tag = Object.keys(tag).map(function (key) {
- return {
- Key: key,
- Value: tag[key]
- };
- });
- paramXMLObj = {
- Tagging: {
- TagSet: {
- Tag: tag
- }
- }
- };
- params.mime = 'xml';
- params.content = obj2xml(paramXMLObj);
- _context.next = 13;
- return this.request(params);
- case 13:
- result = _context.sent;
- return _context.abrupt("return", {
- res: result.res,
- status: result.status
- });
- case 15:
- case "end":
- return _context.stop();
- }
- }
- }, _callee, this);
- }));
- function putObjectTagging(_x, _x2) {
- return _putObjectTagging.apply(this, arguments);
- }
- return putObjectTagging;
- }();
- },{"../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){
- "use strict";
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
- var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
- require("core-js/modules/es.object.assign.js");
- var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
- var proto = exports;
- /**
- * putSymlink
- * @param {String} name - object name
- * @param {String} targetName - target name
- * @param {Object} options
- * @param {{res}}
- */
- proto.putSymlink = /*#__PURE__*/function () {
- var _putSymlink = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(name, targetName, options) {
- var params, result;
- return _regenerator.default.wrap(function _callee$(_context) {
- while (1) {
- switch (_context.prev = _context.next) {
- case 0:
- options = options || {};
- options.headers = options.headers || {};
- targetName = this._escape(this._objectName(targetName));
- this._convertMetaToHeaders(options.meta, options.headers);
- options.headers['x-oss-symlink-target'] = targetName;
- options.subres = Object.assign({
- symlink: ''
- }, options.subres);
- if (options.versionId) {
- options.subres.versionId = options.versionId;
- }
- if (options.storageClass) {
- options.headers['x-oss-storage-class'] = options.storageClass;
- }
- name = this._objectName(name);
- params = this._objectRequestParams('PUT', name, options);
- params.successStatuses = [200];
- _context.next = 13;
- return this.request(params);
- case 13:
- result = _context.sent;
- return _context.abrupt("return", {
- res: result.res
- });
- case 15:
- case "end":
- return _context.stop();
- }
- }
- }, _callee, this);
- }));
- function putSymlink(_x, _x2, _x3) {
- return _putSymlink.apply(this, arguments);
- }
- return putSymlink;
- }();
- },{"@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){
- "use strict";
- require("core-js/modules/es.object.assign.js");
- var urlutil = require('url');
- var utility = require('utility');
- var copy = require('copy-to');
- var signHelper = require('../../common/signUtils');
- var _require = require('../utils/isIP'),
- isIP = _require.isIP;
- var _require2 = require('../../common/utils/isFunction'),
- isFunction = _require2.isFunction;
- var _require3 = require('../utils/setSTSToken'),
- checkCredentials = _require3.checkCredentials;
- var _require4 = require('../utils/formatObjKey'),
- formatObjKey = _require4.formatObjKey;
- var proto = exports;
- proto.signatureUrl = function signatureUrl(name, options) {
- var _this = this;
- if (isIP(this.options.endpoint.hostname)) {
- throw new Error('can not get the object URL when endpoint is IP');
- }
- options = options || {};
- name = this._objectName(name);
- options.method = options.method || 'GET';
- var expires = utility.timestamp() + (options.expires || 1800);
- var params = {
- bucket: this.options.bucket,
- object: name
- };
- var resource = this._getResource(params);
- if (this.options.stsToken && isFunction(this.options.refreshSTSToken)) {
- var now = new Date();
- if (this.stsTokenFreshTime >= this.options.refreshSTSTokenInterval) {
- this.stsTokenFreshTime = now;
- this.options.refreshSTSToken().then(function (r) {
- var credentials = formatObjKey(r, 'firstLowerCase');
- if (credentials.securityToken) {
- credentials.stsToken = credentials.securityToken;
- }
- checkCredentials(credentials);
- Object.assign(_this.options, credentials);
- });
- } else {
- this.stsTokenFreshTime = now;
- }
- }
- if (this.options.stsToken) {
- options['security-token'] = this.options.stsToken;
- }
- var signRes = signHelper._signatureForURL(this.options.accessKeySecret, options, resource, expires);
- var url = urlutil.parse(this._getReqUrl(params));
- url.query = {
- OSSAccessKeyId: this.options.accessKeyId,
- Expires: expires,
- Signature: signRes.Signature
- };
- copy(signRes.subResource).to(url.query);
- return url.format();
- };
- },{"../../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){
- "use strict";
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
- var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
- require("core-js/modules/es.array.iterator.js");
- require("core-js/modules/es.object.to-string.js");
- require("core-js/modules/es.promise.js");
- require("core-js/modules/es.string.iterator.js");
- require("core-js/modules/web.dom-collections.iterator.js");
- require("core-js/modules/web.dom-collections.for-each.js");
- require("core-js/modules/es.function.name.js");
- var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
- var _require = require('./utils/isArray'),
- isArray = _require.isArray;
- var proto = exports;
- proto._parallelNode = /*#__PURE__*/function () {
- var _parallelNode2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(todo, parallel, fn, sourceData) {
- var that, jobErr, jobs, tempBatch, remainder, batch, taskIndex, i;
- return _regenerator.default.wrap(function _callee$(_context) {
- while (1) {
- switch (_context.prev = _context.next) {
- case 0:
- that = this; // upload in parallel
- jobErr = [];
- jobs = [];
- tempBatch = todo.length / parallel;
- remainder = todo.length % parallel;
- batch = remainder === 0 ? tempBatch : (todo.length - remainder) / parallel + 1;
- taskIndex = 1;
- i = 0;
- case 8:
- if (!(i < todo.length)) {
- _context.next = 26;
- break;
- }
- if (!that.isCancel()) {
- _context.next = 11;
- break;
- }
- return _context.abrupt("break", 26);
- case 11:
- if (sourceData) {
- jobs.push(fn(that, todo[i], sourceData));
- } else {
- jobs.push(fn(that, todo[i]));
- }
- if (!(jobs.length === parallel || taskIndex === batch && i === todo.length - 1)) {
- _context.next = 23;
- break;
- }
- _context.prev = 13;
- taskIndex += 1;
- /* eslint no-await-in-loop: [0] */
- _context.next = 17;
- return Promise.all(jobs);
- case 17:
- _context.next = 22;
- break;
- case 19:
- _context.prev = 19;
- _context.t0 = _context["catch"](13);
- jobErr.push(_context.t0);
- case 22:
- jobs = [];
- case 23:
- i++;
- _context.next = 8;
- break;
- case 26:
- return _context.abrupt("return", jobErr);
- case 27:
- case "end":
- return _context.stop();
- }
- }
- }, _callee, this, [[13, 19]]);
- }));
- function _parallelNode(_x, _x2, _x3, _x4) {
- return _parallelNode2.apply(this, arguments);
- }
- return _parallelNode;
- }();
- proto._parallel = function _parallel(todo, parallel, jobPromise) {
- var that = this;
- return new Promise(function (resolve) {
- var _jobErr = [];
- if (parallel <= 0 || !todo) {
- resolve(_jobErr);
- return;
- }
- function onlyOnce(fn) {
- return function () {
- if (fn === null) throw new Error('Callback was already called.');
- var callFn = fn;
- fn = null;
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
- args[_key] = arguments[_key];
- }
- callFn.apply(this, args);
- };
- }
- function createArrayIterator(coll) {
- var i = -1;
- var len = coll.length;
- return function next() {
- return ++i < len && !that.isCancel() ? {
- value: coll[i],
- key: i
- } : null;
- };
- }
- var nextElem = createArrayIterator(todo);
- var done = false;
- var running = 0;
- var looping = false;
- function iterateeCallback(err, value) {
- running -= 1;
- if (err) {
- done = true;
- _jobErr.push(err);
- resolve(_jobErr);
- } else if (value === {} || done && running <= 0) {
- done = true;
- resolve(_jobErr);
- } else if (!looping) {
- /* eslint no-use-before-define: [0] */
- if (that.isCancel()) {
- resolve(_jobErr);
- } else {
- replenish();
- }
- }
- }
- function iteratee(value, callback) {
- jobPromise(value).then(function (result) {
- callback(null, result);
- }).catch(function (err) {
- callback(err);
- });
- }
- function replenish() {
- looping = true;
- while (running < parallel && !done && !that.isCancel()) {
- var elem = nextElem();
- if (elem === null || _jobErr.length > 0) {
- done = true;
- if (running <= 0) {
- resolve(_jobErr);
- }
- return;
- }
- running += 1;
- iteratee(elem.value, onlyOnce(iterateeCallback));
- }
- looping = false;
- }
- replenish();
- });
- };
- /**
- * cancel operation, now can use with multipartUpload
- * @param {Object} abort
- * {String} anort.name object key
- * {String} anort.uploadId upload id
- * {String} anort.options timeout
- */
- proto.cancel = function cancel(abort) {
- this.options.cancelFlag = true;
- if (isArray(this.multipartUploadStreams)) {
- this.multipartUploadStreams.forEach(function (_) {
- if (_.destroyed === false) {
- var err = {
- name: 'cancel',
- message: 'cancel'
- };
- _.destroy(err);
- }
- });
- }
- this.multipartUploadStreams = [];
- if (abort) {
- this.abortMultipartUpload(abort.name, abort.uploadId, abort.options);
- }
- };
- proto.isCancel = function isCancel() {
- return this.options.cancelFlag;
- };
- proto.resetCancelFlag = function resetCancelFlag() {
- this.options.cancelFlag = false;
- };
- proto._stop = function _stop() {
- this.options.cancelFlag = true;
- }; // cancel is not error , so create an object
- proto._makeCancelEvent = function _makeCancelEvent() {
- var cancelEvent = {
- status: 0,
- name: 'cancel'
- };
- return cancelEvent;
- }; // abort is not error , so create an object
- proto._makeAbortEvent = function _makeAbortEvent() {
- var abortEvent = {
- status: 0,
- name: 'abort',
- message: 'upload task has been abort'
- };
- return abortEvent;
- };
- },{"./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){
- (function (Buffer){(function (){
- "use strict";
- require("core-js/modules/es.string.trim.js");
- require("core-js/modules/es.array.sort.js");
- require("core-js/modules/es.array.join.js");
- require("core-js/modules/web.dom-collections.for-each.js");
- require("core-js/modules/es.object.keys.js");
- require("core-js/modules/es.array.concat.js");
- require("core-js/modules/es.object.to-string.js");
- require("core-js/modules/es.regexp.to-string.js");
- var crypto = require('./../../shims/crypto/crypto.js');
- var is = require('is-type-of');
- var _require = require('./utils/lowercaseKeyHeader'),
- lowercaseKeyHeader = _require.lowercaseKeyHeader;
- /**
- *
- * @param {String} resourcePath
- * @param {Object} parameters
- * @return
- */
- exports.buildCanonicalizedResource = function buildCanonicalizedResource(resourcePath, parameters) {
- var canonicalizedResource = "".concat(resourcePath);
- var separatorString = '?';
- if (is.string(parameters) && parameters.trim() !== '') {
- canonicalizedResource += separatorString + parameters;
- } else if (is.array(parameters)) {
- parameters.sort();
- canonicalizedResource += separatorString + parameters.join('&');
- } else if (parameters) {
- var compareFunc = function compareFunc(entry1, entry2) {
- if (entry1[0] > entry2[0]) {
- return 1;
- } else if (entry1[0] < entry2[0]) {
- return -1;
- }
- return 0;
- };
- var processFunc = function processFunc(key) {
- canonicalizedResource += separatorString + key;
- if (parameters[key] || parameters[key] === 0) {
- canonicalizedResource += "=".concat(parameters[key]);
- }
- separatorString = '&';
- };
- Object.keys(parameters).sort(compareFunc).forEach(processFunc);
- }
- return canonicalizedResource;
- };
- /**
- * @param {String} method
- * @param {String} resourcePath
- * @param {Object} request
- * @param {String} expires
- * @return {String} canonicalString
- */
- exports.buildCanonicalString = function canonicalString(method, resourcePath, request, expires) {
- request = request || {};
- var headers = lowercaseKeyHeader(request.headers);
- var OSS_PREFIX = 'x-oss-';
- var ossHeaders = [];
- var headersToSign = {};
- var signContent = [method.toUpperCase(), headers['content-md5'] || '', headers['content-type'], expires || headers['x-oss-date']];
- Object.keys(headers).forEach(function (key) {
- var lowerKey = key.toLowerCase();
- if (lowerKey.indexOf(OSS_PREFIX) === 0) {
- headersToSign[lowerKey] = String(headers[key]).trim();
- }
- });
- Object.keys(headersToSign).sort().forEach(function (key) {
- ossHeaders.push("".concat(key, ":").concat(headersToSign[key]));
- });
- signContent = signContent.concat(ossHeaders);
- signContent.push(this.buildCanonicalizedResource(resourcePath, request.parameters));
- return signContent.join('\n');
- };
- /**
- * @param {String} accessKeySecret
- * @param {String} canonicalString
- */
- exports.computeSignature = function computeSignature(accessKeySecret, canonicalString) {
- var headerEncoding = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'utf-8';
- var signature = crypto.createHmac('sha1', accessKeySecret);
- return signature.update(Buffer.from(canonicalString, headerEncoding)).digest('base64');
- };
- /**
- * @param {String} accessKeyId
- * @param {String} accessKeySecret
- * @param {String} canonicalString
- */
- exports.authorization = function authorization(accessKeyId, accessKeySecret, canonicalString, headerEncoding) {
- return "OSS ".concat(accessKeyId, ":").concat(this.computeSignature(accessKeySecret, canonicalString, headerEncoding));
- };
- /**
- *
- * @param {String} accessKeySecret
- * @param {Object} options
- * @param {String} resource
- * @param {Number} expires
- */
- exports._signatureForURL = function _signatureForURL(accessKeySecret) {
- var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
- var resource = arguments.length > 2 ? arguments[2] : undefined;
- var expires = arguments.length > 3 ? arguments[3] : undefined;
- var headerEncoding = arguments.length > 4 ? arguments[4] : undefined;
- var headers = {};
- var _options$subResource = options.subResource,
- subResource = _options$subResource === void 0 ? {} : _options$subResource;
- if (options.process) {
- var processKeyword = 'x-oss-process';
- subResource[processKeyword] = options.process;
- }
- if (options.trafficLimit) {
- var trafficLimitKey = 'x-oss-traffic-limit';
- subResource[trafficLimitKey] = options.trafficLimit;
- }
- if (options.response) {
- Object.keys(options.response).forEach(function (k) {
- var key = "response-".concat(k.toLowerCase());
- subResource[key] = options.response[k];
- });
- }
- Object.keys(options).forEach(function (key) {
- var lowerKey = key.toLowerCase();
- var value = options[key];
- if (lowerKey.indexOf('x-oss-') === 0) {
- headers[lowerKey] = value;
- } else if (lowerKey.indexOf('content-md5') === 0) {
- headers[key] = value;
- } else if (lowerKey.indexOf('content-type') === 0) {
- headers[key] = value;
- }
- });
- if (Object.prototype.hasOwnProperty.call(options, 'security-token')) {
- subResource['security-token'] = options['security-token'];
- }
- if (Object.prototype.hasOwnProperty.call(options, 'callback')) {
- var json = {
- callbackUrl: encodeURI(options.callback.url),
- callbackBody: options.callback.body
- };
- if (options.callback.host) {
- json.callbackHost = options.callback.host;
- }
- if (options.callback.contentType) {
- json.callbackBodyType = options.callback.contentType;
- }
- subResource.callback = Buffer.from(JSON.stringify(json)).toString('base64');
- if (options.callback.customValue) {
- var callbackVar = {};
- Object.keys(options.callback.customValue).forEach(function (key) {
- callbackVar["x:".concat(key)] = options.callback.customValue[key];
- });
- subResource['callback-var'] = Buffer.from(JSON.stringify(callbackVar)).toString('base64');
- }
- }
- var canonicalString = this.buildCanonicalString(options.method, resource, {
- headers: headers,
- parameters: subResource
- }, expires.toString());
- return {
- Signature: this.computeSignature(accessKeySecret, canonicalString, headerEncoding),
- subResource: subResource
- };
- };
- }).call(this)}).call(this,require("buffer").Buffer)
- },{"./../../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){
- "use strict";
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.checkBucketName = void 0;
- exports.checkBucketName = function (name) {
- var createBucket = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
- 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_]$/;
- if (!bucketRegex.test(name)) {
- throw new Error('The bucket must be conform to the specifications');
- }
- };
- },{}],51:[function(require,module,exports){
- "use strict";
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.checkConfigValid = void 0;
- var checkConfigMap = {
- endpoint: checkEndpoint,
- region: /^[a-zA-Z0-9\-_]+$/
- };
- function checkEndpoint(endpoint) {
- if (typeof endpoint === 'string') {
- return /^[a-zA-Z0-9._:/-]+$/.test(endpoint);
- } else if (endpoint.host) {
- return /^[a-zA-Z0-9._:/-]+$/.test(endpoint.host);
- }
- return false;
- }
- exports.checkConfigValid = function (conf, key) {
- if (checkConfigMap[key]) {
- var isConfigValid = true;
- if (checkConfigMap[key] instanceof Function) {
- isConfigValid = checkConfigMap[key](conf);
- } else {
- isConfigValid = checkConfigMap[key].test(conf);
- }
- if (!isConfigValid) {
- throw new Error("The ".concat(key, " must be conform to the specifications"));
- }
- }
- };
- },{}],52:[function(require,module,exports){
- "use strict";
- require("core-js/modules/es.array.concat.js");
- require("core-js/modules/es.object.entries.js");
- require("core-js/modules/web.dom-collections.for-each.js");
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.checkObjectTag = void 0;
- var _require = require('./checkValid'),
- checkValid = _require.checkValid;
- var _require2 = require('./isObject'),
- isObject = _require2.isObject;
- var commonRules = [{
- validator: function validator(value) {
- if (typeof value !== 'string') {
- throw new Error('the key and value of the tag must be String');
- }
- }
- }, {
- pattern: /^[a-zA-Z0-9 +-=._:/]+$/,
- msg: 'tag can contain letters, numbers, spaces, and the following symbols: plus sign (+), hyphen (-), equal sign (=), period (.), underscore (_), colon (:), and forward slash (/)'
- }];
- var rules = {
- key: [].concat(commonRules, [{
- pattern: /^.{1,128}$/,
- msg: 'tag key can be a maximum of 128 bytes in length'
- }]),
- value: [].concat(commonRules, [{
- pattern: /^.{0,256}$/,
- msg: 'tag value can be a maximum of 256 bytes in length'
- }])
- };
- function checkObjectTag(tag) {
- if (!isObject(tag)) {
- throw new Error('tag must be Object');
- }
- var entries = Object.entries(tag);
- if (entries.length > 10) {
- throw new Error('maximum of 10 tags for a object');
- }
- var rulesIndexKey = ['key', 'value'];
- entries.forEach(function (keyValue) {
- keyValue.forEach(function (item, index) {
- checkValid(item, rules[rulesIndexKey[index]]);
- });
- });
- }
- exports.checkObjectTag = checkObjectTag;
- },{"./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){
- "use strict";
- require("core-js/modules/web.dom-collections.for-each.js");
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.checkValid = void 0;
- function checkValid(_value, _rules) {
- _rules.forEach(function (rule) {
- if (rule.validator) {
- rule.validator(_value);
- } else if (rule.pattern && !rule.pattern.test(_value)) {
- throw new Error(rule.msg);
- }
- });
- }
- exports.checkValid = checkValid;
- },{"core-js/modules/web.dom-collections.for-each.js":296}],54:[function(require,module,exports){
- (function (Buffer){(function (){
- "use strict";
- require("core-js/modules/es.array.includes.js");
- require("core-js/modules/es.string.includes.js");
- require("core-js/modules/es.object.assign.js");
- require("core-js/modules/es.array.concat.js");
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.createRequest = void 0;
- var crypto = require('./../../../shims/crypto/crypto.js');
- var debug = require('debug')('ali-oss');
- var mime = require('mime');
- var dateFormat = require('dateformat');
- var copy = require('copy-to');
- var path = require('path');
- var _require = require('./encoder'),
- encoder = _require.encoder;
- var _require2 = require('./isIP'),
- isIP = _require2.isIP;
- var _require3 = require('./setRegion'),
- setRegion = _require3.setRegion;
- var _require4 = require('../client/getReqUrl'),
- getReqUrl = _require4.getReqUrl;
- function getHeader(headers, name) {
- return headers[name] || headers[name.toLowerCase()];
- }
- function delHeader(headers, name) {
- delete headers[name];
- delete headers[name.toLowerCase()];
- }
- function createRequest(params) {
- var date = new Date();
- if (this.options.amendTimeSkewed) {
- date = +new Date() + this.options.amendTimeSkewed;
- }
- var headers = {
- 'x-oss-date': dateFormat(date, 'UTC:ddd, dd mmm yyyy HH:MM:ss \'GMT\'')
- };
- if (typeof window !== 'undefined') {
- headers['x-oss-user-agent'] = this.userAgent;
- }
- if (this.userAgent.includes('nodejs')) {
- headers['User-Agent'] = this.userAgent;
- }
- if (this.options.isRequestPay) {
- Object.assign(headers, {
- 'x-oss-request-payer': 'requester'
- });
- }
- if (this.options.stsToken) {
- headers['x-oss-security-token'] = this.options.stsToken;
- }
- copy(params.headers).to(headers);
- if (!getHeader(headers, 'Content-Type')) {
- if (params.mime && params.mime.indexOf('/') > 0) {
- headers['Content-Type'] = params.mime;
- } else {
- headers['Content-Type'] = mime.getType(params.mime || path.extname(params.object || ''));
- }
- }
- if (!getHeader(headers, 'Content-Type')) {
- delHeader(headers, 'Content-Type');
- }
- if (params.content) {
- if (!params.disabledMD5) {
- headers['Content-MD5'] = crypto.createHash('md5').update(Buffer.from(params.content, 'utf8')).digest('base64');
- }
- if (!headers['Content-Length']) {
- headers['Content-Length'] = params.content.length;
- }
- }
- var hasOwnProperty = Object.prototype.hasOwnProperty;
- for (var k in headers) {
- if (headers[k] && hasOwnProperty.call(headers, k)) {
- headers[k] = encoder(String(headers[k]), this.options.headerEncoding);
- }
- }
- var authResource = this._getResource(params);
- headers.authorization = this.authorization(params.method, authResource, params.subres, headers, this.options.headerEncoding); // const url = this._getReqUrl(params);
- if (isIP(this.options.endpoint.hostname)) {
- var _this$options = this.options,
- region = _this$options.region,
- internal = _this$options.internal,
- secure = _this$options.secure;
- var hostInfo = setRegion(region, internal, secure);
- headers.host = "".concat(params.bucket, ".").concat(hostInfo.host);
- }
- var url = getReqUrl.bind(this)(params);
- debug('request %s %s, with headers %j, !!stream: %s', params.method, url, headers, !!params.stream);
- var timeout = params.timeout || this.options.timeout;
- var reqParams = {
- method: params.method,
- content: params.content,
- stream: params.stream,
- headers: headers,
- timeout: timeout,
- writeStream: params.writeStream,
- customResponse: params.customResponse,
- ctx: params.ctx || this.ctx
- };
- if (this.agent) {
- reqParams.agent = this.agent;
- }
- if (this.httpsAgent) {
- reqParams.httpsAgent = this.httpsAgent;
- }
- reqParams.enableProxy = !!this.options.enableProxy;
- reqParams.proxy = this.options.proxy ? this.options.proxy : null;
- return {
- url: url,
- params: reqParams
- };
- }
- exports.createRequest = createRequest;
- }).call(this)}).call(this,require("buffer").Buffer)
- },{"../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){
- "use strict";
- require("core-js/modules/web.dom-collections.for-each.js");
- require("core-js/modules/es.object.entries.js");
- require("core-js/modules/es.regexp.exec.js");
- require("core-js/modules/es.string.replace.js");
- require("core-js/modules/es.array.includes.js");
- require("core-js/modules/es.object.keys.js");
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.dataFix = void 0;
- var isObject_1 = require("./isObject");
- var TRUE = ['true', 'TRUE', '1', 1];
- var FALSE = ['false', 'FALSE', '0', 0];
- function dataFix(o, conf, finalKill) {
- if (!isObject_1.isObject(o)) return;
- var _conf$remove = conf.remove,
- remove = _conf$remove === void 0 ? [] : _conf$remove,
- _conf$rename = conf.rename,
- rename = _conf$rename === void 0 ? {} : _conf$rename,
- _conf$camel = conf.camel,
- camel = _conf$camel === void 0 ? [] : _conf$camel,
- _conf$bool = conf.bool,
- bool = _conf$bool === void 0 ? [] : _conf$bool,
- _conf$lowerFirst = conf.lowerFirst,
- lowerFirst = _conf$lowerFirst === void 0 ? false : _conf$lowerFirst; // 删除不需要的数据
- remove.forEach(function (v) {
- return delete o[v];
- }); // 重命名
- Object.entries(rename).forEach(function (v) {
- if (!o[v[0]]) return;
- if (o[v[1]]) return;
- o[v[1]] = o[v[0]];
- delete o[v[0]];
- }); // 驼峰化
- camel.forEach(function (v) {
- if (!o[v]) return;
- var afterKey = v.replace(/^(.)/, function ($0) {
- return $0.toLowerCase();
- }).replace(/-(\w)/g, function (_, $1) {
- return $1.toUpperCase();
- });
- if (o[afterKey]) return;
- o[afterKey] = o[v]; // todo 暂时兼容以前数据,不做删除
- // delete o[v];
- }); // 转换值为布尔值
- bool.forEach(function (v) {
- o[v] = fixBool(o[v]);
- }); // finalKill
- if (typeof finalKill === 'function') {
- finalKill(o);
- } // 首字母转小写
- fixLowerFirst(o, lowerFirst);
- return dataFix;
- }
- exports.dataFix = dataFix;
- function fixBool(value) {
- if (!value) return false;
- if (TRUE.includes(value)) return true;
- return FALSE.includes(value) ? false : value;
- }
- function fixLowerFirst(o, lowerFirst) {
- if (lowerFirst) {
- Object.keys(o).forEach(function (key) {
- var lowerK = key.replace(/^\w/, function (match) {
- return match.toLowerCase();
- });
- if (typeof o[lowerK] === 'undefined') {
- o[lowerK] = o[key];
- delete o[key];
- }
- });
- }
- }
- },{"./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){
- "use strict";
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
- require("core-js/modules/es.array.slice.js");
- require("core-js/modules/web.dom-collections.for-each.js");
- require("core-js/modules/es.object.keys.js");
- var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.deepCopyWith = exports.deepCopy = void 0;
- var isBuffer_1 = require("./isBuffer");
- exports.deepCopy = function (obj) {
- if (obj === null || (0, _typeof2.default)(obj) !== 'object') {
- return obj;
- }
- if (isBuffer_1.isBuffer(obj)) {
- return obj.slice();
- }
- var copy = Array.isArray(obj) ? [] : {};
- Object.keys(obj).forEach(function (key) {
- copy[key] = exports.deepCopy(obj[key]);
- });
- return copy;
- };
- exports.deepCopyWith = function (obj, customizer) {
- function deepCopyWithHelper(value, innerKey, innerObject) {
- var result = customizer(value, innerKey, innerObject);
- if (result !== undefined) return result;
- if (value === null || (0, _typeof2.default)(value) !== 'object') {
- return value;
- }
- if (isBuffer_1.isBuffer(value)) {
- return value.slice();
- }
- var copy = Array.isArray(value) ? [] : {};
- Object.keys(value).forEach(function (k) {
- copy[k] = deepCopyWithHelper(value[k], k, value);
- });
- return copy;
- }
- if (customizer) {
- return deepCopyWithHelper(obj, '', null);
- } else {
- return exports.deepCopy(obj);
- }
- };
- },{"./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){
- (function (Buffer){(function (){
- "use strict";
- require("core-js/modules/es.object.to-string.js");
- require("core-js/modules/es.regexp.to-string.js");
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.encoder = void 0;
- function encoder(str) {
- var encoding = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'utf-8';
- if (encoding === 'utf-8') return str;
- return Buffer.from(str).toString('latin1');
- }
- exports.encoder = encoder;
- }).call(this)}).call(this,require("buffer").Buffer)
- },{"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){
- "use strict";
- require("core-js/modules/es.array.map.js");
- require("core-js/modules/es.regexp.exec.js");
- require("core-js/modules/es.string.replace.js");
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.formatInventoryConfig = void 0;
- var dataFix_1 = require("../utils/dataFix");
- var isObject_1 = require("../utils/isObject");
- var isArray_1 = require("../utils/isArray");
- var formatObjKey_1 = require("../utils/formatObjKey");
- function formatInventoryConfig(inventoryConfig) {
- var toArray = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
- if (toArray && isObject_1.isObject(inventoryConfig)) inventoryConfig = [inventoryConfig];
- if (isArray_1.isArray(inventoryConfig)) {
- inventoryConfig = inventoryConfig.map(formatFn);
- } else {
- inventoryConfig = formatFn(inventoryConfig);
- }
- return inventoryConfig;
- }
- exports.formatInventoryConfig = formatInventoryConfig;
- function formatFn(_) {
- dataFix_1.dataFix(_, {
- bool: ['IsEnabled']
- }, function (conf) {
- var _a, _b; // prefix
- conf.prefix = conf.Filter.Prefix;
- delete conf.Filter; // OSSBucketDestination
- conf.OSSBucketDestination = conf.Destination.OSSBucketDestination; // OSSBucketDestination.rolename
- conf.OSSBucketDestination.rolename = conf.OSSBucketDestination.RoleArn.replace(/.*\//, '');
- delete conf.OSSBucketDestination.RoleArn; // OSSBucketDestination.bucket
- conf.OSSBucketDestination.bucket = conf.OSSBucketDestination.Bucket.replace(/.*:::/, '');
- delete conf.OSSBucketDestination.Bucket;
- delete conf.Destination; // frequency
- conf.frequency = conf.Schedule.Frequency;
- delete conf.Schedule.Frequency; // optionalFields
- 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];
- }); // firstLowerCase
- _ = formatObjKey_1.formatObjKey(_, 'firstLowerCase', {
- exclude: ['OSSBucketDestination', 'SSE-OSS', 'SSE-KMS']
- });
- return _;
- }
- },{"../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){
- "use strict";
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
- require("core-js/modules/web.dom-collections.for-each.js");
- require("core-js/modules/es.object.keys.js");
- require("core-js/modules/es.array.includes.js");
- require("core-js/modules/es.string.includes.js");
- require("core-js/modules/es.regexp.exec.js");
- require("core-js/modules/es.string.replace.js");
- var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.formatObjKey = void 0;
- function formatObjKey(obj, type, options) {
- if (obj === null || (0, _typeof2.default)(obj) !== 'object') {
- return obj;
- }
- var o;
- if (Array.isArray(obj)) {
- o = [];
- for (var i = 0; i < obj.length; i++) {
- o.push(formatObjKey(obj[i], type, options));
- }
- } else {
- o = {};
- Object.keys(obj).forEach(function (key) {
- o[handelFormat(key, type, options)] = formatObjKey(obj[key], type, options);
- });
- }
- return o;
- }
- exports.formatObjKey = formatObjKey;
- function handelFormat(key, type, options) {
- var _a;
- if (options && ((_a = options.exclude) === null || _a === void 0 ? void 0 : _a.includes(key))) return key;
- if (type === 'firstUpperCase') {
- key = key.replace(/^./, function (_) {
- return _.toUpperCase();
- });
- } else if (type === 'firstLowerCase') {
- key = key.replace(/^./, function (_) {
- return _.toLowerCase();
- });
- }
- return key;
- }
- },{"@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){
- "use strict";
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.getStrBytesCount = void 0;
- function getStrBytesCount(str) {
- var bytesCount = 0;
- for (var i = 0; i < str.length; i++) {
- var c = str.charAt(i);
- if (/^[\u00-\uff]$/.test(c)) {
- bytesCount += 1;
- } else {
- bytesCount += 2;
- }
- }
- return bytesCount;
- }
- exports.getStrBytesCount = getStrBytesCount;
- },{}],61:[function(require,module,exports){
- "use strict";
- require("core-js/modules/es.object.to-string.js");
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.isArray = void 0;
- exports.isArray = function (obj) {
- return Object.prototype.toString.call(obj) === '[object Array]';
- };
- },{"core-js/modules/es.object.to-string.js":258}],62:[function(require,module,exports){
- "use strict";
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.isBlob = void 0;
- function isBlob(blob) {
- return typeof Blob !== 'undefined' && blob instanceof Blob;
- }
- exports.isBlob = isBlob;
- },{}],63:[function(require,module,exports){
- (function (Buffer){(function (){
- "use strict";
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.isBuffer = void 0;
- function isBuffer(obj) {
- return Buffer.isBuffer(obj);
- }
- exports.isBuffer = isBuffer;
- }).call(this)}).call(this,{"isBuffer":require("../../../node_modules/is-buffer/index.js")})
- },{"../../../node_modules/is-buffer/index.js":312}],64:[function(require,module,exports){
- "use strict";
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.isFile = void 0;
- exports.isFile = function (obj) {
- return typeof File !== 'undefined' && obj instanceof File;
- };
- },{}],65:[function(require,module,exports){
- "use strict";
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.isFunction = void 0;
- exports.isFunction = function (v) {
- return typeof v === 'function';
- };
- },{}],66:[function(require,module,exports){
- "use strict";
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.isIP = void 0; // it provide commont methods for node and browser , we will add more solutions later in this file
- /**
- * Judge isIP include ipv4 or ipv6
- * @param {String} options
- * @return {Array} the multipart uploads
- */
- exports.isIP = function (host) {
- 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}$/;
- 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*$/;
- return ipv4Regex.test(host) || ipv6Regex.test(host);
- };
- },{}],67:[function(require,module,exports){
- "use strict";
- require("core-js/modules/es.object.to-string.js");
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.isObject = void 0;
- exports.isObject = function (obj) {
- return Object.prototype.toString.call(obj) === '[object Object]';
- };
- },{"core-js/modules/es.object.to-string.js":258}],68:[function(require,module,exports){
- "use strict";
- require("core-js/modules/web.dom-collections.for-each.js");
- require("core-js/modules/es.object.keys.js");
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.lowercaseKeyHeader = void 0;
- var isObject_1 = require("./isObject");
- function lowercaseKeyHeader(headers) {
- var lowercaseHeader = {};
- if (isObject_1.isObject(headers)) {
- Object.keys(headers).forEach(function (key) {
- lowercaseHeader[key.toLowerCase()] = headers[key];
- });
- }
- return lowercaseHeader;
- }
- exports.lowercaseKeyHeader = lowercaseKeyHeader;
- },{"./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){
- "use strict";
- require("core-js/modules/es.regexp.exec.js");
- require("core-js/modules/es.string.replace.js");
- require("core-js/modules/es.object.to-string.js");
- require("core-js/modules/web.dom-collections.for-each.js");
- require("core-js/modules/es.object.keys.js");
- require("core-js/modules/es.array.concat.js");
- require("core-js/modules/es.array.join.js");
- require("core-js/modules/es.array.map.js");
- require("core-js/modules/es.regexp.to-string.js");
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.obj2xml = void 0;
- var formatObjKey_1 = require("./formatObjKey");
- function type(params) {
- return Object.prototype.toString.call(params).replace(/(.*? |])/g, '').toLowerCase();
- }
- function obj2xml(obj, options) {
- var s = '';
- if (options && options.headers) {
- s = '<?xml version="1.0" encoding="UTF-8"?>\n';
- }
- if (options && options.firstUpperCase) {
- obj = formatObjKey_1.formatObjKey(obj, 'firstUpperCase');
- }
- if (type(obj) === 'object') {
- Object.keys(obj).forEach(function (key) {
- // filter undefined or null
- if (type(obj[key]) !== 'undefined' && type(obj[key]) !== 'null') {
- if (type(obj[key]) === 'string' || type(obj[key]) === 'number') {
- s += "<".concat(key, ">").concat(obj[key], "</").concat(key, ">");
- } else if (type(obj[key]) === 'object') {
- s += "<".concat(key, ">").concat(obj2xml(obj[key]), "</").concat(key, ">");
- } else if (type(obj[key]) === 'array') {
- s += obj[key].map(function (keyChild) {
- return "<".concat(key, ">").concat(obj2xml(keyChild), "</").concat(key, ">");
- }).join('');
- } else {
- s += "<".concat(key, ">").concat(obj[key].toString(), "</").concat(key, ">");
- }
- }
- });
- } else {
- s += obj.toString();
- }
- return s;
- }
- exports.obj2xml = obj2xml;
- },{"./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){
- "use strict";
- require("core-js/modules/es.object.to-string.js");
- require("core-js/modules/es.promise.js");
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.retry = void 0;
- function retry(func, retryMax) {
- var config = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
- var retryNum = 0;
- var _config$retryDelay = config.retryDelay,
- retryDelay = _config$retryDelay === void 0 ? 500 : _config$retryDelay,
- _config$errorHandler = config.errorHandler,
- errorHandler = _config$errorHandler === void 0 ? function () {
- return true;
- } : _config$errorHandler;
- var funcR = function funcR() {
- for (var _len = arguments.length, arg = new Array(_len), _key = 0; _key < _len; _key++) {
- arg[_key] = arguments[_key];
- }
- return new Promise(function (resolve, reject) {
- func.apply(void 0, arg).then(function (result) {
- retryNum = 0;
- resolve(result);
- }).catch(function (err) {
- if (retryNum < retryMax && errorHandler(err)) {
- retryNum++;
- setTimeout(function () {
- resolve(funcR.apply(void 0, arg));
- }, retryDelay);
- } else {
- retryNum = 0;
- reject(err);
- }
- });
- });
- };
- return funcR;
- }
- exports.retry = retry;
- },{"core-js/modules/es.object.to-string.js":258,"core-js/modules/es.promise.js":259}],71:[function(require,module,exports){
- "use strict";
- var __importDefault = void 0 && (void 0).__importDefault || function (mod) {
- return mod && mod.__esModule ? mod : {
- "default": mod
- };
- };
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.setRegion = void 0;
- var url_1 = __importDefault(require("url"));
- var checkConfigValid_1 = require("./checkConfigValid");
- function setRegion(region) {
- var internal = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
- var secure = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
- checkConfigValid_1.checkConfigValid(region, 'region');
- var protocol = secure ? 'https://' : 'http://';
- var suffix = internal ? '-internal.aliyuncs.com' : '.aliyuncs.com';
- var prefix = 'vpc100-oss-cn-'; // aliyun VPC region: https://help.aliyun.com/knowledge_detail/38740.html
- if (region.substr(0, prefix.length) === prefix) {
- suffix = '.aliyuncs.com';
- }
- return url_1.default.parse(protocol + region + suffix);
- }
- exports.setRegion = setRegion;
- },{"./checkConfigValid":51,"url":404}],72:[function(require,module,exports){
- "use strict";
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
- var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
- require("core-js/modules/es.object.keys.js");
- require("core-js/modules/es.array.find.js");
- require("core-js/modules/es.object.assign.js");
- var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.checkCredentials = exports.setSTSToken = void 0;
- var formatObjKey_1 = require("./formatObjKey");
- function setSTSToken() {
- return _setSTSToken.apply(this, arguments);
- }
- function _setSTSToken() {
- _setSTSToken = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
- var now, credentials;
- return _regenerator.default.wrap(function _callee$(_context) {
- while (1) {
- switch (_context.prev = _context.next) {
- case 0:
- if (!this.options) this.options = {};
- now = new Date();
- if (!this.stsTokenFreshTime) {
- _context.next = 14;
- break;
- }
- if (!(+now - this.stsTokenFreshTime >= this.options.refreshSTSTokenInterval)) {
- _context.next = 12;
- break;
- }
- this.stsTokenFreshTime = now;
- _context.next = 7;
- return this.options.refreshSTSToken();
- case 7:
- credentials = _context.sent;
- credentials = formatObjKey_1.formatObjKey(credentials, 'firstLowerCase');
- if (credentials.securityToken) {
- credentials.stsToken = credentials.securityToken;
- }
- checkCredentials(credentials);
- Object.assign(this.options, credentials);
- case 12:
- _context.next = 15;
- break;
- case 14:
- this.stsTokenFreshTime = now;
- case 15:
- return _context.abrupt("return", null);
- case 16:
- case "end":
- return _context.stop();
- }
- }
- }, _callee, this);
- }));
- return _setSTSToken.apply(this, arguments);
- }
- exports.setSTSToken = setSTSToken;
- function checkCredentials(obj) {
- var stsTokenKey = ['accessKeySecret', 'accessKeyId', 'stsToken'];
- var objKeys = Object.keys(obj);
- stsTokenKey.forEach(function (_) {
- if (!objKeys.find(function (key) {
- return key === _;
- })) {
- throw Error("refreshSTSToken must return contains ".concat(_));
- }
- });
- }
- exports.checkCredentials = checkCredentials;
- },{"./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){
- function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
- try {
- var info = gen[key](arg);
- var value = info.value;
- } catch (error) {
- reject(error);
- return;
- }
- if (info.done) {
- resolve(value);
- } else {
- Promise.resolve(value).then(_next, _throw);
- }
- }
- function _asyncToGenerator(fn) {
- return function () {
- var self = this,
- args = arguments;
- return new Promise(function (resolve, reject) {
- var gen = fn.apply(self, args);
- function _next(value) {
- asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
- }
- function _throw(err) {
- asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
- }
- _next(undefined);
- });
- };
- }
- module.exports = _asyncToGenerator;
- module.exports["default"] = module.exports, module.exports.__esModule = true;
- },{}],74:[function(require,module,exports){
- function _interopRequireDefault(obj) {
- return obj && obj.__esModule ? obj : {
- "default": obj
- };
- }
- module.exports = _interopRequireDefault;
- module.exports["default"] = module.exports, module.exports.__esModule = true;
- },{}],75:[function(require,module,exports){
- function _typeof(obj) {
- "@babel/helpers - typeof";
- if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
- module.exports = _typeof = function _typeof(obj) {
- return typeof obj;
- };
- module.exports["default"] = module.exports, module.exports.__esModule = true;
- } else {
- module.exports = _typeof = function _typeof(obj) {
- return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
- };
- module.exports["default"] = module.exports, module.exports.__esModule = true;
- }
- return _typeof(obj);
- }
- module.exports = _typeof;
- module.exports["default"] = module.exports, module.exports.__esModule = true;
- },{}],76:[function(require,module,exports){
- module.exports = require("regenerator-runtime");
- },{"regenerator-runtime":342}],77:[function(require,module,exports){
- module.exports = noop;
- module.exports.HttpsAgent = noop;
- // Noop function for browser since native api's don't use agents.
- function noop () {}
- },{}],78:[function(require,module,exports){
- (function (global){(function (){
- 'use strict';
- var objectAssign = require('object-assign');
- // compare and isBuffer taken from https://github.com/feross/buffer/blob/680e9e5e488f22aac27599a57dc844a6315928dd/index.js
- // original notice:
- /*!
- * The buffer module from node.js, for the browser.
- *
- * @author Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
- * @license MIT
- */
- function compare(a, b) {
- if (a === b) {
- return 0;
- }
- var x = a.length;
- var y = b.length;
- for (var i = 0, len = Math.min(x, y); i < len; ++i) {
- if (a[i] !== b[i]) {
- x = a[i];
- y = b[i];
- break;
- }
- }
- if (x < y) {
- return -1;
- }
- if (y < x) {
- return 1;
- }
- return 0;
- }
- function isBuffer(b) {
- if (global.Buffer && typeof global.Buffer.isBuffer === 'function') {
- return global.Buffer.isBuffer(b);
- }
- return !!(b != null && b._isBuffer);
- }
- // based on node assert, original notice:
- // NB: The URL to the CommonJS spec is kept just for tradition.
- // node-assert has evolved a lot since then, both in API and behavior.
- // http://wiki.commonjs.org/wiki/Unit_Testing/1.0
- //
- // THIS IS NOT TESTED NOR LIKELY TO WORK OUTSIDE V8!
- //
- // Originally from narwhal.js (http://narwhaljs.org)
- // Copyright (c) 2009 Thomas Robinson <280north.com>
- //
- // Permission is hereby granted, free of charge, to any person obtaining a copy
- // of this software and associated documentation files (the 'Software'), to
- // deal in the Software without restriction, including without limitation the
- // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
- // sell copies of the Software, and to permit persons to whom the Software is
- // furnished to do so, subject to the following conditions:
- //
- // The above copyright notice and this permission notice shall be included in
- // all copies or substantial portions of the Software.
- //
- // THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- // AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
- // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- var util = require('util/');
- var hasOwn = Object.prototype.hasOwnProperty;
- var pSlice = Array.prototype.slice;
- var functionsHaveNames = (function () {
- return function foo() {}.name === 'foo';
- }());
- function pToString (obj) {
- return Object.prototype.toString.call(obj);
- }
- function isView(arrbuf) {
- if (isBuffer(arrbuf)) {
- return false;
- }
- if (typeof global.ArrayBuffer !== 'function') {
- return false;
- }
- if (typeof ArrayBuffer.isView === 'function') {
- return ArrayBuffer.isView(arrbuf);
- }
- if (!arrbuf) {
- return false;
- }
- if (arrbuf instanceof DataView) {
- return true;
- }
- if (arrbuf.buffer && arrbuf.buffer instanceof ArrayBuffer) {
- return true;
- }
- return false;
- }
- // 1. The assert module provides functions that throw
- // AssertionError's when particular conditions are not met. The
- // assert module must conform to the following interface.
- var assert = module.exports = ok;
- // 2. The AssertionError is defined in assert.
- // new assert.AssertionError({ message: message,
- // actual: actual,
- // expected: expected })
- var regex = /\s*function\s+([^\(\s]*)\s*/;
- // based on https://github.com/ljharb/function.prototype.name/blob/adeeeec8bfcc6068b187d7d9fb3d5bb1d3a30899/implementation.js
- function getName(func) {
- if (!util.isFunction(func)) {
- return;
- }
- if (functionsHaveNames) {
- return func.name;
- }
- var str = func.toString();
- var match = str.match(regex);
- return match && match[1];
- }
- assert.AssertionError = function AssertionError(options) {
- this.name = 'AssertionError';
- this.actual = options.actual;
- this.expected = options.expected;
- this.operator = options.operator;
- if (options.message) {
- this.message = options.message;
- this.generatedMessage = false;
- } else {
- this.message = getMessage(this);
- this.generatedMessage = true;
- }
- var stackStartFunction = options.stackStartFunction || fail;
- if (Error.captureStackTrace) {
- Error.captureStackTrace(this, stackStartFunction);
- } else {
- // non v8 browsers so we can have a stacktrace
- var err = new Error();
- if (err.stack) {
- var out = err.stack;
- // try to strip useless frames
- var fn_name = getName(stackStartFunction);
- var idx = out.indexOf('\n' + fn_name);
- if (idx >= 0) {
- // once we have located the function frame
- // we need to strip out everything before it (and its line)
- var next_line = out.indexOf('\n', idx + 1);
- out = out.substring(next_line + 1);
- }
- this.stack = out;
- }
- }
- };
- // assert.AssertionError instanceof Error
- util.inherits(assert.AssertionError, Error);
- function truncate(s, n) {
- if (typeof s === 'string') {
- return s.length < n ? s : s.slice(0, n);
- } else {
- return s;
- }
- }
- function inspect(something) {
- if (functionsHaveNames || !util.isFunction(something)) {
- return util.inspect(something);
- }
- var rawname = getName(something);
- var name = rawname ? ': ' + rawname : '';
- return '[Function' + name + ']';
- }
- function getMessage(self) {
- return truncate(inspect(self.actual), 128) + ' ' +
- self.operator + ' ' +
- truncate(inspect(self.expected), 128);
- }
- // At present only the three keys mentioned above are used and
- // understood by the spec. Implementations or sub modules can pass
- // other keys to the AssertionError's constructor - they will be
- // ignored.
- // 3. All of the following functions must throw an AssertionError
- // when a corresponding condition is not met, with a message that
- // may be undefined if not provided. All assertion methods provide
- // both the actual and expected values to the assertion error for
- // display purposes.
- function fail(actual, expected, message, operator, stackStartFunction) {
- throw new assert.AssertionError({
- message: message,
- actual: actual,
- expected: expected,
- operator: operator,
- stackStartFunction: stackStartFunction
- });
- }
- // EXTENSION! allows for well behaved errors defined elsewhere.
- assert.fail = fail;
- // 4. Pure assertion tests whether a value is truthy, as determined
- // by !!guard.
- // assert.ok(guard, message_opt);
- // This statement is equivalent to assert.equal(true, !!guard,
- // message_opt);. To test strictly for the value true, use
- // assert.strictEqual(true, guard, message_opt);.
- function ok(value, message) {
- if (!value) fail(value, true, message, '==', assert.ok);
- }
- assert.ok = ok;
- // 5. The equality assertion tests shallow, coercive equality with
- // ==.
- // assert.equal(actual, expected, message_opt);
- assert.equal = function equal(actual, expected, message) {
- if (actual != expected) fail(actual, expected, message, '==', assert.equal);
- };
- // 6. The non-equality assertion tests for whether two objects are not equal
- // with != assert.notEqual(actual, expected, message_opt);
- assert.notEqual = function notEqual(actual, expected, message) {
- if (actual == expected) {
- fail(actual, expected, message, '!=', assert.notEqual);
- }
- };
- // 7. The equivalence assertion tests a deep equality relation.
- // assert.deepEqual(actual, expected, message_opt);
- assert.deepEqual = function deepEqual(actual, expected, message) {
- if (!_deepEqual(actual, expected, false)) {
- fail(actual, expected, message, 'deepEqual', assert.deepEqual);
- }
- };
- assert.deepStrictEqual = function deepStrictEqual(actual, expected, message) {
- if (!_deepEqual(actual, expected, true)) {
- fail(actual, expected, message, 'deepStrictEqual', assert.deepStrictEqual);
- }
- };
- function _deepEqual(actual, expected, strict, memos) {
- // 7.1. All identical values are equivalent, as determined by ===.
- if (actual === expected) {
- return true;
- } else if (isBuffer(actual) && isBuffer(expected)) {
- return compare(actual, expected) === 0;
- // 7.2. If the expected value is a Date object, the actual value is
- // equivalent if it is also a Date object that refers to the same time.
- } else if (util.isDate(actual) && util.isDate(expected)) {
- return actual.getTime() === expected.getTime();
- // 7.3 If the expected value is a RegExp object, the actual value is
- // equivalent if it is also a RegExp object with the same source and
- // properties (`global`, `multiline`, `lastIndex`, `ignoreCase`).
- } else if (util.isRegExp(actual) && util.isRegExp(expected)) {
- return actual.source === expected.source &&
- actual.global === expected.global &&
- actual.multiline === expected.multiline &&
- actual.lastIndex === expected.lastIndex &&
- actual.ignoreCase === expected.ignoreCase;
- // 7.4. Other pairs that do not both pass typeof value == 'object',
- // equivalence is determined by ==.
- } else if ((actual === null || typeof actual !== 'object') &&
- (expected === null || typeof expected !== 'object')) {
- return strict ? actual === expected : actual == expected;
- // If both values are instances of typed arrays, wrap their underlying
- // ArrayBuffers in a Buffer each to increase performance
- // This optimization requires the arrays to have the same type as checked by
- // Object.prototype.toString (aka pToString). Never perform binary
- // comparisons for Float*Arrays, though, since e.g. +0 === -0 but their
- // bit patterns are not identical.
- } else if (isView(actual) && isView(expected) &&
- pToString(actual) === pToString(expected) &&
- !(actual instanceof Float32Array ||
- actual instanceof Float64Array)) {
- return compare(new Uint8Array(actual.buffer),
- new Uint8Array(expected.buffer)) === 0;
- // 7.5 For all other Object pairs, including Array objects, equivalence is
- // determined by having the same number of owned properties (as verified
- // with Object.prototype.hasOwnProperty.call), the same set of keys
- // (although not necessarily the same order), equivalent values for every
- // corresponding key, and an identical 'prototype' property. Note: this
- // accounts for both named and indexed properties on Arrays.
- } else if (isBuffer(actual) !== isBuffer(expected)) {
- return false;
- } else {
- memos = memos || {actual: [], expected: []};
- var actualIndex = memos.actual.indexOf(actual);
- if (actualIndex !== -1) {
- if (actualIndex === memos.expected.indexOf(expected)) {
- return true;
- }
- }
- memos.actual.push(actual);
- memos.expected.push(expected);
- return objEquiv(actual, expected, strict, memos);
- }
- }
- function isArguments(object) {
- return Object.prototype.toString.call(object) == '[object Arguments]';
- }
- function objEquiv(a, b, strict, actualVisitedObjects) {
- if (a === null || a === undefined || b === null || b === undefined)
- return false;
- // if one is a primitive, the other must be same
- if (util.isPrimitive(a) || util.isPrimitive(b))
- return a === b;
- if (strict && Object.getPrototypeOf(a) !== Object.getPrototypeOf(b))
- return false;
- var aIsArgs = isArguments(a);
- var bIsArgs = isArguments(b);
- if ((aIsArgs && !bIsArgs) || (!aIsArgs && bIsArgs))
- return false;
- if (aIsArgs) {
- a = pSlice.call(a);
- b = pSlice.call(b);
- return _deepEqual(a, b, strict);
- }
- var ka = objectKeys(a);
- var kb = objectKeys(b);
- var key, i;
- // having the same number of owned properties (keys incorporates
- // hasOwnProperty)
- if (ka.length !== kb.length)
- return false;
- //the same set of keys (although not necessarily the same order),
- ka.sort();
- kb.sort();
- //~~~cheap key test
- for (i = ka.length - 1; i >= 0; i--) {
- if (ka[i] !== kb[i])
- return false;
- }
- //equivalent values for every corresponding key, and
- //~~~possibly expensive deep test
- for (i = ka.length - 1; i >= 0; i--) {
- key = ka[i];
- if (!_deepEqual(a[key], b[key], strict, actualVisitedObjects))
- return false;
- }
- return true;
- }
- // 8. The non-equivalence assertion tests for any deep inequality.
- // assert.notDeepEqual(actual, expected, message_opt);
- assert.notDeepEqual = function notDeepEqual(actual, expected, message) {
- if (_deepEqual(actual, expected, false)) {
- fail(actual, expected, message, 'notDeepEqual', assert.notDeepEqual);
- }
- };
- assert.notDeepStrictEqual = notDeepStrictEqual;
- function notDeepStrictEqual(actual, expected, message) {
- if (_deepEqual(actual, expected, true)) {
- fail(actual, expected, message, 'notDeepStrictEqual', notDeepStrictEqual);
- }
- }
- // 9. The strict equality assertion tests strict equality, as determined by ===.
- // assert.strictEqual(actual, expected, message_opt);
- assert.strictEqual = function strictEqual(actual, expected, message) {
- if (actual !== expected) {
- fail(actual, expected, message, '===', assert.strictEqual);
- }
- };
- // 10. The strict non-equality assertion tests for strict inequality, as
- // determined by !==. assert.notStrictEqual(actual, expected, message_opt);
- assert.notStrictEqual = function notStrictEqual(actual, expected, message) {
- if (actual === expected) {
- fail(actual, expected, message, '!==', assert.notStrictEqual);
- }
- };
- function expectedException(actual, expected) {
- if (!actual || !expected) {
- return false;
- }
- if (Object.prototype.toString.call(expected) == '[object RegExp]') {
- return expected.test(actual);
- }
- try {
- if (actual instanceof expected) {
- return true;
- }
- } catch (e) {
- // Ignore. The instanceof check doesn't work for arrow functions.
- }
- if (Error.isPrototypeOf(expected)) {
- return false;
- }
- return expected.call({}, actual) === true;
- }
- function _tryBlock(block) {
- var error;
- try {
- block();
- } catch (e) {
- error = e;
- }
- return error;
- }
- function _throws(shouldThrow, block, expected, message) {
- var actual;
- if (typeof block !== 'function') {
- throw new TypeError('"block" argument must be a function');
- }
- if (typeof expected === 'string') {
- message = expected;
- expected = null;
- }
- actual = _tryBlock(block);
- message = (expected && expected.name ? ' (' + expected.name + ').' : '.') +
- (message ? ' ' + message : '.');
- if (shouldThrow && !actual) {
- fail(actual, expected, 'Missing expected exception' + message);
- }
- var userProvidedMessage = typeof message === 'string';
- var isUnwantedException = !shouldThrow && util.isError(actual);
- var isUnexpectedException = !shouldThrow && actual && !expected;
- if ((isUnwantedException &&
- userProvidedMessage &&
- expectedException(actual, expected)) ||
- isUnexpectedException) {
- fail(actual, expected, 'Got unwanted exception' + message);
- }
- if ((shouldThrow && actual && expected &&
- !expectedException(actual, expected)) || (!shouldThrow && actual)) {
- throw actual;
- }
- }
- // 11. Expected to throw an error:
- // assert.throws(block, Error_opt, message_opt);
- assert.throws = function(block, /*optional*/error, /*optional*/message) {
- _throws(true, block, error, message);
- };
- // EXTENSION! This is annoying to write outside this module.
- assert.doesNotThrow = function(block, /*optional*/error, /*optional*/message) {
- _throws(false, block, error, message);
- };
- assert.ifError = function(err) { if (err) throw err; };
- // Expose a strict only variant of assert
- function strict(value, message) {
- if (!value) fail(value, true, message, '==', strict);
- }
- assert.strict = objectAssign(strict, assert, {
- equal: assert.strictEqual,
- deepEqual: assert.deepStrictEqual,
- notEqual: assert.notStrictEqual,
- notDeepEqual: assert.notDeepStrictEqual
- });
- assert.strict.strict = assert.strict;
- var objectKeys = Object.keys || function (obj) {
- var keys = [];
- for (var key in obj) {
- if (hasOwn.call(obj, key)) keys.push(key);
- }
- return keys;
- };
- }).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
- },{"object-assign":320,"util/":81}],79:[function(require,module,exports){
- if (typeof Object.create === 'function') {
- // implementation from standard node.js 'util' module
- module.exports = function inherits(ctor, superCtor) {
- ctor.super_ = superCtor
- ctor.prototype = Object.create(superCtor.prototype, {
- constructor: {
- value: ctor,
- enumerable: false,
- writable: true,
- configurable: true
- }
- });
- };
- } else {
- // old school shim for old browsers
- module.exports = function inherits(ctor, superCtor) {
- ctor.super_ = superCtor
- var TempCtor = function () {}
- TempCtor.prototype = superCtor.prototype
- ctor.prototype = new TempCtor()
- ctor.prototype.constructor = ctor
- }
- }
- },{}],80:[function(require,module,exports){
- module.exports = function isBuffer(arg) {
- return arg && typeof arg === 'object'
- && typeof arg.copy === 'function'
- && typeof arg.fill === 'function'
- && typeof arg.readUInt8 === 'function';
- }
- },{}],81:[function(require,module,exports){
- (function (process,global){(function (){
- // Copyright Joyent, Inc. and other Node contributors.
- //
- // Permission is hereby granted, free of charge, to any person obtaining a
- // copy of this software and associated documentation files (the
- // "Software"), to deal in the Software without restriction, including
- // without limitation the rights to use, copy, modify, merge, publish,
- // distribute, sublicense, and/or sell copies of the Software, and to permit
- // persons to whom the Software is furnished to do so, subject to the
- // following conditions:
- //
- // The above copyright notice and this permission notice shall be included
- // in all copies or substantial portions of the Software.
- //
- // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
- // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
- // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
- // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
- // USE OR OTHER DEALINGS IN THE SOFTWARE.
- var formatRegExp = /%[sdj%]/g;
- exports.format = function(f) {
- if (!isString(f)) {
- var objects = [];
- for (var i = 0; i < arguments.length; i++) {
- objects.push(inspect(arguments[i]));
- }
- return objects.join(' ');
- }
- var i = 1;
- var args = arguments;
- var len = args.length;
- var str = String(f).replace(formatRegExp, function(x) {
- if (x === '%%') return '%';
- if (i >= len) return x;
- switch (x) {
- case '%s': return String(args[i++]);
- case '%d': return Number(args[i++]);
- case '%j':
- try {
- return JSON.stringify(args[i++]);
- } catch (_) {
- return '[Circular]';
- }
- default:
- return x;
- }
- });
- for (var x = args[i]; i < len; x = args[++i]) {
- if (isNull(x) || !isObject(x)) {
- str += ' ' + x;
- } else {
- str += ' ' + inspect(x);
- }
- }
- return str;
- };
- // Mark that a method should not be used.
- // Returns a modified function which warns once by default.
- // If --no-deprecation is set, then it is a no-op.
- exports.deprecate = function(fn, msg) {
- // Allow for deprecating things in the process of starting up.
- if (isUndefined(global.process)) {
- return function() {
- return exports.deprecate(fn, msg).apply(this, arguments);
- };
- }
- if (process.noDeprecation === true) {
- return fn;
- }
- var warned = false;
- function deprecated() {
- if (!warned) {
- if (process.throwDeprecation) {
- throw new Error(msg);
- } else if (process.traceDeprecation) {
- console.trace(msg);
- } else {
- console.error(msg);
- }
- warned = true;
- }
- return fn.apply(this, arguments);
- }
- return deprecated;
- };
- var debugs = {};
- var debugEnviron;
- exports.debuglog = function(set) {
- if (isUndefined(debugEnviron))
- debugEnviron = process.env.NODE_DEBUG || '';
- set = set.toUpperCase();
- if (!debugs[set]) {
- if (new RegExp('\\b' + set + '\\b', 'i').test(debugEnviron)) {
- var pid = process.pid;
- debugs[set] = function() {
- var msg = exports.format.apply(exports, arguments);
- console.error('%s %d: %s', set, pid, msg);
- };
- } else {
- debugs[set] = function() {};
- }
- }
- return debugs[set];
- };
- /**
- * Echos the value of a value. Trys to print the value out
- * in the best way possible given the different types.
- *
- * @param {Object} obj The object to print out.
- * @param {Object} opts Optional options object that alters the output.
- */
- /* legacy: obj, showHidden, depth, colors*/
- function inspect(obj, opts) {
- // default options
- var ctx = {
- seen: [],
- stylize: stylizeNoColor
- };
- // legacy...
- if (arguments.length >= 3) ctx.depth = arguments[2];
- if (arguments.length >= 4) ctx.colors = arguments[3];
- if (isBoolean(opts)) {
- // legacy...
- ctx.showHidden = opts;
- } else if (opts) {
- // got an "options" object
- exports._extend(ctx, opts);
- }
- // set default options
- if (isUndefined(ctx.showHidden)) ctx.showHidden = false;
- if (isUndefined(ctx.depth)) ctx.depth = 2;
- if (isUndefined(ctx.colors)) ctx.colors = false;
- if (isUndefined(ctx.customInspect)) ctx.customInspect = true;
- if (ctx.colors) ctx.stylize = stylizeWithColor;
- return formatValue(ctx, obj, ctx.depth);
- }
- exports.inspect = inspect;
- // http://en.wikipedia.org/wiki/ANSI_escape_code#graphics
- inspect.colors = {
- 'bold' : [1, 22],
- 'italic' : [3, 23],
- 'underline' : [4, 24],
- 'inverse' : [7, 27],
- 'white' : [37, 39],
- 'grey' : [90, 39],
- 'black' : [30, 39],
- 'blue' : [34, 39],
- 'cyan' : [36, 39],
- 'green' : [32, 39],
- 'magenta' : [35, 39],
- 'red' : [31, 39],
- 'yellow' : [33, 39]
- };
- // Don't use 'blue' not visible on cmd.exe
- inspect.styles = {
- 'special': 'cyan',
- 'number': 'yellow',
- 'boolean': 'yellow',
- 'undefined': 'grey',
- 'null': 'bold',
- 'string': 'green',
- 'date': 'magenta',
- // "name": intentionally not styling
- 'regexp': 'red'
- };
- function stylizeWithColor(str, styleType) {
- var style = inspect.styles[styleType];
- if (style) {
- return '\u001b[' + inspect.colors[style][0] + 'm' + str +
- '\u001b[' + inspect.colors[style][1] + 'm';
- } else {
- return str;
- }
- }
- function stylizeNoColor(str, styleType) {
- return str;
- }
- function arrayToHash(array) {
- var hash = {};
- array.forEach(function(val, idx) {
- hash[val] = true;
- });
- return hash;
- }
- function formatValue(ctx, value, recurseTimes) {
- // Provide a hook for user-specified inspect functions.
- // Check that value is an object with an inspect function on it
- if (ctx.customInspect &&
- value &&
- isFunction(value.inspect) &&
- // Filter out the util module, it's inspect function is special
- value.inspect !== exports.inspect &&
- // Also filter out any prototype objects using the circular check.
- !(value.constructor && value.constructor.prototype === value)) {
- var ret = value.inspect(recurseTimes, ctx);
- if (!isString(ret)) {
- ret = formatValue(ctx, ret, recurseTimes);
- }
- return ret;
- }
- // Primitive types cannot have properties
- var primitive = formatPrimitive(ctx, value);
- if (primitive) {
- return primitive;
- }
- // Look up the keys of the object.
- var keys = Object.keys(value);
- var visibleKeys = arrayToHash(keys);
- if (ctx.showHidden) {
- keys = Object.getOwnPropertyNames(value);
- }
- // IE doesn't make error fields non-enumerable
- // http://msdn.microsoft.com/en-us/library/ie/dww52sbt(v=vs.94).aspx
- if (isError(value)
- && (keys.indexOf('message') >= 0 || keys.indexOf('description') >= 0)) {
- return formatError(value);
- }
- // Some type of object without properties can be shortcutted.
- if (keys.length === 0) {
- if (isFunction(value)) {
- var name = value.name ? ': ' + value.name : '';
- return ctx.stylize('[Function' + name + ']', 'special');
- }
- if (isRegExp(value)) {
- return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');
- }
- if (isDate(value)) {
- return ctx.stylize(Date.prototype.toString.call(value), 'date');
- }
- if (isError(value)) {
- return formatError(value);
- }
- }
- var base = '', array = false, braces = ['{', '}'];
- // Make Array say that they are Array
- if (isArray(value)) {
- array = true;
- braces = ['[', ']'];
- }
- // Make functions say that they are functions
- if (isFunction(value)) {
- var n = value.name ? ': ' + value.name : '';
- base = ' [Function' + n + ']';
- }
- // Make RegExps say that they are RegExps
- if (isRegExp(value)) {
- base = ' ' + RegExp.prototype.toString.call(value);
- }
- // Make dates with properties first say the date
- if (isDate(value)) {
- base = ' ' + Date.prototype.toUTCString.call(value);
- }
- // Make error with message first say the error
- if (isError(value)) {
- base = ' ' + formatError(value);
- }
- if (keys.length === 0 && (!array || value.length == 0)) {
- return braces[0] + base + braces[1];
- }
- if (recurseTimes < 0) {
- if (isRegExp(value)) {
- return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');
- } else {
- return ctx.stylize('[Object]', 'special');
- }
- }
- ctx.seen.push(value);
- var output;
- if (array) {
- output = formatArray(ctx, value, recurseTimes, visibleKeys, keys);
- } else {
- output = keys.map(function(key) {
- return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array);
- });
- }
- ctx.seen.pop();
- return reduceToSingleString(output, base, braces);
- }
- function formatPrimitive(ctx, value) {
- if (isUndefined(value))
- return ctx.stylize('undefined', 'undefined');
- if (isString(value)) {
- var simple = '\'' + JSON.stringify(value).replace(/^"|"$/g, '')
- .replace(/'/g, "\\'")
- .replace(/\\"/g, '"') + '\'';
- return ctx.stylize(simple, 'string');
- }
- if (isNumber(value))
- return ctx.stylize('' + value, 'number');
- if (isBoolean(value))
- return ctx.stylize('' + value, 'boolean');
- // For some reason typeof null is "object", so special case here.
- if (isNull(value))
- return ctx.stylize('null', 'null');
- }
- function formatError(value) {
- return '[' + Error.prototype.toString.call(value) + ']';
- }
- function formatArray(ctx, value, recurseTimes, visibleKeys, keys) {
- var output = [];
- for (var i = 0, l = value.length; i < l; ++i) {
- if (hasOwnProperty(value, String(i))) {
- output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,
- String(i), true));
- } else {
- output.push('');
- }
- }
- keys.forEach(function(key) {
- if (!key.match(/^\d+$/)) {
- output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,
- key, true));
- }
- });
- return output;
- }
- function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) {
- var name, str, desc;
- desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] };
- if (desc.get) {
- if (desc.set) {
- str = ctx.stylize('[Getter/Setter]', 'special');
- } else {
- str = ctx.stylize('[Getter]', 'special');
- }
- } else {
- if (desc.set) {
- str = ctx.stylize('[Setter]', 'special');
- }
- }
- if (!hasOwnProperty(visibleKeys, key)) {
- name = '[' + key + ']';
- }
- if (!str) {
- if (ctx.seen.indexOf(desc.value) < 0) {
- if (isNull(recurseTimes)) {
- str = formatValue(ctx, desc.value, null);
- } else {
- str = formatValue(ctx, desc.value, recurseTimes - 1);
- }
- if (str.indexOf('\n') > -1) {
- if (array) {
- str = str.split('\n').map(function(line) {
- return ' ' + line;
- }).join('\n').substr(2);
- } else {
- str = '\n' + str.split('\n').map(function(line) {
- return ' ' + line;
- }).join('\n');
- }
- }
- } else {
- str = ctx.stylize('[Circular]', 'special');
- }
- }
- if (isUndefined(name)) {
- if (array && key.match(/^\d+$/)) {
- return str;
- }
- name = JSON.stringify('' + key);
- if (name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)) {
- name = name.substr(1, name.length - 2);
- name = ctx.stylize(name, 'name');
- } else {
- name = name.replace(/'/g, "\\'")
- .replace(/\\"/g, '"')
- .replace(/(^"|"$)/g, "'");
- name = ctx.stylize(name, 'string');
- }
- }
- return name + ': ' + str;
- }
- function reduceToSingleString(output, base, braces) {
- var numLinesEst = 0;
- var length = output.reduce(function(prev, cur) {
- numLinesEst++;
- if (cur.indexOf('\n') >= 0) numLinesEst++;
- return prev + cur.replace(/\u001b\[\d\d?m/g, '').length + 1;
- }, 0);
- if (length > 60) {
- return braces[0] +
- (base === '' ? '' : base + '\n ') +
- ' ' +
- output.join(',\n ') +
- ' ' +
- braces[1];
- }
- return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1];
- }
- // NOTE: These type checking functions intentionally don't use `instanceof`
- // because it is fragile and can be easily faked with `Object.create()`.
- function isArray(ar) {
- return Array.isArray(ar);
- }
- exports.isArray = isArray;
- function isBoolean(arg) {
- return typeof arg === 'boolean';
- }
- exports.isBoolean = isBoolean;
- function isNull(arg) {
- return arg === null;
- }
- exports.isNull = isNull;
- function isNullOrUndefined(arg) {
- return arg == null;
- }
- exports.isNullOrUndefined = isNullOrUndefined;
- function isNumber(arg) {
- return typeof arg === 'number';
- }
- exports.isNumber = isNumber;
- function isString(arg) {
- return typeof arg === 'string';
- }
- exports.isString = isString;
- function isSymbol(arg) {
- return typeof arg === 'symbol';
- }
- exports.isSymbol = isSymbol;
- function isUndefined(arg) {
- return arg === void 0;
- }
- exports.isUndefined = isUndefined;
- function isRegExp(re) {
- return isObject(re) && objectToString(re) === '[object RegExp]';
- }
- exports.isRegExp = isRegExp;
- function isObject(arg) {
- return typeof arg === 'object' && arg !== null;
- }
- exports.isObject = isObject;
- function isDate(d) {
- return isObject(d) && objectToString(d) === '[object Date]';
- }
- exports.isDate = isDate;
- function isError(e) {
- return isObject(e) &&
- (objectToString(e) === '[object Error]' || e instanceof Error);
- }
- exports.isError = isError;
- function isFunction(arg) {
- return typeof arg === 'function';
- }
- exports.isFunction = isFunction;
- function isPrimitive(arg) {
- return arg === null ||
- typeof arg === 'boolean' ||
- typeof arg === 'number' ||
- typeof arg === 'string' ||
- typeof arg === 'symbol' || // ES6 symbol
- typeof arg === 'undefined';
- }
- exports.isPrimitive = isPrimitive;
- exports.isBuffer = require('./support/isBuffer');
- function objectToString(o) {
- return Object.prototype.toString.call(o);
- }
- function pad(n) {
- return n < 10 ? '0' + n.toString(10) : n.toString(10);
- }
- var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep',
- 'Oct', 'Nov', 'Dec'];
- // 26 Feb 16:19:34
- function timestamp() {
- var d = new Date();
- var time = [pad(d.getHours()),
- pad(d.getMinutes()),
- pad(d.getSeconds())].join(':');
- return [d.getDate(), months[d.getMonth()], time].join(' ');
- }
- // log is just a thin wrapper to console.log that prepends a timestamp
- exports.log = function() {
- console.log('%s - %s', timestamp(), exports.format.apply(exports, arguments));
- };
- /**
- * Inherit the prototype methods from one constructor into another.
- *
- * The Function.prototype.inherits from lang.js rewritten as a standalone
- * function (not on Function.prototype). NOTE: If this file is to be loaded
- * during bootstrapping this function needs to be rewritten using some native
- * functions as prototype setup using normal JavaScript does not work as
- * expected during bootstrapping (see mirror.js in r114903).
- *
- * @param {function} ctor Constructor function which needs to inherit the
- * prototype.
- * @param {function} superCtor Constructor function to inherit prototype from.
- */
- exports.inherits = require('inherits');
- exports._extend = function(origin, add) {
- // Don't do anything if add isn't an object
- if (!add || !isObject(add)) return origin;
- var keys = Object.keys(add);
- var i = keys.length;
- while (i--) {
- origin[keys[i]] = add[keys[i]];
- }
- return origin;
- };
- function hasOwnProperty(obj, prop) {
- return Object.prototype.hasOwnProperty.call(obj, prop);
- }
- }).call(this)}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
- },{"./support/isBuffer":80,"_process":399,"inherits":79}],82:[function(require,module,exports){
- 'use strict'
- exports.byteLength = byteLength
- exports.toByteArray = toByteArray
- exports.fromByteArray = fromByteArray
- var lookup = []
- var revLookup = []
- var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array
- var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
- for (var i = 0, len = code.length; i < len; ++i) {
- lookup[i] = code[i]
- revLookup[code.charCodeAt(i)] = i
- }
- // Support decoding URL-safe base64 strings, as Node.js does.
- // See: https://en.wikipedia.org/wiki/Base64#URL_applications
- revLookup['-'.charCodeAt(0)] = 62
- revLookup['_'.charCodeAt(0)] = 63
- function getLens (b64) {
- var len = b64.length
- if (len % 4 > 0) {
- throw new Error('Invalid string. Length must be a multiple of 4')
- }
- // Trim off extra bytes after placeholder bytes are found
- // See: https://github.com/beatgammit/base64-js/issues/42
- var validLen = b64.indexOf('=')
- if (validLen === -1) validLen = len
- var placeHoldersLen = validLen === len
- ? 0
- : 4 - (validLen % 4)
- return [validLen, placeHoldersLen]
- }
- // base64 is 4/3 + up to two characters of the original data
- function byteLength (b64) {
- var lens = getLens(b64)
- var validLen = lens[0]
- var placeHoldersLen = lens[1]
- return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
- }
- function _byteLength (b64, validLen, placeHoldersLen) {
- return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
- }
- function toByteArray (b64) {
- var tmp
- var lens = getLens(b64)
- var validLen = lens[0]
- var placeHoldersLen = lens[1]
- var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen))
- var curByte = 0
- // if there are placeholders, only get up to the last complete 4 chars
- var len = placeHoldersLen > 0
- ? validLen - 4
- : validLen
- var i
- for (i = 0; i < len; i += 4) {
- tmp =
- (revLookup[b64.charCodeAt(i)] << 18) |
- (revLookup[b64.charCodeAt(i + 1)] << 12) |
- (revLookup[b64.charCodeAt(i + 2)] << 6) |
- revLookup[b64.charCodeAt(i + 3)]
- arr[curByte++] = (tmp >> 16) & 0xFF
- arr[curByte++] = (tmp >> 8) & 0xFF
- arr[curByte++] = tmp & 0xFF
- }
- if (placeHoldersLen === 2) {
- tmp =
- (revLookup[b64.charCodeAt(i)] << 2) |
- (revLookup[b64.charCodeAt(i + 1)] >> 4)
- arr[curByte++] = tmp & 0xFF
- }
- if (placeHoldersLen === 1) {
- tmp =
- (revLookup[b64.charCodeAt(i)] << 10) |
- (revLookup[b64.charCodeAt(i + 1)] << 4) |
- (revLookup[b64.charCodeAt(i + 2)] >> 2)
- arr[curByte++] = (tmp >> 8) & 0xFF
- arr[curByte++] = tmp & 0xFF
- }
- return arr
- }
- function tripletToBase64 (num) {
- return lookup[num >> 18 & 0x3F] +
- lookup[num >> 12 & 0x3F] +
- lookup[num >> 6 & 0x3F] +
- lookup[num & 0x3F]
- }
- function encodeChunk (uint8, start, end) {
- var tmp
- var output = []
- for (var i = start; i < end; i += 3) {
- tmp =
- ((uint8[i] << 16) & 0xFF0000) +
- ((uint8[i + 1] << 8) & 0xFF00) +
- (uint8[i + 2] & 0xFF)
- output.push(tripletToBase64(tmp))
- }
- return output.join('')
- }
- function fromByteArray (uint8) {
- var tmp
- var len = uint8.length
- var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes
- var parts = []
- var maxChunkLength = 16383 // must be multiple of 3
- // go through the array every three bytes, we'll deal with trailing stuff later
- for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {
- parts.push(encodeChunk(uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)))
- }
- // pad the end with zeros, but make sure to not forget the extra bytes
- if (extraBytes === 1) {
- tmp = uint8[len - 1]
- parts.push(
- lookup[tmp >> 2] +
- lookup[(tmp << 4) & 0x3F] +
- '=='
- )
- } else if (extraBytes === 2) {
- tmp = (uint8[len - 2] << 8) + uint8[len - 1]
- parts.push(
- lookup[tmp >> 10] +
- lookup[(tmp >> 4) & 0x3F] +
- lookup[(tmp << 2) & 0x3F] +
- '='
- )
- }
- return parts.join('')
- }
- },{}],83:[function(require,module,exports){
- /*!
- * Bowser - a browser detector
- * https://github.com/ded/bowser
- * MIT License | (c) Dustin Diaz 2015
- */
- !function (root, name, definition) {
- if (typeof module != 'undefined' && module.exports) module.exports = definition()
- else if (typeof define == 'function' && define.amd) define(name, definition)
- else root[name] = definition()
- }(this, 'bowser', function () {
- /**
- * See useragents.js for examples of navigator.userAgent
- */
- var t = true
- function detect(ua) {
- function getFirstMatch(regex) {
- var match = ua.match(regex);
- return (match && match.length > 1 && match[1]) || '';
- }
- function getSecondMatch(regex) {
- var match = ua.match(regex);
- return (match && match.length > 1 && match[2]) || '';
- }
- var iosdevice = getFirstMatch(/(ipod|iphone|ipad)/i).toLowerCase()
- , likeAndroid = /like android/i.test(ua)
- , android = !likeAndroid && /android/i.test(ua)
- , nexusMobile = /nexus\s*[0-6]\s*/i.test(ua)
- , nexusTablet = !nexusMobile && /nexus\s*[0-9]+/i.test(ua)
- , chromeos = /CrOS/.test(ua)
- , silk = /silk/i.test(ua)
- , sailfish = /sailfish/i.test(ua)
- , tizen = /tizen/i.test(ua)
- , webos = /(web|hpw)(o|0)s/i.test(ua)
- , windowsphone = /windows phone/i.test(ua)
- , samsungBrowser = /SamsungBrowser/i.test(ua)
- , windows = !windowsphone && /windows/i.test(ua)
- , mac = !iosdevice && !silk && /macintosh/i.test(ua)
- , linux = !android && !sailfish && !tizen && !webos && /linux/i.test(ua)
- , edgeVersion = getSecondMatch(/edg([ea]|ios)\/(\d+(\.\d+)?)/i)
- , versionIdentifier = getFirstMatch(/version\/(\d+(\.\d+)?)/i)
- , tablet = /tablet/i.test(ua) && !/tablet pc/i.test(ua)
- , mobile = !tablet && /[^-]mobi/i.test(ua)
- , xbox = /xbox/i.test(ua)
- , result
- if (/opera/i.test(ua)) {
- // an old Opera
- result = {
- name: 'Opera'
- , opera: t
- , version: versionIdentifier || getFirstMatch(/(?:opera|opr|opios)[\s\/](\d+(\.\d+)?)/i)
- }
- } else if (/opr\/|opios/i.test(ua)) {
- // a new Opera
- result = {
- name: 'Opera'
- , opera: t
- , version: getFirstMatch(/(?:opr|opios)[\s\/](\d+(\.\d+)?)/i) || versionIdentifier
- }
- }
- else if (/SamsungBrowser/i.test(ua)) {
- result = {
- name: 'Samsung Internet for Android'
- , samsungBrowser: t
- , version: versionIdentifier || getFirstMatch(/(?:SamsungBrowser)[\s\/](\d+(\.\d+)?)/i)
- }
- }
- else if (/Whale/i.test(ua)) {
- result = {
- name: 'NAVER Whale browser'
- , whale: t
- , version: getFirstMatch(/(?:whale)[\s\/](\d+(?:\.\d+)+)/i)
- }
- }
- else if (/MZBrowser/i.test(ua)) {
- result = {
- name: 'MZ Browser'
- , mzbrowser: t
- , version: getFirstMatch(/(?:MZBrowser)[\s\/](\d+(?:\.\d+)+)/i)
- }
- }
- else if (/coast/i.test(ua)) {
- result = {
- name: 'Opera Coast'
- , coast: t
- , version: versionIdentifier || getFirstMatch(/(?:coast)[\s\/](\d+(\.\d+)?)/i)
- }
- }
- else if (/focus/i.test(ua)) {
- result = {
- name: 'Focus'
- , focus: t
- , version: getFirstMatch(/(?:focus)[\s\/](\d+(?:\.\d+)+)/i)
- }
- }
- else if (/yabrowser/i.test(ua)) {
- result = {
- name: 'Yandex Browser'
- , yandexbrowser: t
- , version: versionIdentifier || getFirstMatch(/(?:yabrowser)[\s\/](\d+(\.\d+)?)/i)
- }
- }
- else if (/ucbrowser/i.test(ua)) {
- result = {
- name: 'UC Browser'
- , ucbrowser: t
- , version: getFirstMatch(/(?:ucbrowser)[\s\/](\d+(?:\.\d+)+)/i)
- }
- }
- else if (/mxios/i.test(ua)) {
- result = {
- name: 'Maxthon'
- , maxthon: t
- , version: getFirstMatch(/(?:mxios)[\s\/](\d+(?:\.\d+)+)/i)
- }
- }
- else if (/epiphany/i.test(ua)) {
- result = {
- name: 'Epiphany'
- , epiphany: t
- , version: getFirstMatch(/(?:epiphany)[\s\/](\d+(?:\.\d+)+)/i)
- }
- }
- else if (/puffin/i.test(ua)) {
- result = {
- name: 'Puffin'
- , puffin: t
- , version: getFirstMatch(/(?:puffin)[\s\/](\d+(?:\.\d+)?)/i)
- }
- }
- else if (/sleipnir/i.test(ua)) {
- result = {
- name: 'Sleipnir'
- , sleipnir: t
- , version: getFirstMatch(/(?:sleipnir)[\s\/](\d+(?:\.\d+)+)/i)
- }
- }
- else if (/k-meleon/i.test(ua)) {
- result = {
- name: 'K-Meleon'
- , kMeleon: t
- , version: getFirstMatch(/(?:k-meleon)[\s\/](\d+(?:\.\d+)+)/i)
- }
- }
- else if (windowsphone) {
- result = {
- name: 'Windows Phone'
- , osname: 'Windows Phone'
- , windowsphone: t
- }
- if (edgeVersion) {
- result.msedge = t
- result.version = edgeVersion
- }
- else {
- result.msie = t
- result.version = getFirstMatch(/iemobile\/(\d+(\.\d+)?)/i)
- }
- }
- else if (/msie|trident/i.test(ua)) {
- result = {
- name: 'Internet Explorer'
- , msie: t
- , version: getFirstMatch(/(?:msie |rv:)(\d+(\.\d+)?)/i)
- }
- } else if (chromeos) {
- result = {
- name: 'Chrome'
- , osname: 'Chrome OS'
- , chromeos: t
- , chromeBook: t
- , chrome: t
- , version: getFirstMatch(/(?:chrome|crios|crmo)\/(\d+(\.\d+)?)/i)
- }
- } else if (/edg([ea]|ios)/i.test(ua)) {
- result = {
- name: 'Microsoft Edge'
- , msedge: t
- , version: edgeVersion
- }
- }
- else if (/vivaldi/i.test(ua)) {
- result = {
- name: 'Vivaldi'
- , vivaldi: t
- , version: getFirstMatch(/vivaldi\/(\d+(\.\d+)?)/i) || versionIdentifier
- }
- }
- else if (sailfish) {
- result = {
- name: 'Sailfish'
- , osname: 'Sailfish OS'
- , sailfish: t
- , version: getFirstMatch(/sailfish\s?browser\/(\d+(\.\d+)?)/i)
- }
- }
- else if (/seamonkey\//i.test(ua)) {
- result = {
- name: 'SeaMonkey'
- , seamonkey: t
- , version: getFirstMatch(/seamonkey\/(\d+(\.\d+)?)/i)
- }
- }
- else if (/firefox|iceweasel|fxios/i.test(ua)) {
- result = {
- name: 'Firefox'
- , firefox: t
- , version: getFirstMatch(/(?:firefox|iceweasel|fxios)[ \/](\d+(\.\d+)?)/i)
- }
- if (/\((mobile|tablet);[^\)]*rv:[\d\.]+\)/i.test(ua)) {
- result.firefoxos = t
- result.osname = 'Firefox OS'
- }
- }
- else if (silk) {
- result = {
- name: 'Amazon Silk'
- , silk: t
- , version : getFirstMatch(/silk\/(\d+(\.\d+)?)/i)
- }
- }
- else if (/phantom/i.test(ua)) {
- result = {
- name: 'PhantomJS'
- , phantom: t
- , version: getFirstMatch(/phantomjs\/(\d+(\.\d+)?)/i)
- }
- }
- else if (/slimerjs/i.test(ua)) {
- result = {
- name: 'SlimerJS'
- , slimer: t
- , version: getFirstMatch(/slimerjs\/(\d+(\.\d+)?)/i)
- }
- }
- else if (/blackberry|\bbb\d+/i.test(ua) || /rim\stablet/i.test(ua)) {
- result = {
- name: 'BlackBerry'
- , osname: 'BlackBerry OS'
- , blackberry: t
- , version: versionIdentifier || getFirstMatch(/blackberry[\d]+\/(\d+(\.\d+)?)/i)
- }
- }
- else if (webos) {
- result = {
- name: 'WebOS'
- , osname: 'WebOS'
- , webos: t
- , version: versionIdentifier || getFirstMatch(/w(?:eb)?osbrowser\/(\d+(\.\d+)?)/i)
- };
- /touchpad\//i.test(ua) && (result.touchpad = t)
- }
- else if (/bada/i.test(ua)) {
- result = {
- name: 'Bada'
- , osname: 'Bada'
- , bada: t
- , version: getFirstMatch(/dolfin\/(\d+(\.\d+)?)/i)
- };
- }
- else if (tizen) {
- result = {
- name: 'Tizen'
- , osname: 'Tizen'
- , tizen: t
- , version: getFirstMatch(/(?:tizen\s?)?browser\/(\d+(\.\d+)?)/i) || versionIdentifier
- };
- }
- else if (/qupzilla/i.test(ua)) {
- result = {
- name: 'QupZilla'
- , qupzilla: t
- , version: getFirstMatch(/(?:qupzilla)[\s\/](\d+(?:\.\d+)+)/i) || versionIdentifier
- }
- }
- else if (/chromium/i.test(ua)) {
- result = {
- name: 'Chromium'
- , chromium: t
- , version: getFirstMatch(/(?:chromium)[\s\/](\d+(?:\.\d+)?)/i) || versionIdentifier
- }
- }
- else if (/chrome|crios|crmo/i.test(ua)) {
- result = {
- name: 'Chrome'
- , chrome: t
- , version: getFirstMatch(/(?:chrome|crios|crmo)\/(\d+(\.\d+)?)/i)
- }
- }
- else if (android) {
- result = {
- name: 'Android'
- , version: versionIdentifier
- }
- }
- else if (/safari|applewebkit/i.test(ua)) {
- result = {
- name: 'Safari'
- , safari: t
- }
- if (versionIdentifier) {
- result.version = versionIdentifier
- }
- }
- else if (iosdevice) {
- result = {
- name : iosdevice == 'iphone' ? 'iPhone' : iosdevice == 'ipad' ? 'iPad' : 'iPod'
- }
- // WTF: version is not part of user agent in web apps
- if (versionIdentifier) {
- result.version = versionIdentifier
- }
- }
- else if(/googlebot/i.test(ua)) {
- result = {
- name: 'Googlebot'
- , googlebot: t
- , version: getFirstMatch(/googlebot\/(\d+(\.\d+))/i) || versionIdentifier
- }
- }
- else {
- result = {
- name: getFirstMatch(/^(.*)\/(.*) /),
- version: getSecondMatch(/^(.*)\/(.*) /)
- };
- }
- // set webkit or gecko flag for browsers based on these engines
- if (!result.msedge && /(apple)?webkit/i.test(ua)) {
- if (/(apple)?webkit\/537\.36/i.test(ua)) {
- result.name = result.name || "Blink"
- result.blink = t
- } else {
- result.name = result.name || "Webkit"
- result.webkit = t
- }
- if (!result.version && versionIdentifier) {
- result.version = versionIdentifier
- }
- } else if (!result.opera && /gecko\//i.test(ua)) {
- result.name = result.name || "Gecko"
- result.gecko = t
- result.version = result.version || getFirstMatch(/gecko\/(\d+(\.\d+)?)/i)
- }
- // set OS flags for platforms that have multiple browsers
- if (!result.windowsphone && (android || result.silk)) {
- result.android = t
- result.osname = 'Android'
- } else if (!result.windowsphone && iosdevice) {
- result[iosdevice] = t
- result.ios = t
- result.osname = 'iOS'
- } else if (mac) {
- result.mac = t
- result.osname = 'macOS'
- } else if (xbox) {
- result.xbox = t
- result.osname = 'Xbox'
- } else if (windows) {
- result.windows = t
- result.osname = 'Windows'
- } else if (linux) {
- result.linux = t
- result.osname = 'Linux'
- }
- function getWindowsVersion (s) {
- switch (s) {
- case 'NT': return 'NT'
- case 'XP': return 'XP'
- case 'NT 5.0': return '2000'
- case 'NT 5.1': return 'XP'
- case 'NT 5.2': return '2003'
- case 'NT 6.0': return 'Vista'
- case 'NT 6.1': return '7'
- case 'NT 6.2': return '8'
- case 'NT 6.3': return '8.1'
- case 'NT 10.0': return '10'
- default: return undefined
- }
- }
- // OS version extraction
- var osVersion = '';
- if (result.windows) {
- osVersion = getWindowsVersion(getFirstMatch(/Windows ((NT|XP)( \d\d?.\d)?)/i))
- } else if (result.windowsphone) {
- osVersion = getFirstMatch(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i);
- } else if (result.mac) {
- osVersion = getFirstMatch(/Mac OS X (\d+([_\.\s]\d+)*)/i);
- osVersion = osVersion.replace(/[_\s]/g, '.');
- } else if (iosdevice) {
- osVersion = getFirstMatch(/os (\d+([_\s]\d+)*) like mac os x/i);
- osVersion = osVersion.replace(/[_\s]/g, '.');
- } else if (android) {
- osVersion = getFirstMatch(/android[ \/-](\d+(\.\d+)*)/i);
- } else if (result.webos) {
- osVersion = getFirstMatch(/(?:web|hpw)os\/(\d+(\.\d+)*)/i);
- } else if (result.blackberry) {
- osVersion = getFirstMatch(/rim\stablet\sos\s(\d+(\.\d+)*)/i);
- } else if (result.bada) {
- osVersion = getFirstMatch(/bada\/(\d+(\.\d+)*)/i);
- } else if (result.tizen) {
- osVersion = getFirstMatch(/tizen[\/\s](\d+(\.\d+)*)/i);
- }
- if (osVersion) {
- result.osversion = osVersion;
- }
- // device type extraction
- var osMajorVersion = !result.windows && osVersion.split('.')[0];
- if (
- tablet
- || nexusTablet
- || iosdevice == 'ipad'
- || (android && (osMajorVersion == 3 || (osMajorVersion >= 4 && !mobile)))
- || result.silk
- ) {
- result.tablet = t
- } else if (
- mobile
- || iosdevice == 'iphone'
- || iosdevice == 'ipod'
- || android
- || nexusMobile
- || result.blackberry
- || result.webos
- || result.bada
- ) {
- result.mobile = t
- }
- // Graded Browser Support
- // http://developer.yahoo.com/yui/articles/gbs
- if (result.msedge ||
- (result.msie && result.version >= 10) ||
- (result.yandexbrowser && result.version >= 15) ||
- (result.vivaldi && result.version >= 1.0) ||
- (result.chrome && result.version >= 20) ||
- (result.samsungBrowser && result.version >= 4) ||
- (result.whale && compareVersions([result.version, '1.0']) === 1) ||
- (result.mzbrowser && compareVersions([result.version, '6.0']) === 1) ||
- (result.focus && compareVersions([result.version, '1.0']) === 1) ||
- (result.firefox && result.version >= 20.0) ||
- (result.safari && result.version >= 6) ||
- (result.opera && result.version >= 10.0) ||
- (result.ios && result.osversion && result.osversion.split(".")[0] >= 6) ||
- (result.blackberry && result.version >= 10.1)
- || (result.chromium && result.version >= 20)
- ) {
- result.a = t;
- }
- else if ((result.msie && result.version < 10) ||
- (result.chrome && result.version < 20) ||
- (result.firefox && result.version < 20.0) ||
- (result.safari && result.version < 6) ||
- (result.opera && result.version < 10.0) ||
- (result.ios && result.osversion && result.osversion.split(".")[0] < 6)
- || (result.chromium && result.version < 20)
- ) {
- result.c = t
- } else result.x = t
- return result
- }
- var bowser = detect(typeof navigator !== 'undefined' ? navigator.userAgent || '' : '')
- bowser.test = function (browserList) {
- for (var i = 0; i < browserList.length; ++i) {
- var browserItem = browserList[i];
- if (typeof browserItem=== 'string') {
- if (browserItem in bowser) {
- return true;
- }
- }
- }
- return false;
- }
- /**
- * Get version precisions count
- *
- * @example
- * getVersionPrecision("1.10.3") // 3
- *
- * @param {string} version
- * @return {number}
- */
- function getVersionPrecision(version) {
- return version.split(".").length;
- }
- /**
- * Array::map polyfill
- *
- * @param {Array} arr
- * @param {Function} iterator
- * @return {Array}
- */
- function map(arr, iterator) {
- var result = [], i;
- if (Array.prototype.map) {
- return Array.prototype.map.call(arr, iterator);
- }
- for (i = 0; i < arr.length; i++) {
- result.push(iterator(arr[i]));
- }
- return result;
- }
- /**
- * Calculate browser version weight
- *
- * @example
- * compareVersions(['1.10.2.1', '1.8.2.1.90']) // 1
- * compareVersions(['1.010.2.1', '1.09.2.1.90']); // 1
- * compareVersions(['1.10.2.1', '1.10.2.1']); // 0
- * compareVersions(['1.10.2.1', '1.0800.2']); // -1
- *
- * @param {Array<String>} versions versions to compare
- * @return {Number} comparison result
- */
- function compareVersions(versions) {
- // 1) get common precision for both versions, for example for "10.0" and "9" it should be 2
- var precision = Math.max(getVersionPrecision(versions[0]), getVersionPrecision(versions[1]));
- var chunks = map(versions, function (version) {
- var delta = precision - getVersionPrecision(version);
- // 2) "9" -> "9.0" (for precision = 2)
- version = version + new Array(delta + 1).join(".0");
- // 3) "9.0" -> ["000000000"", "000000009"]
- return map(version.split("."), function (chunk) {
- return new Array(20 - chunk.length).join("0") + chunk;
- }).reverse();
- });
- // iterate in reverse order by reversed chunks array
- while (--precision >= 0) {
- // 4) compare: "000000009" > "000000010" = false (but "9" > "10" = true)
- if (chunks[0][precision] > chunks[1][precision]) {
- return 1;
- }
- else if (chunks[0][precision] === chunks[1][precision]) {
- if (precision === 0) {
- // all version chunks are same
- return 0;
- }
- }
- else {
- return -1;
- }
- }
- }
- /**
- * Check if browser is unsupported
- *
- * @example
- * bowser.isUnsupportedBrowser({
- * msie: "10",
- * firefox: "23",
- * chrome: "29",
- * safari: "5.1",
- * opera: "16",
- * phantom: "534"
- * });
- *
- * @param {Object} minVersions map of minimal version to browser
- * @param {Boolean} [strictMode = false] flag to return false if browser wasn't found in map
- * @param {String} [ua] user agent string
- * @return {Boolean}
- */
- function isUnsupportedBrowser(minVersions, strictMode, ua) {
- var _bowser = bowser;
- // make strictMode param optional with ua param usage
- if (typeof strictMode === 'string') {
- ua = strictMode;
- strictMode = void(0);
- }
- if (strictMode === void(0)) {
- strictMode = false;
- }
- if (ua) {
- _bowser = detect(ua);
- }
- var version = "" + _bowser.version;
- for (var browser in minVersions) {
- if (minVersions.hasOwnProperty(browser)) {
- if (_bowser[browser]) {
- if (typeof minVersions[browser] !== 'string') {
- throw new Error('Browser version in the minVersion map should be a string: ' + browser + ': ' + String(minVersions));
- }
- // browser version and min supported version.
- return compareVersions([version, minVersions[browser]]) < 0;
- }
- }
- }
- return strictMode; // not found
- }
- /**
- * Check if browser is supported
- *
- * @param {Object} minVersions map of minimal version to browser
- * @param {Boolean} [strictMode = false] flag to return false if browser wasn't found in map
- * @param {String} [ua] user agent string
- * @return {Boolean}
- */
- function check(minVersions, strictMode, ua) {
- return !isUnsupportedBrowser(minVersions, strictMode, ua);
- }
- bowser.isUnsupportedBrowser = isUnsupportedBrowser;
- bowser.compareVersions = compareVersions;
- bowser.check = check;
- /*
- * Set our detect method to the main bowser object so we can
- * reuse it to test other user agents.
- * This is needed to implement future tests.
- */
- bowser._detect = detect;
- /*
- * Set our detect public method to the main bowser object
- * This is needed to implement bowser in server side
- */
- bowser.detect = detect;
- return bowser
- });
- },{}],84:[function(require,module,exports){
- },{}],85:[function(require,module,exports){
- (function (global,Buffer){(function (){
- /*!
- * The buffer module from node.js, for the browser.
- *
- * @author Feross Aboukhadijeh <http://feross.org>
- * @license MIT
- */
- /* eslint-disable no-proto */
- 'use strict'
- var base64 = require('base64-js')
- var ieee754 = require('ieee754')
- var isArray = require('isarray')
- exports.Buffer = Buffer
- exports.SlowBuffer = SlowBuffer
- exports.INSPECT_MAX_BYTES = 50
- /**
- * If `Buffer.TYPED_ARRAY_SUPPORT`:
- * === true Use Uint8Array implementation (fastest)
- * === false Use Object implementation (most compatible, even IE6)
- *
- * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,
- * Opera 11.6+, iOS 4.2+.
- *
- * Due to various browser bugs, sometimes the Object implementation will be used even
- * when the browser supports typed arrays.
- *
- * Note:
- *
- * - Firefox 4-29 lacks support for adding new properties to `Uint8Array` instances,
- * See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438.
- *
- * - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function.
- *
- * - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of
- * incorrect length in some situations.
- * We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so they
- * get the Object implementation, which is slower but behaves correctly.
- */
- Buffer.TYPED_ARRAY_SUPPORT = global.TYPED_ARRAY_SUPPORT !== undefined
- ? global.TYPED_ARRAY_SUPPORT
- : typedArraySupport()
- /*
- * Export kMaxLength after typed array support is determined.
- */
- exports.kMaxLength = kMaxLength()
- function typedArraySupport () {
- try {
- var arr = new Uint8Array(1)
- arr.__proto__ = {__proto__: Uint8Array.prototype, foo: function () { return 42 }}
- return arr.foo() === 42 && // typed array instances can be augmented
- typeof arr.subarray === 'function' && // chrome 9-10 lack `subarray`
- arr.subarray(1, 1).byteLength === 0 // ie10 has broken `subarray`
- } catch (e) {
- return false
- }
- }
- function kMaxLength () {
- return Buffer.TYPED_ARRAY_SUPPORT
- ? 0x7fffffff
- : 0x3fffffff
- }
- function createBuffer (that, length) {
- if (kMaxLength() < length) {
- throw new RangeError('Invalid typed array length')
- }
- if (Buffer.TYPED_ARRAY_SUPPORT) {
- // Return an augmented `Uint8Array` instance, for best performance
- that = new Uint8Array(length)
- that.__proto__ = Buffer.prototype
- } else {
- // Fallback: Return an object instance of the Buffer class
- if (that === null) {
- that = new Buffer(length)
- }
- that.length = length
- }
- return that
- }
- /**
- * The Buffer constructor returns instances of `Uint8Array` that have their
- * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of
- * `Uint8Array`, so the returned instances will have all the node `Buffer` methods
- * and the `Uint8Array` methods. Square bracket notation works as expected -- it
- * returns a single octet.
- *
- * The `Uint8Array` prototype remains unmodified.
- */
- function Buffer (arg, encodingOrOffset, length) {
- if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) {
- return new Buffer(arg, encodingOrOffset, length)
- }
- // Common case.
- if (typeof arg === 'number') {
- if (typeof encodingOrOffset === 'string') {
- throw new Error(
- 'If encoding is specified then the first argument must be a string'
- )
- }
- return allocUnsafe(this, arg)
- }
- return from(this, arg, encodingOrOffset, length)
- }
- Buffer.poolSize = 8192 // not used by this implementation
- // TODO: Legacy, not needed anymore. Remove in next major version.
- Buffer._augment = function (arr) {
- arr.__proto__ = Buffer.prototype
- return arr
- }
- function from (that, value, encodingOrOffset, length) {
- if (typeof value === 'number') {
- throw new TypeError('"value" argument must not be a number')
- }
- if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) {
- return fromArrayBuffer(that, value, encodingOrOffset, length)
- }
- if (typeof value === 'string') {
- return fromString(that, value, encodingOrOffset)
- }
- return fromObject(that, value)
- }
- /**
- * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError
- * if value is a number.
- * Buffer.from(str[, encoding])
- * Buffer.from(array)
- * Buffer.from(buffer)
- * Buffer.from(arrayBuffer[, byteOffset[, length]])
- **/
- Buffer.from = function (value, encodingOrOffset, length) {
- return from(null, value, encodingOrOffset, length)
- }
- if (Buffer.TYPED_ARRAY_SUPPORT) {
- Buffer.prototype.__proto__ = Uint8Array.prototype
- Buffer.__proto__ = Uint8Array
- if (typeof Symbol !== 'undefined' && Symbol.species &&
- Buffer[Symbol.species] === Buffer) {
- // Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97
- Object.defineProperty(Buffer, Symbol.species, {
- value: null,
- configurable: true
- })
- }
- }
- function assertSize (size) {
- if (typeof size !== 'number') {
- throw new TypeError('"size" argument must be a number')
- } else if (size < 0) {
- throw new RangeError('"size" argument must not be negative')
- }
- }
- function alloc (that, size, fill, encoding) {
- assertSize(size)
- if (size <= 0) {
- return createBuffer(that, size)
- }
- if (fill !== undefined) {
- // Only pay attention to encoding if it's a string. This
- // prevents accidentally sending in a number that would
- // be interpretted as a start offset.
- return typeof encoding === 'string'
- ? createBuffer(that, size).fill(fill, encoding)
- : createBuffer(that, size).fill(fill)
- }
- return createBuffer(that, size)
- }
- /**
- * Creates a new filled Buffer instance.
- * alloc(size[, fill[, encoding]])
- **/
- Buffer.alloc = function (size, fill, encoding) {
- return alloc(null, size, fill, encoding)
- }
- function allocUnsafe (that, size) {
- assertSize(size)
- that = createBuffer(that, size < 0 ? 0 : checked(size) | 0)
- if (!Buffer.TYPED_ARRAY_SUPPORT) {
- for (var i = 0; i < size; ++i) {
- that[i] = 0
- }
- }
- return that
- }
- /**
- * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.
- * */
- Buffer.allocUnsafe = function (size) {
- return allocUnsafe(null, size)
- }
- /**
- * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
- */
- Buffer.allocUnsafeSlow = function (size) {
- return allocUnsafe(null, size)
- }
- function fromString (that, string, encoding) {
- if (typeof encoding !== 'string' || encoding === '') {
- encoding = 'utf8'
- }
- if (!Buffer.isEncoding(encoding)) {
- throw new TypeError('"encoding" must be a valid string encoding')
- }
- var length = byteLength(string, encoding) | 0
- that = createBuffer(that, length)
- var actual = that.write(string, encoding)
- if (actual !== length) {
- // Writing a hex string, for example, that contains invalid characters will
- // cause everything after the first invalid character to be ignored. (e.g.
- // 'abxxcd' will be treated as 'ab')
- that = that.slice(0, actual)
- }
- return that
- }
- function fromArrayLike (that, array) {
- var length = array.length < 0 ? 0 : checked(array.length) | 0
- that = createBuffer(that, length)
- for (var i = 0; i < length; i += 1) {
- that[i] = array[i] & 255
- }
- return that
- }
- function fromArrayBuffer (that, array, byteOffset, length) {
- array.byteLength // this throws if `array` is not a valid ArrayBuffer
- if (byteOffset < 0 || array.byteLength < byteOffset) {
- throw new RangeError('\'offset\' is out of bounds')
- }
- if (array.byteLength < byteOffset + (length || 0)) {
- throw new RangeError('\'length\' is out of bounds')
- }
- if (byteOffset === undefined && length === undefined) {
- array = new Uint8Array(array)
- } else if (length === undefined) {
- array = new Uint8Array(array, byteOffset)
- } else {
- array = new Uint8Array(array, byteOffset, length)
- }
- if (Buffer.TYPED_ARRAY_SUPPORT) {
- // Return an augmented `Uint8Array` instance, for best performance
- that = array
- that.__proto__ = Buffer.prototype
- } else {
- // Fallback: Return an object instance of the Buffer class
- that = fromArrayLike(that, array)
- }
- return that
- }
- function fromObject (that, obj) {
- if (Buffer.isBuffer(obj)) {
- var len = checked(obj.length) | 0
- that = createBuffer(that, len)
- if (that.length === 0) {
- return that
- }
- obj.copy(that, 0, 0, len)
- return that
- }
- if (obj) {
- if ((typeof ArrayBuffer !== 'undefined' &&
- obj.buffer instanceof ArrayBuffer) || 'length' in obj) {
- if (typeof obj.length !== 'number' || isnan(obj.length)) {
- return createBuffer(that, 0)
- }
- return fromArrayLike(that, obj)
- }
- if (obj.type === 'Buffer' && isArray(obj.data)) {
- return fromArrayLike(that, obj.data)
- }
- }
- throw new TypeError('First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.')
- }
- function checked (length) {
- // Note: cannot use `length < kMaxLength()` here because that fails when
- // length is NaN (which is otherwise coerced to zero.)
- if (length >= kMaxLength()) {
- throw new RangeError('Attempt to allocate Buffer larger than maximum ' +
- 'size: 0x' + kMaxLength().toString(16) + ' bytes')
- }
- return length | 0
- }
- function SlowBuffer (length) {
- if (+length != length) { // eslint-disable-line eqeqeq
- length = 0
- }
- return Buffer.alloc(+length)
- }
- Buffer.isBuffer = function isBuffer (b) {
- return !!(b != null && b._isBuffer)
- }
- Buffer.compare = function compare (a, b) {
- if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {
- throw new TypeError('Arguments must be Buffers')
- }
- if (a === b) return 0
- var x = a.length
- var y = b.length
- for (var i = 0, len = Math.min(x, y); i < len; ++i) {
- if (a[i] !== b[i]) {
- x = a[i]
- y = b[i]
- break
- }
- }
- if (x < y) return -1
- if (y < x) return 1
- return 0
- }
- Buffer.isEncoding = function isEncoding (encoding) {
- switch (String(encoding).toLowerCase()) {
- case 'hex':
- case 'utf8':
- case 'utf-8':
- case 'ascii':
- case 'latin1':
- case 'binary':
- case 'base64':
- case 'ucs2':
- case 'ucs-2':
- case 'utf16le':
- case 'utf-16le':
- return true
- default:
- return false
- }
- }
- Buffer.concat = function concat (list, length) {
- if (!isArray(list)) {
- throw new TypeError('"list" argument must be an Array of Buffers')
- }
- if (list.length === 0) {
- return Buffer.alloc(0)
- }
- var i
- if (length === undefined) {
- length = 0
- for (i = 0; i < list.length; ++i) {
- length += list[i].length
- }
- }
- var buffer = Buffer.allocUnsafe(length)
- var pos = 0
- for (i = 0; i < list.length; ++i) {
- var buf = list[i]
- if (!Buffer.isBuffer(buf)) {
- throw new TypeError('"list" argument must be an Array of Buffers')
- }
- buf.copy(buffer, pos)
- pos += buf.length
- }
- return buffer
- }
- function byteLength (string, encoding) {
- if (Buffer.isBuffer(string)) {
- return string.length
- }
- if (typeof ArrayBuffer !== 'undefined' && typeof ArrayBuffer.isView === 'function' &&
- (ArrayBuffer.isView(string) || string instanceof ArrayBuffer)) {
- return string.byteLength
- }
- if (typeof string !== 'string') {
- string = '' + string
- }
- var len = string.length
- if (len === 0) return 0
- // Use a for loop to avoid recursion
- var loweredCase = false
- for (;;) {
- switch (encoding) {
- case 'ascii':
- case 'latin1':
- case 'binary':
- return len
- case 'utf8':
- case 'utf-8':
- case undefined:
- return utf8ToBytes(string).length
- case 'ucs2':
- case 'ucs-2':
- case 'utf16le':
- case 'utf-16le':
- return len * 2
- case 'hex':
- return len >>> 1
- case 'base64':
- return base64ToBytes(string).length
- default:
- if (loweredCase) return utf8ToBytes(string).length // assume utf8
- encoding = ('' + encoding).toLowerCase()
- loweredCase = true
- }
- }
- }
- Buffer.byteLength = byteLength
- function slowToString (encoding, start, end) {
- var loweredCase = false
- // No need to verify that "this.length <= MAX_UINT32" since it's a read-only
- // property of a typed array.
- // This behaves neither like String nor Uint8Array in that we set start/end
- // to their upper/lower bounds if the value passed is out of range.
- // undefined is handled specially as per ECMA-262 6th Edition,
- // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.
- if (start === undefined || start < 0) {
- start = 0
- }
- // Return early if start > this.length. Done here to prevent potential uint32
- // coercion fail below.
- if (start > this.length) {
- return ''
- }
- if (end === undefined || end > this.length) {
- end = this.length
- }
- if (end <= 0) {
- return ''
- }
- // Force coersion to uint32. This will also coerce falsey/NaN values to 0.
- end >>>= 0
- start >>>= 0
- if (end <= start) {
- return ''
- }
- if (!encoding) encoding = 'utf8'
- while (true) {
- switch (encoding) {
- case 'hex':
- return hexSlice(this, start, end)
- case 'utf8':
- case 'utf-8':
- return utf8Slice(this, start, end)
- case 'ascii':
- return asciiSlice(this, start, end)
- case 'latin1':
- case 'binary':
- return latin1Slice(this, start, end)
- case 'base64':
- return base64Slice(this, start, end)
- case 'ucs2':
- case 'ucs-2':
- case 'utf16le':
- case 'utf-16le':
- return utf16leSlice(this, start, end)
- default:
- if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
- encoding = (encoding + '').toLowerCase()
- loweredCase = true
- }
- }
- }
- // The property is used by `Buffer.isBuffer` and `is-buffer` (in Safari 5-7) to detect
- // Buffer instances.
- Buffer.prototype._isBuffer = true
- function swap (b, n, m) {
- var i = b[n]
- b[n] = b[m]
- b[m] = i
- }
- Buffer.prototype.swap16 = function swap16 () {
- var len = this.length
- if (len % 2 !== 0) {
- throw new RangeError('Buffer size must be a multiple of 16-bits')
- }
- for (var i = 0; i < len; i += 2) {
- swap(this, i, i + 1)
- }
- return this
- }
- Buffer.prototype.swap32 = function swap32 () {
- var len = this.length
- if (len % 4 !== 0) {
- throw new RangeError('Buffer size must be a multiple of 32-bits')
- }
- for (var i = 0; i < len; i += 4) {
- swap(this, i, i + 3)
- swap(this, i + 1, i + 2)
- }
- return this
- }
- Buffer.prototype.swap64 = function swap64 () {
- var len = this.length
- if (len % 8 !== 0) {
- throw new RangeError('Buffer size must be a multiple of 64-bits')
- }
- for (var i = 0; i < len; i += 8) {
- swap(this, i, i + 7)
- swap(this, i + 1, i + 6)
- swap(this, i + 2, i + 5)
- swap(this, i + 3, i + 4)
- }
- return this
- }
- Buffer.prototype.toString = function toString () {
- var length = this.length | 0
- if (length === 0) return ''
- if (arguments.length === 0) return utf8Slice(this, 0, length)
- return slowToString.apply(this, arguments)
- }
- Buffer.prototype.equals = function equals (b) {
- if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')
- if (this === b) return true
- return Buffer.compare(this, b) === 0
- }
- Buffer.prototype.inspect = function inspect () {
- var str = ''
- var max = exports.INSPECT_MAX_BYTES
- if (this.length > 0) {
- str = this.toString('hex', 0, max).match(/.{2}/g).join(' ')
- if (this.length > max) str += ' ... '
- }
- return '<Buffer ' + str + '>'
- }
- Buffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) {
- if (!Buffer.isBuffer(target)) {
- throw new TypeError('Argument must be a Buffer')
- }
- if (start === undefined) {
- start = 0
- }
- if (end === undefined) {
- end = target ? target.length : 0
- }
- if (thisStart === undefined) {
- thisStart = 0
- }
- if (thisEnd === undefined) {
- thisEnd = this.length
- }
- if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {
- throw new RangeError('out of range index')
- }
- if (thisStart >= thisEnd && start >= end) {
- return 0
- }
- if (thisStart >= thisEnd) {
- return -1
- }
- if (start >= end) {
- return 1
- }
- start >>>= 0
- end >>>= 0
- thisStart >>>= 0
- thisEnd >>>= 0
- if (this === target) return 0
- var x = thisEnd - thisStart
- var y = end - start
- var len = Math.min(x, y)
- var thisCopy = this.slice(thisStart, thisEnd)
- var targetCopy = target.slice(start, end)
- for (var i = 0; i < len; ++i) {
- if (thisCopy[i] !== targetCopy[i]) {
- x = thisCopy[i]
- y = targetCopy[i]
- break
- }
- }
- if (x < y) return -1
- if (y < x) return 1
- return 0
- }
- // Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,
- // OR the last index of `val` in `buffer` at offset <= `byteOffset`.
- //
- // Arguments:
- // - buffer - a Buffer to search
- // - val - a string, Buffer, or number
- // - byteOffset - an index into `buffer`; will be clamped to an int32
- // - encoding - an optional encoding, relevant is val is a string
- // - dir - true for indexOf, false for lastIndexOf
- function bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {
- // Empty buffer means no match
- if (buffer.length === 0) return -1
- // Normalize byteOffset
- if (typeof byteOffset === 'string') {
- encoding = byteOffset
- byteOffset = 0
- } else if (byteOffset > 0x7fffffff) {
- byteOffset = 0x7fffffff
- } else if (byteOffset < -0x80000000) {
- byteOffset = -0x80000000
- }
- byteOffset = +byteOffset // Coerce to Number.
- if (isNaN(byteOffset)) {
- // byteOffset: it it's undefined, null, NaN, "foo", etc, search whole buffer
- byteOffset = dir ? 0 : (buffer.length - 1)
- }
- // Normalize byteOffset: negative offsets start from the end of the buffer
- if (byteOffset < 0) byteOffset = buffer.length + byteOffset
- if (byteOffset >= buffer.length) {
- if (dir) return -1
- else byteOffset = buffer.length - 1
- } else if (byteOffset < 0) {
- if (dir) byteOffset = 0
- else return -1
- }
- // Normalize val
- if (typeof val === 'string') {
- val = Buffer.from(val, encoding)
- }
- // Finally, search either indexOf (if dir is true) or lastIndexOf
- if (Buffer.isBuffer(val)) {
- // Special case: looking for empty string/buffer always fails
- if (val.length === 0) {
- return -1
- }
- return arrayIndexOf(buffer, val, byteOffset, encoding, dir)
- } else if (typeof val === 'number') {
- val = val & 0xFF // Search for a byte value [0-255]
- if (Buffer.TYPED_ARRAY_SUPPORT &&
- typeof Uint8Array.prototype.indexOf === 'function') {
- if (dir) {
- return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset)
- } else {
- return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset)
- }
- }
- return arrayIndexOf(buffer, [ val ], byteOffset, encoding, dir)
- }
- throw new TypeError('val must be string, number or Buffer')
- }
- function arrayIndexOf (arr, val, byteOffset, encoding, dir) {
- var indexSize = 1
- var arrLength = arr.length
- var valLength = val.length
- if (encoding !== undefined) {
- encoding = String(encoding).toLowerCase()
- if (encoding === 'ucs2' || encoding === 'ucs-2' ||
- encoding === 'utf16le' || encoding === 'utf-16le') {
- if (arr.length < 2 || val.length < 2) {
- return -1
- }
- indexSize = 2
- arrLength /= 2
- valLength /= 2
- byteOffset /= 2
- }
- }
- function read (buf, i) {
- if (indexSize === 1) {
- return buf[i]
- } else {
- return buf.readUInt16BE(i * indexSize)
- }
- }
- var i
- if (dir) {
- var foundIndex = -1
- for (i = byteOffset; i < arrLength; i++) {
- if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {
- if (foundIndex === -1) foundIndex = i
- if (i - foundIndex + 1 === valLength) return foundIndex * indexSize
- } else {
- if (foundIndex !== -1) i -= i - foundIndex
- foundIndex = -1
- }
- }
- } else {
- if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength
- for (i = byteOffset; i >= 0; i--) {
- var found = true
- for (var j = 0; j < valLength; j++) {
- if (read(arr, i + j) !== read(val, j)) {
- found = false
- break
- }
- }
- if (found) return i
- }
- }
- return -1
- }
- Buffer.prototype.includes = function includes (val, byteOffset, encoding) {
- return this.indexOf(val, byteOffset, encoding) !== -1
- }
- Buffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) {
- return bidirectionalIndexOf(this, val, byteOffset, encoding, true)
- }
- Buffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) {
- return bidirectionalIndexOf(this, val, byteOffset, encoding, false)
- }
- function hexWrite (buf, string, offset, length) {
- offset = Number(offset) || 0
- var remaining = buf.length - offset
- if (!length) {
- length = remaining
- } else {
- length = Number(length)
- if (length > remaining) {
- length = remaining
- }
- }
- // must be an even number of digits
- var strLen = string.length
- if (strLen % 2 !== 0) throw new TypeError('Invalid hex string')
- if (length > strLen / 2) {
- length = strLen / 2
- }
- for (var i = 0; i < length; ++i) {
- var parsed = parseInt(string.substr(i * 2, 2), 16)
- if (isNaN(parsed)) return i
- buf[offset + i] = parsed
- }
- return i
- }
- function utf8Write (buf, string, offset, length) {
- return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)
- }
- function asciiWrite (buf, string, offset, length) {
- return blitBuffer(asciiToBytes(string), buf, offset, length)
- }
- function latin1Write (buf, string, offset, length) {
- return asciiWrite(buf, string, offset, length)
- }
- function base64Write (buf, string, offset, length) {
- return blitBuffer(base64ToBytes(string), buf, offset, length)
- }
- function ucs2Write (buf, string, offset, length) {
- return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)
- }
- Buffer.prototype.write = function write (string, offset, length, encoding) {
- // Buffer#write(string)
- if (offset === undefined) {
- encoding = 'utf8'
- length = this.length
- offset = 0
- // Buffer#write(string, encoding)
- } else if (length === undefined && typeof offset === 'string') {
- encoding = offset
- length = this.length
- offset = 0
- // Buffer#write(string, offset[, length][, encoding])
- } else if (isFinite(offset)) {
- offset = offset | 0
- if (isFinite(length)) {
- length = length | 0
- if (encoding === undefined) encoding = 'utf8'
- } else {
- encoding = length
- length = undefined
- }
- // legacy write(string, encoding, offset, length) - remove in v0.13
- } else {
- throw new Error(
- 'Buffer.write(string, encoding, offset[, length]) is no longer supported'
- )
- }
- var remaining = this.length - offset
- if (length === undefined || length > remaining) length = remaining
- if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {
- throw new RangeError('Attempt to write outside buffer bounds')
- }
- if (!encoding) encoding = 'utf8'
- var loweredCase = false
- for (;;) {
- switch (encoding) {
- case 'hex':
- return hexWrite(this, string, offset, length)
- case 'utf8':
- case 'utf-8':
- return utf8Write(this, string, offset, length)
- case 'ascii':
- return asciiWrite(this, string, offset, length)
- case 'latin1':
- case 'binary':
- return latin1Write(this, string, offset, length)
- case 'base64':
- // Warning: maxLength not taken into account in base64Write
- return base64Write(this, string, offset, length)
- case 'ucs2':
- case 'ucs-2':
- case 'utf16le':
- case 'utf-16le':
- return ucs2Write(this, string, offset, length)
- default:
- if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
- encoding = ('' + encoding).toLowerCase()
- loweredCase = true
- }
- }
- }
- Buffer.prototype.toJSON = function toJSON () {
- return {
- type: 'Buffer',
- data: Array.prototype.slice.call(this._arr || this, 0)
- }
- }
- function base64Slice (buf, start, end) {
- if (start === 0 && end === buf.length) {
- return base64.fromByteArray(buf)
- } else {
- return base64.fromByteArray(buf.slice(start, end))
- }
- }
- function utf8Slice (buf, start, end) {
- end = Math.min(buf.length, end)
- var res = []
- var i = start
- while (i < end) {
- var firstByte = buf[i]
- var codePoint = null
- var bytesPerSequence = (firstByte > 0xEF) ? 4
- : (firstByte > 0xDF) ? 3
- : (firstByte > 0xBF) ? 2
- : 1
- if (i + bytesPerSequence <= end) {
- var secondByte, thirdByte, fourthByte, tempCodePoint
- switch (bytesPerSequence) {
- case 1:
- if (firstByte < 0x80) {
- codePoint = firstByte
- }
- break
- case 2:
- secondByte = buf[i + 1]
- if ((secondByte & 0xC0) === 0x80) {
- tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F)
- if (tempCodePoint > 0x7F) {
- codePoint = tempCodePoint
- }
- }
- break
- case 3:
- secondByte = buf[i + 1]
- thirdByte = buf[i + 2]
- if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {
- tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F)
- if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {
- codePoint = tempCodePoint
- }
- }
- break
- case 4:
- secondByte = buf[i + 1]
- thirdByte = buf[i + 2]
- fourthByte = buf[i + 3]
- if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {
- tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F)
- if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {
- codePoint = tempCodePoint
- }
- }
- }
- }
- if (codePoint === null) {
- // we did not generate a valid codePoint so insert a
- // replacement char (U+FFFD) and advance only 1 byte
- codePoint = 0xFFFD
- bytesPerSequence = 1
- } else if (codePoint > 0xFFFF) {
- // encode to utf16 (surrogate pair dance)
- codePoint -= 0x10000
- res.push(codePoint >>> 10 & 0x3FF | 0xD800)
- codePoint = 0xDC00 | codePoint & 0x3FF
- }
- res.push(codePoint)
- i += bytesPerSequence
- }
- return decodeCodePointsArray(res)
- }
- // Based on http://stackoverflow.com/a/22747272/680742, the browser with
- // the lowest limit is Chrome, with 0x10000 args.
- // We go 1 magnitude less, for safety
- var MAX_ARGUMENTS_LENGTH = 0x1000
- function decodeCodePointsArray (codePoints) {
- var len = codePoints.length
- if (len <= MAX_ARGUMENTS_LENGTH) {
- return String.fromCharCode.apply(String, codePoints) // avoid extra slice()
- }
- // Decode in chunks to avoid "call stack size exceeded".
- var res = ''
- var i = 0
- while (i < len) {
- res += String.fromCharCode.apply(
- String,
- codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)
- )
- }
- return res
- }
- function asciiSlice (buf, start, end) {
- var ret = ''
- end = Math.min(buf.length, end)
- for (var i = start; i < end; ++i) {
- ret += String.fromCharCode(buf[i] & 0x7F)
- }
- return ret
- }
- function latin1Slice (buf, start, end) {
- var ret = ''
- end = Math.min(buf.length, end)
- for (var i = start; i < end; ++i) {
- ret += String.fromCharCode(buf[i])
- }
- return ret
- }
- function hexSlice (buf, start, end) {
- var len = buf.length
- if (!start || start < 0) start = 0
- if (!end || end < 0 || end > len) end = len
- var out = ''
- for (var i = start; i < end; ++i) {
- out += toHex(buf[i])
- }
- return out
- }
- function utf16leSlice (buf, start, end) {
- var bytes = buf.slice(start, end)
- var res = ''
- for (var i = 0; i < bytes.length; i += 2) {
- res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256)
- }
- return res
- }
- Buffer.prototype.slice = function slice (start, end) {
- var len = this.length
- start = ~~start
- end = end === undefined ? len : ~~end
- if (start < 0) {
- start += len
- if (start < 0) start = 0
- } else if (start > len) {
- start = len
- }
- if (end < 0) {
- end += len
- if (end < 0) end = 0
- } else if (end > len) {
- end = len
- }
- if (end < start) end = start
- var newBuf
- if (Buffer.TYPED_ARRAY_SUPPORT) {
- newBuf = this.subarray(start, end)
- newBuf.__proto__ = Buffer.prototype
- } else {
- var sliceLen = end - start
- newBuf = new Buffer(sliceLen, undefined)
- for (var i = 0; i < sliceLen; ++i) {
- newBuf[i] = this[i + start]
- }
- }
- return newBuf
- }
- /*
- * Need to make sure that buffer isn't trying to write out of bounds.
- */
- function checkOffset (offset, ext, length) {
- if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')
- if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')
- }
- Buffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {
- offset = offset | 0
- byteLength = byteLength | 0
- if (!noAssert) checkOffset(offset, byteLength, this.length)
- var val = this[offset]
- var mul = 1
- var i = 0
- while (++i < byteLength && (mul *= 0x100)) {
- val += this[offset + i] * mul
- }
- return val
- }
- Buffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {
- offset = offset | 0
- byteLength = byteLength | 0
- if (!noAssert) {
- checkOffset(offset, byteLength, this.length)
- }
- var val = this[offset + --byteLength]
- var mul = 1
- while (byteLength > 0 && (mul *= 0x100)) {
- val += this[offset + --byteLength] * mul
- }
- return val
- }
- Buffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {
- if (!noAssert) checkOffset(offset, 1, this.length)
- return this[offset]
- }
- Buffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {
- if (!noAssert) checkOffset(offset, 2, this.length)
- return this[offset] | (this[offset + 1] << 8)
- }
- Buffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {
- if (!noAssert) checkOffset(offset, 2, this.length)
- return (this[offset] << 8) | this[offset + 1]
- }
- Buffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {
- if (!noAssert) checkOffset(offset, 4, this.length)
- return ((this[offset]) |
- (this[offset + 1] << 8) |
- (this[offset + 2] << 16)) +
- (this[offset + 3] * 0x1000000)
- }
- Buffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {
- if (!noAssert) checkOffset(offset, 4, this.length)
- return (this[offset] * 0x1000000) +
- ((this[offset + 1] << 16) |
- (this[offset + 2] << 8) |
- this[offset + 3])
- }
- Buffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {
- offset = offset | 0
- byteLength = byteLength | 0
- if (!noAssert) checkOffset(offset, byteLength, this.length)
- var val = this[offset]
- var mul = 1
- var i = 0
- while (++i < byteLength && (mul *= 0x100)) {
- val += this[offset + i] * mul
- }
- mul *= 0x80
- if (val >= mul) val -= Math.pow(2, 8 * byteLength)
- return val
- }
- Buffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {
- offset = offset | 0
- byteLength = byteLength | 0
- if (!noAssert) checkOffset(offset, byteLength, this.length)
- var i = byteLength
- var mul = 1
- var val = this[offset + --i]
- while (i > 0 && (mul *= 0x100)) {
- val += this[offset + --i] * mul
- }
- mul *= 0x80
- if (val >= mul) val -= Math.pow(2, 8 * byteLength)
- return val
- }
- Buffer.prototype.readInt8 = function readInt8 (offset, noAssert) {
- if (!noAssert) checkOffset(offset, 1, this.length)
- if (!(this[offset] & 0x80)) return (this[offset])
- return ((0xff - this[offset] + 1) * -1)
- }
- Buffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {
- if (!noAssert) checkOffset(offset, 2, this.length)
- var val = this[offset] | (this[offset + 1] << 8)
- return (val & 0x8000) ? val | 0xFFFF0000 : val
- }
- Buffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {
- if (!noAssert) checkOffset(offset, 2, this.length)
- var val = this[offset + 1] | (this[offset] << 8)
- return (val & 0x8000) ? val | 0xFFFF0000 : val
- }
- Buffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {
- if (!noAssert) checkOffset(offset, 4, this.length)
- return (this[offset]) |
- (this[offset + 1] << 8) |
- (this[offset + 2] << 16) |
- (this[offset + 3] << 24)
- }
- Buffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {
- if (!noAssert) checkOffset(offset, 4, this.length)
- return (this[offset] << 24) |
- (this[offset + 1] << 16) |
- (this[offset + 2] << 8) |
- (this[offset + 3])
- }
- Buffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {
- if (!noAssert) checkOffset(offset, 4, this.length)
- return ieee754.read(this, offset, true, 23, 4)
- }
- Buffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {
- if (!noAssert) checkOffset(offset, 4, this.length)
- return ieee754.read(this, offset, false, 23, 4)
- }
- Buffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {
- if (!noAssert) checkOffset(offset, 8, this.length)
- return ieee754.read(this, offset, true, 52, 8)
- }
- Buffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {
- if (!noAssert) checkOffset(offset, 8, this.length)
- return ieee754.read(this, offset, false, 52, 8)
- }
- function checkInt (buf, value, offset, ext, max, min) {
- if (!Buffer.isBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance')
- if (value > max || value < min) throw new RangeError('"value" argument is out of bounds')
- if (offset + ext > buf.length) throw new RangeError('Index out of range')
- }
- Buffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {
- value = +value
- offset = offset | 0
- byteLength = byteLength | 0
- if (!noAssert) {
- var maxBytes = Math.pow(2, 8 * byteLength) - 1
- checkInt(this, value, offset, byteLength, maxBytes, 0)
- }
- var mul = 1
- var i = 0
- this[offset] = value & 0xFF
- while (++i < byteLength && (mul *= 0x100)) {
- this[offset + i] = (value / mul) & 0xFF
- }
- return offset + byteLength
- }
- Buffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {
- value = +value
- offset = offset | 0
- byteLength = byteLength | 0
- if (!noAssert) {
- var maxBytes = Math.pow(2, 8 * byteLength) - 1
- checkInt(this, value, offset, byteLength, maxBytes, 0)
- }
- var i = byteLength - 1
- var mul = 1
- this[offset + i] = value & 0xFF
- while (--i >= 0 && (mul *= 0x100)) {
- this[offset + i] = (value / mul) & 0xFF
- }
- return offset + byteLength
- }
- Buffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {
- value = +value
- offset = offset | 0
- if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0)
- if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)
- this[offset] = (value & 0xff)
- return offset + 1
- }
- function objectWriteUInt16 (buf, value, offset, littleEndian) {
- if (value < 0) value = 0xffff + value + 1
- for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; ++i) {
- buf[offset + i] = (value & (0xff << (8 * (littleEndian ? i : 1 - i)))) >>>
- (littleEndian ? i : 1 - i) * 8
- }
- }
- Buffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {
- value = +value
- offset = offset | 0
- if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
- if (Buffer.TYPED_ARRAY_SUPPORT) {
- this[offset] = (value & 0xff)
- this[offset + 1] = (value >>> 8)
- } else {
- objectWriteUInt16(this, value, offset, true)
- }
- return offset + 2
- }
- Buffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {
- value = +value
- offset = offset | 0
- if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
- if (Buffer.TYPED_ARRAY_SUPPORT) {
- this[offset] = (value >>> 8)
- this[offset + 1] = (value & 0xff)
- } else {
- objectWriteUInt16(this, value, offset, false)
- }
- return offset + 2
- }
- function objectWriteUInt32 (buf, value, offset, littleEndian) {
- if (value < 0) value = 0xffffffff + value + 1
- for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; ++i) {
- buf[offset + i] = (value >>> (littleEndian ? i : 3 - i) * 8) & 0xff
- }
- }
- Buffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {
- value = +value
- offset = offset | 0
- if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
- if (Buffer.TYPED_ARRAY_SUPPORT) {
- this[offset + 3] = (value >>> 24)
- this[offset + 2] = (value >>> 16)
- this[offset + 1] = (value >>> 8)
- this[offset] = (value & 0xff)
- } else {
- objectWriteUInt32(this, value, offset, true)
- }
- return offset + 4
- }
- Buffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {
- value = +value
- offset = offset | 0
- if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
- if (Buffer.TYPED_ARRAY_SUPPORT) {
- this[offset] = (value >>> 24)
- this[offset + 1] = (value >>> 16)
- this[offset + 2] = (value >>> 8)
- this[offset + 3] = (value & 0xff)
- } else {
- objectWriteUInt32(this, value, offset, false)
- }
- return offset + 4
- }
- Buffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {
- value = +value
- offset = offset | 0
- if (!noAssert) {
- var limit = Math.pow(2, 8 * byteLength - 1)
- checkInt(this, value, offset, byteLength, limit - 1, -limit)
- }
- var i = 0
- var mul = 1
- var sub = 0
- this[offset] = value & 0xFF
- while (++i < byteLength && (mul *= 0x100)) {
- if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {
- sub = 1
- }
- this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
- }
- return offset + byteLength
- }
- Buffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {
- value = +value
- offset = offset | 0
- if (!noAssert) {
- var limit = Math.pow(2, 8 * byteLength - 1)
- checkInt(this, value, offset, byteLength, limit - 1, -limit)
- }
- var i = byteLength - 1
- var mul = 1
- var sub = 0
- this[offset + i] = value & 0xFF
- while (--i >= 0 && (mul *= 0x100)) {
- if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {
- sub = 1
- }
- this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
- }
- return offset + byteLength
- }
- Buffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {
- value = +value
- offset = offset | 0
- if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80)
- if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)
- if (value < 0) value = 0xff + value + 1
- this[offset] = (value & 0xff)
- return offset + 1
- }
- Buffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {
- value = +value
- offset = offset | 0
- if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
- if (Buffer.TYPED_ARRAY_SUPPORT) {
- this[offset] = (value & 0xff)
- this[offset + 1] = (value >>> 8)
- } else {
- objectWriteUInt16(this, value, offset, true)
- }
- return offset + 2
- }
- Buffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {
- value = +value
- offset = offset | 0
- if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
- if (Buffer.TYPED_ARRAY_SUPPORT) {
- this[offset] = (value >>> 8)
- this[offset + 1] = (value & 0xff)
- } else {
- objectWriteUInt16(this, value, offset, false)
- }
- return offset + 2
- }
- Buffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {
- value = +value
- offset = offset | 0
- if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
- if (Buffer.TYPED_ARRAY_SUPPORT) {
- this[offset] = (value & 0xff)
- this[offset + 1] = (value >>> 8)
- this[offset + 2] = (value >>> 16)
- this[offset + 3] = (value >>> 24)
- } else {
- objectWriteUInt32(this, value, offset, true)
- }
- return offset + 4
- }
- Buffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {
- value = +value
- offset = offset | 0
- if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
- if (value < 0) value = 0xffffffff + value + 1
- if (Buffer.TYPED_ARRAY_SUPPORT) {
- this[offset] = (value >>> 24)
- this[offset + 1] = (value >>> 16)
- this[offset + 2] = (value >>> 8)
- this[offset + 3] = (value & 0xff)
- } else {
- objectWriteUInt32(this, value, offset, false)
- }
- return offset + 4
- }
- function checkIEEE754 (buf, value, offset, ext, max, min) {
- if (offset + ext > buf.length) throw new RangeError('Index out of range')
- if (offset < 0) throw new RangeError('Index out of range')
- }
- function writeFloat (buf, value, offset, littleEndian, noAssert) {
- if (!noAssert) {
- checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38)
- }
- ieee754.write(buf, value, offset, littleEndian, 23, 4)
- return offset + 4
- }
- Buffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {
- return writeFloat(this, value, offset, true, noAssert)
- }
- Buffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {
- return writeFloat(this, value, offset, false, noAssert)
- }
- function writeDouble (buf, value, offset, littleEndian, noAssert) {
- if (!noAssert) {
- checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308)
- }
- ieee754.write(buf, value, offset, littleEndian, 52, 8)
- return offset + 8
- }
- Buffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {
- return writeDouble(this, value, offset, true, noAssert)
- }
- Buffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {
- return writeDouble(this, value, offset, false, noAssert)
- }
- // copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)
- Buffer.prototype.copy = function copy (target, targetStart, start, end) {
- if (!start) start = 0
- if (!end && end !== 0) end = this.length
- if (targetStart >= target.length) targetStart = target.length
- if (!targetStart) targetStart = 0
- if (end > 0 && end < start) end = start
- // Copy 0 bytes; we're done
- if (end === start) return 0
- if (target.length === 0 || this.length === 0) return 0
- // Fatal error conditions
- if (targetStart < 0) {
- throw new RangeError('targetStart out of bounds')
- }
- if (start < 0 || start >= this.length) throw new RangeError('sourceStart out of bounds')
- if (end < 0) throw new RangeError('sourceEnd out of bounds')
- // Are we oob?
- if (end > this.length) end = this.length
- if (target.length - targetStart < end - start) {
- end = target.length - targetStart + start
- }
- var len = end - start
- var i
- if (this === target && start < targetStart && targetStart < end) {
- // descending copy from end
- for (i = len - 1; i >= 0; --i) {
- target[i + targetStart] = this[i + start]
- }
- } else if (len < 1000 || !Buffer.TYPED_ARRAY_SUPPORT) {
- // ascending copy from start
- for (i = 0; i < len; ++i) {
- target[i + targetStart] = this[i + start]
- }
- } else {
- Uint8Array.prototype.set.call(
- target,
- this.subarray(start, start + len),
- targetStart
- )
- }
- return len
- }
- // Usage:
- // buffer.fill(number[, offset[, end]])
- // buffer.fill(buffer[, offset[, end]])
- // buffer.fill(string[, offset[, end]][, encoding])
- Buffer.prototype.fill = function fill (val, start, end, encoding) {
- // Handle string cases:
- if (typeof val === 'string') {
- if (typeof start === 'string') {
- encoding = start
- start = 0
- end = this.length
- } else if (typeof end === 'string') {
- encoding = end
- end = this.length
- }
- if (val.length === 1) {
- var code = val.charCodeAt(0)
- if (code < 256) {
- val = code
- }
- }
- if (encoding !== undefined && typeof encoding !== 'string') {
- throw new TypeError('encoding must be a string')
- }
- if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {
- throw new TypeError('Unknown encoding: ' + encoding)
- }
- } else if (typeof val === 'number') {
- val = val & 255
- }
- // Invalid ranges are not set to a default, so can range check early.
- if (start < 0 || this.length < start || this.length < end) {
- throw new RangeError('Out of range index')
- }
- if (end <= start) {
- return this
- }
- start = start >>> 0
- end = end === undefined ? this.length : end >>> 0
- if (!val) val = 0
- var i
- if (typeof val === 'number') {
- for (i = start; i < end; ++i) {
- this[i] = val
- }
- } else {
- var bytes = Buffer.isBuffer(val)
- ? val
- : utf8ToBytes(new Buffer(val, encoding).toString())
- var len = bytes.length
- for (i = 0; i < end - start; ++i) {
- this[i + start] = bytes[i % len]
- }
- }
- return this
- }
- // HELPER FUNCTIONS
- // ================
- var INVALID_BASE64_RE = /[^+\/0-9A-Za-z-_]/g
- function base64clean (str) {
- // Node strips out invalid characters like \n and \t from the string, base64-js does not
- str = stringtrim(str).replace(INVALID_BASE64_RE, '')
- // Node converts strings with length < 2 to ''
- if (str.length < 2) return ''
- // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not
- while (str.length % 4 !== 0) {
- str = str + '='
- }
- return str
- }
- function stringtrim (str) {
- if (str.trim) return str.trim()
- return str.replace(/^\s+|\s+$/g, '')
- }
- function toHex (n) {
- if (n < 16) return '0' + n.toString(16)
- return n.toString(16)
- }
- function utf8ToBytes (string, units) {
- units = units || Infinity
- var codePoint
- var length = string.length
- var leadSurrogate = null
- var bytes = []
- for (var i = 0; i < length; ++i) {
- codePoint = string.charCodeAt(i)
- // is surrogate component
- if (codePoint > 0xD7FF && codePoint < 0xE000) {
- // last char was a lead
- if (!leadSurrogate) {
- // no lead yet
- if (codePoint > 0xDBFF) {
- // unexpected trail
- if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
- continue
- } else if (i + 1 === length) {
- // unpaired lead
- if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
- continue
- }
- // valid lead
- leadSurrogate = codePoint
- continue
- }
- // 2 leads in a row
- if (codePoint < 0xDC00) {
- if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
- leadSurrogate = codePoint
- continue
- }
- // valid surrogate pair
- codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000
- } else if (leadSurrogate) {
- // valid bmp char, but last char was a lead
- if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
- }
- leadSurrogate = null
- // encode utf8
- if (codePoint < 0x80) {
- if ((units -= 1) < 0) break
- bytes.push(codePoint)
- } else if (codePoint < 0x800) {
- if ((units -= 2) < 0) break
- bytes.push(
- codePoint >> 0x6 | 0xC0,
- codePoint & 0x3F | 0x80
- )
- } else if (codePoint < 0x10000) {
- if ((units -= 3) < 0) break
- bytes.push(
- codePoint >> 0xC | 0xE0,
- codePoint >> 0x6 & 0x3F | 0x80,
- codePoint & 0x3F | 0x80
- )
- } else if (codePoint < 0x110000) {
- if ((units -= 4) < 0) break
- bytes.push(
- codePoint >> 0x12 | 0xF0,
- codePoint >> 0xC & 0x3F | 0x80,
- codePoint >> 0x6 & 0x3F | 0x80,
- codePoint & 0x3F | 0x80
- )
- } else {
- throw new Error('Invalid code point')
- }
- }
- return bytes
- }
- function asciiToBytes (str) {
- var byteArray = []
- for (var i = 0; i < str.length; ++i) {
- // Node's code seems to be doing this and not & 0x7F..
- byteArray.push(str.charCodeAt(i) & 0xFF)
- }
- return byteArray
- }
- function utf16leToBytes (str, units) {
- var c, hi, lo
- var byteArray = []
- for (var i = 0; i < str.length; ++i) {
- if ((units -= 2) < 0) break
- c = str.charCodeAt(i)
- hi = c >> 8
- lo = c % 256
- byteArray.push(lo)
- byteArray.push(hi)
- }
- return byteArray
- }
- function base64ToBytes (str) {
- return base64.toByteArray(base64clean(str))
- }
- function blitBuffer (src, dst, offset, length) {
- for (var i = 0; i < length; ++i) {
- if ((i + offset >= dst.length) || (i >= src.length)) break
- dst[i + offset] = src[i]
- }
- return i
- }
- function isnan (val) {
- return val !== val // eslint-disable-line no-self-compare
- }
- }).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {},require("buffer").Buffer)
- },{"base64-js":82,"buffer":85,"ieee754":304,"isarray":313}],86:[function(require,module,exports){
- // Copyright Joyent, Inc. and other Node contributors.
- //
- // Permission is hereby granted, free of charge, to any person obtaining a
- // copy of this software and associated documentation files (the
- // "Software"), to deal in the Software without restriction, including
- // without limitation the rights to use, copy, modify, merge, publish,
- // distribute, sublicense, and/or sell copies of the Software, and to permit
- // persons to whom the Software is furnished to do so, subject to the
- // following conditions:
- //
- // The above copyright notice and this permission notice shall be included
- // in all copies or substantial portions of the Software.
- //
- // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
- // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
- // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
- // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
- // USE OR OTHER DEALINGS IN THE SOFTWARE.
- var Buffer = require('buffer').Buffer;
- var isBufferEncoding = Buffer.isEncoding
- || function(encoding) {
- switch (encoding && encoding.toLowerCase()) {
- 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;
- default: return false;
- }
- }
- function assertEncoding(encoding) {
- if (encoding && !isBufferEncoding(encoding)) {
- throw new Error('Unknown encoding: ' + encoding);
- }
- }
- // StringDecoder provides an interface for efficiently splitting a series of
- // buffers into a series of JS strings without breaking apart multi-byte
- // characters. CESU-8 is handled as part of the UTF-8 encoding.
- //
- // @TODO Handling all encodings inside a single object makes it very difficult
- // to reason about this code, so it should be split up in the future.
- // @TODO There should be a utf8-strict encoding that rejects invalid UTF-8 code
- // points as used by CESU-8.
- var StringDecoder = exports.StringDecoder = function(encoding) {
- this.encoding = (encoding || 'utf8').toLowerCase().replace(/[-_]/, '');
- assertEncoding(encoding);
- switch (this.encoding) {
- case 'utf8':
- // CESU-8 represents each of Surrogate Pair by 3-bytes
- this.surrogateSize = 3;
- break;
- case 'ucs2':
- case 'utf16le':
- // UTF-16 represents each of Surrogate Pair by 2-bytes
- this.surrogateSize = 2;
- this.detectIncompleteChar = utf16DetectIncompleteChar;
- break;
- case 'base64':
- // Base-64 stores 3 bytes in 4 chars, and pads the remainder.
- this.surrogateSize = 3;
- this.detectIncompleteChar = base64DetectIncompleteChar;
- break;
- default:
- this.write = passThroughWrite;
- return;
- }
- // Enough space to store all bytes of a single character. UTF-8 needs 4
- // bytes, but CESU-8 may require up to 6 (3 bytes per surrogate).
- this.charBuffer = new Buffer(6);
- // Number of bytes received for the current incomplete multi-byte character.
- this.charReceived = 0;
- // Number of bytes expected for the current incomplete multi-byte character.
- this.charLength = 0;
- };
- // write decodes the given buffer and returns it as JS string that is
- // guaranteed to not contain any partial multi-byte characters. Any partial
- // character found at the end of the buffer is buffered up, and will be
- // returned when calling write again with the remaining bytes.
- //
- // Note: Converting a Buffer containing an orphan surrogate to a String
- // currently works, but converting a String to a Buffer (via `new Buffer`, or
- // Buffer#write) will replace incomplete surrogates with the unicode
- // replacement character. See https://codereview.chromium.org/121173009/ .
- StringDecoder.prototype.write = function(buffer) {
- var charStr = '';
- // if our last write ended with an incomplete multibyte character
- while (this.charLength) {
- // determine how many remaining bytes this buffer has to offer for this char
- var available = (buffer.length >= this.charLength - this.charReceived) ?
- this.charLength - this.charReceived :
- buffer.length;
- // add the new bytes to the char buffer
- buffer.copy(this.charBuffer, this.charReceived, 0, available);
- this.charReceived += available;
- if (this.charReceived < this.charLength) {
- // still not enough chars in this buffer? wait for more ...
- return '';
- }
- // remove bytes belonging to the current character from the buffer
- buffer = buffer.slice(available, buffer.length);
- // get the character that was split
- charStr = this.charBuffer.slice(0, this.charLength).toString(this.encoding);
- // CESU-8: lead surrogate (D800-DBFF) is also the incomplete character
- var charCode = charStr.charCodeAt(charStr.length - 1);
- if (charCode >= 0xD800 && charCode <= 0xDBFF) {
- this.charLength += this.surrogateSize;
- charStr = '';
- continue;
- }
- this.charReceived = this.charLength = 0;
- // if there are no more bytes in this buffer, just emit our char
- if (buffer.length === 0) {
- return charStr;
- }
- break;
- }
- // determine and set charLength / charReceived
- this.detectIncompleteChar(buffer);
- var end = buffer.length;
- if (this.charLength) {
- // buffer the incomplete character bytes we got
- buffer.copy(this.charBuffer, 0, buffer.length - this.charReceived, end);
- end -= this.charReceived;
- }
- charStr += buffer.toString(this.encoding, 0, end);
- var end = charStr.length - 1;
- var charCode = charStr.charCodeAt(end);
- // CESU-8: lead surrogate (D800-DBFF) is also the incomplete character
- if (charCode >= 0xD800 && charCode <= 0xDBFF) {
- var size = this.surrogateSize;
- this.charLength += size;
- this.charReceived += size;
- this.charBuffer.copy(this.charBuffer, size, 0, size);
- buffer.copy(this.charBuffer, 0, 0, size);
- return charStr.substring(0, end);
- }
- // or just emit the charStr
- return charStr;
- };
- // detectIncompleteChar determines if there is an incomplete UTF-8 character at
- // the end of the given buffer. If so, it sets this.charLength to the byte
- // length that character, and sets this.charReceived to the number of bytes
- // that are available for this character.
- StringDecoder.prototype.detectIncompleteChar = function(buffer) {
- // determine how many bytes we have to check at the end of this buffer
- var i = (buffer.length >= 3) ? 3 : buffer.length;
- // Figure out if one of the last i bytes of our buffer announces an
- // incomplete char.
- for (; i > 0; i--) {
- var c = buffer[buffer.length - i];
- // See http://en.wikipedia.org/wiki/UTF-8#Description
- // 110XXXXX
- if (i == 1 && c >> 5 == 0x06) {
- this.charLength = 2;
- break;
- }
- // 1110XXXX
- if (i <= 2 && c >> 4 == 0x0E) {
- this.charLength = 3;
- break;
- }
- // 11110XXX
- if (i <= 3 && c >> 3 == 0x1E) {
- this.charLength = 4;
- break;
- }
- }
- this.charReceived = i;
- };
- StringDecoder.prototype.end = function(buffer) {
- var res = '';
- if (buffer && buffer.length)
- res = this.write(buffer);
- if (this.charReceived) {
- var cr = this.charReceived;
- var buf = this.charBuffer;
- var enc = this.encoding;
- res += buf.slice(0, cr).toString(enc);
- }
- return res;
- };
- function passThroughWrite(buffer) {
- return buffer.toString(this.encoding);
- }
- function utf16DetectIncompleteChar(buffer) {
- this.charReceived = buffer.length % 2;
- this.charLength = this.charReceived ? 2 : 0;
- }
- function base64DetectIncompleteChar(buffer) {
- this.charReceived = buffer.length % 3;
- this.charLength = this.charReceived ? 3 : 0;
- }
- },{"buffer":85}],87:[function(require,module,exports){
- module.exports = {
- "100": "Continue",
- "101": "Switching Protocols",
- "102": "Processing",
- "200": "OK",
- "201": "Created",
- "202": "Accepted",
- "203": "Non-Authoritative Information",
- "204": "No Content",
- "205": "Reset Content",
- "206": "Partial Content",
- "207": "Multi-Status",
- "208": "Already Reported",
- "226": "IM Used",
- "300": "Multiple Choices",
- "301": "Moved Permanently",
- "302": "Found",
- "303": "See Other",
- "304": "Not Modified",
- "305": "Use Proxy",
- "307": "Temporary Redirect",
- "308": "Permanent Redirect",
- "400": "Bad Request",
- "401": "Unauthorized",
- "402": "Payment Required",
- "403": "Forbidden",
- "404": "Not Found",
- "405": "Method Not Allowed",
- "406": "Not Acceptable",
- "407": "Proxy Authentication Required",
- "408": "Request Timeout",
- "409": "Conflict",
- "410": "Gone",
- "411": "Length Required",
- "412": "Precondition Failed",
- "413": "Payload Too Large",
- "414": "URI Too Long",
- "415": "Unsupported Media Type",
- "416": "Range Not Satisfiable",
- "417": "Expectation Failed",
- "418": "I'm a teapot",
- "421": "Misdirected Request",
- "422": "Unprocessable Entity",
- "423": "Locked",
- "424": "Failed Dependency",
- "425": "Unordered Collection",
- "426": "Upgrade Required",
- "428": "Precondition Required",
- "429": "Too Many Requests",
- "431": "Request Header Fields Too Large",
- "451": "Unavailable For Legal Reasons",
- "500": "Internal Server Error",
- "501": "Not Implemented",
- "502": "Bad Gateway",
- "503": "Service Unavailable",
- "504": "Gateway Timeout",
- "505": "HTTP Version Not Supported",
- "506": "Variant Also Negotiates",
- "507": "Insufficient Storage",
- "508": "Loop Detected",
- "509": "Bandwidth Limit Exceeded",
- "510": "Not Extended",
- "511": "Network Authentication Required"
- }
- },{}],88:[function(require,module,exports){
- /*!
- * copy-to - index.js
- * Copyright(c) 2014 dead_horse <dead_horse@qq.com>
- * MIT Licensed
- */
- 'use strict';
- /**
- * slice() reference.
- */
- var slice = Array.prototype.slice;
- /**
- * Expose copy
- *
- * ```
- * copy({foo: 'nar', hello: 'copy'}).to({hello: 'world'});
- * copy({foo: 'nar', hello: 'copy'}).toCover({hello: 'world'});
- * ```
- *
- * @param {Object} src
- * @return {Copy}
- */
- module.exports = Copy;
- /**
- * Copy
- * @param {Object} src
- * @param {Boolean} withAccess
- */
- function Copy(src, withAccess) {
- if (!(this instanceof Copy)) return new Copy(src, withAccess);
- this.src = src;
- this._withAccess = withAccess;
- }
- /**
- * copy properties include getter and setter
- * @param {[type]} val [description]
- * @return {[type]} [description]
- */
- Copy.prototype.withAccess = function (w) {
- this._withAccess = w !== false;
- return this;
- };
- /**
- * pick keys in src
- *
- * @api: public
- */
- Copy.prototype.pick = function(keys) {
- if (!Array.isArray(keys)) {
- keys = slice.call(arguments);
- }
- if (keys.length) {
- this.keys = keys;
- }
- return this;
- };
- /**
- * copy src to target,
- * do not cover any property target has
- * @param {Object} to
- *
- * @api: public
- */
- Copy.prototype.to = function(to) {
- to = to || {};
- if (!this.src) return to;
- var keys = this.keys || Object.keys(this.src);
- if (!this._withAccess) {
- for (var i = 0; i < keys.length; i++) {
- key = keys[i];
- if (to[key] !== undefined) continue;
- to[key] = this.src[key];
- }
- return to;
- }
- for (var i = 0; i < keys.length; i++) {
- var key = keys[i];
- if (!notDefined(to, key)) continue;
- var getter = this.src.__lookupGetter__(key);
- var setter = this.src.__lookupSetter__(key);
- if (getter) to.__defineGetter__(key, getter);
- if (setter) to.__defineSetter__(key, setter);
- if (!getter && !setter) {
- to[key] = this.src[key];
- }
- }
- return to;
- };
- /**
- * copy src to target,
- * override any property target has
- * @param {Object} to
- *
- * @api: public
- */
- Copy.prototype.toCover = function(to) {
- var keys = this.keys || Object.keys(this.src);
- for (var i = 0; i < keys.length; i++) {
- var key = keys[i];
- delete to[key];
- var getter = this.src.__lookupGetter__(key);
- var setter = this.src.__lookupSetter__(key);
- if (getter) to.__defineGetter__(key, getter);
- if (setter) to.__defineSetter__(key, setter);
- if (!getter && !setter) {
- to[key] = this.src[key];
- }
- }
- };
- Copy.prototype.override = Copy.prototype.toCover;
- /**
- * append another object to src
- * @param {Obj} obj
- * @return {Copy}
- */
- Copy.prototype.and = function (obj) {
- var src = {};
- this.to(src);
- this.src = obj;
- this.to(src);
- this.src = src;
- return this;
- };
- /**
- * check obj[key] if not defiend
- * @param {Object} obj
- * @param {String} key
- * @return {Boolean}
- */
- function notDefined(obj, key) {
- return obj[key] === undefined
- && obj.__lookupGetter__(key) === undefined
- && obj.__lookupSetter__(key) === undefined;
- }
- },{}],89:[function(require,module,exports){
- module.exports = function (it) {
- if (typeof it != 'function') {
- throw TypeError(String(it) + ' is not a function');
- } return it;
- };
- },{}],90:[function(require,module,exports){
- var isObject = require('../internals/is-object');
- module.exports = function (it) {
- if (!isObject(it) && it !== null) {
- throw TypeError("Can't set " + String(it) + ' as a prototype');
- } return it;
- };
- },{"../internals/is-object":162}],91:[function(require,module,exports){
- var wellKnownSymbol = require('../internals/well-known-symbol');
- var create = require('../internals/object-create');
- var definePropertyModule = require('../internals/object-define-property');
- var UNSCOPABLES = wellKnownSymbol('unscopables');
- var ArrayPrototype = Array.prototype;
- // Array.prototype[@@unscopables]
- // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
- if (ArrayPrototype[UNSCOPABLES] == undefined) {
- definePropertyModule.f(ArrayPrototype, UNSCOPABLES, {
- configurable: true,
- value: create(null)
- });
- }
- // add a key to Array.prototype[@@unscopables]
- module.exports = function (key) {
- ArrayPrototype[UNSCOPABLES][key] = true;
- };
- },{"../internals/object-create":177,"../internals/object-define-property":179,"../internals/well-known-symbol":237}],92:[function(require,module,exports){
- 'use strict';
- var charAt = require('../internals/string-multibyte').charAt;
- // `AdvanceStringIndex` abstract operation
- // https://tc39.es/ecma262/#sec-advancestringindex
- module.exports = function (S, index, unicode) {
- return index + (unicode ? charAt(S, index).length : 1);
- };
- },{"../internals/string-multibyte":213}],93:[function(require,module,exports){
- module.exports = function (it, Constructor, name) {
- if (!(it instanceof Constructor)) {
- throw TypeError('Incorrect ' + (name ? name + ' ' : '') + 'invocation');
- } return it;
- };
- },{}],94:[function(require,module,exports){
- var isObject = require('../internals/is-object');
- module.exports = function (it) {
- if (!isObject(it)) {
- throw TypeError(String(it) + ' is not an object');
- } return it;
- };
- },{"../internals/is-object":162}],95:[function(require,module,exports){
- // eslint-disable-next-line es/no-typed-arrays -- safe
- module.exports = typeof ArrayBuffer !== 'undefined' && typeof DataView !== 'undefined';
- },{}],96:[function(require,module,exports){
- 'use strict';
- var NATIVE_ARRAY_BUFFER = require('../internals/array-buffer-native');
- var DESCRIPTORS = require('../internals/descriptors');
- var global = require('../internals/global');
- var isObject = require('../internals/is-object');
- var has = require('../internals/has');
- var classof = require('../internals/classof');
- var createNonEnumerableProperty = require('../internals/create-non-enumerable-property');
- var redefine = require('../internals/redefine');
- var defineProperty = require('../internals/object-define-property').f;
- var getPrototypeOf = require('../internals/object-get-prototype-of');
- var setPrototypeOf = require('../internals/object-set-prototype-of');
- var wellKnownSymbol = require('../internals/well-known-symbol');
- var uid = require('../internals/uid');
- var Int8Array = global.Int8Array;
- var Int8ArrayPrototype = Int8Array && Int8Array.prototype;
- var Uint8ClampedArray = global.Uint8ClampedArray;
- var Uint8ClampedArrayPrototype = Uint8ClampedArray && Uint8ClampedArray.prototype;
- var TypedArray = Int8Array && getPrototypeOf(Int8Array);
- var TypedArrayPrototype = Int8ArrayPrototype && getPrototypeOf(Int8ArrayPrototype);
- var ObjectPrototype = Object.prototype;
- var isPrototypeOf = ObjectPrototype.isPrototypeOf;
- var TO_STRING_TAG = wellKnownSymbol('toStringTag');
- var TYPED_ARRAY_TAG = uid('TYPED_ARRAY_TAG');
- var TYPED_ARRAY_CONSTRUCTOR = uid('TYPED_ARRAY_CONSTRUCTOR');
- // Fixing native typed arrays in Opera Presto crashes the browser, see #595
- var NATIVE_ARRAY_BUFFER_VIEWS = NATIVE_ARRAY_BUFFER && !!setPrototypeOf && classof(global.opera) !== 'Opera';
- var TYPED_ARRAY_TAG_REQIRED = false;
- var NAME, Constructor, Prototype;
- var TypedArrayConstructorsList = {
- Int8Array: 1,
- Uint8Array: 1,
- Uint8ClampedArray: 1,
- Int16Array: 2,
- Uint16Array: 2,
- Int32Array: 4,
- Uint32Array: 4,
- Float32Array: 4,
- Float64Array: 8
- };
- var BigIntArrayConstructorsList = {
- BigInt64Array: 8,
- BigUint64Array: 8
- };
- var isView = function isView(it) {
- if (!isObject(it)) return false;
- var klass = classof(it);
- return klass === 'DataView'
- || has(TypedArrayConstructorsList, klass)
- || has(BigIntArrayConstructorsList, klass);
- };
- var isTypedArray = function (it) {
- if (!isObject(it)) return false;
- var klass = classof(it);
- return has(TypedArrayConstructorsList, klass)
- || has(BigIntArrayConstructorsList, klass);
- };
- var aTypedArray = function (it) {
- if (isTypedArray(it)) return it;
- throw TypeError('Target is not a typed array');
- };
- var aTypedArrayConstructor = function (C) {
- if (setPrototypeOf && !isPrototypeOf.call(TypedArray, C)) {
- throw TypeError('Target is not a typed array constructor');
- } return C;
- };
- var exportTypedArrayMethod = function (KEY, property, forced) {
- if (!DESCRIPTORS) return;
- if (forced) for (var ARRAY in TypedArrayConstructorsList) {
- var TypedArrayConstructor = global[ARRAY];
- if (TypedArrayConstructor && has(TypedArrayConstructor.prototype, KEY)) try {
- delete TypedArrayConstructor.prototype[KEY];
- } catch (error) { /* empty */ }
- }
- if (!TypedArrayPrototype[KEY] || forced) {
- redefine(TypedArrayPrototype, KEY, forced ? property
- : NATIVE_ARRAY_BUFFER_VIEWS && Int8ArrayPrototype[KEY] || property);
- }
- };
- var exportTypedArrayStaticMethod = function (KEY, property, forced) {
- var ARRAY, TypedArrayConstructor;
- if (!DESCRIPTORS) return;
- if (setPrototypeOf) {
- if (forced) for (ARRAY in TypedArrayConstructorsList) {
- TypedArrayConstructor = global[ARRAY];
- if (TypedArrayConstructor && has(TypedArrayConstructor, KEY)) try {
- delete TypedArrayConstructor[KEY];
- } catch (error) { /* empty */ }
- }
- if (!TypedArray[KEY] || forced) {
- // V8 ~ Chrome 49-50 `%TypedArray%` methods are non-writable non-configurable
- try {
- return redefine(TypedArray, KEY, forced ? property : NATIVE_ARRAY_BUFFER_VIEWS && TypedArray[KEY] || property);
- } catch (error) { /* empty */ }
- } else return;
- }
- for (ARRAY in TypedArrayConstructorsList) {
- TypedArrayConstructor = global[ARRAY];
- if (TypedArrayConstructor && (!TypedArrayConstructor[KEY] || forced)) {
- redefine(TypedArrayConstructor, KEY, property);
- }
- }
- };
- for (NAME in TypedArrayConstructorsList) {
- Constructor = global[NAME];
- Prototype = Constructor && Constructor.prototype;
- if (Prototype) createNonEnumerableProperty(Prototype, TYPED_ARRAY_CONSTRUCTOR, Constructor);
- else NATIVE_ARRAY_BUFFER_VIEWS = false;
- }
- for (NAME in BigIntArrayConstructorsList) {
- Constructor = global[NAME];
- Prototype = Constructor && Constructor.prototype;
- if (Prototype) createNonEnumerableProperty(Prototype, TYPED_ARRAY_CONSTRUCTOR, Constructor);
- }
- // WebKit bug - typed arrays constructors prototype is Object.prototype
- if (!NATIVE_ARRAY_BUFFER_VIEWS || typeof TypedArray != 'function' || TypedArray === Function.prototype) {
- // eslint-disable-next-line no-shadow -- safe
- TypedArray = function TypedArray() {
- throw TypeError('Incorrect invocation');
- };
- if (NATIVE_ARRAY_BUFFER_VIEWS) for (NAME in TypedArrayConstructorsList) {
- if (global[NAME]) setPrototypeOf(global[NAME], TypedArray);
- }
- }
- if (!NATIVE_ARRAY_BUFFER_VIEWS || !TypedArrayPrototype || TypedArrayPrototype === ObjectPrototype) {
- TypedArrayPrototype = TypedArray.prototype;
- if (NATIVE_ARRAY_BUFFER_VIEWS) for (NAME in TypedArrayConstructorsList) {
- if (global[NAME]) setPrototypeOf(global[NAME].prototype, TypedArrayPrototype);
- }
- }
- // WebKit bug - one more object in Uint8ClampedArray prototype chain
- if (NATIVE_ARRAY_BUFFER_VIEWS && getPrototypeOf(Uint8ClampedArrayPrototype) !== TypedArrayPrototype) {
- setPrototypeOf(Uint8ClampedArrayPrototype, TypedArrayPrototype);
- }
- if (DESCRIPTORS && !has(TypedArrayPrototype, TO_STRING_TAG)) {
- TYPED_ARRAY_TAG_REQIRED = true;
- defineProperty(TypedArrayPrototype, TO_STRING_TAG, { get: function () {
- return isObject(this) ? this[TYPED_ARRAY_TAG] : undefined;
- } });
- for (NAME in TypedArrayConstructorsList) if (global[NAME]) {
- createNonEnumerableProperty(global[NAME], TYPED_ARRAY_TAG, NAME);
- }
- }
- module.exports = {
- NATIVE_ARRAY_BUFFER_VIEWS: NATIVE_ARRAY_BUFFER_VIEWS,
- TYPED_ARRAY_CONSTRUCTOR: TYPED_ARRAY_CONSTRUCTOR,
- TYPED_ARRAY_TAG: TYPED_ARRAY_TAG_REQIRED && TYPED_ARRAY_TAG,
- aTypedArray: aTypedArray,
- aTypedArrayConstructor: aTypedArrayConstructor,
- exportTypedArrayMethod: exportTypedArrayMethod,
- exportTypedArrayStaticMethod: exportTypedArrayStaticMethod,
- isView: isView,
- isTypedArray: isTypedArray,
- TypedArray: TypedArray,
- TypedArrayPrototype: TypedArrayPrototype
- };
- },{"../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){
- 'use strict';
- var global = require('../internals/global');
- var DESCRIPTORS = require('../internals/descriptors');
- var NATIVE_ARRAY_BUFFER = require('../internals/array-buffer-native');
- var createNonEnumerableProperty = require('../internals/create-non-enumerable-property');
- var redefineAll = require('../internals/redefine-all');
- var fails = require('../internals/fails');
- var anInstance = require('../internals/an-instance');
- var toInteger = require('../internals/to-integer');
- var toLength = require('../internals/to-length');
- var toIndex = require('../internals/to-index');
- var IEEE754 = require('../internals/ieee754');
- var getPrototypeOf = require('../internals/object-get-prototype-of');
- var setPrototypeOf = require('../internals/object-set-prototype-of');
- var getOwnPropertyNames = require('../internals/object-get-own-property-names').f;
- var defineProperty = require('../internals/object-define-property').f;
- var arrayFill = require('../internals/array-fill');
- var setToStringTag = require('../internals/set-to-string-tag');
- var InternalStateModule = require('../internals/internal-state');
- var getInternalState = InternalStateModule.get;
- var setInternalState = InternalStateModule.set;
- var ARRAY_BUFFER = 'ArrayBuffer';
- var DATA_VIEW = 'DataView';
- var PROTOTYPE = 'prototype';
- var WRONG_LENGTH = 'Wrong length';
- var WRONG_INDEX = 'Wrong index';
- var NativeArrayBuffer = global[ARRAY_BUFFER];
- var $ArrayBuffer = NativeArrayBuffer;
- var $DataView = global[DATA_VIEW];
- var $DataViewPrototype = $DataView && $DataView[PROTOTYPE];
- var ObjectPrototype = Object.prototype;
- var RangeError = global.RangeError;
- var packIEEE754 = IEEE754.pack;
- var unpackIEEE754 = IEEE754.unpack;
- var packInt8 = function (number) {
- return [number & 0xFF];
- };
- var packInt16 = function (number) {
- return [number & 0xFF, number >> 8 & 0xFF];
- };
- var packInt32 = function (number) {
- return [number & 0xFF, number >> 8 & 0xFF, number >> 16 & 0xFF, number >> 24 & 0xFF];
- };
- var unpackInt32 = function (buffer) {
- return buffer[3] << 24 | buffer[2] << 16 | buffer[1] << 8 | buffer[0];
- };
- var packFloat32 = function (number) {
- return packIEEE754(number, 23, 4);
- };
- var packFloat64 = function (number) {
- return packIEEE754(number, 52, 8);
- };
- var addGetter = function (Constructor, key) {
- defineProperty(Constructor[PROTOTYPE], key, { get: function () { return getInternalState(this)[key]; } });
- };
- var get = function (view, count, index, isLittleEndian) {
- var intIndex = toIndex(index);
- var store = getInternalState(view);
- if (intIndex + count > store.byteLength) throw RangeError(WRONG_INDEX);
- var bytes = getInternalState(store.buffer).bytes;
- var start = intIndex + store.byteOffset;
- var pack = bytes.slice(start, start + count);
- return isLittleEndian ? pack : pack.reverse();
- };
- var set = function (view, count, index, conversion, value, isLittleEndian) {
- var intIndex = toIndex(index);
- var store = getInternalState(view);
- if (intIndex + count > store.byteLength) throw RangeError(WRONG_INDEX);
- var bytes = getInternalState(store.buffer).bytes;
- var start = intIndex + store.byteOffset;
- var pack = conversion(+value);
- for (var i = 0; i < count; i++) bytes[start + i] = pack[isLittleEndian ? i : count - i - 1];
- };
- if (!NATIVE_ARRAY_BUFFER) {
- $ArrayBuffer = function ArrayBuffer(length) {
- anInstance(this, $ArrayBuffer, ARRAY_BUFFER);
- var byteLength = toIndex(length);
- setInternalState(this, {
- bytes: arrayFill.call(new Array(byteLength), 0),
- byteLength: byteLength
- });
- if (!DESCRIPTORS) this.byteLength = byteLength;
- };
- $DataView = function DataView(buffer, byteOffset, byteLength) {
- anInstance(this, $DataView, DATA_VIEW);
- anInstance(buffer, $ArrayBuffer, DATA_VIEW);
- var bufferLength = getInternalState(buffer).byteLength;
- var offset = toInteger(byteOffset);
- if (offset < 0 || offset > bufferLength) throw RangeError('Wrong offset');
- byteLength = byteLength === undefined ? bufferLength - offset : toLength(byteLength);
- if (offset + byteLength > bufferLength) throw RangeError(WRONG_LENGTH);
- setInternalState(this, {
- buffer: buffer,
- byteLength: byteLength,
- byteOffset: offset
- });
- if (!DESCRIPTORS) {
- this.buffer = buffer;
- this.byteLength = byteLength;
- this.byteOffset = offset;
- }
- };
- if (DESCRIPTORS) {
- addGetter($ArrayBuffer, 'byteLength');
- addGetter($DataView, 'buffer');
- addGetter($DataView, 'byteLength');
- addGetter($DataView, 'byteOffset');
- }
- redefineAll($DataView[PROTOTYPE], {
- getInt8: function getInt8(byteOffset) {
- return get(this, 1, byteOffset)[0] << 24 >> 24;
- },
- getUint8: function getUint8(byteOffset) {
- return get(this, 1, byteOffset)[0];
- },
- getInt16: function getInt16(byteOffset /* , littleEndian */) {
- var bytes = get(this, 2, byteOffset, arguments.length > 1 ? arguments[1] : undefined);
- return (bytes[1] << 8 | bytes[0]) << 16 >> 16;
- },
- getUint16: function getUint16(byteOffset /* , littleEndian */) {
- var bytes = get(this, 2, byteOffset, arguments.length > 1 ? arguments[1] : undefined);
- return bytes[1] << 8 | bytes[0];
- },
- getInt32: function getInt32(byteOffset /* , littleEndian */) {
- return unpackInt32(get(this, 4, byteOffset, arguments.length > 1 ? arguments[1] : undefined));
- },
- getUint32: function getUint32(byteOffset /* , littleEndian */) {
- return unpackInt32(get(this, 4, byteOffset, arguments.length > 1 ? arguments[1] : undefined)) >>> 0;
- },
- getFloat32: function getFloat32(byteOffset /* , littleEndian */) {
- return unpackIEEE754(get(this, 4, byteOffset, arguments.length > 1 ? arguments[1] : undefined), 23);
- },
- getFloat64: function getFloat64(byteOffset /* , littleEndian */) {
- return unpackIEEE754(get(this, 8, byteOffset, arguments.length > 1 ? arguments[1] : undefined), 52);
- },
- setInt8: function setInt8(byteOffset, value) {
- set(this, 1, byteOffset, packInt8, value);
- },
- setUint8: function setUint8(byteOffset, value) {
- set(this, 1, byteOffset, packInt8, value);
- },
- setInt16: function setInt16(byteOffset, value /* , littleEndian */) {
- set(this, 2, byteOffset, packInt16, value, arguments.length > 2 ? arguments[2] : undefined);
- },
- setUint16: function setUint16(byteOffset, value /* , littleEndian */) {
- set(this, 2, byteOffset, packInt16, value, arguments.length > 2 ? arguments[2] : undefined);
- },
- setInt32: function setInt32(byteOffset, value /* , littleEndian */) {
- set(this, 4, byteOffset, packInt32, value, arguments.length > 2 ? arguments[2] : undefined);
- },
- setUint32: function setUint32(byteOffset, value /* , littleEndian */) {
- set(this, 4, byteOffset, packInt32, value, arguments.length > 2 ? arguments[2] : undefined);
- },
- setFloat32: function setFloat32(byteOffset, value /* , littleEndian */) {
- set(this, 4, byteOffset, packFloat32, value, arguments.length > 2 ? arguments[2] : undefined);
- },
- setFloat64: function setFloat64(byteOffset, value /* , littleEndian */) {
- set(this, 8, byteOffset, packFloat64, value, arguments.length > 2 ? arguments[2] : undefined);
- }
- });
- } else {
- /* eslint-disable no-new -- required for testing */
- if (!fails(function () {
- NativeArrayBuffer(1);
- }) || !fails(function () {
- new NativeArrayBuffer(-1);
- }) || fails(function () {
- new NativeArrayBuffer();
- new NativeArrayBuffer(1.5);
- new NativeArrayBuffer(NaN);
- return NativeArrayBuffer.name != ARRAY_BUFFER;
- })) {
- /* eslint-enable no-new -- required for testing */
- $ArrayBuffer = function ArrayBuffer(length) {
- anInstance(this, $ArrayBuffer);
- return new NativeArrayBuffer(toIndex(length));
- };
- var ArrayBufferPrototype = $ArrayBuffer[PROTOTYPE] = NativeArrayBuffer[PROTOTYPE];
- for (var keys = getOwnPropertyNames(NativeArrayBuffer), j = 0, key; keys.length > j;) {
- if (!((key = keys[j++]) in $ArrayBuffer)) {
- createNonEnumerableProperty($ArrayBuffer, key, NativeArrayBuffer[key]);
- }
- }
- ArrayBufferPrototype.constructor = $ArrayBuffer;
- }
- // WebKit bug - the same parent prototype for typed arrays and data view
- if (setPrototypeOf && getPrototypeOf($DataViewPrototype) !== ObjectPrototype) {
- setPrototypeOf($DataViewPrototype, ObjectPrototype);
- }
- // iOS Safari 7.x bug
- var testView = new $DataView(new $ArrayBuffer(2));
- var $setInt8 = $DataViewPrototype.setInt8;
- testView.setInt8(0, 2147483648);
- testView.setInt8(1, 2147483649);
- if (testView.getInt8(0) || !testView.getInt8(1)) redefineAll($DataViewPrototype, {
- setInt8: function setInt8(byteOffset, value) {
- $setInt8.call(this, byteOffset, value << 24 >> 24);
- },
- setUint8: function setUint8(byteOffset, value) {
- $setInt8.call(this, byteOffset, value << 24 >> 24);
- }
- }, { unsafe: true });
- }
- setToStringTag($ArrayBuffer, ARRAY_BUFFER);
- setToStringTag($DataView, DATA_VIEW);
- module.exports = {
- ArrayBuffer: $ArrayBuffer,
- DataView: $DataView
- };
- },{"../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){
- 'use strict';
- var toObject = require('../internals/to-object');
- var toAbsoluteIndex = require('../internals/to-absolute-index');
- var toLength = require('../internals/to-length');
- var min = Math.min;
- // `Array.prototype.copyWithin` method implementation
- // https://tc39.es/ecma262/#sec-array.prototype.copywithin
- // eslint-disable-next-line es/no-array-prototype-copywithin -- safe
- module.exports = [].copyWithin || function copyWithin(target /* = 0 */, start /* = 0, end = @length */) {
- var O = toObject(this);
- var len = toLength(O.length);
- var to = toAbsoluteIndex(target, len);
- var from = toAbsoluteIndex(start, len);
- var end = arguments.length > 2 ? arguments[2] : undefined;
- var count = min((end === undefined ? len : toAbsoluteIndex(end, len)) - from, len - to);
- var inc = 1;
- if (from < to && to < from + count) {
- inc = -1;
- from += count - 1;
- to += count - 1;
- }
- while (count-- > 0) {
- if (from in O) O[to] = O[from];
- else delete O[to];
- to += inc;
- from += inc;
- } return O;
- };
- },{"../internals/to-absolute-index":217,"../internals/to-length":221,"../internals/to-object":222}],99:[function(require,module,exports){
- 'use strict';
- var toObject = require('../internals/to-object');
- var toAbsoluteIndex = require('../internals/to-absolute-index');
- var toLength = require('../internals/to-length');
- // `Array.prototype.fill` method implementation
- // https://tc39.es/ecma262/#sec-array.prototype.fill
- module.exports = function fill(value /* , start = 0, end = @length */) {
- var O = toObject(this);
- var length = toLength(O.length);
- var argumentsLength = arguments.length;
- var index = toAbsoluteIndex(argumentsLength > 1 ? arguments[1] : undefined, length);
- var end = argumentsLength > 2 ? arguments[2] : undefined;
- var endPos = end === undefined ? length : toAbsoluteIndex(end, length);
- while (endPos > index) O[index++] = value;
- return O;
- };
- },{"../internals/to-absolute-index":217,"../internals/to-length":221,"../internals/to-object":222}],100:[function(require,module,exports){
- 'use strict';
- var $forEach = require('../internals/array-iteration').forEach;
- var arrayMethodIsStrict = require('../internals/array-method-is-strict');
- var STRICT_METHOD = arrayMethodIsStrict('forEach');
- // `Array.prototype.forEach` method implementation
- // https://tc39.es/ecma262/#sec-array.prototype.foreach
- module.exports = !STRICT_METHOD ? function forEach(callbackfn /* , thisArg */) {
- return $forEach(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
- // eslint-disable-next-line es/no-array-prototype-foreach -- safe
- } : [].forEach;
- },{"../internals/array-iteration":104,"../internals/array-method-is-strict":107}],101:[function(require,module,exports){
- module.exports = function (Constructor, list) {
- var index = 0;
- var length = list.length;
- var result = new Constructor(length);
- while (length > index) result[index] = list[index++];
- return result;
- };
- },{}],102:[function(require,module,exports){
- 'use strict';
- var bind = require('../internals/function-bind-context');
- var toObject = require('../internals/to-object');
- var callWithSafeIterationClosing = require('../internals/call-with-safe-iteration-closing');
- var isArrayIteratorMethod = require('../internals/is-array-iterator-method');
- var toLength = require('../internals/to-length');
- var createProperty = require('../internals/create-property');
- var getIterator = require('../internals/get-iterator');
- var getIteratorMethod = require('../internals/get-iterator-method');
- // `Array.from` method implementation
- // https://tc39.es/ecma262/#sec-array.from
- module.exports = function from(arrayLike /* , mapfn = undefined, thisArg = undefined */) {
- var O = toObject(arrayLike);
- var C = typeof this == 'function' ? this : Array;
- var argumentsLength = arguments.length;
- var mapfn = argumentsLength > 1 ? arguments[1] : undefined;
- var mapping = mapfn !== undefined;
- var iteratorMethod = getIteratorMethod(O);
- var index = 0;
- var length, result, step, iterator, next, value;
- if (mapping) mapfn = bind(mapfn, argumentsLength > 2 ? arguments[2] : undefined, 2);
- // if the target is not iterable or it's an array with the default iterator - use a simple case
- if (iteratorMethod != undefined && !(C == Array && isArrayIteratorMethod(iteratorMethod))) {
- iterator = getIterator(O, iteratorMethod);
- next = iterator.next;
- result = new C();
- for (;!(step = next.call(iterator)).done; index++) {
- value = mapping ? callWithSafeIterationClosing(iterator, mapfn, [step.value, index], true) : step.value;
- createProperty(result, index, value);
- }
- } else {
- length = toLength(O.length);
- result = new C(length);
- for (;length > index; index++) {
- value = mapping ? mapfn(O[index], index) : O[index];
- createProperty(result, index, value);
- }
- }
- result.length = index;
- return result;
- };
- },{"../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){
- var toIndexedObject = require('../internals/to-indexed-object');
- var toLength = require('../internals/to-length');
- var toAbsoluteIndex = require('../internals/to-absolute-index');
- // `Array.prototype.{ indexOf, includes }` methods implementation
- var createMethod = function (IS_INCLUDES) {
- return function ($this, el, fromIndex) {
- var O = toIndexedObject($this);
- var length = toLength(O.length);
- var index = toAbsoluteIndex(fromIndex, length);
- var value;
- // Array#includes uses SameValueZero equality algorithm
- // eslint-disable-next-line no-self-compare -- NaN check
- if (IS_INCLUDES && el != el) while (length > index) {
- value = O[index++];
- // eslint-disable-next-line no-self-compare -- NaN check
- if (value != value) return true;
- // Array#indexOf ignores holes, Array#includes - not
- } else for (;length > index; index++) {
- if ((IS_INCLUDES || index in O) && O[index] === el) return IS_INCLUDES || index || 0;
- } return !IS_INCLUDES && -1;
- };
- };
- module.exports = {
- // `Array.prototype.includes` method
- // https://tc39.es/ecma262/#sec-array.prototype.includes
- includes: createMethod(true),
- // `Array.prototype.indexOf` method
- // https://tc39.es/ecma262/#sec-array.prototype.indexof
- indexOf: createMethod(false)
- };
- },{"../internals/to-absolute-index":217,"../internals/to-indexed-object":219,"../internals/to-length":221}],104:[function(require,module,exports){
- var bind = require('../internals/function-bind-context');
- var IndexedObject = require('../internals/indexed-object');
- var toObject = require('../internals/to-object');
- var toLength = require('../internals/to-length');
- var arraySpeciesCreate = require('../internals/array-species-create');
- var push = [].push;
- // `Array.prototype.{ forEach, map, filter, some, every, find, findIndex, filterReject }` methods implementation
- var createMethod = function (TYPE) {
- var IS_MAP = TYPE == 1;
- var IS_FILTER = TYPE == 2;
- var IS_SOME = TYPE == 3;
- var IS_EVERY = TYPE == 4;
- var IS_FIND_INDEX = TYPE == 6;
- var IS_FILTER_REJECT = TYPE == 7;
- var NO_HOLES = TYPE == 5 || IS_FIND_INDEX;
- return function ($this, callbackfn, that, specificCreate) {
- var O = toObject($this);
- var self = IndexedObject(O);
- var boundFunction = bind(callbackfn, that, 3);
- var length = toLength(self.length);
- var index = 0;
- var create = specificCreate || arraySpeciesCreate;
- var target = IS_MAP ? create($this, length) : IS_FILTER || IS_FILTER_REJECT ? create($this, 0) : undefined;
- var value, result;
- for (;length > index; index++) if (NO_HOLES || index in self) {
- value = self[index];
- result = boundFunction(value, index, O);
- if (TYPE) {
- if (IS_MAP) target[index] = result; // map
- else if (result) switch (TYPE) {
- case 3: return true; // some
- case 5: return value; // find
- case 6: return index; // findIndex
- case 2: push.call(target, value); // filter
- } else switch (TYPE) {
- case 4: return false; // every
- case 7: push.call(target, value); // filterReject
- }
- }
- }
- return IS_FIND_INDEX ? -1 : IS_SOME || IS_EVERY ? IS_EVERY : target;
- };
- };
- module.exports = {
- // `Array.prototype.forEach` method
- // https://tc39.es/ecma262/#sec-array.prototype.foreach
- forEach: createMethod(0),
- // `Array.prototype.map` method
- // https://tc39.es/ecma262/#sec-array.prototype.map
- map: createMethod(1),
- // `Array.prototype.filter` method
- // https://tc39.es/ecma262/#sec-array.prototype.filter
- filter: createMethod(2),
- // `Array.prototype.some` method
- // https://tc39.es/ecma262/#sec-array.prototype.some
- some: createMethod(3),
- // `Array.prototype.every` method
- // https://tc39.es/ecma262/#sec-array.prototype.every
- every: createMethod(4),
- // `Array.prototype.find` method
- // https://tc39.es/ecma262/#sec-array.prototype.find
- find: createMethod(5),
- // `Array.prototype.findIndex` method
- // https://tc39.es/ecma262/#sec-array.prototype.findIndex
- findIndex: createMethod(6),
- // `Array.prototype.filterReject` method
- // https://github.com/tc39/proposal-array-filtering
- filterReject: createMethod(7)
- };
- },{"../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){
- 'use strict';
- /* eslint-disable es/no-array-prototype-lastindexof -- safe */
- var toIndexedObject = require('../internals/to-indexed-object');
- var toInteger = require('../internals/to-integer');
- var toLength = require('../internals/to-length');
- var arrayMethodIsStrict = require('../internals/array-method-is-strict');
- var min = Math.min;
- var $lastIndexOf = [].lastIndexOf;
- var NEGATIVE_ZERO = !!$lastIndexOf && 1 / [1].lastIndexOf(1, -0) < 0;
- var STRICT_METHOD = arrayMethodIsStrict('lastIndexOf');
- var FORCED = NEGATIVE_ZERO || !STRICT_METHOD;
- // `Array.prototype.lastIndexOf` method implementation
- // https://tc39.es/ecma262/#sec-array.prototype.lastindexof
- module.exports = FORCED ? function lastIndexOf(searchElement /* , fromIndex = @[*-1] */) {
- // convert -0 to +0
- if (NEGATIVE_ZERO) return $lastIndexOf.apply(this, arguments) || 0;
- var O = toIndexedObject(this);
- var length = toLength(O.length);
- var index = length - 1;
- if (arguments.length > 1) index = min(index, toInteger(arguments[1]));
- if (index < 0) index = length + index;
- for (;index >= 0; index--) if (index in O && O[index] === searchElement) return index || 0;
- return -1;
- } : $lastIndexOf;
- },{"../internals/array-method-is-strict":107,"../internals/to-indexed-object":219,"../internals/to-integer":220,"../internals/to-length":221}],106:[function(require,module,exports){
- var fails = require('../internals/fails');
- var wellKnownSymbol = require('../internals/well-known-symbol');
- var V8_VERSION = require('../internals/engine-v8-version');
- var SPECIES = wellKnownSymbol('species');
- module.exports = function (METHOD_NAME) {
- // We can't use this feature detection in V8 since it causes
- // deoptimization and serious performance degradation
- // https://github.com/zloirock/core-js/issues/677
- return V8_VERSION >= 51 || !fails(function () {
- var array = [];
- var constructor = array.constructor = {};
- constructor[SPECIES] = function () {
- return { foo: 1 };
- };
- return array[METHOD_NAME](Boolean).foo !== 1;
- });
- };
- },{"../internals/engine-v8-version":136,"../internals/fails":140,"../internals/well-known-symbol":237}],107:[function(require,module,exports){
- 'use strict';
- var fails = require('../internals/fails');
- module.exports = function (METHOD_NAME, argument) {
- var method = [][METHOD_NAME];
- return !!method && fails(function () {
- // eslint-disable-next-line no-useless-call,no-throw-literal -- required for testing
- method.call(null, argument || function () { throw 1; }, 1);
- });
- };
- },{"../internals/fails":140}],108:[function(require,module,exports){
- var aFunction = require('../internals/a-function');
- var toObject = require('../internals/to-object');
- var IndexedObject = require('../internals/indexed-object');
- var toLength = require('../internals/to-length');
- // `Array.prototype.{ reduce, reduceRight }` methods implementation
- var createMethod = function (IS_RIGHT) {
- return function (that, callbackfn, argumentsLength, memo) {
- aFunction(callbackfn);
- var O = toObject(that);
- var self = IndexedObject(O);
- var length = toLength(O.length);
- var index = IS_RIGHT ? length - 1 : 0;
- var i = IS_RIGHT ? -1 : 1;
- if (argumentsLength < 2) while (true) {
- if (index in self) {
- memo = self[index];
- index += i;
- break;
- }
- index += i;
- if (IS_RIGHT ? index < 0 : length <= index) {
- throw TypeError('Reduce of empty array with no initial value');
- }
- }
- for (;IS_RIGHT ? index >= 0 : length > index; index += i) if (index in self) {
- memo = callbackfn(memo, self[index], index, O);
- }
- return memo;
- };
- };
- module.exports = {
- // `Array.prototype.reduce` method
- // https://tc39.es/ecma262/#sec-array.prototype.reduce
- left: createMethod(false),
- // `Array.prototype.reduceRight` method
- // https://tc39.es/ecma262/#sec-array.prototype.reduceright
- right: createMethod(true)
- };
- },{"../internals/a-function":89,"../internals/indexed-object":154,"../internals/to-length":221,"../internals/to-object":222}],109:[function(require,module,exports){
- // TODO: use something more complex like timsort?
- var floor = Math.floor;
- var mergeSort = function (array, comparefn) {
- var length = array.length;
- var middle = floor(length / 2);
- return length < 8 ? insertionSort(array, comparefn) : merge(
- mergeSort(array.slice(0, middle), comparefn),
- mergeSort(array.slice(middle), comparefn),
- comparefn
- );
- };
- var insertionSort = function (array, comparefn) {
- var length = array.length;
- var i = 1;
- var element, j;
- while (i < length) {
- j = i;
- element = array[i];
- while (j && comparefn(array[j - 1], element) > 0) {
- array[j] = array[--j];
- }
- if (j !== i++) array[j] = element;
- } return array;
- };
- var merge = function (left, right, comparefn) {
- var llength = left.length;
- var rlength = right.length;
- var lindex = 0;
- var rindex = 0;
- var result = [];
- while (lindex < llength || rindex < rlength) {
- if (lindex < llength && rindex < rlength) {
- result.push(comparefn(left[lindex], right[rindex]) <= 0 ? left[lindex++] : right[rindex++]);
- } else {
- result.push(lindex < llength ? left[lindex++] : right[rindex++]);
- }
- } return result;
- };
- module.exports = mergeSort;
- },{}],110:[function(require,module,exports){
- var isObject = require('../internals/is-object');
- var isArray = require('../internals/is-array');
- var wellKnownSymbol = require('../internals/well-known-symbol');
- var SPECIES = wellKnownSymbol('species');
- // a part of `ArraySpeciesCreate` abstract operation
- // https://tc39.es/ecma262/#sec-arrayspeciescreate
- module.exports = function (originalArray) {
- var C;
- if (isArray(originalArray)) {
- C = originalArray.constructor;
- // cross-realm fallback
- if (typeof C == 'function' && (C === Array || isArray(C.prototype))) C = undefined;
- else if (isObject(C)) {
- C = C[SPECIES];
- if (C === null) C = undefined;
- }
- } return C === undefined ? Array : C;
- };
- },{"../internals/is-array":159,"../internals/is-object":162,"../internals/well-known-symbol":237}],111:[function(require,module,exports){
- var arraySpeciesConstructor = require('../internals/array-species-constructor');
- // `ArraySpeciesCreate` abstract operation
- // https://tc39.es/ecma262/#sec-arrayspeciescreate
- module.exports = function (originalArray, length) {
- return new (arraySpeciesConstructor(originalArray))(length === 0 ? 0 : length);
- };
- },{"../internals/array-species-constructor":110}],112:[function(require,module,exports){
- var anObject = require('../internals/an-object');
- var iteratorClose = require('../internals/iterator-close');
- // call something on iterator step with safe closing on error
- module.exports = function (iterator, fn, value, ENTRIES) {
- try {
- return ENTRIES ? fn(anObject(value)[0], value[1]) : fn(value);
- } catch (error) {
- iteratorClose(iterator, 'throw', error);
- }
- };
- },{"../internals/an-object":94,"../internals/iterator-close":167}],113:[function(require,module,exports){
- var wellKnownSymbol = require('../internals/well-known-symbol');
- var ITERATOR = wellKnownSymbol('iterator');
- var SAFE_CLOSING = false;
- try {
- var called = 0;
- var iteratorWithReturn = {
- next: function () {
- return { done: !!called++ };
- },
- 'return': function () {
- SAFE_CLOSING = true;
- }
- };
- iteratorWithReturn[ITERATOR] = function () {
- return this;
- };
- // eslint-disable-next-line es/no-array-from, no-throw-literal -- required for testing
- Array.from(iteratorWithReturn, function () { throw 2; });
- } catch (error) { /* empty */ }
- module.exports = function (exec, SKIP_CLOSING) {
- if (!SKIP_CLOSING && !SAFE_CLOSING) return false;
- var ITERATION_SUPPORT = false;
- try {
- var object = {};
- object[ITERATOR] = function () {
- return {
- next: function () {
- return { done: ITERATION_SUPPORT = true };
- }
- };
- };
- exec(object);
- } catch (error) { /* empty */ }
- return ITERATION_SUPPORT;
- };
- },{"../internals/well-known-symbol":237}],114:[function(require,module,exports){
- var toString = {}.toString;
- module.exports = function (it) {
- return toString.call(it).slice(8, -1);
- };
- },{}],115:[function(require,module,exports){
- var TO_STRING_TAG_SUPPORT = require('../internals/to-string-tag-support');
- var classofRaw = require('../internals/classof-raw');
- var wellKnownSymbol = require('../internals/well-known-symbol');
- var TO_STRING_TAG = wellKnownSymbol('toStringTag');
- // ES3 wrong here
- var CORRECT_ARGUMENTS = classofRaw(function () { return arguments; }()) == 'Arguments';
- // fallback for IE11 Script Access Denied error
- var tryGet = function (it, key) {
- try {
- return it[key];
- } catch (error) { /* empty */ }
- };
- // getting tag from ES6+ `Object.prototype.toString`
- module.exports = TO_STRING_TAG_SUPPORT ? classofRaw : function (it) {
- var O, tag, result;
- return it === undefined ? 'Undefined' : it === null ? 'Null'
- // @@toStringTag case
- : typeof (tag = tryGet(O = Object(it), TO_STRING_TAG)) == 'string' ? tag
- // builtinTag case
- : CORRECT_ARGUMENTS ? classofRaw(O)
- // ES3 arguments fallback
- : (result = classofRaw(O)) == 'Object' && typeof O.callee == 'function' ? 'Arguments' : result;
- };
- },{"../internals/classof-raw":114,"../internals/to-string-tag-support":227,"../internals/well-known-symbol":237}],116:[function(require,module,exports){
- var has = require('../internals/has');
- var ownKeys = require('../internals/own-keys');
- var getOwnPropertyDescriptorModule = require('../internals/object-get-own-property-descriptor');
- var definePropertyModule = require('../internals/object-define-property');
- module.exports = function (target, source) {
- var keys = ownKeys(source);
- var defineProperty = definePropertyModule.f;
- var getOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f;
- for (var i = 0; i < keys.length; i++) {
- var key = keys[i];
- if (!has(target, key)) defineProperty(target, key, getOwnPropertyDescriptor(source, key));
- }
- };
- },{"../internals/has":148,"../internals/object-define-property":179,"../internals/object-get-own-property-descriptor":180,"../internals/own-keys":192}],117:[function(require,module,exports){
- var wellKnownSymbol = require('../internals/well-known-symbol');
- var MATCH = wellKnownSymbol('match');
- module.exports = function (METHOD_NAME) {
- var regexp = /./;
- try {
- '/./'[METHOD_NAME](regexp);
- } catch (error1) {
- try {
- regexp[MATCH] = false;
- return '/./'[METHOD_NAME](regexp);
- } catch (error2) { /* empty */ }
- } return false;
- };
- },{"../internals/well-known-symbol":237}],118:[function(require,module,exports){
- var fails = require('../internals/fails');
- module.exports = !fails(function () {
- function F() { /* empty */ }
- F.prototype.constructor = null;
- // eslint-disable-next-line es/no-object-getprototypeof -- required for testing
- return Object.getPrototypeOf(new F()) !== F.prototype;
- });
- },{"../internals/fails":140}],119:[function(require,module,exports){
- 'use strict';
- var IteratorPrototype = require('../internals/iterators-core').IteratorPrototype;
- var create = require('../internals/object-create');
- var createPropertyDescriptor = require('../internals/create-property-descriptor');
- var setToStringTag = require('../internals/set-to-string-tag');
- var Iterators = require('../internals/iterators');
- var returnThis = function () { return this; };
- module.exports = function (IteratorConstructor, NAME, next) {
- var TO_STRING_TAG = NAME + ' Iterator';
- IteratorConstructor.prototype = create(IteratorPrototype, { next: createPropertyDescriptor(1, next) });
- setToStringTag(IteratorConstructor, TO_STRING_TAG, false, true);
- Iterators[TO_STRING_TAG] = returnThis;
- return IteratorConstructor;
- };
- },{"../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){
- var DESCRIPTORS = require('../internals/descriptors');
- var definePropertyModule = require('../internals/object-define-property');
- var createPropertyDescriptor = require('../internals/create-property-descriptor');
- module.exports = DESCRIPTORS ? function (object, key, value) {
- return definePropertyModule.f(object, key, createPropertyDescriptor(1, value));
- } : function (object, key, value) {
- object[key] = value;
- return object;
- };
- },{"../internals/create-property-descriptor":121,"../internals/descriptors":125,"../internals/object-define-property":179}],121:[function(require,module,exports){
- module.exports = function (bitmap, value) {
- return {
- enumerable: !(bitmap & 1),
- configurable: !(bitmap & 2),
- writable: !(bitmap & 4),
- value: value
- };
- };
- },{}],122:[function(require,module,exports){
- 'use strict';
- var toPropertyKey = require('../internals/to-property-key');
- var definePropertyModule = require('../internals/object-define-property');
- var createPropertyDescriptor = require('../internals/create-property-descriptor');
- module.exports = function (object, key, value) {
- var propertyKey = toPropertyKey(key);
- if (propertyKey in object) definePropertyModule.f(object, propertyKey, createPropertyDescriptor(0, value));
- else object[propertyKey] = value;
- };
- },{"../internals/create-property-descriptor":121,"../internals/object-define-property":179,"../internals/to-property-key":226}],123:[function(require,module,exports){
- 'use strict';
- var $ = require('../internals/export');
- var createIteratorConstructor = require('../internals/create-iterator-constructor');
- var getPrototypeOf = require('../internals/object-get-prototype-of');
- var setPrototypeOf = require('../internals/object-set-prototype-of');
- var setToStringTag = require('../internals/set-to-string-tag');
- var createNonEnumerableProperty = require('../internals/create-non-enumerable-property');
- var redefine = require('../internals/redefine');
- var wellKnownSymbol = require('../internals/well-known-symbol');
- var IS_PURE = require('../internals/is-pure');
- var Iterators = require('../internals/iterators');
- var IteratorsCore = require('../internals/iterators-core');
- var IteratorPrototype = IteratorsCore.IteratorPrototype;
- var BUGGY_SAFARI_ITERATORS = IteratorsCore.BUGGY_SAFARI_ITERATORS;
- var ITERATOR = wellKnownSymbol('iterator');
- var KEYS = 'keys';
- var VALUES = 'values';
- var ENTRIES = 'entries';
- var returnThis = function () { return this; };
- module.exports = function (Iterable, NAME, IteratorConstructor, next, DEFAULT, IS_SET, FORCED) {
- createIteratorConstructor(IteratorConstructor, NAME, next);
- var getIterationMethod = function (KIND) {
- if (KIND === DEFAULT && defaultIterator) return defaultIterator;
- if (!BUGGY_SAFARI_ITERATORS && KIND in IterablePrototype) return IterablePrototype[KIND];
- switch (KIND) {
- case KEYS: return function keys() { return new IteratorConstructor(this, KIND); };
- case VALUES: return function values() { return new IteratorConstructor(this, KIND); };
- case ENTRIES: return function entries() { return new IteratorConstructor(this, KIND); };
- } return function () { return new IteratorConstructor(this); };
- };
- var TO_STRING_TAG = NAME + ' Iterator';
- var INCORRECT_VALUES_NAME = false;
- var IterablePrototype = Iterable.prototype;
- var nativeIterator = IterablePrototype[ITERATOR]
- || IterablePrototype['@@iterator']
- || DEFAULT && IterablePrototype[DEFAULT];
- var defaultIterator = !BUGGY_SAFARI_ITERATORS && nativeIterator || getIterationMethod(DEFAULT);
- var anyNativeIterator = NAME == 'Array' ? IterablePrototype.entries || nativeIterator : nativeIterator;
- var CurrentIteratorPrototype, methods, KEY;
- // fix native
- if (anyNativeIterator) {
- CurrentIteratorPrototype = getPrototypeOf(anyNativeIterator.call(new Iterable()));
- if (IteratorPrototype !== Object.prototype && CurrentIteratorPrototype.next) {
- if (!IS_PURE && getPrototypeOf(CurrentIteratorPrototype) !== IteratorPrototype) {
- if (setPrototypeOf) {
- setPrototypeOf(CurrentIteratorPrototype, IteratorPrototype);
- } else if (typeof CurrentIteratorPrototype[ITERATOR] != 'function') {
- createNonEnumerableProperty(CurrentIteratorPrototype, ITERATOR, returnThis);
- }
- }
- // Set @@toStringTag to native iterators
- setToStringTag(CurrentIteratorPrototype, TO_STRING_TAG, true, true);
- if (IS_PURE) Iterators[TO_STRING_TAG] = returnThis;
- }
- }
- // fix Array.prototype.{ values, @@iterator }.name in V8 / FF
- if (DEFAULT == VALUES && nativeIterator && nativeIterator.name !== VALUES) {
- INCORRECT_VALUES_NAME = true;
- defaultIterator = function values() { return nativeIterator.call(this); };
- }
- // define iterator
- if ((!IS_PURE || FORCED) && IterablePrototype[ITERATOR] !== defaultIterator) {
- createNonEnumerableProperty(IterablePrototype, ITERATOR, defaultIterator);
- }
- Iterators[NAME] = defaultIterator;
- // export additional methods
- if (DEFAULT) {
- methods = {
- values: getIterationMethod(VALUES),
- keys: IS_SET ? defaultIterator : getIterationMethod(KEYS),
- entries: getIterationMethod(ENTRIES)
- };
- if (FORCED) for (KEY in methods) {
- if (BUGGY_SAFARI_ITERATORS || INCORRECT_VALUES_NAME || !(KEY in IterablePrototype)) {
- redefine(IterablePrototype, KEY, methods[KEY]);
- }
- } else $({ target: NAME, proto: true, forced: BUGGY_SAFARI_ITERATORS || INCORRECT_VALUES_NAME }, methods);
- }
- return methods;
- };
- },{"../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){
- var path = require('../internals/path');
- var has = require('../internals/has');
- var wrappedWellKnownSymbolModule = require('../internals/well-known-symbol-wrapped');
- var defineProperty = require('../internals/object-define-property').f;
- module.exports = function (NAME) {
- var Symbol = path.Symbol || (path.Symbol = {});
- if (!has(Symbol, NAME)) defineProperty(Symbol, NAME, {
- value: wrappedWellKnownSymbolModule.f(NAME)
- });
- };
- },{"../internals/has":148,"../internals/object-define-property":179,"../internals/path":193,"../internals/well-known-symbol-wrapped":236}],125:[function(require,module,exports){
- var fails = require('../internals/fails');
- // Detect IE8's incomplete defineProperty implementation
- module.exports = !fails(function () {
- // eslint-disable-next-line es/no-object-defineproperty -- required for testing
- return Object.defineProperty({}, 1, { get: function () { return 7; } })[1] != 7;
- });
- },{"../internals/fails":140}],126:[function(require,module,exports){
- var global = require('../internals/global');
- var isObject = require('../internals/is-object');
- var document = global.document;
- // typeof document.createElement is 'object' in old IE
- var EXISTS = isObject(document) && isObject(document.createElement);
- module.exports = function (it) {
- return EXISTS ? document.createElement(it) : {};
- };
- },{"../internals/global":147,"../internals/is-object":162}],127:[function(require,module,exports){
- // iterable DOM collections
- // flag - `iterable` interface - 'entries', 'keys', 'values', 'forEach' methods
- module.exports = {
- CSSRuleList: 0,
- CSSStyleDeclaration: 0,
- CSSValueList: 0,
- ClientRectList: 0,
- DOMRectList: 0,
- DOMStringList: 0,
- DOMTokenList: 1,
- DataTransferItemList: 0,
- FileList: 0,
- HTMLAllCollection: 0,
- HTMLCollection: 0,
- HTMLFormElement: 0,
- HTMLSelectElement: 0,
- MediaList: 0,
- MimeTypeArray: 0,
- NamedNodeMap: 0,
- NodeList: 1,
- PaintRequestList: 0,
- Plugin: 0,
- PluginArray: 0,
- SVGLengthList: 0,
- SVGNumberList: 0,
- SVGPathSegList: 0,
- SVGPointList: 0,
- SVGStringList: 0,
- SVGTransformList: 0,
- SourceBufferList: 0,
- StyleSheetList: 0,
- TextTrackCueList: 0,
- TextTrackList: 0,
- TouchList: 0
- };
- },{}],128:[function(require,module,exports){
- var userAgent = require('../internals/engine-user-agent');
- var firefox = userAgent.match(/firefox\/(\d+)/i);
- module.exports = !!firefox && +firefox[1];
- },{"../internals/engine-user-agent":135}],129:[function(require,module,exports){
- module.exports = typeof window == 'object';
- },{}],130:[function(require,module,exports){
- var UA = require('../internals/engine-user-agent');
- module.exports = /MSIE|Trident/.test(UA);
- },{"../internals/engine-user-agent":135}],131:[function(require,module,exports){
- var userAgent = require('../internals/engine-user-agent');
- var global = require('../internals/global');
- module.exports = /ipad|iphone|ipod/i.test(userAgent) && global.Pebble !== undefined;
- },{"../internals/engine-user-agent":135,"../internals/global":147}],132:[function(require,module,exports){
- var userAgent = require('../internals/engine-user-agent');
- module.exports = /(?:ipad|iphone|ipod).*applewebkit/i.test(userAgent);
- },{"../internals/engine-user-agent":135}],133:[function(require,module,exports){
- var classof = require('../internals/classof-raw');
- var global = require('../internals/global');
- module.exports = classof(global.process) == 'process';
- },{"../internals/classof-raw":114,"../internals/global":147}],134:[function(require,module,exports){
- var userAgent = require('../internals/engine-user-agent');
- module.exports = /web0s(?!.*chrome)/i.test(userAgent);
- },{"../internals/engine-user-agent":135}],135:[function(require,module,exports){
- var getBuiltIn = require('../internals/get-built-in');
- module.exports = getBuiltIn('navigator', 'userAgent') || '';
- },{"../internals/get-built-in":143}],136:[function(require,module,exports){
- var global = require('../internals/global');
- var userAgent = require('../internals/engine-user-agent');
- var process = global.process;
- var Deno = global.Deno;
- var versions = process && process.versions || Deno && Deno.version;
- var v8 = versions && versions.v8;
- var match, version;
- if (v8) {
- match = v8.split('.');
- version = match[0] < 4 ? 1 : match[0] + match[1];
- } else if (userAgent) {
- match = userAgent.match(/Edge\/(\d+)/);
- if (!match || match[1] >= 74) {
- match = userAgent.match(/Chrome\/(\d+)/);
- if (match) version = match[1];
- }
- }
- module.exports = version && +version;
- },{"../internals/engine-user-agent":135,"../internals/global":147}],137:[function(require,module,exports){
- var userAgent = require('../internals/engine-user-agent');
- var webkit = userAgent.match(/AppleWebKit\/(\d+)\./);
- module.exports = !!webkit && +webkit[1];
- },{"../internals/engine-user-agent":135}],138:[function(require,module,exports){
- // IE8- don't enum bug keys
- module.exports = [
- 'constructor',
- 'hasOwnProperty',
- 'isPrototypeOf',
- 'propertyIsEnumerable',
- 'toLocaleString',
- 'toString',
- 'valueOf'
- ];
- },{}],139:[function(require,module,exports){
- var global = require('../internals/global');
- var getOwnPropertyDescriptor = require('../internals/object-get-own-property-descriptor').f;
- var createNonEnumerableProperty = require('../internals/create-non-enumerable-property');
- var redefine = require('../internals/redefine');
- var setGlobal = require('../internals/set-global');
- var copyConstructorProperties = require('../internals/copy-constructor-properties');
- var isForced = require('../internals/is-forced');
- /*
- options.target - name of the target object
- options.global - target is the global object
- options.stat - export as static methods of target
- options.proto - export as prototype methods of target
- options.real - real prototype method for the `pure` version
- options.forced - export even if the native feature is available
- options.bind - bind methods to the target, required for the `pure` version
- options.wrap - wrap constructors to preventing global pollution, required for the `pure` version
- options.unsafe - use the simple assignment of property instead of delete + defineProperty
- options.sham - add a flag to not completely full polyfills
- options.enumerable - export as enumerable property
- options.noTargetGet - prevent calling a getter on target
- */
- module.exports = function (options, source) {
- var TARGET = options.target;
- var GLOBAL = options.global;
- var STATIC = options.stat;
- var FORCED, target, key, targetProperty, sourceProperty, descriptor;
- if (GLOBAL) {
- target = global;
- } else if (STATIC) {
- target = global[TARGET] || setGlobal(TARGET, {});
- } else {
- target = (global[TARGET] || {}).prototype;
- }
- if (target) for (key in source) {
- sourceProperty = source[key];
- if (options.noTargetGet) {
- descriptor = getOwnPropertyDescriptor(target, key);
- targetProperty = descriptor && descriptor.value;
- } else targetProperty = target[key];
- FORCED = isForced(GLOBAL ? key : TARGET + (STATIC ? '.' : '#') + key, options.forced);
- // contained in target
- if (!FORCED && targetProperty !== undefined) {
- if (typeof sourceProperty === typeof targetProperty) continue;
- copyConstructorProperties(sourceProperty, targetProperty);
- }
- // add a flag to not completely full polyfills
- if (options.sham || (targetProperty && targetProperty.sham)) {
- createNonEnumerableProperty(sourceProperty, 'sham', true);
- }
- // extend global
- redefine(target, key, sourceProperty, options);
- }
- };
- },{"../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){
- module.exports = function (exec) {
- try {
- return !!exec();
- } catch (error) {
- return true;
- }
- };
- },{}],141:[function(require,module,exports){
- 'use strict';
- // TODO: Remove from `core-js@4` since it's moved to entry points
- require('../modules/es.regexp.exec');
- var redefine = require('../internals/redefine');
- var regexpExec = require('../internals/regexp-exec');
- var fails = require('../internals/fails');
- var wellKnownSymbol = require('../internals/well-known-symbol');
- var createNonEnumerableProperty = require('../internals/create-non-enumerable-property');
- var SPECIES = wellKnownSymbol('species');
- var RegExpPrototype = RegExp.prototype;
- module.exports = function (KEY, exec, FORCED, SHAM) {
- var SYMBOL = wellKnownSymbol(KEY);
- var DELEGATES_TO_SYMBOL = !fails(function () {
- // String methods call symbol-named RegEp methods
- var O = {};
- O[SYMBOL] = function () { return 7; };
- return ''[KEY](O) != 7;
- });
- var DELEGATES_TO_EXEC = DELEGATES_TO_SYMBOL && !fails(function () {
- // Symbol-named RegExp methods call .exec
- var execCalled = false;
- var re = /a/;
- if (KEY === 'split') {
- // We can't use real regex here since it causes deoptimization
- // and serious performance degradation in V8
- // https://github.com/zloirock/core-js/issues/306
- re = {};
- // RegExp[@@split] doesn't call the regex's exec method, but first creates
- // a new one. We need to return the patched regex when creating the new one.
- re.constructor = {};
- re.constructor[SPECIES] = function () { return re; };
- re.flags = '';
- re[SYMBOL] = /./[SYMBOL];
- }
- re.exec = function () { execCalled = true; return null; };
- re[SYMBOL]('');
- return !execCalled;
- });
- if (
- !DELEGATES_TO_SYMBOL ||
- !DELEGATES_TO_EXEC ||
- FORCED
- ) {
- var nativeRegExpMethod = /./[SYMBOL];
- var methods = exec(SYMBOL, ''[KEY], function (nativeMethod, regexp, str, arg2, forceStringMethod) {
- var $exec = regexp.exec;
- if ($exec === regexpExec || $exec === RegExpPrototype.exec) {
- if (DELEGATES_TO_SYMBOL && !forceStringMethod) {
- // The native String method already delegates to @@method (this
- // polyfilled function), leasing to infinite recursion.
- // We avoid it by directly calling the native @@method method.
- return { done: true, value: nativeRegExpMethod.call(regexp, str, arg2) };
- }
- return { done: true, value: nativeMethod.call(str, regexp, arg2) };
- }
- return { done: false };
- });
- redefine(String.prototype, KEY, methods[0]);
- redefine(RegExpPrototype, SYMBOL, methods[1]);
- }
- if (SHAM) createNonEnumerableProperty(RegExpPrototype[SYMBOL], 'sham', true);
- };
- },{"../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){
- var aFunction = require('../internals/a-function');
- // optional / simple context binding
- module.exports = function (fn, that, length) {
- aFunction(fn);
- if (that === undefined) return fn;
- switch (length) {
- case 0: return function () {
- return fn.call(that);
- };
- case 1: return function (a) {
- return fn.call(that, a);
- };
- case 2: return function (a, b) {
- return fn.call(that, a, b);
- };
- case 3: return function (a, b, c) {
- return fn.call(that, a, b, c);
- };
- }
- return function (/* ...args */) {
- return fn.apply(that, arguments);
- };
- };
- },{"../internals/a-function":89}],143:[function(require,module,exports){
- var global = require('../internals/global');
- var aFunction = function (variable) {
- return typeof variable == 'function' ? variable : undefined;
- };
- module.exports = function (namespace, method) {
- return arguments.length < 2 ? aFunction(global[namespace]) : global[namespace] && global[namespace][method];
- };
- },{"../internals/global":147}],144:[function(require,module,exports){
- var classof = require('../internals/classof');
- var Iterators = require('../internals/iterators');
- var wellKnownSymbol = require('../internals/well-known-symbol');
- var ITERATOR = wellKnownSymbol('iterator');
- module.exports = function (it) {
- if (it != undefined) return it[ITERATOR]
- || it['@@iterator']
- || Iterators[classof(it)];
- };
- },{"../internals/classof":115,"../internals/iterators":169,"../internals/well-known-symbol":237}],145:[function(require,module,exports){
- var anObject = require('../internals/an-object');
- var getIteratorMethod = require('../internals/get-iterator-method');
- module.exports = function (it, usingIterator) {
- var iteratorMethod = arguments.length < 2 ? getIteratorMethod(it) : usingIterator;
- if (typeof iteratorMethod != 'function') {
- throw TypeError(String(it) + ' is not iterable');
- } return anObject(iteratorMethod.call(it));
- };
- },{"../internals/an-object":94,"../internals/get-iterator-method":144}],146:[function(require,module,exports){
- var toObject = require('../internals/to-object');
- var floor = Math.floor;
- var replace = ''.replace;
- var SUBSTITUTION_SYMBOLS = /\$([$&'`]|\d{1,2}|<[^>]*>)/g;
- var SUBSTITUTION_SYMBOLS_NO_NAMED = /\$([$&'`]|\d{1,2})/g;
- // `GetSubstitution` abstract operation
- // https://tc39.es/ecma262/#sec-getsubstitution
- module.exports = function (matched, str, position, captures, namedCaptures, replacement) {
- var tailPos = position + matched.length;
- var m = captures.length;
- var symbols = SUBSTITUTION_SYMBOLS_NO_NAMED;
- if (namedCaptures !== undefined) {
- namedCaptures = toObject(namedCaptures);
- symbols = SUBSTITUTION_SYMBOLS;
- }
- return replace.call(replacement, symbols, function (match, ch) {
- var capture;
- switch (ch.charAt(0)) {
- case '$': return '$';
- case '&': return matched;
- case '`': return str.slice(0, position);
- case "'": return str.slice(tailPos);
- case '<':
- capture = namedCaptures[ch.slice(1, -1)];
- break;
- default: // \d\d?
- var n = +ch;
- if (n === 0) return match;
- if (n > m) {
- var f = floor(n / 10);
- if (f === 0) return match;
- if (f <= m) return captures[f - 1] === undefined ? ch.charAt(1) : captures[f - 1] + ch.charAt(1);
- return match;
- }
- capture = captures[n - 1];
- }
- return capture === undefined ? '' : capture;
- });
- };
- },{"../internals/to-object":222}],147:[function(require,module,exports){
- (function (global){(function (){
- var check = function (it) {
- return it && it.Math == Math && it;
- };
- // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
- module.exports =
- // eslint-disable-next-line es/no-global-this -- safe
- check(typeof globalThis == 'object' && globalThis) ||
- check(typeof window == 'object' && window) ||
- // eslint-disable-next-line no-restricted-globals -- safe
- check(typeof self == 'object' && self) ||
- check(typeof global == 'object' && global) ||
- // eslint-disable-next-line no-new-func -- fallback
- (function () { return this; })() || Function('return this')();
- }).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
- },{}],148:[function(require,module,exports){
- var toObject = require('../internals/to-object');
- var hasOwnProperty = {}.hasOwnProperty;
- module.exports = Object.hasOwn || function hasOwn(it, key) {
- return hasOwnProperty.call(toObject(it), key);
- };
- },{"../internals/to-object":222}],149:[function(require,module,exports){
- module.exports = {};
- },{}],150:[function(require,module,exports){
- var global = require('../internals/global');
- module.exports = function (a, b) {
- var console = global.console;
- if (console && console.error) {
- arguments.length === 1 ? console.error(a) : console.error(a, b);
- }
- };
- },{"../internals/global":147}],151:[function(require,module,exports){
- var getBuiltIn = require('../internals/get-built-in');
- module.exports = getBuiltIn('document', 'documentElement');
- },{"../internals/get-built-in":143}],152:[function(require,module,exports){
- var DESCRIPTORS = require('../internals/descriptors');
- var fails = require('../internals/fails');
- var createElement = require('../internals/document-create-element');
- // Thank's IE8 for his funny defineProperty
- module.exports = !DESCRIPTORS && !fails(function () {
- // eslint-disable-next-line es/no-object-defineproperty -- requied for testing
- return Object.defineProperty(createElement('div'), 'a', {
- get: function () { return 7; }
- }).a != 7;
- });
- },{"../internals/descriptors":125,"../internals/document-create-element":126,"../internals/fails":140}],153:[function(require,module,exports){
- // IEEE754 conversions based on https://github.com/feross/ieee754
- var abs = Math.abs;
- var pow = Math.pow;
- var floor = Math.floor;
- var log = Math.log;
- var LN2 = Math.LN2;
- var pack = function (number, mantissaLength, bytes) {
- var buffer = new Array(bytes);
- var exponentLength = bytes * 8 - mantissaLength - 1;
- var eMax = (1 << exponentLength) - 1;
- var eBias = eMax >> 1;
- var rt = mantissaLength === 23 ? pow(2, -24) - pow(2, -77) : 0;
- var sign = number < 0 || number === 0 && 1 / number < 0 ? 1 : 0;
- var index = 0;
- var exponent, mantissa, c;
- number = abs(number);
- // eslint-disable-next-line no-self-compare -- NaN check
- if (number != number || number === Infinity) {
- // eslint-disable-next-line no-self-compare -- NaN check
- mantissa = number != number ? 1 : 0;
- exponent = eMax;
- } else {
- exponent = floor(log(number) / LN2);
- if (number * (c = pow(2, -exponent)) < 1) {
- exponent--;
- c *= 2;
- }
- if (exponent + eBias >= 1) {
- number += rt / c;
- } else {
- number += rt * pow(2, 1 - eBias);
- }
- if (number * c >= 2) {
- exponent++;
- c /= 2;
- }
- if (exponent + eBias >= eMax) {
- mantissa = 0;
- exponent = eMax;
- } else if (exponent + eBias >= 1) {
- mantissa = (number * c - 1) * pow(2, mantissaLength);
- exponent = exponent + eBias;
- } else {
- mantissa = number * pow(2, eBias - 1) * pow(2, mantissaLength);
- exponent = 0;
- }
- }
- for (; mantissaLength >= 8; buffer[index++] = mantissa & 255, mantissa /= 256, mantissaLength -= 8);
- exponent = exponent << mantissaLength | mantissa;
- exponentLength += mantissaLength;
- for (; exponentLength > 0; buffer[index++] = exponent & 255, exponent /= 256, exponentLength -= 8);
- buffer[--index] |= sign * 128;
- return buffer;
- };
- var unpack = function (buffer, mantissaLength) {
- var bytes = buffer.length;
- var exponentLength = bytes * 8 - mantissaLength - 1;
- var eMax = (1 << exponentLength) - 1;
- var eBias = eMax >> 1;
- var nBits = exponentLength - 7;
- var index = bytes - 1;
- var sign = buffer[index--];
- var exponent = sign & 127;
- var mantissa;
- sign >>= 7;
- for (; nBits > 0; exponent = exponent * 256 + buffer[index], index--, nBits -= 8);
- mantissa = exponent & (1 << -nBits) - 1;
- exponent >>= -nBits;
- nBits += mantissaLength;
- for (; nBits > 0; mantissa = mantissa * 256 + buffer[index], index--, nBits -= 8);
- if (exponent === 0) {
- exponent = 1 - eBias;
- } else if (exponent === eMax) {
- return mantissa ? NaN : sign ? -Infinity : Infinity;
- } else {
- mantissa = mantissa + pow(2, mantissaLength);
- exponent = exponent - eBias;
- } return (sign ? -1 : 1) * mantissa * pow(2, exponent - mantissaLength);
- };
- module.exports = {
- pack: pack,
- unpack: unpack
- };
- },{}],154:[function(require,module,exports){
- var fails = require('../internals/fails');
- var classof = require('../internals/classof-raw');
- var split = ''.split;
- // fallback for non-array-like ES3 and non-enumerable old V8 strings
- module.exports = fails(function () {
- // throws an error in rhino, see https://github.com/mozilla/rhino/issues/346
- // eslint-disable-next-line no-prototype-builtins -- safe
- return !Object('z').propertyIsEnumerable(0);
- }) ? function (it) {
- return classof(it) == 'String' ? split.call(it, '') : Object(it);
- } : Object;
- },{"../internals/classof-raw":114,"../internals/fails":140}],155:[function(require,module,exports){
- var isObject = require('../internals/is-object');
- var setPrototypeOf = require('../internals/object-set-prototype-of');
- // makes subclassing work correct for wrapped built-ins
- module.exports = function ($this, dummy, Wrapper) {
- var NewTarget, NewTargetPrototype;
- if (
- // it can work only with native `setPrototypeOf`
- setPrototypeOf &&
- // we haven't completely correct pre-ES6 way for getting `new.target`, so use this
- typeof (NewTarget = dummy.constructor) == 'function' &&
- NewTarget !== Wrapper &&
- isObject(NewTargetPrototype = NewTarget.prototype) &&
- NewTargetPrototype !== Wrapper.prototype
- ) setPrototypeOf($this, NewTargetPrototype);
- return $this;
- };
- },{"../internals/is-object":162,"../internals/object-set-prototype-of":188}],156:[function(require,module,exports){
- var store = require('../internals/shared-store');
- var functionToString = Function.toString;
- // this helper broken in `core-js@3.4.1-3.4.4`, so we can't use `shared` helper
- if (typeof store.inspectSource != 'function') {
- store.inspectSource = function (it) {
- return functionToString.call(it);
- };
- }
- module.exports = store.inspectSource;
- },{"../internals/shared-store":210}],157:[function(require,module,exports){
- var NATIVE_WEAK_MAP = require('../internals/native-weak-map');
- var global = require('../internals/global');
- var isObject = require('../internals/is-object');
- var createNonEnumerableProperty = require('../internals/create-non-enumerable-property');
- var objectHas = require('../internals/has');
- var shared = require('../internals/shared-store');
- var sharedKey = require('../internals/shared-key');
- var hiddenKeys = require('../internals/hidden-keys');
- var OBJECT_ALREADY_INITIALIZED = 'Object already initialized';
- var WeakMap = global.WeakMap;
- var set, get, has;
- var enforce = function (it) {
- return has(it) ? get(it) : set(it, {});
- };
- var getterFor = function (TYPE) {
- return function (it) {
- var state;
- if (!isObject(it) || (state = get(it)).type !== TYPE) {
- throw TypeError('Incompatible receiver, ' + TYPE + ' required');
- } return state;
- };
- };
- if (NATIVE_WEAK_MAP || shared.state) {
- var store = shared.state || (shared.state = new WeakMap());
- var wmget = store.get;
- var wmhas = store.has;
- var wmset = store.set;
- set = function (it, metadata) {
- if (wmhas.call(store, it)) throw new TypeError(OBJECT_ALREADY_INITIALIZED);
- metadata.facade = it;
- wmset.call(store, it, metadata);
- return metadata;
- };
- get = function (it) {
- return wmget.call(store, it) || {};
- };
- has = function (it) {
- return wmhas.call(store, it);
- };
- } else {
- var STATE = sharedKey('state');
- hiddenKeys[STATE] = true;
- set = function (it, metadata) {
- if (objectHas(it, STATE)) throw new TypeError(OBJECT_ALREADY_INITIALIZED);
- metadata.facade = it;
- createNonEnumerableProperty(it, STATE, metadata);
- return metadata;
- };
- get = function (it) {
- return objectHas(it, STATE) ? it[STATE] : {};
- };
- has = function (it) {
- return objectHas(it, STATE);
- };
- }
- module.exports = {
- set: set,
- get: get,
- has: has,
- enforce: enforce,
- getterFor: getterFor
- };
- },{"../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){
- var wellKnownSymbol = require('../internals/well-known-symbol');
- var Iterators = require('../internals/iterators');
- var ITERATOR = wellKnownSymbol('iterator');
- var ArrayPrototype = Array.prototype;
- // check on default Array iterator
- module.exports = function (it) {
- return it !== undefined && (Iterators.Array === it || ArrayPrototype[ITERATOR] === it);
- };
- },{"../internals/iterators":169,"../internals/well-known-symbol":237}],159:[function(require,module,exports){
- var classof = require('../internals/classof-raw');
- // `IsArray` abstract operation
- // https://tc39.es/ecma262/#sec-isarray
- // eslint-disable-next-line es/no-array-isarray -- safe
- module.exports = Array.isArray || function isArray(arg) {
- return classof(arg) == 'Array';
- };
- },{"../internals/classof-raw":114}],160:[function(require,module,exports){
- var fails = require('../internals/fails');
- var replacement = /#|\.prototype\./;
- var isForced = function (feature, detection) {
- var value = data[normalize(feature)];
- return value == POLYFILL ? true
- : value == NATIVE ? false
- : typeof detection == 'function' ? fails(detection)
- : !!detection;
- };
- var normalize = isForced.normalize = function (string) {
- return String(string).replace(replacement, '.').toLowerCase();
- };
- var data = isForced.data = {};
- var NATIVE = isForced.NATIVE = 'N';
- var POLYFILL = isForced.POLYFILL = 'P';
- module.exports = isForced;
- },{"../internals/fails":140}],161:[function(require,module,exports){
- var isObject = require('../internals/is-object');
- var floor = Math.floor;
- // `Number.isInteger` method implementation
- // https://tc39.es/ecma262/#sec-number.isinteger
- module.exports = function isInteger(it) {
- return !isObject(it) && isFinite(it) && floor(it) === it;
- };
- },{"../internals/is-object":162}],162:[function(require,module,exports){
- module.exports = function (it) {
- return typeof it === 'object' ? it !== null : typeof it === 'function';
- };
- },{}],163:[function(require,module,exports){
- module.exports = false;
- },{}],164:[function(require,module,exports){
- var isObject = require('../internals/is-object');
- var classof = require('../internals/classof-raw');
- var wellKnownSymbol = require('../internals/well-known-symbol');
- var MATCH = wellKnownSymbol('match');
- // `IsRegExp` abstract operation
- // https://tc39.es/ecma262/#sec-isregexp
- module.exports = function (it) {
- var isRegExp;
- return isObject(it) && ((isRegExp = it[MATCH]) !== undefined ? !!isRegExp : classof(it) == 'RegExp');
- };
- },{"../internals/classof-raw":114,"../internals/is-object":162,"../internals/well-known-symbol":237}],165:[function(require,module,exports){
- var getBuiltIn = require('../internals/get-built-in');
- var USE_SYMBOL_AS_UID = require('../internals/use-symbol-as-uid');
- module.exports = USE_SYMBOL_AS_UID ? function (it) {
- return typeof it == 'symbol';
- } : function (it) {
- var $Symbol = getBuiltIn('Symbol');
- return typeof $Symbol == 'function' && Object(it) instanceof $Symbol;
- };
- },{"../internals/get-built-in":143,"../internals/use-symbol-as-uid":235}],166:[function(require,module,exports){
- var anObject = require('../internals/an-object');
- var isArrayIteratorMethod = require('../internals/is-array-iterator-method');
- var toLength = require('../internals/to-length');
- var bind = require('../internals/function-bind-context');
- var getIterator = require('../internals/get-iterator');
- var getIteratorMethod = require('../internals/get-iterator-method');
- var iteratorClose = require('../internals/iterator-close');
- var Result = function (stopped, result) {
- this.stopped = stopped;
- this.result = result;
- };
- module.exports = function (iterable, unboundFunction, options) {
- var that = options && options.that;
- var AS_ENTRIES = !!(options && options.AS_ENTRIES);
- var IS_ITERATOR = !!(options && options.IS_ITERATOR);
- var INTERRUPTED = !!(options && options.INTERRUPTED);
- var fn = bind(unboundFunction, that, 1 + AS_ENTRIES + INTERRUPTED);
- var iterator, iterFn, index, length, result, next, step;
- var stop = function (condition) {
- if (iterator) iteratorClose(iterator, 'normal', condition);
- return new Result(true, condition);
- };
- var callFn = function (value) {
- if (AS_ENTRIES) {
- anObject(value);
- return INTERRUPTED ? fn(value[0], value[1], stop) : fn(value[0], value[1]);
- } return INTERRUPTED ? fn(value, stop) : fn(value);
- };
- if (IS_ITERATOR) {
- iterator = iterable;
- } else {
- iterFn = getIteratorMethod(iterable);
- if (typeof iterFn != 'function') throw TypeError('Target is not iterable');
- // optimisation for array iterators
- if (isArrayIteratorMethod(iterFn)) {
- for (index = 0, length = toLength(iterable.length); length > index; index++) {
- result = callFn(iterable[index]);
- if (result && result instanceof Result) return result;
- } return new Result(false);
- }
- iterator = getIterator(iterable, iterFn);
- }
- next = iterator.next;
- while (!(step = next.call(iterator)).done) {
- try {
- result = callFn(step.value);
- } catch (error) {
- iteratorClose(iterator, 'throw', error);
- }
- if (typeof result == 'object' && result && result instanceof Result) return result;
- } return new Result(false);
- };
- },{"../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){
- var anObject = require('../internals/an-object');
- module.exports = function (iterator, kind, value) {
- var innerResult, innerError;
- anObject(iterator);
- try {
- innerResult = iterator['return'];
- if (innerResult === undefined) {
- if (kind === 'throw') throw value;
- return value;
- }
- innerResult = innerResult.call(iterator);
- } catch (error) {
- innerError = true;
- innerResult = error;
- }
- if (kind === 'throw') throw value;
- if (innerError) throw innerResult;
- anObject(innerResult);
- return value;
- };
- },{"../internals/an-object":94}],168:[function(require,module,exports){
- 'use strict';
- var fails = require('../internals/fails');
- var getPrototypeOf = require('../internals/object-get-prototype-of');
- var createNonEnumerableProperty = require('../internals/create-non-enumerable-property');
- var has = require('../internals/has');
- var wellKnownSymbol = require('../internals/well-known-symbol');
- var IS_PURE = require('../internals/is-pure');
- var ITERATOR = wellKnownSymbol('iterator');
- var BUGGY_SAFARI_ITERATORS = false;
- var returnThis = function () { return this; };
- // `%IteratorPrototype%` object
- // https://tc39.es/ecma262/#sec-%iteratorprototype%-object
- var IteratorPrototype, PrototypeOfArrayIteratorPrototype, arrayIterator;
- /* eslint-disable es/no-array-prototype-keys -- safe */
- if ([].keys) {
- arrayIterator = [].keys();
- // Safari 8 has buggy iterators w/o `next`
- if (!('next' in arrayIterator)) BUGGY_SAFARI_ITERATORS = true;
- else {
- PrototypeOfArrayIteratorPrototype = getPrototypeOf(getPrototypeOf(arrayIterator));
- if (PrototypeOfArrayIteratorPrototype !== Object.prototype) IteratorPrototype = PrototypeOfArrayIteratorPrototype;
- }
- }
- var NEW_ITERATOR_PROTOTYPE = IteratorPrototype == undefined || fails(function () {
- var test = {};
- // FF44- legacy iterators case
- return IteratorPrototype[ITERATOR].call(test) !== test;
- });
- if (NEW_ITERATOR_PROTOTYPE) IteratorPrototype = {};
- // `%IteratorPrototype%[@@iterator]()` method
- // https://tc39.es/ecma262/#sec-%iteratorprototype%-@@iterator
- if ((!IS_PURE || NEW_ITERATOR_PROTOTYPE) && !has(IteratorPrototype, ITERATOR)) {
- createNonEnumerableProperty(IteratorPrototype, ITERATOR, returnThis);
- }
- module.exports = {
- IteratorPrototype: IteratorPrototype,
- BUGGY_SAFARI_ITERATORS: BUGGY_SAFARI_ITERATORS
- };
- },{"../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){
- arguments[4][149][0].apply(exports,arguments)
- },{"dup":149}],170:[function(require,module,exports){
- var global = require('../internals/global');
- var getOwnPropertyDescriptor = require('../internals/object-get-own-property-descriptor').f;
- var macrotask = require('../internals/task').set;
- var IS_IOS = require('../internals/engine-is-ios');
- var IS_IOS_PEBBLE = require('../internals/engine-is-ios-pebble');
- var IS_WEBOS_WEBKIT = require('../internals/engine-is-webos-webkit');
- var IS_NODE = require('../internals/engine-is-node');
- var MutationObserver = global.MutationObserver || global.WebKitMutationObserver;
- var document = global.document;
- var process = global.process;
- var Promise = global.Promise;
- // Node.js 11 shows ExperimentalWarning on getting `queueMicrotask`
- var queueMicrotaskDescriptor = getOwnPropertyDescriptor(global, 'queueMicrotask');
- var queueMicrotask = queueMicrotaskDescriptor && queueMicrotaskDescriptor.value;
- var flush, head, last, notify, toggle, node, promise, then;
- // modern engines have queueMicrotask method
- if (!queueMicrotask) {
- flush = function () {
- var parent, fn;
- if (IS_NODE && (parent = process.domain)) parent.exit();
- while (head) {
- fn = head.fn;
- head = head.next;
- try {
- fn();
- } catch (error) {
- if (head) notify();
- else last = undefined;
- throw error;
- }
- } last = undefined;
- if (parent) parent.enter();
- };
- // browsers with MutationObserver, except iOS - https://github.com/zloirock/core-js/issues/339
- // also except WebOS Webkit https://github.com/zloirock/core-js/issues/898
- if (!IS_IOS && !IS_NODE && !IS_WEBOS_WEBKIT && MutationObserver && document) {
- toggle = true;
- node = document.createTextNode('');
- new MutationObserver(flush).observe(node, { characterData: true });
- notify = function () {
- node.data = toggle = !toggle;
- };
- // environments with maybe non-completely correct, but existent Promise
- } else if (!IS_IOS_PEBBLE && Promise && Promise.resolve) {
- // Promise.resolve without an argument throws an error in LG WebOS 2
- promise = Promise.resolve(undefined);
- // workaround of WebKit ~ iOS Safari 10.1 bug
- promise.constructor = Promise;
- then = promise.then;
- notify = function () {
- then.call(promise, flush);
- };
- // Node.js without promises
- } else if (IS_NODE) {
- notify = function () {
- process.nextTick(flush);
- };
- // for other environments - macrotask based on:
- // - setImmediate
- // - MessageChannel
- // - window.postMessag
- // - onreadystatechange
- // - setTimeout
- } else {
- notify = function () {
- // strange IE + webpack dev server bug - use .call(global)
- macrotask.call(global, flush);
- };
- }
- }
- module.exports = queueMicrotask || function (fn) {
- var task = { fn: fn, next: undefined };
- if (last) last.next = task;
- if (!head) {
- head = task;
- notify();
- } last = task;
- };
- },{"../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){
- var global = require('../internals/global');
- module.exports = global.Promise;
- },{"../internals/global":147}],172:[function(require,module,exports){
- /* eslint-disable es/no-symbol -- required for testing */
- var V8_VERSION = require('../internals/engine-v8-version');
- var fails = require('../internals/fails');
- // eslint-disable-next-line es/no-object-getownpropertysymbols -- required for testing
- module.exports = !!Object.getOwnPropertySymbols && !fails(function () {
- var symbol = Symbol();
- // Chrome 38 Symbol has incorrect toString conversion
- // `get-own-property-symbols` polyfill symbols converted to object are not Symbol instances
- return !String(symbol) || !(Object(symbol) instanceof Symbol) ||
- // Chrome 38-40 symbols are not inherited from DOM collections prototypes to instances
- !Symbol.sham && V8_VERSION && V8_VERSION < 41;
- });
- },{"../internals/engine-v8-version":136,"../internals/fails":140}],173:[function(require,module,exports){
- var global = require('../internals/global');
- var inspectSource = require('../internals/inspect-source');
- var WeakMap = global.WeakMap;
- module.exports = typeof WeakMap === 'function' && /native code/.test(inspectSource(WeakMap));
- },{"../internals/global":147,"../internals/inspect-source":156}],174:[function(require,module,exports){
- 'use strict';
- var aFunction = require('../internals/a-function');
- var PromiseCapability = function (C) {
- var resolve, reject;
- this.promise = new C(function ($$resolve, $$reject) {
- if (resolve !== undefined || reject !== undefined) throw TypeError('Bad Promise constructor');
- resolve = $$resolve;
- reject = $$reject;
- });
- this.resolve = aFunction(resolve);
- this.reject = aFunction(reject);
- };
- // `NewPromiseCapability` abstract operation
- // https://tc39.es/ecma262/#sec-newpromisecapability
- module.exports.f = function (C) {
- return new PromiseCapability(C);
- };
- },{"../internals/a-function":89}],175:[function(require,module,exports){
- var isRegExp = require('../internals/is-regexp');
- module.exports = function (it) {
- if (isRegExp(it)) {
- throw TypeError("The method doesn't accept regular expressions");
- } return it;
- };
- },{"../internals/is-regexp":164}],176:[function(require,module,exports){
- 'use strict';
- var DESCRIPTORS = require('../internals/descriptors');
- var fails = require('../internals/fails');
- var objectKeys = require('../internals/object-keys');
- var getOwnPropertySymbolsModule = require('../internals/object-get-own-property-symbols');
- var propertyIsEnumerableModule = require('../internals/object-property-is-enumerable');
- var toObject = require('../internals/to-object');
- var IndexedObject = require('../internals/indexed-object');
- // eslint-disable-next-line es/no-object-assign -- safe
- var $assign = Object.assign;
- // eslint-disable-next-line es/no-object-defineproperty -- required for testing
- var defineProperty = Object.defineProperty;
- // `Object.assign` method
- // https://tc39.es/ecma262/#sec-object.assign
- module.exports = !$assign || fails(function () {
- // should have correct order of operations (Edge bug)
- if (DESCRIPTORS && $assign({ b: 1 }, $assign(defineProperty({}, 'a', {
- enumerable: true,
- get: function () {
- defineProperty(this, 'b', {
- value: 3,
- enumerable: false
- });
- }
- }), { b: 2 })).b !== 1) return true;
- // should work with symbols and should have deterministic property order (V8 bug)
- var A = {};
- var B = {};
- // eslint-disable-next-line es/no-symbol -- safe
- var symbol = Symbol();
- var alphabet = 'abcdefghijklmnopqrst';
- A[symbol] = 7;
- alphabet.split('').forEach(function (chr) { B[chr] = chr; });
- return $assign({}, A)[symbol] != 7 || objectKeys($assign({}, B)).join('') != alphabet;
- }) ? function assign(target, source) { // eslint-disable-line no-unused-vars -- required for `.length`
- var T = toObject(target);
- var argumentsLength = arguments.length;
- var index = 1;
- var getOwnPropertySymbols = getOwnPropertySymbolsModule.f;
- var propertyIsEnumerable = propertyIsEnumerableModule.f;
- while (argumentsLength > index) {
- var S = IndexedObject(arguments[index++]);
- var keys = getOwnPropertySymbols ? objectKeys(S).concat(getOwnPropertySymbols(S)) : objectKeys(S);
- var length = keys.length;
- var j = 0;
- var key;
- while (length > j) {
- key = keys[j++];
- if (!DESCRIPTORS || propertyIsEnumerable.call(S, key)) T[key] = S[key];
- }
- } return T;
- } : $assign;
- },{"../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){
- /* global ActiveXObject -- old IE, WSH */
- var anObject = require('../internals/an-object');
- var defineProperties = require('../internals/object-define-properties');
- var enumBugKeys = require('../internals/enum-bug-keys');
- var hiddenKeys = require('../internals/hidden-keys');
- var html = require('../internals/html');
- var documentCreateElement = require('../internals/document-create-element');
- var sharedKey = require('../internals/shared-key');
- var GT = '>';
- var LT = '<';
- var PROTOTYPE = 'prototype';
- var SCRIPT = 'script';
- var IE_PROTO = sharedKey('IE_PROTO');
- var EmptyConstructor = function () { /* empty */ };
- var scriptTag = function (content) {
- return LT + SCRIPT + GT + content + LT + '/' + SCRIPT + GT;
- };
- // Create object with fake `null` prototype: use ActiveX Object with cleared prototype
- var NullProtoObjectViaActiveX = function (activeXDocument) {
- activeXDocument.write(scriptTag(''));
- activeXDocument.close();
- var temp = activeXDocument.parentWindow.Object;
- activeXDocument = null; // avoid memory leak
- return temp;
- };
- // Create object with fake `null` prototype: use iframe Object with cleared prototype
- var NullProtoObjectViaIFrame = function () {
- // Thrash, waste and sodomy: IE GC bug
- var iframe = documentCreateElement('iframe');
- var JS = 'java' + SCRIPT + ':';
- var iframeDocument;
- iframe.style.display = 'none';
- html.appendChild(iframe);
- // https://github.com/zloirock/core-js/issues/475
- iframe.src = String(JS);
- iframeDocument = iframe.contentWindow.document;
- iframeDocument.open();
- iframeDocument.write(scriptTag('document.F=Object'));
- iframeDocument.close();
- return iframeDocument.F;
- };
- // Check for document.domain and active x support
- // No need to use active x approach when document.domain is not set
- // see https://github.com/es-shims/es5-shim/issues/150
- // variation of https://github.com/kitcambridge/es5-shim/commit/4f738ac066346
- // avoid IE GC bug
- var activeXDocument;
- var NullProtoObject = function () {
- try {
- activeXDocument = new ActiveXObject('htmlfile');
- } catch (error) { /* ignore */ }
- NullProtoObject = typeof document != 'undefined'
- ? document.domain && activeXDocument
- ? NullProtoObjectViaActiveX(activeXDocument) // old IE
- : NullProtoObjectViaIFrame()
- : NullProtoObjectViaActiveX(activeXDocument); // WSH
- var length = enumBugKeys.length;
- while (length--) delete NullProtoObject[PROTOTYPE][enumBugKeys[length]];
- return NullProtoObject();
- };
- hiddenKeys[IE_PROTO] = true;
- // `Object.create` method
- // https://tc39.es/ecma262/#sec-object.create
- module.exports = Object.create || function create(O, Properties) {
- var result;
- if (O !== null) {
- EmptyConstructor[PROTOTYPE] = anObject(O);
- result = new EmptyConstructor();
- EmptyConstructor[PROTOTYPE] = null;
- // add "__proto__" for Object.getPrototypeOf polyfill
- result[IE_PROTO] = O;
- } else result = NullProtoObject();
- return Properties === undefined ? result : defineProperties(result, Properties);
- };
- },{"../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){
- var DESCRIPTORS = require('../internals/descriptors');
- var definePropertyModule = require('../internals/object-define-property');
- var anObject = require('../internals/an-object');
- var objectKeys = require('../internals/object-keys');
- // `Object.defineProperties` method
- // https://tc39.es/ecma262/#sec-object.defineproperties
- // eslint-disable-next-line es/no-object-defineproperties -- safe
- module.exports = DESCRIPTORS ? Object.defineProperties : function defineProperties(O, Properties) {
- anObject(O);
- var keys = objectKeys(Properties);
- var length = keys.length;
- var index = 0;
- var key;
- while (length > index) definePropertyModule.f(O, key = keys[index++], Properties[key]);
- return O;
- };
- },{"../internals/an-object":94,"../internals/descriptors":125,"../internals/object-define-property":179,"../internals/object-keys":186}],179:[function(require,module,exports){
- var DESCRIPTORS = require('../internals/descriptors');
- var IE8_DOM_DEFINE = require('../internals/ie8-dom-define');
- var anObject = require('../internals/an-object');
- var toPropertyKey = require('../internals/to-property-key');
- // eslint-disable-next-line es/no-object-defineproperty -- safe
- var $defineProperty = Object.defineProperty;
- // `Object.defineProperty` method
- // https://tc39.es/ecma262/#sec-object.defineproperty
- exports.f = DESCRIPTORS ? $defineProperty : function defineProperty(O, P, Attributes) {
- anObject(O);
- P = toPropertyKey(P);
- anObject(Attributes);
- if (IE8_DOM_DEFINE) try {
- return $defineProperty(O, P, Attributes);
- } catch (error) { /* empty */ }
- if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported');
- if ('value' in Attributes) O[P] = Attributes.value;
- return O;
- };
- },{"../internals/an-object":94,"../internals/descriptors":125,"../internals/ie8-dom-define":152,"../internals/to-property-key":226}],180:[function(require,module,exports){
- var DESCRIPTORS = require('../internals/descriptors');
- var propertyIsEnumerableModule = require('../internals/object-property-is-enumerable');
- var createPropertyDescriptor = require('../internals/create-property-descriptor');
- var toIndexedObject = require('../internals/to-indexed-object');
- var toPropertyKey = require('../internals/to-property-key');
- var has = require('../internals/has');
- var IE8_DOM_DEFINE = require('../internals/ie8-dom-define');
- // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
- var $getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
- // `Object.getOwnPropertyDescriptor` method
- // https://tc39.es/ecma262/#sec-object.getownpropertydescriptor
- exports.f = DESCRIPTORS ? $getOwnPropertyDescriptor : function getOwnPropertyDescriptor(O, P) {
- O = toIndexedObject(O);
- P = toPropertyKey(P);
- if (IE8_DOM_DEFINE) try {
- return $getOwnPropertyDescriptor(O, P);
- } catch (error) { /* empty */ }
- if (has(O, P)) return createPropertyDescriptor(!propertyIsEnumerableModule.f.call(O, P), O[P]);
- };
- },{"../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){
- /* eslint-disable es/no-object-getownpropertynames -- safe */
- var toIndexedObject = require('../internals/to-indexed-object');
- var $getOwnPropertyNames = require('../internals/object-get-own-property-names').f;
- var toString = {}.toString;
- var windowNames = typeof window == 'object' && window && Object.getOwnPropertyNames
- ? Object.getOwnPropertyNames(window) : [];
- var getWindowNames = function (it) {
- try {
- return $getOwnPropertyNames(it);
- } catch (error) {
- return windowNames.slice();
- }
- };
- // fallback for IE11 buggy Object.getOwnPropertyNames with iframe and window
- module.exports.f = function getOwnPropertyNames(it) {
- return windowNames && toString.call(it) == '[object Window]'
- ? getWindowNames(it)
- : $getOwnPropertyNames(toIndexedObject(it));
- };
- },{"../internals/object-get-own-property-names":182,"../internals/to-indexed-object":219}],182:[function(require,module,exports){
- var internalObjectKeys = require('../internals/object-keys-internal');
- var enumBugKeys = require('../internals/enum-bug-keys');
- var hiddenKeys = enumBugKeys.concat('length', 'prototype');
- // `Object.getOwnPropertyNames` method
- // https://tc39.es/ecma262/#sec-object.getownpropertynames
- // eslint-disable-next-line es/no-object-getownpropertynames -- safe
- exports.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {
- return internalObjectKeys(O, hiddenKeys);
- };
- },{"../internals/enum-bug-keys":138,"../internals/object-keys-internal":185}],183:[function(require,module,exports){
- // eslint-disable-next-line es/no-object-getownpropertysymbols -- safe
- exports.f = Object.getOwnPropertySymbols;
- },{}],184:[function(require,module,exports){
- var has = require('../internals/has');
- var toObject = require('../internals/to-object');
- var sharedKey = require('../internals/shared-key');
- var CORRECT_PROTOTYPE_GETTER = require('../internals/correct-prototype-getter');
- var IE_PROTO = sharedKey('IE_PROTO');
- var ObjectPrototype = Object.prototype;
- // `Object.getPrototypeOf` method
- // https://tc39.es/ecma262/#sec-object.getprototypeof
- // eslint-disable-next-line es/no-object-getprototypeof -- safe
- module.exports = CORRECT_PROTOTYPE_GETTER ? Object.getPrototypeOf : function (O) {
- O = toObject(O);
- if (has(O, IE_PROTO)) return O[IE_PROTO];
- if (typeof O.constructor == 'function' && O instanceof O.constructor) {
- return O.constructor.prototype;
- } return O instanceof Object ? ObjectPrototype : null;
- };
- },{"../internals/correct-prototype-getter":118,"../internals/has":148,"../internals/shared-key":209,"../internals/to-object":222}],185:[function(require,module,exports){
- var has = require('../internals/has');
- var toIndexedObject = require('../internals/to-indexed-object');
- var indexOf = require('../internals/array-includes').indexOf;
- var hiddenKeys = require('../internals/hidden-keys');
- module.exports = function (object, names) {
- var O = toIndexedObject(object);
- var i = 0;
- var result = [];
- var key;
- for (key in O) !has(hiddenKeys, key) && has(O, key) && result.push(key);
- // Don't enum bug & hidden keys
- while (names.length > i) if (has(O, key = names[i++])) {
- ~indexOf(result, key) || result.push(key);
- }
- return result;
- };
- },{"../internals/array-includes":103,"../internals/has":148,"../internals/hidden-keys":149,"../internals/to-indexed-object":219}],186:[function(require,module,exports){
- var internalObjectKeys = require('../internals/object-keys-internal');
- var enumBugKeys = require('../internals/enum-bug-keys');
- // `Object.keys` method
- // https://tc39.es/ecma262/#sec-object.keys
- // eslint-disable-next-line es/no-object-keys -- safe
- module.exports = Object.keys || function keys(O) {
- return internalObjectKeys(O, enumBugKeys);
- };
- },{"../internals/enum-bug-keys":138,"../internals/object-keys-internal":185}],187:[function(require,module,exports){
- 'use strict';
- var $propertyIsEnumerable = {}.propertyIsEnumerable;
- // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
- var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
- // Nashorn ~ JDK8 bug
- var NASHORN_BUG = getOwnPropertyDescriptor && !$propertyIsEnumerable.call({ 1: 2 }, 1);
- // `Object.prototype.propertyIsEnumerable` method implementation
- // https://tc39.es/ecma262/#sec-object.prototype.propertyisenumerable
- exports.f = NASHORN_BUG ? function propertyIsEnumerable(V) {
- var descriptor = getOwnPropertyDescriptor(this, V);
- return !!descriptor && descriptor.enumerable;
- } : $propertyIsEnumerable;
- },{}],188:[function(require,module,exports){
- /* eslint-disable no-proto -- safe */
- var anObject = require('../internals/an-object');
- var aPossiblePrototype = require('../internals/a-possible-prototype');
- // `Object.setPrototypeOf` method
- // https://tc39.es/ecma262/#sec-object.setprototypeof
- // Works with __proto__ only. Old v8 can't work with null proto objects.
- // eslint-disable-next-line es/no-object-setprototypeof -- safe
- module.exports = Object.setPrototypeOf || ('__proto__' in {} ? function () {
- var CORRECT_SETTER = false;
- var test = {};
- var setter;
- try {
- // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
- setter = Object.getOwnPropertyDescriptor(Object.prototype, '__proto__').set;
- setter.call(test, []);
- CORRECT_SETTER = test instanceof Array;
- } catch (error) { /* empty */ }
- return function setPrototypeOf(O, proto) {
- anObject(O);
- aPossiblePrototype(proto);
- if (CORRECT_SETTER) setter.call(O, proto);
- else O.__proto__ = proto;
- return O;
- };
- }() : undefined);
- },{"../internals/a-possible-prototype":90,"../internals/an-object":94}],189:[function(require,module,exports){
- var DESCRIPTORS = require('../internals/descriptors');
- var objectKeys = require('../internals/object-keys');
- var toIndexedObject = require('../internals/to-indexed-object');
- var propertyIsEnumerable = require('../internals/object-property-is-enumerable').f;
- // `Object.{ entries, values }` methods implementation
- var createMethod = function (TO_ENTRIES) {
- return function (it) {
- var O = toIndexedObject(it);
- var keys = objectKeys(O);
- var length = keys.length;
- var i = 0;
- var result = [];
- var key;
- while (length > i) {
- key = keys[i++];
- if (!DESCRIPTORS || propertyIsEnumerable.call(O, key)) {
- result.push(TO_ENTRIES ? [key, O[key]] : O[key]);
- }
- }
- return result;
- };
- };
- module.exports = {
- // `Object.entries` method
- // https://tc39.es/ecma262/#sec-object.entries
- entries: createMethod(true),
- // `Object.values` method
- // https://tc39.es/ecma262/#sec-object.values
- values: createMethod(false)
- };
- },{"../internals/descriptors":125,"../internals/object-keys":186,"../internals/object-property-is-enumerable":187,"../internals/to-indexed-object":219}],190:[function(require,module,exports){
- 'use strict';
- var TO_STRING_TAG_SUPPORT = require('../internals/to-string-tag-support');
- var classof = require('../internals/classof');
- // `Object.prototype.toString` method implementation
- // https://tc39.es/ecma262/#sec-object.prototype.tostring
- module.exports = TO_STRING_TAG_SUPPORT ? {}.toString : function toString() {
- return '[object ' + classof(this) + ']';
- };
- },{"../internals/classof":115,"../internals/to-string-tag-support":227}],191:[function(require,module,exports){
- var isObject = require('../internals/is-object');
- // `OrdinaryToPrimitive` abstract operation
- // https://tc39.es/ecma262/#sec-ordinarytoprimitive
- module.exports = function (input, pref) {
- var fn, val;
- if (pref === 'string' && typeof (fn = input.toString) == 'function' && !isObject(val = fn.call(input))) return val;
- if (typeof (fn = input.valueOf) == 'function' && !isObject(val = fn.call(input))) return val;
- if (pref !== 'string' && typeof (fn = input.toString) == 'function' && !isObject(val = fn.call(input))) return val;
- throw TypeError("Can't convert object to primitive value");
- };
- },{"../internals/is-object":162}],192:[function(require,module,exports){
- var getBuiltIn = require('../internals/get-built-in');
- var getOwnPropertyNamesModule = require('../internals/object-get-own-property-names');
- var getOwnPropertySymbolsModule = require('../internals/object-get-own-property-symbols');
- var anObject = require('../internals/an-object');
- // all object keys, includes non-enumerable and symbols
- module.exports = getBuiltIn('Reflect', 'ownKeys') || function ownKeys(it) {
- var keys = getOwnPropertyNamesModule.f(anObject(it));
- var getOwnPropertySymbols = getOwnPropertySymbolsModule.f;
- return getOwnPropertySymbols ? keys.concat(getOwnPropertySymbols(it)) : keys;
- };
- },{"../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){
- var global = require('../internals/global');
- module.exports = global;
- },{"../internals/global":147}],194:[function(require,module,exports){
- module.exports = function (exec) {
- try {
- return { error: false, value: exec() };
- } catch (error) {
- return { error: true, value: error };
- }
- };
- },{}],195:[function(require,module,exports){
- var anObject = require('../internals/an-object');
- var isObject = require('../internals/is-object');
- var newPromiseCapability = require('../internals/new-promise-capability');
- module.exports = function (C, x) {
- anObject(C);
- if (isObject(x) && x.constructor === C) return x;
- var promiseCapability = newPromiseCapability.f(C);
- var resolve = promiseCapability.resolve;
- resolve(x);
- return promiseCapability.promise;
- };
- },{"../internals/an-object":94,"../internals/is-object":162,"../internals/new-promise-capability":174}],196:[function(require,module,exports){
- var redefine = require('../internals/redefine');
- module.exports = function (target, src, options) {
- for (var key in src) redefine(target, key, src[key], options);
- return target;
- };
- },{"../internals/redefine":197}],197:[function(require,module,exports){
- var global = require('../internals/global');
- var createNonEnumerableProperty = require('../internals/create-non-enumerable-property');
- var has = require('../internals/has');
- var setGlobal = require('../internals/set-global');
- var inspectSource = require('../internals/inspect-source');
- var InternalStateModule = require('../internals/internal-state');
- var getInternalState = InternalStateModule.get;
- var enforceInternalState = InternalStateModule.enforce;
- var TEMPLATE = String(String).split('String');
- (module.exports = function (O, key, value, options) {
- var unsafe = options ? !!options.unsafe : false;
- var simple = options ? !!options.enumerable : false;
- var noTargetGet = options ? !!options.noTargetGet : false;
- var state;
- if (typeof value == 'function') {
- if (typeof key == 'string' && !has(value, 'name')) {
- createNonEnumerableProperty(value, 'name', key);
- }
- state = enforceInternalState(value);
- if (!state.source) {
- state.source = TEMPLATE.join(typeof key == 'string' ? key : '');
- }
- }
- if (O === global) {
- if (simple) O[key] = value;
- else setGlobal(key, value);
- return;
- } else if (!unsafe) {
- delete O[key];
- } else if (!noTargetGet && O[key]) {
- simple = true;
- }
- if (simple) O[key] = value;
- else createNonEnumerableProperty(O, key, value);
- // add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative
- })(Function.prototype, 'toString', function toString() {
- return typeof this == 'function' && getInternalState(this).source || inspectSource(this);
- });
- },{"../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){
- var classof = require('./classof-raw');
- var regexpExec = require('./regexp-exec');
- // `RegExpExec` abstract operation
- // https://tc39.es/ecma262/#sec-regexpexec
- module.exports = function (R, S) {
- var exec = R.exec;
- if (typeof exec === 'function') {
- var result = exec.call(R, S);
- if (typeof result !== 'object') {
- throw TypeError('RegExp exec method returned something other than an Object or null');
- }
- return result;
- }
- if (classof(R) !== 'RegExp') {
- throw TypeError('RegExp#exec called on incompatible receiver');
- }
- return regexpExec.call(R, S);
- };
- },{"./classof-raw":114,"./regexp-exec":199}],199:[function(require,module,exports){
- 'use strict';
- /* eslint-disable regexp/no-empty-capturing-group, regexp/no-empty-group, regexp/no-lazy-ends -- testing */
- /* eslint-disable regexp/no-useless-quantifier -- testing */
- var toString = require('../internals/to-string');
- var regexpFlags = require('../internals/regexp-flags');
- var stickyHelpers = require('../internals/regexp-sticky-helpers');
- var shared = require('../internals/shared');
- var create = require('../internals/object-create');
- var getInternalState = require('../internals/internal-state').get;
- var UNSUPPORTED_DOT_ALL = require('../internals/regexp-unsupported-dot-all');
- var UNSUPPORTED_NCG = require('../internals/regexp-unsupported-ncg');
- var nativeExec = RegExp.prototype.exec;
- var nativeReplace = shared('native-string-replace', String.prototype.replace);
- var patchedExec = nativeExec;
- var UPDATES_LAST_INDEX_WRONG = (function () {
- var re1 = /a/;
- var re2 = /b*/g;
- nativeExec.call(re1, 'a');
- nativeExec.call(re2, 'a');
- return re1.lastIndex !== 0 || re2.lastIndex !== 0;
- })();
- var UNSUPPORTED_Y = stickyHelpers.UNSUPPORTED_Y || stickyHelpers.BROKEN_CARET;
- // nonparticipating capturing group, copied from es5-shim's String#split patch.
- var NPCG_INCLUDED = /()??/.exec('')[1] !== undefined;
- var PATCH = UPDATES_LAST_INDEX_WRONG || NPCG_INCLUDED || UNSUPPORTED_Y || UNSUPPORTED_DOT_ALL || UNSUPPORTED_NCG;
- if (PATCH) {
- // eslint-disable-next-line max-statements -- TODO
- patchedExec = function exec(string) {
- var re = this;
- var state = getInternalState(re);
- var str = toString(string);
- var raw = state.raw;
- var result, reCopy, lastIndex, match, i, object, group;
- if (raw) {
- raw.lastIndex = re.lastIndex;
- result = patchedExec.call(raw, str);
- re.lastIndex = raw.lastIndex;
- return result;
- }
- var groups = state.groups;
- var sticky = UNSUPPORTED_Y && re.sticky;
- var flags = regexpFlags.call(re);
- var source = re.source;
- var charsAdded = 0;
- var strCopy = str;
- if (sticky) {
- flags = flags.replace('y', '');
- if (flags.indexOf('g') === -1) {
- flags += 'g';
- }
- strCopy = str.slice(re.lastIndex);
- // Support anchored sticky behavior.
- if (re.lastIndex > 0 && (!re.multiline || re.multiline && str.charAt(re.lastIndex - 1) !== '\n')) {
- source = '(?: ' + source + ')';
- strCopy = ' ' + strCopy;
- charsAdded++;
- }
- // ^(? + rx + ) is needed, in combination with some str slicing, to
- // simulate the 'y' flag.
- reCopy = new RegExp('^(?:' + source + ')', flags);
- }
- if (NPCG_INCLUDED) {
- reCopy = new RegExp('^' + source + '$(?!\\s)', flags);
- }
- if (UPDATES_LAST_INDEX_WRONG) lastIndex = re.lastIndex;
- match = nativeExec.call(sticky ? reCopy : re, strCopy);
- if (sticky) {
- if (match) {
- match.input = match.input.slice(charsAdded);
- match[0] = match[0].slice(charsAdded);
- match.index = re.lastIndex;
- re.lastIndex += match[0].length;
- } else re.lastIndex = 0;
- } else if (UPDATES_LAST_INDEX_WRONG && match) {
- re.lastIndex = re.global ? match.index + match[0].length : lastIndex;
- }
- if (NPCG_INCLUDED && match && match.length > 1) {
- // Fix browsers whose `exec` methods don't consistently return `undefined`
- // for NPCG, like IE8. NOTE: This doesn' work for /(.?)?/
- nativeReplace.call(match[0], reCopy, function () {
- for (i = 1; i < arguments.length - 2; i++) {
- if (arguments[i] === undefined) match[i] = undefined;
- }
- });
- }
- if (match && groups) {
- match.groups = object = create(null);
- for (i = 0; i < groups.length; i++) {
- group = groups[i];
- object[group[0]] = match[group[1]];
- }
- }
- return match;
- };
- }
- module.exports = patchedExec;
- },{"../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){
- 'use strict';
- var anObject = require('../internals/an-object');
- // `RegExp.prototype.flags` getter implementation
- // https://tc39.es/ecma262/#sec-get-regexp.prototype.flags
- module.exports = function () {
- var that = anObject(this);
- var result = '';
- if (that.global) result += 'g';
- if (that.ignoreCase) result += 'i';
- if (that.multiline) result += 'm';
- if (that.dotAll) result += 's';
- if (that.unicode) result += 'u';
- if (that.sticky) result += 'y';
- return result;
- };
- },{"../internals/an-object":94}],201:[function(require,module,exports){
- var fails = require('../internals/fails');
- var global = require('../internals/global');
- // babel-minify and Closure Compiler transpiles RegExp('a', 'y') -> /a/y and it causes SyntaxError
- var $RegExp = global.RegExp;
- exports.UNSUPPORTED_Y = fails(function () {
- var re = $RegExp('a', 'y');
- re.lastIndex = 2;
- return re.exec('abcd') != null;
- });
- exports.BROKEN_CARET = fails(function () {
- // https://bugzilla.mozilla.org/show_bug.cgi?id=773687
- var re = $RegExp('^r', 'gy');
- re.lastIndex = 2;
- return re.exec('str') != null;
- });
- },{"../internals/fails":140,"../internals/global":147}],202:[function(require,module,exports){
- var fails = require('./fails');
- var global = require('../internals/global');
- // babel-minify and Closure Compiler transpiles RegExp('.', 's') -> /./s and it causes SyntaxError
- var $RegExp = global.RegExp;
- module.exports = fails(function () {
- var re = $RegExp('.', 's');
- return !(re.dotAll && re.exec('\n') && re.flags === 's');
- });
- },{"../internals/global":147,"./fails":140}],203:[function(require,module,exports){
- var fails = require('./fails');
- var global = require('../internals/global');
- // babel-minify and Closure Compiler transpiles RegExp('(?<a>b)', 'g') -> /(?<a>b)/g and it causes SyntaxError
- var $RegExp = global.RegExp;
- module.exports = fails(function () {
- var re = $RegExp('(?<a>b)', 'g');
- return re.exec('b').groups.a !== 'b' ||
- 'b'.replace(re, '$<a>c') !== 'bc';
- });
- },{"../internals/global":147,"./fails":140}],204:[function(require,module,exports){
- // `RequireObjectCoercible` abstract operation
- // https://tc39.es/ecma262/#sec-requireobjectcoercible
- module.exports = function (it) {
- if (it == undefined) throw TypeError("Can't call method on " + it);
- return it;
- };
- },{}],205:[function(require,module,exports){
- // `SameValue` abstract operation
- // https://tc39.es/ecma262/#sec-samevalue
- // eslint-disable-next-line es/no-object-is -- safe
- module.exports = Object.is || function is(x, y) {
- // eslint-disable-next-line no-self-compare -- NaN check
- return x === y ? x !== 0 || 1 / x === 1 / y : x != x && y != y;
- };
- },{}],206:[function(require,module,exports){
- var global = require('../internals/global');
- module.exports = function (key, value) {
- try {
- // eslint-disable-next-line es/no-object-defineproperty -- safe
- Object.defineProperty(global, key, { value: value, configurable: true, writable: true });
- } catch (error) {
- global[key] = value;
- } return value;
- };
- },{"../internals/global":147}],207:[function(require,module,exports){
- 'use strict';
- var getBuiltIn = require('../internals/get-built-in');
- var definePropertyModule = require('../internals/object-define-property');
- var wellKnownSymbol = require('../internals/well-known-symbol');
- var DESCRIPTORS = require('../internals/descriptors');
- var SPECIES = wellKnownSymbol('species');
- module.exports = function (CONSTRUCTOR_NAME) {
- var Constructor = getBuiltIn(CONSTRUCTOR_NAME);
- var defineProperty = definePropertyModule.f;
- if (DESCRIPTORS && Constructor && !Constructor[SPECIES]) {
- defineProperty(Constructor, SPECIES, {
- configurable: true,
- get: function () { return this; }
- });
- }
- };
- },{"../internals/descriptors":125,"../internals/get-built-in":143,"../internals/object-define-property":179,"../internals/well-known-symbol":237}],208:[function(require,module,exports){
- var defineProperty = require('../internals/object-define-property').f;
- var has = require('../internals/has');
- var wellKnownSymbol = require('../internals/well-known-symbol');
- var TO_STRING_TAG = wellKnownSymbol('toStringTag');
- module.exports = function (it, TAG, STATIC) {
- if (it && !has(it = STATIC ? it : it.prototype, TO_STRING_TAG)) {
- defineProperty(it, TO_STRING_TAG, { configurable: true, value: TAG });
- }
- };
- },{"../internals/has":148,"../internals/object-define-property":179,"../internals/well-known-symbol":237}],209:[function(require,module,exports){
- var shared = require('../internals/shared');
- var uid = require('../internals/uid');
- var keys = shared('keys');
- module.exports = function (key) {
- return keys[key] || (keys[key] = uid(key));
- };
- },{"../internals/shared":211,"../internals/uid":234}],210:[function(require,module,exports){
- var global = require('../internals/global');
- var setGlobal = require('../internals/set-global');
- var SHARED = '__core-js_shared__';
- var store = global[SHARED] || setGlobal(SHARED, {});
- module.exports = store;
- },{"../internals/global":147,"../internals/set-global":206}],211:[function(require,module,exports){
- var IS_PURE = require('../internals/is-pure');
- var store = require('../internals/shared-store');
- (module.exports = function (key, value) {
- return store[key] || (store[key] = value !== undefined ? value : {});
- })('versions', []).push({
- version: '3.17.2',
- mode: IS_PURE ? 'pure' : 'global',
- copyright: '© 2021 Denis Pushkarev (zloirock.ru)'
- });
- },{"../internals/is-pure":163,"../internals/shared-store":210}],212:[function(require,module,exports){
- var anObject = require('../internals/an-object');
- var aFunction = require('../internals/a-function');
- var wellKnownSymbol = require('../internals/well-known-symbol');
- var SPECIES = wellKnownSymbol('species');
- // `SpeciesConstructor` abstract operation
- // https://tc39.es/ecma262/#sec-speciesconstructor
- module.exports = function (O, defaultConstructor) {
- var C = anObject(O).constructor;
- var S;
- return C === undefined || (S = anObject(C)[SPECIES]) == undefined ? defaultConstructor : aFunction(S);
- };
- },{"../internals/a-function":89,"../internals/an-object":94,"../internals/well-known-symbol":237}],213:[function(require,module,exports){
- var toInteger = require('../internals/to-integer');
- var toString = require('../internals/to-string');
- var requireObjectCoercible = require('../internals/require-object-coercible');
- // `String.prototype.codePointAt` methods implementation
- var createMethod = function (CONVERT_TO_STRING) {
- return function ($this, pos) {
- var S = toString(requireObjectCoercible($this));
- var position = toInteger(pos);
- var size = S.length;
- var first, second;
- if (position < 0 || position >= size) return CONVERT_TO_STRING ? '' : undefined;
- first = S.charCodeAt(position);
- return first < 0xD800 || first > 0xDBFF || position + 1 === size
- || (second = S.charCodeAt(position + 1)) < 0xDC00 || second > 0xDFFF
- ? CONVERT_TO_STRING ? S.charAt(position) : first
- : CONVERT_TO_STRING ? S.slice(position, position + 2) : (first - 0xD800 << 10) + (second - 0xDC00) + 0x10000;
- };
- };
- module.exports = {
- // `String.prototype.codePointAt` method
- // https://tc39.es/ecma262/#sec-string.prototype.codepointat
- codeAt: createMethod(false),
- // `String.prototype.at` method
- // https://github.com/mathiasbynens/String.prototype.at
- charAt: createMethod(true)
- };
- },{"../internals/require-object-coercible":204,"../internals/to-integer":220,"../internals/to-string":228}],214:[function(require,module,exports){
- var fails = require('../internals/fails');
- var whitespaces = require('../internals/whitespaces');
- var non = '\u200B\u0085\u180E';
- // check that a method works with the correct list
- // of whitespaces and has a correct name
- module.exports = function (METHOD_NAME) {
- return fails(function () {
- return !!whitespaces[METHOD_NAME]() || non[METHOD_NAME]() != non || whitespaces[METHOD_NAME].name !== METHOD_NAME;
- });
- };
- },{"../internals/fails":140,"../internals/whitespaces":238}],215:[function(require,module,exports){
- var requireObjectCoercible = require('../internals/require-object-coercible');
- var toString = require('../internals/to-string');
- var whitespaces = require('../internals/whitespaces');
- var whitespace = '[' + whitespaces + ']';
- var ltrim = RegExp('^' + whitespace + whitespace + '*');
- var rtrim = RegExp(whitespace + whitespace + '*$');
- // `String.prototype.{ trim, trimStart, trimEnd, trimLeft, trimRight }` methods implementation
- var createMethod = function (TYPE) {
- return function ($this) {
- var string = toString(requireObjectCoercible($this));
- if (TYPE & 1) string = string.replace(ltrim, '');
- if (TYPE & 2) string = string.replace(rtrim, '');
- return string;
- };
- };
- module.exports = {
- // `String.prototype.{ trimLeft, trimStart }` methods
- // https://tc39.es/ecma262/#sec-string.prototype.trimstart
- start: createMethod(1),
- // `String.prototype.{ trimRight, trimEnd }` methods
- // https://tc39.es/ecma262/#sec-string.prototype.trimend
- end: createMethod(2),
- // `String.prototype.trim` method
- // https://tc39.es/ecma262/#sec-string.prototype.trim
- trim: createMethod(3)
- };
- },{"../internals/require-object-coercible":204,"../internals/to-string":228,"../internals/whitespaces":238}],216:[function(require,module,exports){
- var global = require('../internals/global');
- var fails = require('../internals/fails');
- var bind = require('../internals/function-bind-context');
- var html = require('../internals/html');
- var createElement = require('../internals/document-create-element');
- var IS_IOS = require('../internals/engine-is-ios');
- var IS_NODE = require('../internals/engine-is-node');
- var set = global.setImmediate;
- var clear = global.clearImmediate;
- var process = global.process;
- var MessageChannel = global.MessageChannel;
- var Dispatch = global.Dispatch;
- var counter = 0;
- var queue = {};
- var ONREADYSTATECHANGE = 'onreadystatechange';
- var location, defer, channel, port;
- try {
- // Deno throws a ReferenceError on `location` access without `--location` flag
- location = global.location;
- } catch (error) { /* empty */ }
- var run = function (id) {
- // eslint-disable-next-line no-prototype-builtins -- safe
- if (queue.hasOwnProperty(id)) {
- var fn = queue[id];
- delete queue[id];
- fn();
- }
- };
- var runner = function (id) {
- return function () {
- run(id);
- };
- };
- var listener = function (event) {
- run(event.data);
- };
- var post = function (id) {
- // old engines have not location.origin
- global.postMessage(String(id), location.protocol + '//' + location.host);
- };
- // Node.js 0.9+ & IE10+ has setImmediate, otherwise:
- if (!set || !clear) {
- set = function setImmediate(fn) {
- var args = [];
- var argumentsLength = arguments.length;
- var i = 1;
- while (argumentsLength > i) args.push(arguments[i++]);
- queue[++counter] = function () {
- // eslint-disable-next-line no-new-func -- spec requirement
- (typeof fn == 'function' ? fn : Function(fn)).apply(undefined, args);
- };
- defer(counter);
- return counter;
- };
- clear = function clearImmediate(id) {
- delete queue[id];
- };
- // Node.js 0.8-
- if (IS_NODE) {
- defer = function (id) {
- process.nextTick(runner(id));
- };
- // Sphere (JS game engine) Dispatch API
- } else if (Dispatch && Dispatch.now) {
- defer = function (id) {
- Dispatch.now(runner(id));
- };
- // Browsers with MessageChannel, includes WebWorkers
- // except iOS - https://github.com/zloirock/core-js/issues/624
- } else if (MessageChannel && !IS_IOS) {
- channel = new MessageChannel();
- port = channel.port2;
- channel.port1.onmessage = listener;
- defer = bind(port.postMessage, port, 1);
- // Browsers with postMessage, skip WebWorkers
- // IE8 has postMessage, but it's sync & typeof its postMessage is 'object'
- } else if (
- global.addEventListener &&
- typeof postMessage == 'function' &&
- !global.importScripts &&
- location && location.protocol !== 'file:' &&
- !fails(post)
- ) {
- defer = post;
- global.addEventListener('message', listener, false);
- // IE8-
- } else if (ONREADYSTATECHANGE in createElement('script')) {
- defer = function (id) {
- html.appendChild(createElement('script'))[ONREADYSTATECHANGE] = function () {
- html.removeChild(this);
- run(id);
- };
- };
- // Rest old browsers
- } else {
- defer = function (id) {
- setTimeout(runner(id), 0);
- };
- }
- }
- module.exports = {
- set: set,
- clear: clear
- };
- },{"../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){
- var toInteger = require('../internals/to-integer');
- var max = Math.max;
- var min = Math.min;
- // Helper for a popular repeating case of the spec:
- // Let integer be ? ToInteger(index).
- // If integer < 0, let result be max((length + integer), 0); else let result be min(integer, length).
- module.exports = function (index, length) {
- var integer = toInteger(index);
- return integer < 0 ? max(integer + length, 0) : min(integer, length);
- };
- },{"../internals/to-integer":220}],218:[function(require,module,exports){
- var toInteger = require('../internals/to-integer');
- var toLength = require('../internals/to-length');
- // `ToIndex` abstract operation
- // https://tc39.es/ecma262/#sec-toindex
- module.exports = function (it) {
- if (it === undefined) return 0;
- var number = toInteger(it);
- var length = toLength(number);
- if (number !== length) throw RangeError('Wrong length or index');
- return length;
- };
- },{"../internals/to-integer":220,"../internals/to-length":221}],219:[function(require,module,exports){
- // toObject with fallback for non-array-like ES3 strings
- var IndexedObject = require('../internals/indexed-object');
- var requireObjectCoercible = require('../internals/require-object-coercible');
- module.exports = function (it) {
- return IndexedObject(requireObjectCoercible(it));
- };
- },{"../internals/indexed-object":154,"../internals/require-object-coercible":204}],220:[function(require,module,exports){
- var ceil = Math.ceil;
- var floor = Math.floor;
- // `ToInteger` abstract operation
- // https://tc39.es/ecma262/#sec-tointeger
- module.exports = function (argument) {
- return isNaN(argument = +argument) ? 0 : (argument > 0 ? floor : ceil)(argument);
- };
- },{}],221:[function(require,module,exports){
- var toInteger = require('../internals/to-integer');
- var min = Math.min;
- // `ToLength` abstract operation
- // https://tc39.es/ecma262/#sec-tolength
- module.exports = function (argument) {
- return argument > 0 ? min(toInteger(argument), 0x1FFFFFFFFFFFFF) : 0; // 2 ** 53 - 1 == 9007199254740991
- };
- },{"../internals/to-integer":220}],222:[function(require,module,exports){
- var requireObjectCoercible = require('../internals/require-object-coercible');
- // `ToObject` abstract operation
- // https://tc39.es/ecma262/#sec-toobject
- module.exports = function (argument) {
- return Object(requireObjectCoercible(argument));
- };
- },{"../internals/require-object-coercible":204}],223:[function(require,module,exports){
- var toPositiveInteger = require('../internals/to-positive-integer');
- module.exports = function (it, BYTES) {
- var offset = toPositiveInteger(it);
- if (offset % BYTES) throw RangeError('Wrong offset');
- return offset;
- };
- },{"../internals/to-positive-integer":224}],224:[function(require,module,exports){
- var toInteger = require('../internals/to-integer');
- module.exports = function (it) {
- var result = toInteger(it);
- if (result < 0) throw RangeError("The argument can't be less than 0");
- return result;
- };
- },{"../internals/to-integer":220}],225:[function(require,module,exports){
- var isObject = require('../internals/is-object');
- var isSymbol = require('../internals/is-symbol');
- var ordinaryToPrimitive = require('../internals/ordinary-to-primitive');
- var wellKnownSymbol = require('../internals/well-known-symbol');
- var TO_PRIMITIVE = wellKnownSymbol('toPrimitive');
- // `ToPrimitive` abstract operation
- // https://tc39.es/ecma262/#sec-toprimitive
- module.exports = function (input, pref) {
- if (!isObject(input) || isSymbol(input)) return input;
- var exoticToPrim = input[TO_PRIMITIVE];
- var result;
- if (exoticToPrim !== undefined) {
- if (pref === undefined) pref = 'default';
- result = exoticToPrim.call(input, pref);
- if (!isObject(result) || isSymbol(result)) return result;
- throw TypeError("Can't convert object to primitive value");
- }
- if (pref === undefined) pref = 'number';
- return ordinaryToPrimitive(input, pref);
- };
- },{"../internals/is-object":162,"../internals/is-symbol":165,"../internals/ordinary-to-primitive":191,"../internals/well-known-symbol":237}],226:[function(require,module,exports){
- var toPrimitive = require('../internals/to-primitive');
- var isSymbol = require('../internals/is-symbol');
- // `ToPropertyKey` abstract operation
- // https://tc39.es/ecma262/#sec-topropertykey
- module.exports = function (argument) {
- var key = toPrimitive(argument, 'string');
- return isSymbol(key) ? key : String(key);
- };
- },{"../internals/is-symbol":165,"../internals/to-primitive":225}],227:[function(require,module,exports){
- var wellKnownSymbol = require('../internals/well-known-symbol');
- var TO_STRING_TAG = wellKnownSymbol('toStringTag');
- var test = {};
- test[TO_STRING_TAG] = 'z';
- module.exports = String(test) === '[object z]';
- },{"../internals/well-known-symbol":237}],228:[function(require,module,exports){
- var isSymbol = require('../internals/is-symbol');
- module.exports = function (argument) {
- if (isSymbol(argument)) throw TypeError('Cannot convert a Symbol value to a string');
- return String(argument);
- };
- },{"../internals/is-symbol":165}],229:[function(require,module,exports){
- 'use strict';
- var $ = require('../internals/export');
- var global = require('../internals/global');
- var DESCRIPTORS = require('../internals/descriptors');
- var TYPED_ARRAYS_CONSTRUCTORS_REQUIRES_WRAPPERS = require('../internals/typed-array-constructors-require-wrappers');
- var ArrayBufferViewCore = require('../internals/array-buffer-view-core');
- var ArrayBufferModule = require('../internals/array-buffer');
- var anInstance = require('../internals/an-instance');
- var createPropertyDescriptor = require('../internals/create-property-descriptor');
- var createNonEnumerableProperty = require('../internals/create-non-enumerable-property');
- var isInteger = require('../internals/is-integer');
- var toLength = require('../internals/to-length');
- var toIndex = require('../internals/to-index');
- var toOffset = require('../internals/to-offset');
- var toPropertyKey = require('../internals/to-property-key');
- var has = require('../internals/has');
- var classof = require('../internals/classof');
- var isObject = require('../internals/is-object');
- var isSymbol = require('../internals/is-symbol');
- var create = require('../internals/object-create');
- var setPrototypeOf = require('../internals/object-set-prototype-of');
- var getOwnPropertyNames = require('../internals/object-get-own-property-names').f;
- var typedArrayFrom = require('../internals/typed-array-from');
- var forEach = require('../internals/array-iteration').forEach;
- var setSpecies = require('../internals/set-species');
- var definePropertyModule = require('../internals/object-define-property');
- var getOwnPropertyDescriptorModule = require('../internals/object-get-own-property-descriptor');
- var InternalStateModule = require('../internals/internal-state');
- var inheritIfRequired = require('../internals/inherit-if-required');
- var getInternalState = InternalStateModule.get;
- var setInternalState = InternalStateModule.set;
- var nativeDefineProperty = definePropertyModule.f;
- var nativeGetOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f;
- var round = Math.round;
- var RangeError = global.RangeError;
- var ArrayBuffer = ArrayBufferModule.ArrayBuffer;
- var DataView = ArrayBufferModule.DataView;
- var NATIVE_ARRAY_BUFFER_VIEWS = ArrayBufferViewCore.NATIVE_ARRAY_BUFFER_VIEWS;
- var TYPED_ARRAY_CONSTRUCTOR = ArrayBufferViewCore.TYPED_ARRAY_CONSTRUCTOR;
- var TYPED_ARRAY_TAG = ArrayBufferViewCore.TYPED_ARRAY_TAG;
- var TypedArray = ArrayBufferViewCore.TypedArray;
- var TypedArrayPrototype = ArrayBufferViewCore.TypedArrayPrototype;
- var aTypedArrayConstructor = ArrayBufferViewCore.aTypedArrayConstructor;
- var isTypedArray = ArrayBufferViewCore.isTypedArray;
- var BYTES_PER_ELEMENT = 'BYTES_PER_ELEMENT';
- var WRONG_LENGTH = 'Wrong length';
- var fromList = function (C, list) {
- var index = 0;
- var length = list.length;
- var result = new (aTypedArrayConstructor(C))(length);
- while (length > index) result[index] = list[index++];
- return result;
- };
- var addGetter = function (it, key) {
- nativeDefineProperty(it, key, { get: function () {
- return getInternalState(this)[key];
- } });
- };
- var isArrayBuffer = function (it) {
- var klass;
- return it instanceof ArrayBuffer || (klass = classof(it)) == 'ArrayBuffer' || klass == 'SharedArrayBuffer';
- };
- var isTypedArrayIndex = function (target, key) {
- return isTypedArray(target)
- && !isSymbol(key)
- && key in target
- && isInteger(+key)
- && key >= 0;
- };
- var wrappedGetOwnPropertyDescriptor = function getOwnPropertyDescriptor(target, key) {
- key = toPropertyKey(key);
- return isTypedArrayIndex(target, key)
- ? createPropertyDescriptor(2, target[key])
- : nativeGetOwnPropertyDescriptor(target, key);
- };
- var wrappedDefineProperty = function defineProperty(target, key, descriptor) {
- key = toPropertyKey(key);
- if (isTypedArrayIndex(target, key)
- && isObject(descriptor)
- && has(descriptor, 'value')
- && !has(descriptor, 'get')
- && !has(descriptor, 'set')
- // TODO: add validation descriptor w/o calling accessors
- && !descriptor.configurable
- && (!has(descriptor, 'writable') || descriptor.writable)
- && (!has(descriptor, 'enumerable') || descriptor.enumerable)
- ) {
- target[key] = descriptor.value;
- return target;
- } return nativeDefineProperty(target, key, descriptor);
- };
- if (DESCRIPTORS) {
- if (!NATIVE_ARRAY_BUFFER_VIEWS) {
- getOwnPropertyDescriptorModule.f = wrappedGetOwnPropertyDescriptor;
- definePropertyModule.f = wrappedDefineProperty;
- addGetter(TypedArrayPrototype, 'buffer');
- addGetter(TypedArrayPrototype, 'byteOffset');
- addGetter(TypedArrayPrototype, 'byteLength');
- addGetter(TypedArrayPrototype, 'length');
- }
- $({ target: 'Object', stat: true, forced: !NATIVE_ARRAY_BUFFER_VIEWS }, {
- getOwnPropertyDescriptor: wrappedGetOwnPropertyDescriptor,
- defineProperty: wrappedDefineProperty
- });
- module.exports = function (TYPE, wrapper, CLAMPED) {
- var BYTES = TYPE.match(/\d+$/)[0] / 8;
- var CONSTRUCTOR_NAME = TYPE + (CLAMPED ? 'Clamped' : '') + 'Array';
- var GETTER = 'get' + TYPE;
- var SETTER = 'set' + TYPE;
- var NativeTypedArrayConstructor = global[CONSTRUCTOR_NAME];
- var TypedArrayConstructor = NativeTypedArrayConstructor;
- var TypedArrayConstructorPrototype = TypedArrayConstructor && TypedArrayConstructor.prototype;
- var exported = {};
- var getter = function (that, index) {
- var data = getInternalState(that);
- return data.view[GETTER](index * BYTES + data.byteOffset, true);
- };
- var setter = function (that, index, value) {
- var data = getInternalState(that);
- if (CLAMPED) value = (value = round(value)) < 0 ? 0 : value > 0xFF ? 0xFF : value & 0xFF;
- data.view[SETTER](index * BYTES + data.byteOffset, value, true);
- };
- var addElement = function (that, index) {
- nativeDefineProperty(that, index, {
- get: function () {
- return getter(this, index);
- },
- set: function (value) {
- return setter(this, index, value);
- },
- enumerable: true
- });
- };
- if (!NATIVE_ARRAY_BUFFER_VIEWS) {
- TypedArrayConstructor = wrapper(function (that, data, offset, $length) {
- anInstance(that, TypedArrayConstructor, CONSTRUCTOR_NAME);
- var index = 0;
- var byteOffset = 0;
- var buffer, byteLength, length;
- if (!isObject(data)) {
- length = toIndex(data);
- byteLength = length * BYTES;
- buffer = new ArrayBuffer(byteLength);
- } else if (isArrayBuffer(data)) {
- buffer = data;
- byteOffset = toOffset(offset, BYTES);
- var $len = data.byteLength;
- if ($length === undefined) {
- if ($len % BYTES) throw RangeError(WRONG_LENGTH);
- byteLength = $len - byteOffset;
- if (byteLength < 0) throw RangeError(WRONG_LENGTH);
- } else {
- byteLength = toLength($length) * BYTES;
- if (byteLength + byteOffset > $len) throw RangeError(WRONG_LENGTH);
- }
- length = byteLength / BYTES;
- } else if (isTypedArray(data)) {
- return fromList(TypedArrayConstructor, data);
- } else {
- return typedArrayFrom.call(TypedArrayConstructor, data);
- }
- setInternalState(that, {
- buffer: buffer,
- byteOffset: byteOffset,
- byteLength: byteLength,
- length: length,
- view: new DataView(buffer)
- });
- while (index < length) addElement(that, index++);
- });
- if (setPrototypeOf) setPrototypeOf(TypedArrayConstructor, TypedArray);
- TypedArrayConstructorPrototype = TypedArrayConstructor.prototype = create(TypedArrayPrototype);
- } else if (TYPED_ARRAYS_CONSTRUCTORS_REQUIRES_WRAPPERS) {
- TypedArrayConstructor = wrapper(function (dummy, data, typedArrayOffset, $length) {
- anInstance(dummy, TypedArrayConstructor, CONSTRUCTOR_NAME);
- return inheritIfRequired(function () {
- if (!isObject(data)) return new NativeTypedArrayConstructor(toIndex(data));
- if (isArrayBuffer(data)) return $length !== undefined
- ? new NativeTypedArrayConstructor(data, toOffset(typedArrayOffset, BYTES), $length)
- : typedArrayOffset !== undefined
- ? new NativeTypedArrayConstructor(data, toOffset(typedArrayOffset, BYTES))
- : new NativeTypedArrayConstructor(data);
- if (isTypedArray(data)) return fromList(TypedArrayConstructor, data);
- return typedArrayFrom.call(TypedArrayConstructor, data);
- }(), dummy, TypedArrayConstructor);
- });
- if (setPrototypeOf) setPrototypeOf(TypedArrayConstructor, TypedArray);
- forEach(getOwnPropertyNames(NativeTypedArrayConstructor), function (key) {
- if (!(key in TypedArrayConstructor)) {
- createNonEnumerableProperty(TypedArrayConstructor, key, NativeTypedArrayConstructor[key]);
- }
- });
- TypedArrayConstructor.prototype = TypedArrayConstructorPrototype;
- }
- if (TypedArrayConstructorPrototype.constructor !== TypedArrayConstructor) {
- createNonEnumerableProperty(TypedArrayConstructorPrototype, 'constructor', TypedArrayConstructor);
- }
- createNonEnumerableProperty(TypedArrayConstructorPrototype, TYPED_ARRAY_CONSTRUCTOR, TypedArrayConstructor);
- if (TYPED_ARRAY_TAG) {
- createNonEnumerableProperty(TypedArrayConstructorPrototype, TYPED_ARRAY_TAG, CONSTRUCTOR_NAME);
- }
- exported[CONSTRUCTOR_NAME] = TypedArrayConstructor;
- $({
- global: true, forced: TypedArrayConstructor != NativeTypedArrayConstructor, sham: !NATIVE_ARRAY_BUFFER_VIEWS
- }, exported);
- if (!(BYTES_PER_ELEMENT in TypedArrayConstructor)) {
- createNonEnumerableProperty(TypedArrayConstructor, BYTES_PER_ELEMENT, BYTES);
- }
- if (!(BYTES_PER_ELEMENT in TypedArrayConstructorPrototype)) {
- createNonEnumerableProperty(TypedArrayConstructorPrototype, BYTES_PER_ELEMENT, BYTES);
- }
- setSpecies(CONSTRUCTOR_NAME);
- };
- } else module.exports = function () { /* empty */ };
- },{"../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){
- /* eslint-disable no-new -- required for testing */
- var global = require('../internals/global');
- var fails = require('../internals/fails');
- var checkCorrectnessOfIteration = require('../internals/check-correctness-of-iteration');
- var NATIVE_ARRAY_BUFFER_VIEWS = require('../internals/array-buffer-view-core').NATIVE_ARRAY_BUFFER_VIEWS;
- var ArrayBuffer = global.ArrayBuffer;
- var Int8Array = global.Int8Array;
- module.exports = !NATIVE_ARRAY_BUFFER_VIEWS || !fails(function () {
- Int8Array(1);
- }) || !fails(function () {
- new Int8Array(-1);
- }) || !checkCorrectnessOfIteration(function (iterable) {
- new Int8Array();
- new Int8Array(null);
- new Int8Array(1.5);
- new Int8Array(iterable);
- }, true) || fails(function () {
- // Safari (11+) bug - a reason why even Safari 13 should load a typed array polyfill
- return new Int8Array(new ArrayBuffer(2), 1, undefined).length !== 1;
- });
- },{"../internals/array-buffer-view-core":96,"../internals/check-correctness-of-iteration":113,"../internals/fails":140,"../internals/global":147}],231:[function(require,module,exports){
- var arrayFromConstructorAndList = require('../internals/array-from-constructor-and-list');
- var typedArraySpeciesConstructor = require('../internals/typed-array-species-constructor');
- module.exports = function (instance, list) {
- return arrayFromConstructorAndList(typedArraySpeciesConstructor(instance), list);
- };
- },{"../internals/array-from-constructor-and-list":101,"../internals/typed-array-species-constructor":233}],232:[function(require,module,exports){
- var toObject = require('../internals/to-object');
- var toLength = require('../internals/to-length');
- var getIterator = require('../internals/get-iterator');
- var getIteratorMethod = require('../internals/get-iterator-method');
- var isArrayIteratorMethod = require('../internals/is-array-iterator-method');
- var bind = require('../internals/function-bind-context');
- var aTypedArrayConstructor = require('../internals/array-buffer-view-core').aTypedArrayConstructor;
- module.exports = function from(source /* , mapfn, thisArg */) {
- var O = toObject(source);
- var argumentsLength = arguments.length;
- var mapfn = argumentsLength > 1 ? arguments[1] : undefined;
- var mapping = mapfn !== undefined;
- var iteratorMethod = getIteratorMethod(O);
- var i, length, result, step, iterator, next;
- if (iteratorMethod != undefined && !isArrayIteratorMethod(iteratorMethod)) {
- iterator = getIterator(O, iteratorMethod);
- next = iterator.next;
- O = [];
- while (!(step = next.call(iterator)).done) {
- O.push(step.value);
- }
- }
- if (mapping && argumentsLength > 2) {
- mapfn = bind(mapfn, arguments[2], 2);
- }
- length = toLength(O.length);
- result = new (aTypedArrayConstructor(this))(length);
- for (i = 0; length > i; i++) {
- result[i] = mapping ? mapfn(O[i], i) : O[i];
- }
- return result;
- };
- },{"../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){
- var ArrayBufferViewCore = require('../internals/array-buffer-view-core');
- var speciesConstructor = require('../internals/species-constructor');
- var TYPED_ARRAY_CONSTRUCTOR = ArrayBufferViewCore.TYPED_ARRAY_CONSTRUCTOR;
- var aTypedArrayConstructor = ArrayBufferViewCore.aTypedArrayConstructor;
- // a part of `TypedArraySpeciesCreate` abstract operation
- // https://tc39.es/ecma262/#typedarray-species-create
- module.exports = function (originalArray) {
- return aTypedArrayConstructor(speciesConstructor(originalArray, originalArray[TYPED_ARRAY_CONSTRUCTOR]));
- };
- },{"../internals/array-buffer-view-core":96,"../internals/species-constructor":212}],234:[function(require,module,exports){
- var id = 0;
- var postfix = Math.random();
- module.exports = function (key) {
- return 'Symbol(' + String(key === undefined ? '' : key) + ')_' + (++id + postfix).toString(36);
- };
- },{}],235:[function(require,module,exports){
- /* eslint-disable es/no-symbol -- required for testing */
- var NATIVE_SYMBOL = require('../internals/native-symbol');
- module.exports = NATIVE_SYMBOL
- && !Symbol.sham
- && typeof Symbol.iterator == 'symbol';
- },{"../internals/native-symbol":172}],236:[function(require,module,exports){
- var wellKnownSymbol = require('../internals/well-known-symbol');
- exports.f = wellKnownSymbol;
- },{"../internals/well-known-symbol":237}],237:[function(require,module,exports){
- var global = require('../internals/global');
- var shared = require('../internals/shared');
- var has = require('../internals/has');
- var uid = require('../internals/uid');
- var NATIVE_SYMBOL = require('../internals/native-symbol');
- var USE_SYMBOL_AS_UID = require('../internals/use-symbol-as-uid');
- var WellKnownSymbolsStore = shared('wks');
- var Symbol = global.Symbol;
- var createWellKnownSymbol = USE_SYMBOL_AS_UID ? Symbol : Symbol && Symbol.withoutSetter || uid;
- module.exports = function (name) {
- if (!has(WellKnownSymbolsStore, name) || !(NATIVE_SYMBOL || typeof WellKnownSymbolsStore[name] == 'string')) {
- if (NATIVE_SYMBOL && has(Symbol, name)) {
- WellKnownSymbolsStore[name] = Symbol[name];
- } else {
- WellKnownSymbolsStore[name] = createWellKnownSymbol('Symbol.' + name);
- }
- } return WellKnownSymbolsStore[name];
- };
- },{"../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){
- // a string of all valid unicode whitespaces
- module.exports = '\u0009\u000A\u000B\u000C\u000D\u0020\u00A0\u1680\u2000\u2001\u2002' +
- '\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF';
- },{}],239:[function(require,module,exports){
- 'use strict';
- var $ = require('../internals/export');
- var global = require('../internals/global');
- var arrayBufferModule = require('../internals/array-buffer');
- var setSpecies = require('../internals/set-species');
- var ARRAY_BUFFER = 'ArrayBuffer';
- var ArrayBuffer = arrayBufferModule[ARRAY_BUFFER];
- var NativeArrayBuffer = global[ARRAY_BUFFER];
- // `ArrayBuffer` constructor
- // https://tc39.es/ecma262/#sec-arraybuffer-constructor
- $({ global: true, forced: NativeArrayBuffer !== ArrayBuffer }, {
- ArrayBuffer: ArrayBuffer
- });
- setSpecies(ARRAY_BUFFER);
- },{"../internals/array-buffer":97,"../internals/export":139,"../internals/global":147,"../internals/set-species":207}],240:[function(require,module,exports){
- 'use strict';
- var $ = require('../internals/export');
- var fails = require('../internals/fails');
- var ArrayBufferModule = require('../internals/array-buffer');
- var anObject = require('../internals/an-object');
- var toAbsoluteIndex = require('../internals/to-absolute-index');
- var toLength = require('../internals/to-length');
- var speciesConstructor = require('../internals/species-constructor');
- var ArrayBuffer = ArrayBufferModule.ArrayBuffer;
- var DataView = ArrayBufferModule.DataView;
- var nativeArrayBufferSlice = ArrayBuffer.prototype.slice;
- var INCORRECT_SLICE = fails(function () {
- return !new ArrayBuffer(2).slice(1, undefined).byteLength;
- });
- // `ArrayBuffer.prototype.slice` method
- // https://tc39.es/ecma262/#sec-arraybuffer.prototype.slice
- $({ target: 'ArrayBuffer', proto: true, unsafe: true, forced: INCORRECT_SLICE }, {
- slice: function slice(start, end) {
- if (nativeArrayBufferSlice !== undefined && end === undefined) {
- return nativeArrayBufferSlice.call(anObject(this), start); // FF fix
- }
- var length = anObject(this).byteLength;
- var first = toAbsoluteIndex(start, length);
- var fin = toAbsoluteIndex(end === undefined ? length : end, length);
- var result = new (speciesConstructor(this, ArrayBuffer))(toLength(fin - first));
- var viewSource = new DataView(this);
- var viewTarget = new DataView(result);
- var index = 0;
- while (first < fin) {
- viewTarget.setUint8(index++, viewSource.getUint8(first++));
- } return result;
- }
- });
- },{"../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){
- 'use strict';
- var $ = require('../internals/export');
- var fails = require('../internals/fails');
- var isArray = require('../internals/is-array');
- var isObject = require('../internals/is-object');
- var toObject = require('../internals/to-object');
- var toLength = require('../internals/to-length');
- var createProperty = require('../internals/create-property');
- var arraySpeciesCreate = require('../internals/array-species-create');
- var arrayMethodHasSpeciesSupport = require('../internals/array-method-has-species-support');
- var wellKnownSymbol = require('../internals/well-known-symbol');
- var V8_VERSION = require('../internals/engine-v8-version');
- var IS_CONCAT_SPREADABLE = wellKnownSymbol('isConcatSpreadable');
- var MAX_SAFE_INTEGER = 0x1FFFFFFFFFFFFF;
- var MAXIMUM_ALLOWED_INDEX_EXCEEDED = 'Maximum allowed index exceeded';
- // We can't use this feature detection in V8 since it causes
- // deoptimization and serious performance degradation
- // https://github.com/zloirock/core-js/issues/679
- var IS_CONCAT_SPREADABLE_SUPPORT = V8_VERSION >= 51 || !fails(function () {
- var array = [];
- array[IS_CONCAT_SPREADABLE] = false;
- return array.concat()[0] !== array;
- });
- var SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('concat');
- var isConcatSpreadable = function (O) {
- if (!isObject(O)) return false;
- var spreadable = O[IS_CONCAT_SPREADABLE];
- return spreadable !== undefined ? !!spreadable : isArray(O);
- };
- var FORCED = !IS_CONCAT_SPREADABLE_SUPPORT || !SPECIES_SUPPORT;
- // `Array.prototype.concat` method
- // https://tc39.es/ecma262/#sec-array.prototype.concat
- // with adding support of @@isConcatSpreadable and @@species
- $({ target: 'Array', proto: true, forced: FORCED }, {
- // eslint-disable-next-line no-unused-vars -- required for `.length`
- concat: function concat(arg) {
- var O = toObject(this);
- var A = arraySpeciesCreate(O, 0);
- var n = 0;
- var i, k, length, len, E;
- for (i = -1, length = arguments.length; i < length; i++) {
- E = i === -1 ? O : arguments[i];
- if (isConcatSpreadable(E)) {
- len = toLength(E.length);
- if (n + len > MAX_SAFE_INTEGER) throw TypeError(MAXIMUM_ALLOWED_INDEX_EXCEEDED);
- for (k = 0; k < len; k++, n++) if (k in E) createProperty(A, n, E[k]);
- } else {
- if (n >= MAX_SAFE_INTEGER) throw TypeError(MAXIMUM_ALLOWED_INDEX_EXCEEDED);
- createProperty(A, n++, E);
- }
- }
- A.length = n;
- return A;
- }
- });
- },{"../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){
- var $ = require('../internals/export');
- var fill = require('../internals/array-fill');
- var addToUnscopables = require('../internals/add-to-unscopables');
- // `Array.prototype.fill` method
- // https://tc39.es/ecma262/#sec-array.prototype.fill
- $({ target: 'Array', proto: true }, {
- fill: fill
- });
- // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
- addToUnscopables('fill');
- },{"../internals/add-to-unscopables":91,"../internals/array-fill":99,"../internals/export":139}],243:[function(require,module,exports){
- 'use strict';
- var $ = require('../internals/export');
- var $filter = require('../internals/array-iteration').filter;
- var arrayMethodHasSpeciesSupport = require('../internals/array-method-has-species-support');
- var HAS_SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('filter');
- // `Array.prototype.filter` method
- // https://tc39.es/ecma262/#sec-array.prototype.filter
- // with adding support of @@species
- $({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT }, {
- filter: function filter(callbackfn /* , thisArg */) {
- return $filter(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
- }
- });
- },{"../internals/array-iteration":104,"../internals/array-method-has-species-support":106,"../internals/export":139}],244:[function(require,module,exports){
- 'use strict';
- var $ = require('../internals/export');
- var $find = require('../internals/array-iteration').find;
- var addToUnscopables = require('../internals/add-to-unscopables');
- var FIND = 'find';
- var SKIPS_HOLES = true;
- // Shouldn't skip holes
- if (FIND in []) Array(1)[FIND](function () { SKIPS_HOLES = false; });
- // `Array.prototype.find` method
- // https://tc39.es/ecma262/#sec-array.prototype.find
- $({ target: 'Array', proto: true, forced: SKIPS_HOLES }, {
- find: function find(callbackfn /* , that = undefined */) {
- return $find(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
- }
- });
- // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
- addToUnscopables(FIND);
- },{"../internals/add-to-unscopables":91,"../internals/array-iteration":104,"../internals/export":139}],245:[function(require,module,exports){
- var $ = require('../internals/export');
- var from = require('../internals/array-from');
- var checkCorrectnessOfIteration = require('../internals/check-correctness-of-iteration');
- var INCORRECT_ITERATION = !checkCorrectnessOfIteration(function (iterable) {
- // eslint-disable-next-line es/no-array-from -- required for testing
- Array.from(iterable);
- });
- // `Array.from` method
- // https://tc39.es/ecma262/#sec-array.from
- $({ target: 'Array', stat: true, forced: INCORRECT_ITERATION }, {
- from: from
- });
- },{"../internals/array-from":102,"../internals/check-correctness-of-iteration":113,"../internals/export":139}],246:[function(require,module,exports){
- 'use strict';
- var $ = require('../internals/export');
- var $includes = require('../internals/array-includes').includes;
- var addToUnscopables = require('../internals/add-to-unscopables');
- // `Array.prototype.includes` method
- // https://tc39.es/ecma262/#sec-array.prototype.includes
- $({ target: 'Array', proto: true }, {
- includes: function includes(el /* , fromIndex = 0 */) {
- return $includes(this, el, arguments.length > 1 ? arguments[1] : undefined);
- }
- });
- // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
- addToUnscopables('includes');
- },{"../internals/add-to-unscopables":91,"../internals/array-includes":103,"../internals/export":139}],247:[function(require,module,exports){
- 'use strict';
- var toIndexedObject = require('../internals/to-indexed-object');
- var addToUnscopables = require('../internals/add-to-unscopables');
- var Iterators = require('../internals/iterators');
- var InternalStateModule = require('../internals/internal-state');
- var defineIterator = require('../internals/define-iterator');
- var ARRAY_ITERATOR = 'Array Iterator';
- var setInternalState = InternalStateModule.set;
- var getInternalState = InternalStateModule.getterFor(ARRAY_ITERATOR);
- // `Array.prototype.entries` method
- // https://tc39.es/ecma262/#sec-array.prototype.entries
- // `Array.prototype.keys` method
- // https://tc39.es/ecma262/#sec-array.prototype.keys
- // `Array.prototype.values` method
- // https://tc39.es/ecma262/#sec-array.prototype.values
- // `Array.prototype[@@iterator]` method
- // https://tc39.es/ecma262/#sec-array.prototype-@@iterator
- // `CreateArrayIterator` internal method
- // https://tc39.es/ecma262/#sec-createarrayiterator
- module.exports = defineIterator(Array, 'Array', function (iterated, kind) {
- setInternalState(this, {
- type: ARRAY_ITERATOR,
- target: toIndexedObject(iterated), // target
- index: 0, // next index
- kind: kind // kind
- });
- // `%ArrayIteratorPrototype%.next` method
- // https://tc39.es/ecma262/#sec-%arrayiteratorprototype%.next
- }, function () {
- var state = getInternalState(this);
- var target = state.target;
- var kind = state.kind;
- var index = state.index++;
- if (!target || index >= target.length) {
- state.target = undefined;
- return { value: undefined, done: true };
- }
- if (kind == 'keys') return { value: index, done: false };
- if (kind == 'values') return { value: target[index], done: false };
- return { value: [index, target[index]], done: false };
- }, 'values');
- // argumentsList[@@iterator] is %ArrayProto_values%
- // https://tc39.es/ecma262/#sec-createunmappedargumentsobject
- // https://tc39.es/ecma262/#sec-createmappedargumentsobject
- Iterators.Arguments = Iterators.Array;
- // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
- addToUnscopables('keys');
- addToUnscopables('values');
- addToUnscopables('entries');
- },{"../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){
- 'use strict';
- var $ = require('../internals/export');
- var IndexedObject = require('../internals/indexed-object');
- var toIndexedObject = require('../internals/to-indexed-object');
- var arrayMethodIsStrict = require('../internals/array-method-is-strict');
- var nativeJoin = [].join;
- var ES3_STRINGS = IndexedObject != Object;
- var STRICT_METHOD = arrayMethodIsStrict('join', ',');
- // `Array.prototype.join` method
- // https://tc39.es/ecma262/#sec-array.prototype.join
- $({ target: 'Array', proto: true, forced: ES3_STRINGS || !STRICT_METHOD }, {
- join: function join(separator) {
- return nativeJoin.call(toIndexedObject(this), separator === undefined ? ',' : separator);
- }
- });
- },{"../internals/array-method-is-strict":107,"../internals/export":139,"../internals/indexed-object":154,"../internals/to-indexed-object":219}],249:[function(require,module,exports){
- 'use strict';
- var $ = require('../internals/export');
- var $map = require('../internals/array-iteration').map;
- var arrayMethodHasSpeciesSupport = require('../internals/array-method-has-species-support');
- var HAS_SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('map');
- // `Array.prototype.map` method
- // https://tc39.es/ecma262/#sec-array.prototype.map
- // with adding support of @@species
- $({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT }, {
- map: function map(callbackfn /* , thisArg */) {
- return $map(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
- }
- });
- },{"../internals/array-iteration":104,"../internals/array-method-has-species-support":106,"../internals/export":139}],250:[function(require,module,exports){
- 'use strict';
- var $ = require('../internals/export');
- var isObject = require('../internals/is-object');
- var isArray = require('../internals/is-array');
- var toAbsoluteIndex = require('../internals/to-absolute-index');
- var toLength = require('../internals/to-length');
- var toIndexedObject = require('../internals/to-indexed-object');
- var createProperty = require('../internals/create-property');
- var wellKnownSymbol = require('../internals/well-known-symbol');
- var arrayMethodHasSpeciesSupport = require('../internals/array-method-has-species-support');
- var HAS_SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('slice');
- var SPECIES = wellKnownSymbol('species');
- var nativeSlice = [].slice;
- var max = Math.max;
- // `Array.prototype.slice` method
- // https://tc39.es/ecma262/#sec-array.prototype.slice
- // fallback for not array-like ES3 strings and DOM objects
- $({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT }, {
- slice: function slice(start, end) {
- var O = toIndexedObject(this);
- var length = toLength(O.length);
- var k = toAbsoluteIndex(start, length);
- var fin = toAbsoluteIndex(end === undefined ? length : end, length);
- // inline `ArraySpeciesCreate` for usage native `Array#slice` where it's possible
- var Constructor, result, n;
- if (isArray(O)) {
- Constructor = O.constructor;
- // cross-realm fallback
- if (typeof Constructor == 'function' && (Constructor === Array || isArray(Constructor.prototype))) {
- Constructor = undefined;
- } else if (isObject(Constructor)) {
- Constructor = Constructor[SPECIES];
- if (Constructor === null) Constructor = undefined;
- }
- if (Constructor === Array || Constructor === undefined) {
- return nativeSlice.call(O, k, fin);
- }
- }
- result = new (Constructor === undefined ? Array : Constructor)(max(fin - k, 0));
- for (n = 0; k < fin; k++, n++) if (k in O) createProperty(result, n, O[k]);
- result.length = n;
- return result;
- }
- });
- },{"../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){
- 'use strict';
- var $ = require('../internals/export');
- var aFunction = require('../internals/a-function');
- var toObject = require('../internals/to-object');
- var toLength = require('../internals/to-length');
- var toString = require('../internals/to-string');
- var fails = require('../internals/fails');
- var internalSort = require('../internals/array-sort');
- var arrayMethodIsStrict = require('../internals/array-method-is-strict');
- var FF = require('../internals/engine-ff-version');
- var IE_OR_EDGE = require('../internals/engine-is-ie-or-edge');
- var V8 = require('../internals/engine-v8-version');
- var WEBKIT = require('../internals/engine-webkit-version');
- var test = [];
- var nativeSort = test.sort;
- // IE8-
- var FAILS_ON_UNDEFINED = fails(function () {
- test.sort(undefined);
- });
- // V8 bug
- var FAILS_ON_NULL = fails(function () {
- test.sort(null);
- });
- // Old WebKit
- var STRICT_METHOD = arrayMethodIsStrict('sort');
- var STABLE_SORT = !fails(function () {
- // feature detection can be too slow, so check engines versions
- if (V8) return V8 < 70;
- if (FF && FF > 3) return;
- if (IE_OR_EDGE) return true;
- if (WEBKIT) return WEBKIT < 603;
- var result = '';
- var code, chr, value, index;
- // generate an array with more 512 elements (Chakra and old V8 fails only in this case)
- for (code = 65; code < 76; code++) {
- chr = String.fromCharCode(code);
- switch (code) {
- case 66: case 69: case 70: case 72: value = 3; break;
- case 68: case 71: value = 4; break;
- default: value = 2;
- }
- for (index = 0; index < 47; index++) {
- test.push({ k: chr + index, v: value });
- }
- }
- test.sort(function (a, b) { return b.v - a.v; });
- for (index = 0; index < test.length; index++) {
- chr = test[index].k.charAt(0);
- if (result.charAt(result.length - 1) !== chr) result += chr;
- }
- return result !== 'DGBEFHACIJK';
- });
- var FORCED = FAILS_ON_UNDEFINED || !FAILS_ON_NULL || !STRICT_METHOD || !STABLE_SORT;
- var getSortCompare = function (comparefn) {
- return function (x, y) {
- if (y === undefined) return -1;
- if (x === undefined) return 1;
- if (comparefn !== undefined) return +comparefn(x, y) || 0;
- return toString(x) > toString(y) ? 1 : -1;
- };
- };
- // `Array.prototype.sort` method
- // https://tc39.es/ecma262/#sec-array.prototype.sort
- $({ target: 'Array', proto: true, forced: FORCED }, {
- sort: function sort(comparefn) {
- if (comparefn !== undefined) aFunction(comparefn);
- var array = toObject(this);
- if (STABLE_SORT) return comparefn === undefined ? nativeSort.call(array) : nativeSort.call(array, comparefn);
- var items = [];
- var arrayLength = toLength(array.length);
- var itemsLength, index;
- for (index = 0; index < arrayLength; index++) {
- if (index in array) items.push(array[index]);
- }
- items = internalSort(items, getSortCompare(comparefn));
- itemsLength = items.length;
- index = 0;
- while (index < itemsLength) array[index] = items[index++];
- while (index < arrayLength) delete array[index++];
- return array;
- }
- });
- },{"../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){
- 'use strict';
- var $ = require('../internals/export');
- var toAbsoluteIndex = require('../internals/to-absolute-index');
- var toInteger = require('../internals/to-integer');
- var toLength = require('../internals/to-length');
- var toObject = require('../internals/to-object');
- var arraySpeciesCreate = require('../internals/array-species-create');
- var createProperty = require('../internals/create-property');
- var arrayMethodHasSpeciesSupport = require('../internals/array-method-has-species-support');
- var HAS_SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('splice');
- var max = Math.max;
- var min = Math.min;
- var MAX_SAFE_INTEGER = 0x1FFFFFFFFFFFFF;
- var MAXIMUM_ALLOWED_LENGTH_EXCEEDED = 'Maximum allowed length exceeded';
- // `Array.prototype.splice` method
- // https://tc39.es/ecma262/#sec-array.prototype.splice
- // with adding support of @@species
- $({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT }, {
- splice: function splice(start, deleteCount /* , ...items */) {
- var O = toObject(this);
- var len = toLength(O.length);
- var actualStart = toAbsoluteIndex(start, len);
- var argumentsLength = arguments.length;
- var insertCount, actualDeleteCount, A, k, from, to;
- if (argumentsLength === 0) {
- insertCount = actualDeleteCount = 0;
- } else if (argumentsLength === 1) {
- insertCount = 0;
- actualDeleteCount = len - actualStart;
- } else {
- insertCount = argumentsLength - 2;
- actualDeleteCount = min(max(toInteger(deleteCount), 0), len - actualStart);
- }
- if (len + insertCount - actualDeleteCount > MAX_SAFE_INTEGER) {
- throw TypeError(MAXIMUM_ALLOWED_LENGTH_EXCEEDED);
- }
- A = arraySpeciesCreate(O, actualDeleteCount);
- for (k = 0; k < actualDeleteCount; k++) {
- from = actualStart + k;
- if (from in O) createProperty(A, k, O[from]);
- }
- A.length = actualDeleteCount;
- if (insertCount < actualDeleteCount) {
- for (k = actualStart; k < len - actualDeleteCount; k++) {
- from = k + actualDeleteCount;
- to = k + insertCount;
- if (from in O) O[to] = O[from];
- else delete O[to];
- }
- for (k = len; k > len - actualDeleteCount + insertCount; k--) delete O[k - 1];
- } else if (insertCount > actualDeleteCount) {
- for (k = len - actualDeleteCount; k > actualStart; k--) {
- from = k + actualDeleteCount - 1;
- to = k + insertCount - 1;
- if (from in O) O[to] = O[from];
- else delete O[to];
- }
- }
- for (k = 0; k < insertCount; k++) {
- O[k + actualStart] = arguments[k + 2];
- }
- O.length = len - actualDeleteCount + insertCount;
- return A;
- }
- });
- },{"../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){
- var DESCRIPTORS = require('../internals/descriptors');
- var defineProperty = require('../internals/object-define-property').f;
- var FunctionPrototype = Function.prototype;
- var FunctionPrototypeToString = FunctionPrototype.toString;
- var nameRE = /^\s*function ([^ (]*)/;
- var NAME = 'name';
- // Function instances `.name` property
- // https://tc39.es/ecma262/#sec-function-instances-name
- if (DESCRIPTORS && !(NAME in FunctionPrototype)) {
- defineProperty(FunctionPrototype, NAME, {
- configurable: true,
- get: function () {
- try {
- return FunctionPrototypeToString.call(this).match(nameRE)[1];
- } catch (error) {
- return '';
- }
- }
- });
- }
- },{"../internals/descriptors":125,"../internals/object-define-property":179}],254:[function(require,module,exports){
- 'use strict';
- var DESCRIPTORS = require('../internals/descriptors');
- var global = require('../internals/global');
- var isForced = require('../internals/is-forced');
- var redefine = require('../internals/redefine');
- var has = require('../internals/has');
- var classof = require('../internals/classof-raw');
- var inheritIfRequired = require('../internals/inherit-if-required');
- var isSymbol = require('../internals/is-symbol');
- var toPrimitive = require('../internals/to-primitive');
- var fails = require('../internals/fails');
- var create = require('../internals/object-create');
- var getOwnPropertyNames = require('../internals/object-get-own-property-names').f;
- var getOwnPropertyDescriptor = require('../internals/object-get-own-property-descriptor').f;
- var defineProperty = require('../internals/object-define-property').f;
- var trim = require('../internals/string-trim').trim;
- var NUMBER = 'Number';
- var NativeNumber = global[NUMBER];
- var NumberPrototype = NativeNumber.prototype;
- // Opera ~12 has broken Object#toString
- var BROKEN_CLASSOF = classof(create(NumberPrototype)) == NUMBER;
- // `ToNumber` abstract operation
- // https://tc39.es/ecma262/#sec-tonumber
- var toNumber = function (argument) {
- if (isSymbol(argument)) throw TypeError('Cannot convert a Symbol value to a number');
- var it = toPrimitive(argument, 'number');
- var first, third, radix, maxCode, digits, length, index, code;
- if (typeof it == 'string' && it.length > 2) {
- it = trim(it);
- first = it.charCodeAt(0);
- if (first === 43 || first === 45) {
- third = it.charCodeAt(2);
- if (third === 88 || third === 120) return NaN; // Number('+0x1') should be NaN, old V8 fix
- } else if (first === 48) {
- switch (it.charCodeAt(1)) {
- case 66: case 98: radix = 2; maxCode = 49; break; // fast equal of /^0b[01]+$/i
- case 79: case 111: radix = 8; maxCode = 55; break; // fast equal of /^0o[0-7]+$/i
- default: return +it;
- }
- digits = it.slice(2);
- length = digits.length;
- for (index = 0; index < length; index++) {
- code = digits.charCodeAt(index);
- // parseInt parses a string to a first unavailable symbol
- // but ToNumber should return NaN if a string contains unavailable symbols
- if (code < 48 || code > maxCode) return NaN;
- } return parseInt(digits, radix);
- }
- } return +it;
- };
- // `Number` constructor
- // https://tc39.es/ecma262/#sec-number-constructor
- if (isForced(NUMBER, !NativeNumber(' 0o1') || !NativeNumber('0b1') || NativeNumber('+0x1'))) {
- var NumberWrapper = function Number(value) {
- var it = arguments.length < 1 ? 0 : value;
- var dummy = this;
- return dummy instanceof NumberWrapper
- // check on 1..constructor(foo) case
- && (BROKEN_CLASSOF ? fails(function () { NumberPrototype.valueOf.call(dummy); }) : classof(dummy) != NUMBER)
- ? inheritIfRequired(new NativeNumber(toNumber(it)), dummy, NumberWrapper) : toNumber(it);
- };
- for (var keys = DESCRIPTORS ? getOwnPropertyNames(NativeNumber) : (
- // ES3:
- 'MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,' +
- // ES2015 (in case, if modules with ES2015 Number statics required before):
- 'EPSILON,isFinite,isInteger,isNaN,isSafeInteger,MAX_SAFE_INTEGER,' +
- 'MIN_SAFE_INTEGER,parseFloat,parseInt,isInteger,' +
- // ESNext
- 'fromString,range'
- ).split(','), j = 0, key; keys.length > j; j++) {
- if (has(NativeNumber, key = keys[j]) && !has(NumberWrapper, key)) {
- defineProperty(NumberWrapper, key, getOwnPropertyDescriptor(NativeNumber, key));
- }
- }
- NumberWrapper.prototype = NumberPrototype;
- NumberPrototype.constructor = NumberWrapper;
- redefine(global, NUMBER, NumberWrapper);
- }
- },{"../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){
- var $ = require('../internals/export');
- var assign = require('../internals/object-assign');
- // `Object.assign` method
- // https://tc39.es/ecma262/#sec-object.assign
- // eslint-disable-next-line es/no-object-assign -- required for testing
- $({ target: 'Object', stat: true, forced: Object.assign !== assign }, {
- assign: assign
- });
- },{"../internals/export":139,"../internals/object-assign":176}],256:[function(require,module,exports){
- var $ = require('../internals/export');
- var $entries = require('../internals/object-to-array').entries;
- // `Object.entries` method
- // https://tc39.es/ecma262/#sec-object.entries
- $({ target: 'Object', stat: true }, {
- entries: function entries(O) {
- return $entries(O);
- }
- });
- },{"../internals/export":139,"../internals/object-to-array":189}],257:[function(require,module,exports){
- var $ = require('../internals/export');
- var toObject = require('../internals/to-object');
- var nativeKeys = require('../internals/object-keys');
- var fails = require('../internals/fails');
- var FAILS_ON_PRIMITIVES = fails(function () { nativeKeys(1); });
- // `Object.keys` method
- // https://tc39.es/ecma262/#sec-object.keys
- $({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES }, {
- keys: function keys(it) {
- return nativeKeys(toObject(it));
- }
- });
- },{"../internals/export":139,"../internals/fails":140,"../internals/object-keys":186,"../internals/to-object":222}],258:[function(require,module,exports){
- var TO_STRING_TAG_SUPPORT = require('../internals/to-string-tag-support');
- var redefine = require('../internals/redefine');
- var toString = require('../internals/object-to-string');
- // `Object.prototype.toString` method
- // https://tc39.es/ecma262/#sec-object.prototype.tostring
- if (!TO_STRING_TAG_SUPPORT) {
- redefine(Object.prototype, 'toString', toString, { unsafe: true });
- }
- },{"../internals/object-to-string":190,"../internals/redefine":197,"../internals/to-string-tag-support":227}],259:[function(require,module,exports){
- 'use strict';
- var $ = require('../internals/export');
- var IS_PURE = require('../internals/is-pure');
- var global = require('../internals/global');
- var getBuiltIn = require('../internals/get-built-in');
- var NativePromise = require('../internals/native-promise-constructor');
- var redefine = require('../internals/redefine');
- var redefineAll = require('../internals/redefine-all');
- var setPrototypeOf = require('../internals/object-set-prototype-of');
- var setToStringTag = require('../internals/set-to-string-tag');
- var setSpecies = require('../internals/set-species');
- var isObject = require('../internals/is-object');
- var aFunction = require('../internals/a-function');
- var anInstance = require('../internals/an-instance');
- var inspectSource = require('../internals/inspect-source');
- var iterate = require('../internals/iterate');
- var checkCorrectnessOfIteration = require('../internals/check-correctness-of-iteration');
- var speciesConstructor = require('../internals/species-constructor');
- var task = require('../internals/task').set;
- var microtask = require('../internals/microtask');
- var promiseResolve = require('../internals/promise-resolve');
- var hostReportErrors = require('../internals/host-report-errors');
- var newPromiseCapabilityModule = require('../internals/new-promise-capability');
- var perform = require('../internals/perform');
- var InternalStateModule = require('../internals/internal-state');
- var isForced = require('../internals/is-forced');
- var wellKnownSymbol = require('../internals/well-known-symbol');
- var IS_BROWSER = require('../internals/engine-is-browser');
- var IS_NODE = require('../internals/engine-is-node');
- var V8_VERSION = require('../internals/engine-v8-version');
- var SPECIES = wellKnownSymbol('species');
- var PROMISE = 'Promise';
- var getInternalState = InternalStateModule.get;
- var setInternalState = InternalStateModule.set;
- var getInternalPromiseState = InternalStateModule.getterFor(PROMISE);
- var NativePromisePrototype = NativePromise && NativePromise.prototype;
- var PromiseConstructor = NativePromise;
- var PromiseConstructorPrototype = NativePromisePrototype;
- var TypeError = global.TypeError;
- var document = global.document;
- var process = global.process;
- var newPromiseCapability = newPromiseCapabilityModule.f;
- var newGenericPromiseCapability = newPromiseCapability;
- var DISPATCH_EVENT = !!(document && document.createEvent && global.dispatchEvent);
- var NATIVE_REJECTION_EVENT = typeof PromiseRejectionEvent == 'function';
- var UNHANDLED_REJECTION = 'unhandledrejection';
- var REJECTION_HANDLED = 'rejectionhandled';
- var PENDING = 0;
- var FULFILLED = 1;
- var REJECTED = 2;
- var HANDLED = 1;
- var UNHANDLED = 2;
- var SUBCLASSING = false;
- var Internal, OwnPromiseCapability, PromiseWrapper, nativeThen;
- var FORCED = isForced(PROMISE, function () {
- var PROMISE_CONSTRUCTOR_SOURCE = inspectSource(PromiseConstructor);
- var GLOBAL_CORE_JS_PROMISE = PROMISE_CONSTRUCTOR_SOURCE !== String(PromiseConstructor);
- // V8 6.6 (Node 10 and Chrome 66) have a bug with resolving custom thenables
- // https://bugs.chromium.org/p/chromium/issues/detail?id=830565
- // We can't detect it synchronously, so just check versions
- if (!GLOBAL_CORE_JS_PROMISE && V8_VERSION === 66) return true;
- // We need Promise#finally in the pure version for preventing prototype pollution
- if (IS_PURE && !PromiseConstructorPrototype['finally']) return true;
- // We can't use @@species feature detection in V8 since it causes
- // deoptimization and performance degradation
- // https://github.com/zloirock/core-js/issues/679
- if (V8_VERSION >= 51 && /native code/.test(PROMISE_CONSTRUCTOR_SOURCE)) return false;
- // Detect correctness of subclassing with @@species support
- var promise = new PromiseConstructor(function (resolve) { resolve(1); });
- var FakePromise = function (exec) {
- exec(function () { /* empty */ }, function () { /* empty */ });
- };
- var constructor = promise.constructor = {};
- constructor[SPECIES] = FakePromise;
- SUBCLASSING = promise.then(function () { /* empty */ }) instanceof FakePromise;
- if (!SUBCLASSING) return true;
- // Unhandled rejections tracking support, NodeJS Promise without it fails @@species test
- return !GLOBAL_CORE_JS_PROMISE && IS_BROWSER && !NATIVE_REJECTION_EVENT;
- });
- var INCORRECT_ITERATION = FORCED || !checkCorrectnessOfIteration(function (iterable) {
- PromiseConstructor.all(iterable)['catch'](function () { /* empty */ });
- });
- // helpers
- var isThenable = function (it) {
- var then;
- return isObject(it) && typeof (then = it.then) == 'function' ? then : false;
- };
- var notify = function (state, isReject) {
- if (state.notified) return;
- state.notified = true;
- var chain = state.reactions;
- microtask(function () {
- var value = state.value;
- var ok = state.state == FULFILLED;
- var index = 0;
- // variable length - can't use forEach
- while (chain.length > index) {
- var reaction = chain[index++];
- var handler = ok ? reaction.ok : reaction.fail;
- var resolve = reaction.resolve;
- var reject = reaction.reject;
- var domain = reaction.domain;
- var result, then, exited;
- try {
- if (handler) {
- if (!ok) {
- if (state.rejection === UNHANDLED) onHandleUnhandled(state);
- state.rejection = HANDLED;
- }
- if (handler === true) result = value;
- else {
- if (domain) domain.enter();
- result = handler(value); // can throw
- if (domain) {
- domain.exit();
- exited = true;
- }
- }
- if (result === reaction.promise) {
- reject(TypeError('Promise-chain cycle'));
- } else if (then = isThenable(result)) {
- then.call(result, resolve, reject);
- } else resolve(result);
- } else reject(value);
- } catch (error) {
- if (domain && !exited) domain.exit();
- reject(error);
- }
- }
- state.reactions = [];
- state.notified = false;
- if (isReject && !state.rejection) onUnhandled(state);
- });
- };
- var dispatchEvent = function (name, promise, reason) {
- var event, handler;
- if (DISPATCH_EVENT) {
- event = document.createEvent('Event');
- event.promise = promise;
- event.reason = reason;
- event.initEvent(name, false, true);
- global.dispatchEvent(event);
- } else event = { promise: promise, reason: reason };
- if (!NATIVE_REJECTION_EVENT && (handler = global['on' + name])) handler(event);
- else if (name === UNHANDLED_REJECTION) hostReportErrors('Unhandled promise rejection', reason);
- };
- var onUnhandled = function (state) {
- task.call(global, function () {
- var promise = state.facade;
- var value = state.value;
- var IS_UNHANDLED = isUnhandled(state);
- var result;
- if (IS_UNHANDLED) {
- result = perform(function () {
- if (IS_NODE) {
- process.emit('unhandledRejection', value, promise);
- } else dispatchEvent(UNHANDLED_REJECTION, promise, value);
- });
- // Browsers should not trigger `rejectionHandled` event if it was handled here, NodeJS - should
- state.rejection = IS_NODE || isUnhandled(state) ? UNHANDLED : HANDLED;
- if (result.error) throw result.value;
- }
- });
- };
- var isUnhandled = function (state) {
- return state.rejection !== HANDLED && !state.parent;
- };
- var onHandleUnhandled = function (state) {
- task.call(global, function () {
- var promise = state.facade;
- if (IS_NODE) {
- process.emit('rejectionHandled', promise);
- } else dispatchEvent(REJECTION_HANDLED, promise, state.value);
- });
- };
- var bind = function (fn, state, unwrap) {
- return function (value) {
- fn(state, value, unwrap);
- };
- };
- var internalReject = function (state, value, unwrap) {
- if (state.done) return;
- state.done = true;
- if (unwrap) state = unwrap;
- state.value = value;
- state.state = REJECTED;
- notify(state, true);
- };
- var internalResolve = function (state, value, unwrap) {
- if (state.done) return;
- state.done = true;
- if (unwrap) state = unwrap;
- try {
- if (state.facade === value) throw TypeError("Promise can't be resolved itself");
- var then = isThenable(value);
- if (then) {
- microtask(function () {
- var wrapper = { done: false };
- try {
- then.call(value,
- bind(internalResolve, wrapper, state),
- bind(internalReject, wrapper, state)
- );
- } catch (error) {
- internalReject(wrapper, error, state);
- }
- });
- } else {
- state.value = value;
- state.state = FULFILLED;
- notify(state, false);
- }
- } catch (error) {
- internalReject({ done: false }, error, state);
- }
- };
- // constructor polyfill
- if (FORCED) {
- // 25.4.3.1 Promise(executor)
- PromiseConstructor = function Promise(executor) {
- anInstance(this, PromiseConstructor, PROMISE);
- aFunction(executor);
- Internal.call(this);
- var state = getInternalState(this);
- try {
- executor(bind(internalResolve, state), bind(internalReject, state));
- } catch (error) {
- internalReject(state, error);
- }
- };
- PromiseConstructorPrototype = PromiseConstructor.prototype;
- // eslint-disable-next-line no-unused-vars -- required for `.length`
- Internal = function Promise(executor) {
- setInternalState(this, {
- type: PROMISE,
- done: false,
- notified: false,
- parent: false,
- reactions: [],
- rejection: false,
- state: PENDING,
- value: undefined
- });
- };
- Internal.prototype = redefineAll(PromiseConstructorPrototype, {
- // `Promise.prototype.then` method
- // https://tc39.es/ecma262/#sec-promise.prototype.then
- then: function then(onFulfilled, onRejected) {
- var state = getInternalPromiseState(this);
- var reaction = newPromiseCapability(speciesConstructor(this, PromiseConstructor));
- reaction.ok = typeof onFulfilled == 'function' ? onFulfilled : true;
- reaction.fail = typeof onRejected == 'function' && onRejected;
- reaction.domain = IS_NODE ? process.domain : undefined;
- state.parent = true;
- state.reactions.push(reaction);
- if (state.state != PENDING) notify(state, false);
- return reaction.promise;
- },
- // `Promise.prototype.catch` method
- // https://tc39.es/ecma262/#sec-promise.prototype.catch
- 'catch': function (onRejected) {
- return this.then(undefined, onRejected);
- }
- });
- OwnPromiseCapability = function () {
- var promise = new Internal();
- var state = getInternalState(promise);
- this.promise = promise;
- this.resolve = bind(internalResolve, state);
- this.reject = bind(internalReject, state);
- };
- newPromiseCapabilityModule.f = newPromiseCapability = function (C) {
- return C === PromiseConstructor || C === PromiseWrapper
- ? new OwnPromiseCapability(C)
- : newGenericPromiseCapability(C);
- };
- if (!IS_PURE && typeof NativePromise == 'function' && NativePromisePrototype !== Object.prototype) {
- nativeThen = NativePromisePrototype.then;
- if (!SUBCLASSING) {
- // make `Promise#then` return a polyfilled `Promise` for native promise-based APIs
- redefine(NativePromisePrototype, 'then', function then(onFulfilled, onRejected) {
- var that = this;
- return new PromiseConstructor(function (resolve, reject) {
- nativeThen.call(that, resolve, reject);
- }).then(onFulfilled, onRejected);
- // https://github.com/zloirock/core-js/issues/640
- }, { unsafe: true });
- // makes sure that native promise-based APIs `Promise#catch` properly works with patched `Promise#then`
- redefine(NativePromisePrototype, 'catch', PromiseConstructorPrototype['catch'], { unsafe: true });
- }
- // make `.constructor === Promise` work for native promise-based APIs
- try {
- delete NativePromisePrototype.constructor;
- } catch (error) { /* empty */ }
- // make `instanceof Promise` work for native promise-based APIs
- if (setPrototypeOf) {
- setPrototypeOf(NativePromisePrototype, PromiseConstructorPrototype);
- }
- }
- }
- $({ global: true, wrap: true, forced: FORCED }, {
- Promise: PromiseConstructor
- });
- setToStringTag(PromiseConstructor, PROMISE, false, true);
- setSpecies(PROMISE);
- PromiseWrapper = getBuiltIn(PROMISE);
- // statics
- $({ target: PROMISE, stat: true, forced: FORCED }, {
- // `Promise.reject` method
- // https://tc39.es/ecma262/#sec-promise.reject
- reject: function reject(r) {
- var capability = newPromiseCapability(this);
- capability.reject.call(undefined, r);
- return capability.promise;
- }
- });
- $({ target: PROMISE, stat: true, forced: IS_PURE || FORCED }, {
- // `Promise.resolve` method
- // https://tc39.es/ecma262/#sec-promise.resolve
- resolve: function resolve(x) {
- return promiseResolve(IS_PURE && this === PromiseWrapper ? PromiseConstructor : this, x);
- }
- });
- $({ target: PROMISE, stat: true, forced: INCORRECT_ITERATION }, {
- // `Promise.all` method
- // https://tc39.es/ecma262/#sec-promise.all
- all: function all(iterable) {
- var C = this;
- var capability = newPromiseCapability(C);
- var resolve = capability.resolve;
- var reject = capability.reject;
- var result = perform(function () {
- var $promiseResolve = aFunction(C.resolve);
- var values = [];
- var counter = 0;
- var remaining = 1;
- iterate(iterable, function (promise) {
- var index = counter++;
- var alreadyCalled = false;
- values.push(undefined);
- remaining++;
- $promiseResolve.call(C, promise).then(function (value) {
- if (alreadyCalled) return;
- alreadyCalled = true;
- values[index] = value;
- --remaining || resolve(values);
- }, reject);
- });
- --remaining || resolve(values);
- });
- if (result.error) reject(result.value);
- return capability.promise;
- },
- // `Promise.race` method
- // https://tc39.es/ecma262/#sec-promise.race
- race: function race(iterable) {
- var C = this;
- var capability = newPromiseCapability(C);
- var reject = capability.reject;
- var result = perform(function () {
- var $promiseResolve = aFunction(C.resolve);
- iterate(iterable, function (promise) {
- $promiseResolve.call(C, promise).then(capability.resolve, reject);
- });
- });
- if (result.error) reject(result.value);
- return capability.promise;
- }
- });
- },{"../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){
- var DESCRIPTORS = require('../internals/descriptors');
- var global = require('../internals/global');
- var isForced = require('../internals/is-forced');
- var inheritIfRequired = require('../internals/inherit-if-required');
- var createNonEnumerableProperty = require('../internals/create-non-enumerable-property');
- var defineProperty = require('../internals/object-define-property').f;
- var getOwnPropertyNames = require('../internals/object-get-own-property-names').f;
- var isRegExp = require('../internals/is-regexp');
- var toString = require('../internals/to-string');
- var getFlags = require('../internals/regexp-flags');
- var stickyHelpers = require('../internals/regexp-sticky-helpers');
- var redefine = require('../internals/redefine');
- var fails = require('../internals/fails');
- var has = require('../internals/has');
- var enforceInternalState = require('../internals/internal-state').enforce;
- var setSpecies = require('../internals/set-species');
- var wellKnownSymbol = require('../internals/well-known-symbol');
- var UNSUPPORTED_DOT_ALL = require('../internals/regexp-unsupported-dot-all');
- var UNSUPPORTED_NCG = require('../internals/regexp-unsupported-ncg');
- var MATCH = wellKnownSymbol('match');
- var NativeRegExp = global.RegExp;
- var RegExpPrototype = NativeRegExp.prototype;
- // TODO: Use only propper RegExpIdentifierName
- var IS_NCG = /^\?<[^\s\d!#%&*+<=>@^][^\s!#%&*+<=>@^]*>/;
- var re1 = /a/g;
- var re2 = /a/g;
- // "new" should create a new object, old webkit bug
- var CORRECT_NEW = new NativeRegExp(re1) !== re1;
- var UNSUPPORTED_Y = stickyHelpers.UNSUPPORTED_Y;
- var BASE_FORCED = DESCRIPTORS &&
- (!CORRECT_NEW || UNSUPPORTED_Y || UNSUPPORTED_DOT_ALL || UNSUPPORTED_NCG || fails(function () {
- re2[MATCH] = false;
- // RegExp constructor can alter flags and IsRegExp works correct with @@match
- return NativeRegExp(re1) != re1 || NativeRegExp(re2) == re2 || NativeRegExp(re1, 'i') != '/a/i';
- }));
- var handleDotAll = function (string) {
- var length = string.length;
- var index = 0;
- var result = '';
- var brackets = false;
- var chr;
- for (; index <= length; index++) {
- chr = string.charAt(index);
- if (chr === '\\') {
- result += chr + string.charAt(++index);
- continue;
- }
- if (!brackets && chr === '.') {
- result += '[\\s\\S]';
- } else {
- if (chr === '[') {
- brackets = true;
- } else if (chr === ']') {
- brackets = false;
- } result += chr;
- }
- } return result;
- };
- var handleNCG = function (string) {
- var length = string.length;
- var index = 0;
- var result = '';
- var named = [];
- var names = {};
- var brackets = false;
- var ncg = false;
- var groupid = 0;
- var groupname = '';
- var chr;
- for (; index <= length; index++) {
- chr = string.charAt(index);
- if (chr === '\\') {
- chr = chr + string.charAt(++index);
- } else if (chr === ']') {
- brackets = false;
- } else if (!brackets) switch (true) {
- case chr === '[':
- brackets = true;
- break;
- case chr === '(':
- if (IS_NCG.test(string.slice(index + 1))) {
- index += 2;
- ncg = true;
- }
- result += chr;
- groupid++;
- continue;
- case chr === '>' && ncg:
- if (groupname === '' || has(names, groupname)) {
- throw new SyntaxError('Invalid capture group name');
- }
- names[groupname] = true;
- named.push([groupname, groupid]);
- ncg = false;
- groupname = '';
- continue;
- }
- if (ncg) groupname += chr;
- else result += chr;
- } return [result, named];
- };
- // `RegExp` constructor
- // https://tc39.es/ecma262/#sec-regexp-constructor
- if (isForced('RegExp', BASE_FORCED)) {
- var RegExpWrapper = function RegExp(pattern, flags) {
- var thisIsRegExp = this instanceof RegExpWrapper;
- var patternIsRegExp = isRegExp(pattern);
- var flagsAreUndefined = flags === undefined;
- var groups = [];
- var rawPattern = pattern;
- var rawFlags, dotAll, sticky, handled, result, state;
- if (!thisIsRegExp && patternIsRegExp && flagsAreUndefined && pattern.constructor === RegExpWrapper) {
- return pattern;
- }
- if (patternIsRegExp || pattern instanceof RegExpWrapper) {
- pattern = pattern.source;
- if (flagsAreUndefined) flags = 'flags' in rawPattern ? rawPattern.flags : getFlags.call(rawPattern);
- }
- pattern = pattern === undefined ? '' : toString(pattern);
- flags = flags === undefined ? '' : toString(flags);
- rawPattern = pattern;
- if (UNSUPPORTED_DOT_ALL && 'dotAll' in re1) {
- dotAll = !!flags && flags.indexOf('s') > -1;
- if (dotAll) flags = flags.replace(/s/g, '');
- }
- rawFlags = flags;
- if (UNSUPPORTED_Y && 'sticky' in re1) {
- sticky = !!flags && flags.indexOf('y') > -1;
- if (sticky) flags = flags.replace(/y/g, '');
- }
- if (UNSUPPORTED_NCG) {
- handled = handleNCG(pattern);
- pattern = handled[0];
- groups = handled[1];
- }
- result = inheritIfRequired(NativeRegExp(pattern, flags), thisIsRegExp ? this : RegExpPrototype, RegExpWrapper);
- if (dotAll || sticky || groups.length) {
- state = enforceInternalState(result);
- if (dotAll) {
- state.dotAll = true;
- state.raw = RegExpWrapper(handleDotAll(pattern), rawFlags);
- }
- if (sticky) state.sticky = true;
- if (groups.length) state.groups = groups;
- }
- if (pattern !== rawPattern) try {
- // fails in old engines, but we have no alternatives for unsupported regex syntax
- createNonEnumerableProperty(result, 'source', rawPattern === '' ? '(?:)' : rawPattern);
- } catch (error) { /* empty */ }
- return result;
- };
- var proxy = function (key) {
- key in RegExpWrapper || defineProperty(RegExpWrapper, key, {
- configurable: true,
- get: function () { return NativeRegExp[key]; },
- set: function (it) { NativeRegExp[key] = it; }
- });
- };
- for (var keys = getOwnPropertyNames(NativeRegExp), index = 0; keys.length > index;) {
- proxy(keys[index++]);
- }
- RegExpPrototype.constructor = RegExpWrapper;
- RegExpWrapper.prototype = RegExpPrototype;
- redefine(global, 'RegExp', RegExpWrapper);
- }
- // https://tc39.es/ecma262/#sec-get-regexp-@@species
- setSpecies('RegExp');
- },{"../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){
- 'use strict';
- var $ = require('../internals/export');
- var exec = require('../internals/regexp-exec');
- // `RegExp.prototype.exec` method
- // https://tc39.es/ecma262/#sec-regexp.prototype.exec
- $({ target: 'RegExp', proto: true, forced: /./.exec !== exec }, {
- exec: exec
- });
- },{"../internals/export":139,"../internals/regexp-exec":199}],262:[function(require,module,exports){
- 'use strict';
- var redefine = require('../internals/redefine');
- var anObject = require('../internals/an-object');
- var $toString = require('../internals/to-string');
- var fails = require('../internals/fails');
- var flags = require('../internals/regexp-flags');
- var TO_STRING = 'toString';
- var RegExpPrototype = RegExp.prototype;
- var nativeToString = RegExpPrototype[TO_STRING];
- var NOT_GENERIC = fails(function () { return nativeToString.call({ source: 'a', flags: 'b' }) != '/a/b'; });
- // FF44- RegExp#toString has a wrong name
- var INCORRECT_NAME = nativeToString.name != TO_STRING;
- // `RegExp.prototype.toString` method
- // https://tc39.es/ecma262/#sec-regexp.prototype.tostring
- if (NOT_GENERIC || INCORRECT_NAME) {
- redefine(RegExp.prototype, TO_STRING, function toString() {
- var R = anObject(this);
- var p = $toString(R.source);
- var rf = R.flags;
- var f = $toString(rf === undefined && R instanceof RegExp && !('flags' in RegExpPrototype) ? flags.call(R) : rf);
- return '/' + p + '/' + f;
- }, { unsafe: true });
- }
- },{"../internals/an-object":94,"../internals/fails":140,"../internals/redefine":197,"../internals/regexp-flags":200,"../internals/to-string":228}],263:[function(require,module,exports){
- 'use strict';
- var $ = require('../internals/export');
- var notARegExp = require('../internals/not-a-regexp');
- var requireObjectCoercible = require('../internals/require-object-coercible');
- var toString = require('../internals/to-string');
- var correctIsRegExpLogic = require('../internals/correct-is-regexp-logic');
- // `String.prototype.includes` method
- // https://tc39.es/ecma262/#sec-string.prototype.includes
- $({ target: 'String', proto: true, forced: !correctIsRegExpLogic('includes') }, {
- includes: function includes(searchString /* , position = 0 */) {
- return !!~toString(requireObjectCoercible(this))
- .indexOf(toString(notARegExp(searchString)), arguments.length > 1 ? arguments[1] : undefined);
- }
- });
- },{"../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){
- 'use strict';
- var charAt = require('../internals/string-multibyte').charAt;
- var toString = require('../internals/to-string');
- var InternalStateModule = require('../internals/internal-state');
- var defineIterator = require('../internals/define-iterator');
- var STRING_ITERATOR = 'String Iterator';
- var setInternalState = InternalStateModule.set;
- var getInternalState = InternalStateModule.getterFor(STRING_ITERATOR);
- // `String.prototype[@@iterator]` method
- // https://tc39.es/ecma262/#sec-string.prototype-@@iterator
- defineIterator(String, 'String', function (iterated) {
- setInternalState(this, {
- type: STRING_ITERATOR,
- string: toString(iterated),
- index: 0
- });
- // `%StringIteratorPrototype%.next` method
- // https://tc39.es/ecma262/#sec-%stringiteratorprototype%.next
- }, function next() {
- var state = getInternalState(this);
- var string = state.string;
- var index = state.index;
- var point;
- if (index >= string.length) return { value: undefined, done: true };
- point = charAt(string, index);
- state.index += point.length;
- return { value: point, done: false };
- });
- },{"../internals/define-iterator":123,"../internals/internal-state":157,"../internals/string-multibyte":213,"../internals/to-string":228}],265:[function(require,module,exports){
- 'use strict';
- var fixRegExpWellKnownSymbolLogic = require('../internals/fix-regexp-well-known-symbol-logic');
- var anObject = require('../internals/an-object');
- var toLength = require('../internals/to-length');
- var toString = require('../internals/to-string');
- var requireObjectCoercible = require('../internals/require-object-coercible');
- var advanceStringIndex = require('../internals/advance-string-index');
- var regExpExec = require('../internals/regexp-exec-abstract');
- // @@match logic
- fixRegExpWellKnownSymbolLogic('match', function (MATCH, nativeMatch, maybeCallNative) {
- return [
- // `String.prototype.match` method
- // https://tc39.es/ecma262/#sec-string.prototype.match
- function match(regexp) {
- var O = requireObjectCoercible(this);
- var matcher = regexp == undefined ? undefined : regexp[MATCH];
- return matcher !== undefined ? matcher.call(regexp, O) : new RegExp(regexp)[MATCH](toString(O));
- },
- // `RegExp.prototype[@@match]` method
- // https://tc39.es/ecma262/#sec-regexp.prototype-@@match
- function (string) {
- var rx = anObject(this);
- var S = toString(string);
- var res = maybeCallNative(nativeMatch, rx, S);
- if (res.done) return res.value;
- if (!rx.global) return regExpExec(rx, S);
- var fullUnicode = rx.unicode;
- rx.lastIndex = 0;
- var A = [];
- var n = 0;
- var result;
- while ((result = regExpExec(rx, S)) !== null) {
- var matchStr = toString(result[0]);
- A[n] = matchStr;
- if (matchStr === '') rx.lastIndex = advanceStringIndex(S, toLength(rx.lastIndex), fullUnicode);
- n++;
- }
- return n === 0 ? null : A;
- }
- ];
- });
- },{"../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){
- 'use strict';
- var fixRegExpWellKnownSymbolLogic = require('../internals/fix-regexp-well-known-symbol-logic');
- var fails = require('../internals/fails');
- var anObject = require('../internals/an-object');
- var toInteger = require('../internals/to-integer');
- var toLength = require('../internals/to-length');
- var toString = require('../internals/to-string');
- var requireObjectCoercible = require('../internals/require-object-coercible');
- var advanceStringIndex = require('../internals/advance-string-index');
- var getSubstitution = require('../internals/get-substitution');
- var regExpExec = require('../internals/regexp-exec-abstract');
- var wellKnownSymbol = require('../internals/well-known-symbol');
- var REPLACE = wellKnownSymbol('replace');
- var max = Math.max;
- var min = Math.min;
- var maybeToString = function (it) {
- return it === undefined ? it : String(it);
- };
- // IE <= 11 replaces $0 with the whole match, as if it was $&
- // https://stackoverflow.com/questions/6024666/getting-ie-to-replace-a-regex-with-the-literal-string-0
- var REPLACE_KEEPS_$0 = (function () {
- // eslint-disable-next-line regexp/prefer-escape-replacement-dollar-char -- required for testing
- return 'a'.replace(/./, '$0') === '$0';
- })();
- // Safari <= 13.0.3(?) substitutes nth capture where n>m with an empty string
- var REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE = (function () {
- if (/./[REPLACE]) {
- return /./[REPLACE]('a', '$0') === '';
- }
- return false;
- })();
- var REPLACE_SUPPORTS_NAMED_GROUPS = !fails(function () {
- var re = /./;
- re.exec = function () {
- var result = [];
- result.groups = { a: '7' };
- return result;
- };
- // eslint-disable-next-line regexp/no-useless-dollar-replacements -- false positive
- return ''.replace(re, '$<a>') !== '7';
- });
- // @@replace logic
- fixRegExpWellKnownSymbolLogic('replace', function (_, nativeReplace, maybeCallNative) {
- var UNSAFE_SUBSTITUTE = REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE ? '$' : '$0';
- return [
- // `String.prototype.replace` method
- // https://tc39.es/ecma262/#sec-string.prototype.replace
- function replace(searchValue, replaceValue) {
- var O = requireObjectCoercible(this);
- var replacer = searchValue == undefined ? undefined : searchValue[REPLACE];
- return replacer !== undefined
- ? replacer.call(searchValue, O, replaceValue)
- : nativeReplace.call(toString(O), searchValue, replaceValue);
- },
- // `RegExp.prototype[@@replace]` method
- // https://tc39.es/ecma262/#sec-regexp.prototype-@@replace
- function (string, replaceValue) {
- var rx = anObject(this);
- var S = toString(string);
- if (
- typeof replaceValue === 'string' &&
- replaceValue.indexOf(UNSAFE_SUBSTITUTE) === -1 &&
- replaceValue.indexOf('$<') === -1
- ) {
- var res = maybeCallNative(nativeReplace, rx, S, replaceValue);
- if (res.done) return res.value;
- }
- var functionalReplace = typeof replaceValue === 'function';
- if (!functionalReplace) replaceValue = toString(replaceValue);
- var global = rx.global;
- if (global) {
- var fullUnicode = rx.unicode;
- rx.lastIndex = 0;
- }
- var results = [];
- while (true) {
- var result = regExpExec(rx, S);
- if (result === null) break;
- results.push(result);
- if (!global) break;
- var matchStr = toString(result[0]);
- if (matchStr === '') rx.lastIndex = advanceStringIndex(S, toLength(rx.lastIndex), fullUnicode);
- }
- var accumulatedResult = '';
- var nextSourcePosition = 0;
- for (var i = 0; i < results.length; i++) {
- result = results[i];
- var matched = toString(result[0]);
- var position = max(min(toInteger(result.index), S.length), 0);
- var captures = [];
- // NOTE: This is equivalent to
- // captures = result.slice(1).map(maybeToString)
- // but for some reason `nativeSlice.call(result, 1, result.length)` (called in
- // the slice polyfill when slicing native arrays) "doesn't work" in safari 9 and
- // causes a crash (https://pastebin.com/N21QzeQA) when trying to debug it.
- for (var j = 1; j < result.length; j++) captures.push(maybeToString(result[j]));
- var namedCaptures = result.groups;
- if (functionalReplace) {
- var replacerArgs = [matched].concat(captures, position, S);
- if (namedCaptures !== undefined) replacerArgs.push(namedCaptures);
- var replacement = toString(replaceValue.apply(undefined, replacerArgs));
- } else {
- replacement = getSubstitution(matched, S, position, captures, namedCaptures, replaceValue);
- }
- if (position >= nextSourcePosition) {
- accumulatedResult += S.slice(nextSourcePosition, position) + replacement;
- nextSourcePosition = position + matched.length;
- }
- }
- return accumulatedResult + S.slice(nextSourcePosition);
- }
- ];
- }, !REPLACE_SUPPORTS_NAMED_GROUPS || !REPLACE_KEEPS_$0 || REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE);
- },{"../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){
- 'use strict';
- var fixRegExpWellKnownSymbolLogic = require('../internals/fix-regexp-well-known-symbol-logic');
- var anObject = require('../internals/an-object');
- var requireObjectCoercible = require('../internals/require-object-coercible');
- var sameValue = require('../internals/same-value');
- var toString = require('../internals/to-string');
- var regExpExec = require('../internals/regexp-exec-abstract');
- // @@search logic
- fixRegExpWellKnownSymbolLogic('search', function (SEARCH, nativeSearch, maybeCallNative) {
- return [
- // `String.prototype.search` method
- // https://tc39.es/ecma262/#sec-string.prototype.search
- function search(regexp) {
- var O = requireObjectCoercible(this);
- var searcher = regexp == undefined ? undefined : regexp[SEARCH];
- return searcher !== undefined ? searcher.call(regexp, O) : new RegExp(regexp)[SEARCH](toString(O));
- },
- // `RegExp.prototype[@@search]` method
- // https://tc39.es/ecma262/#sec-regexp.prototype-@@search
- function (string) {
- var rx = anObject(this);
- var S = toString(string);
- var res = maybeCallNative(nativeSearch, rx, S);
- if (res.done) return res.value;
- var previousLastIndex = rx.lastIndex;
- if (!sameValue(previousLastIndex, 0)) rx.lastIndex = 0;
- var result = regExpExec(rx, S);
- if (!sameValue(rx.lastIndex, previousLastIndex)) rx.lastIndex = previousLastIndex;
- return result === null ? -1 : result.index;
- }
- ];
- });
- },{"../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){
- 'use strict';
- var fixRegExpWellKnownSymbolLogic = require('../internals/fix-regexp-well-known-symbol-logic');
- var isRegExp = require('../internals/is-regexp');
- var anObject = require('../internals/an-object');
- var requireObjectCoercible = require('../internals/require-object-coercible');
- var speciesConstructor = require('../internals/species-constructor');
- var advanceStringIndex = require('../internals/advance-string-index');
- var toLength = require('../internals/to-length');
- var toString = require('../internals/to-string');
- var callRegExpExec = require('../internals/regexp-exec-abstract');
- var regexpExec = require('../internals/regexp-exec');
- var stickyHelpers = require('../internals/regexp-sticky-helpers');
- var fails = require('../internals/fails');
- var UNSUPPORTED_Y = stickyHelpers.UNSUPPORTED_Y;
- var arrayPush = [].push;
- var min = Math.min;
- var MAX_UINT32 = 0xFFFFFFFF;
- // Chrome 51 has a buggy "split" implementation when RegExp#exec !== nativeExec
- // Weex JS has frozen built-in prototypes, so use try / catch wrapper
- var SPLIT_WORKS_WITH_OVERWRITTEN_EXEC = !fails(function () {
- // eslint-disable-next-line regexp/no-empty-group -- required for testing
- var re = /(?:)/;
- var originalExec = re.exec;
- re.exec = function () { return originalExec.apply(this, arguments); };
- var result = 'ab'.split(re);
- return result.length !== 2 || result[0] !== 'a' || result[1] !== 'b';
- });
- // @@split logic
- fixRegExpWellKnownSymbolLogic('split', function (SPLIT, nativeSplit, maybeCallNative) {
- var internalSplit;
- if (
- 'abbc'.split(/(b)*/)[1] == 'c' ||
- // eslint-disable-next-line regexp/no-empty-group -- required for testing
- 'test'.split(/(?:)/, -1).length != 4 ||
- 'ab'.split(/(?:ab)*/).length != 2 ||
- '.'.split(/(.?)(.?)/).length != 4 ||
- // eslint-disable-next-line regexp/no-empty-capturing-group, regexp/no-empty-group -- required for testing
- '.'.split(/()()/).length > 1 ||
- ''.split(/.?/).length
- ) {
- // based on es5-shim implementation, need to rework it
- internalSplit = function (separator, limit) {
- var string = toString(requireObjectCoercible(this));
- var lim = limit === undefined ? MAX_UINT32 : limit >>> 0;
- if (lim === 0) return [];
- if (separator === undefined) return [string];
- // If `separator` is not a regex, use native split
- if (!isRegExp(separator)) {
- return nativeSplit.call(string, separator, lim);
- }
- var output = [];
- var flags = (separator.ignoreCase ? 'i' : '') +
- (separator.multiline ? 'm' : '') +
- (separator.unicode ? 'u' : '') +
- (separator.sticky ? 'y' : '');
- var lastLastIndex = 0;
- // Make `global` and avoid `lastIndex` issues by working with a copy
- var separatorCopy = new RegExp(separator.source, flags + 'g');
- var match, lastIndex, lastLength;
- while (match = regexpExec.call(separatorCopy, string)) {
- lastIndex = separatorCopy.lastIndex;
- if (lastIndex > lastLastIndex) {
- output.push(string.slice(lastLastIndex, match.index));
- if (match.length > 1 && match.index < string.length) arrayPush.apply(output, match.slice(1));
- lastLength = match[0].length;
- lastLastIndex = lastIndex;
- if (output.length >= lim) break;
- }
- if (separatorCopy.lastIndex === match.index) separatorCopy.lastIndex++; // Avoid an infinite loop
- }
- if (lastLastIndex === string.length) {
- if (lastLength || !separatorCopy.test('')) output.push('');
- } else output.push(string.slice(lastLastIndex));
- return output.length > lim ? output.slice(0, lim) : output;
- };
- // Chakra, V8
- } else if ('0'.split(undefined, 0).length) {
- internalSplit = function (separator, limit) {
- return separator === undefined && limit === 0 ? [] : nativeSplit.call(this, separator, limit);
- };
- } else internalSplit = nativeSplit;
- return [
- // `String.prototype.split` method
- // https://tc39.es/ecma262/#sec-string.prototype.split
- function split(separator, limit) {
- var O = requireObjectCoercible(this);
- var splitter = separator == undefined ? undefined : separator[SPLIT];
- return splitter !== undefined
- ? splitter.call(separator, O, limit)
- : internalSplit.call(toString(O), separator, limit);
- },
- // `RegExp.prototype[@@split]` method
- // https://tc39.es/ecma262/#sec-regexp.prototype-@@split
- //
- // NOTE: This cannot be properly polyfilled in engines that don't support
- // the 'y' flag.
- function (string, limit) {
- var rx = anObject(this);
- var S = toString(string);
- var res = maybeCallNative(internalSplit, rx, S, limit, internalSplit !== nativeSplit);
- if (res.done) return res.value;
- var C = speciesConstructor(rx, RegExp);
- var unicodeMatching = rx.unicode;
- var flags = (rx.ignoreCase ? 'i' : '') +
- (rx.multiline ? 'm' : '') +
- (rx.unicode ? 'u' : '') +
- (UNSUPPORTED_Y ? 'g' : 'y');
- // ^(? + rx + ) is needed, in combination with some S slicing, to
- // simulate the 'y' flag.
- var splitter = new C(UNSUPPORTED_Y ? '^(?:' + rx.source + ')' : rx, flags);
- var lim = limit === undefined ? MAX_UINT32 : limit >>> 0;
- if (lim === 0) return [];
- if (S.length === 0) return callRegExpExec(splitter, S) === null ? [S] : [];
- var p = 0;
- var q = 0;
- var A = [];
- while (q < S.length) {
- splitter.lastIndex = UNSUPPORTED_Y ? 0 : q;
- var z = callRegExpExec(splitter, UNSUPPORTED_Y ? S.slice(q) : S);
- var e;
- if (
- z === null ||
- (e = min(toLength(splitter.lastIndex + (UNSUPPORTED_Y ? q : 0)), S.length)) === p
- ) {
- q = advanceStringIndex(S, q, unicodeMatching);
- } else {
- A.push(S.slice(p, q));
- if (A.length === lim) return A;
- for (var i = 1; i <= z.length - 1; i++) {
- A.push(z[i]);
- if (A.length === lim) return A;
- }
- q = p = e;
- }
- }
- A.push(S.slice(p));
- return A;
- }
- ];
- }, !SPLIT_WORKS_WITH_OVERWRITTEN_EXEC, UNSUPPORTED_Y);
- },{"../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){
- 'use strict';
- var $ = require('../internals/export');
- var $trim = require('../internals/string-trim').trim;
- var forcedStringTrimMethod = require('../internals/string-trim-forced');
- // `String.prototype.trim` method
- // https://tc39.es/ecma262/#sec-string.prototype.trim
- $({ target: 'String', proto: true, forced: forcedStringTrimMethod('trim') }, {
- trim: function trim() {
- return $trim(this);
- }
- });
- },{"../internals/export":139,"../internals/string-trim":215,"../internals/string-trim-forced":214}],270:[function(require,module,exports){
- // `Symbol.prototype.description` getter
- // https://tc39.es/ecma262/#sec-symbol.prototype.description
- 'use strict';
- var $ = require('../internals/export');
- var DESCRIPTORS = require('../internals/descriptors');
- var global = require('../internals/global');
- var has = require('../internals/has');
- var isObject = require('../internals/is-object');
- var defineProperty = require('../internals/object-define-property').f;
- var copyConstructorProperties = require('../internals/copy-constructor-properties');
- var NativeSymbol = global.Symbol;
- if (DESCRIPTORS && typeof NativeSymbol == 'function' && (!('description' in NativeSymbol.prototype) ||
- // Safari 12 bug
- NativeSymbol().description !== undefined
- )) {
- var EmptyStringDescriptionStore = {};
- // wrap Symbol constructor for correct work with undefined description
- var SymbolWrapper = function Symbol() {
- var description = arguments.length < 1 || arguments[0] === undefined ? undefined : String(arguments[0]);
- var result = this instanceof SymbolWrapper
- ? new NativeSymbol(description)
- // in Edge 13, String(Symbol(undefined)) === 'Symbol(undefined)'
- : description === undefined ? NativeSymbol() : NativeSymbol(description);
- if (description === '') EmptyStringDescriptionStore[result] = true;
- return result;
- };
- copyConstructorProperties(SymbolWrapper, NativeSymbol);
- var symbolPrototype = SymbolWrapper.prototype = NativeSymbol.prototype;
- symbolPrototype.constructor = SymbolWrapper;
- var symbolToString = symbolPrototype.toString;
- var nativeSymbol = String(NativeSymbol('test')) == 'Symbol(test)';
- var regexp = /^Symbol\((.*)\)[^)]+$/;
- defineProperty(symbolPrototype, 'description', {
- configurable: true,
- get: function description() {
- var symbol = isObject(this) ? this.valueOf() : this;
- var string = symbolToString.call(symbol);
- if (has(EmptyStringDescriptionStore, symbol)) return '';
- var desc = nativeSymbol ? string.slice(7, -1) : string.replace(regexp, '$1');
- return desc === '' ? undefined : desc;
- }
- });
- $({ global: true, forced: true }, {
- Symbol: SymbolWrapper
- });
- }
- },{"../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){
- 'use strict';
- var $ = require('../internals/export');
- var global = require('../internals/global');
- var getBuiltIn = require('../internals/get-built-in');
- var IS_PURE = require('../internals/is-pure');
- var DESCRIPTORS = require('../internals/descriptors');
- var NATIVE_SYMBOL = require('../internals/native-symbol');
- var fails = require('../internals/fails');
- var has = require('../internals/has');
- var isArray = require('../internals/is-array');
- var isObject = require('../internals/is-object');
- var isSymbol = require('../internals/is-symbol');
- var anObject = require('../internals/an-object');
- var toObject = require('../internals/to-object');
- var toIndexedObject = require('../internals/to-indexed-object');
- var toPropertyKey = require('../internals/to-property-key');
- var $toString = require('../internals/to-string');
- var createPropertyDescriptor = require('../internals/create-property-descriptor');
- var nativeObjectCreate = require('../internals/object-create');
- var objectKeys = require('../internals/object-keys');
- var getOwnPropertyNamesModule = require('../internals/object-get-own-property-names');
- var getOwnPropertyNamesExternal = require('../internals/object-get-own-property-names-external');
- var getOwnPropertySymbolsModule = require('../internals/object-get-own-property-symbols');
- var getOwnPropertyDescriptorModule = require('../internals/object-get-own-property-descriptor');
- var definePropertyModule = require('../internals/object-define-property');
- var propertyIsEnumerableModule = require('../internals/object-property-is-enumerable');
- var createNonEnumerableProperty = require('../internals/create-non-enumerable-property');
- var redefine = require('../internals/redefine');
- var shared = require('../internals/shared');
- var sharedKey = require('../internals/shared-key');
- var hiddenKeys = require('../internals/hidden-keys');
- var uid = require('../internals/uid');
- var wellKnownSymbol = require('../internals/well-known-symbol');
- var wrappedWellKnownSymbolModule = require('../internals/well-known-symbol-wrapped');
- var defineWellKnownSymbol = require('../internals/define-well-known-symbol');
- var setToStringTag = require('../internals/set-to-string-tag');
- var InternalStateModule = require('../internals/internal-state');
- var $forEach = require('../internals/array-iteration').forEach;
- var HIDDEN = sharedKey('hidden');
- var SYMBOL = 'Symbol';
- var PROTOTYPE = 'prototype';
- var TO_PRIMITIVE = wellKnownSymbol('toPrimitive');
- var setInternalState = InternalStateModule.set;
- var getInternalState = InternalStateModule.getterFor(SYMBOL);
- var ObjectPrototype = Object[PROTOTYPE];
- var $Symbol = global.Symbol;
- var $stringify = getBuiltIn('JSON', 'stringify');
- var nativeGetOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f;
- var nativeDefineProperty = definePropertyModule.f;
- var nativeGetOwnPropertyNames = getOwnPropertyNamesExternal.f;
- var nativePropertyIsEnumerable = propertyIsEnumerableModule.f;
- var AllSymbols = shared('symbols');
- var ObjectPrototypeSymbols = shared('op-symbols');
- var StringToSymbolRegistry = shared('string-to-symbol-registry');
- var SymbolToStringRegistry = shared('symbol-to-string-registry');
- var WellKnownSymbolsStore = shared('wks');
- var QObject = global.QObject;
- // Don't use setters in Qt Script, https://github.com/zloirock/core-js/issues/173
- var USE_SETTER = !QObject || !QObject[PROTOTYPE] || !QObject[PROTOTYPE].findChild;
- // fallback for old Android, https://code.google.com/p/v8/issues/detail?id=687
- var setSymbolDescriptor = DESCRIPTORS && fails(function () {
- return nativeObjectCreate(nativeDefineProperty({}, 'a', {
- get: function () { return nativeDefineProperty(this, 'a', { value: 7 }).a; }
- })).a != 7;
- }) ? function (O, P, Attributes) {
- var ObjectPrototypeDescriptor = nativeGetOwnPropertyDescriptor(ObjectPrototype, P);
- if (ObjectPrototypeDescriptor) delete ObjectPrototype[P];
- nativeDefineProperty(O, P, Attributes);
- if (ObjectPrototypeDescriptor && O !== ObjectPrototype) {
- nativeDefineProperty(ObjectPrototype, P, ObjectPrototypeDescriptor);
- }
- } : nativeDefineProperty;
- var wrap = function (tag, description) {
- var symbol = AllSymbols[tag] = nativeObjectCreate($Symbol[PROTOTYPE]);
- setInternalState(symbol, {
- type: SYMBOL,
- tag: tag,
- description: description
- });
- if (!DESCRIPTORS) symbol.description = description;
- return symbol;
- };
- var $defineProperty = function defineProperty(O, P, Attributes) {
- if (O === ObjectPrototype) $defineProperty(ObjectPrototypeSymbols, P, Attributes);
- anObject(O);
- var key = toPropertyKey(P);
- anObject(Attributes);
- if (has(AllSymbols, key)) {
- if (!Attributes.enumerable) {
- if (!has(O, HIDDEN)) nativeDefineProperty(O, HIDDEN, createPropertyDescriptor(1, {}));
- O[HIDDEN][key] = true;
- } else {
- if (has(O, HIDDEN) && O[HIDDEN][key]) O[HIDDEN][key] = false;
- Attributes = nativeObjectCreate(Attributes, { enumerable: createPropertyDescriptor(0, false) });
- } return setSymbolDescriptor(O, key, Attributes);
- } return nativeDefineProperty(O, key, Attributes);
- };
- var $defineProperties = function defineProperties(O, Properties) {
- anObject(O);
- var properties = toIndexedObject(Properties);
- var keys = objectKeys(properties).concat($getOwnPropertySymbols(properties));
- $forEach(keys, function (key) {
- if (!DESCRIPTORS || $propertyIsEnumerable.call(properties, key)) $defineProperty(O, key, properties[key]);
- });
- return O;
- };
- var $create = function create(O, Properties) {
- return Properties === undefined ? nativeObjectCreate(O) : $defineProperties(nativeObjectCreate(O), Properties);
- };
- var $propertyIsEnumerable = function propertyIsEnumerable(V) {
- var P = toPropertyKey(V);
- var enumerable = nativePropertyIsEnumerable.call(this, P);
- if (this === ObjectPrototype && has(AllSymbols, P) && !has(ObjectPrototypeSymbols, P)) return false;
- return enumerable || !has(this, P) || !has(AllSymbols, P) || has(this, HIDDEN) && this[HIDDEN][P] ? enumerable : true;
- };
- var $getOwnPropertyDescriptor = function getOwnPropertyDescriptor(O, P) {
- var it = toIndexedObject(O);
- var key = toPropertyKey(P);
- if (it === ObjectPrototype && has(AllSymbols, key) && !has(ObjectPrototypeSymbols, key)) return;
- var descriptor = nativeGetOwnPropertyDescriptor(it, key);
- if (descriptor && has(AllSymbols, key) && !(has(it, HIDDEN) && it[HIDDEN][key])) {
- descriptor.enumerable = true;
- }
- return descriptor;
- };
- var $getOwnPropertyNames = function getOwnPropertyNames(O) {
- var names = nativeGetOwnPropertyNames(toIndexedObject(O));
- var result = [];
- $forEach(names, function (key) {
- if (!has(AllSymbols, key) && !has(hiddenKeys, key)) result.push(key);
- });
- return result;
- };
- var $getOwnPropertySymbols = function getOwnPropertySymbols(O) {
- var IS_OBJECT_PROTOTYPE = O === ObjectPrototype;
- var names = nativeGetOwnPropertyNames(IS_OBJECT_PROTOTYPE ? ObjectPrototypeSymbols : toIndexedObject(O));
- var result = [];
- $forEach(names, function (key) {
- if (has(AllSymbols, key) && (!IS_OBJECT_PROTOTYPE || has(ObjectPrototype, key))) {
- result.push(AllSymbols[key]);
- }
- });
- return result;
- };
- // `Symbol` constructor
- // https://tc39.es/ecma262/#sec-symbol-constructor
- if (!NATIVE_SYMBOL) {
- $Symbol = function Symbol() {
- if (this instanceof $Symbol) throw TypeError('Symbol is not a constructor');
- var description = !arguments.length || arguments[0] === undefined ? undefined : $toString(arguments[0]);
- var tag = uid(description);
- var setter = function (value) {
- if (this === ObjectPrototype) setter.call(ObjectPrototypeSymbols, value);
- if (has(this, HIDDEN) && has(this[HIDDEN], tag)) this[HIDDEN][tag] = false;
- setSymbolDescriptor(this, tag, createPropertyDescriptor(1, value));
- };
- if (DESCRIPTORS && USE_SETTER) setSymbolDescriptor(ObjectPrototype, tag, { configurable: true, set: setter });
- return wrap(tag, description);
- };
- redefine($Symbol[PROTOTYPE], 'toString', function toString() {
- return getInternalState(this).tag;
- });
- redefine($Symbol, 'withoutSetter', function (description) {
- return wrap(uid(description), description);
- });
- propertyIsEnumerableModule.f = $propertyIsEnumerable;
- definePropertyModule.f = $defineProperty;
- getOwnPropertyDescriptorModule.f = $getOwnPropertyDescriptor;
- getOwnPropertyNamesModule.f = getOwnPropertyNamesExternal.f = $getOwnPropertyNames;
- getOwnPropertySymbolsModule.f = $getOwnPropertySymbols;
- wrappedWellKnownSymbolModule.f = function (name) {
- return wrap(wellKnownSymbol(name), name);
- };
- if (DESCRIPTORS) {
- // https://github.com/tc39/proposal-Symbol-description
- nativeDefineProperty($Symbol[PROTOTYPE], 'description', {
- configurable: true,
- get: function description() {
- return getInternalState(this).description;
- }
- });
- if (!IS_PURE) {
- redefine(ObjectPrototype, 'propertyIsEnumerable', $propertyIsEnumerable, { unsafe: true });
- }
- }
- }
- $({ global: true, wrap: true, forced: !NATIVE_SYMBOL, sham: !NATIVE_SYMBOL }, {
- Symbol: $Symbol
- });
- $forEach(objectKeys(WellKnownSymbolsStore), function (name) {
- defineWellKnownSymbol(name);
- });
- $({ target: SYMBOL, stat: true, forced: !NATIVE_SYMBOL }, {
- // `Symbol.for` method
- // https://tc39.es/ecma262/#sec-symbol.for
- 'for': function (key) {
- var string = $toString(key);
- if (has(StringToSymbolRegistry, string)) return StringToSymbolRegistry[string];
- var symbol = $Symbol(string);
- StringToSymbolRegistry[string] = symbol;
- SymbolToStringRegistry[symbol] = string;
- return symbol;
- },
- // `Symbol.keyFor` method
- // https://tc39.es/ecma262/#sec-symbol.keyfor
- keyFor: function keyFor(sym) {
- if (!isSymbol(sym)) throw TypeError(sym + ' is not a symbol');
- if (has(SymbolToStringRegistry, sym)) return SymbolToStringRegistry[sym];
- },
- useSetter: function () { USE_SETTER = true; },
- useSimple: function () { USE_SETTER = false; }
- });
- $({ target: 'Object', stat: true, forced: !NATIVE_SYMBOL, sham: !DESCRIPTORS }, {
- // `Object.create` method
- // https://tc39.es/ecma262/#sec-object.create
- create: $create,
- // `Object.defineProperty` method
- // https://tc39.es/ecma262/#sec-object.defineproperty
- defineProperty: $defineProperty,
- // `Object.defineProperties` method
- // https://tc39.es/ecma262/#sec-object.defineproperties
- defineProperties: $defineProperties,
- // `Object.getOwnPropertyDescriptor` method
- // https://tc39.es/ecma262/#sec-object.getownpropertydescriptors
- getOwnPropertyDescriptor: $getOwnPropertyDescriptor
- });
- $({ target: 'Object', stat: true, forced: !NATIVE_SYMBOL }, {
- // `Object.getOwnPropertyNames` method
- // https://tc39.es/ecma262/#sec-object.getownpropertynames
- getOwnPropertyNames: $getOwnPropertyNames,
- // `Object.getOwnPropertySymbols` method
- // https://tc39.es/ecma262/#sec-object.getownpropertysymbols
- getOwnPropertySymbols: $getOwnPropertySymbols
- });
- // Chrome 38 and 39 `Object.getOwnPropertySymbols` fails on primitives
- // https://bugs.chromium.org/p/v8/issues/detail?id=3443
- $({ target: 'Object', stat: true, forced: fails(function () { getOwnPropertySymbolsModule.f(1); }) }, {
- getOwnPropertySymbols: function getOwnPropertySymbols(it) {
- return getOwnPropertySymbolsModule.f(toObject(it));
- }
- });
- // `JSON.stringify` method behavior with symbols
- // https://tc39.es/ecma262/#sec-json.stringify
- if ($stringify) {
- var FORCED_JSON_STRINGIFY = !NATIVE_SYMBOL || fails(function () {
- var symbol = $Symbol();
- // MS Edge converts symbol values to JSON as {}
- return $stringify([symbol]) != '[null]'
- // WebKit converts symbol values to JSON as null
- || $stringify({ a: symbol }) != '{}'
- // V8 throws on boxed symbols
- || $stringify(Object(symbol)) != '{}';
- });
- $({ target: 'JSON', stat: true, forced: FORCED_JSON_STRINGIFY }, {
- // eslint-disable-next-line no-unused-vars -- required for `.length`
- stringify: function stringify(it, replacer, space) {
- var args = [it];
- var index = 1;
- var $replacer;
- while (arguments.length > index) args.push(arguments[index++]);
- $replacer = replacer;
- if (!isObject(replacer) && it === undefined || isSymbol(it)) return; // IE8 returns string on undefined
- if (!isArray(replacer)) replacer = function (key, value) {
- if (typeof $replacer == 'function') value = $replacer.call(this, key, value);
- if (!isSymbol(value)) return value;
- };
- args[1] = replacer;
- return $stringify.apply(null, args);
- }
- });
- }
- // `Symbol.prototype[@@toPrimitive]` method
- // https://tc39.es/ecma262/#sec-symbol.prototype-@@toprimitive
- if (!$Symbol[PROTOTYPE][TO_PRIMITIVE]) {
- createNonEnumerableProperty($Symbol[PROTOTYPE], TO_PRIMITIVE, $Symbol[PROTOTYPE].valueOf);
- }
- // `Symbol.prototype[@@toStringTag]` property
- // https://tc39.es/ecma262/#sec-symbol.prototype-@@tostringtag
- setToStringTag($Symbol, SYMBOL);
- hiddenKeys[HIDDEN] = true;
- },{"../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){
- 'use strict';
- var ArrayBufferViewCore = require('../internals/array-buffer-view-core');
- var $copyWithin = require('../internals/array-copy-within');
- var aTypedArray = ArrayBufferViewCore.aTypedArray;
- var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod;
- // `%TypedArray%.prototype.copyWithin` method
- // https://tc39.es/ecma262/#sec-%typedarray%.prototype.copywithin
- exportTypedArrayMethod('copyWithin', function copyWithin(target, start /* , end */) {
- return $copyWithin.call(aTypedArray(this), target, start, arguments.length > 2 ? arguments[2] : undefined);
- });
- },{"../internals/array-buffer-view-core":96,"../internals/array-copy-within":98}],273:[function(require,module,exports){
- 'use strict';
- var ArrayBufferViewCore = require('../internals/array-buffer-view-core');
- var $every = require('../internals/array-iteration').every;
- var aTypedArray = ArrayBufferViewCore.aTypedArray;
- var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod;
- // `%TypedArray%.prototype.every` method
- // https://tc39.es/ecma262/#sec-%typedarray%.prototype.every
- exportTypedArrayMethod('every', function every(callbackfn /* , thisArg */) {
- return $every(aTypedArray(this), callbackfn, arguments.length > 1 ? arguments[1] : undefined);
- });
- },{"../internals/array-buffer-view-core":96,"../internals/array-iteration":104}],274:[function(require,module,exports){
- 'use strict';
- var ArrayBufferViewCore = require('../internals/array-buffer-view-core');
- var $fill = require('../internals/array-fill');
- var aTypedArray = ArrayBufferViewCore.aTypedArray;
- var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod;
- // `%TypedArray%.prototype.fill` method
- // https://tc39.es/ecma262/#sec-%typedarray%.prototype.fill
- // eslint-disable-next-line no-unused-vars -- required for `.length`
- exportTypedArrayMethod('fill', function fill(value /* , start, end */) {
- return $fill.apply(aTypedArray(this), arguments);
- });
- },{"../internals/array-buffer-view-core":96,"../internals/array-fill":99}],275:[function(require,module,exports){
- 'use strict';
- var ArrayBufferViewCore = require('../internals/array-buffer-view-core');
- var $filter = require('../internals/array-iteration').filter;
- var fromSpeciesAndList = require('../internals/typed-array-from-species-and-list');
- var aTypedArray = ArrayBufferViewCore.aTypedArray;
- var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod;
- // `%TypedArray%.prototype.filter` method
- // https://tc39.es/ecma262/#sec-%typedarray%.prototype.filter
- exportTypedArrayMethod('filter', function filter(callbackfn /* , thisArg */) {
- var list = $filter(aTypedArray(this), callbackfn, arguments.length > 1 ? arguments[1] : undefined);
- return fromSpeciesAndList(this, list);
- });
- },{"../internals/array-buffer-view-core":96,"../internals/array-iteration":104,"../internals/typed-array-from-species-and-list":231}],276:[function(require,module,exports){
- 'use strict';
- var ArrayBufferViewCore = require('../internals/array-buffer-view-core');
- var $findIndex = require('../internals/array-iteration').findIndex;
- var aTypedArray = ArrayBufferViewCore.aTypedArray;
- var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod;
- // `%TypedArray%.prototype.findIndex` method
- // https://tc39.es/ecma262/#sec-%typedarray%.prototype.findindex
- exportTypedArrayMethod('findIndex', function findIndex(predicate /* , thisArg */) {
- return $findIndex(aTypedArray(this), predicate, arguments.length > 1 ? arguments[1] : undefined);
- });
- },{"../internals/array-buffer-view-core":96,"../internals/array-iteration":104}],277:[function(require,module,exports){
- 'use strict';
- var ArrayBufferViewCore = require('../internals/array-buffer-view-core');
- var $find = require('../internals/array-iteration').find;
- var aTypedArray = ArrayBufferViewCore.aTypedArray;
- var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod;
- // `%TypedArray%.prototype.find` method
- // https://tc39.es/ecma262/#sec-%typedarray%.prototype.find
- exportTypedArrayMethod('find', function find(predicate /* , thisArg */) {
- return $find(aTypedArray(this), predicate, arguments.length > 1 ? arguments[1] : undefined);
- });
- },{"../internals/array-buffer-view-core":96,"../internals/array-iteration":104}],278:[function(require,module,exports){
- 'use strict';
- var ArrayBufferViewCore = require('../internals/array-buffer-view-core');
- var $forEach = require('../internals/array-iteration').forEach;
- var aTypedArray = ArrayBufferViewCore.aTypedArray;
- var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod;
- // `%TypedArray%.prototype.forEach` method
- // https://tc39.es/ecma262/#sec-%typedarray%.prototype.foreach
- exportTypedArrayMethod('forEach', function forEach(callbackfn /* , thisArg */) {
- $forEach(aTypedArray(this), callbackfn, arguments.length > 1 ? arguments[1] : undefined);
- });
- },{"../internals/array-buffer-view-core":96,"../internals/array-iteration":104}],279:[function(require,module,exports){
- 'use strict';
- var ArrayBufferViewCore = require('../internals/array-buffer-view-core');
- var $includes = require('../internals/array-includes').includes;
- var aTypedArray = ArrayBufferViewCore.aTypedArray;
- var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod;
- // `%TypedArray%.prototype.includes` method
- // https://tc39.es/ecma262/#sec-%typedarray%.prototype.includes
- exportTypedArrayMethod('includes', function includes(searchElement /* , fromIndex */) {
- return $includes(aTypedArray(this), searchElement, arguments.length > 1 ? arguments[1] : undefined);
- });
- },{"../internals/array-buffer-view-core":96,"../internals/array-includes":103}],280:[function(require,module,exports){
- 'use strict';
- var ArrayBufferViewCore = require('../internals/array-buffer-view-core');
- var $indexOf = require('../internals/array-includes').indexOf;
- var aTypedArray = ArrayBufferViewCore.aTypedArray;
- var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod;
- // `%TypedArray%.prototype.indexOf` method
- // https://tc39.es/ecma262/#sec-%typedarray%.prototype.indexof
- exportTypedArrayMethod('indexOf', function indexOf(searchElement /* , fromIndex */) {
- return $indexOf(aTypedArray(this), searchElement, arguments.length > 1 ? arguments[1] : undefined);
- });
- },{"../internals/array-buffer-view-core":96,"../internals/array-includes":103}],281:[function(require,module,exports){
- 'use strict';
- var global = require('../internals/global');
- var ArrayBufferViewCore = require('../internals/array-buffer-view-core');
- var ArrayIterators = require('../modules/es.array.iterator');
- var wellKnownSymbol = require('../internals/well-known-symbol');
- var ITERATOR = wellKnownSymbol('iterator');
- var Uint8Array = global.Uint8Array;
- var arrayValues = ArrayIterators.values;
- var arrayKeys = ArrayIterators.keys;
- var arrayEntries = ArrayIterators.entries;
- var aTypedArray = ArrayBufferViewCore.aTypedArray;
- var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod;
- var nativeTypedArrayIterator = Uint8Array && Uint8Array.prototype[ITERATOR];
- var CORRECT_ITER_NAME = !!nativeTypedArrayIterator
- && (nativeTypedArrayIterator.name == 'values' || nativeTypedArrayIterator.name == undefined);
- var typedArrayValues = function values() {
- return arrayValues.call(aTypedArray(this));
- };
- // `%TypedArray%.prototype.entries` method
- // https://tc39.es/ecma262/#sec-%typedarray%.prototype.entries
- exportTypedArrayMethod('entries', function entries() {
- return arrayEntries.call(aTypedArray(this));
- });
- // `%TypedArray%.prototype.keys` method
- // https://tc39.es/ecma262/#sec-%typedarray%.prototype.keys
- exportTypedArrayMethod('keys', function keys() {
- return arrayKeys.call(aTypedArray(this));
- });
- // `%TypedArray%.prototype.values` method
- // https://tc39.es/ecma262/#sec-%typedarray%.prototype.values
- exportTypedArrayMethod('values', typedArrayValues, !CORRECT_ITER_NAME);
- // `%TypedArray%.prototype[@@iterator]` method
- // https://tc39.es/ecma262/#sec-%typedarray%.prototype-@@iterator
- exportTypedArrayMethod(ITERATOR, typedArrayValues, !CORRECT_ITER_NAME);
- },{"../internals/array-buffer-view-core":96,"../internals/global":147,"../internals/well-known-symbol":237,"../modules/es.array.iterator":247}],282:[function(require,module,exports){
- 'use strict';
- var ArrayBufferViewCore = require('../internals/array-buffer-view-core');
- var aTypedArray = ArrayBufferViewCore.aTypedArray;
- var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod;
- var $join = [].join;
- // `%TypedArray%.prototype.join` method
- // https://tc39.es/ecma262/#sec-%typedarray%.prototype.join
- // eslint-disable-next-line no-unused-vars -- required for `.length`
- exportTypedArrayMethod('join', function join(separator) {
- return $join.apply(aTypedArray(this), arguments);
- });
- },{"../internals/array-buffer-view-core":96}],283:[function(require,module,exports){
- 'use strict';
- var ArrayBufferViewCore = require('../internals/array-buffer-view-core');
- var $lastIndexOf = require('../internals/array-last-index-of');
- var aTypedArray = ArrayBufferViewCore.aTypedArray;
- var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod;
- // `%TypedArray%.prototype.lastIndexOf` method
- // https://tc39.es/ecma262/#sec-%typedarray%.prototype.lastindexof
- // eslint-disable-next-line no-unused-vars -- required for `.length`
- exportTypedArrayMethod('lastIndexOf', function lastIndexOf(searchElement /* , fromIndex */) {
- return $lastIndexOf.apply(aTypedArray(this), arguments);
- });
- },{"../internals/array-buffer-view-core":96,"../internals/array-last-index-of":105}],284:[function(require,module,exports){
- 'use strict';
- var ArrayBufferViewCore = require('../internals/array-buffer-view-core');
- var $map = require('../internals/array-iteration').map;
- var typedArraySpeciesConstructor = require('../internals/typed-array-species-constructor');
- var aTypedArray = ArrayBufferViewCore.aTypedArray;
- var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod;
- // `%TypedArray%.prototype.map` method
- // https://tc39.es/ecma262/#sec-%typedarray%.prototype.map
- exportTypedArrayMethod('map', function map(mapfn /* , thisArg */) {
- return $map(aTypedArray(this), mapfn, arguments.length > 1 ? arguments[1] : undefined, function (O, length) {
- return new (typedArraySpeciesConstructor(O))(length);
- });
- });
- },{"../internals/array-buffer-view-core":96,"../internals/array-iteration":104,"../internals/typed-array-species-constructor":233}],285:[function(require,module,exports){
- 'use strict';
- var ArrayBufferViewCore = require('../internals/array-buffer-view-core');
- var $reduceRight = require('../internals/array-reduce').right;
- var aTypedArray = ArrayBufferViewCore.aTypedArray;
- var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod;
- // `%TypedArray%.prototype.reduceRicht` method
- // https://tc39.es/ecma262/#sec-%typedarray%.prototype.reduceright
- exportTypedArrayMethod('reduceRight', function reduceRight(callbackfn /* , initialValue */) {
- return $reduceRight(aTypedArray(this), callbackfn, arguments.length, arguments.length > 1 ? arguments[1] : undefined);
- });
- },{"../internals/array-buffer-view-core":96,"../internals/array-reduce":108}],286:[function(require,module,exports){
- 'use strict';
- var ArrayBufferViewCore = require('../internals/array-buffer-view-core');
- var $reduce = require('../internals/array-reduce').left;
- var aTypedArray = ArrayBufferViewCore.aTypedArray;
- var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod;
- // `%TypedArray%.prototype.reduce` method
- // https://tc39.es/ecma262/#sec-%typedarray%.prototype.reduce
- exportTypedArrayMethod('reduce', function reduce(callbackfn /* , initialValue */) {
- return $reduce(aTypedArray(this), callbackfn, arguments.length, arguments.length > 1 ? arguments[1] : undefined);
- });
- },{"../internals/array-buffer-view-core":96,"../internals/array-reduce":108}],287:[function(require,module,exports){
- 'use strict';
- var ArrayBufferViewCore = require('../internals/array-buffer-view-core');
- var aTypedArray = ArrayBufferViewCore.aTypedArray;
- var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod;
- var floor = Math.floor;
- // `%TypedArray%.prototype.reverse` method
- // https://tc39.es/ecma262/#sec-%typedarray%.prototype.reverse
- exportTypedArrayMethod('reverse', function reverse() {
- var that = this;
- var length = aTypedArray(that).length;
- var middle = floor(length / 2);
- var index = 0;
- var value;
- while (index < middle) {
- value = that[index];
- that[index++] = that[--length];
- that[length] = value;
- } return that;
- });
- },{"../internals/array-buffer-view-core":96}],288:[function(require,module,exports){
- 'use strict';
- var ArrayBufferViewCore = require('../internals/array-buffer-view-core');
- var toLength = require('../internals/to-length');
- var toOffset = require('../internals/to-offset');
- var toObject = require('../internals/to-object');
- var fails = require('../internals/fails');
- var aTypedArray = ArrayBufferViewCore.aTypedArray;
- var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod;
- var FORCED = fails(function () {
- // eslint-disable-next-line es/no-typed-arrays -- required for testing
- new Int8Array(1).set({});
- });
- // `%TypedArray%.prototype.set` method
- // https://tc39.es/ecma262/#sec-%typedarray%.prototype.set
- exportTypedArrayMethod('set', function set(arrayLike /* , offset */) {
- aTypedArray(this);
- var offset = toOffset(arguments.length > 1 ? arguments[1] : undefined, 1);
- var length = this.length;
- var src = toObject(arrayLike);
- var len = toLength(src.length);
- var index = 0;
- if (len + offset > length) throw RangeError('Wrong length');
- while (index < len) this[offset + index] = src[index++];
- }, FORCED);
- },{"../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){
- 'use strict';
- var ArrayBufferViewCore = require('../internals/array-buffer-view-core');
- var typedArraySpeciesConstructor = require('../internals/typed-array-species-constructor');
- var fails = require('../internals/fails');
- var aTypedArray = ArrayBufferViewCore.aTypedArray;
- var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod;
- var $slice = [].slice;
- var FORCED = fails(function () {
- // eslint-disable-next-line es/no-typed-arrays -- required for testing
- new Int8Array(1).slice();
- });
- // `%TypedArray%.prototype.slice` method
- // https://tc39.es/ecma262/#sec-%typedarray%.prototype.slice
- exportTypedArrayMethod('slice', function slice(start, end) {
- var list = $slice.call(aTypedArray(this), start, end);
- var C = typedArraySpeciesConstructor(this);
- var index = 0;
- var length = list.length;
- var result = new C(length);
- while (length > index) result[index] = list[index++];
- return result;
- }, FORCED);
- },{"../internals/array-buffer-view-core":96,"../internals/fails":140,"../internals/typed-array-species-constructor":233}],290:[function(require,module,exports){
- 'use strict';
- var ArrayBufferViewCore = require('../internals/array-buffer-view-core');
- var $some = require('../internals/array-iteration').some;
- var aTypedArray = ArrayBufferViewCore.aTypedArray;
- var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod;
- // `%TypedArray%.prototype.some` method
- // https://tc39.es/ecma262/#sec-%typedarray%.prototype.some
- exportTypedArrayMethod('some', function some(callbackfn /* , thisArg */) {
- return $some(aTypedArray(this), callbackfn, arguments.length > 1 ? arguments[1] : undefined);
- });
- },{"../internals/array-buffer-view-core":96,"../internals/array-iteration":104}],291:[function(require,module,exports){
- 'use strict';
- var ArrayBufferViewCore = require('../internals/array-buffer-view-core');
- var global = require('../internals/global');
- var fails = require('../internals/fails');
- var aFunction = require('../internals/a-function');
- var toLength = require('../internals/to-length');
- var internalSort = require('../internals/array-sort');
- var FF = require('../internals/engine-ff-version');
- var IE_OR_EDGE = require('../internals/engine-is-ie-or-edge');
- var V8 = require('../internals/engine-v8-version');
- var WEBKIT = require('../internals/engine-webkit-version');
- var aTypedArray = ArrayBufferViewCore.aTypedArray;
- var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod;
- var Uint16Array = global.Uint16Array;
- var nativeSort = Uint16Array && Uint16Array.prototype.sort;
- // WebKit
- var ACCEPT_INCORRECT_ARGUMENTS = !!nativeSort && !fails(function () {
- var array = new Uint16Array(2);
- array.sort(null);
- array.sort({});
- });
- var STABLE_SORT = !!nativeSort && !fails(function () {
- // feature detection can be too slow, so check engines versions
- if (V8) return V8 < 74;
- if (FF) return FF < 67;
- if (IE_OR_EDGE) return true;
- if (WEBKIT) return WEBKIT < 602;
- var array = new Uint16Array(516);
- var expected = Array(516);
- var index, mod;
- for (index = 0; index < 516; index++) {
- mod = index % 4;
- array[index] = 515 - index;
- expected[index] = index - 2 * mod + 3;
- }
- array.sort(function (a, b) {
- return (a / 4 | 0) - (b / 4 | 0);
- });
- for (index = 0; index < 516; index++) {
- if (array[index] !== expected[index]) return true;
- }
- });
- var getSortCompare = function (comparefn) {
- return function (x, y) {
- if (comparefn !== undefined) return +comparefn(x, y) || 0;
- // eslint-disable-next-line no-self-compare -- NaN check
- if (y !== y) return -1;
- // eslint-disable-next-line no-self-compare -- NaN check
- if (x !== x) return 1;
- if (x === 0 && y === 0) return 1 / x > 0 && 1 / y < 0 ? 1 : -1;
- return x > y;
- };
- };
- // `%TypedArray%.prototype.sort` method
- // https://tc39.es/ecma262/#sec-%typedarray%.prototype.sort
- exportTypedArrayMethod('sort', function sort(comparefn) {
- var array = this;
- if (comparefn !== undefined) aFunction(comparefn);
- if (STABLE_SORT) return nativeSort.call(array, comparefn);
- aTypedArray(array);
- var arrayLength = toLength(array.length);
- var items = Array(arrayLength);
- var index;
- for (index = 0; index < arrayLength; index++) {
- items[index] = array[index];
- }
- items = internalSort(array, getSortCompare(comparefn));
- for (index = 0; index < arrayLength; index++) {
- array[index] = items[index];
- }
- return array;
- }, !STABLE_SORT || ACCEPT_INCORRECT_ARGUMENTS);
- },{"../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){
- 'use strict';
- var ArrayBufferViewCore = require('../internals/array-buffer-view-core');
- var toLength = require('../internals/to-length');
- var toAbsoluteIndex = require('../internals/to-absolute-index');
- var typedArraySpeciesConstructor = require('../internals/typed-array-species-constructor');
- var aTypedArray = ArrayBufferViewCore.aTypedArray;
- var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod;
- // `%TypedArray%.prototype.subarray` method
- // https://tc39.es/ecma262/#sec-%typedarray%.prototype.subarray
- exportTypedArrayMethod('subarray', function subarray(begin, end) {
- var O = aTypedArray(this);
- var length = O.length;
- var beginIndex = toAbsoluteIndex(begin, length);
- var C = typedArraySpeciesConstructor(O);
- return new C(
- O.buffer,
- O.byteOffset + beginIndex * O.BYTES_PER_ELEMENT,
- toLength((end === undefined ? length : toAbsoluteIndex(end, length)) - beginIndex)
- );
- });
- },{"../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){
- 'use strict';
- var global = require('../internals/global');
- var ArrayBufferViewCore = require('../internals/array-buffer-view-core');
- var fails = require('../internals/fails');
- var Int8Array = global.Int8Array;
- var aTypedArray = ArrayBufferViewCore.aTypedArray;
- var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod;
- var $toLocaleString = [].toLocaleString;
- var $slice = [].slice;
- // iOS Safari 6.x fails here
- var TO_LOCALE_STRING_BUG = !!Int8Array && fails(function () {
- $toLocaleString.call(new Int8Array(1));
- });
- var FORCED = fails(function () {
- return [1, 2].toLocaleString() != new Int8Array([1, 2]).toLocaleString();
- }) || !fails(function () {
- Int8Array.prototype.toLocaleString.call([1, 2]);
- });
- // `%TypedArray%.prototype.toLocaleString` method
- // https://tc39.es/ecma262/#sec-%typedarray%.prototype.tolocalestring
- exportTypedArrayMethod('toLocaleString', function toLocaleString() {
- return $toLocaleString.apply(TO_LOCALE_STRING_BUG ? $slice.call(aTypedArray(this)) : aTypedArray(this), arguments);
- }, FORCED);
- },{"../internals/array-buffer-view-core":96,"../internals/fails":140,"../internals/global":147}],294:[function(require,module,exports){
- 'use strict';
- var exportTypedArrayMethod = require('../internals/array-buffer-view-core').exportTypedArrayMethod;
- var fails = require('../internals/fails');
- var global = require('../internals/global');
- var Uint8Array = global.Uint8Array;
- var Uint8ArrayPrototype = Uint8Array && Uint8Array.prototype || {};
- var arrayToString = [].toString;
- var arrayJoin = [].join;
- if (fails(function () { arrayToString.call({}); })) {
- arrayToString = function toString() {
- return arrayJoin.call(this);
- };
- }
- var IS_NOT_ARRAY_METHOD = Uint8ArrayPrototype.toString != arrayToString;
- // `%TypedArray%.prototype.toString` method
- // https://tc39.es/ecma262/#sec-%typedarray%.prototype.tostring
- exportTypedArrayMethod('toString', arrayToString, IS_NOT_ARRAY_METHOD);
- },{"../internals/array-buffer-view-core":96,"../internals/fails":140,"../internals/global":147}],295:[function(require,module,exports){
- var createTypedArrayConstructor = require('../internals/typed-array-constructor');
- // `Uint8Array` constructor
- // https://tc39.es/ecma262/#sec-typedarray-objects
- createTypedArrayConstructor('Uint8', function (init) {
- return function Uint8Array(data, byteOffset, length) {
- return init(this, data, byteOffset, length);
- };
- });
- },{"../internals/typed-array-constructor":229}],296:[function(require,module,exports){
- var global = require('../internals/global');
- var DOMIterables = require('../internals/dom-iterables');
- var forEach = require('../internals/array-for-each');
- var createNonEnumerableProperty = require('../internals/create-non-enumerable-property');
- for (var COLLECTION_NAME in DOMIterables) {
- var Collection = global[COLLECTION_NAME];
- var CollectionPrototype = Collection && Collection.prototype;
- // some Chrome versions have non-configurable methods on DOMTokenList
- if (CollectionPrototype && CollectionPrototype.forEach !== forEach) try {
- createNonEnumerableProperty(CollectionPrototype, 'forEach', forEach);
- } catch (error) {
- CollectionPrototype.forEach = forEach;
- }
- }
- },{"../internals/array-for-each":100,"../internals/create-non-enumerable-property":120,"../internals/dom-iterables":127,"../internals/global":147}],297:[function(require,module,exports){
- var global = require('../internals/global');
- var DOMIterables = require('../internals/dom-iterables');
- var ArrayIteratorMethods = require('../modules/es.array.iterator');
- var createNonEnumerableProperty = require('../internals/create-non-enumerable-property');
- var wellKnownSymbol = require('../internals/well-known-symbol');
- var ITERATOR = wellKnownSymbol('iterator');
- var TO_STRING_TAG = wellKnownSymbol('toStringTag');
- var ArrayValues = ArrayIteratorMethods.values;
- for (var COLLECTION_NAME in DOMIterables) {
- var Collection = global[COLLECTION_NAME];
- var CollectionPrototype = Collection && Collection.prototype;
- if (CollectionPrototype) {
- // some Chrome versions have non-configurable methods on DOMTokenList
- if (CollectionPrototype[ITERATOR] !== ArrayValues) try {
- createNonEnumerableProperty(CollectionPrototype, ITERATOR, ArrayValues);
- } catch (error) {
- CollectionPrototype[ITERATOR] = ArrayValues;
- }
- if (!CollectionPrototype[TO_STRING_TAG]) {
- createNonEnumerableProperty(CollectionPrototype, TO_STRING_TAG, COLLECTION_NAME);
- }
- if (DOMIterables[COLLECTION_NAME]) for (var METHOD_NAME in ArrayIteratorMethods) {
- // some Chrome versions have non-configurable methods on DOMTokenList
- if (CollectionPrototype[METHOD_NAME] !== ArrayIteratorMethods[METHOD_NAME]) try {
- createNonEnumerableProperty(CollectionPrototype, METHOD_NAME, ArrayIteratorMethods[METHOD_NAME]);
- } catch (error) {
- CollectionPrototype[METHOD_NAME] = ArrayIteratorMethods[METHOD_NAME];
- }
- }
- }
- }
- },{"../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){
- // Copyright Joyent, Inc. and other Node contributors.
- //
- // Permission is hereby granted, free of charge, to any person obtaining a
- // copy of this software and associated documentation files (the
- // "Software"), to deal in the Software without restriction, including
- // without limitation the rights to use, copy, modify, merge, publish,
- // distribute, sublicense, and/or sell copies of the Software, and to permit
- // persons to whom the Software is furnished to do so, subject to the
- // following conditions:
- //
- // The above copyright notice and this permission notice shall be included
- // in all copies or substantial portions of the Software.
- //
- // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
- // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
- // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
- // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
- // USE OR OTHER DEALINGS IN THE SOFTWARE.
- // NOTE: These type checking functions intentionally don't use `instanceof`
- // because it is fragile and can be easily faked with `Object.create()`.
- function isArray(arg) {
- if (Array.isArray) {
- return Array.isArray(arg);
- }
- return objectToString(arg) === '[object Array]';
- }
- exports.isArray = isArray;
- function isBoolean(arg) {
- return typeof arg === 'boolean';
- }
- exports.isBoolean = isBoolean;
- function isNull(arg) {
- return arg === null;
- }
- exports.isNull = isNull;
- function isNullOrUndefined(arg) {
- return arg == null;
- }
- exports.isNullOrUndefined = isNullOrUndefined;
- function isNumber(arg) {
- return typeof arg === 'number';
- }
- exports.isNumber = isNumber;
- function isString(arg) {
- return typeof arg === 'string';
- }
- exports.isString = isString;
- function isSymbol(arg) {
- return typeof arg === 'symbol';
- }
- exports.isSymbol = isSymbol;
- function isUndefined(arg) {
- return arg === void 0;
- }
- exports.isUndefined = isUndefined;
- function isRegExp(re) {
- return objectToString(re) === '[object RegExp]';
- }
- exports.isRegExp = isRegExp;
- function isObject(arg) {
- return typeof arg === 'object' && arg !== null;
- }
- exports.isObject = isObject;
- function isDate(d) {
- return objectToString(d) === '[object Date]';
- }
- exports.isDate = isDate;
- function isError(e) {
- return (objectToString(e) === '[object Error]' || e instanceof Error);
- }
- exports.isError = isError;
- function isFunction(arg) {
- return typeof arg === 'function';
- }
- exports.isFunction = isFunction;
- function isPrimitive(arg) {
- return arg === null ||
- typeof arg === 'boolean' ||
- typeof arg === 'number' ||
- typeof arg === 'string' ||
- typeof arg === 'symbol' || // ES6 symbol
- typeof arg === 'undefined';
- }
- exports.isPrimitive = isPrimitive;
- exports.isBuffer = require('buffer').Buffer.isBuffer;
- function objectToString(o) {
- return Object.prototype.toString.call(o);
- }
- },{"buffer":85}],299:[function(require,module,exports){
- /*
- * Date Format 1.2.3
- * (c) 2007-2009 Steven Levithan <stevenlevithan.com>
- * MIT license
- *
- * Includes enhancements by Scott Trenda <scott.trenda.net>
- * and Kris Kowal <cixar.com/~kris.kowal/>
- *
- * Accepts a date, a mask, or a date and a mask.
- * Returns a formatted version of the given date.
- * The date defaults to the current date/time.
- * The mask defaults to dateFormat.masks.default.
- */
- (function(global) {
- 'use strict';
- var dateFormat = (function() {
- var token = /d{1,4}|m{1,4}|yy(?:yy)?|([HhMsTt])\1?|[LloSZWN]|'[^']*'|'[^']*'/g;
- var timezone = /\b(?:[PMCEA][SDP]T|(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time|(?:GMT|UTC)(?:[-+]\d{4})?)\b/g;
- var timezoneClip = /[^-+\dA-Z]/g;
-
- // Regexes and supporting functions are cached through closure
- return function (date, mask, utc, gmt) {
-
- // You can't provide utc if you skip other args (use the 'UTC:' mask prefix)
- if (arguments.length === 1 && kindOf(date) === 'string' && !/\d/.test(date)) {
- mask = date;
- date = undefined;
- }
-
- date = date || new Date;
-
- if(!(date instanceof Date)) {
- date = new Date(date);
- }
-
- if (isNaN(date)) {
- throw TypeError('Invalid date');
- }
-
- mask = String(dateFormat.masks[mask] || mask || dateFormat.masks['default']);
-
- // Allow setting the utc/gmt argument via the mask
- var maskSlice = mask.slice(0, 4);
- if (maskSlice === 'UTC:' || maskSlice === 'GMT:') {
- mask = mask.slice(4);
- utc = true;
- if (maskSlice === 'GMT:') {
- gmt = true;
- }
- }
-
- var _ = utc ? 'getUTC' : 'get';
- var d = date[_ + 'Date']();
- var D = date[_ + 'Day']();
- var m = date[_ + 'Month']();
- var y = date[_ + 'FullYear']();
- var H = date[_ + 'Hours']();
- var M = date[_ + 'Minutes']();
- var s = date[_ + 'Seconds']();
- var L = date[_ + 'Milliseconds']();
- var o = utc ? 0 : date.getTimezoneOffset();
- var W = getWeek(date);
- var N = getDayOfWeek(date);
- var flags = {
- d: d,
- dd: pad(d),
- ddd: dateFormat.i18n.dayNames[D],
- dddd: dateFormat.i18n.dayNames[D + 7],
- m: m + 1,
- mm: pad(m + 1),
- mmm: dateFormat.i18n.monthNames[m],
- mmmm: dateFormat.i18n.monthNames[m + 12],
- yy: String(y).slice(2),
- yyyy: y,
- h: H % 12 || 12,
- hh: pad(H % 12 || 12),
- H: H,
- HH: pad(H),
- M: M,
- MM: pad(M),
- s: s,
- ss: pad(s),
- l: pad(L, 3),
- L: pad(Math.round(L / 10)),
- t: H < 12 ? 'a' : 'p',
- tt: H < 12 ? 'am' : 'pm',
- T: H < 12 ? 'A' : 'P',
- TT: H < 12 ? 'AM' : 'PM',
- Z: gmt ? 'GMT' : utc ? 'UTC' : (String(date).match(timezone) || ['']).pop().replace(timezoneClip, ''),
- o: (o > 0 ? '-' : '+') + pad(Math.floor(Math.abs(o) / 60) * 100 + Math.abs(o) % 60, 4),
- S: ['th', 'st', 'nd', 'rd'][d % 10 > 3 ? 0 : (d % 100 - d % 10 != 10) * d % 10],
- W: W,
- N: N
- };
-
- return mask.replace(token, function (match) {
- if (match in flags) {
- return flags[match];
- }
- return match.slice(1, match.length - 1);
- });
- };
- })();
- dateFormat.masks = {
- 'default': 'ddd mmm dd yyyy HH:MM:ss',
- 'shortDate': 'm/d/yy',
- 'mediumDate': 'mmm d, yyyy',
- 'longDate': 'mmmm d, yyyy',
- 'fullDate': 'dddd, mmmm d, yyyy',
- 'shortTime': 'h:MM TT',
- 'mediumTime': 'h:MM:ss TT',
- 'longTime': 'h:MM:ss TT Z',
- 'isoDate': 'yyyy-mm-dd',
- 'isoTime': 'HH:MM:ss',
- 'isoDateTime': 'yyyy-mm-dd\'T\'HH:MM:sso',
- 'isoUtcDateTime': 'UTC:yyyy-mm-dd\'T\'HH:MM:ss\'Z\'',
- 'expiresHeaderFormat': 'ddd, dd mmm yyyy HH:MM:ss Z'
- };
- // Internationalization strings
- dateFormat.i18n = {
- dayNames: [
- 'Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat',
- 'Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'
- ],
- monthNames: [
- 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec',
- 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'
- ]
- };
- function pad(val, len) {
- val = String(val);
- len = len || 2;
- while (val.length < len) {
- val = '0' + val;
- }
- return val;
- }
- /**
- * Get the ISO 8601 week number
- * Based on comments from
- * http://techblog.procurios.nl/k/n618/news/view/33796/14863/Calculate-ISO-8601-week-and-year-in-javascript.html
- *
- * @param {Object} `date`
- * @return {Number}
- */
- function getWeek(date) {
- // Remove time components of date
- var targetThursday = new Date(date.getFullYear(), date.getMonth(), date.getDate());
- // Change date to Thursday same week
- targetThursday.setDate(targetThursday.getDate() - ((targetThursday.getDay() + 6) % 7) + 3);
- // Take January 4th as it is always in week 1 (see ISO 8601)
- var firstThursday = new Date(targetThursday.getFullYear(), 0, 4);
- // Change date to Thursday same week
- firstThursday.setDate(firstThursday.getDate() - ((firstThursday.getDay() + 6) % 7) + 3);
- // Check if daylight-saving-time-switch occurred and correct for it
- var ds = targetThursday.getTimezoneOffset() - firstThursday.getTimezoneOffset();
- targetThursday.setHours(targetThursday.getHours() - ds);
- // Number of weeks between target Thursday and first Thursday
- var weekDiff = (targetThursday - firstThursday) / (86400000*7);
- return 1 + Math.floor(weekDiff);
- }
- /**
- * Get ISO-8601 numeric representation of the day of the week
- * 1 (for Monday) through 7 (for Sunday)
- *
- * @param {Object} `date`
- * @return {Number}
- */
- function getDayOfWeek(date) {
- var dow = date.getDay();
- if(dow === 0) {
- dow = 7;
- }
- return dow;
- }
- /**
- * kind-of shortcut
- * @param {*} val
- * @return {String}
- */
- function kindOf(val) {
- if (val === null) {
- return 'null';
- }
- if (val === undefined) {
- return 'undefined';
- }
- if (typeof val !== 'object') {
- return typeof val;
- }
- if (Array.isArray(val)) {
- return 'array';
- }
- return {}.toString.call(val)
- .slice(8, -1).toLowerCase();
- };
- if (typeof define === 'function' && define.amd) {
- define(function () {
- return dateFormat;
- });
- } else if (typeof exports === 'object') {
- module.exports = dateFormat;
- } else {
- global.dateFormat = dateFormat;
- }
- })(this);
- },{}],300:[function(require,module,exports){
- /*!
- * escape-html
- * Copyright(c) 2012-2013 TJ Holowaychuk
- * Copyright(c) 2015 Andreas Lubbe
- * Copyright(c) 2015 Tiancheng "Timothy" Gu
- * MIT Licensed
- */
- 'use strict';
- /**
- * Module variables.
- * @private
- */
- var matchHtmlRegExp = /["'&<>]/;
- /**
- * Module exports.
- * @public
- */
- module.exports = escapeHtml;
- /**
- * Escape special characters in the given string of html.
- *
- * @param {string} string The string to escape for inserting into HTML
- * @return {string}
- * @public
- */
- function escapeHtml(string) {
- var str = '' + string;
- var match = matchHtmlRegExp.exec(str);
- if (!match) {
- return str;
- }
- var escape;
- var html = '';
- var index = 0;
- var lastIndex = 0;
- for (index = match.index; index < str.length; index++) {
- switch (str.charCodeAt(index)) {
- case 34: // "
- escape = '"';
- break;
- case 38: // &
- escape = '&';
- break;
- case 39: // '
- escape = ''';
- break;
- case 60: // <
- escape = '<';
- break;
- case 62: // >
- escape = '>';
- break;
- default:
- continue;
- }
- if (lastIndex !== index) {
- html += str.substring(lastIndex, index);
- }
- lastIndex = index + 1;
- html += escape;
- }
- return lastIndex !== index
- ? html + str.substring(lastIndex, index)
- : html;
- }
- },{}],301:[function(require,module,exports){
- // Copyright Joyent, Inc. and other Node contributors.
- //
- // Permission is hereby granted, free of charge, to any person obtaining a
- // copy of this software and associated documentation files (the
- // "Software"), to deal in the Software without restriction, including
- // without limitation the rights to use, copy, modify, merge, publish,
- // distribute, sublicense, and/or sell copies of the Software, and to permit
- // persons to whom the Software is furnished to do so, subject to the
- // following conditions:
- //
- // The above copyright notice and this permission notice shall be included
- // in all copies or substantial portions of the Software.
- //
- // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
- // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
- // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
- // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
- // USE OR OTHER DEALINGS IN THE SOFTWARE.
- function EventEmitter() {
- this._events = this._events || {};
- this._maxListeners = this._maxListeners || undefined;
- }
- module.exports = EventEmitter;
- // Backwards-compat with node 0.10.x
- EventEmitter.EventEmitter = EventEmitter;
- EventEmitter.prototype._events = undefined;
- EventEmitter.prototype._maxListeners = undefined;
- // By default EventEmitters will print a warning if more than 10 listeners are
- // added to it. This is a useful default which helps finding memory leaks.
- EventEmitter.defaultMaxListeners = 10;
- // Obviously not all Emitters should be limited to 10. This function allows
- // that to be increased. Set to zero for unlimited.
- EventEmitter.prototype.setMaxListeners = function(n) {
- if (!isNumber(n) || n < 0 || isNaN(n))
- throw TypeError('n must be a positive number');
- this._maxListeners = n;
- return this;
- };
- EventEmitter.prototype.emit = function(type) {
- var er, handler, len, args, i, listeners;
- if (!this._events)
- this._events = {};
- // If there is no 'error' event listener then throw.
- if (type === 'error') {
- if (!this._events.error ||
- (isObject(this._events.error) && !this._events.error.length)) {
- er = arguments[1];
- if (er instanceof Error) {
- throw er; // Unhandled 'error' event
- } else {
- // At least give some kind of context to the user
- var err = new Error('Uncaught, unspecified "error" event. (' + er + ')');
- err.context = er;
- throw err;
- }
- }
- }
- handler = this._events[type];
- if (isUndefined(handler))
- return false;
- if (isFunction(handler)) {
- switch (arguments.length) {
- // fast cases
- case 1:
- handler.call(this);
- break;
- case 2:
- handler.call(this, arguments[1]);
- break;
- case 3:
- handler.call(this, arguments[1], arguments[2]);
- break;
- // slower
- default:
- args = Array.prototype.slice.call(arguments, 1);
- handler.apply(this, args);
- }
- } else if (isObject(handler)) {
- args = Array.prototype.slice.call(arguments, 1);
- listeners = handler.slice();
- len = listeners.length;
- for (i = 0; i < len; i++)
- listeners[i].apply(this, args);
- }
- return true;
- };
- EventEmitter.prototype.addListener = function(type, listener) {
- var m;
- if (!isFunction(listener))
- throw TypeError('listener must be a function');
- if (!this._events)
- this._events = {};
- // To avoid recursion in the case that type === "newListener"! Before
- // adding it to the listeners, first emit "newListener".
- if (this._events.newListener)
- this.emit('newListener', type,
- isFunction(listener.listener) ?
- listener.listener : listener);
- if (!this._events[type])
- // Optimize the case of one listener. Don't need the extra array object.
- this._events[type] = listener;
- else if (isObject(this._events[type]))
- // If we've already got an array, just append.
- this._events[type].push(listener);
- else
- // Adding the second element, need to change to array.
- this._events[type] = [this._events[type], listener];
- // Check for listener leak
- if (isObject(this._events[type]) && !this._events[type].warned) {
- if (!isUndefined(this._maxListeners)) {
- m = this._maxListeners;
- } else {
- m = EventEmitter.defaultMaxListeners;
- }
- if (m && m > 0 && this._events[type].length > m) {
- this._events[type].warned = true;
- console.error('(node) warning: possible EventEmitter memory ' +
- 'leak detected. %d listeners added. ' +
- 'Use emitter.setMaxListeners() to increase limit.',
- this._events[type].length);
- if (typeof console.trace === 'function') {
- // not supported in IE 10
- console.trace();
- }
- }
- }
- return this;
- };
- EventEmitter.prototype.on = EventEmitter.prototype.addListener;
- EventEmitter.prototype.once = function(type, listener) {
- if (!isFunction(listener))
- throw TypeError('listener must be a function');
- var fired = false;
- function g() {
- this.removeListener(type, g);
- if (!fired) {
- fired = true;
- listener.apply(this, arguments);
- }
- }
- g.listener = listener;
- this.on(type, g);
- return this;
- };
- // emits a 'removeListener' event iff the listener was removed
- EventEmitter.prototype.removeListener = function(type, listener) {
- var list, position, length, i;
- if (!isFunction(listener))
- throw TypeError('listener must be a function');
- if (!this._events || !this._events[type])
- return this;
- list = this._events[type];
- length = list.length;
- position = -1;
- if (list === listener ||
- (isFunction(list.listener) && list.listener === listener)) {
- delete this._events[type];
- if (this._events.removeListener)
- this.emit('removeListener', type, listener);
- } else if (isObject(list)) {
- for (i = length; i-- > 0;) {
- if (list[i] === listener ||
- (list[i].listener && list[i].listener === listener)) {
- position = i;
- break;
- }
- }
- if (position < 0)
- return this;
- if (list.length === 1) {
- list.length = 0;
- delete this._events[type];
- } else {
- list.splice(position, 1);
- }
- if (this._events.removeListener)
- this.emit('removeListener', type, listener);
- }
- return this;
- };
- EventEmitter.prototype.removeAllListeners = function(type) {
- var key, listeners;
- if (!this._events)
- return this;
- // not listening for removeListener, no need to emit
- if (!this._events.removeListener) {
- if (arguments.length === 0)
- this._events = {};
- else if (this._events[type])
- delete this._events[type];
- return this;
- }
- // emit removeListener for all listeners on all events
- if (arguments.length === 0) {
- for (key in this._events) {
- if (key === 'removeListener') continue;
- this.removeAllListeners(key);
- }
- this.removeAllListeners('removeListener');
- this._events = {};
- return this;
- }
- listeners = this._events[type];
- if (isFunction(listeners)) {
- this.removeListener(type, listeners);
- } else if (listeners) {
- // LIFO order
- while (listeners.length)
- this.removeListener(type, listeners[listeners.length - 1]);
- }
- delete this._events[type];
- return this;
- };
- EventEmitter.prototype.listeners = function(type) {
- var ret;
- if (!this._events || !this._events[type])
- ret = [];
- else if (isFunction(this._events[type]))
- ret = [this._events[type]];
- else
- ret = this._events[type].slice();
- return ret;
- };
- EventEmitter.prototype.listenerCount = function(type) {
- if (this._events) {
- var evlistener = this._events[type];
- if (isFunction(evlistener))
- return 1;
- else if (evlistener)
- return evlistener.length;
- }
- return 0;
- };
- EventEmitter.listenerCount = function(emitter, type) {
- return emitter.listenerCount(type);
- };
- function isFunction(arg) {
- return typeof arg === 'function';
- }
- function isNumber(arg) {
- return typeof arg === 'number';
- }
- function isObject(arg) {
- return typeof arg === 'object' && arg !== null;
- }
- function isUndefined(arg) {
- return arg === void 0;
- }
- },{}],302:[function(require,module,exports){
- var http = require('http');
- var https = module.exports;
- for (var key in http) {
- if (http.hasOwnProperty(key)) https[key] = http[key];
- };
- https.request = function (params, cb) {
- if (!params) params = {};
- params.scheme = 'https';
- params.protocol = 'https:';
- return http.request.call(this, params, cb);
- }
- },{"http":400}],303:[function(require,module,exports){
- /*!
- * humanize-ms - index.js
- * Copyright(c) 2014 dead_horse <dead_horse@qq.com>
- * MIT Licensed
- */
- 'use strict';
- /**
- * Module dependencies.
- */
- var util = require('util');
- var ms = require('ms');
- module.exports = function (t) {
- if (typeof t === 'number') return t;
- var r = ms(t);
- if (r === undefined) {
- var err = new Error(util.format('humanize-ms(%j) result undefined', t));
- console.warn(err.stack);
- }
- return r;
- };
- },{"ms":319,"util":352}],304:[function(require,module,exports){
- /*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
- exports.read = function (buffer, offset, isLE, mLen, nBytes) {
- var e, m
- var eLen = (nBytes * 8) - mLen - 1
- var eMax = (1 << eLen) - 1
- var eBias = eMax >> 1
- var nBits = -7
- var i = isLE ? (nBytes - 1) : 0
- var d = isLE ? -1 : 1
- var s = buffer[offset + i]
- i += d
- e = s & ((1 << (-nBits)) - 1)
- s >>= (-nBits)
- nBits += eLen
- for (; nBits > 0; e = (e * 256) + buffer[offset + i], i += d, nBits -= 8) {}
- m = e & ((1 << (-nBits)) - 1)
- e >>= (-nBits)
- nBits += mLen
- for (; nBits > 0; m = (m * 256) + buffer[offset + i], i += d, nBits -= 8) {}
- if (e === 0) {
- e = 1 - eBias
- } else if (e === eMax) {
- return m ? NaN : ((s ? -1 : 1) * Infinity)
- } else {
- m = m + Math.pow(2, mLen)
- e = e - eBias
- }
- return (s ? -1 : 1) * m * Math.pow(2, e - mLen)
- }
- exports.write = function (buffer, value, offset, isLE, mLen, nBytes) {
- var e, m, c
- var eLen = (nBytes * 8) - mLen - 1
- var eMax = (1 << eLen) - 1
- var eBias = eMax >> 1
- var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0)
- var i = isLE ? 0 : (nBytes - 1)
- var d = isLE ? 1 : -1
- var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0
- value = Math.abs(value)
- if (isNaN(value) || value === Infinity) {
- m = isNaN(value) ? 1 : 0
- e = eMax
- } else {
- e = Math.floor(Math.log(value) / Math.LN2)
- if (value * (c = Math.pow(2, -e)) < 1) {
- e--
- c *= 2
- }
- if (e + eBias >= 1) {
- value += rt / c
- } else {
- value += rt * Math.pow(2, 1 - eBias)
- }
- if (value * c >= 2) {
- e++
- c /= 2
- }
- if (e + eBias >= eMax) {
- m = 0
- e = eMax
- } else if (e + eBias >= 1) {
- m = ((value * c) - 1) * Math.pow(2, mLen)
- e = e + eBias
- } else {
- m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen)
- e = 0
- }
- }
- for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}
- e = (e << mLen) | m
- eLen += mLen
- for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}
- buffer[offset + i - d] |= s * 128
- }
- },{}],305:[function(require,module,exports){
- 'use strict';
- var types = [
- require('./nextTick'),
- require('./queueMicrotask'),
- require('./mutation.js'),
- require('./messageChannel'),
- require('./stateChange'),
- require('./timeout')
- ];
- var draining;
- var currentQueue;
- var queueIndex = -1;
- var queue = [];
- var scheduled = false;
- function cleanUpNextTick() {
- if (!draining || !currentQueue) {
- return;
- }
- draining = false;
- if (currentQueue.length) {
- queue = currentQueue.concat(queue);
- } else {
- queueIndex = -1;
- }
- if (queue.length) {
- nextTick();
- }
- }
- //named nextTick for less confusing stack traces
- function nextTick() {
- if (draining) {
- return;
- }
- scheduled = false;
- draining = true;
- var len = queue.length;
- var timeout = setTimeout(cleanUpNextTick);
- while (len) {
- currentQueue = queue;
- queue = [];
- while (currentQueue && ++queueIndex < len) {
- currentQueue[queueIndex].run();
- }
- queueIndex = -1;
- len = queue.length;
- }
- currentQueue = null;
- queueIndex = -1;
- draining = false;
- clearTimeout(timeout);
- }
- var scheduleDrain;
- var i = -1;
- var len = types.length;
- while (++i < len) {
- if (types[i] && types[i].test && types[i].test()) {
- scheduleDrain = types[i].install(nextTick);
- break;
- }
- }
- // v8 likes predictible objects
- function Item(fun, array) {
- this.fun = fun;
- this.array = array;
- }
- Item.prototype.run = function () {
- var fun = this.fun;
- var array = this.array;
- switch (array.length) {
- case 0:
- return fun();
- case 1:
- return fun(array[0]);
- case 2:
- return fun(array[0], array[1]);
- case 3:
- return fun(array[0], array[1], array[2]);
- default:
- return fun.apply(null, array);
- }
- };
- module.exports = immediate;
- function immediate(task) {
- var args = new Array(arguments.length - 1);
- if (arguments.length > 1) {
- for (var i = 1; i < arguments.length; i++) {
- args[i - 1] = arguments[i];
- }
- }
- queue.push(new Item(task, args));
- if (!scheduled && !draining) {
- scheduled = true;
- scheduleDrain();
- }
- }
- },{"./messageChannel":306,"./mutation.js":307,"./nextTick":84,"./queueMicrotask":308,"./stateChange":309,"./timeout":310}],306:[function(require,module,exports){
- (function (global){(function (){
- 'use strict';
- exports.test = function () {
- if (global.setImmediate) {
- // we can only get here in IE10
- // which doesn't handel postMessage well
- return false;
- }
- return typeof global.MessageChannel !== 'undefined';
- };
- exports.install = function (func) {
- var channel = new global.MessageChannel();
- channel.port1.onmessage = func;
- return function () {
- channel.port2.postMessage(0);
- };
- };
- }).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
- },{}],307:[function(require,module,exports){
- (function (global){(function (){
- 'use strict';
- //based off rsvp https://github.com/tildeio/rsvp.js
- //license https://github.com/tildeio/rsvp.js/blob/master/LICENSE
- //https://github.com/tildeio/rsvp.js/blob/master/lib/rsvp/asap.js
- var Mutation = global.MutationObserver || global.WebKitMutationObserver;
- exports.test = function () {
- return Mutation;
- };
- exports.install = function (handle) {
- var called = 0;
- var observer = new Mutation(handle);
- var element = global.document.createTextNode('');
- observer.observe(element, {
- characterData: true
- });
- return function () {
- element.data = (called = ++called % 2);
- };
- };
- }).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
- },{}],308:[function(require,module,exports){
- (function (global){(function (){
- 'use strict';
- exports.test = function () {
- return typeof global.queueMicrotask === 'function';
- };
- exports.install = function (func) {
- return function () {
- global.queueMicrotask(func);
- };
- };
- }).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
- },{}],309:[function(require,module,exports){
- (function (global){(function (){
- 'use strict';
- exports.test = function () {
- return 'document' in global && 'onreadystatechange' in global.document.createElement('script');
- };
- exports.install = function (handle) {
- return function () {
- // Create a <script> element; its readystatechange event will be fired asynchronously once it is inserted
- // into the document. Do so, thus queuing up the task. Remember to clean up once it's been called.
- var scriptEl = global.document.createElement('script');
- scriptEl.onreadystatechange = function () {
- handle();
- scriptEl.onreadystatechange = null;
- scriptEl.parentNode.removeChild(scriptEl);
- scriptEl = null;
- };
- global.document.documentElement.appendChild(scriptEl);
- return handle;
- };
- };
- }).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
- },{}],310:[function(require,module,exports){
- 'use strict';
- exports.test = function () {
- return true;
- };
- exports.install = function (t) {
- return function () {
- setTimeout(t, 0);
- };
- };
- },{}],311:[function(require,module,exports){
- if (typeof Object.create === 'function') {
- // implementation from standard node.js 'util' module
- module.exports = function inherits(ctor, superCtor) {
- if (superCtor) {
- ctor.super_ = superCtor
- ctor.prototype = Object.create(superCtor.prototype, {
- constructor: {
- value: ctor,
- enumerable: false,
- writable: true,
- configurable: true
- }
- })
- }
- };
- } else {
- // old school shim for old browsers
- module.exports = function inherits(ctor, superCtor) {
- if (superCtor) {
- ctor.super_ = superCtor
- var TempCtor = function () {}
- TempCtor.prototype = superCtor.prototype
- ctor.prototype = new TempCtor()
- ctor.prototype.constructor = ctor
- }
- }
- }
- },{}],312:[function(require,module,exports){
- /*!
- * Determine if an object is a Buffer
- *
- * @author Feross Aboukhadijeh <https://feross.org>
- * @license MIT
- */
- // The _isBuffer check is for Safari 5-7 support, because it's missing
- // Object.prototype.constructor. Remove this eventually
- module.exports = function (obj) {
- return obj != null && (isBuffer(obj) || isSlowBuffer(obj) || !!obj._isBuffer)
- }
- function isBuffer (obj) {
- return !!obj.constructor && typeof obj.constructor.isBuffer === 'function' && obj.constructor.isBuffer(obj)
- }
- // For Node v0.10 support. Remove this eventually.
- function isSlowBuffer (obj) {
- return typeof obj.readFloatLE === 'function' && typeof obj.slice === 'function' && isBuffer(obj.slice(0, 0))
- }
- },{}],313:[function(require,module,exports){
- var toString = {}.toString;
- module.exports = Array.isArray || function (arr) {
- return toString.call(arr) == '[object Array]';
- };
- },{}],314:[function(require,module,exports){
- (function (global){(function (){
- /*
- * base64.js
- *
- * Licensed under the BSD 3-Clause License.
- * http://opensource.org/licenses/BSD-3-Clause
- *
- * References:
- * http://en.wikipedia.org/wiki/Base64
- */
- ;(function (global, factory) {
- typeof exports === 'object' && typeof module !== 'undefined'
- ? module.exports = factory(global)
- : typeof define === 'function' && define.amd
- ? define(factory) : factory(global)
- }((
- typeof self !== 'undefined' ? self
- : typeof window !== 'undefined' ? window
- : typeof global !== 'undefined' ? global
- : this
- ), function(global) {
- 'use strict';
- // existing version for noConflict()
- global = global || {};
- var _Base64 = global.Base64;
- var version = "2.6.4";
- // constants
- var b64chars
- = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
- var b64tab = function(bin) {
- var t = {};
- for (var i = 0, l = bin.length; i < l; i++) t[bin.charAt(i)] = i;
- return t;
- }(b64chars);
- var fromCharCode = String.fromCharCode;
- // encoder stuff
- var cb_utob = function(c) {
- if (c.length < 2) {
- var cc = c.charCodeAt(0);
- return cc < 0x80 ? c
- : cc < 0x800 ? (fromCharCode(0xc0 | (cc >>> 6))
- + fromCharCode(0x80 | (cc & 0x3f)))
- : (fromCharCode(0xe0 | ((cc >>> 12) & 0x0f))
- + fromCharCode(0x80 | ((cc >>> 6) & 0x3f))
- + fromCharCode(0x80 | ( cc & 0x3f)));
- } else {
- var cc = 0x10000
- + (c.charCodeAt(0) - 0xD800) * 0x400
- + (c.charCodeAt(1) - 0xDC00);
- return (fromCharCode(0xf0 | ((cc >>> 18) & 0x07))
- + fromCharCode(0x80 | ((cc >>> 12) & 0x3f))
- + fromCharCode(0x80 | ((cc >>> 6) & 0x3f))
- + fromCharCode(0x80 | ( cc & 0x3f)));
- }
- };
- var re_utob = /[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g;
- var utob = function(u) {
- return u.replace(re_utob, cb_utob);
- };
- var cb_encode = function(ccc) {
- var padlen = [0, 2, 1][ccc.length % 3],
- ord = ccc.charCodeAt(0) << 16
- | ((ccc.length > 1 ? ccc.charCodeAt(1) : 0) << 8)
- | ((ccc.length > 2 ? ccc.charCodeAt(2) : 0)),
- chars = [
- b64chars.charAt( ord >>> 18),
- b64chars.charAt((ord >>> 12) & 63),
- padlen >= 2 ? '=' : b64chars.charAt((ord >>> 6) & 63),
- padlen >= 1 ? '=' : b64chars.charAt(ord & 63)
- ];
- return chars.join('');
- };
- var btoa = global.btoa && typeof global.btoa == 'function'
- ? function(b){ return global.btoa(b) } : function(b) {
- if (b.match(/[^\x00-\xFF]/)) throw new RangeError(
- 'The string contains invalid characters.'
- );
- return b.replace(/[\s\S]{1,3}/g, cb_encode);
- };
- var _encode = function(u) {
- return btoa(utob(String(u)));
- };
- var mkUriSafe = function (b64) {
- return b64.replace(/[+\/]/g, function(m0) {
- return m0 == '+' ? '-' : '_';
- }).replace(/=/g, '');
- };
- var encode = function(u, urisafe) {
- return urisafe ? mkUriSafe(_encode(u)) : _encode(u);
- };
- var encodeURI = function(u) { return encode(u, true) };
- var fromUint8Array;
- if (global.Uint8Array) fromUint8Array = function(a, urisafe) {
- // return btoa(fromCharCode.apply(null, a));
- var b64 = '';
- for (var i = 0, l = a.length; i < l; i += 3) {
- var a0 = a[i], a1 = a[i+1], a2 = a[i+2];
- var ord = a0 << 16 | a1 << 8 | a2;
- b64 += b64chars.charAt( ord >>> 18)
- + b64chars.charAt((ord >>> 12) & 63)
- + ( typeof a1 != 'undefined'
- ? b64chars.charAt((ord >>> 6) & 63) : '=')
- + ( typeof a2 != 'undefined'
- ? b64chars.charAt( ord & 63) : '=');
- }
- return urisafe ? mkUriSafe(b64) : b64;
- };
- // decoder stuff
- var re_btou = /[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g;
- var cb_btou = function(cccc) {
- switch(cccc.length) {
- case 4:
- var cp = ((0x07 & cccc.charCodeAt(0)) << 18)
- | ((0x3f & cccc.charCodeAt(1)) << 12)
- | ((0x3f & cccc.charCodeAt(2)) << 6)
- | (0x3f & cccc.charCodeAt(3)),
- offset = cp - 0x10000;
- return (fromCharCode((offset >>> 10) + 0xD800)
- + fromCharCode((offset & 0x3FF) + 0xDC00));
- case 3:
- return fromCharCode(
- ((0x0f & cccc.charCodeAt(0)) << 12)
- | ((0x3f & cccc.charCodeAt(1)) << 6)
- | (0x3f & cccc.charCodeAt(2))
- );
- default:
- return fromCharCode(
- ((0x1f & cccc.charCodeAt(0)) << 6)
- | (0x3f & cccc.charCodeAt(1))
- );
- }
- };
- var btou = function(b) {
- return b.replace(re_btou, cb_btou);
- };
- var cb_decode = function(cccc) {
- var len = cccc.length,
- padlen = len % 4,
- n = (len > 0 ? b64tab[cccc.charAt(0)] << 18 : 0)
- | (len > 1 ? b64tab[cccc.charAt(1)] << 12 : 0)
- | (len > 2 ? b64tab[cccc.charAt(2)] << 6 : 0)
- | (len > 3 ? b64tab[cccc.charAt(3)] : 0),
- chars = [
- fromCharCode( n >>> 16),
- fromCharCode((n >>> 8) & 0xff),
- fromCharCode( n & 0xff)
- ];
- chars.length -= [0, 0, 2, 1][padlen];
- return chars.join('');
- };
- var _atob = global.atob && typeof global.atob == 'function'
- ? function(a){ return global.atob(a) } : function(a){
- return a.replace(/\S{1,4}/g, cb_decode);
- };
- var atob = function(a) {
- return _atob(String(a).replace(/[^A-Za-z0-9\+\/]/g, ''));
- };
- var _decode = function(a) { return btou(_atob(a)) };
- var _fromURI = function(a) {
- return String(a).replace(/[-_]/g, function(m0) {
- return m0 == '-' ? '+' : '/'
- }).replace(/[^A-Za-z0-9\+\/]/g, '');
- };
- var decode = function(a){
- return _decode(_fromURI(a));
- };
- var toUint8Array;
- if (global.Uint8Array) toUint8Array = function(a) {
- return Uint8Array.from(atob(_fromURI(a)), function(c) {
- return c.charCodeAt(0);
- });
- };
- var noConflict = function() {
- var Base64 = global.Base64;
- global.Base64 = _Base64;
- return Base64;
- };
- // export Base64
- global.Base64 = {
- VERSION: version,
- atob: atob,
- btoa: btoa,
- fromBase64: decode,
- toBase64: encode,
- utob: utob,
- encode: encode,
- encodeURI: encodeURI,
- btou: btou,
- decode: decode,
- noConflict: noConflict,
- fromUint8Array: fromUint8Array,
- toUint8Array: toUint8Array
- };
- // if ES5 is available, make Base64.extendString() available
- if (typeof Object.defineProperty === 'function') {
- var noEnum = function(v){
- return {value:v,enumerable:false,writable:true,configurable:true};
- };
- global.Base64.extendString = function () {
- Object.defineProperty(
- String.prototype, 'fromBase64', noEnum(function () {
- return decode(this)
- }));
- Object.defineProperty(
- String.prototype, 'toBase64', noEnum(function (urisafe) {
- return encode(this, urisafe)
- }));
- Object.defineProperty(
- String.prototype, 'toBase64URI', noEnum(function () {
- return encode(this, true)
- }));
- };
- }
- //
- // export Base64 to the namespace
- //
- if (global['Meteor']) { // Meteor.js
- Base64 = global.Base64;
- }
- // module.exports and AMD are mutually exclusive.
- // module.exports has precedence.
- if (typeof module !== 'undefined' && module.exports) {
- module.exports.Base64 = global.Base64;
- }
- else if (typeof define === 'function' && define.amd) {
- // AMD. Register as an anonymous module.
- define([], function(){ return global.Base64 });
- }
- // that's it!
- return {Base64: global.Base64}
- }));
- }).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
- },{}],315:[function(require,module,exports){
- /*!
- * merge-descriptors
- * Copyright(c) 2014 Jonathan Ong
- * Copyright(c) 2015 Douglas Christopher Wilson
- * MIT Licensed
- */
- 'use strict'
- /**
- * Module exports.
- * @public
- */
- module.exports = merge
- /**
- * Module variables.
- * @private
- */
- var hasOwnProperty = Object.prototype.hasOwnProperty
- /**
- * Merge the property descriptors of `src` into `dest`
- *
- * @param {object} dest Object to add descriptors to
- * @param {object} src Object to clone descriptors from
- * @param {boolean} [redefine=true] Redefine `dest` properties with `src` properties
- * @returns {object} Reference to dest
- * @public
- */
- function merge(dest, src, redefine) {
- if (!dest) {
- throw new TypeError('argument dest is required')
- }
- if (!src) {
- throw new TypeError('argument src is required')
- }
- if (redefine === undefined) {
- // Default to true
- redefine = true
- }
- Object.getOwnPropertyNames(src).forEach(function forEachOwnPropertyName(name) {
- if (!redefine && hasOwnProperty.call(dest, name)) {
- // Skip desriptor
- return
- }
- // Copy descriptor
- var descriptor = Object.getOwnPropertyDescriptor(src, name)
- Object.defineProperty(dest, name, descriptor)
- })
- return dest
- }
- },{}],316:[function(require,module,exports){
- 'use strict';
- /**
- * @param typeMap [Object] Map of MIME type -> Array[extensions]
- * @param ...
- */
- require("core-js/modules/es.array.map.js");
- require("core-js/modules/es.regexp.exec.js");
- require("core-js/modules/es.string.replace.js");
- require("core-js/modules/es.regexp.constructor.js");
- require("core-js/modules/es.regexp.to-string.js");
- function Mime() {
- this._types = Object.create(null);
- this._extensions = Object.create(null);
- for (var i = 0; i < arguments.length; i++) {
- this.define(arguments[i]);
- }
- this.define = this.define.bind(this);
- this.getType = this.getType.bind(this);
- this.getExtension = this.getExtension.bind(this);
- }
- /**
- * Define mimetype -> extension mappings. Each key is a mime-type that maps
- * to an array of extensions associated with the type. The first extension is
- * used as the default extension for the type.
- *
- * e.g. mime.define({'audio/ogg', ['oga', 'ogg', 'spx']});
- *
- * If a type declares an extension that has already been defined, an error will
- * be thrown. To suppress this error and force the extension to be associated
- * with the new type, pass `force`=true. Alternatively, you may prefix the
- * extension with "*" to map the type to extension, without mapping the
- * extension to the type.
- *
- * e.g. mime.define({'audio/wav', ['wav']}, {'audio/x-wav', ['*wav']});
- *
- *
- * @param map (Object) type definitions
- * @param force (Boolean) if true, force overriding of existing definitions
- */
- Mime.prototype.define = function (typeMap, force) {
- for (var type in typeMap) {
- var extensions = typeMap[type].map(function (t) {
- return t.toLowerCase();
- });
- type = type.toLowerCase();
- for (var i = 0; i < extensions.length; i++) {
- var ext = extensions[i]; // '*' prefix = not the preferred type for this extension. So fixup the
- // extension, and skip it.
- if (ext[0] === '*') {
- continue;
- }
- if (!force && ext in this._types) {
- 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 + '".');
- }
- this._types[ext] = type;
- } // Use first extension as default
- if (force || !this._extensions[type]) {
- var _ext = extensions[0];
- this._extensions[type] = _ext[0] !== '*' ? _ext : _ext.substr(1);
- }
- }
- };
- /**
- * Lookup a mime type based on extension
- */
- Mime.prototype.getType = function (path) {
- path = String(path);
- var last = path.replace(/^.*[/\\]/, '').toLowerCase();
- var ext = last.replace(/^.*\./, '').toLowerCase();
- var hasPath = last.length < path.length;
- var hasDot = ext.length < last.length - 1;
- return (hasDot || !hasPath) && this._types[ext] || null;
- };
- /**
- * Return file extension associated with a mime type
- */
- Mime.prototype.getExtension = function (type) {
- type = /^\s*([^;\s]*)/.test(type) && RegExp.$1;
- return type && this._extensions[type.toLowerCase()] || null;
- };
- module.exports = Mime;
- },{"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){
- 'use strict';
- var Mime = require('./Mime');
- module.exports = new Mime(require('./types/standard'));
- },{"./Mime":316,"./types/standard":318}],318:[function(require,module,exports){
- "use strict";
- module.exports = {
- "application/andrew-inset": ["ez"],
- "application/applixware": ["aw"],
- "application/atom+xml": ["atom"],
- "application/atomcat+xml": ["atomcat"],
- "application/atomdeleted+xml": ["atomdeleted"],
- "application/atomsvc+xml": ["atomsvc"],
- "application/atsc-dwd+xml": ["dwd"],
- "application/atsc-held+xml": ["held"],
- "application/atsc-rsat+xml": ["rsat"],
- "application/bdoc": ["bdoc"],
- "application/calendar+xml": ["xcs"],
- "application/ccxml+xml": ["ccxml"],
- "application/cdfx+xml": ["cdfx"],
- "application/cdmi-capability": ["cdmia"],
- "application/cdmi-container": ["cdmic"],
- "application/cdmi-domain": ["cdmid"],
- "application/cdmi-object": ["cdmio"],
- "application/cdmi-queue": ["cdmiq"],
- "application/cu-seeme": ["cu"],
- "application/dash+xml": ["mpd"],
- "application/davmount+xml": ["davmount"],
- "application/docbook+xml": ["dbk"],
- "application/dssc+der": ["dssc"],
- "application/dssc+xml": ["xdssc"],
- "application/ecmascript": ["ecma", "es"],
- "application/emma+xml": ["emma"],
- "application/emotionml+xml": ["emotionml"],
- "application/epub+zip": ["epub"],
- "application/exi": ["exi"],
- "application/fdt+xml": ["fdt"],
- "application/font-tdpfr": ["pfr"],
- "application/geo+json": ["geojson"],
- "application/gml+xml": ["gml"],
- "application/gpx+xml": ["gpx"],
- "application/gxf": ["gxf"],
- "application/gzip": ["gz"],
- "application/hjson": ["hjson"],
- "application/hyperstudio": ["stk"],
- "application/inkml+xml": ["ink", "inkml"],
- "application/ipfix": ["ipfix"],
- "application/its+xml": ["its"],
- "application/java-archive": ["jar", "war", "ear"],
- "application/java-serialized-object": ["ser"],
- "application/java-vm": ["class"],
- "application/javascript": ["js", "mjs"],
- "application/json": ["json", "map"],
- "application/json5": ["json5"],
- "application/jsonml+json": ["jsonml"],
- "application/ld+json": ["jsonld"],
- "application/lgr+xml": ["lgr"],
- "application/lost+xml": ["lostxml"],
- "application/mac-binhex40": ["hqx"],
- "application/mac-compactpro": ["cpt"],
- "application/mads+xml": ["mads"],
- "application/manifest+json": ["webmanifest"],
- "application/marc": ["mrc"],
- "application/marcxml+xml": ["mrcx"],
- "application/mathematica": ["ma", "nb", "mb"],
- "application/mathml+xml": ["mathml"],
- "application/mbox": ["mbox"],
- "application/mediaservercontrol+xml": ["mscml"],
- "application/metalink+xml": ["metalink"],
- "application/metalink4+xml": ["meta4"],
- "application/mets+xml": ["mets"],
- "application/mmt-aei+xml": ["maei"],
- "application/mmt-usd+xml": ["musd"],
- "application/mods+xml": ["mods"],
- "application/mp21": ["m21", "mp21"],
- "application/mp4": ["mp4s", "m4p"],
- "application/mrb-consumer+xml": ["*xdf"],
- "application/mrb-publish+xml": ["*xdf"],
- "application/msword": ["doc", "dot"],
- "application/mxf": ["mxf"],
- "application/n-quads": ["nq"],
- "application/n-triples": ["nt"],
- "application/node": ["cjs"],
- "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"],
- "application/oda": ["oda"],
- "application/oebps-package+xml": ["opf"],
- "application/ogg": ["ogx"],
- "application/omdoc+xml": ["omdoc"],
- "application/onenote": ["onetoc", "onetoc2", "onetmp", "onepkg"],
- "application/oxps": ["oxps"],
- "application/p2p-overlay+xml": ["relo"],
- "application/patch-ops-error+xml": ["*xer"],
- "application/pdf": ["pdf"],
- "application/pgp-encrypted": ["pgp"],
- "application/pgp-signature": ["asc", "sig"],
- "application/pics-rules": ["prf"],
- "application/pkcs10": ["p10"],
- "application/pkcs7-mime": ["p7m", "p7c"],
- "application/pkcs7-signature": ["p7s"],
- "application/pkcs8": ["p8"],
- "application/pkix-attr-cert": ["ac"],
- "application/pkix-cert": ["cer"],
- "application/pkix-crl": ["crl"],
- "application/pkix-pkipath": ["pkipath"],
- "application/pkixcmp": ["pki"],
- "application/pls+xml": ["pls"],
- "application/postscript": ["ai", "eps", "ps"],
- "application/provenance+xml": ["provx"],
- "application/pskc+xml": ["pskcxml"],
- "application/raml+yaml": ["raml"],
- "application/rdf+xml": ["rdf", "owl"],
- "application/reginfo+xml": ["rif"],
- "application/relax-ng-compact-syntax": ["rnc"],
- "application/resource-lists+xml": ["rl"],
- "application/resource-lists-diff+xml": ["rld"],
- "application/rls-services+xml": ["rs"],
- "application/route-apd+xml": ["rapd"],
- "application/route-s-tsid+xml": ["sls"],
- "application/route-usd+xml": ["rusd"],
- "application/rpki-ghostbusters": ["gbr"],
- "application/rpki-manifest": ["mft"],
- "application/rpki-roa": ["roa"],
- "application/rsd+xml": ["rsd"],
- "application/rss+xml": ["rss"],
- "application/rtf": ["rtf"],
- "application/sbml+xml": ["sbml"],
- "application/scvp-cv-request": ["scq"],
- "application/scvp-cv-response": ["scs"],
- "application/scvp-vp-request": ["spq"],
- "application/scvp-vp-response": ["spp"],
- "application/sdp": ["sdp"],
- "application/senml+xml": ["senmlx"],
- "application/sensml+xml": ["sensmlx"],
- "application/set-payment-initiation": ["setpay"],
- "application/set-registration-initiation": ["setreg"],
- "application/shf+xml": ["shf"],
- "application/sieve": ["siv", "sieve"],
- "application/smil+xml": ["smi", "smil"],
- "application/sparql-query": ["rq"],
- "application/sparql-results+xml": ["srx"],
- "application/srgs": ["gram"],
- "application/srgs+xml": ["grxml"],
- "application/sru+xml": ["sru"],
- "application/ssdl+xml": ["ssdl"],
- "application/ssml+xml": ["ssml"],
- "application/swid+xml": ["swidtag"],
- "application/tei+xml": ["tei", "teicorpus"],
- "application/thraud+xml": ["tfi"],
- "application/timestamped-data": ["tsd"],
- "application/toml": ["toml"],
- "application/ttml+xml": ["ttml"],
- "application/ubjson": ["ubj"],
- "application/urc-ressheet+xml": ["rsheet"],
- "application/urc-targetdesc+xml": ["td"],
- "application/voicexml+xml": ["vxml"],
- "application/wasm": ["wasm"],
- "application/widget": ["wgt"],
- "application/winhlp": ["hlp"],
- "application/wsdl+xml": ["wsdl"],
- "application/wspolicy+xml": ["wspolicy"],
- "application/xaml+xml": ["xaml"],
- "application/xcap-att+xml": ["xav"],
- "application/xcap-caps+xml": ["xca"],
- "application/xcap-diff+xml": ["xdf"],
- "application/xcap-el+xml": ["xel"],
- "application/xcap-error+xml": ["xer"],
- "application/xcap-ns+xml": ["xns"],
- "application/xenc+xml": ["xenc"],
- "application/xhtml+xml": ["xhtml", "xht"],
- "application/xliff+xml": ["xlf"],
- "application/xml": ["xml", "xsl", "xsd", "rng"],
- "application/xml-dtd": ["dtd"],
- "application/xop+xml": ["xop"],
- "application/xproc+xml": ["xpl"],
- "application/xslt+xml": ["*xsl", "xslt"],
- "application/xspf+xml": ["xspf"],
- "application/xv+xml": ["mxml", "xhvml", "xvml", "xvm"],
- "application/yang": ["yang"],
- "application/yin+xml": ["yin"],
- "application/zip": ["zip"],
- "audio/3gpp": ["*3gpp"],
- "audio/adpcm": ["adp"],
- "audio/amr": ["amr"],
- "audio/basic": ["au", "snd"],
- "audio/midi": ["mid", "midi", "kar", "rmi"],
- "audio/mobile-xmf": ["mxmf"],
- "audio/mp3": ["*mp3"],
- "audio/mp4": ["m4a", "mp4a"],
- "audio/mpeg": ["mpga", "mp2", "mp2a", "mp3", "m2a", "m3a"],
- "audio/ogg": ["oga", "ogg", "spx", "opus"],
- "audio/s3m": ["s3m"],
- "audio/silk": ["sil"],
- "audio/wav": ["wav"],
- "audio/wave": ["*wav"],
- "audio/webm": ["weba"],
- "audio/xm": ["xm"],
- "font/collection": ["ttc"],
- "font/otf": ["otf"],
- "font/ttf": ["ttf"],
- "font/woff": ["woff"],
- "font/woff2": ["woff2"],
- "image/aces": ["exr"],
- "image/apng": ["apng"],
- "image/avif": ["avif"],
- "image/bmp": ["bmp"],
- "image/cgm": ["cgm"],
- "image/dicom-rle": ["drle"],
- "image/emf": ["emf"],
- "image/fits": ["fits"],
- "image/g3fax": ["g3"],
- "image/gif": ["gif"],
- "image/heic": ["heic"],
- "image/heic-sequence": ["heics"],
- "image/heif": ["heif"],
- "image/heif-sequence": ["heifs"],
- "image/hej2k": ["hej2"],
- "image/hsj2": ["hsj2"],
- "image/ief": ["ief"],
- "image/jls": ["jls"],
- "image/jp2": ["jp2", "jpg2"],
- "image/jpeg": ["jpeg", "jpg", "jpe"],
- "image/jph": ["jph"],
- "image/jphc": ["jhc"],
- "image/jpm": ["jpm"],
- "image/jpx": ["jpx", "jpf"],
- "image/jxr": ["jxr"],
- "image/jxra": ["jxra"],
- "image/jxrs": ["jxrs"],
- "image/jxs": ["jxs"],
- "image/jxsc": ["jxsc"],
- "image/jxsi": ["jxsi"],
- "image/jxss": ["jxss"],
- "image/ktx": ["ktx"],
- "image/ktx2": ["ktx2"],
- "image/png": ["png"],
- "image/sgi": ["sgi"],
- "image/svg+xml": ["svg", "svgz"],
- "image/t38": ["t38"],
- "image/tiff": ["tif", "tiff"],
- "image/tiff-fx": ["tfx"],
- "image/webp": ["webp"],
- "image/wmf": ["wmf"],
- "message/disposition-notification": ["disposition-notification"],
- "message/global": ["u8msg"],
- "message/global-delivery-status": ["u8dsn"],
- "message/global-disposition-notification": ["u8mdn"],
- "message/global-headers": ["u8hdr"],
- "message/rfc822": ["eml", "mime"],
- "model/3mf": ["3mf"],
- "model/gltf+json": ["gltf"],
- "model/gltf-binary": ["glb"],
- "model/iges": ["igs", "iges"],
- "model/mesh": ["msh", "mesh", "silo"],
- "model/mtl": ["mtl"],
- "model/obj": ["obj"],
- "model/stl": ["stl"],
- "model/vrml": ["wrl", "vrml"],
- "model/x3d+binary": ["*x3db", "x3dbz"],
- "model/x3d+fastinfoset": ["x3db"],
- "model/x3d+vrml": ["*x3dv", "x3dvz"],
- "model/x3d+xml": ["x3d", "x3dz"],
- "model/x3d-vrml": ["x3dv"],
- "text/cache-manifest": ["appcache", "manifest"],
- "text/calendar": ["ics", "ifb"],
- "text/coffeescript": ["coffee", "litcoffee"],
- "text/css": ["css"],
- "text/csv": ["csv"],
- "text/html": ["html", "htm", "shtml"],
- "text/jade": ["jade"],
- "text/jsx": ["jsx"],
- "text/less": ["less"],
- "text/markdown": ["markdown", "md"],
- "text/mathml": ["mml"],
- "text/mdx": ["mdx"],
- "text/n3": ["n3"],
- "text/plain": ["txt", "text", "conf", "def", "list", "log", "in", "ini"],
- "text/richtext": ["rtx"],
- "text/rtf": ["*rtf"],
- "text/sgml": ["sgml", "sgm"],
- "text/shex": ["shex"],
- "text/slim": ["slim", "slm"],
- "text/spdx": ["spdx"],
- "text/stylus": ["stylus", "styl"],
- "text/tab-separated-values": ["tsv"],
- "text/troff": ["t", "tr", "roff", "man", "me", "ms"],
- "text/turtle": ["ttl"],
- "text/uri-list": ["uri", "uris", "urls"],
- "text/vcard": ["vcard"],
- "text/vtt": ["vtt"],
- "text/xml": ["*xml"],
- "text/yaml": ["yaml", "yml"],
- "video/3gpp": ["3gp", "3gpp"],
- "video/3gpp2": ["3g2"],
- "video/h261": ["h261"],
- "video/h263": ["h263"],
- "video/h264": ["h264"],
- "video/iso.segment": ["m4s"],
- "video/jpeg": ["jpgv"],
- "video/jpm": ["*jpm", "jpgm"],
- "video/mj2": ["mj2", "mjp2"],
- "video/mp2t": ["ts"],
- "video/mp4": ["mp4", "mp4v", "mpg4"],
- "video/mpeg": ["mpeg", "mpg", "mpe", "m1v", "m2v"],
- "video/ogg": ["ogv"],
- "video/quicktime": ["qt", "mov"],
- "video/webm": ["webm"]
- };
- },{}],319:[function(require,module,exports){
- /**
- * Helpers.
- */
- var s = 1000;
- var m = s * 60;
- var h = m * 60;
- var d = h * 24;
- var w = d * 7;
- var y = d * 365.25;
- /**
- * Parse or format the given `val`.
- *
- * Options:
- *
- * - `long` verbose formatting [false]
- *
- * @param {String|Number} val
- * @param {Object} [options]
- * @throws {Error} throw an error if val is not a non-empty string or a number
- * @return {String|Number}
- * @api public
- */
- module.exports = function (val, options) {
- options = options || {};
- var type = typeof val;
- if (type === 'string' && val.length > 0) {
- return parse(val);
- } else if (type === 'number' && isFinite(val)) {
- return options.long ? fmtLong(val) : fmtShort(val);
- }
- throw new Error(
- 'val is not a non-empty string or a valid number. val=' +
- JSON.stringify(val)
- );
- };
- /**
- * Parse the given `str` and return milliseconds.
- *
- * @param {String} str
- * @return {Number}
- * @api private
- */
- function parse(str) {
- str = String(str);
- if (str.length > 100) {
- return;
- }
- 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(
- str
- );
- if (!match) {
- return;
- }
- var n = parseFloat(match[1]);
- var type = (match[2] || 'ms').toLowerCase();
- switch (type) {
- case 'years':
- case 'year':
- case 'yrs':
- case 'yr':
- case 'y':
- return n * y;
- case 'weeks':
- case 'week':
- case 'w':
- return n * w;
- case 'days':
- case 'day':
- case 'd':
- return n * d;
- case 'hours':
- case 'hour':
- case 'hrs':
- case 'hr':
- case 'h':
- return n * h;
- case 'minutes':
- case 'minute':
- case 'mins':
- case 'min':
- case 'm':
- return n * m;
- case 'seconds':
- case 'second':
- case 'secs':
- case 'sec':
- case 's':
- return n * s;
- case 'milliseconds':
- case 'millisecond':
- case 'msecs':
- case 'msec':
- case 'ms':
- return n;
- default:
- return undefined;
- }
- }
- /**
- * Short format for `ms`.
- *
- * @param {Number} ms
- * @return {String}
- * @api private
- */
- function fmtShort(ms) {
- var msAbs = Math.abs(ms);
- if (msAbs >= d) {
- return Math.round(ms / d) + 'd';
- }
- if (msAbs >= h) {
- return Math.round(ms / h) + 'h';
- }
- if (msAbs >= m) {
- return Math.round(ms / m) + 'm';
- }
- if (msAbs >= s) {
- return Math.round(ms / s) + 's';
- }
- return ms + 'ms';
- }
- /**
- * Long format for `ms`.
- *
- * @param {Number} ms
- * @return {String}
- * @api private
- */
- function fmtLong(ms) {
- var msAbs = Math.abs(ms);
- if (msAbs >= d) {
- return plural(ms, msAbs, d, 'day');
- }
- if (msAbs >= h) {
- return plural(ms, msAbs, h, 'hour');
- }
- if (msAbs >= m) {
- return plural(ms, msAbs, m, 'minute');
- }
- if (msAbs >= s) {
- return plural(ms, msAbs, s, 'second');
- }
- return ms + ' ms';
- }
- /**
- * Pluralization helper.
- */
- function plural(ms, msAbs, n, name) {
- var isPlural = msAbs >= n * 1.5;
- return Math.round(ms / n) + ' ' + name + (isPlural ? 's' : '');
- }
- },{}],320:[function(require,module,exports){
- /*
- object-assign
- (c) Sindre Sorhus
- @license MIT
- */
- 'use strict';
- /* eslint-disable no-unused-vars */
- var getOwnPropertySymbols = Object.getOwnPropertySymbols;
- var hasOwnProperty = Object.prototype.hasOwnProperty;
- var propIsEnumerable = Object.prototype.propertyIsEnumerable;
- function toObject(val) {
- if (val === null || val === undefined) {
- throw new TypeError('Object.assign cannot be called with null or undefined');
- }
- return Object(val);
- }
- function shouldUseNative() {
- try {
- if (!Object.assign) {
- return false;
- }
- // Detect buggy property enumeration order in older V8 versions.
- // https://bugs.chromium.org/p/v8/issues/detail?id=4118
- var test1 = new String('abc'); // eslint-disable-line no-new-wrappers
- test1[5] = 'de';
- if (Object.getOwnPropertyNames(test1)[0] === '5') {
- return false;
- }
- // https://bugs.chromium.org/p/v8/issues/detail?id=3056
- var test2 = {};
- for (var i = 0; i < 10; i++) {
- test2['_' + String.fromCharCode(i)] = i;
- }
- var order2 = Object.getOwnPropertyNames(test2).map(function (n) {
- return test2[n];
- });
- if (order2.join('') !== '0123456789') {
- return false;
- }
- // https://bugs.chromium.org/p/v8/issues/detail?id=3056
- var test3 = {};
- 'abcdefghijklmnopqrst'.split('').forEach(function (letter) {
- test3[letter] = letter;
- });
- if (Object.keys(Object.assign({}, test3)).join('') !==
- 'abcdefghijklmnopqrst') {
- return false;
- }
- return true;
- } catch (err) {
- // We don't expect any of the above to throw, but better to be safe.
- return false;
- }
- }
- module.exports = shouldUseNative() ? Object.assign : function (target, source) {
- var from;
- var to = toObject(target);
- var symbols;
- for (var s = 1; s < arguments.length; s++) {
- from = Object(arguments[s]);
- for (var key in from) {
- if (hasOwnProperty.call(from, key)) {
- to[key] = from[key];
- }
- }
- if (getOwnPropertySymbols) {
- symbols = getOwnPropertySymbols(from);
- for (var i = 0; i < symbols.length; i++) {
- if (propIsEnumerable.call(from, symbols[i])) {
- to[symbols[i]] = from[symbols[i]];
- }
- }
- }
- }
- return to;
- };
- },{}],321:[function(require,module,exports){
- (function (process){(function (){
- // .dirname, .basename, and .extname methods are extracted from Node.js v8.11.1,
- // backported and transplited with Babel, with backwards-compat fixes
- // Copyright Joyent, Inc. and other Node contributors.
- //
- // Permission is hereby granted, free of charge, to any person obtaining a
- // copy of this software and associated documentation files (the
- // "Software"), to deal in the Software without restriction, including
- // without limitation the rights to use, copy, modify, merge, publish,
- // distribute, sublicense, and/or sell copies of the Software, and to permit
- // persons to whom the Software is furnished to do so, subject to the
- // following conditions:
- //
- // The above copyright notice and this permission notice shall be included
- // in all copies or substantial portions of the Software.
- //
- // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
- // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
- // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
- // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
- // USE OR OTHER DEALINGS IN THE SOFTWARE.
- // resolves . and .. elements in a path array with directory names there
- // must be no slashes, empty elements, or device names (c:\) in the array
- // (so also no leading and trailing slashes - it does not distinguish
- // relative and absolute paths)
- function normalizeArray(parts, allowAboveRoot) {
- // if the path tries to go above the root, `up` ends up > 0
- var up = 0;
- for (var i = parts.length - 1; i >= 0; i--) {
- var last = parts[i];
- if (last === '.') {
- parts.splice(i, 1);
- } else if (last === '..') {
- parts.splice(i, 1);
- up++;
- } else if (up) {
- parts.splice(i, 1);
- up--;
- }
- }
- // if the path is allowed to go above the root, restore leading ..s
- if (allowAboveRoot) {
- for (; up--; up) {
- parts.unshift('..');
- }
- }
- return parts;
- }
- // path.resolve([from ...], to)
- // posix version
- exports.resolve = function() {
- var resolvedPath = '',
- resolvedAbsolute = false;
- for (var i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) {
- var path = (i >= 0) ? arguments[i] : process.cwd();
- // Skip empty and invalid entries
- if (typeof path !== 'string') {
- throw new TypeError('Arguments to path.resolve must be strings');
- } else if (!path) {
- continue;
- }
- resolvedPath = path + '/' + resolvedPath;
- resolvedAbsolute = path.charAt(0) === '/';
- }
- // At this point the path should be resolved to a full absolute path, but
- // handle relative paths to be safe (might happen when process.cwd() fails)
- // Normalize the path
- resolvedPath = normalizeArray(filter(resolvedPath.split('/'), function(p) {
- return !!p;
- }), !resolvedAbsolute).join('/');
- return ((resolvedAbsolute ? '/' : '') + resolvedPath) || '.';
- };
- // path.normalize(path)
- // posix version
- exports.normalize = function(path) {
- var isAbsolute = exports.isAbsolute(path),
- trailingSlash = substr(path, -1) === '/';
- // Normalize the path
- path = normalizeArray(filter(path.split('/'), function(p) {
- return !!p;
- }), !isAbsolute).join('/');
- if (!path && !isAbsolute) {
- path = '.';
- }
- if (path && trailingSlash) {
- path += '/';
- }
- return (isAbsolute ? '/' : '') + path;
- };
- // posix version
- exports.isAbsolute = function(path) {
- return path.charAt(0) === '/';
- };
- // posix version
- exports.join = function() {
- var paths = Array.prototype.slice.call(arguments, 0);
- return exports.normalize(filter(paths, function(p, index) {
- if (typeof p !== 'string') {
- throw new TypeError('Arguments to path.join must be strings');
- }
- return p;
- }).join('/'));
- };
- // path.relative(from, to)
- // posix version
- exports.relative = function(from, to) {
- from = exports.resolve(from).substr(1);
- to = exports.resolve(to).substr(1);
- function trim(arr) {
- var start = 0;
- for (; start < arr.length; start++) {
- if (arr[start] !== '') break;
- }
- var end = arr.length - 1;
- for (; end >= 0; end--) {
- if (arr[end] !== '') break;
- }
- if (start > end) return [];
- return arr.slice(start, end - start + 1);
- }
- var fromParts = trim(from.split('/'));
- var toParts = trim(to.split('/'));
- var length = Math.min(fromParts.length, toParts.length);
- var samePartsLength = length;
- for (var i = 0; i < length; i++) {
- if (fromParts[i] !== toParts[i]) {
- samePartsLength = i;
- break;
- }
- }
- var outputParts = [];
- for (var i = samePartsLength; i < fromParts.length; i++) {
- outputParts.push('..');
- }
- outputParts = outputParts.concat(toParts.slice(samePartsLength));
- return outputParts.join('/');
- };
- exports.sep = '/';
- exports.delimiter = ':';
- exports.dirname = function (path) {
- if (typeof path !== 'string') path = path + '';
- if (path.length === 0) return '.';
- var code = path.charCodeAt(0);
- var hasRoot = code === 47 /*/*/;
- var end = -1;
- var matchedSlash = true;
- for (var i = path.length - 1; i >= 1; --i) {
- code = path.charCodeAt(i);
- if (code === 47 /*/*/) {
- if (!matchedSlash) {
- end = i;
- break;
- }
- } else {
- // We saw the first non-path separator
- matchedSlash = false;
- }
- }
- if (end === -1) return hasRoot ? '/' : '.';
- if (hasRoot && end === 1) {
- // return '//';
- // Backwards-compat fix:
- return '/';
- }
- return path.slice(0, end);
- };
- function basename(path) {
- if (typeof path !== 'string') path = path + '';
- var start = 0;
- var end = -1;
- var matchedSlash = true;
- var i;
- for (i = path.length - 1; i >= 0; --i) {
- if (path.charCodeAt(i) === 47 /*/*/) {
- // If we reached a path separator that was not part of a set of path
- // separators at the end of the string, stop now
- if (!matchedSlash) {
- start = i + 1;
- break;
- }
- } else if (end === -1) {
- // We saw the first non-path separator, mark this as the end of our
- // path component
- matchedSlash = false;
- end = i + 1;
- }
- }
- if (end === -1) return '';
- return path.slice(start, end);
- }
- // Uses a mixed approach for backwards-compatibility, as ext behavior changed
- // in new Node.js versions, so only basename() above is backported here
- exports.basename = function (path, ext) {
- var f = basename(path);
- if (ext && f.substr(-1 * ext.length) === ext) {
- f = f.substr(0, f.length - ext.length);
- }
- return f;
- };
- exports.extname = function (path) {
- if (typeof path !== 'string') path = path + '';
- var startDot = -1;
- var startPart = 0;
- var end = -1;
- var matchedSlash = true;
- // Track the state of characters (if any) we see before our first dot and
- // after any path separator we find
- var preDotState = 0;
- for (var i = path.length - 1; i >= 0; --i) {
- var code = path.charCodeAt(i);
- if (code === 47 /*/*/) {
- // If we reached a path separator that was not part of a set of path
- // separators at the end of the string, stop now
- if (!matchedSlash) {
- startPart = i + 1;
- break;
- }
- continue;
- }
- if (end === -1) {
- // We saw the first non-path separator, mark this as the end of our
- // extension
- matchedSlash = false;
- end = i + 1;
- }
- if (code === 46 /*.*/) {
- // If this is our first dot, mark it as the start of our extension
- if (startDot === -1)
- startDot = i;
- else if (preDotState !== 1)
- preDotState = 1;
- } else if (startDot !== -1) {
- // We saw a non-dot and non-path separator before our dot, so we should
- // have a good chance at having a non-empty extension
- preDotState = -1;
- }
- }
- if (startDot === -1 || end === -1 ||
- // We saw a non-dot character immediately before the dot
- preDotState === 0 ||
- // The (right-most) trimmed path component is exactly '..'
- preDotState === 1 && startDot === end - 1 && startDot === startPart + 1) {
- return '';
- }
- return path.slice(startDot, end);
- };
- function filter (xs, f) {
- if (xs.filter) return xs.filter(f);
- var res = [];
- for (var i = 0; i < xs.length; i++) {
- if (f(xs[i], i, xs)) res.push(xs[i]);
- }
- return res;
- }
- // String.prototype.substr - negative index don't work in IE8
- var substr = 'ab'.substr(-1) === 'b'
- ? function (str, start, len) { return str.substr(start, len) }
- : function (str, start, len) {
- if (start < 0) start = str.length + start;
- return str.substr(start, len);
- }
- ;
- }).call(this)}).call(this,require('_process'))
- },{"_process":399}],322:[function(require,module,exports){
- (function (global){(function (){
- /*!
- * Platform.js v1.3.6
- * Copyright 2014-2020 Benjamin Tan
- * Copyright 2011-2013 John-David Dalton
- * Available under MIT license
- */
- ;(function() {
- 'use strict';
- /** Used to determine if values are of the language type `Object`. */
- var objectTypes = {
- 'function': true,
- 'object': true
- };
- /** Used as a reference to the global object. */
- var root = (objectTypes[typeof window] && window) || this;
- /** Backup possible global object. */
- var oldRoot = root;
- /** Detect free variable `exports`. */
- var freeExports = objectTypes[typeof exports] && exports;
- /** Detect free variable `module`. */
- var freeModule = objectTypes[typeof module] && module && !module.nodeType && module;
- /** Detect free variable `global` from Node.js or Browserified code and use it as `root`. */
- var freeGlobal = freeExports && freeModule && typeof global == 'object' && global;
- if (freeGlobal && (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal || freeGlobal.self === freeGlobal)) {
- root = freeGlobal;
- }
- /**
- * Used as the maximum length of an array-like object.
- * See the [ES6 spec](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-tolength)
- * for more details.
- */
- var maxSafeInteger = Math.pow(2, 53) - 1;
- /** Regular expression to detect Opera. */
- var reOpera = /\bOpera/;
- /** Possible global object. */
- var thisBinding = this;
- /** Used for native method references. */
- var objectProto = Object.prototype;
- /** Used to check for own properties of an object. */
- var hasOwnProperty = objectProto.hasOwnProperty;
- /** Used to resolve the internal `[[Class]]` of values. */
- var toString = objectProto.toString;
- /*--------------------------------------------------------------------------*/
- /**
- * Capitalizes a string value.
- *
- * @private
- * @param {string} string The string to capitalize.
- * @returns {string} The capitalized string.
- */
- function capitalize(string) {
- string = String(string);
- return string.charAt(0).toUpperCase() + string.slice(1);
- }
- /**
- * A utility function to clean up the OS name.
- *
- * @private
- * @param {string} os The OS name to clean up.
- * @param {string} [pattern] A `RegExp` pattern matching the OS name.
- * @param {string} [label] A label for the OS.
- */
- function cleanupOS(os, pattern, label) {
- // Platform tokens are defined at:
- // http://msdn.microsoft.com/en-us/library/ms537503(VS.85).aspx
- // http://web.archive.org/web/20081122053950/http://msdn.microsoft.com/en-us/library/ms537503(VS.85).aspx
- var data = {
- '10.0': '10',
- '6.4': '10 Technical Preview',
- '6.3': '8.1',
- '6.2': '8',
- '6.1': 'Server 2008 R2 / 7',
- '6.0': 'Server 2008 / Vista',
- '5.2': 'Server 2003 / XP 64-bit',
- '5.1': 'XP',
- '5.01': '2000 SP1',
- '5.0': '2000',
- '4.0': 'NT',
- '4.90': 'ME'
- };
- // Detect Windows version from platform tokens.
- if (pattern && label && /^Win/i.test(os) && !/^Windows Phone /i.test(os) &&
- (data = data[/[\d.]+$/.exec(os)])) {
- os = 'Windows ' + data;
- }
- // Correct character case and cleanup string.
- os = String(os);
- if (pattern && label) {
- os = os.replace(RegExp(pattern, 'i'), label);
- }
- os = format(
- os.replace(/ ce$/i, ' CE')
- .replace(/\bhpw/i, 'web')
- .replace(/\bMacintosh\b/, 'Mac OS')
- .replace(/_PowerPC\b/i, ' OS')
- .replace(/\b(OS X) [^ \d]+/i, '$1')
- .replace(/\bMac (OS X)\b/, '$1')
- .replace(/\/(\d)/, ' $1')
- .replace(/_/g, '.')
- .replace(/(?: BePC|[ .]*fc[ \d.]+)$/i, '')
- .replace(/\bx86\.64\b/gi, 'x86_64')
- .replace(/\b(Windows Phone) OS\b/, '$1')
- .replace(/\b(Chrome OS \w+) [\d.]+\b/, '$1')
- .split(' on ')[0]
- );
- return os;
- }
- /**
- * An iteration utility for arrays and objects.
- *
- * @private
- * @param {Array|Object} object The object to iterate over.
- * @param {Function} callback The function called per iteration.
- */
- function each(object, callback) {
- var index = -1,
- length = object ? object.length : 0;
- if (typeof length == 'number' && length > -1 && length <= maxSafeInteger) {
- while (++index < length) {
- callback(object[index], index, object);
- }
- } else {
- forOwn(object, callback);
- }
- }
- /**
- * Trim and conditionally capitalize string values.
- *
- * @private
- * @param {string} string The string to format.
- * @returns {string} The formatted string.
- */
- function format(string) {
- string = trim(string);
- return /^(?:webOS|i(?:OS|P))/.test(string)
- ? string
- : capitalize(string);
- }
- /**
- * Iterates over an object's own properties, executing the `callback` for each.
- *
- * @private
- * @param {Object} object The object to iterate over.
- * @param {Function} callback The function executed per own property.
- */
- function forOwn(object, callback) {
- for (var key in object) {
- if (hasOwnProperty.call(object, key)) {
- callback(object[key], key, object);
- }
- }
- }
- /**
- * Gets the internal `[[Class]]` of a value.
- *
- * @private
- * @param {*} value The value.
- * @returns {string} The `[[Class]]`.
- */
- function getClassOf(value) {
- return value == null
- ? capitalize(value)
- : toString.call(value).slice(8, -1);
- }
- /**
- * Host objects can return type values that are different from their actual
- * data type. The objects we are concerned with usually return non-primitive
- * types of "object", "function", or "unknown".
- *
- * @private
- * @param {*} object The owner of the property.
- * @param {string} property The property to check.
- * @returns {boolean} Returns `true` if the property value is a non-primitive, else `false`.
- */
- function isHostType(object, property) {
- var type = object != null ? typeof object[property] : 'number';
- return !/^(?:boolean|number|string|undefined)$/.test(type) &&
- (type == 'object' ? !!object[property] : true);
- }
- /**
- * Prepares a string for use in a `RegExp` by making hyphens and spaces optional.
- *
- * @private
- * @param {string} string The string to qualify.
- * @returns {string} The qualified string.
- */
- function qualify(string) {
- return String(string).replace(/([ -])(?!$)/g, '$1?');
- }
- /**
- * A bare-bones `Array#reduce` like utility function.
- *
- * @private
- * @param {Array} array The array to iterate over.
- * @param {Function} callback The function called per iteration.
- * @returns {*} The accumulated result.
- */
- function reduce(array, callback) {
- var accumulator = null;
- each(array, function(value, index) {
- accumulator = callback(accumulator, value, index, array);
- });
- return accumulator;
- }
- /**
- * Removes leading and trailing whitespace from a string.
- *
- * @private
- * @param {string} string The string to trim.
- * @returns {string} The trimmed string.
- */
- function trim(string) {
- return String(string).replace(/^ +| +$/g, '');
- }
- /*--------------------------------------------------------------------------*/
- /**
- * Creates a new platform object.
- *
- * @memberOf platform
- * @param {Object|string} [ua=navigator.userAgent] The user agent string or
- * context object.
- * @returns {Object} A platform object.
- */
- function parse(ua) {
- /** The environment context object. */
- var context = root;
- /** Used to flag when a custom context is provided. */
- var isCustomContext = ua && typeof ua == 'object' && getClassOf(ua) != 'String';
- // Juggle arguments.
- if (isCustomContext) {
- context = ua;
- ua = null;
- }
- /** Browser navigator object. */
- var nav = context.navigator || {};
- /** Browser user agent string. */
- var userAgent = nav.userAgent || '';
- ua || (ua = userAgent);
- /** Used to flag when `thisBinding` is the [ModuleScope]. */
- var isModuleScope = isCustomContext || thisBinding == oldRoot;
- /** Used to detect if browser is like Chrome. */
- var likeChrome = isCustomContext
- ? !!nav.likeChrome
- : /\bChrome\b/.test(ua) && !/internal|\n/i.test(toString.toString());
- /** Internal `[[Class]]` value shortcuts. */
- var objectClass = 'Object',
- airRuntimeClass = isCustomContext ? objectClass : 'ScriptBridgingProxyObject',
- enviroClass = isCustomContext ? objectClass : 'Environment',
- javaClass = (isCustomContext && context.java) ? 'JavaPackage' : getClassOf(context.java),
- phantomClass = isCustomContext ? objectClass : 'RuntimeObject';
- /** Detect Java environments. */
- var java = /\bJava/.test(javaClass) && context.java;
- /** Detect Rhino. */
- var rhino = java && getClassOf(context.environment) == enviroClass;
- /** A character to represent alpha. */
- var alpha = java ? 'a' : '\u03b1';
- /** A character to represent beta. */
- var beta = java ? 'b' : '\u03b2';
- /** Browser document object. */
- var doc = context.document || {};
- /**
- * Detect Opera browser (Presto-based).
- * http://www.howtocreate.co.uk/operaStuff/operaObject.html
- * http://dev.opera.com/articles/view/opera-mini-web-content-authoring-guidelines/#operamini
- */
- var opera = context.operamini || context.opera;
- /** Opera `[[Class]]`. */
- var operaClass = reOpera.test(operaClass = (isCustomContext && opera) ? opera['[[Class]]'] : getClassOf(opera))
- ? operaClass
- : (opera = null);
- /*------------------------------------------------------------------------*/
- /** Temporary variable used over the script's lifetime. */
- var data;
- /** The CPU architecture. */
- var arch = ua;
- /** Platform description array. */
- var description = [];
- /** Platform alpha/beta indicator. */
- var prerelease = null;
- /** A flag to indicate that environment features should be used to resolve the platform. */
- var useFeatures = ua == userAgent;
- /** The browser/environment version. */
- var version = useFeatures && opera && typeof opera.version == 'function' && opera.version();
- /** A flag to indicate if the OS ends with "/ Version" */
- var isSpecialCasedOS;
- /* Detectable layout engines (order is important). */
- var layout = getLayout([
- { 'label': 'EdgeHTML', 'pattern': 'Edge' },
- 'Trident',
- { 'label': 'WebKit', 'pattern': 'AppleWebKit' },
- 'iCab',
- 'Presto',
- 'NetFront',
- 'Tasman',
- 'KHTML',
- 'Gecko'
- ]);
- /* Detectable browser names (order is important). */
- var name = getName([
- 'Adobe AIR',
- 'Arora',
- 'Avant Browser',
- 'Breach',
- 'Camino',
- 'Electron',
- 'Epiphany',
- 'Fennec',
- 'Flock',
- 'Galeon',
- 'GreenBrowser',
- 'iCab',
- 'Iceweasel',
- 'K-Meleon',
- 'Konqueror',
- 'Lunascape',
- 'Maxthon',
- { 'label': 'Microsoft Edge', 'pattern': '(?:Edge|Edg|EdgA|EdgiOS)' },
- 'Midori',
- 'Nook Browser',
- 'PaleMoon',
- 'PhantomJS',
- 'Raven',
- 'Rekonq',
- 'RockMelt',
- { 'label': 'Samsung Internet', 'pattern': 'SamsungBrowser' },
- 'SeaMonkey',
- { 'label': 'Silk', 'pattern': '(?:Cloud9|Silk-Accelerated)' },
- 'Sleipnir',
- 'SlimBrowser',
- { 'label': 'SRWare Iron', 'pattern': 'Iron' },
- 'Sunrise',
- 'Swiftfox',
- 'Vivaldi',
- 'Waterfox',
- 'WebPositive',
- { 'label': 'Yandex Browser', 'pattern': 'YaBrowser' },
- { 'label': 'UC Browser', 'pattern': 'UCBrowser' },
- 'Opera Mini',
- { 'label': 'Opera Mini', 'pattern': 'OPiOS' },
- 'Opera',
- { 'label': 'Opera', 'pattern': 'OPR' },
- 'Chromium',
- 'Chrome',
- { 'label': 'Chrome', 'pattern': '(?:HeadlessChrome)' },
- { 'label': 'Chrome Mobile', 'pattern': '(?:CriOS|CrMo)' },
- { 'label': 'Firefox', 'pattern': '(?:Firefox|Minefield)' },
- { 'label': 'Firefox for iOS', 'pattern': 'FxiOS' },
- { 'label': 'IE', 'pattern': 'IEMobile' },
- { 'label': 'IE', 'pattern': 'MSIE' },
- 'Safari'
- ]);
- /* Detectable products (order is important). */
- var product = getProduct([
- { 'label': 'BlackBerry', 'pattern': 'BB10' },
- 'BlackBerry',
- { 'label': 'Galaxy S', 'pattern': 'GT-I9000' },
- { 'label': 'Galaxy S2', 'pattern': 'GT-I9100' },
- { 'label': 'Galaxy S3', 'pattern': 'GT-I9300' },
- { 'label': 'Galaxy S4', 'pattern': 'GT-I9500' },
- { 'label': 'Galaxy S5', 'pattern': 'SM-G900' },
- { 'label': 'Galaxy S6', 'pattern': 'SM-G920' },
- { 'label': 'Galaxy S6 Edge', 'pattern': 'SM-G925' },
- { 'label': 'Galaxy S7', 'pattern': 'SM-G930' },
- { 'label': 'Galaxy S7 Edge', 'pattern': 'SM-G935' },
- 'Google TV',
- 'Lumia',
- 'iPad',
- 'iPod',
- 'iPhone',
- 'Kindle',
- { 'label': 'Kindle Fire', 'pattern': '(?:Cloud9|Silk-Accelerated)' },
- 'Nexus',
- 'Nook',
- 'PlayBook',
- 'PlayStation Vita',
- 'PlayStation',
- 'TouchPad',
- 'Transformer',
- { 'label': 'Wii U', 'pattern': 'WiiU' },
- 'Wii',
- 'Xbox One',
- { 'label': 'Xbox 360', 'pattern': 'Xbox' },
- 'Xoom'
- ]);
- /* Detectable manufacturers. */
- var manufacturer = getManufacturer({
- 'Apple': { 'iPad': 1, 'iPhone': 1, 'iPod': 1 },
- 'Alcatel': {},
- 'Archos': {},
- 'Amazon': { 'Kindle': 1, 'Kindle Fire': 1 },
- 'Asus': { 'Transformer': 1 },
- 'Barnes & Noble': { 'Nook': 1 },
- 'BlackBerry': { 'PlayBook': 1 },
- 'Google': { 'Google TV': 1, 'Nexus': 1 },
- 'HP': { 'TouchPad': 1 },
- 'HTC': {},
- 'Huawei': {},
- 'Lenovo': {},
- 'LG': {},
- 'Microsoft': { 'Xbox': 1, 'Xbox One': 1 },
- 'Motorola': { 'Xoom': 1 },
- 'Nintendo': { 'Wii U': 1, 'Wii': 1 },
- 'Nokia': { 'Lumia': 1 },
- 'Oppo': {},
- 'Samsung': { 'Galaxy S': 1, 'Galaxy S2': 1, 'Galaxy S3': 1, 'Galaxy S4': 1 },
- 'Sony': { 'PlayStation': 1, 'PlayStation Vita': 1 },
- 'Xiaomi': { 'Mi': 1, 'Redmi': 1 }
- });
- /* Detectable operating systems (order is important). */
- var os = getOS([
- 'Windows Phone',
- 'KaiOS',
- 'Android',
- 'CentOS',
- { 'label': 'Chrome OS', 'pattern': 'CrOS' },
- 'Debian',
- { 'label': 'DragonFly BSD', 'pattern': 'DragonFly' },
- 'Fedora',
- 'FreeBSD',
- 'Gentoo',
- 'Haiku',
- 'Kubuntu',
- 'Linux Mint',
- 'OpenBSD',
- 'Red Hat',
- 'SuSE',
- 'Ubuntu',
- 'Xubuntu',
- 'Cygwin',
- 'Symbian OS',
- 'hpwOS',
- 'webOS ',
- 'webOS',
- 'Tablet OS',
- 'Tizen',
- 'Linux',
- 'Mac OS X',
- 'Macintosh',
- 'Mac',
- 'Windows 98;',
- 'Windows '
- ]);
- /*------------------------------------------------------------------------*/
- /**
- * Picks the layout engine from an array of guesses.
- *
- * @private
- * @param {Array} guesses An array of guesses.
- * @returns {null|string} The detected layout engine.
- */
- function getLayout(guesses) {
- return reduce(guesses, function(result, guess) {
- return result || RegExp('\\b' + (
- guess.pattern || qualify(guess)
- ) + '\\b', 'i').exec(ua) && (guess.label || guess);
- });
- }
- /**
- * Picks the manufacturer from an array of guesses.
- *
- * @private
- * @param {Array} guesses An object of guesses.
- * @returns {null|string} The detected manufacturer.
- */
- function getManufacturer(guesses) {
- return reduce(guesses, function(result, value, key) {
- // Lookup the manufacturer by product or scan the UA for the manufacturer.
- return result || (
- value[product] ||
- value[/^[a-z]+(?: +[a-z]+\b)*/i.exec(product)] ||
- RegExp('\\b' + qualify(key) + '(?:\\b|\\w*\\d)', 'i').exec(ua)
- ) && key;
- });
- }
- /**
- * Picks the browser name from an array of guesses.
- *
- * @private
- * @param {Array} guesses An array of guesses.
- * @returns {null|string} The detected browser name.
- */
- function getName(guesses) {
- return reduce(guesses, function(result, guess) {
- return result || RegExp('\\b' + (
- guess.pattern || qualify(guess)
- ) + '\\b', 'i').exec(ua) && (guess.label || guess);
- });
- }
- /**
- * Picks the OS name from an array of guesses.
- *
- * @private
- * @param {Array} guesses An array of guesses.
- * @returns {null|string} The detected OS name.
- */
- function getOS(guesses) {
- return reduce(guesses, function(result, guess) {
- var pattern = guess.pattern || qualify(guess);
- if (!result && (result =
- RegExp('\\b' + pattern + '(?:/[\\d.]+|[ \\w.]*)', 'i').exec(ua)
- )) {
- result = cleanupOS(result, pattern, guess.label || guess);
- }
- return result;
- });
- }
- /**
- * Picks the product name from an array of guesses.
- *
- * @private
- * @param {Array} guesses An array of guesses.
- * @returns {null|string} The detected product name.
- */
- function getProduct(guesses) {
- return reduce(guesses, function(result, guess) {
- var pattern = guess.pattern || qualify(guess);
- if (!result && (result =
- RegExp('\\b' + pattern + ' *\\d+[.\\w_]*', 'i').exec(ua) ||
- RegExp('\\b' + pattern + ' *\\w+-[\\w]*', 'i').exec(ua) ||
- RegExp('\\b' + pattern + '(?:; *(?:[a-z]+[_-])?[a-z]+\\d+|[^ ();-]*)', 'i').exec(ua)
- )) {
- // Split by forward slash and append product version if needed.
- if ((result = String((guess.label && !RegExp(pattern, 'i').test(guess.label)) ? guess.label : result).split('/'))[1] && !/[\d.]+/.test(result[0])) {
- result[0] += ' ' + result[1];
- }
- // Correct character case and cleanup string.
- guess = guess.label || guess;
- result = format(result[0]
- .replace(RegExp(pattern, 'i'), guess)
- .replace(RegExp('; *(?:' + guess + '[_-])?', 'i'), ' ')
- .replace(RegExp('(' + guess + ')[-_.]?(\\w)', 'i'), '$1 $2'));
- }
- return result;
- });
- }
- /**
- * Resolves the version using an array of UA patterns.
- *
- * @private
- * @param {Array} patterns An array of UA patterns.
- * @returns {null|string} The detected version.
- */
- function getVersion(patterns) {
- return reduce(patterns, function(result, pattern) {
- return result || (RegExp(pattern +
- '(?:-[\\d.]+/|(?: for [\\w-]+)?[ /-])([\\d.]+[^ ();/_-]*)', 'i').exec(ua) || 0)[1] || null;
- });
- }
- /**
- * Returns `platform.description` when the platform object is coerced to a string.
- *
- * @name toString
- * @memberOf platform
- * @returns {string} Returns `platform.description` if available, else an empty string.
- */
- function toStringPlatform() {
- return this.description || '';
- }
- /*------------------------------------------------------------------------*/
- // Convert layout to an array so we can add extra details.
- layout && (layout = [layout]);
- // Detect Android products.
- // Browsers on Android devices typically provide their product IDS after "Android;"
- // up to "Build" or ") AppleWebKit".
- // Example:
- // "Mozilla/5.0 (Linux; Android 8.1.0; Moto G (5) Plus) AppleWebKit/537.36
- // (KHTML, like Gecko) Chrome/70.0.3538.80 Mobile Safari/537.36"
- if (/\bAndroid\b/.test(os) && !product &&
- (data = /\bAndroid[^;]*;(.*?)(?:Build|\) AppleWebKit)\b/i.exec(ua))) {
- product = trim(data[1])
- // Replace any language codes (eg. "en-US").
- .replace(/^[a-z]{2}-[a-z]{2};\s*/i, '')
- || null;
- }
- // Detect product names that contain their manufacturer's name.
- if (manufacturer && !product) {
- product = getProduct([manufacturer]);
- } else if (manufacturer && product) {
- product = product
- .replace(RegExp('^(' + qualify(manufacturer) + ')[-_.\\s]', 'i'), manufacturer + ' ')
- .replace(RegExp('^(' + qualify(manufacturer) + ')[-_.]?(\\w)', 'i'), manufacturer + ' $2');
- }
- // Clean up Google TV.
- if ((data = /\bGoogle TV\b/.exec(product))) {
- product = data[0];
- }
- // Detect simulators.
- if (/\bSimulator\b/i.test(ua)) {
- product = (product ? product + ' ' : '') + 'Simulator';
- }
- // Detect Opera Mini 8+ running in Turbo/Uncompressed mode on iOS.
- if (name == 'Opera Mini' && /\bOPiOS\b/.test(ua)) {
- description.push('running in Turbo/Uncompressed mode');
- }
- // Detect IE Mobile 11.
- if (name == 'IE' && /\blike iPhone OS\b/.test(ua)) {
- data = parse(ua.replace(/like iPhone OS/, ''));
- manufacturer = data.manufacturer;
- product = data.product;
- }
- // Detect iOS.
- else if (/^iP/.test(product)) {
- name || (name = 'Safari');
- os = 'iOS' + ((data = / OS ([\d_]+)/i.exec(ua))
- ? ' ' + data[1].replace(/_/g, '.')
- : '');
- }
- // Detect Kubuntu.
- else if (name == 'Konqueror' && /^Linux\b/i.test(os)) {
- os = 'Kubuntu';
- }
- // Detect Android browsers.
- else if ((manufacturer && manufacturer != 'Google' &&
- ((/Chrome/.test(name) && !/\bMobile Safari\b/i.test(ua)) || /\bVita\b/.test(product))) ||
- (/\bAndroid\b/.test(os) && /^Chrome/.test(name) && /\bVersion\//i.test(ua))) {
- name = 'Android Browser';
- os = /\bAndroid\b/.test(os) ? os : 'Android';
- }
- // Detect Silk desktop/accelerated modes.
- else if (name == 'Silk') {
- if (!/\bMobi/i.test(ua)) {
- os = 'Android';
- description.unshift('desktop mode');
- }
- if (/Accelerated *= *true/i.test(ua)) {
- description.unshift('accelerated');
- }
- }
- // Detect UC Browser speed mode.
- else if (name == 'UC Browser' && /\bUCWEB\b/.test(ua)) {
- description.push('speed mode');
- }
- // Detect PaleMoon identifying as Firefox.
- else if (name == 'PaleMoon' && (data = /\bFirefox\/([\d.]+)\b/.exec(ua))) {
- description.push('identifying as Firefox ' + data[1]);
- }
- // Detect Firefox OS and products running Firefox.
- else if (name == 'Firefox' && (data = /\b(Mobile|Tablet|TV)\b/i.exec(ua))) {
- os || (os = 'Firefox OS');
- product || (product = data[1]);
- }
- // Detect false positives for Firefox/Safari.
- else if (!name || (data = !/\bMinefield\b/i.test(ua) && /\b(?:Firefox|Safari)\b/.exec(name))) {
- // Escape the `/` for Firefox 1.
- if (name && !product && /[\/,]|^[^(]+?\)/.test(ua.slice(ua.indexOf(data + '/') + 8))) {
- // Clear name of false positives.
- name = null;
- }
- // Reassign a generic name.
- if ((data = product || manufacturer || os) &&
- (product || manufacturer || /\b(?:Android|Symbian OS|Tablet OS|webOS)\b/.test(os))) {
- name = /[a-z]+(?: Hat)?/i.exec(/\bAndroid\b/.test(os) ? os : data) + ' Browser';
- }
- }
- // Add Chrome version to description for Electron.
- else if (name == 'Electron' && (data = (/\bChrome\/([\d.]+)\b/.exec(ua) || 0)[1])) {
- description.push('Chromium ' + data);
- }
- // Detect non-Opera (Presto-based) versions (order is important).
- if (!version) {
- version = getVersion([
- '(?:Cloud9|CriOS|CrMo|Edge|Edg|EdgA|EdgiOS|FxiOS|HeadlessChrome|IEMobile|Iron|Opera ?Mini|OPiOS|OPR|Raven|SamsungBrowser|Silk(?!/[\\d.]+$)|UCBrowser|YaBrowser)',
- 'Version',
- qualify(name),
- '(?:Firefox|Minefield|NetFront)'
- ]);
- }
- // Detect stubborn layout engines.
- if ((data =
- layout == 'iCab' && parseFloat(version) > 3 && 'WebKit' ||
- /\bOpera\b/.test(name) && (/\bOPR\b/.test(ua) ? 'Blink' : 'Presto') ||
- /\b(?:Midori|Nook|Safari)\b/i.test(ua) && !/^(?:Trident|EdgeHTML)$/.test(layout) && 'WebKit' ||
- !layout && /\bMSIE\b/i.test(ua) && (os == 'Mac OS' ? 'Tasman' : 'Trident') ||
- layout == 'WebKit' && /\bPlayStation\b(?! Vita\b)/i.test(name) && 'NetFront'
- )) {
- layout = [data];
- }
- // Detect Windows Phone 7 desktop mode.
- if (name == 'IE' && (data = (/; *(?:XBLWP|ZuneWP)(\d+)/i.exec(ua) || 0)[1])) {
- name += ' Mobile';
- os = 'Windows Phone ' + (/\+$/.test(data) ? data : data + '.x');
- description.unshift('desktop mode');
- }
- // Detect Windows Phone 8.x desktop mode.
- else if (/\bWPDesktop\b/i.test(ua)) {
- name = 'IE Mobile';
- os = 'Windows Phone 8.x';
- description.unshift('desktop mode');
- version || (version = (/\brv:([\d.]+)/.exec(ua) || 0)[1]);
- }
- // Detect IE 11 identifying as other browsers.
- else if (name != 'IE' && layout == 'Trident' && (data = /\brv:([\d.]+)/.exec(ua))) {
- if (name) {
- description.push('identifying as ' + name + (version ? ' ' + version : ''));
- }
- name = 'IE';
- version = data[1];
- }
- // Leverage environment features.
- if (useFeatures) {
- // Detect server-side environments.
- // Rhino has a global function while others have a global object.
- if (isHostType(context, 'global')) {
- if (java) {
- data = java.lang.System;
- arch = data.getProperty('os.arch');
- os = os || data.getProperty('os.name') + ' ' + data.getProperty('os.version');
- }
- if (rhino) {
- try {
- version = context.require('ringo/engine').version.join('.');
- name = 'RingoJS';
- } catch(e) {
- if ((data = context.system) && data.global.system == context.system) {
- name = 'Narwhal';
- os || (os = data[0].os || null);
- }
- }
- if (!name) {
- name = 'Rhino';
- }
- }
- else if (
- typeof context.process == 'object' && !context.process.browser &&
- (data = context.process)
- ) {
- if (typeof data.versions == 'object') {
- if (typeof data.versions.electron == 'string') {
- description.push('Node ' + data.versions.node);
- name = 'Electron';
- version = data.versions.electron;
- } else if (typeof data.versions.nw == 'string') {
- description.push('Chromium ' + version, 'Node ' + data.versions.node);
- name = 'NW.js';
- version = data.versions.nw;
- }
- }
- if (!name) {
- name = 'Node.js';
- arch = data.arch;
- os = data.platform;
- version = /[\d.]+/.exec(data.version);
- version = version ? version[0] : null;
- }
- }
- }
- // Detect Adobe AIR.
- else if (getClassOf((data = context.runtime)) == airRuntimeClass) {
- name = 'Adobe AIR';
- os = data.flash.system.Capabilities.os;
- }
- // Detect PhantomJS.
- else if (getClassOf((data = context.phantom)) == phantomClass) {
- name = 'PhantomJS';
- version = (data = data.version || null) && (data.major + '.' + data.minor + '.' + data.patch);
- }
- // Detect IE compatibility modes.
- else if (typeof doc.documentMode == 'number' && (data = /\bTrident\/(\d+)/i.exec(ua))) {
- // We're in compatibility mode when the Trident version + 4 doesn't
- // equal the document mode.
- version = [version, doc.documentMode];
- if ((data = +data[1] + 4) != version[1]) {
- description.push('IE ' + version[1] + ' mode');
- layout && (layout[1] = '');
- version[1] = data;
- }
- version = name == 'IE' ? String(version[1].toFixed(1)) : version[0];
- }
- // Detect IE 11 masking as other browsers.
- else if (typeof doc.documentMode == 'number' && /^(?:Chrome|Firefox)\b/.test(name)) {
- description.push('masking as ' + name + ' ' + version);
- name = 'IE';
- version = '11.0';
- layout = ['Trident'];
- os = 'Windows';
- }
- os = os && format(os);
- }
- // Detect prerelease phases.
- if (version && (data =
- /(?:[ab]|dp|pre|[ab]\d+pre)(?:\d+\+?)?$/i.exec(version) ||
- /(?:alpha|beta)(?: ?\d)?/i.exec(ua + ';' + (useFeatures && nav.appMinorVersion)) ||
- /\bMinefield\b/i.test(ua) && 'a'
- )) {
- prerelease = /b/i.test(data) ? 'beta' : 'alpha';
- version = version.replace(RegExp(data + '\\+?$'), '') +
- (prerelease == 'beta' ? beta : alpha) + (/\d+\+?/.exec(data) || '');
- }
- // Detect Firefox Mobile.
- if (name == 'Fennec' || name == 'Firefox' && /\b(?:Android|Firefox OS|KaiOS)\b/.test(os)) {
- name = 'Firefox Mobile';
- }
- // Obscure Maxthon's unreliable version.
- else if (name == 'Maxthon' && version) {
- version = version.replace(/\.[\d.]+/, '.x');
- }
- // Detect Xbox 360 and Xbox One.
- else if (/\bXbox\b/i.test(product)) {
- if (product == 'Xbox 360') {
- os = null;
- }
- if (product == 'Xbox 360' && /\bIEMobile\b/.test(ua)) {
- description.unshift('mobile mode');
- }
- }
- // Add mobile postfix.
- else if ((/^(?:Chrome|IE|Opera)$/.test(name) || name && !product && !/Browser|Mobi/.test(name)) &&
- (os == 'Windows CE' || /Mobi/i.test(ua))) {
- name += ' Mobile';
- }
- // Detect IE platform preview.
- else if (name == 'IE' && useFeatures) {
- try {
- if (context.external === null) {
- description.unshift('platform preview');
- }
- } catch(e) {
- description.unshift('embedded');
- }
- }
- // Detect BlackBerry OS version.
- // http://docs.blackberry.com/en/developers/deliverables/18169/HTTP_headers_sent_by_BB_Browser_1234911_11.jsp
- else if ((/\bBlackBerry\b/.test(product) || /\bBB10\b/.test(ua)) && (data =
- (RegExp(product.replace(/ +/g, ' *') + '/([.\\d]+)', 'i').exec(ua) || 0)[1] ||
- version
- )) {
- data = [data, /BB10/.test(ua)];
- os = (data[1] ? (product = null, manufacturer = 'BlackBerry') : 'Device Software') + ' ' + data[0];
- version = null;
- }
- // Detect Opera identifying/masking itself as another browser.
- // http://www.opera.com/support/kb/view/843/
- else if (this != forOwn && product != 'Wii' && (
- (useFeatures && opera) ||
- (/Opera/.test(name) && /\b(?:MSIE|Firefox)\b/i.test(ua)) ||
- (name == 'Firefox' && /\bOS X (?:\d+\.){2,}/.test(os)) ||
- (name == 'IE' && (
- (os && !/^Win/.test(os) && version > 5.5) ||
- /\bWindows XP\b/.test(os) && version > 8 ||
- version == 8 && !/\bTrident\b/.test(ua)
- ))
- ) && !reOpera.test((data = parse.call(forOwn, ua.replace(reOpera, '') + ';'))) && data.name) {
- // When "identifying", the UA contains both Opera and the other browser's name.
- data = 'ing as ' + data.name + ((data = data.version) ? ' ' + data : '');
- if (reOpera.test(name)) {
- if (/\bIE\b/.test(data) && os == 'Mac OS') {
- os = null;
- }
- data = 'identify' + data;
- }
- // When "masking", the UA contains only the other browser's name.
- else {
- data = 'mask' + data;
- if (operaClass) {
- name = format(operaClass.replace(/([a-z])([A-Z])/g, '$1 $2'));
- } else {
- name = 'Opera';
- }
- if (/\bIE\b/.test(data)) {
- os = null;
- }
- if (!useFeatures) {
- version = null;
- }
- }
- layout = ['Presto'];
- description.push(data);
- }
- // Detect WebKit Nightly and approximate Chrome/Safari versions.
- if ((data = (/\bAppleWebKit\/([\d.]+\+?)/i.exec(ua) || 0)[1])) {
- // Correct build number for numeric comparison.
- // (e.g. "532.5" becomes "532.05")
- data = [parseFloat(data.replace(/\.(\d)$/, '.0$1')), data];
- // Nightly builds are postfixed with a "+".
- if (name == 'Safari' && data[1].slice(-1) == '+') {
- name = 'WebKit Nightly';
- prerelease = 'alpha';
- version = data[1].slice(0, -1);
- }
- // Clear incorrect browser versions.
- else if (version == data[1] ||
- version == (data[2] = (/\bSafari\/([\d.]+\+?)/i.exec(ua) || 0)[1])) {
- version = null;
- }
- // Use the full Chrome version when available.
- data[1] = (/\b(?:Headless)?Chrome\/([\d.]+)/i.exec(ua) || 0)[1];
- // Detect Blink layout engine.
- if (data[0] == 537.36 && data[2] == 537.36 && parseFloat(data[1]) >= 28 && layout == 'WebKit') {
- layout = ['Blink'];
- }
- // Detect JavaScriptCore.
- // http://stackoverflow.com/questions/6768474/how-can-i-detect-which-javascript-engine-v8-or-jsc-is-used-at-runtime-in-androi
- if (!useFeatures || (!likeChrome && !data[1])) {
- layout && (layout[1] = 'like Safari');
- 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');
- } else {
- layout && (layout[1] = 'like Chrome');
- 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');
- }
- // Add the postfix of ".x" or "+" for approximate versions.
- layout && (layout[1] += ' ' + (data += typeof data == 'number' ? '.x' : /[.+]/.test(data) ? '' : '+'));
- // Obscure version for some Safari 1-2 releases.
- if (name == 'Safari' && (!version || parseInt(version) > 45)) {
- version = data;
- } else if (name == 'Chrome' && /\bHeadlessChrome/i.test(ua)) {
- description.unshift('headless');
- }
- }
- // Detect Opera desktop modes.
- if (name == 'Opera' && (data = /\bzbov|zvav$/.exec(os))) {
- name += ' ';
- description.unshift('desktop mode');
- if (data == 'zvav') {
- name += 'Mini';
- version = null;
- } else {
- name += 'Mobile';
- }
- os = os.replace(RegExp(' *' + data + '$'), '');
- }
- // Detect Chrome desktop mode.
- else if (name == 'Safari' && /\bChrome\b/.exec(layout && layout[1])) {
- description.unshift('desktop mode');
- name = 'Chrome Mobile';
- version = null;
- if (/\bOS X\b/.test(os)) {
- manufacturer = 'Apple';
- os = 'iOS 4.3+';
- } else {
- os = null;
- }
- }
- // Newer versions of SRWare Iron uses the Chrome tag to indicate its version number.
- else if (/\bSRWare Iron\b/.test(name) && !version) {
- version = getVersion('Chrome');
- }
- // Strip incorrect OS versions.
- if (version && version.indexOf((data = /[\d.]+$/.exec(os))) == 0 &&
- ua.indexOf('/' + data + '-') > -1) {
- os = trim(os.replace(data, ''));
- }
- // Ensure OS does not include the browser name.
- if (os && os.indexOf(name) != -1 && !RegExp(name + ' OS').test(os)) {
- os = os.replace(RegExp(' *' + qualify(name) + ' *'), '');
- }
- // Add layout engine.
- if (layout && !/\b(?:Avant|Nook)\b/.test(name) && (
- /Browser|Lunascape|Maxthon/.test(name) ||
- name != 'Safari' && /^iOS/.test(os) && /\bSafari\b/.test(layout[1]) ||
- /^(?:Adobe|Arora|Breach|Midori|Opera|Phantom|Rekonq|Rock|Samsung Internet|Sleipnir|SRWare Iron|Vivaldi|Web)/.test(name) && layout[1])) {
- // Don't add layout details to description if they are falsey.
- (data = layout[layout.length - 1]) && description.push(data);
- }
- // Combine contextual information.
- if (description.length) {
- description = ['(' + description.join('; ') + ')'];
- }
- // Append manufacturer to description.
- if (manufacturer && product && product.indexOf(manufacturer) < 0) {
- description.push('on ' + manufacturer);
- }
- // Append product to description.
- if (product) {
- description.push((/^on /.test(description[description.length - 1]) ? '' : 'on ') + product);
- }
- // Parse the OS into an object.
- if (os) {
- data = / ([\d.+]+)$/.exec(os);
- isSpecialCasedOS = data && os.charAt(os.length - data[0].length - 1) == '/';
- os = {
- 'architecture': 32,
- 'family': (data && !isSpecialCasedOS) ? os.replace(data[0], '') : os,
- 'version': data ? data[1] : null,
- 'toString': function() {
- var version = this.version;
- return this.family + ((version && !isSpecialCasedOS) ? ' ' + version : '') + (this.architecture == 64 ? ' 64-bit' : '');
- }
- };
- }
- // Add browser/OS architecture.
- if ((data = /\b(?:AMD|IA|Win|WOW|x86_|x)64\b/i.exec(arch)) && !/\bi686\b/i.test(arch)) {
- if (os) {
- os.architecture = 64;
- os.family = os.family.replace(RegExp(' *' + data), '');
- }
- if (
- name && (/\bWOW64\b/i.test(ua) ||
- (useFeatures && /\w(?:86|32)$/.test(nav.cpuClass || nav.platform) && !/\bWin64; x64\b/i.test(ua)))
- ) {
- description.unshift('32-bit');
- }
- }
- // Chrome 39 and above on OS X is always 64-bit.
- else if (
- os && /^OS X/.test(os.family) &&
- name == 'Chrome' && parseFloat(version) >= 39
- ) {
- os.architecture = 64;
- }
- ua || (ua = null);
- /*------------------------------------------------------------------------*/
- /**
- * The platform object.
- *
- * @name platform
- * @type Object
- */
- var platform = {};
- /**
- * The platform description.
- *
- * @memberOf platform
- * @type string|null
- */
- platform.description = ua;
- /**
- * The name of the browser's layout engine.
- *
- * The list of common layout engines include:
- * "Blink", "EdgeHTML", "Gecko", "Trident" and "WebKit"
- *
- * @memberOf platform
- * @type string|null
- */
- platform.layout = layout && layout[0];
- /**
- * The name of the product's manufacturer.
- *
- * The list of manufacturers include:
- * "Apple", "Archos", "Amazon", "Asus", "Barnes & Noble", "BlackBerry",
- * "Google", "HP", "HTC", "LG", "Microsoft", "Motorola", "Nintendo",
- * "Nokia", "Samsung" and "Sony"
- *
- * @memberOf platform
- * @type string|null
- */
- platform.manufacturer = manufacturer;
- /**
- * The name of the browser/environment.
- *
- * The list of common browser names include:
- * "Chrome", "Electron", "Firefox", "Firefox for iOS", "IE",
- * "Microsoft Edge", "PhantomJS", "Safari", "SeaMonkey", "Silk",
- * "Opera Mini" and "Opera"
- *
- * Mobile versions of some browsers have "Mobile" appended to their name:
- * eg. "Chrome Mobile", "Firefox Mobile", "IE Mobile" and "Opera Mobile"
- *
- * @memberOf platform
- * @type string|null
- */
- platform.name = name;
- /**
- * The alpha/beta release indicator.
- *
- * @memberOf platform
- * @type string|null
- */
- platform.prerelease = prerelease;
- /**
- * The name of the product hosting the browser.
- *
- * The list of common products include:
- *
- * "BlackBerry", "Galaxy S4", "Lumia", "iPad", "iPod", "iPhone", "Kindle",
- * "Kindle Fire", "Nexus", "Nook", "PlayBook", "TouchPad" and "Transformer"
- *
- * @memberOf platform
- * @type string|null
- */
- platform.product = product;
- /**
- * The browser's user agent string.
- *
- * @memberOf platform
- * @type string|null
- */
- platform.ua = ua;
- /**
- * The browser/environment version.
- *
- * @memberOf platform
- * @type string|null
- */
- platform.version = name && version;
- /**
- * The name of the operating system.
- *
- * @memberOf platform
- * @type Object
- */
- platform.os = os || {
- /**
- * The CPU architecture the OS is built for.
- *
- * @memberOf platform.os
- * @type number|null
- */
- 'architecture': null,
- /**
- * The family of the OS.
- *
- * Common values include:
- * "Windows", "Windows Server 2008 R2 / 7", "Windows Server 2008 / Vista",
- * "Windows XP", "OS X", "Linux", "Ubuntu", "Debian", "Fedora", "Red Hat",
- * "SuSE", "Android", "iOS" and "Windows Phone"
- *
- * @memberOf platform.os
- * @type string|null
- */
- 'family': null,
- /**
- * The version of the OS.
- *
- * @memberOf platform.os
- * @type string|null
- */
- 'version': null,
- /**
- * Returns the OS string.
- *
- * @memberOf platform.os
- * @returns {string} The OS string.
- */
- 'toString': function() { return 'null'; }
- };
- platform.parse = parse;
- platform.toString = toStringPlatform;
- if (platform.version) {
- description.unshift(version);
- }
- if (platform.name) {
- description.unshift(name);
- }
- if (os && name && !(os == String(os).split(' ')[0] && (os == name.split(' ')[0] || product))) {
- description.push(product ? '(' + os + ')' : 'on ' + os);
- }
- if (description.length) {
- platform.description = description.join(' ');
- }
- return platform;
- }
- /*--------------------------------------------------------------------------*/
- // Export platform.
- var platform = parse();
- // Some AMD build optimizers, like r.js, check for condition patterns like the following:
- if (typeof define == 'function' && typeof define.amd == 'object' && define.amd) {
- // Expose platform on the global object to prevent errors when platform is
- // loaded by a script tag in the presence of an AMD loader.
- // See http://requirejs.org/docs/errors.html#mismatch for more details.
- root.platform = platform;
- // Define as an anonymous module so platform can be aliased through path mapping.
- define(function() {
- return platform;
- });
- }
- // Check for `exports` after `define` in case a build optimizer adds an `exports` object.
- else if (freeExports && freeModule) {
- // Export for CommonJS support.
- forOwn(platform, function(value, key) {
- freeExports[key] = value;
- });
- }
- else {
- // Export to the global object.
- root.platform = platform;
- }
- }.call(this));
- }).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
- },{}],323:[function(require,module,exports){
- (function (process){(function (){
- 'use strict';
- if (typeof process === 'undefined' ||
- !process.version ||
- process.version.indexOf('v0.') === 0 ||
- process.version.indexOf('v1.') === 0 && process.version.indexOf('v1.8.') !== 0) {
- module.exports = { nextTick: nextTick };
- } else {
- module.exports = process
- }
- function nextTick(fn, arg1, arg2, arg3) {
- if (typeof fn !== 'function') {
- throw new TypeError('"callback" argument must be a function');
- }
- var len = arguments.length;
- var args, i;
- switch (len) {
- case 0:
- case 1:
- return process.nextTick(fn);
- case 2:
- return process.nextTick(function afterTickOne() {
- fn.call(null, arg1);
- });
- case 3:
- return process.nextTick(function afterTickTwo() {
- fn.call(null, arg1, arg2);
- });
- case 4:
- return process.nextTick(function afterTickThree() {
- fn.call(null, arg1, arg2, arg3);
- });
- default:
- args = new Array(len - 1);
- i = 0;
- while (i < args.length) {
- args[i++] = arguments[i];
- }
- return process.nextTick(function afterTick() {
- fn.apply(null, args);
- });
- }
- }
- }).call(this)}).call(this,require('_process'))
- },{"_process":399}],324:[function(require,module,exports){
- // shim for using process in browser
- var process = module.exports = {};
- // cached from whatever global is present so that test runners that stub it
- // don't break things. But we need to wrap it in a try catch in case it is
- // wrapped in strict mode code which doesn't define any globals. It's inside a
- // function because try/catches deoptimize in certain engines.
- var cachedSetTimeout;
- var cachedClearTimeout;
- function defaultSetTimout() {
- throw new Error('setTimeout has not been defined');
- }
- function defaultClearTimeout () {
- throw new Error('clearTimeout has not been defined');
- }
- (function () {
- try {
- if (typeof setTimeout === 'function') {
- cachedSetTimeout = setTimeout;
- } else {
- cachedSetTimeout = defaultSetTimout;
- }
- } catch (e) {
- cachedSetTimeout = defaultSetTimout;
- }
- try {
- if (typeof clearTimeout === 'function') {
- cachedClearTimeout = clearTimeout;
- } else {
- cachedClearTimeout = defaultClearTimeout;
- }
- } catch (e) {
- cachedClearTimeout = defaultClearTimeout;
- }
- } ())
- function runTimeout(fun) {
- if (cachedSetTimeout === setTimeout) {
- //normal enviroments in sane situations
- return setTimeout(fun, 0);
- }
- // if setTimeout wasn't available but was latter defined
- if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
- cachedSetTimeout = setTimeout;
- return setTimeout(fun, 0);
- }
- try {
- // when when somebody has screwed with setTimeout but no I.E. maddness
- return cachedSetTimeout(fun, 0);
- } catch(e){
- try {
- // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
- return cachedSetTimeout.call(null, fun, 0);
- } catch(e){
- // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error
- return cachedSetTimeout.call(this, fun, 0);
- }
- }
- }
- function runClearTimeout(marker) {
- if (cachedClearTimeout === clearTimeout) {
- //normal enviroments in sane situations
- return clearTimeout(marker);
- }
- // if clearTimeout wasn't available but was latter defined
- if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
- cachedClearTimeout = clearTimeout;
- return clearTimeout(marker);
- }
- try {
- // when when somebody has screwed with setTimeout but no I.E. maddness
- return cachedClearTimeout(marker);
- } catch (e){
- try {
- // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
- return cachedClearTimeout.call(null, marker);
- } catch (e){
- // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.
- // Some versions of I.E. have different rules for clearTimeout vs setTimeout
- return cachedClearTimeout.call(this, marker);
- }
- }
- }
- var queue = [];
- var draining = false;
- var currentQueue;
- var queueIndex = -1;
- function cleanUpNextTick() {
- if (!draining || !currentQueue) {
- return;
- }
- draining = false;
- if (currentQueue.length) {
- queue = currentQueue.concat(queue);
- } else {
- queueIndex = -1;
- }
- if (queue.length) {
- drainQueue();
- }
- }
- function drainQueue() {
- if (draining) {
- return;
- }
- var timeout = runTimeout(cleanUpNextTick);
- draining = true;
- var len = queue.length;
- while(len) {
- currentQueue = queue;
- queue = [];
- while (++queueIndex < len) {
- if (currentQueue) {
- currentQueue[queueIndex].run();
- }
- }
- queueIndex = -1;
- len = queue.length;
- }
- currentQueue = null;
- draining = false;
- runClearTimeout(timeout);
- }
- process.nextTick = function (fun) {
- var args = new Array(arguments.length - 1);
- if (arguments.length > 1) {
- for (var i = 1; i < arguments.length; i++) {
- args[i - 1] = arguments[i];
- }
- }
- queue.push(new Item(fun, args));
- if (queue.length === 1 && !draining) {
- runTimeout(drainQueue);
- }
- };
- // v8 likes predictible objects
- function Item(fun, array) {
- this.fun = fun;
- this.array = array;
- }
- Item.prototype.run = function () {
- this.fun.apply(null, this.array);
- };
- process.title = 'browser';
- process.browser = true;
- process.env = {};
- process.argv = [];
- process.version = ''; // empty string to avoid regexp issues
- process.versions = {};
- function noop() {}
- process.on = noop;
- process.addListener = noop;
- process.once = noop;
- process.off = noop;
- process.removeListener = noop;
- process.removeAllListeners = noop;
- process.emit = noop;
- process.prependListener = noop;
- process.prependOnceListener = noop;
- process.listeners = function (name) { return [] }
- process.binding = function (name) {
- throw new Error('process.binding is not supported');
- };
- process.cwd = function () { return '/' };
- process.chdir = function (dir) {
- throw new Error('process.chdir is not supported');
- };
- process.umask = function() { return 0; };
- },{}],325:[function(require,module,exports){
- (function (global){(function (){
- /*! https://mths.be/punycode v1.4.1 by @mathias */
- ;(function(root) {
- /** Detect free variables */
- var freeExports = typeof exports == 'object' && exports &&
- !exports.nodeType && exports;
- var freeModule = typeof module == 'object' && module &&
- !module.nodeType && module;
- var freeGlobal = typeof global == 'object' && global;
- if (
- freeGlobal.global === freeGlobal ||
- freeGlobal.window === freeGlobal ||
- freeGlobal.self === freeGlobal
- ) {
- root = freeGlobal;
- }
- /**
- * The `punycode` object.
- * @name punycode
- * @type Object
- */
- var punycode,
- /** Highest positive signed 32-bit float value */
- maxInt = 2147483647, // aka. 0x7FFFFFFF or 2^31-1
- /** Bootstring parameters */
- base = 36,
- tMin = 1,
- tMax = 26,
- skew = 38,
- damp = 700,
- initialBias = 72,
- initialN = 128, // 0x80
- delimiter = '-', // '\x2D'
- /** Regular expressions */
- regexPunycode = /^xn--/,
- regexNonASCII = /[^\x20-\x7E]/, // unprintable ASCII chars + non-ASCII chars
- regexSeparators = /[\x2E\u3002\uFF0E\uFF61]/g, // RFC 3490 separators
- /** Error messages */
- errors = {
- 'overflow': 'Overflow: input needs wider integers to process',
- 'not-basic': 'Illegal input >= 0x80 (not a basic code point)',
- 'invalid-input': 'Invalid input'
- },
- /** Convenience shortcuts */
- baseMinusTMin = base - tMin,
- floor = Math.floor,
- stringFromCharCode = String.fromCharCode,
- /** Temporary variable */
- key;
- /*--------------------------------------------------------------------------*/
- /**
- * A generic error utility function.
- * @private
- * @param {String} type The error type.
- * @returns {Error} Throws a `RangeError` with the applicable error message.
- */
- function error(type) {
- throw new RangeError(errors[type]);
- }
- /**
- * A generic `Array#map` utility function.
- * @private
- * @param {Array} array The array to iterate over.
- * @param {Function} callback The function that gets called for every array
- * item.
- * @returns {Array} A new array of values returned by the callback function.
- */
- function map(array, fn) {
- var length = array.length;
- var result = [];
- while (length--) {
- result[length] = fn(array[length]);
- }
- return result;
- }
- /**
- * A simple `Array#map`-like wrapper to work with domain name strings or email
- * addresses.
- * @private
- * @param {String} domain The domain name or email address.
- * @param {Function} callback The function that gets called for every
- * character.
- * @returns {Array} A new string of characters returned by the callback
- * function.
- */
- function mapDomain(string, fn) {
- var parts = string.split('@');
- var result = '';
- if (parts.length > 1) {
- // In email addresses, only the domain name should be punycoded. Leave
- // the local part (i.e. everything up to `@`) intact.
- result = parts[0] + '@';
- string = parts[1];
- }
- // Avoid `split(regex)` for IE8 compatibility. See #17.
- string = string.replace(regexSeparators, '\x2E');
- var labels = string.split('.');
- var encoded = map(labels, fn).join('.');
- return result + encoded;
- }
- /**
- * Creates an array containing the numeric code points of each Unicode
- * character in the string. While JavaScript uses UCS-2 internally,
- * this function will convert a pair of surrogate halves (each of which
- * UCS-2 exposes as separate characters) into a single code point,
- * matching UTF-16.
- * @see `punycode.ucs2.encode`
- * @see <https://mathiasbynens.be/notes/javascript-encoding>
- * @memberOf punycode.ucs2
- * @name decode
- * @param {String} string The Unicode input string (UCS-2).
- * @returns {Array} The new array of code points.
- */
- function ucs2decode(string) {
- var output = [],
- counter = 0,
- length = string.length,
- value,
- extra;
- while (counter < length) {
- value = string.charCodeAt(counter++);
- if (value >= 0xD800 && value <= 0xDBFF && counter < length) {
- // high surrogate, and there is a next character
- extra = string.charCodeAt(counter++);
- if ((extra & 0xFC00) == 0xDC00) { // low surrogate
- output.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000);
- } else {
- // unmatched surrogate; only append this code unit, in case the next
- // code unit is the high surrogate of a surrogate pair
- output.push(value);
- counter--;
- }
- } else {
- output.push(value);
- }
- }
- return output;
- }
- /**
- * Creates a string based on an array of numeric code points.
- * @see `punycode.ucs2.decode`
- * @memberOf punycode.ucs2
- * @name encode
- * @param {Array} codePoints The array of numeric code points.
- * @returns {String} The new Unicode string (UCS-2).
- */
- function ucs2encode(array) {
- return map(array, function(value) {
- var output = '';
- if (value > 0xFFFF) {
- value -= 0x10000;
- output += stringFromCharCode(value >>> 10 & 0x3FF | 0xD800);
- value = 0xDC00 | value & 0x3FF;
- }
- output += stringFromCharCode(value);
- return output;
- }).join('');
- }
- /**
- * Converts a basic code point into a digit/integer.
- * @see `digitToBasic()`
- * @private
- * @param {Number} codePoint The basic numeric code point value.
- * @returns {Number} The numeric value of a basic code point (for use in
- * representing integers) in the range `0` to `base - 1`, or `base` if
- * the code point does not represent a value.
- */
- function basicToDigit(codePoint) {
- if (codePoint - 48 < 10) {
- return codePoint - 22;
- }
- if (codePoint - 65 < 26) {
- return codePoint - 65;
- }
- if (codePoint - 97 < 26) {
- return codePoint - 97;
- }
- return base;
- }
- /**
- * Converts a digit/integer into a basic code point.
- * @see `basicToDigit()`
- * @private
- * @param {Number} digit The numeric value of a basic code point.
- * @returns {Number} The basic code point whose value (when used for
- * representing integers) is `digit`, which needs to be in the range
- * `0` to `base - 1`. If `flag` is non-zero, the uppercase form is
- * used; else, the lowercase form is used. The behavior is undefined
- * if `flag` is non-zero and `digit` has no uppercase form.
- */
- function digitToBasic(digit, flag) {
- // 0..25 map to ASCII a..z or A..Z
- // 26..35 map to ASCII 0..9
- return digit + 22 + 75 * (digit < 26) - ((flag != 0) << 5);
- }
- /**
- * Bias adaptation function as per section 3.4 of RFC 3492.
- * https://tools.ietf.org/html/rfc3492#section-3.4
- * @private
- */
- function adapt(delta, numPoints, firstTime) {
- var k = 0;
- delta = firstTime ? floor(delta / damp) : delta >> 1;
- delta += floor(delta / numPoints);
- for (/* no initialization */; delta > baseMinusTMin * tMax >> 1; k += base) {
- delta = floor(delta / baseMinusTMin);
- }
- return floor(k + (baseMinusTMin + 1) * delta / (delta + skew));
- }
- /**
- * Converts a Punycode string of ASCII-only symbols to a string of Unicode
- * symbols.
- * @memberOf punycode
- * @param {String} input The Punycode string of ASCII-only symbols.
- * @returns {String} The resulting string of Unicode symbols.
- */
- function decode(input) {
- // Don't use UCS-2
- var output = [],
- inputLength = input.length,
- out,
- i = 0,
- n = initialN,
- bias = initialBias,
- basic,
- j,
- index,
- oldi,
- w,
- k,
- digit,
- t,
- /** Cached calculation results */
- baseMinusT;
- // Handle the basic code points: let `basic` be the number of input code
- // points before the last delimiter, or `0` if there is none, then copy
- // the first basic code points to the output.
- basic = input.lastIndexOf(delimiter);
- if (basic < 0) {
- basic = 0;
- }
- for (j = 0; j < basic; ++j) {
- // if it's not a basic code point
- if (input.charCodeAt(j) >= 0x80) {
- error('not-basic');
- }
- output.push(input.charCodeAt(j));
- }
- // Main decoding loop: start just after the last delimiter if any basic code
- // points were copied; start at the beginning otherwise.
- for (index = basic > 0 ? basic + 1 : 0; index < inputLength; /* no final expression */) {
- // `index` is the index of the next character to be consumed.
- // Decode a generalized variable-length integer into `delta`,
- // which gets added to `i`. The overflow checking is easier
- // if we increase `i` as we go, then subtract off its starting
- // value at the end to obtain `delta`.
- for (oldi = i, w = 1, k = base; /* no condition */; k += base) {
- if (index >= inputLength) {
- error('invalid-input');
- }
- digit = basicToDigit(input.charCodeAt(index++));
- if (digit >= base || digit > floor((maxInt - i) / w)) {
- error('overflow');
- }
- i += digit * w;
- t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias);
- if (digit < t) {
- break;
- }
- baseMinusT = base - t;
- if (w > floor(maxInt / baseMinusT)) {
- error('overflow');
- }
- w *= baseMinusT;
- }
- out = output.length + 1;
- bias = adapt(i - oldi, out, oldi == 0);
- // `i` was supposed to wrap around from `out` to `0`,
- // incrementing `n` each time, so we'll fix that now:
- if (floor(i / out) > maxInt - n) {
- error('overflow');
- }
- n += floor(i / out);
- i %= out;
- // Insert `n` at position `i` of the output
- output.splice(i++, 0, n);
- }
- return ucs2encode(output);
- }
- /**
- * Converts a string of Unicode symbols (e.g. a domain name label) to a
- * Punycode string of ASCII-only symbols.
- * @memberOf punycode
- * @param {String} input The string of Unicode symbols.
- * @returns {String} The resulting Punycode string of ASCII-only symbols.
- */
- function encode(input) {
- var n,
- delta,
- handledCPCount,
- basicLength,
- bias,
- j,
- m,
- q,
- k,
- t,
- currentValue,
- output = [],
- /** `inputLength` will hold the number of code points in `input`. */
- inputLength,
- /** Cached calculation results */
- handledCPCountPlusOne,
- baseMinusT,
- qMinusT;
- // Convert the input in UCS-2 to Unicode
- input = ucs2decode(input);
- // Cache the length
- inputLength = input.length;
- // Initialize the state
- n = initialN;
- delta = 0;
- bias = initialBias;
- // Handle the basic code points
- for (j = 0; j < inputLength; ++j) {
- currentValue = input[j];
- if (currentValue < 0x80) {
- output.push(stringFromCharCode(currentValue));
- }
- }
- handledCPCount = basicLength = output.length;
- // `handledCPCount` is the number of code points that have been handled;
- // `basicLength` is the number of basic code points.
- // Finish the basic string - if it is not empty - with a delimiter
- if (basicLength) {
- output.push(delimiter);
- }
- // Main encoding loop:
- while (handledCPCount < inputLength) {
- // All non-basic code points < n have been handled already. Find the next
- // larger one:
- for (m = maxInt, j = 0; j < inputLength; ++j) {
- currentValue = input[j];
- if (currentValue >= n && currentValue < m) {
- m = currentValue;
- }
- }
- // Increase `delta` enough to advance the decoder's <n,i> state to <m,0>,
- // but guard against overflow
- handledCPCountPlusOne = handledCPCount + 1;
- if (m - n > floor((maxInt - delta) / handledCPCountPlusOne)) {
- error('overflow');
- }
- delta += (m - n) * handledCPCountPlusOne;
- n = m;
- for (j = 0; j < inputLength; ++j) {
- currentValue = input[j];
- if (currentValue < n && ++delta > maxInt) {
- error('overflow');
- }
- if (currentValue == n) {
- // Represent delta as a generalized variable-length integer
- for (q = delta, k = base; /* no condition */; k += base) {
- t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias);
- if (q < t) {
- break;
- }
- qMinusT = q - t;
- baseMinusT = base - t;
- output.push(
- stringFromCharCode(digitToBasic(t + qMinusT % baseMinusT, 0))
- );
- q = floor(qMinusT / baseMinusT);
- }
- output.push(stringFromCharCode(digitToBasic(q, 0)));
- bias = adapt(delta, handledCPCountPlusOne, handledCPCount == basicLength);
- delta = 0;
- ++handledCPCount;
- }
- }
- ++delta;
- ++n;
- }
- return output.join('');
- }
- /**
- * Converts a Punycode string representing a domain name or an email address
- * to Unicode. Only the Punycoded parts of the input will be converted, i.e.
- * it doesn't matter if you call it on a string that has already been
- * converted to Unicode.
- * @memberOf punycode
- * @param {String} input The Punycoded domain name or email address to
- * convert to Unicode.
- * @returns {String} The Unicode representation of the given Punycode
- * string.
- */
- function toUnicode(input) {
- return mapDomain(input, function(string) {
- return regexPunycode.test(string)
- ? decode(string.slice(4).toLowerCase())
- : string;
- });
- }
- /**
- * Converts a Unicode string representing a domain name or an email address to
- * Punycode. Only the non-ASCII parts of the domain name will be converted,
- * i.e. it doesn't matter if you call it with a domain that's already in
- * ASCII.
- * @memberOf punycode
- * @param {String} input The domain name or email address to convert, as a
- * Unicode string.
- * @returns {String} The Punycode representation of the given domain name or
- * email address.
- */
- function toASCII(input) {
- return mapDomain(input, function(string) {
- return regexNonASCII.test(string)
- ? 'xn--' + encode(string)
- : string;
- });
- }
- /*--------------------------------------------------------------------------*/
- /** Define the public API */
- punycode = {
- /**
- * A string representing the current Punycode.js version number.
- * @memberOf punycode
- * @type String
- */
- 'version': '1.4.1',
- /**
- * An object of methods to convert from JavaScript's internal character
- * representation (UCS-2) to Unicode code points, and back.
- * @see <https://mathiasbynens.be/notes/javascript-encoding>
- * @memberOf punycode
- * @type Object
- */
- 'ucs2': {
- 'decode': ucs2decode,
- 'encode': ucs2encode
- },
- 'decode': decode,
- 'encode': encode,
- 'toASCII': toASCII,
- 'toUnicode': toUnicode
- };
- /** Expose `punycode` */
- // Some AMD build optimizers, like r.js, check for specific condition patterns
- // like the following:
- if (
- typeof define == 'function' &&
- typeof define.amd == 'object' &&
- define.amd
- ) {
- define('punycode', function() {
- return punycode;
- });
- } else if (freeExports && freeModule) {
- if (module.exports == freeExports) {
- // in Node.js, io.js, or RingoJS v0.8.0+
- freeModule.exports = punycode;
- } else {
- // in Narwhal or RingoJS v0.7.0-
- for (key in punycode) {
- punycode.hasOwnProperty(key) && (freeExports[key] = punycode[key]);
- }
- }
- } else {
- // in Rhino or a web browser
- root.punycode = punycode;
- }
- }(this));
- }).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
- },{}],326:[function(require,module,exports){
- // Copyright Joyent, Inc. and other Node contributors.
- //
- // Permission is hereby granted, free of charge, to any person obtaining a
- // copy of this software and associated documentation files (the
- // "Software"), to deal in the Software without restriction, including
- // without limitation the rights to use, copy, modify, merge, publish,
- // distribute, sublicense, and/or sell copies of the Software, and to permit
- // persons to whom the Software is furnished to do so, subject to the
- // following conditions:
- //
- // The above copyright notice and this permission notice shall be included
- // in all copies or substantial portions of the Software.
- //
- // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
- // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
- // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
- // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
- // USE OR OTHER DEALINGS IN THE SOFTWARE.
- 'use strict';
- // If obj.hasOwnProperty has been overridden, then calling
- // obj.hasOwnProperty(prop) will break.
- // See: https://github.com/joyent/node/issues/1707
- function hasOwnProperty(obj, prop) {
- return Object.prototype.hasOwnProperty.call(obj, prop);
- }
- module.exports = function(qs, sep, eq, options) {
- sep = sep || '&';
- eq = eq || '=';
- var obj = {};
- if (typeof qs !== 'string' || qs.length === 0) {
- return obj;
- }
- var regexp = /\+/g;
- qs = qs.split(sep);
- var maxKeys = 1000;
- if (options && typeof options.maxKeys === 'number') {
- maxKeys = options.maxKeys;
- }
- var len = qs.length;
- // maxKeys <= 0 means that we should not limit keys count
- if (maxKeys > 0 && len > maxKeys) {
- len = maxKeys;
- }
- for (var i = 0; i < len; ++i) {
- var x = qs[i].replace(regexp, '%20'),
- idx = x.indexOf(eq),
- kstr, vstr, k, v;
- if (idx >= 0) {
- kstr = x.substr(0, idx);
- vstr = x.substr(idx + 1);
- } else {
- kstr = x;
- vstr = '';
- }
- k = decodeURIComponent(kstr);
- v = decodeURIComponent(vstr);
- if (!hasOwnProperty(obj, k)) {
- obj[k] = v;
- } else if (isArray(obj[k])) {
- obj[k].push(v);
- } else {
- obj[k] = [obj[k], v];
- }
- }
- return obj;
- };
- var isArray = Array.isArray || function (xs) {
- return Object.prototype.toString.call(xs) === '[object Array]';
- };
- },{}],327:[function(require,module,exports){
- // Copyright Joyent, Inc. and other Node contributors.
- //
- // Permission is hereby granted, free of charge, to any person obtaining a
- // copy of this software and associated documentation files (the
- // "Software"), to deal in the Software without restriction, including
- // without limitation the rights to use, copy, modify, merge, publish,
- // distribute, sublicense, and/or sell copies of the Software, and to permit
- // persons to whom the Software is furnished to do so, subject to the
- // following conditions:
- //
- // The above copyright notice and this permission notice shall be included
- // in all copies or substantial portions of the Software.
- //
- // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
- // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
- // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
- // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
- // USE OR OTHER DEALINGS IN THE SOFTWARE.
- 'use strict';
- var stringifyPrimitive = function(v) {
- switch (typeof v) {
- case 'string':
- return v;
- case 'boolean':
- return v ? 'true' : 'false';
- case 'number':
- return isFinite(v) ? v : '';
- default:
- return '';
- }
- };
- module.exports = function(obj, sep, eq, name) {
- sep = sep || '&';
- eq = eq || '=';
- if (obj === null) {
- obj = undefined;
- }
- if (typeof obj === 'object') {
- return map(objectKeys(obj), function(k) {
- var ks = encodeURIComponent(stringifyPrimitive(k)) + eq;
- if (isArray(obj[k])) {
- return map(obj[k], function(v) {
- return ks + encodeURIComponent(stringifyPrimitive(v));
- }).join(sep);
- } else {
- return ks + encodeURIComponent(stringifyPrimitive(obj[k]));
- }
- }).join(sep);
- }
- if (!name) return '';
- return encodeURIComponent(stringifyPrimitive(name)) + eq +
- encodeURIComponent(stringifyPrimitive(obj));
- };
- var isArray = Array.isArray || function (xs) {
- return Object.prototype.toString.call(xs) === '[object Array]';
- };
- function map (xs, f) {
- if (xs.map) return xs.map(f);
- var res = [];
- for (var i = 0; i < xs.length; i++) {
- res.push(f(xs[i], i));
- }
- return res;
- }
- var objectKeys = Object.keys || function (obj) {
- var res = [];
- for (var key in obj) {
- if (Object.prototype.hasOwnProperty.call(obj, key)) res.push(key);
- }
- return res;
- };
- },{}],328:[function(require,module,exports){
- 'use strict';
- exports.decode = exports.parse = require('./decode');
- exports.encode = exports.stringify = require('./encode');
- },{"./decode":326,"./encode":327}],329:[function(require,module,exports){
- module.exports = require('./lib/_stream_duplex.js');
- },{"./lib/_stream_duplex.js":330}],330:[function(require,module,exports){
- // Copyright Joyent, Inc. and other Node contributors.
- //
- // Permission is hereby granted, free of charge, to any person obtaining a
- // copy of this software and associated documentation files (the
- // "Software"), to deal in the Software without restriction, including
- // without limitation the rights to use, copy, modify, merge, publish,
- // distribute, sublicense, and/or sell copies of the Software, and to permit
- // persons to whom the Software is furnished to do so, subject to the
- // following conditions:
- //
- // The above copyright notice and this permission notice shall be included
- // in all copies or substantial portions of the Software.
- //
- // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
- // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
- // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
- // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
- // USE OR OTHER DEALINGS IN THE SOFTWARE.
- // a duplex stream is just a stream that is both readable and writable.
- // Since JS doesn't have multiple prototypal inheritance, this class
- // prototypally inherits from Readable, and then parasitically from
- // Writable.
- 'use strict';
- /*<replacement>*/
- var pna = require('process-nextick-args');
- /*</replacement>*/
- /*<replacement>*/
- var objectKeys = Object.keys || function (obj) {
- var keys = [];
- for (var key in obj) {
- keys.push(key);
- }return keys;
- };
- /*</replacement>*/
- module.exports = Duplex;
- /*<replacement>*/
- var util = Object.create(require('core-util-is'));
- util.inherits = require('inherits');
- /*</replacement>*/
- var Readable = require('./_stream_readable');
- var Writable = require('./_stream_writable');
- util.inherits(Duplex, Readable);
- {
- // avoid scope creep, the keys array can then be collected
- var keys = objectKeys(Writable.prototype);
- for (var v = 0; v < keys.length; v++) {
- var method = keys[v];
- if (!Duplex.prototype[method]) Duplex.prototype[method] = Writable.prototype[method];
- }
- }
- function Duplex(options) {
- if (!(this instanceof Duplex)) return new Duplex(options);
- Readable.call(this, options);
- Writable.call(this, options);
- if (options && options.readable === false) this.readable = false;
- if (options && options.writable === false) this.writable = false;
- this.allowHalfOpen = true;
- if (options && options.allowHalfOpen === false) this.allowHalfOpen = false;
- this.once('end', onend);
- }
- Object.defineProperty(Duplex.prototype, 'writableHighWaterMark', {
- // making it explicit this property is not enumerable
- // because otherwise some prototype manipulation in
- // userland will fail
- enumerable: false,
- get: function () {
- return this._writableState.highWaterMark;
- }
- });
- // the no-half-open enforcer
- function onend() {
- // if we allow half-open state, or if the writable side ended,
- // then we're ok.
- if (this.allowHalfOpen || this._writableState.ended) return;
- // no more data can be written.
- // But allow more writes to happen in this tick.
- pna.nextTick(onEndNT, this);
- }
- function onEndNT(self) {
- self.end();
- }
- Object.defineProperty(Duplex.prototype, 'destroyed', {
- get: function () {
- if (this._readableState === undefined || this._writableState === undefined) {
- return false;
- }
- return this._readableState.destroyed && this._writableState.destroyed;
- },
- set: function (value) {
- // we ignore the value if the stream
- // has not been initialized yet
- if (this._readableState === undefined || this._writableState === undefined) {
- return;
- }
- // backward compatibility, the user is explicitly
- // managing destroyed
- this._readableState.destroyed = value;
- this._writableState.destroyed = value;
- }
- });
- Duplex.prototype._destroy = function (err, cb) {
- this.push(null);
- this.end();
- pna.nextTick(cb, err);
- };
- },{"./_stream_readable":332,"./_stream_writable":334,"core-util-is":298,"inherits":311,"process-nextick-args":323}],331:[function(require,module,exports){
- // Copyright Joyent, Inc. and other Node contributors.
- //
- // Permission is hereby granted, free of charge, to any person obtaining a
- // copy of this software and associated documentation files (the
- // "Software"), to deal in the Software without restriction, including
- // without limitation the rights to use, copy, modify, merge, publish,
- // distribute, sublicense, and/or sell copies of the Software, and to permit
- // persons to whom the Software is furnished to do so, subject to the
- // following conditions:
- //
- // The above copyright notice and this permission notice shall be included
- // in all copies or substantial portions of the Software.
- //
- // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
- // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
- // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
- // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
- // USE OR OTHER DEALINGS IN THE SOFTWARE.
- // a passthrough stream.
- // basically just the most minimal sort of Transform stream.
- // Every written chunk gets output as-is.
- 'use strict';
- module.exports = PassThrough;
- var Transform = require('./_stream_transform');
- /*<replacement>*/
- var util = Object.create(require('core-util-is'));
- util.inherits = require('inherits');
- /*</replacement>*/
- util.inherits(PassThrough, Transform);
- function PassThrough(options) {
- if (!(this instanceof PassThrough)) return new PassThrough(options);
- Transform.call(this, options);
- }
- PassThrough.prototype._transform = function (chunk, encoding, cb) {
- cb(null, chunk);
- };
- },{"./_stream_transform":333,"core-util-is":298,"inherits":311}],332:[function(require,module,exports){
- (function (process,global){(function (){
- // Copyright Joyent, Inc. and other Node contributors.
- //
- // Permission is hereby granted, free of charge, to any person obtaining a
- // copy of this software and associated documentation files (the
- // "Software"), to deal in the Software without restriction, including
- // without limitation the rights to use, copy, modify, merge, publish,
- // distribute, sublicense, and/or sell copies of the Software, and to permit
- // persons to whom the Software is furnished to do so, subject to the
- // following conditions:
- //
- // The above copyright notice and this permission notice shall be included
- // in all copies or substantial portions of the Software.
- //
- // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
- // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
- // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
- // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
- // USE OR OTHER DEALINGS IN THE SOFTWARE.
- 'use strict';
- /*<replacement>*/
- var pna = require('process-nextick-args');
- /*</replacement>*/
- module.exports = Readable;
- /*<replacement>*/
- var isArray = require('isarray');
- /*</replacement>*/
- /*<replacement>*/
- var Duplex;
- /*</replacement>*/
- Readable.ReadableState = ReadableState;
- /*<replacement>*/
- var EE = require('events').EventEmitter;
- var EElistenerCount = function (emitter, type) {
- return emitter.listeners(type).length;
- };
- /*</replacement>*/
- /*<replacement>*/
- var Stream = require('./internal/streams/stream');
- /*</replacement>*/
- /*<replacement>*/
- var Buffer = require('safe-buffer').Buffer;
- var OurUint8Array = global.Uint8Array || function () {};
- function _uint8ArrayToBuffer(chunk) {
- return Buffer.from(chunk);
- }
- function _isUint8Array(obj) {
- return Buffer.isBuffer(obj) || obj instanceof OurUint8Array;
- }
- /*</replacement>*/
- /*<replacement>*/
- var util = Object.create(require('core-util-is'));
- util.inherits = require('inherits');
- /*</replacement>*/
- /*<replacement>*/
- var debugUtil = require('util');
- var debug = void 0;
- if (debugUtil && debugUtil.debuglog) {
- debug = debugUtil.debuglog('stream');
- } else {
- debug = function () {};
- }
- /*</replacement>*/
- var BufferList = require('./internal/streams/BufferList');
- var destroyImpl = require('./internal/streams/destroy');
- var StringDecoder;
- util.inherits(Readable, Stream);
- var kProxyEvents = ['error', 'close', 'destroy', 'pause', 'resume'];
- function prependListener(emitter, event, fn) {
- // Sadly this is not cacheable as some libraries bundle their own
- // event emitter implementation with them.
- if (typeof emitter.prependListener === 'function') return emitter.prependListener(event, fn);
- // This is a hack to make sure that our error handler is attached before any
- // userland ones. NEVER DO THIS. This is here only because this code needs
- // to continue to work with older versions of Node.js that do not include
- // the prependListener() method. The goal is to eventually remove this hack.
- 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]];
- }
- function ReadableState(options, stream) {
- Duplex = Duplex || require('./_stream_duplex');
- options = options || {};
- // Duplex streams are both readable and writable, but share
- // the same options object.
- // However, some cases require setting options to different
- // values for the readable and the writable sides of the duplex stream.
- // These options can be provided separately as readableXXX and writableXXX.
- var isDuplex = stream instanceof Duplex;
- // object stream flag. Used to make read(n) ignore n and to
- // make all the buffer merging and length checks go away
- this.objectMode = !!options.objectMode;
- if (isDuplex) this.objectMode = this.objectMode || !!options.readableObjectMode;
- // the point at which it stops calling _read() to fill the buffer
- // Note: 0 is a valid value, means "don't call _read preemptively ever"
- var hwm = options.highWaterMark;
- var readableHwm = options.readableHighWaterMark;
- var defaultHwm = this.objectMode ? 16 : 16 * 1024;
- if (hwm || hwm === 0) this.highWaterMark = hwm;else if (isDuplex && (readableHwm || readableHwm === 0)) this.highWaterMark = readableHwm;else this.highWaterMark = defaultHwm;
- // cast to ints.
- this.highWaterMark = Math.floor(this.highWaterMark);
- // A linked list is used to store data chunks instead of an array because the
- // linked list can remove elements from the beginning faster than
- // array.shift()
- this.buffer = new BufferList();
- this.length = 0;
- this.pipes = null;
- this.pipesCount = 0;
- this.flowing = null;
- this.ended = false;
- this.endEmitted = false;
- this.reading = false;
- // a flag to be able to tell if the event 'readable'/'data' is emitted
- // immediately, or on a later tick. We set this to true at first, because
- // any actions that shouldn't happen until "later" should generally also
- // not happen before the first read call.
- this.sync = true;
- // whenever we return null, then we set a flag to say
- // that we're awaiting a 'readable' event emission.
- this.needReadable = false;
- this.emittedReadable = false;
- this.readableListening = false;
- this.resumeScheduled = false;
- // has it been destroyed
- this.destroyed = false;
- // Crypto is kind of old and crusty. Historically, its default string
- // encoding is 'binary' so we have to make this configurable.
- // Everything else in the universe uses 'utf8', though.
- this.defaultEncoding = options.defaultEncoding || 'utf8';
- // the number of writers that are awaiting a drain event in .pipe()s
- this.awaitDrain = 0;
- // if true, a maybeReadMore has been scheduled
- this.readingMore = false;
- this.decoder = null;
- this.encoding = null;
- if (options.encoding) {
- if (!StringDecoder) StringDecoder = require('string_decoder/').StringDecoder;
- this.decoder = new StringDecoder(options.encoding);
- this.encoding = options.encoding;
- }
- }
- function Readable(options) {
- Duplex = Duplex || require('./_stream_duplex');
- if (!(this instanceof Readable)) return new Readable(options);
- this._readableState = new ReadableState(options, this);
- // legacy
- this.readable = true;
- if (options) {
- if (typeof options.read === 'function') this._read = options.read;
- if (typeof options.destroy === 'function') this._destroy = options.destroy;
- }
- Stream.call(this);
- }
- Object.defineProperty(Readable.prototype, 'destroyed', {
- get: function () {
- if (this._readableState === undefined) {
- return false;
- }
- return this._readableState.destroyed;
- },
- set: function (value) {
- // we ignore the value if the stream
- // has not been initialized yet
- if (!this._readableState) {
- return;
- }
- // backward compatibility, the user is explicitly
- // managing destroyed
- this._readableState.destroyed = value;
- }
- });
- Readable.prototype.destroy = destroyImpl.destroy;
- Readable.prototype._undestroy = destroyImpl.undestroy;
- Readable.prototype._destroy = function (err, cb) {
- this.push(null);
- cb(err);
- };
- // Manually shove something into the read() buffer.
- // This returns true if the highWaterMark has not been hit yet,
- // similar to how Writable.write() returns true if you should
- // write() some more.
- Readable.prototype.push = function (chunk, encoding) {
- var state = this._readableState;
- var skipChunkCheck;
- if (!state.objectMode) {
- if (typeof chunk === 'string') {
- encoding = encoding || state.defaultEncoding;
- if (encoding !== state.encoding) {
- chunk = Buffer.from(chunk, encoding);
- encoding = '';
- }
- skipChunkCheck = true;
- }
- } else {
- skipChunkCheck = true;
- }
- return readableAddChunk(this, chunk, encoding, false, skipChunkCheck);
- };
- // Unshift should *always* be something directly out of read()
- Readable.prototype.unshift = function (chunk) {
- return readableAddChunk(this, chunk, null, true, false);
- };
- function readableAddChunk(stream, chunk, encoding, addToFront, skipChunkCheck) {
- var state = stream._readableState;
- if (chunk === null) {
- state.reading = false;
- onEofChunk(stream, state);
- } else {
- var er;
- if (!skipChunkCheck) er = chunkInvalid(state, chunk);
- if (er) {
- stream.emit('error', er);
- } else if (state.objectMode || chunk && chunk.length > 0) {
- if (typeof chunk !== 'string' && !state.objectMode && Object.getPrototypeOf(chunk) !== Buffer.prototype) {
- chunk = _uint8ArrayToBuffer(chunk);
- }
- if (addToFront) {
- if (state.endEmitted) stream.emit('error', new Error('stream.unshift() after end event'));else addChunk(stream, state, chunk, true);
- } else if (state.ended) {
- stream.emit('error', new Error('stream.push() after EOF'));
- } else {
- state.reading = false;
- if (state.decoder && !encoding) {
- chunk = state.decoder.write(chunk);
- if (state.objectMode || chunk.length !== 0) addChunk(stream, state, chunk, false);else maybeReadMore(stream, state);
- } else {
- addChunk(stream, state, chunk, false);
- }
- }
- } else if (!addToFront) {
- state.reading = false;
- }
- }
- return needMoreData(state);
- }
- function addChunk(stream, state, chunk, addToFront) {
- if (state.flowing && state.length === 0 && !state.sync) {
- stream.emit('data', chunk);
- stream.read(0);
- } else {
- // update the buffer info.
- state.length += state.objectMode ? 1 : chunk.length;
- if (addToFront) state.buffer.unshift(chunk);else state.buffer.push(chunk);
- if (state.needReadable) emitReadable(stream);
- }
- maybeReadMore(stream, state);
- }
- function chunkInvalid(state, chunk) {
- var er;
- if (!_isUint8Array(chunk) && typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) {
- er = new TypeError('Invalid non-string/buffer chunk');
- }
- return er;
- }
- // if it's past the high water mark, we can push in some more.
- // Also, if we have no data yet, we can stand some
- // more bytes. This is to work around cases where hwm=0,
- // such as the repl. Also, if the push() triggered a
- // readable event, and the user called read(largeNumber) such that
- // needReadable was set, then we ought to push more, so that another
- // 'readable' event will be triggered.
- function needMoreData(state) {
- return !state.ended && (state.needReadable || state.length < state.highWaterMark || state.length === 0);
- }
- Readable.prototype.isPaused = function () {
- return this._readableState.flowing === false;
- };
- // backwards compatibility.
- Readable.prototype.setEncoding = function (enc) {
- if (!StringDecoder) StringDecoder = require('string_decoder/').StringDecoder;
- this._readableState.decoder = new StringDecoder(enc);
- this._readableState.encoding = enc;
- return this;
- };
- // Don't raise the hwm > 8MB
- var MAX_HWM = 0x800000;
- function computeNewHighWaterMark(n) {
- if (n >= MAX_HWM) {
- n = MAX_HWM;
- } else {
- // Get the next highest power of 2 to prevent increasing hwm excessively in
- // tiny amounts
- n--;
- n |= n >>> 1;
- n |= n >>> 2;
- n |= n >>> 4;
- n |= n >>> 8;
- n |= n >>> 16;
- n++;
- }
- return n;
- }
- // This function is designed to be inlinable, so please take care when making
- // changes to the function body.
- function howMuchToRead(n, state) {
- if (n <= 0 || state.length === 0 && state.ended) return 0;
- if (state.objectMode) return 1;
- if (n !== n) {
- // Only flow one buffer at a time
- if (state.flowing && state.length) return state.buffer.head.data.length;else return state.length;
- }
- // If we're asking for more than the current hwm, then raise the hwm.
- if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n);
- if (n <= state.length) return n;
- // Don't have enough
- if (!state.ended) {
- state.needReadable = true;
- return 0;
- }
- return state.length;
- }
- // you can override either this method, or the async _read(n) below.
- Readable.prototype.read = function (n) {
- debug('read', n);
- n = parseInt(n, 10);
- var state = this._readableState;
- var nOrig = n;
- if (n !== 0) state.emittedReadable = false;
- // if we're doing read(0) to trigger a readable event, but we
- // already have a bunch of data in the buffer, then just trigger
- // the 'readable' event and move on.
- if (n === 0 && state.needReadable && (state.length >= state.highWaterMark || state.ended)) {
- debug('read: emitReadable', state.length, state.ended);
- if (state.length === 0 && state.ended) endReadable(this);else emitReadable(this);
- return null;
- }
- n = howMuchToRead(n, state);
- // if we've ended, and we're now clear, then finish it up.
- if (n === 0 && state.ended) {
- if (state.length === 0) endReadable(this);
- return null;
- }
- // All the actual chunk generation logic needs to be
- // *below* the call to _read. The reason is that in certain
- // synthetic stream cases, such as passthrough streams, _read
- // may be a completely synchronous operation which may change
- // the state of the read buffer, providing enough data when
- // before there was *not* enough.
- //
- // So, the steps are:
- // 1. Figure out what the state of things will be after we do
- // a read from the buffer.
- //
- // 2. If that resulting state will trigger a _read, then call _read.
- // Note that this may be asynchronous, or synchronous. Yes, it is
- // deeply ugly to write APIs this way, but that still doesn't mean
- // that the Readable class should behave improperly, as streams are
- // designed to be sync/async agnostic.
- // Take note if the _read call is sync or async (ie, if the read call
- // has returned yet), so that we know whether or not it's safe to emit
- // 'readable' etc.
- //
- // 3. Actually pull the requested chunks out of the buffer and return.
- // if we need a readable event, then we need to do some reading.
- var doRead = state.needReadable;
- debug('need readable', doRead);
- // if we currently have less than the highWaterMark, then also read some
- if (state.length === 0 || state.length - n < state.highWaterMark) {
- doRead = true;
- debug('length less than watermark', doRead);
- }
- // however, if we've ended, then there's no point, and if we're already
- // reading, then it's unnecessary.
- if (state.ended || state.reading) {
- doRead = false;
- debug('reading or ended', doRead);
- } else if (doRead) {
- debug('do read');
- state.reading = true;
- state.sync = true;
- // if the length is currently zero, then we *need* a readable event.
- if (state.length === 0) state.needReadable = true;
- // call internal read method
- this._read(state.highWaterMark);
- state.sync = false;
- // If _read pushed data synchronously, then `reading` will be false,
- // and we need to re-evaluate how much data we can return to the user.
- if (!state.reading) n = howMuchToRead(nOrig, state);
- }
- var ret;
- if (n > 0) ret = fromList(n, state);else ret = null;
- if (ret === null) {
- state.needReadable = true;
- n = 0;
- } else {
- state.length -= n;
- }
- if (state.length === 0) {
- // If we have nothing in the buffer, then we want to know
- // as soon as we *do* get something into the buffer.
- if (!state.ended) state.needReadable = true;
- // If we tried to read() past the EOF, then emit end on the next tick.
- if (nOrig !== n && state.ended) endReadable(this);
- }
- if (ret !== null) this.emit('data', ret);
- return ret;
- };
- function onEofChunk(stream, state) {
- if (state.ended) return;
- if (state.decoder) {
- var chunk = state.decoder.end();
- if (chunk && chunk.length) {
- state.buffer.push(chunk);
- state.length += state.objectMode ? 1 : chunk.length;
- }
- }
- state.ended = true;
- // emit 'readable' now to make sure it gets picked up.
- emitReadable(stream);
- }
- // Don't emit readable right away in sync mode, because this can trigger
- // another read() call => stack overflow. This way, it might trigger
- // a nextTick recursion warning, but that's not so bad.
- function emitReadable(stream) {
- var state = stream._readableState;
- state.needReadable = false;
- if (!state.emittedReadable) {
- debug('emitReadable', state.flowing);
- state.emittedReadable = true;
- if (state.sync) pna.nextTick(emitReadable_, stream);else emitReadable_(stream);
- }
- }
- function emitReadable_(stream) {
- debug('emit readable');
- stream.emit('readable');
- flow(stream);
- }
- // at this point, the user has presumably seen the 'readable' event,
- // and called read() to consume some data. that may have triggered
- // in turn another _read(n) call, in which case reading = true if
- // it's in progress.
- // However, if we're not ended, or reading, and the length < hwm,
- // then go ahead and try to read some more preemptively.
- function maybeReadMore(stream, state) {
- if (!state.readingMore) {
- state.readingMore = true;
- pna.nextTick(maybeReadMore_, stream, state);
- }
- }
- function maybeReadMore_(stream, state) {
- var len = state.length;
- while (!state.reading && !state.flowing && !state.ended && state.length < state.highWaterMark) {
- debug('maybeReadMore read 0');
- stream.read(0);
- if (len === state.length)
- // didn't get any data, stop spinning.
- break;else len = state.length;
- }
- state.readingMore = false;
- }
- // abstract method. to be overridden in specific implementation classes.
- // call cb(er, data) where data is <= n in length.
- // for virtual (non-string, non-buffer) streams, "length" is somewhat
- // arbitrary, and perhaps not very meaningful.
- Readable.prototype._read = function (n) {
- this.emit('error', new Error('_read() is not implemented'));
- };
- Readable.prototype.pipe = function (dest, pipeOpts) {
- var src = this;
- var state = this._readableState;
- switch (state.pipesCount) {
- case 0:
- state.pipes = dest;
- break;
- case 1:
- state.pipes = [state.pipes, dest];
- break;
- default:
- state.pipes.push(dest);
- break;
- }
- state.pipesCount += 1;
- debug('pipe count=%d opts=%j', state.pipesCount, pipeOpts);
- var doEnd = (!pipeOpts || pipeOpts.end !== false) && dest !== process.stdout && dest !== process.stderr;
- var endFn = doEnd ? onend : unpipe;
- if (state.endEmitted) pna.nextTick(endFn);else src.once('end', endFn);
- dest.on('unpipe', onunpipe);
- function onunpipe(readable, unpipeInfo) {
- debug('onunpipe');
- if (readable === src) {
- if (unpipeInfo && unpipeInfo.hasUnpiped === false) {
- unpipeInfo.hasUnpiped = true;
- cleanup();
- }
- }
- }
- function onend() {
- debug('onend');
- dest.end();
- }
- // when the dest drains, it reduces the awaitDrain counter
- // on the source. This would be more elegant with a .once()
- // handler in flow(), but adding and removing repeatedly is
- // too slow.
- var ondrain = pipeOnDrain(src);
- dest.on('drain', ondrain);
- var cleanedUp = false;
- function cleanup() {
- debug('cleanup');
- // cleanup event handlers once the pipe is broken
- dest.removeListener('close', onclose);
- dest.removeListener('finish', onfinish);
- dest.removeListener('drain', ondrain);
- dest.removeListener('error', onerror);
- dest.removeListener('unpipe', onunpipe);
- src.removeListener('end', onend);
- src.removeListener('end', unpipe);
- src.removeListener('data', ondata);
- cleanedUp = true;
- // if the reader is waiting for a drain event from this
- // specific writer, then it would cause it to never start
- // flowing again.
- // So, if this is awaiting a drain, then we just call it now.
- // If we don't know, then assume that we are waiting for one.
- if (state.awaitDrain && (!dest._writableState || dest._writableState.needDrain)) ondrain();
- }
- // If the user pushes more data while we're writing to dest then we'll end up
- // in ondata again. However, we only want to increase awaitDrain once because
- // dest will only emit one 'drain' event for the multiple writes.
- // => Introduce a guard on increasing awaitDrain.
- var increasedAwaitDrain = false;
- src.on('data', ondata);
- function ondata(chunk) {
- debug('ondata');
- increasedAwaitDrain = false;
- var ret = dest.write(chunk);
- if (false === ret && !increasedAwaitDrain) {
- // If the user unpiped during `dest.write()`, it is possible
- // to get stuck in a permanently paused state if that write
- // also returned false.
- // => Check whether `dest` is still a piping destination.
- if ((state.pipesCount === 1 && state.pipes === dest || state.pipesCount > 1 && indexOf(state.pipes, dest) !== -1) && !cleanedUp) {
- debug('false write response, pause', src._readableState.awaitDrain);
- src._readableState.awaitDrain++;
- increasedAwaitDrain = true;
- }
- src.pause();
- }
- }
- // if the dest has an error, then stop piping into it.
- // however, don't suppress the throwing behavior for this.
- function onerror(er) {
- debug('onerror', er);
- unpipe();
- dest.removeListener('error', onerror);
- if (EElistenerCount(dest, 'error') === 0) dest.emit('error', er);
- }
- // Make sure our error handler is attached before userland ones.
- prependListener(dest, 'error', onerror);
- // Both close and finish should trigger unpipe, but only once.
- function onclose() {
- dest.removeListener('finish', onfinish);
- unpipe();
- }
- dest.once('close', onclose);
- function onfinish() {
- debug('onfinish');
- dest.removeListener('close', onclose);
- unpipe();
- }
- dest.once('finish', onfinish);
- function unpipe() {
- debug('unpipe');
- src.unpipe(dest);
- }
- // tell the dest that it's being piped to
- dest.emit('pipe', src);
- // start the flow if it hasn't been started already.
- if (!state.flowing) {
- debug('pipe resume');
- src.resume();
- }
- return dest;
- };
- function pipeOnDrain(src) {
- return function () {
- var state = src._readableState;
- debug('pipeOnDrain', state.awaitDrain);
- if (state.awaitDrain) state.awaitDrain--;
- if (state.awaitDrain === 0 && EElistenerCount(src, 'data')) {
- state.flowing = true;
- flow(src);
- }
- };
- }
- Readable.prototype.unpipe = function (dest) {
- var state = this._readableState;
- var unpipeInfo = { hasUnpiped: false };
- // if we're not piping anywhere, then do nothing.
- if (state.pipesCount === 0) return this;
- // just one destination. most common case.
- if (state.pipesCount === 1) {
- // passed in one, but it's not the right one.
- if (dest && dest !== state.pipes) return this;
- if (!dest) dest = state.pipes;
- // got a match.
- state.pipes = null;
- state.pipesCount = 0;
- state.flowing = false;
- if (dest) dest.emit('unpipe', this, unpipeInfo);
- return this;
- }
- // slow case. multiple pipe destinations.
- if (!dest) {
- // remove all.
- var dests = state.pipes;
- var len = state.pipesCount;
- state.pipes = null;
- state.pipesCount = 0;
- state.flowing = false;
- for (var i = 0; i < len; i++) {
- dests[i].emit('unpipe', this, unpipeInfo);
- }return this;
- }
- // try to find the right one.
- var index = indexOf(state.pipes, dest);
- if (index === -1) return this;
- state.pipes.splice(index, 1);
- state.pipesCount -= 1;
- if (state.pipesCount === 1) state.pipes = state.pipes[0];
- dest.emit('unpipe', this, unpipeInfo);
- return this;
- };
- // set up data events if they are asked for
- // Ensure readable listeners eventually get something
- Readable.prototype.on = function (ev, fn) {
- var res = Stream.prototype.on.call(this, ev, fn);
- if (ev === 'data') {
- // Start flowing on next tick if stream isn't explicitly paused
- if (this._readableState.flowing !== false) this.resume();
- } else if (ev === 'readable') {
- var state = this._readableState;
- if (!state.endEmitted && !state.readableListening) {
- state.readableListening = state.needReadable = true;
- state.emittedReadable = false;
- if (!state.reading) {
- pna.nextTick(nReadingNextTick, this);
- } else if (state.length) {
- emitReadable(this);
- }
- }
- }
- return res;
- };
- Readable.prototype.addListener = Readable.prototype.on;
- function nReadingNextTick(self) {
- debug('readable nexttick read 0');
- self.read(0);
- }
- // pause() and resume() are remnants of the legacy readable stream API
- // If the user uses them, then switch into old mode.
- Readable.prototype.resume = function () {
- var state = this._readableState;
- if (!state.flowing) {
- debug('resume');
- state.flowing = true;
- resume(this, state);
- }
- return this;
- };
- function resume(stream, state) {
- if (!state.resumeScheduled) {
- state.resumeScheduled = true;
- pna.nextTick(resume_, stream, state);
- }
- }
- function resume_(stream, state) {
- if (!state.reading) {
- debug('resume read 0');
- stream.read(0);
- }
- state.resumeScheduled = false;
- state.awaitDrain = 0;
- stream.emit('resume');
- flow(stream);
- if (state.flowing && !state.reading) stream.read(0);
- }
- Readable.prototype.pause = function () {
- debug('call pause flowing=%j', this._readableState.flowing);
- if (false !== this._readableState.flowing) {
- debug('pause');
- this._readableState.flowing = false;
- this.emit('pause');
- }
- return this;
- };
- function flow(stream) {
- var state = stream._readableState;
- debug('flow', state.flowing);
- while (state.flowing && stream.read() !== null) {}
- }
- // wrap an old-style stream as the async data source.
- // This is *not* part of the readable stream interface.
- // It is an ugly unfortunate mess of history.
- Readable.prototype.wrap = function (stream) {
- var _this = this;
- var state = this._readableState;
- var paused = false;
- stream.on('end', function () {
- debug('wrapped end');
- if (state.decoder && !state.ended) {
- var chunk = state.decoder.end();
- if (chunk && chunk.length) _this.push(chunk);
- }
- _this.push(null);
- });
- stream.on('data', function (chunk) {
- debug('wrapped data');
- if (state.decoder) chunk = state.decoder.write(chunk);
- // don't skip over falsy values in objectMode
- if (state.objectMode && (chunk === null || chunk === undefined)) return;else if (!state.objectMode && (!chunk || !chunk.length)) return;
- var ret = _this.push(chunk);
- if (!ret) {
- paused = true;
- stream.pause();
- }
- });
- // proxy all the other methods.
- // important when wrapping filters and duplexes.
- for (var i in stream) {
- if (this[i] === undefined && typeof stream[i] === 'function') {
- this[i] = function (method) {
- return function () {
- return stream[method].apply(stream, arguments);
- };
- }(i);
- }
- }
- // proxy certain important events.
- for (var n = 0; n < kProxyEvents.length; n++) {
- stream.on(kProxyEvents[n], this.emit.bind(this, kProxyEvents[n]));
- }
- // when we try to consume some more bytes, simply unpause the
- // underlying stream.
- this._read = function (n) {
- debug('wrapped _read', n);
- if (paused) {
- paused = false;
- stream.resume();
- }
- };
- return this;
- };
- Object.defineProperty(Readable.prototype, 'readableHighWaterMark', {
- // making it explicit this property is not enumerable
- // because otherwise some prototype manipulation in
- // userland will fail
- enumerable: false,
- get: function () {
- return this._readableState.highWaterMark;
- }
- });
- // exposed for testing purposes only.
- Readable._fromList = fromList;
- // Pluck off n bytes from an array of buffers.
- // Length is the combined lengths of all the buffers in the list.
- // This function is designed to be inlinable, so please take care when making
- // changes to the function body.
- function fromList(n, state) {
- // nothing buffered
- if (state.length === 0) return null;
- var ret;
- if (state.objectMode) ret = state.buffer.shift();else if (!n || n >= state.length) {
- // read it all, truncate the list
- 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);
- state.buffer.clear();
- } else {
- // read part of list
- ret = fromListPartial(n, state.buffer, state.decoder);
- }
- return ret;
- }
- // Extracts only enough buffered data to satisfy the amount requested.
- // This function is designed to be inlinable, so please take care when making
- // changes to the function body.
- function fromListPartial(n, list, hasStrings) {
- var ret;
- if (n < list.head.data.length) {
- // slice is the same for buffers and strings
- ret = list.head.data.slice(0, n);
- list.head.data = list.head.data.slice(n);
- } else if (n === list.head.data.length) {
- // first chunk is a perfect match
- ret = list.shift();
- } else {
- // result spans more than one buffer
- ret = hasStrings ? copyFromBufferString(n, list) : copyFromBuffer(n, list);
- }
- return ret;
- }
- // Copies a specified amount of characters from the list of buffered data
- // chunks.
- // This function is designed to be inlinable, so please take care when making
- // changes to the function body.
- function copyFromBufferString(n, list) {
- var p = list.head;
- var c = 1;
- var ret = p.data;
- n -= ret.length;
- while (p = p.next) {
- var str = p.data;
- var nb = n > str.length ? str.length : n;
- if (nb === str.length) ret += str;else ret += str.slice(0, n);
- n -= nb;
- if (n === 0) {
- if (nb === str.length) {
- ++c;
- if (p.next) list.head = p.next;else list.head = list.tail = null;
- } else {
- list.head = p;
- p.data = str.slice(nb);
- }
- break;
- }
- ++c;
- }
- list.length -= c;
- return ret;
- }
- // Copies a specified amount of bytes from the list of buffered data chunks.
- // This function is designed to be inlinable, so please take care when making
- // changes to the function body.
- function copyFromBuffer(n, list) {
- var ret = Buffer.allocUnsafe(n);
- var p = list.head;
- var c = 1;
- p.data.copy(ret);
- n -= p.data.length;
- while (p = p.next) {
- var buf = p.data;
- var nb = n > buf.length ? buf.length : n;
- buf.copy(ret, ret.length - n, 0, nb);
- n -= nb;
- if (n === 0) {
- if (nb === buf.length) {
- ++c;
- if (p.next) list.head = p.next;else list.head = list.tail = null;
- } else {
- list.head = p;
- p.data = buf.slice(nb);
- }
- break;
- }
- ++c;
- }
- list.length -= c;
- return ret;
- }
- function endReadable(stream) {
- var state = stream._readableState;
- // If we get here before consuming all the bytes, then that is a
- // bug in node. Should never happen.
- if (state.length > 0) throw new Error('"endReadable()" called on non-empty stream');
- if (!state.endEmitted) {
- state.ended = true;
- pna.nextTick(endReadableNT, state, stream);
- }
- }
- function endReadableNT(state, stream) {
- // Check that we didn't get one last unshift.
- if (!state.endEmitted && state.length === 0) {
- state.endEmitted = true;
- stream.readable = false;
- stream.emit('end');
- }
- }
- function indexOf(xs, x) {
- for (var i = 0, l = xs.length; i < l; i++) {
- if (xs[i] === x) return i;
- }
- return -1;
- }
- }).call(this)}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
- },{"./_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){
- // Copyright Joyent, Inc. and other Node contributors.
- //
- // Permission is hereby granted, free of charge, to any person obtaining a
- // copy of this software and associated documentation files (the
- // "Software"), to deal in the Software without restriction, including
- // without limitation the rights to use, copy, modify, merge, publish,
- // distribute, sublicense, and/or sell copies of the Software, and to permit
- // persons to whom the Software is furnished to do so, subject to the
- // following conditions:
- //
- // The above copyright notice and this permission notice shall be included
- // in all copies or substantial portions of the Software.
- //
- // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
- // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
- // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
- // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
- // USE OR OTHER DEALINGS IN THE SOFTWARE.
- // a transform stream is a readable/writable stream where you do
- // something with the data. Sometimes it's called a "filter",
- // but that's not a great name for it, since that implies a thing where
- // some bits pass through, and others are simply ignored. (That would
- // be a valid example of a transform, of course.)
- //
- // While the output is causally related to the input, it's not a
- // necessarily symmetric or synchronous transformation. For example,
- // a zlib stream might take multiple plain-text writes(), and then
- // emit a single compressed chunk some time in the future.
- //
- // Here's how this works:
- //
- // The Transform stream has all the aspects of the readable and writable
- // stream classes. When you write(chunk), that calls _write(chunk,cb)
- // internally, and returns false if there's a lot of pending writes
- // buffered up. When you call read(), that calls _read(n) until
- // there's enough pending readable data buffered up.
- //
- // In a transform stream, the written data is placed in a buffer. When
- // _read(n) is called, it transforms the queued up data, calling the
- // buffered _write cb's as it consumes chunks. If consuming a single
- // written chunk would result in multiple output chunks, then the first
- // outputted bit calls the readcb, and subsequent chunks just go into
- // the read buffer, and will cause it to emit 'readable' if necessary.
- //
- // This way, back-pressure is actually determined by the reading side,
- // since _read has to be called to start processing a new chunk. However,
- // a pathological inflate type of transform can cause excessive buffering
- // here. For example, imagine a stream where every byte of input is
- // interpreted as an integer from 0-255, and then results in that many
- // bytes of output. Writing the 4 bytes {ff,ff,ff,ff} would result in
- // 1kb of data being output. In this case, you could write a very small
- // amount of input, and end up with a very large amount of output. In
- // such a pathological inflating mechanism, there'd be no way to tell
- // the system to stop doing the transform. A single 4MB write could
- // cause the system to run out of memory.
- //
- // However, even in such a pathological case, only a single written chunk
- // would be consumed, and then the rest would wait (un-transformed) until
- // the results of the previous transformed chunk were consumed.
- 'use strict';
- module.exports = Transform;
- var Duplex = require('./_stream_duplex');
- /*<replacement>*/
- var util = Object.create(require('core-util-is'));
- util.inherits = require('inherits');
- /*</replacement>*/
- util.inherits(Transform, Duplex);
- function afterTransform(er, data) {
- var ts = this._transformState;
- ts.transforming = false;
- var cb = ts.writecb;
- if (!cb) {
- return this.emit('error', new Error('write callback called multiple times'));
- }
- ts.writechunk = null;
- ts.writecb = null;
- if (data != null) // single equals check for both `null` and `undefined`
- this.push(data);
- cb(er);
- var rs = this._readableState;
- rs.reading = false;
- if (rs.needReadable || rs.length < rs.highWaterMark) {
- this._read(rs.highWaterMark);
- }
- }
- function Transform(options) {
- if (!(this instanceof Transform)) return new Transform(options);
- Duplex.call(this, options);
- this._transformState = {
- afterTransform: afterTransform.bind(this),
- needTransform: false,
- transforming: false,
- writecb: null,
- writechunk: null,
- writeencoding: null
- };
- // start out asking for a readable event once data is transformed.
- this._readableState.needReadable = true;
- // we have implemented the _read method, and done the other things
- // that Readable wants before the first _read call, so unset the
- // sync guard flag.
- this._readableState.sync = false;
- if (options) {
- if (typeof options.transform === 'function') this._transform = options.transform;
- if (typeof options.flush === 'function') this._flush = options.flush;
- }
- // When the writable side finishes, then flush out anything remaining.
- this.on('prefinish', prefinish);
- }
- function prefinish() {
- var _this = this;
- if (typeof this._flush === 'function') {
- this._flush(function (er, data) {
- done(_this, er, data);
- });
- } else {
- done(this, null, null);
- }
- }
- Transform.prototype.push = function (chunk, encoding) {
- this._transformState.needTransform = false;
- return Duplex.prototype.push.call(this, chunk, encoding);
- };
- // This is the part where you do stuff!
- // override this function in implementation classes.
- // 'chunk' is an input chunk.
- //
- // Call `push(newChunk)` to pass along transformed output
- // to the readable side. You may call 'push' zero or more times.
- //
- // Call `cb(err)` when you are done with this chunk. If you pass
- // an error, then that'll put the hurt on the whole operation. If you
- // never call cb(), then you'll never get another chunk.
- Transform.prototype._transform = function (chunk, encoding, cb) {
- throw new Error('_transform() is not implemented');
- };
- Transform.prototype._write = function (chunk, encoding, cb) {
- var ts = this._transformState;
- ts.writecb = cb;
- ts.writechunk = chunk;
- ts.writeencoding = encoding;
- if (!ts.transforming) {
- var rs = this._readableState;
- if (ts.needTransform || rs.needReadable || rs.length < rs.highWaterMark) this._read(rs.highWaterMark);
- }
- };
- // Doesn't matter what the args are here.
- // _transform does all the work.
- // That we got here means that the readable side wants more data.
- Transform.prototype._read = function (n) {
- var ts = this._transformState;
- if (ts.writechunk !== null && ts.writecb && !ts.transforming) {
- ts.transforming = true;
- this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform);
- } else {
- // mark that we need a transform, so that any data that comes in
- // will get processed, now that we've asked for it.
- ts.needTransform = true;
- }
- };
- Transform.prototype._destroy = function (err, cb) {
- var _this2 = this;
- Duplex.prototype._destroy.call(this, err, function (err2) {
- cb(err2);
- _this2.emit('close');
- });
- };
- function done(stream, er, data) {
- if (er) return stream.emit('error', er);
- if (data != null) // single equals check for both `null` and `undefined`
- stream.push(data);
- // if there's nothing in the write buffer, then that means
- // that nothing more will ever be provided
- if (stream._writableState.length) throw new Error('Calling transform done when ws.length != 0');
- if (stream._transformState.transforming) throw new Error('Calling transform done when still transforming');
- return stream.push(null);
- }
- },{"./_stream_duplex":330,"core-util-is":298,"inherits":311}],334:[function(require,module,exports){
- (function (process,global,setImmediate){(function (){
- // Copyright Joyent, Inc. and other Node contributors.
- //
- // Permission is hereby granted, free of charge, to any person obtaining a
- // copy of this software and associated documentation files (the
- // "Software"), to deal in the Software without restriction, including
- // without limitation the rights to use, copy, modify, merge, publish,
- // distribute, sublicense, and/or sell copies of the Software, and to permit
- // persons to whom the Software is furnished to do so, subject to the
- // following conditions:
- //
- // The above copyright notice and this permission notice shall be included
- // in all copies or substantial portions of the Software.
- //
- // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
- // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
- // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
- // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
- // USE OR OTHER DEALINGS IN THE SOFTWARE.
- // A bit simpler than readable streams.
- // Implement an async ._write(chunk, encoding, cb), and it'll handle all
- // the drain event emission and buffering.
- 'use strict';
- /*<replacement>*/
- var pna = require('process-nextick-args');
- /*</replacement>*/
- module.exports = Writable;
- /* <replacement> */
- function WriteReq(chunk, encoding, cb) {
- this.chunk = chunk;
- this.encoding = encoding;
- this.callback = cb;
- this.next = null;
- }
- // It seems a linked list but it is not
- // there will be only 2 of these for each stream
- function CorkedRequest(state) {
- var _this = this;
- this.next = null;
- this.entry = null;
- this.finish = function () {
- onCorkedFinish(_this, state);
- };
- }
- /* </replacement> */
- /*<replacement>*/
- var asyncWrite = !process.browser && ['v0.10', 'v0.9.'].indexOf(process.version.slice(0, 5)) > -1 ? setImmediate : pna.nextTick;
- /*</replacement>*/
- /*<replacement>*/
- var Duplex;
- /*</replacement>*/
- Writable.WritableState = WritableState;
- /*<replacement>*/
- var util = Object.create(require('core-util-is'));
- util.inherits = require('inherits');
- /*</replacement>*/
- /*<replacement>*/
- var internalUtil = {
- deprecate: require('util-deprecate')
- };
- /*</replacement>*/
- /*<replacement>*/
- var Stream = require('./internal/streams/stream');
- /*</replacement>*/
- /*<replacement>*/
- var Buffer = require('safe-buffer').Buffer;
- var OurUint8Array = global.Uint8Array || function () {};
- function _uint8ArrayToBuffer(chunk) {
- return Buffer.from(chunk);
- }
- function _isUint8Array(obj) {
- return Buffer.isBuffer(obj) || obj instanceof OurUint8Array;
- }
- /*</replacement>*/
- var destroyImpl = require('./internal/streams/destroy');
- util.inherits(Writable, Stream);
- function nop() {}
- function WritableState(options, stream) {
- Duplex = Duplex || require('./_stream_duplex');
- options = options || {};
- // Duplex streams are both readable and writable, but share
- // the same options object.
- // However, some cases require setting options to different
- // values for the readable and the writable sides of the duplex stream.
- // These options can be provided separately as readableXXX and writableXXX.
- var isDuplex = stream instanceof Duplex;
- // object stream flag to indicate whether or not this stream
- // contains buffers or objects.
- this.objectMode = !!options.objectMode;
- if (isDuplex) this.objectMode = this.objectMode || !!options.writableObjectMode;
- // the point at which write() starts returning false
- // Note: 0 is a valid value, means that we always return false if
- // the entire buffer is not flushed immediately on write()
- var hwm = options.highWaterMark;
- var writableHwm = options.writableHighWaterMark;
- var defaultHwm = this.objectMode ? 16 : 16 * 1024;
- if (hwm || hwm === 0) this.highWaterMark = hwm;else if (isDuplex && (writableHwm || writableHwm === 0)) this.highWaterMark = writableHwm;else this.highWaterMark = defaultHwm;
- // cast to ints.
- this.highWaterMark = Math.floor(this.highWaterMark);
- // if _final has been called
- this.finalCalled = false;
- // drain event flag.
- this.needDrain = false;
- // at the start of calling end()
- this.ending = false;
- // when end() has been called, and returned
- this.ended = false;
- // when 'finish' is emitted
- this.finished = false;
- // has it been destroyed
- this.destroyed = false;
- // should we decode strings into buffers before passing to _write?
- // this is here so that some node-core streams can optimize string
- // handling at a lower level.
- var noDecode = options.decodeStrings === false;
- this.decodeStrings = !noDecode;
- // Crypto is kind of old and crusty. Historically, its default string
- // encoding is 'binary' so we have to make this configurable.
- // Everything else in the universe uses 'utf8', though.
- this.defaultEncoding = options.defaultEncoding || 'utf8';
- // not an actual buffer we keep track of, but a measurement
- // of how much we're waiting to get pushed to some underlying
- // socket or file.
- this.length = 0;
- // a flag to see when we're in the middle of a write.
- this.writing = false;
- // when true all writes will be buffered until .uncork() call
- this.corked = 0;
- // a flag to be able to tell if the onwrite cb is called immediately,
- // or on a later tick. We set this to true at first, because any
- // actions that shouldn't happen until "later" should generally also
- // not happen before the first write call.
- this.sync = true;
- // a flag to know if we're processing previously buffered items, which
- // may call the _write() callback in the same tick, so that we don't
- // end up in an overlapped onwrite situation.
- this.bufferProcessing = false;
- // the callback that's passed to _write(chunk,cb)
- this.onwrite = function (er) {
- onwrite(stream, er);
- };
- // the callback that the user supplies to write(chunk,encoding,cb)
- this.writecb = null;
- // the amount that is being written when _write is called.
- this.writelen = 0;
- this.bufferedRequest = null;
- this.lastBufferedRequest = null;
- // number of pending user-supplied write callbacks
- // this must be 0 before 'finish' can be emitted
- this.pendingcb = 0;
- // emit prefinish if the only thing we're waiting for is _write cbs
- // This is relevant for synchronous Transform streams
- this.prefinished = false;
- // True if the error was already emitted and should not be thrown again
- this.errorEmitted = false;
- // count buffered requests
- this.bufferedRequestCount = 0;
- // allocate the first CorkedRequest, there is always
- // one allocated and free to use, and we maintain at most two
- this.corkedRequestsFree = new CorkedRequest(this);
- }
- WritableState.prototype.getBuffer = function getBuffer() {
- var current = this.bufferedRequest;
- var out = [];
- while (current) {
- out.push(current);
- current = current.next;
- }
- return out;
- };
- (function () {
- try {
- Object.defineProperty(WritableState.prototype, 'buffer', {
- get: internalUtil.deprecate(function () {
- return this.getBuffer();
- }, '_writableState.buffer is deprecated. Use _writableState.getBuffer ' + 'instead.', 'DEP0003')
- });
- } catch (_) {}
- })();
- // Test _writableState for inheritance to account for Duplex streams,
- // whose prototype chain only points to Readable.
- var realHasInstance;
- if (typeof Symbol === 'function' && Symbol.hasInstance && typeof Function.prototype[Symbol.hasInstance] === 'function') {
- realHasInstance = Function.prototype[Symbol.hasInstance];
- Object.defineProperty(Writable, Symbol.hasInstance, {
- value: function (object) {
- if (realHasInstance.call(this, object)) return true;
- if (this !== Writable) return false;
- return object && object._writableState instanceof WritableState;
- }
- });
- } else {
- realHasInstance = function (object) {
- return object instanceof this;
- };
- }
- function Writable(options) {
- Duplex = Duplex || require('./_stream_duplex');
- // Writable ctor is applied to Duplexes, too.
- // `realHasInstance` is necessary because using plain `instanceof`
- // would return false, as no `_writableState` property is attached.
- // Trying to use the custom `instanceof` for Writable here will also break the
- // Node.js LazyTransform implementation, which has a non-trivial getter for
- // `_writableState` that would lead to infinite recursion.
- if (!realHasInstance.call(Writable, this) && !(this instanceof Duplex)) {
- return new Writable(options);
- }
- this._writableState = new WritableState(options, this);
- // legacy.
- this.writable = true;
- if (options) {
- if (typeof options.write === 'function') this._write = options.write;
- if (typeof options.writev === 'function') this._writev = options.writev;
- if (typeof options.destroy === 'function') this._destroy = options.destroy;
- if (typeof options.final === 'function') this._final = options.final;
- }
- Stream.call(this);
- }
- // Otherwise people can pipe Writable streams, which is just wrong.
- Writable.prototype.pipe = function () {
- this.emit('error', new Error('Cannot pipe, not readable'));
- };
- function writeAfterEnd(stream, cb) {
- var er = new Error('write after end');
- // TODO: defer error events consistently everywhere, not just the cb
- stream.emit('error', er);
- pna.nextTick(cb, er);
- }
- // Checks that a user-supplied chunk is valid, especially for the particular
- // mode the stream is in. Currently this means that `null` is never accepted
- // and undefined/non-string values are only allowed in object mode.
- function validChunk(stream, state, chunk, cb) {
- var valid = true;
- var er = false;
- if (chunk === null) {
- er = new TypeError('May not write null values to stream');
- } else if (typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) {
- er = new TypeError('Invalid non-string/buffer chunk');
- }
- if (er) {
- stream.emit('error', er);
- pna.nextTick(cb, er);
- valid = false;
- }
- return valid;
- }
- Writable.prototype.write = function (chunk, encoding, cb) {
- var state = this._writableState;
- var ret = false;
- var isBuf = !state.objectMode && _isUint8Array(chunk);
- if (isBuf && !Buffer.isBuffer(chunk)) {
- chunk = _uint8ArrayToBuffer(chunk);
- }
- if (typeof encoding === 'function') {
- cb = encoding;
- encoding = null;
- }
- if (isBuf) encoding = 'buffer';else if (!encoding) encoding = state.defaultEncoding;
- if (typeof cb !== 'function') cb = nop;
- if (state.ended) writeAfterEnd(this, cb);else if (isBuf || validChunk(this, state, chunk, cb)) {
- state.pendingcb++;
- ret = writeOrBuffer(this, state, isBuf, chunk, encoding, cb);
- }
- return ret;
- };
- Writable.prototype.cork = function () {
- var state = this._writableState;
- state.corked++;
- };
- Writable.prototype.uncork = function () {
- var state = this._writableState;
- if (state.corked) {
- state.corked--;
- if (!state.writing && !state.corked && !state.finished && !state.bufferProcessing && state.bufferedRequest) clearBuffer(this, state);
- }
- };
- Writable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) {
- // node::ParseEncoding() requires lower case.
- if (typeof encoding === 'string') encoding = encoding.toLowerCase();
- 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);
- this._writableState.defaultEncoding = encoding;
- return this;
- };
- function decodeChunk(state, chunk, encoding) {
- if (!state.objectMode && state.decodeStrings !== false && typeof chunk === 'string') {
- chunk = Buffer.from(chunk, encoding);
- }
- return chunk;
- }
- Object.defineProperty(Writable.prototype, 'writableHighWaterMark', {
- // making it explicit this property is not enumerable
- // because otherwise some prototype manipulation in
- // userland will fail
- enumerable: false,
- get: function () {
- return this._writableState.highWaterMark;
- }
- });
- // if we're already writing something, then just put this
- // in the queue, and wait our turn. Otherwise, call _write
- // If we return false, then we need a drain event, so set that flag.
- function writeOrBuffer(stream, state, isBuf, chunk, encoding, cb) {
- if (!isBuf) {
- var newChunk = decodeChunk(state, chunk, encoding);
- if (chunk !== newChunk) {
- isBuf = true;
- encoding = 'buffer';
- chunk = newChunk;
- }
- }
- var len = state.objectMode ? 1 : chunk.length;
- state.length += len;
- var ret = state.length < state.highWaterMark;
- // we must ensure that previous needDrain will not be reset to false.
- if (!ret) state.needDrain = true;
- if (state.writing || state.corked) {
- var last = state.lastBufferedRequest;
- state.lastBufferedRequest = {
- chunk: chunk,
- encoding: encoding,
- isBuf: isBuf,
- callback: cb,
- next: null
- };
- if (last) {
- last.next = state.lastBufferedRequest;
- } else {
- state.bufferedRequest = state.lastBufferedRequest;
- }
- state.bufferedRequestCount += 1;
- } else {
- doWrite(stream, state, false, len, chunk, encoding, cb);
- }
- return ret;
- }
- function doWrite(stream, state, writev, len, chunk, encoding, cb) {
- state.writelen = len;
- state.writecb = cb;
- state.writing = true;
- state.sync = true;
- if (writev) stream._writev(chunk, state.onwrite);else stream._write(chunk, encoding, state.onwrite);
- state.sync = false;
- }
- function onwriteError(stream, state, sync, er, cb) {
- --state.pendingcb;
- if (sync) {
- // defer the callback if we are being called synchronously
- // to avoid piling up things on the stack
- pna.nextTick(cb, er);
- // this can emit finish, and it will always happen
- // after error
- pna.nextTick(finishMaybe, stream, state);
- stream._writableState.errorEmitted = true;
- stream.emit('error', er);
- } else {
- // the caller expect this to happen before if
- // it is async
- cb(er);
- stream._writableState.errorEmitted = true;
- stream.emit('error', er);
- // this can emit finish, but finish must
- // always follow error
- finishMaybe(stream, state);
- }
- }
- function onwriteStateUpdate(state) {
- state.writing = false;
- state.writecb = null;
- state.length -= state.writelen;
- state.writelen = 0;
- }
- function onwrite(stream, er) {
- var state = stream._writableState;
- var sync = state.sync;
- var cb = state.writecb;
- onwriteStateUpdate(state);
- if (er) onwriteError(stream, state, sync, er, cb);else {
- // Check if we're actually ready to finish, but don't emit yet
- var finished = needFinish(state);
- if (!finished && !state.corked && !state.bufferProcessing && state.bufferedRequest) {
- clearBuffer(stream, state);
- }
- if (sync) {
- /*<replacement>*/
- asyncWrite(afterWrite, stream, state, finished, cb);
- /*</replacement>*/
- } else {
- afterWrite(stream, state, finished, cb);
- }
- }
- }
- function afterWrite(stream, state, finished, cb) {
- if (!finished) onwriteDrain(stream, state);
- state.pendingcb--;
- cb();
- finishMaybe(stream, state);
- }
- // Must force callback to be called on nextTick, so that we don't
- // emit 'drain' before the write() consumer gets the 'false' return
- // value, and has a chance to attach a 'drain' listener.
- function onwriteDrain(stream, state) {
- if (state.length === 0 && state.needDrain) {
- state.needDrain = false;
- stream.emit('drain');
- }
- }
- // if there's something in the buffer waiting, then process it
- function clearBuffer(stream, state) {
- state.bufferProcessing = true;
- var entry = state.bufferedRequest;
- if (stream._writev && entry && entry.next) {
- // Fast case, write everything using _writev()
- var l = state.bufferedRequestCount;
- var buffer = new Array(l);
- var holder = state.corkedRequestsFree;
- holder.entry = entry;
- var count = 0;
- var allBuffers = true;
- while (entry) {
- buffer[count] = entry;
- if (!entry.isBuf) allBuffers = false;
- entry = entry.next;
- count += 1;
- }
- buffer.allBuffers = allBuffers;
- doWrite(stream, state, true, state.length, buffer, '', holder.finish);
- // doWrite is almost always async, defer these to save a bit of time
- // as the hot path ends with doWrite
- state.pendingcb++;
- state.lastBufferedRequest = null;
- if (holder.next) {
- state.corkedRequestsFree = holder.next;
- holder.next = null;
- } else {
- state.corkedRequestsFree = new CorkedRequest(state);
- }
- state.bufferedRequestCount = 0;
- } else {
- // Slow case, write chunks one-by-one
- while (entry) {
- var chunk = entry.chunk;
- var encoding = entry.encoding;
- var cb = entry.callback;
- var len = state.objectMode ? 1 : chunk.length;
- doWrite(stream, state, false, len, chunk, encoding, cb);
- entry = entry.next;
- state.bufferedRequestCount--;
- // if we didn't call the onwrite immediately, then
- // it means that we need to wait until it does.
- // also, that means that the chunk and cb are currently
- // being processed, so move the buffer counter past them.
- if (state.writing) {
- break;
- }
- }
- if (entry === null) state.lastBufferedRequest = null;
- }
- state.bufferedRequest = entry;
- state.bufferProcessing = false;
- }
- Writable.prototype._write = function (chunk, encoding, cb) {
- cb(new Error('_write() is not implemented'));
- };
- Writable.prototype._writev = null;
- Writable.prototype.end = function (chunk, encoding, cb) {
- var state = this._writableState;
- if (typeof chunk === 'function') {
- cb = chunk;
- chunk = null;
- encoding = null;
- } else if (typeof encoding === 'function') {
- cb = encoding;
- encoding = null;
- }
- if (chunk !== null && chunk !== undefined) this.write(chunk, encoding);
- // .end() fully uncorks
- if (state.corked) {
- state.corked = 1;
- this.uncork();
- }
- // ignore unnecessary end() calls.
- if (!state.ending && !state.finished) endWritable(this, state, cb);
- };
- function needFinish(state) {
- return state.ending && state.length === 0 && state.bufferedRequest === null && !state.finished && !state.writing;
- }
- function callFinal(stream, state) {
- stream._final(function (err) {
- state.pendingcb--;
- if (err) {
- stream.emit('error', err);
- }
- state.prefinished = true;
- stream.emit('prefinish');
- finishMaybe(stream, state);
- });
- }
- function prefinish(stream, state) {
- if (!state.prefinished && !state.finalCalled) {
- if (typeof stream._final === 'function') {
- state.pendingcb++;
- state.finalCalled = true;
- pna.nextTick(callFinal, stream, state);
- } else {
- state.prefinished = true;
- stream.emit('prefinish');
- }
- }
- }
- function finishMaybe(stream, state) {
- var need = needFinish(state);
- if (need) {
- prefinish(stream, state);
- if (state.pendingcb === 0) {
- state.finished = true;
- stream.emit('finish');
- }
- }
- return need;
- }
- function endWritable(stream, state, cb) {
- state.ending = true;
- finishMaybe(stream, state);
- if (cb) {
- if (state.finished) pna.nextTick(cb);else stream.once('finish', cb);
- }
- state.ended = true;
- stream.writable = false;
- }
- function onCorkedFinish(corkReq, state, err) {
- var entry = corkReq.entry;
- corkReq.entry = null;
- while (entry) {
- var cb = entry.callback;
- state.pendingcb--;
- cb(err);
- entry = entry.next;
- }
- if (state.corkedRequestsFree) {
- state.corkedRequestsFree.next = corkReq;
- } else {
- state.corkedRequestsFree = corkReq;
- }
- }
- Object.defineProperty(Writable.prototype, 'destroyed', {
- get: function () {
- if (this._writableState === undefined) {
- return false;
- }
- return this._writableState.destroyed;
- },
- set: function (value) {
- // we ignore the value if the stream
- // has not been initialized yet
- if (!this._writableState) {
- return;
- }
- // backward compatibility, the user is explicitly
- // managing destroyed
- this._writableState.destroyed = value;
- }
- });
- Writable.prototype.destroy = destroyImpl.destroy;
- Writable.prototype._undestroy = destroyImpl.undestroy;
- Writable.prototype._destroy = function (err, cb) {
- this.end();
- cb(err);
- };
- }).call(this)}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {},require("timers").setImmediate)
- },{"./_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){
- 'use strict';
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
- var Buffer = require('safe-buffer').Buffer;
- var util = require('util');
- function copyBuffer(src, target, offset) {
- src.copy(target, offset);
- }
- module.exports = function () {
- function BufferList() {
- _classCallCheck(this, BufferList);
- this.head = null;
- this.tail = null;
- this.length = 0;
- }
- BufferList.prototype.push = function push(v) {
- var entry = { data: v, next: null };
- if (this.length > 0) this.tail.next = entry;else this.head = entry;
- this.tail = entry;
- ++this.length;
- };
- BufferList.prototype.unshift = function unshift(v) {
- var entry = { data: v, next: this.head };
- if (this.length === 0) this.tail = entry;
- this.head = entry;
- ++this.length;
- };
- BufferList.prototype.shift = function shift() {
- if (this.length === 0) return;
- var ret = this.head.data;
- if (this.length === 1) this.head = this.tail = null;else this.head = this.head.next;
- --this.length;
- return ret;
- };
- BufferList.prototype.clear = function clear() {
- this.head = this.tail = null;
- this.length = 0;
- };
- BufferList.prototype.join = function join(s) {
- if (this.length === 0) return '';
- var p = this.head;
- var ret = '' + p.data;
- while (p = p.next) {
- ret += s + p.data;
- }return ret;
- };
- BufferList.prototype.concat = function concat(n) {
- if (this.length === 0) return Buffer.alloc(0);
- if (this.length === 1) return this.head.data;
- var ret = Buffer.allocUnsafe(n >>> 0);
- var p = this.head;
- var i = 0;
- while (p) {
- copyBuffer(p.data, ret, i);
- i += p.data.length;
- p = p.next;
- }
- return ret;
- };
- return BufferList;
- }();
- if (util && util.inspect && util.inspect.custom) {
- module.exports.prototype[util.inspect.custom] = function () {
- var obj = util.inspect({ length: this.length });
- return this.constructor.name + ' ' + obj;
- };
- }
- },{"safe-buffer":343,"util":84}],336:[function(require,module,exports){
- 'use strict';
- /*<replacement>*/
- var pna = require('process-nextick-args');
- /*</replacement>*/
- // undocumented cb() API, needed for core, not for public API
- function destroy(err, cb) {
- var _this = this;
- var readableDestroyed = this._readableState && this._readableState.destroyed;
- var writableDestroyed = this._writableState && this._writableState.destroyed;
- if (readableDestroyed || writableDestroyed) {
- if (cb) {
- cb(err);
- } else if (err && (!this._writableState || !this._writableState.errorEmitted)) {
- pna.nextTick(emitErrorNT, this, err);
- }
- return this;
- }
- // we set destroyed to true before firing error callbacks in order
- // to make it re-entrance safe in case destroy() is called within callbacks
- if (this._readableState) {
- this._readableState.destroyed = true;
- }
- // if this is a duplex stream mark the writable part as destroyed as well
- if (this._writableState) {
- this._writableState.destroyed = true;
- }
- this._destroy(err || null, function (err) {
- if (!cb && err) {
- pna.nextTick(emitErrorNT, _this, err);
- if (_this._writableState) {
- _this._writableState.errorEmitted = true;
- }
- } else if (cb) {
- cb(err);
- }
- });
- return this;
- }
- function undestroy() {
- if (this._readableState) {
- this._readableState.destroyed = false;
- this._readableState.reading = false;
- this._readableState.ended = false;
- this._readableState.endEmitted = false;
- }
- if (this._writableState) {
- this._writableState.destroyed = false;
- this._writableState.ended = false;
- this._writableState.ending = false;
- this._writableState.finished = false;
- this._writableState.errorEmitted = false;
- }
- }
- function emitErrorNT(self, err) {
- self.emit('error', err);
- }
- module.exports = {
- destroy: destroy,
- undestroy: undestroy
- };
- },{"process-nextick-args":323}],337:[function(require,module,exports){
- module.exports = require('events').EventEmitter;
- },{"events":301}],338:[function(require,module,exports){
- module.exports = require('./readable').PassThrough
- },{"./readable":339}],339:[function(require,module,exports){
- exports = module.exports = require('./lib/_stream_readable.js');
- exports.Stream = exports;
- exports.Readable = exports;
- exports.Writable = require('./lib/_stream_writable.js');
- exports.Duplex = require('./lib/_stream_duplex.js');
- exports.Transform = require('./lib/_stream_transform.js');
- exports.PassThrough = require('./lib/_stream_passthrough.js');
- },{"./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){
- module.exports = require('./readable').Transform
- },{"./readable":339}],341:[function(require,module,exports){
- module.exports = require('./lib/_stream_writable.js');
- },{"./lib/_stream_writable.js":334}],342:[function(require,module,exports){
- /**
- * Copyright (c) 2014-present, Facebook, Inc.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
- var runtime = (function (exports) {
- "use strict";
- var Op = Object.prototype;
- var hasOwn = Op.hasOwnProperty;
- var undefined; // More compressible than void 0.
- var $Symbol = typeof Symbol === "function" ? Symbol : {};
- var iteratorSymbol = $Symbol.iterator || "@@iterator";
- var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator";
- var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
- function define(obj, key, value) {
- Object.defineProperty(obj, key, {
- value: value,
- enumerable: true,
- configurable: true,
- writable: true
- });
- return obj[key];
- }
- try {
- // IE 8 has a broken Object.defineProperty that only works on DOM objects.
- define({}, "");
- } catch (err) {
- define = function(obj, key, value) {
- return obj[key] = value;
- };
- }
- function wrap(innerFn, outerFn, self, tryLocsList) {
- // If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator.
- var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;
- var generator = Object.create(protoGenerator.prototype);
- var context = new Context(tryLocsList || []);
- // The ._invoke method unifies the implementations of the .next,
- // .throw, and .return methods.
- generator._invoke = makeInvokeMethod(innerFn, self, context);
- return generator;
- }
- exports.wrap = wrap;
- // Try/catch helper to minimize deoptimizations. Returns a completion
- // record like context.tryEntries[i].completion. This interface could
- // have been (and was previously) designed to take a closure to be
- // invoked without arguments, but in all the cases we care about we
- // already have an existing method we want to call, so there's no need
- // to create a new function object. We can even get away with assuming
- // the method takes exactly one argument, since that happens to be true
- // in every case, so we don't have to touch the arguments object. The
- // only additional allocation required is the completion record, which
- // has a stable shape and so hopefully should be cheap to allocate.
- function tryCatch(fn, obj, arg) {
- try {
- return { type: "normal", arg: fn.call(obj, arg) };
- } catch (err) {
- return { type: "throw", arg: err };
- }
- }
- var GenStateSuspendedStart = "suspendedStart";
- var GenStateSuspendedYield = "suspendedYield";
- var GenStateExecuting = "executing";
- var GenStateCompleted = "completed";
- // Returning this object from the innerFn has the same effect as
- // breaking out of the dispatch switch statement.
- var ContinueSentinel = {};
- // Dummy constructor functions that we use as the .constructor and
- // .constructor.prototype properties for functions that return Generator
- // objects. For full spec compliance, you may wish to configure your
- // minifier not to mangle the names of these two functions.
- function Generator() {}
- function GeneratorFunction() {}
- function GeneratorFunctionPrototype() {}
- // This is a polyfill for %IteratorPrototype% for environments that
- // don't natively support it.
- var IteratorPrototype = {};
- define(IteratorPrototype, iteratorSymbol, function () {
- return this;
- });
- var getProto = Object.getPrototypeOf;
- var NativeIteratorPrototype = getProto && getProto(getProto(values([])));
- if (NativeIteratorPrototype &&
- NativeIteratorPrototype !== Op &&
- hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {
- // This environment has a native %IteratorPrototype%; use it instead
- // of the polyfill.
- IteratorPrototype = NativeIteratorPrototype;
- }
- var Gp = GeneratorFunctionPrototype.prototype =
- Generator.prototype = Object.create(IteratorPrototype);
- GeneratorFunction.prototype = GeneratorFunctionPrototype;
- define(Gp, "constructor", GeneratorFunctionPrototype);
- define(GeneratorFunctionPrototype, "constructor", GeneratorFunction);
- GeneratorFunction.displayName = define(
- GeneratorFunctionPrototype,
- toStringTagSymbol,
- "GeneratorFunction"
- );
- // Helper for defining the .next, .throw, and .return methods of the
- // Iterator interface in terms of a single ._invoke method.
- function defineIteratorMethods(prototype) {
- ["next", "throw", "return"].forEach(function(method) {
- define(prototype, method, function(arg) {
- return this._invoke(method, arg);
- });
- });
- }
- exports.isGeneratorFunction = function(genFun) {
- var ctor = typeof genFun === "function" && genFun.constructor;
- return ctor
- ? ctor === GeneratorFunction ||
- // For the native GeneratorFunction constructor, the best we can
- // do is to check its .name property.
- (ctor.displayName || ctor.name) === "GeneratorFunction"
- : false;
- };
- exports.mark = function(genFun) {
- if (Object.setPrototypeOf) {
- Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);
- } else {
- genFun.__proto__ = GeneratorFunctionPrototype;
- define(genFun, toStringTagSymbol, "GeneratorFunction");
- }
- genFun.prototype = Object.create(Gp);
- return genFun;
- };
- // Within the body of any async function, `await x` is transformed to
- // `yield regeneratorRuntime.awrap(x)`, so that the runtime can test
- // `hasOwn.call(value, "__await")` to determine if the yielded value is
- // meant to be awaited.
- exports.awrap = function(arg) {
- return { __await: arg };
- };
- function AsyncIterator(generator, PromiseImpl) {
- function invoke(method, arg, resolve, reject) {
- var record = tryCatch(generator[method], generator, arg);
- if (record.type === "throw") {
- reject(record.arg);
- } else {
- var result = record.arg;
- var value = result.value;
- if (value &&
- typeof value === "object" &&
- hasOwn.call(value, "__await")) {
- return PromiseImpl.resolve(value.__await).then(function(value) {
- invoke("next", value, resolve, reject);
- }, function(err) {
- invoke("throw", err, resolve, reject);
- });
- }
- return PromiseImpl.resolve(value).then(function(unwrapped) {
- // When a yielded Promise is resolved, its final value becomes
- // the .value of the Promise<{value,done}> result for the
- // current iteration.
- result.value = unwrapped;
- resolve(result);
- }, function(error) {
- // If a rejected Promise was yielded, throw the rejection back
- // into the async generator function so it can be handled there.
- return invoke("throw", error, resolve, reject);
- });
- }
- }
- var previousPromise;
- function enqueue(method, arg) {
- function callInvokeWithMethodAndArg() {
- return new PromiseImpl(function(resolve, reject) {
- invoke(method, arg, resolve, reject);
- });
- }
- return previousPromise =
- // If enqueue has been called before, then we want to wait until
- // all previous Promises have been resolved before calling invoke,
- // so that results are always delivered in the correct order. If
- // enqueue has not been called before, then it is important to
- // call invoke immediately, without waiting on a callback to fire,
- // so that the async generator function has the opportunity to do
- // any necessary setup in a predictable way. This predictability
- // is why the Promise constructor synchronously invokes its
- // executor callback, and why async functions synchronously
- // execute code before the first await. Since we implement simple
- // async functions in terms of async generators, it is especially
- // important to get this right, even though it requires care.
- previousPromise ? previousPromise.then(
- callInvokeWithMethodAndArg,
- // Avoid propagating failures to Promises returned by later
- // invocations of the iterator.
- callInvokeWithMethodAndArg
- ) : callInvokeWithMethodAndArg();
- }
- // Define the unified helper method that is used to implement .next,
- // .throw, and .return (see defineIteratorMethods).
- this._invoke = enqueue;
- }
- defineIteratorMethods(AsyncIterator.prototype);
- define(AsyncIterator.prototype, asyncIteratorSymbol, function () {
- return this;
- });
- exports.AsyncIterator = AsyncIterator;
- // Note that simple async functions are implemented on top of
- // AsyncIterator objects; they just return a Promise for the value of
- // the final result produced by the iterator.
- exports.async = function(innerFn, outerFn, self, tryLocsList, PromiseImpl) {
- if (PromiseImpl === void 0) PromiseImpl = Promise;
- var iter = new AsyncIterator(
- wrap(innerFn, outerFn, self, tryLocsList),
- PromiseImpl
- );
- return exports.isGeneratorFunction(outerFn)
- ? iter // If outerFn is a generator, return the full iterator.
- : iter.next().then(function(result) {
- return result.done ? result.value : iter.next();
- });
- };
- function makeInvokeMethod(innerFn, self, context) {
- var state = GenStateSuspendedStart;
- return function invoke(method, arg) {
- if (state === GenStateExecuting) {
- throw new Error("Generator is already running");
- }
- if (state === GenStateCompleted) {
- if (method === "throw") {
- throw arg;
- }
- // Be forgiving, per 25.3.3.3.3 of the spec:
- // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume
- return doneResult();
- }
- context.method = method;
- context.arg = arg;
- while (true) {
- var delegate = context.delegate;
- if (delegate) {
- var delegateResult = maybeInvokeDelegate(delegate, context);
- if (delegateResult) {
- if (delegateResult === ContinueSentinel) continue;
- return delegateResult;
- }
- }
- if (context.method === "next") {
- // Setting context._sent for legacy support of Babel's
- // function.sent implementation.
- context.sent = context._sent = context.arg;
- } else if (context.method === "throw") {
- if (state === GenStateSuspendedStart) {
- state = GenStateCompleted;
- throw context.arg;
- }
- context.dispatchException(context.arg);
- } else if (context.method === "return") {
- context.abrupt("return", context.arg);
- }
- state = GenStateExecuting;
- var record = tryCatch(innerFn, self, context);
- if (record.type === "normal") {
- // If an exception is thrown from innerFn, we leave state ===
- // GenStateExecuting and loop back for another invocation.
- state = context.done
- ? GenStateCompleted
- : GenStateSuspendedYield;
- if (record.arg === ContinueSentinel) {
- continue;
- }
- return {
- value: record.arg,
- done: context.done
- };
- } else if (record.type === "throw") {
- state = GenStateCompleted;
- // Dispatch the exception by looping back around to the
- // context.dispatchException(context.arg) call above.
- context.method = "throw";
- context.arg = record.arg;
- }
- }
- };
- }
- // Call delegate.iterator[context.method](context.arg) and handle the
- // result, either by returning a { value, done } result from the
- // delegate iterator, or by modifying context.method and context.arg,
- // setting context.delegate to null, and returning the ContinueSentinel.
- function maybeInvokeDelegate(delegate, context) {
- var method = delegate.iterator[context.method];
- if (method === undefined) {
- // A .throw or .return when the delegate iterator has no .throw
- // method always terminates the yield* loop.
- context.delegate = null;
- if (context.method === "throw") {
- // Note: ["return"] must be used for ES3 parsing compatibility.
- if (delegate.iterator["return"]) {
- // If the delegate iterator has a return method, give it a
- // chance to clean up.
- context.method = "return";
- context.arg = undefined;
- maybeInvokeDelegate(delegate, context);
- if (context.method === "throw") {
- // If maybeInvokeDelegate(context) changed context.method from
- // "return" to "throw", let that override the TypeError below.
- return ContinueSentinel;
- }
- }
- context.method = "throw";
- context.arg = new TypeError(
- "The iterator does not provide a 'throw' method");
- }
- return ContinueSentinel;
- }
- var record = tryCatch(method, delegate.iterator, context.arg);
- if (record.type === "throw") {
- context.method = "throw";
- context.arg = record.arg;
- context.delegate = null;
- return ContinueSentinel;
- }
- var info = record.arg;
- if (! info) {
- context.method = "throw";
- context.arg = new TypeError("iterator result is not an object");
- context.delegate = null;
- return ContinueSentinel;
- }
- if (info.done) {
- // Assign the result of the finished delegate to the temporary
- // variable specified by delegate.resultName (see delegateYield).
- context[delegate.resultName] = info.value;
- // Resume execution at the desired location (see delegateYield).
- context.next = delegate.nextLoc;
- // If context.method was "throw" but the delegate handled the
- // exception, let the outer generator proceed normally. If
- // context.method was "next", forget context.arg since it has been
- // "consumed" by the delegate iterator. If context.method was
- // "return", allow the original .return call to continue in the
- // outer generator.
- if (context.method !== "return") {
- context.method = "next";
- context.arg = undefined;
- }
- } else {
- // Re-yield the result returned by the delegate method.
- return info;
- }
- // The delegate iterator is finished, so forget it and continue with
- // the outer generator.
- context.delegate = null;
- return ContinueSentinel;
- }
- // Define Generator.prototype.{next,throw,return} in terms of the
- // unified ._invoke helper method.
- defineIteratorMethods(Gp);
- define(Gp, toStringTagSymbol, "Generator");
- // A Generator should always return itself as the iterator object when the
- // @@iterator function is called on it. Some browsers' implementations of the
- // iterator prototype chain incorrectly implement this, causing the Generator
- // object to not be returned from this call. This ensures that doesn't happen.
- // See https://github.com/facebook/regenerator/issues/274 for more details.
- define(Gp, iteratorSymbol, function() {
- return this;
- });
- define(Gp, "toString", function() {
- return "[object Generator]";
- });
- function pushTryEntry(locs) {
- var entry = { tryLoc: locs[0] };
- if (1 in locs) {
- entry.catchLoc = locs[1];
- }
- if (2 in locs) {
- entry.finallyLoc = locs[2];
- entry.afterLoc = locs[3];
- }
- this.tryEntries.push(entry);
- }
- function resetTryEntry(entry) {
- var record = entry.completion || {};
- record.type = "normal";
- delete record.arg;
- entry.completion = record;
- }
- function Context(tryLocsList) {
- // The root entry object (effectively a try statement without a catch
- // or a finally block) gives us a place to store values thrown from
- // locations where there is no enclosing try statement.
- this.tryEntries = [{ tryLoc: "root" }];
- tryLocsList.forEach(pushTryEntry, this);
- this.reset(true);
- }
- exports.keys = function(object) {
- var keys = [];
- for (var key in object) {
- keys.push(key);
- }
- keys.reverse();
- // Rather than returning an object with a next method, we keep
- // things simple and return the next function itself.
- return function next() {
- while (keys.length) {
- var key = keys.pop();
- if (key in object) {
- next.value = key;
- next.done = false;
- return next;
- }
- }
- // To avoid creating an additional object, we just hang the .value
- // and .done properties off the next function object itself. This
- // also ensures that the minifier will not anonymize the function.
- next.done = true;
- return next;
- };
- };
- function values(iterable) {
- if (iterable) {
- var iteratorMethod = iterable[iteratorSymbol];
- if (iteratorMethod) {
- return iteratorMethod.call(iterable);
- }
- if (typeof iterable.next === "function") {
- return iterable;
- }
- if (!isNaN(iterable.length)) {
- var i = -1, next = function next() {
- while (++i < iterable.length) {
- if (hasOwn.call(iterable, i)) {
- next.value = iterable[i];
- next.done = false;
- return next;
- }
- }
- next.value = undefined;
- next.done = true;
- return next;
- };
- return next.next = next;
- }
- }
- // Return an iterator with no values.
- return { next: doneResult };
- }
- exports.values = values;
- function doneResult() {
- return { value: undefined, done: true };
- }
- Context.prototype = {
- constructor: Context,
- reset: function(skipTempReset) {
- this.prev = 0;
- this.next = 0;
- // Resetting context._sent for legacy support of Babel's
- // function.sent implementation.
- this.sent = this._sent = undefined;
- this.done = false;
- this.delegate = null;
- this.method = "next";
- this.arg = undefined;
- this.tryEntries.forEach(resetTryEntry);
- if (!skipTempReset) {
- for (var name in this) {
- // Not sure about the optimal order of these conditions:
- if (name.charAt(0) === "t" &&
- hasOwn.call(this, name) &&
- !isNaN(+name.slice(1))) {
- this[name] = undefined;
- }
- }
- }
- },
- stop: function() {
- this.done = true;
- var rootEntry = this.tryEntries[0];
- var rootRecord = rootEntry.completion;
- if (rootRecord.type === "throw") {
- throw rootRecord.arg;
- }
- return this.rval;
- },
- dispatchException: function(exception) {
- if (this.done) {
- throw exception;
- }
- var context = this;
- function handle(loc, caught) {
- record.type = "throw";
- record.arg = exception;
- context.next = loc;
- if (caught) {
- // If the dispatched exception was caught by a catch block,
- // then let that catch block handle the exception normally.
- context.method = "next";
- context.arg = undefined;
- }
- return !! caught;
- }
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
- var entry = this.tryEntries[i];
- var record = entry.completion;
- if (entry.tryLoc === "root") {
- // Exception thrown outside of any try block that could handle
- // it, so set the completion value of the entire function to
- // throw the exception.
- return handle("end");
- }
- if (entry.tryLoc <= this.prev) {
- var hasCatch = hasOwn.call(entry, "catchLoc");
- var hasFinally = hasOwn.call(entry, "finallyLoc");
- if (hasCatch && hasFinally) {
- if (this.prev < entry.catchLoc) {
- return handle(entry.catchLoc, true);
- } else if (this.prev < entry.finallyLoc) {
- return handle(entry.finallyLoc);
- }
- } else if (hasCatch) {
- if (this.prev < entry.catchLoc) {
- return handle(entry.catchLoc, true);
- }
- } else if (hasFinally) {
- if (this.prev < entry.finallyLoc) {
- return handle(entry.finallyLoc);
- }
- } else {
- throw new Error("try statement without catch or finally");
- }
- }
- }
- },
- abrupt: function(type, arg) {
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
- var entry = this.tryEntries[i];
- if (entry.tryLoc <= this.prev &&
- hasOwn.call(entry, "finallyLoc") &&
- this.prev < entry.finallyLoc) {
- var finallyEntry = entry;
- break;
- }
- }
- if (finallyEntry &&
- (type === "break" ||
- type === "continue") &&
- finallyEntry.tryLoc <= arg &&
- arg <= finallyEntry.finallyLoc) {
- // Ignore the finally entry if control is not jumping to a
- // location outside the try/catch block.
- finallyEntry = null;
- }
- var record = finallyEntry ? finallyEntry.completion : {};
- record.type = type;
- record.arg = arg;
- if (finallyEntry) {
- this.method = "next";
- this.next = finallyEntry.finallyLoc;
- return ContinueSentinel;
- }
- return this.complete(record);
- },
- complete: function(record, afterLoc) {
- if (record.type === "throw") {
- throw record.arg;
- }
- if (record.type === "break" ||
- record.type === "continue") {
- this.next = record.arg;
- } else if (record.type === "return") {
- this.rval = this.arg = record.arg;
- this.method = "return";
- this.next = "end";
- } else if (record.type === "normal" && afterLoc) {
- this.next = afterLoc;
- }
- return ContinueSentinel;
- },
- finish: function(finallyLoc) {
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
- var entry = this.tryEntries[i];
- if (entry.finallyLoc === finallyLoc) {
- this.complete(entry.completion, entry.afterLoc);
- resetTryEntry(entry);
- return ContinueSentinel;
- }
- }
- },
- "catch": function(tryLoc) {
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
- var entry = this.tryEntries[i];
- if (entry.tryLoc === tryLoc) {
- var record = entry.completion;
- if (record.type === "throw") {
- var thrown = record.arg;
- resetTryEntry(entry);
- }
- return thrown;
- }
- }
- // The context.catch method must only be called with a location
- // argument that corresponds to a known catch block.
- throw new Error("illegal catch attempt");
- },
- delegateYield: function(iterable, resultName, nextLoc) {
- this.delegate = {
- iterator: values(iterable),
- resultName: resultName,
- nextLoc: nextLoc
- };
- if (this.method === "next") {
- // Deliberately forget the last sent value so that we don't
- // accidentally pass it on to the delegate.
- this.arg = undefined;
- }
- return ContinueSentinel;
- }
- };
- // Regardless of whether this script is executing as a CommonJS module
- // or not, return the runtime object so that we can declare the variable
- // regeneratorRuntime in the outer scope, which allows this module to be
- // injected easily by `bin/regenerator --include-runtime script.js`.
- return exports;
- }(
- // If this script is executing as a CommonJS module, use module.exports
- // as the regeneratorRuntime namespace. Otherwise create a new empty
- // object. Either way, the resulting object will be used to initialize
- // the regeneratorRuntime variable at the top of this file.
- typeof module === "object" ? module.exports : {}
- ));
- try {
- regeneratorRuntime = runtime;
- } catch (accidentalStrictMode) {
- // This module should not be running in strict mode, so the above
- // assignment should always work unless something is misconfigured. Just
- // in case runtime.js accidentally runs in strict mode, in modern engines
- // we can explicitly access globalThis. In older engines we can escape
- // strict mode using a global Function call. This could conceivably fail
- // if a Content Security Policy forbids using Function, but in that case
- // the proper solution is to fix the accidental strict mode problem. If
- // you've misconfigured your bundler to force strict mode and applied a
- // CSP to forbid Function, and you're not willing to fix either of those
- // problems, please detail your unique predicament in a GitHub issue.
- if (typeof globalThis === "object") {
- globalThis.regeneratorRuntime = runtime;
- } else {
- Function("r", "regeneratorRuntime = r")(runtime);
- }
- }
- },{}],343:[function(require,module,exports){
- /* eslint-disable node/no-deprecated-api */
- var buffer = require('buffer')
- var Buffer = buffer.Buffer
- // alternative to using Object.keys for old browsers
- function copyProps (src, dst) {
- for (var key in src) {
- dst[key] = src[key]
- }
- }
- if (Buffer.from && Buffer.alloc && Buffer.allocUnsafe && Buffer.allocUnsafeSlow) {
- module.exports = buffer
- } else {
- // Copy properties from require('buffer')
- copyProps(buffer, exports)
- exports.Buffer = SafeBuffer
- }
- function SafeBuffer (arg, encodingOrOffset, length) {
- return Buffer(arg, encodingOrOffset, length)
- }
- // Copy static methods from Buffer
- copyProps(Buffer, SafeBuffer)
- SafeBuffer.from = function (arg, encodingOrOffset, length) {
- if (typeof arg === 'number') {
- throw new TypeError('Argument must not be a number')
- }
- return Buffer(arg, encodingOrOffset, length)
- }
- SafeBuffer.alloc = function (size, fill, encoding) {
- if (typeof size !== 'number') {
- throw new TypeError('Argument must be a number')
- }
- var buf = Buffer(size)
- if (fill !== undefined) {
- if (typeof encoding === 'string') {
- buf.fill(fill, encoding)
- } else {
- buf.fill(fill)
- }
- } else {
- buf.fill(0)
- }
- return buf
- }
- SafeBuffer.allocUnsafe = function (size) {
- if (typeof size !== 'number') {
- throw new TypeError('Argument must be a number')
- }
- return Buffer(size)
- }
- SafeBuffer.allocUnsafeSlow = function (size) {
- if (typeof size !== 'number') {
- throw new TypeError('Argument must be a number')
- }
- return buffer.SlowBuffer(size)
- }
- },{"buffer":85}],344:[function(require,module,exports){
- (function (Buffer){(function (){
- ;(function (sax) { // wrapper for non-node envs
- sax.parser = function (strict, opt) { return new SAXParser(strict, opt) }
- sax.SAXParser = SAXParser
- sax.SAXStream = SAXStream
- sax.createStream = createStream
- // When we pass the MAX_BUFFER_LENGTH position, start checking for buffer overruns.
- // When we check, schedule the next check for MAX_BUFFER_LENGTH - (max(buffer lengths)),
- // since that's the earliest that a buffer overrun could occur. This way, checks are
- // as rare as required, but as often as necessary to ensure never crossing this bound.
- // Furthermore, buffers are only tested at most once per write(), so passing a very
- // large string into write() might have undesirable effects, but this is manageable by
- // the caller, so it is assumed to be safe. Thus, a call to write() may, in the extreme
- // edge case, result in creating at most one complete copy of the string passed in.
- // Set to Infinity to have unlimited buffers.
- sax.MAX_BUFFER_LENGTH = 64 * 1024
- var buffers = [
- 'comment', 'sgmlDecl', 'textNode', 'tagName', 'doctype',
- 'procInstName', 'procInstBody', 'entity', 'attribName',
- 'attribValue', 'cdata', 'script'
- ]
- sax.EVENTS = [
- 'text',
- 'processinginstruction',
- 'sgmldeclaration',
- 'doctype',
- 'comment',
- 'opentagstart',
- 'attribute',
- 'opentag',
- 'closetag',
- 'opencdata',
- 'cdata',
- 'closecdata',
- 'error',
- 'end',
- 'ready',
- 'script',
- 'opennamespace',
- 'closenamespace'
- ]
- function SAXParser (strict, opt) {
- if (!(this instanceof SAXParser)) {
- return new SAXParser(strict, opt)
- }
- var parser = this
- clearBuffers(parser)
- parser.q = parser.c = ''
- parser.bufferCheckPosition = sax.MAX_BUFFER_LENGTH
- parser.opt = opt || {}
- parser.opt.lowercase = parser.opt.lowercase || parser.opt.lowercasetags
- parser.looseCase = parser.opt.lowercase ? 'toLowerCase' : 'toUpperCase'
- parser.tags = []
- parser.closed = parser.closedRoot = parser.sawRoot = false
- parser.tag = parser.error = null
- parser.strict = !!strict
- parser.noscript = !!(strict || parser.opt.noscript)
- parser.state = S.BEGIN
- parser.strictEntities = parser.opt.strictEntities
- parser.ENTITIES = parser.strictEntities ? Object.create(sax.XML_ENTITIES) : Object.create(sax.ENTITIES)
- parser.attribList = []
- // namespaces form a prototype chain.
- // it always points at the current tag,
- // which protos to its parent tag.
- if (parser.opt.xmlns) {
- parser.ns = Object.create(rootNS)
- }
- // mostly just for error reporting
- parser.trackPosition = parser.opt.position !== false
- if (parser.trackPosition) {
- parser.position = parser.line = parser.column = 0
- }
- emit(parser, 'onready')
- }
- if (!Object.create) {
- Object.create = function (o) {
- function F () {}
- F.prototype = o
- var newf = new F()
- return newf
- }
- }
- if (!Object.keys) {
- Object.keys = function (o) {
- var a = []
- for (var i in o) if (o.hasOwnProperty(i)) a.push(i)
- return a
- }
- }
- function checkBufferLength (parser) {
- var maxAllowed = Math.max(sax.MAX_BUFFER_LENGTH, 10)
- var maxActual = 0
- for (var i = 0, l = buffers.length; i < l; i++) {
- var len = parser[buffers[i]].length
- if (len > maxAllowed) {
- // Text/cdata nodes can get big, and since they're buffered,
- // we can get here under normal conditions.
- // Avoid issues by emitting the text node now,
- // so at least it won't get any bigger.
- switch (buffers[i]) {
- case 'textNode':
- closeText(parser)
- break
- case 'cdata':
- emitNode(parser, 'oncdata', parser.cdata)
- parser.cdata = ''
- break
- case 'script':
- emitNode(parser, 'onscript', parser.script)
- parser.script = ''
- break
- default:
- error(parser, 'Max buffer length exceeded: ' + buffers[i])
- }
- }
- maxActual = Math.max(maxActual, len)
- }
- // schedule the next check for the earliest possible buffer overrun.
- var m = sax.MAX_BUFFER_LENGTH - maxActual
- parser.bufferCheckPosition = m + parser.position
- }
- function clearBuffers (parser) {
- for (var i = 0, l = buffers.length; i < l; i++) {
- parser[buffers[i]] = ''
- }
- }
- function flushBuffers (parser) {
- closeText(parser)
- if (parser.cdata !== '') {
- emitNode(parser, 'oncdata', parser.cdata)
- parser.cdata = ''
- }
- if (parser.script !== '') {
- emitNode(parser, 'onscript', parser.script)
- parser.script = ''
- }
- }
- SAXParser.prototype = {
- end: function () { end(this) },
- write: write,
- resume: function () { this.error = null; return this },
- close: function () { return this.write(null) },
- flush: function () { flushBuffers(this) }
- }
- var Stream
- try {
- Stream = require('stream').Stream
- } catch (ex) {
- Stream = function () {}
- }
- var streamWraps = sax.EVENTS.filter(function (ev) {
- return ev !== 'error' && ev !== 'end'
- })
- function createStream (strict, opt) {
- return new SAXStream(strict, opt)
- }
- function SAXStream (strict, opt) {
- if (!(this instanceof SAXStream)) {
- return new SAXStream(strict, opt)
- }
- Stream.apply(this)
- this._parser = new SAXParser(strict, opt)
- this.writable = true
- this.readable = true
- var me = this
- this._parser.onend = function () {
- me.emit('end')
- }
- this._parser.onerror = function (er) {
- me.emit('error', er)
- // if didn't throw, then means error was handled.
- // go ahead and clear error, so we can write again.
- me._parser.error = null
- }
- this._decoder = null
- streamWraps.forEach(function (ev) {
- Object.defineProperty(me, 'on' + ev, {
- get: function () {
- return me._parser['on' + ev]
- },
- set: function (h) {
- if (!h) {
- me.removeAllListeners(ev)
- me._parser['on' + ev] = h
- return h
- }
- me.on(ev, h)
- },
- enumerable: true,
- configurable: false
- })
- })
- }
- SAXStream.prototype = Object.create(Stream.prototype, {
- constructor: {
- value: SAXStream
- }
- })
- SAXStream.prototype.write = function (data) {
- if (typeof Buffer === 'function' &&
- typeof Buffer.isBuffer === 'function' &&
- Buffer.isBuffer(data)) {
- if (!this._decoder) {
- var SD = require('string_decoder').StringDecoder
- this._decoder = new SD('utf8')
- }
- data = this._decoder.write(data)
- }
- this._parser.write(data.toString())
- this.emit('data', data)
- return true
- }
- SAXStream.prototype.end = function (chunk) {
- if (chunk && chunk.length) {
- this.write(chunk)
- }
- this._parser.end()
- return true
- }
- SAXStream.prototype.on = function (ev, handler) {
- var me = this
- if (!me._parser['on' + ev] && streamWraps.indexOf(ev) !== -1) {
- me._parser['on' + ev] = function () {
- var args = arguments.length === 1 ? [arguments[0]] : Array.apply(null, arguments)
- args.splice(0, 0, ev)
- me.emit.apply(me, args)
- }
- }
- return Stream.prototype.on.call(me, ev, handler)
- }
- // this really needs to be replaced with character classes.
- // XML allows all manner of ridiculous numbers and digits.
- var CDATA = '[CDATA['
- var DOCTYPE = 'DOCTYPE'
- var XML_NAMESPACE = 'http://www.w3.org/XML/1998/namespace'
- var XMLNS_NAMESPACE = 'http://www.w3.org/2000/xmlns/'
- var rootNS = { xml: XML_NAMESPACE, xmlns: XMLNS_NAMESPACE }
- // http://www.w3.org/TR/REC-xml/#NT-NameStartChar
- // This implementation works on strings, a single character at a time
- // as such, it cannot ever support astral-plane characters (10000-EFFFF)
- // without a significant breaking change to either this parser, or the
- // JavaScript language. Implementation of an emoji-capable xml parser
- // is left as an exercise for the reader.
- 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]/
- 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-]/
- 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]/
- 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-]/
- function isWhitespace (c) {
- return c === ' ' || c === '\n' || c === '\r' || c === '\t'
- }
- function isQuote (c) {
- return c === '"' || c === '\''
- }
- function isAttribEnd (c) {
- return c === '>' || isWhitespace(c)
- }
- function isMatch (regex, c) {
- return regex.test(c)
- }
- function notMatch (regex, c) {
- return !isMatch(regex, c)
- }
- var S = 0
- sax.STATE = {
- BEGIN: S++, // leading byte order mark or whitespace
- BEGIN_WHITESPACE: S++, // leading whitespace
- TEXT: S++, // general stuff
- TEXT_ENTITY: S++, // & and such.
- OPEN_WAKA: S++, // <
- SGML_DECL: S++, // <!BLARG
- SGML_DECL_QUOTED: S++, // <!BLARG foo "bar
- DOCTYPE: S++, // <!DOCTYPE
- DOCTYPE_QUOTED: S++, // <!DOCTYPE "//blah
- DOCTYPE_DTD: S++, // <!DOCTYPE "//blah" [ ...
- DOCTYPE_DTD_QUOTED: S++, // <!DOCTYPE "//blah" [ "foo
- COMMENT_STARTING: S++, // <!-
- COMMENT: S++, // <!--
- COMMENT_ENDING: S++, // <!-- blah -
- COMMENT_ENDED: S++, // <!-- blah --
- CDATA: S++, // <![CDATA[ something
- CDATA_ENDING: S++, // ]
- CDATA_ENDING_2: S++, // ]]
- PROC_INST: S++, // <?hi
- PROC_INST_BODY: S++, // <?hi there
- PROC_INST_ENDING: S++, // <?hi "there" ?
- OPEN_TAG: S++, // <strong
- OPEN_TAG_SLASH: S++, // <strong /
- ATTRIB: S++, // <a
- ATTRIB_NAME: S++, // <a foo
- ATTRIB_NAME_SAW_WHITE: S++, // <a foo _
- ATTRIB_VALUE: S++, // <a foo=
- ATTRIB_VALUE_QUOTED: S++, // <a foo="bar
- ATTRIB_VALUE_CLOSED: S++, // <a foo="bar"
- ATTRIB_VALUE_UNQUOTED: S++, // <a foo=bar
- ATTRIB_VALUE_ENTITY_Q: S++, // <foo bar="""
- ATTRIB_VALUE_ENTITY_U: S++, // <foo bar="
- CLOSE_TAG: S++, // </a
- CLOSE_TAG_SAW_WHITE: S++, // </a >
- SCRIPT: S++, // <script> ...
- SCRIPT_ENDING: S++ // <script> ... <
- }
- sax.XML_ENTITIES = {
- 'amp': '&',
- 'gt': '>',
- 'lt': '<',
- 'quot': '"',
- 'apos': "'"
- }
- sax.ENTITIES = {
- 'amp': '&',
- 'gt': '>',
- 'lt': '<',
- 'quot': '"',
- 'apos': "'",
- 'AElig': 198,
- 'Aacute': 193,
- 'Acirc': 194,
- 'Agrave': 192,
- 'Aring': 197,
- 'Atilde': 195,
- 'Auml': 196,
- 'Ccedil': 199,
- 'ETH': 208,
- 'Eacute': 201,
- 'Ecirc': 202,
- 'Egrave': 200,
- 'Euml': 203,
- 'Iacute': 205,
- 'Icirc': 206,
- 'Igrave': 204,
- 'Iuml': 207,
- 'Ntilde': 209,
- 'Oacute': 211,
- 'Ocirc': 212,
- 'Ograve': 210,
- 'Oslash': 216,
- 'Otilde': 213,
- 'Ouml': 214,
- 'THORN': 222,
- 'Uacute': 218,
- 'Ucirc': 219,
- 'Ugrave': 217,
- 'Uuml': 220,
- 'Yacute': 221,
- 'aacute': 225,
- 'acirc': 226,
- 'aelig': 230,
- 'agrave': 224,
- 'aring': 229,
- 'atilde': 227,
- 'auml': 228,
- 'ccedil': 231,
- 'eacute': 233,
- 'ecirc': 234,
- 'egrave': 232,
- 'eth': 240,
- 'euml': 235,
- 'iacute': 237,
- 'icirc': 238,
- 'igrave': 236,
- 'iuml': 239,
- 'ntilde': 241,
- 'oacute': 243,
- 'ocirc': 244,
- 'ograve': 242,
- 'oslash': 248,
- 'otilde': 245,
- 'ouml': 246,
- 'szlig': 223,
- 'thorn': 254,
- 'uacute': 250,
- 'ucirc': 251,
- 'ugrave': 249,
- 'uuml': 252,
- 'yacute': 253,
- 'yuml': 255,
- 'copy': 169,
- 'reg': 174,
- 'nbsp': 160,
- 'iexcl': 161,
- 'cent': 162,
- 'pound': 163,
- 'curren': 164,
- 'yen': 165,
- 'brvbar': 166,
- 'sect': 167,
- 'uml': 168,
- 'ordf': 170,
- 'laquo': 171,
- 'not': 172,
- 'shy': 173,
- 'macr': 175,
- 'deg': 176,
- 'plusmn': 177,
- 'sup1': 185,
- 'sup2': 178,
- 'sup3': 179,
- 'acute': 180,
- 'micro': 181,
- 'para': 182,
- 'middot': 183,
- 'cedil': 184,
- 'ordm': 186,
- 'raquo': 187,
- 'frac14': 188,
- 'frac12': 189,
- 'frac34': 190,
- 'iquest': 191,
- 'times': 215,
- 'divide': 247,
- 'OElig': 338,
- 'oelig': 339,
- 'Scaron': 352,
- 'scaron': 353,
- 'Yuml': 376,
- 'fnof': 402,
- 'circ': 710,
- 'tilde': 732,
- 'Alpha': 913,
- 'Beta': 914,
- 'Gamma': 915,
- 'Delta': 916,
- 'Epsilon': 917,
- 'Zeta': 918,
- 'Eta': 919,
- 'Theta': 920,
- 'Iota': 921,
- 'Kappa': 922,
- 'Lambda': 923,
- 'Mu': 924,
- 'Nu': 925,
- 'Xi': 926,
- 'Omicron': 927,
- 'Pi': 928,
- 'Rho': 929,
- 'Sigma': 931,
- 'Tau': 932,
- 'Upsilon': 933,
- 'Phi': 934,
- 'Chi': 935,
- 'Psi': 936,
- 'Omega': 937,
- 'alpha': 945,
- 'beta': 946,
- 'gamma': 947,
- 'delta': 948,
- 'epsilon': 949,
- 'zeta': 950,
- 'eta': 951,
- 'theta': 952,
- 'iota': 953,
- 'kappa': 954,
- 'lambda': 955,
- 'mu': 956,
- 'nu': 957,
- 'xi': 958,
- 'omicron': 959,
- 'pi': 960,
- 'rho': 961,
- 'sigmaf': 962,
- 'sigma': 963,
- 'tau': 964,
- 'upsilon': 965,
- 'phi': 966,
- 'chi': 967,
- 'psi': 968,
- 'omega': 969,
- 'thetasym': 977,
- 'upsih': 978,
- 'piv': 982,
- 'ensp': 8194,
- 'emsp': 8195,
- 'thinsp': 8201,
- 'zwnj': 8204,
- 'zwj': 8205,
- 'lrm': 8206,
- 'rlm': 8207,
- 'ndash': 8211,
- 'mdash': 8212,
- 'lsquo': 8216,
- 'rsquo': 8217,
- 'sbquo': 8218,
- 'ldquo': 8220,
- 'rdquo': 8221,
- 'bdquo': 8222,
- 'dagger': 8224,
- 'Dagger': 8225,
- 'bull': 8226,
- 'hellip': 8230,
- 'permil': 8240,
- 'prime': 8242,
- 'Prime': 8243,
- 'lsaquo': 8249,
- 'rsaquo': 8250,
- 'oline': 8254,
- 'frasl': 8260,
- 'euro': 8364,
- 'image': 8465,
- 'weierp': 8472,
- 'real': 8476,
- 'trade': 8482,
- 'alefsym': 8501,
- 'larr': 8592,
- 'uarr': 8593,
- 'rarr': 8594,
- 'darr': 8595,
- 'harr': 8596,
- 'crarr': 8629,
- 'lArr': 8656,
- 'uArr': 8657,
- 'rArr': 8658,
- 'dArr': 8659,
- 'hArr': 8660,
- 'forall': 8704,
- 'part': 8706,
- 'exist': 8707,
- 'empty': 8709,
- 'nabla': 8711,
- 'isin': 8712,
- 'notin': 8713,
- 'ni': 8715,
- 'prod': 8719,
- 'sum': 8721,
- 'minus': 8722,
- 'lowast': 8727,
- 'radic': 8730,
- 'prop': 8733,
- 'infin': 8734,
- 'ang': 8736,
- 'and': 8743,
- 'or': 8744,
- 'cap': 8745,
- 'cup': 8746,
- 'int': 8747,
- 'there4': 8756,
- 'sim': 8764,
- 'cong': 8773,
- 'asymp': 8776,
- 'ne': 8800,
- 'equiv': 8801,
- 'le': 8804,
- 'ge': 8805,
- 'sub': 8834,
- 'sup': 8835,
- 'nsub': 8836,
- 'sube': 8838,
- 'supe': 8839,
- 'oplus': 8853,
- 'otimes': 8855,
- 'perp': 8869,
- 'sdot': 8901,
- 'lceil': 8968,
- 'rceil': 8969,
- 'lfloor': 8970,
- 'rfloor': 8971,
- 'lang': 9001,
- 'rang': 9002,
- 'loz': 9674,
- 'spades': 9824,
- 'clubs': 9827,
- 'hearts': 9829,
- 'diams': 9830
- }
- Object.keys(sax.ENTITIES).forEach(function (key) {
- var e = sax.ENTITIES[key]
- var s = typeof e === 'number' ? String.fromCharCode(e) : e
- sax.ENTITIES[key] = s
- })
- for (var s in sax.STATE) {
- sax.STATE[sax.STATE[s]] = s
- }
- // shorthand
- S = sax.STATE
- function emit (parser, event, data) {
- parser[event] && parser[event](data)
- }
- function emitNode (parser, nodeType, data) {
- if (parser.textNode) closeText(parser)
- emit(parser, nodeType, data)
- }
- function closeText (parser) {
- parser.textNode = textopts(parser.opt, parser.textNode)
- if (parser.textNode) emit(parser, 'ontext', parser.textNode)
- parser.textNode = ''
- }
- function textopts (opt, text) {
- if (opt.trim) text = text.trim()
- if (opt.normalize) text = text.replace(/\s+/g, ' ')
- return text
- }
- function error (parser, er) {
- closeText(parser)
- if (parser.trackPosition) {
- er += '\nLine: ' + parser.line +
- '\nColumn: ' + parser.column +
- '\nChar: ' + parser.c
- }
- er = new Error(er)
- parser.error = er
- emit(parser, 'onerror', er)
- return parser
- }
- function end (parser) {
- if (parser.sawRoot && !parser.closedRoot) strictFail(parser, 'Unclosed root tag')
- if ((parser.state !== S.BEGIN) &&
- (parser.state !== S.BEGIN_WHITESPACE) &&
- (parser.state !== S.TEXT)) {
- error(parser, 'Unexpected end')
- }
- closeText(parser)
- parser.c = ''
- parser.closed = true
- emit(parser, 'onend')
- SAXParser.call(parser, parser.strict, parser.opt)
- return parser
- }
- function strictFail (parser, message) {
- if (typeof parser !== 'object' || !(parser instanceof SAXParser)) {
- throw new Error('bad call to strictFail')
- }
- if (parser.strict) {
- error(parser, message)
- }
- }
- function newTag (parser) {
- if (!parser.strict) parser.tagName = parser.tagName[parser.looseCase]()
- var parent = parser.tags[parser.tags.length - 1] || parser
- var tag = parser.tag = { name: parser.tagName, attributes: {} }
- // will be overridden if tag contails an xmlns="foo" or xmlns:foo="bar"
- if (parser.opt.xmlns) {
- tag.ns = parent.ns
- }
- parser.attribList.length = 0
- emitNode(parser, 'onopentagstart', tag)
- }
- function qname (name, attribute) {
- var i = name.indexOf(':')
- var qualName = i < 0 ? [ '', name ] : name.split(':')
- var prefix = qualName[0]
- var local = qualName[1]
- // <x "xmlns"="http://foo">
- if (attribute && name === 'xmlns') {
- prefix = 'xmlns'
- local = ''
- }
- return { prefix: prefix, local: local }
- }
- function attrib (parser) {
- if (!parser.strict) {
- parser.attribName = parser.attribName[parser.looseCase]()
- }
- if (parser.attribList.indexOf(parser.attribName) !== -1 ||
- parser.tag.attributes.hasOwnProperty(parser.attribName)) {
- parser.attribName = parser.attribValue = ''
- return
- }
- if (parser.opt.xmlns) {
- var qn = qname(parser.attribName, true)
- var prefix = qn.prefix
- var local = qn.local
- if (prefix === 'xmlns') {
- // namespace binding attribute. push the binding into scope
- if (local === 'xml' && parser.attribValue !== XML_NAMESPACE) {
- strictFail(parser,
- 'xml: prefix must be bound to ' + XML_NAMESPACE + '\n' +
- 'Actual: ' + parser.attribValue)
- } else if (local === 'xmlns' && parser.attribValue !== XMLNS_NAMESPACE) {
- strictFail(parser,
- 'xmlns: prefix must be bound to ' + XMLNS_NAMESPACE + '\n' +
- 'Actual: ' + parser.attribValue)
- } else {
- var tag = parser.tag
- var parent = parser.tags[parser.tags.length - 1] || parser
- if (tag.ns === parent.ns) {
- tag.ns = Object.create(parent.ns)
- }
- tag.ns[local] = parser.attribValue
- }
- }
- // defer onattribute events until all attributes have been seen
- // so any new bindings can take effect. preserve attribute order
- // so deferred events can be emitted in document order
- parser.attribList.push([parser.attribName, parser.attribValue])
- } else {
- // in non-xmlns mode, we can emit the event right away
- parser.tag.attributes[parser.attribName] = parser.attribValue
- emitNode(parser, 'onattribute', {
- name: parser.attribName,
- value: parser.attribValue
- })
- }
- parser.attribName = parser.attribValue = ''
- }
- function openTag (parser, selfClosing) {
- if (parser.opt.xmlns) {
- // emit namespace binding events
- var tag = parser.tag
- // add namespace info to tag
- var qn = qname(parser.tagName)
- tag.prefix = qn.prefix
- tag.local = qn.local
- tag.uri = tag.ns[qn.prefix] || ''
- if (tag.prefix && !tag.uri) {
- strictFail(parser, 'Unbound namespace prefix: ' +
- JSON.stringify(parser.tagName))
- tag.uri = qn.prefix
- }
- var parent = parser.tags[parser.tags.length - 1] || parser
- if (tag.ns && parent.ns !== tag.ns) {
- Object.keys(tag.ns).forEach(function (p) {
- emitNode(parser, 'onopennamespace', {
- prefix: p,
- uri: tag.ns[p]
- })
- })
- }
- // handle deferred onattribute events
- // Note: do not apply default ns to attributes:
- // http://www.w3.org/TR/REC-xml-names/#defaulting
- for (var i = 0, l = parser.attribList.length; i < l; i++) {
- var nv = parser.attribList[i]
- var name = nv[0]
- var value = nv[1]
- var qualName = qname(name, true)
- var prefix = qualName.prefix
- var local = qualName.local
- var uri = prefix === '' ? '' : (tag.ns[prefix] || '')
- var a = {
- name: name,
- value: value,
- prefix: prefix,
- local: local,
- uri: uri
- }
- // if there's any attributes with an undefined namespace,
- // then fail on them now.
- if (prefix && prefix !== 'xmlns' && !uri) {
- strictFail(parser, 'Unbound namespace prefix: ' +
- JSON.stringify(prefix))
- a.uri = prefix
- }
- parser.tag.attributes[name] = a
- emitNode(parser, 'onattribute', a)
- }
- parser.attribList.length = 0
- }
- parser.tag.isSelfClosing = !!selfClosing
- // process the tag
- parser.sawRoot = true
- parser.tags.push(parser.tag)
- emitNode(parser, 'onopentag', parser.tag)
- if (!selfClosing) {
- // special case for <script> in non-strict mode.
- if (!parser.noscript && parser.tagName.toLowerCase() === 'script') {
- parser.state = S.SCRIPT
- } else {
- parser.state = S.TEXT
- }
- parser.tag = null
- parser.tagName = ''
- }
- parser.attribName = parser.attribValue = ''
- parser.attribList.length = 0
- }
- function closeTag (parser) {
- if (!parser.tagName) {
- strictFail(parser, 'Weird empty close tag.')
- parser.textNode += '</>'
- parser.state = S.TEXT
- return
- }
- if (parser.script) {
- if (parser.tagName !== 'script') {
- parser.script += '</' + parser.tagName + '>'
- parser.tagName = ''
- parser.state = S.SCRIPT
- return
- }
- emitNode(parser, 'onscript', parser.script)
- parser.script = ''
- }
- // first make sure that the closing tag actually exists.
- // <a><b></c></b></a> will close everything, otherwise.
- var t = parser.tags.length
- var tagName = parser.tagName
- if (!parser.strict) {
- tagName = tagName[parser.looseCase]()
- }
- var closeTo = tagName
- while (t--) {
- var close = parser.tags[t]
- if (close.name !== closeTo) {
- // fail the first time in strict mode
- strictFail(parser, 'Unexpected close tag')
- } else {
- break
- }
- }
- // didn't find it. we already failed for strict, so just abort.
- if (t < 0) {
- strictFail(parser, 'Unmatched closing tag: ' + parser.tagName)
- parser.textNode += '</' + parser.tagName + '>'
- parser.state = S.TEXT
- return
- }
- parser.tagName = tagName
- var s = parser.tags.length
- while (s-- > t) {
- var tag = parser.tag = parser.tags.pop()
- parser.tagName = parser.tag.name
- emitNode(parser, 'onclosetag', parser.tagName)
- var x = {}
- for (var i in tag.ns) {
- x[i] = tag.ns[i]
- }
- var parent = parser.tags[parser.tags.length - 1] || parser
- if (parser.opt.xmlns && tag.ns !== parent.ns) {
- // remove namespace bindings introduced by tag
- Object.keys(tag.ns).forEach(function (p) {
- var n = tag.ns[p]
- emitNode(parser, 'onclosenamespace', { prefix: p, uri: n })
- })
- }
- }
- if (t === 0) parser.closedRoot = true
- parser.tagName = parser.attribValue = parser.attribName = ''
- parser.attribList.length = 0
- parser.state = S.TEXT
- }
- function parseEntity (parser) {
- var entity = parser.entity
- var entityLC = entity.toLowerCase()
- var num
- var numStr = ''
- if (parser.ENTITIES[entity]) {
- return parser.ENTITIES[entity]
- }
- if (parser.ENTITIES[entityLC]) {
- return parser.ENTITIES[entityLC]
- }
- entity = entityLC
- if (entity.charAt(0) === '#') {
- if (entity.charAt(1) === 'x') {
- entity = entity.slice(2)
- num = parseInt(entity, 16)
- numStr = num.toString(16)
- } else {
- entity = entity.slice(1)
- num = parseInt(entity, 10)
- numStr = num.toString(10)
- }
- }
- entity = entity.replace(/^0+/, '')
- if (isNaN(num) || numStr.toLowerCase() !== entity) {
- strictFail(parser, 'Invalid character entity')
- return '&' + parser.entity + ';'
- }
- return String.fromCodePoint(num)
- }
- function beginWhiteSpace (parser, c) {
- if (c === '<') {
- parser.state = S.OPEN_WAKA
- parser.startTagPosition = parser.position
- } else if (!isWhitespace(c)) {
- // have to process this as a text node.
- // weird, but happens.
- strictFail(parser, 'Non-whitespace before first tag.')
- parser.textNode = c
- parser.state = S.TEXT
- }
- }
- function charAt (chunk, i) {
- var result = ''
- if (i < chunk.length) {
- result = chunk.charAt(i)
- }
- return result
- }
- function write (chunk) {
- var parser = this
- if (this.error) {
- throw this.error
- }
- if (parser.closed) {
- return error(parser,
- 'Cannot write after close. Assign an onready handler.')
- }
- if (chunk === null) {
- return end(parser)
- }
- if (typeof chunk === 'object') {
- chunk = chunk.toString()
- }
- var i = 0
- var c = ''
- while (true) {
- c = charAt(chunk, i++)
- parser.c = c
- if (!c) {
- break
- }
- if (parser.trackPosition) {
- parser.position++
- if (c === '\n') {
- parser.line++
- parser.column = 0
- } else {
- parser.column++
- }
- }
- switch (parser.state) {
- case S.BEGIN:
- parser.state = S.BEGIN_WHITESPACE
- if (c === '\uFEFF') {
- continue
- }
- beginWhiteSpace(parser, c)
- continue
- case S.BEGIN_WHITESPACE:
- beginWhiteSpace(parser, c)
- continue
- case S.TEXT:
- if (parser.sawRoot && !parser.closedRoot) {
- var starti = i - 1
- while (c && c !== '<' && c !== '&') {
- c = charAt(chunk, i++)
- if (c && parser.trackPosition) {
- parser.position++
- if (c === '\n') {
- parser.line++
- parser.column = 0
- } else {
- parser.column++
- }
- }
- }
- parser.textNode += chunk.substring(starti, i - 1)
- }
- if (c === '<' && !(parser.sawRoot && parser.closedRoot && !parser.strict)) {
- parser.state = S.OPEN_WAKA
- parser.startTagPosition = parser.position
- } else {
- if (!isWhitespace(c) && (!parser.sawRoot || parser.closedRoot)) {
- strictFail(parser, 'Text data outside of root node.')
- }
- if (c === '&') {
- parser.state = S.TEXT_ENTITY
- } else {
- parser.textNode += c
- }
- }
- continue
- case S.SCRIPT:
- // only non-strict
- if (c === '<') {
- parser.state = S.SCRIPT_ENDING
- } else {
- parser.script += c
- }
- continue
- case S.SCRIPT_ENDING:
- if (c === '/') {
- parser.state = S.CLOSE_TAG
- } else {
- parser.script += '<' + c
- parser.state = S.SCRIPT
- }
- continue
- case S.OPEN_WAKA:
- // either a /, ?, !, or text is coming next.
- if (c === '!') {
- parser.state = S.SGML_DECL
- parser.sgmlDecl = ''
- } else if (isWhitespace(c)) {
- // wait for it...
- } else if (isMatch(nameStart, c)) {
- parser.state = S.OPEN_TAG
- parser.tagName = c
- } else if (c === '/') {
- parser.state = S.CLOSE_TAG
- parser.tagName = ''
- } else if (c === '?') {
- parser.state = S.PROC_INST
- parser.procInstName = parser.procInstBody = ''
- } else {
- strictFail(parser, 'Unencoded <')
- // if there was some whitespace, then add that in.
- if (parser.startTagPosition + 1 < parser.position) {
- var pad = parser.position - parser.startTagPosition
- c = new Array(pad).join(' ') + c
- }
- parser.textNode += '<' + c
- parser.state = S.TEXT
- }
- continue
- case S.SGML_DECL:
- if ((parser.sgmlDecl + c).toUpperCase() === CDATA) {
- emitNode(parser, 'onopencdata')
- parser.state = S.CDATA
- parser.sgmlDecl = ''
- parser.cdata = ''
- } else if (parser.sgmlDecl + c === '--') {
- parser.state = S.COMMENT
- parser.comment = ''
- parser.sgmlDecl = ''
- } else if ((parser.sgmlDecl + c).toUpperCase() === DOCTYPE) {
- parser.state = S.DOCTYPE
- if (parser.doctype || parser.sawRoot) {
- strictFail(parser,
- 'Inappropriately located doctype declaration')
- }
- parser.doctype = ''
- parser.sgmlDecl = ''
- } else if (c === '>') {
- emitNode(parser, 'onsgmldeclaration', parser.sgmlDecl)
- parser.sgmlDecl = ''
- parser.state = S.TEXT
- } else if (isQuote(c)) {
- parser.state = S.SGML_DECL_QUOTED
- parser.sgmlDecl += c
- } else {
- parser.sgmlDecl += c
- }
- continue
- case S.SGML_DECL_QUOTED:
- if (c === parser.q) {
- parser.state = S.SGML_DECL
- parser.q = ''
- }
- parser.sgmlDecl += c
- continue
- case S.DOCTYPE:
- if (c === '>') {
- parser.state = S.TEXT
- emitNode(parser, 'ondoctype', parser.doctype)
- parser.doctype = true // just remember that we saw it.
- } else {
- parser.doctype += c
- if (c === '[') {
- parser.state = S.DOCTYPE_DTD
- } else if (isQuote(c)) {
- parser.state = S.DOCTYPE_QUOTED
- parser.q = c
- }
- }
- continue
- case S.DOCTYPE_QUOTED:
- parser.doctype += c
- if (c === parser.q) {
- parser.q = ''
- parser.state = S.DOCTYPE
- }
- continue
- case S.DOCTYPE_DTD:
- parser.doctype += c
- if (c === ']') {
- parser.state = S.DOCTYPE
- } else if (isQuote(c)) {
- parser.state = S.DOCTYPE_DTD_QUOTED
- parser.q = c
- }
- continue
- case S.DOCTYPE_DTD_QUOTED:
- parser.doctype += c
- if (c === parser.q) {
- parser.state = S.DOCTYPE_DTD
- parser.q = ''
- }
- continue
- case S.COMMENT:
- if (c === '-') {
- parser.state = S.COMMENT_ENDING
- } else {
- parser.comment += c
- }
- continue
- case S.COMMENT_ENDING:
- if (c === '-') {
- parser.state = S.COMMENT_ENDED
- parser.comment = textopts(parser.opt, parser.comment)
- if (parser.comment) {
- emitNode(parser, 'oncomment', parser.comment)
- }
- parser.comment = ''
- } else {
- parser.comment += '-' + c
- parser.state = S.COMMENT
- }
- continue
- case S.COMMENT_ENDED:
- if (c !== '>') {
- strictFail(parser, 'Malformed comment')
- // allow <!-- blah -- bloo --> in non-strict mode,
- // which is a comment of " blah -- bloo "
- parser.comment += '--' + c
- parser.state = S.COMMENT
- } else {
- parser.state = S.TEXT
- }
- continue
- case S.CDATA:
- if (c === ']') {
- parser.state = S.CDATA_ENDING
- } else {
- parser.cdata += c
- }
- continue
- case S.CDATA_ENDING:
- if (c === ']') {
- parser.state = S.CDATA_ENDING_2
- } else {
- parser.cdata += ']' + c
- parser.state = S.CDATA
- }
- continue
- case S.CDATA_ENDING_2:
- if (c === '>') {
- if (parser.cdata) {
- emitNode(parser, 'oncdata', parser.cdata)
- }
- emitNode(parser, 'onclosecdata')
- parser.cdata = ''
- parser.state = S.TEXT
- } else if (c === ']') {
- parser.cdata += ']'
- } else {
- parser.cdata += ']]' + c
- parser.state = S.CDATA
- }
- continue
- case S.PROC_INST:
- if (c === '?') {
- parser.state = S.PROC_INST_ENDING
- } else if (isWhitespace(c)) {
- parser.state = S.PROC_INST_BODY
- } else {
- parser.procInstName += c
- }
- continue
- case S.PROC_INST_BODY:
- if (!parser.procInstBody && isWhitespace(c)) {
- continue
- } else if (c === '?') {
- parser.state = S.PROC_INST_ENDING
- } else {
- parser.procInstBody += c
- }
- continue
- case S.PROC_INST_ENDING:
- if (c === '>') {
- emitNode(parser, 'onprocessinginstruction', {
- name: parser.procInstName,
- body: parser.procInstBody
- })
- parser.procInstName = parser.procInstBody = ''
- parser.state = S.TEXT
- } else {
- parser.procInstBody += '?' + c
- parser.state = S.PROC_INST_BODY
- }
- continue
- case S.OPEN_TAG:
- if (isMatch(nameBody, c)) {
- parser.tagName += c
- } else {
- newTag(parser)
- if (c === '>') {
- openTag(parser)
- } else if (c === '/') {
- parser.state = S.OPEN_TAG_SLASH
- } else {
- if (!isWhitespace(c)) {
- strictFail(parser, 'Invalid character in tag name')
- }
- parser.state = S.ATTRIB
- }
- }
- continue
- case S.OPEN_TAG_SLASH:
- if (c === '>') {
- openTag(parser, true)
- closeTag(parser)
- } else {
- strictFail(parser, 'Forward-slash in opening tag not followed by >')
- parser.state = S.ATTRIB
- }
- continue
- case S.ATTRIB:
- // haven't read the attribute name yet.
- if (isWhitespace(c)) {
- continue
- } else if (c === '>') {
- openTag(parser)
- } else if (c === '/') {
- parser.state = S.OPEN_TAG_SLASH
- } else if (isMatch(nameStart, c)) {
- parser.attribName = c
- parser.attribValue = ''
- parser.state = S.ATTRIB_NAME
- } else {
- strictFail(parser, 'Invalid attribute name')
- }
- continue
- case S.ATTRIB_NAME:
- if (c === '=') {
- parser.state = S.ATTRIB_VALUE
- } else if (c === '>') {
- strictFail(parser, 'Attribute without value')
- parser.attribValue = parser.attribName
- attrib(parser)
- openTag(parser)
- } else if (isWhitespace(c)) {
- parser.state = S.ATTRIB_NAME_SAW_WHITE
- } else if (isMatch(nameBody, c)) {
- parser.attribName += c
- } else {
- strictFail(parser, 'Invalid attribute name')
- }
- continue
- case S.ATTRIB_NAME_SAW_WHITE:
- if (c === '=') {
- parser.state = S.ATTRIB_VALUE
- } else if (isWhitespace(c)) {
- continue
- } else {
- strictFail(parser, 'Attribute without value')
- parser.tag.attributes[parser.attribName] = ''
- parser.attribValue = ''
- emitNode(parser, 'onattribute', {
- name: parser.attribName,
- value: ''
- })
- parser.attribName = ''
- if (c === '>') {
- openTag(parser)
- } else if (isMatch(nameStart, c)) {
- parser.attribName = c
- parser.state = S.ATTRIB_NAME
- } else {
- strictFail(parser, 'Invalid attribute name')
- parser.state = S.ATTRIB
- }
- }
- continue
- case S.ATTRIB_VALUE:
- if (isWhitespace(c)) {
- continue
- } else if (isQuote(c)) {
- parser.q = c
- parser.state = S.ATTRIB_VALUE_QUOTED
- } else {
- strictFail(parser, 'Unquoted attribute value')
- parser.state = S.ATTRIB_VALUE_UNQUOTED
- parser.attribValue = c
- }
- continue
- case S.ATTRIB_VALUE_QUOTED:
- if (c !== parser.q) {
- if (c === '&') {
- parser.state = S.ATTRIB_VALUE_ENTITY_Q
- } else {
- parser.attribValue += c
- }
- continue
- }
- attrib(parser)
- parser.q = ''
- parser.state = S.ATTRIB_VALUE_CLOSED
- continue
- case S.ATTRIB_VALUE_CLOSED:
- if (isWhitespace(c)) {
- parser.state = S.ATTRIB
- } else if (c === '>') {
- openTag(parser)
- } else if (c === '/') {
- parser.state = S.OPEN_TAG_SLASH
- } else if (isMatch(nameStart, c)) {
- strictFail(parser, 'No whitespace between attributes')
- parser.attribName = c
- parser.attribValue = ''
- parser.state = S.ATTRIB_NAME
- } else {
- strictFail(parser, 'Invalid attribute name')
- }
- continue
- case S.ATTRIB_VALUE_UNQUOTED:
- if (!isAttribEnd(c)) {
- if (c === '&') {
- parser.state = S.ATTRIB_VALUE_ENTITY_U
- } else {
- parser.attribValue += c
- }
- continue
- }
- attrib(parser)
- if (c === '>') {
- openTag(parser)
- } else {
- parser.state = S.ATTRIB
- }
- continue
- case S.CLOSE_TAG:
- if (!parser.tagName) {
- if (isWhitespace(c)) {
- continue
- } else if (notMatch(nameStart, c)) {
- if (parser.script) {
- parser.script += '</' + c
- parser.state = S.SCRIPT
- } else {
- strictFail(parser, 'Invalid tagname in closing tag.')
- }
- } else {
- parser.tagName = c
- }
- } else if (c === '>') {
- closeTag(parser)
- } else if (isMatch(nameBody, c)) {
- parser.tagName += c
- } else if (parser.script) {
- parser.script += '</' + parser.tagName
- parser.tagName = ''
- parser.state = S.SCRIPT
- } else {
- if (!isWhitespace(c)) {
- strictFail(parser, 'Invalid tagname in closing tag')
- }
- parser.state = S.CLOSE_TAG_SAW_WHITE
- }
- continue
- case S.CLOSE_TAG_SAW_WHITE:
- if (isWhitespace(c)) {
- continue
- }
- if (c === '>') {
- closeTag(parser)
- } else {
- strictFail(parser, 'Invalid characters in closing tag')
- }
- continue
- case S.TEXT_ENTITY:
- case S.ATTRIB_VALUE_ENTITY_Q:
- case S.ATTRIB_VALUE_ENTITY_U:
- var returnState
- var buffer
- switch (parser.state) {
- case S.TEXT_ENTITY:
- returnState = S.TEXT
- buffer = 'textNode'
- break
- case S.ATTRIB_VALUE_ENTITY_Q:
- returnState = S.ATTRIB_VALUE_QUOTED
- buffer = 'attribValue'
- break
- case S.ATTRIB_VALUE_ENTITY_U:
- returnState = S.ATTRIB_VALUE_UNQUOTED
- buffer = 'attribValue'
- break
- }
- if (c === ';') {
- parser[buffer] += parseEntity(parser)
- parser.entity = ''
- parser.state = returnState
- } else if (isMatch(parser.entity.length ? entityBody : entityStart, c)) {
- parser.entity += c
- } else {
- strictFail(parser, 'Invalid character in entity name')
- parser[buffer] += '&' + parser.entity + c
- parser.entity = ''
- parser.state = returnState
- }
- continue
- default:
- throw new Error(parser, 'Unknown state: ' + parser.state)
- }
- } // while
- if (parser.position >= parser.bufferCheckPosition) {
- checkBufferLength(parser)
- }
- return parser
- }
- /*! http://mths.be/fromcodepoint v0.1.0 by @mathias */
- /* istanbul ignore next */
- if (!String.fromCodePoint) {
- (function () {
- var stringFromCharCode = String.fromCharCode
- var floor = Math.floor
- var fromCodePoint = function () {
- var MAX_SIZE = 0x4000
- var codeUnits = []
- var highSurrogate
- var lowSurrogate
- var index = -1
- var length = arguments.length
- if (!length) {
- return ''
- }
- var result = ''
- while (++index < length) {
- var codePoint = Number(arguments[index])
- if (
- !isFinite(codePoint) || // `NaN`, `+Infinity`, or `-Infinity`
- codePoint < 0 || // not a valid Unicode code point
- codePoint > 0x10FFFF || // not a valid Unicode code point
- floor(codePoint) !== codePoint // not an integer
- ) {
- throw RangeError('Invalid code point: ' + codePoint)
- }
- if (codePoint <= 0xFFFF) { // BMP code point
- codeUnits.push(codePoint)
- } else { // Astral code point; split in surrogate halves
- // http://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae
- codePoint -= 0x10000
- highSurrogate = (codePoint >> 10) + 0xD800
- lowSurrogate = (codePoint % 0x400) + 0xDC00
- codeUnits.push(highSurrogate, lowSurrogate)
- }
- if (index + 1 === length || codeUnits.length > MAX_SIZE) {
- result += stringFromCharCode.apply(null, codeUnits)
- codeUnits.length = 0
- }
- }
- return result
- }
- /* istanbul ignore next */
- if (Object.defineProperty) {
- Object.defineProperty(String, 'fromCodePoint', {
- value: fromCodePoint,
- configurable: true,
- writable: true
- })
- } else {
- String.fromCodePoint = fromCodePoint
- }
- }())
- }
- })(typeof exports === 'undefined' ? this.sax = {} : exports)
- }).call(this)}).call(this,require("buffer").Buffer)
- },{"buffer":85,"stream":345,"string_decoder":86}],345:[function(require,module,exports){
- // Copyright Joyent, Inc. and other Node contributors.
- //
- // Permission is hereby granted, free of charge, to any person obtaining a
- // copy of this software and associated documentation files (the
- // "Software"), to deal in the Software without restriction, including
- // without limitation the rights to use, copy, modify, merge, publish,
- // distribute, sublicense, and/or sell copies of the Software, and to permit
- // persons to whom the Software is furnished to do so, subject to the
- // following conditions:
- //
- // The above copyright notice and this permission notice shall be included
- // in all copies or substantial portions of the Software.
- //
- // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
- // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
- // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
- // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
- // USE OR OTHER DEALINGS IN THE SOFTWARE.
- module.exports = Stream;
- var EE = require('events').EventEmitter;
- var inherits = require('inherits');
- inherits(Stream, EE);
- Stream.Readable = require('readable-stream/readable.js');
- Stream.Writable = require('readable-stream/writable.js');
- Stream.Duplex = require('readable-stream/duplex.js');
- Stream.Transform = require('readable-stream/transform.js');
- Stream.PassThrough = require('readable-stream/passthrough.js');
- // Backwards-compat with node 0.4.x
- Stream.Stream = Stream;
- // old-style streams. Note that the pipe method (the only relevant
- // part of this class) is overridden in the Readable class.
- function Stream() {
- EE.call(this);
- }
- Stream.prototype.pipe = function(dest, options) {
- var source = this;
- function ondata(chunk) {
- if (dest.writable) {
- if (false === dest.write(chunk) && source.pause) {
- source.pause();
- }
- }
- }
- source.on('data', ondata);
- function ondrain() {
- if (source.readable && source.resume) {
- source.resume();
- }
- }
- dest.on('drain', ondrain);
- // If the 'end' option is not supplied, dest.end() will be called when
- // source gets the 'end' or 'close' events. Only dest.end() once.
- if (!dest._isStdio && (!options || options.end !== false)) {
- source.on('end', onend);
- source.on('close', onclose);
- }
- var didOnEnd = false;
- function onend() {
- if (didOnEnd) return;
- didOnEnd = true;
- dest.end();
- }
- function onclose() {
- if (didOnEnd) return;
- didOnEnd = true;
- if (typeof dest.destroy === 'function') dest.destroy();
- }
- // don't leave dangling pipes when there are errors.
- function onerror(er) {
- cleanup();
- if (EE.listenerCount(this, 'error') === 0) {
- throw er; // Unhandled stream error in pipe.
- }
- }
- source.on('error', onerror);
- dest.on('error', onerror);
- // remove all the event listeners that were added.
- function cleanup() {
- source.removeListener('data', ondata);
- dest.removeListener('drain', ondrain);
- source.removeListener('end', onend);
- source.removeListener('close', onclose);
- source.removeListener('error', onerror);
- dest.removeListener('error', onerror);
- source.removeListener('end', cleanup);
- source.removeListener('close', cleanup);
- dest.removeListener('close', cleanup);
- }
- source.on('end', cleanup);
- source.on('close', cleanup);
- dest.on('close', cleanup);
- dest.emit('pipe', source);
- // Allow for unix-like usage: A.pipe(B).pipe(C)
- return dest;
- };
- },{"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){
- // Copyright Joyent, Inc. and other Node contributors.
- //
- // Permission is hereby granted, free of charge, to any person obtaining a
- // copy of this software and associated documentation files (the
- // "Software"), to deal in the Software without restriction, including
- // without limitation the rights to use, copy, modify, merge, publish,
- // distribute, sublicense, and/or sell copies of the Software, and to permit
- // persons to whom the Software is furnished to do so, subject to the
- // following conditions:
- //
- // The above copyright notice and this permission notice shall be included
- // in all copies or substantial portions of the Software.
- //
- // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
- // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
- // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
- // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
- // USE OR OTHER DEALINGS IN THE SOFTWARE.
- 'use strict';
- /*<replacement>*/
- var Buffer = require('safe-buffer').Buffer;
- /*</replacement>*/
- var isEncoding = Buffer.isEncoding || function (encoding) {
- encoding = '' + encoding;
- switch (encoding && encoding.toLowerCase()) {
- 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;
- default:
- return false;
- }
- };
- function _normalizeEncoding(enc) {
- if (!enc) return 'utf8';
- var retried;
- while (true) {
- switch (enc) {
- case 'utf8':
- case 'utf-8':
- return 'utf8';
- case 'ucs2':
- case 'ucs-2':
- case 'utf16le':
- case 'utf-16le':
- return 'utf16le';
- case 'latin1':
- case 'binary':
- return 'latin1';
- case 'base64':
- case 'ascii':
- case 'hex':
- return enc;
- default:
- if (retried) return; // undefined
- enc = ('' + enc).toLowerCase();
- retried = true;
- }
- }
- };
- // Do not cache `Buffer.isEncoding` when checking encoding names as some
- // modules monkey-patch it to support additional encodings
- function normalizeEncoding(enc) {
- var nenc = _normalizeEncoding(enc);
- if (typeof nenc !== 'string' && (Buffer.isEncoding === isEncoding || !isEncoding(enc))) throw new Error('Unknown encoding: ' + enc);
- return nenc || enc;
- }
- // StringDecoder provides an interface for efficiently splitting a series of
- // buffers into a series of JS strings without breaking apart multi-byte
- // characters.
- exports.StringDecoder = StringDecoder;
- function StringDecoder(encoding) {
- this.encoding = normalizeEncoding(encoding);
- var nb;
- switch (this.encoding) {
- case 'utf16le':
- this.text = utf16Text;
- this.end = utf16End;
- nb = 4;
- break;
- case 'utf8':
- this.fillLast = utf8FillLast;
- nb = 4;
- break;
- case 'base64':
- this.text = base64Text;
- this.end = base64End;
- nb = 3;
- break;
- default:
- this.write = simpleWrite;
- this.end = simpleEnd;
- return;
- }
- this.lastNeed = 0;
- this.lastTotal = 0;
- this.lastChar = Buffer.allocUnsafe(nb);
- }
- StringDecoder.prototype.write = function (buf) {
- if (buf.length === 0) return '';
- var r;
- var i;
- if (this.lastNeed) {
- r = this.fillLast(buf);
- if (r === undefined) return '';
- i = this.lastNeed;
- this.lastNeed = 0;
- } else {
- i = 0;
- }
- if (i < buf.length) return r ? r + this.text(buf, i) : this.text(buf, i);
- return r || '';
- };
- StringDecoder.prototype.end = utf8End;
- // Returns only complete characters in a Buffer
- StringDecoder.prototype.text = utf8Text;
- // Attempts to complete a partial non-UTF-8 character using bytes from a Buffer
- StringDecoder.prototype.fillLast = function (buf) {
- if (this.lastNeed <= buf.length) {
- buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, this.lastNeed);
- return this.lastChar.toString(this.encoding, 0, this.lastTotal);
- }
- buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, buf.length);
- this.lastNeed -= buf.length;
- };
- // Checks the type of a UTF-8 byte, whether it's ASCII, a leading byte, or a
- // continuation byte. If an invalid byte is detected, -2 is returned.
- function utf8CheckByte(byte) {
- 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;
- return byte >> 6 === 0x02 ? -1 : -2;
- }
- // Checks at most 3 bytes at the end of a Buffer in order to detect an
- // incomplete multi-byte UTF-8 character. The total number of bytes (2, 3, or 4)
- // needed to complete the UTF-8 character (if applicable) are returned.
- function utf8CheckIncomplete(self, buf, i) {
- var j = buf.length - 1;
- if (j < i) return 0;
- var nb = utf8CheckByte(buf[j]);
- if (nb >= 0) {
- if (nb > 0) self.lastNeed = nb - 1;
- return nb;
- }
- if (--j < i || nb === -2) return 0;
- nb = utf8CheckByte(buf[j]);
- if (nb >= 0) {
- if (nb > 0) self.lastNeed = nb - 2;
- return nb;
- }
- if (--j < i || nb === -2) return 0;
- nb = utf8CheckByte(buf[j]);
- if (nb >= 0) {
- if (nb > 0) {
- if (nb === 2) nb = 0;else self.lastNeed = nb - 3;
- }
- return nb;
- }
- return 0;
- }
- // Validates as many continuation bytes for a multi-byte UTF-8 character as
- // needed or are available. If we see a non-continuation byte where we expect
- // one, we "replace" the validated continuation bytes we've seen so far with
- // a single UTF-8 replacement character ('\ufffd'), to match v8's UTF-8 decoding
- // behavior. The continuation byte check is included three times in the case
- // where all of the continuation bytes for a character exist in the same buffer.
- // It is also done this way as a slight performance increase instead of using a
- // loop.
- function utf8CheckExtraBytes(self, buf, p) {
- if ((buf[0] & 0xC0) !== 0x80) {
- self.lastNeed = 0;
- return '\ufffd';
- }
- if (self.lastNeed > 1 && buf.length > 1) {
- if ((buf[1] & 0xC0) !== 0x80) {
- self.lastNeed = 1;
- return '\ufffd';
- }
- if (self.lastNeed > 2 && buf.length > 2) {
- if ((buf[2] & 0xC0) !== 0x80) {
- self.lastNeed = 2;
- return '\ufffd';
- }
- }
- }
- }
- // Attempts to complete a multi-byte UTF-8 character using bytes from a Buffer.
- function utf8FillLast(buf) {
- var p = this.lastTotal - this.lastNeed;
- var r = utf8CheckExtraBytes(this, buf, p);
- if (r !== undefined) return r;
- if (this.lastNeed <= buf.length) {
- buf.copy(this.lastChar, p, 0, this.lastNeed);
- return this.lastChar.toString(this.encoding, 0, this.lastTotal);
- }
- buf.copy(this.lastChar, p, 0, buf.length);
- this.lastNeed -= buf.length;
- }
- // Returns all complete UTF-8 characters in a Buffer. If the Buffer ended on a
- // partial character, the character's bytes are buffered until the required
- // number of bytes are available.
- function utf8Text(buf, i) {
- var total = utf8CheckIncomplete(this, buf, i);
- if (!this.lastNeed) return buf.toString('utf8', i);
- this.lastTotal = total;
- var end = buf.length - (total - this.lastNeed);
- buf.copy(this.lastChar, 0, end);
- return buf.toString('utf8', i, end);
- }
- // For UTF-8, a replacement character is added when ending on a partial
- // character.
- function utf8End(buf) {
- var r = buf && buf.length ? this.write(buf) : '';
- if (this.lastNeed) return r + '\ufffd';
- return r;
- }
- // UTF-16LE typically needs two bytes per character, but even if we have an even
- // number of bytes available, we need to check if we end on a leading/high
- // surrogate. In that case, we need to wait for the next two bytes in order to
- // decode the last character properly.
- function utf16Text(buf, i) {
- if ((buf.length - i) % 2 === 0) {
- var r = buf.toString('utf16le', i);
- if (r) {
- var c = r.charCodeAt(r.length - 1);
- if (c >= 0xD800 && c <= 0xDBFF) {
- this.lastNeed = 2;
- this.lastTotal = 4;
- this.lastChar[0] = buf[buf.length - 2];
- this.lastChar[1] = buf[buf.length - 1];
- return r.slice(0, -1);
- }
- }
- return r;
- }
- this.lastNeed = 1;
- this.lastTotal = 2;
- this.lastChar[0] = buf[buf.length - 1];
- return buf.toString('utf16le', i, buf.length - 1);
- }
- // For UTF-16LE we do not explicitly append special replacement characters if we
- // end on a partial character, we simply let v8 handle that.
- function utf16End(buf) {
- var r = buf && buf.length ? this.write(buf) : '';
- if (this.lastNeed) {
- var end = this.lastTotal - this.lastNeed;
- return r + this.lastChar.toString('utf16le', 0, end);
- }
- return r;
- }
- function base64Text(buf, i) {
- var n = (buf.length - i) % 3;
- if (n === 0) return buf.toString('base64', i);
- this.lastNeed = 3 - n;
- this.lastTotal = 3;
- if (n === 1) {
- this.lastChar[0] = buf[buf.length - 1];
- } else {
- this.lastChar[0] = buf[buf.length - 2];
- this.lastChar[1] = buf[buf.length - 1];
- }
- return buf.toString('base64', i, buf.length - n);
- }
- function base64End(buf) {
- var r = buf && buf.length ? this.write(buf) : '';
- if (this.lastNeed) return r + this.lastChar.toString('base64', 0, 3 - this.lastNeed);
- return r;
- }
- // Pass bytes on through for single-byte encodings (e.g. ascii, latin1, hex)
- function simpleWrite(buf) {
- return buf.toString(this.encoding);
- }
- function simpleEnd(buf) {
- return buf && buf.length ? this.write(buf) : '';
- }
- },{"safe-buffer":343}],347:[function(require,module,exports){
- (function (setImmediate,clearImmediate){(function (){
- var nextTick = require('process/browser.js').nextTick;
- var apply = Function.prototype.apply;
- var slice = Array.prototype.slice;
- var immediateIds = {};
- var nextImmediateId = 0;
- // DOM APIs, for completeness
- exports.setTimeout = function() {
- return new Timeout(apply.call(setTimeout, window, arguments), clearTimeout);
- };
- exports.setInterval = function() {
- return new Timeout(apply.call(setInterval, window, arguments), clearInterval);
- };
- exports.clearTimeout =
- exports.clearInterval = function(timeout) { timeout.close(); };
- function Timeout(id, clearFn) {
- this._id = id;
- this._clearFn = clearFn;
- }
- Timeout.prototype.unref = Timeout.prototype.ref = function() {};
- Timeout.prototype.close = function() {
- this._clearFn.call(window, this._id);
- };
- // Does not start the time, just sets up the members needed.
- exports.enroll = function(item, msecs) {
- clearTimeout(item._idleTimeoutId);
- item._idleTimeout = msecs;
- };
- exports.unenroll = function(item) {
- clearTimeout(item._idleTimeoutId);
- item._idleTimeout = -1;
- };
- exports._unrefActive = exports.active = function(item) {
- clearTimeout(item._idleTimeoutId);
- var msecs = item._idleTimeout;
- if (msecs >= 0) {
- item._idleTimeoutId = setTimeout(function onTimeout() {
- if (item._onTimeout)
- item._onTimeout();
- }, msecs);
- }
- };
- // That's not how node.js implements it but the exposed api is the same.
- exports.setImmediate = typeof setImmediate === "function" ? setImmediate : function(fn) {
- var id = nextImmediateId++;
- var args = arguments.length < 2 ? false : slice.call(arguments, 1);
- immediateIds[id] = true;
- nextTick(function onNextTick() {
- if (immediateIds[id]) {
- // fn.call() is faster so we optimize for the common use-case
- // @see http://jsperf.com/call-apply-segu
- if (args) {
- fn.apply(null, args);
- } else {
- fn.call(null);
- }
- // Prevent ids from leaking
- exports.clearImmediate(id);
- }
- });
- return id;
- };
- exports.clearImmediate = typeof clearImmediate === "function" ? clearImmediate : function(id) {
- delete immediateIds[id];
- };
- }).call(this)}).call(this,require("timers").setImmediate,require("timers").clearImmediate)
- },{"process/browser.js":324,"timers":347}],348:[function(require,module,exports){
- var Buffer = require('buffer').Buffer
- module.exports = function (buf) {
- // If the buffer is backed by a Uint8Array, a faster version will work
- if (buf instanceof Uint8Array) {
- // If the buffer isn't a subarray, return the underlying ArrayBuffer
- if (buf.byteOffset === 0 && buf.byteLength === buf.buffer.byteLength) {
- return buf.buffer
- } else if (typeof buf.buffer.slice === 'function') {
- // Otherwise we need to get a proper copy
- return buf.buffer.slice(buf.byteOffset, buf.byteOffset + buf.byteLength)
- }
- }
- if (Buffer.isBuffer(buf)) {
- // This is the slow version that will work with any Buffer
- // implementation (even in old browsers)
- var arrayCopy = new Uint8Array(buf.length)
- var len = buf.length
- for (var i = 0; i < len; i++) {
- arrayCopy[i] = buf[i]
- }
- return arrayCopy.buffer
- } else {
- throw new Error('Argument must be a Buffer')
- }
- }
- },{"buffer":85}],349:[function(require,module,exports){
- (function (global){(function (){
- /**
- * Module exports.
- */
- module.exports = deprecate;
- /**
- * Mark that a method should not be used.
- * Returns a modified function which warns once by default.
- *
- * If `localStorage.noDeprecation = true` is set, then it is a no-op.
- *
- * If `localStorage.throwDeprecation = true` is set, then deprecated functions
- * will throw an Error when invoked.
- *
- * If `localStorage.traceDeprecation = true` is set, then deprecated functions
- * will invoke `console.trace()` instead of `console.error()`.
- *
- * @param {Function} fn - the function to deprecate
- * @param {String} msg - the string to print to the console when `fn` is invoked
- * @returns {Function} a new "deprecated" version of `fn`
- * @api public
- */
- function deprecate (fn, msg) {
- if (config('noDeprecation')) {
- return fn;
- }
- var warned = false;
- function deprecated() {
- if (!warned) {
- if (config('throwDeprecation')) {
- throw new Error(msg);
- } else if (config('traceDeprecation')) {
- console.trace(msg);
- } else {
- console.warn(msg);
- }
- warned = true;
- }
- return fn.apply(this, arguments);
- }
- return deprecated;
- }
- /**
- * Checks `localStorage` for boolean values for the given `name`.
- *
- * @param {String} name
- * @returns {Boolean}
- * @api private
- */
- function config (name) {
- // accessing global.localStorage can trigger a DOMException in sandboxed iframes
- try {
- if (!global.localStorage) return false;
- } catch (_) {
- return false;
- }
- var val = global.localStorage[name];
- if (null == val) return false;
- return String(val).toLowerCase() === 'true';
- }
- }).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
- },{}],350:[function(require,module,exports){
- arguments[4][79][0].apply(exports,arguments)
- },{"dup":79}],351:[function(require,module,exports){
- arguments[4][80][0].apply(exports,arguments)
- },{"dup":80}],352:[function(require,module,exports){
- arguments[4][81][0].apply(exports,arguments)
- },{"./support/isBuffer":351,"_process":399,"dup":81,"inherits":350}],353:[function(require,module,exports){
- // Generated by CoffeeScript 1.12.7
- (function() {
- "use strict";
- exports.stripBOM = function(str) {
- if (str[0] === '\uFEFF') {
- return str.substring(1);
- } else {
- return str;
- }
- };
- }).call(this);
- },{}],354:[function(require,module,exports){
- // Generated by CoffeeScript 1.12.7
- (function() {
- "use strict";
- var builder, defaults, escapeCDATA, requiresCDATA, wrapCDATA,
- hasProp = {}.hasOwnProperty;
- builder = require('xmlbuilder');
- defaults = require('./defaults').defaults;
- requiresCDATA = function(entry) {
- return typeof entry === "string" && (entry.indexOf('&') >= 0 || entry.indexOf('>') >= 0 || entry.indexOf('<') >= 0);
- };
- wrapCDATA = function(entry) {
- return "<![CDATA[" + (escapeCDATA(entry)) + "]]>";
- };
- escapeCDATA = function(entry) {
- return entry.replace(']]>', ']]]]><![CDATA[>');
- };
- exports.Builder = (function() {
- function Builder(opts) {
- var key, ref, value;
- this.options = {};
- ref = defaults["0.2"];
- for (key in ref) {
- if (!hasProp.call(ref, key)) continue;
- value = ref[key];
- this.options[key] = value;
- }
- for (key in opts) {
- if (!hasProp.call(opts, key)) continue;
- value = opts[key];
- this.options[key] = value;
- }
- }
- Builder.prototype.buildObject = function(rootObj) {
- var attrkey, charkey, render, rootElement, rootName;
- attrkey = this.options.attrkey;
- charkey = this.options.charkey;
- if ((Object.keys(rootObj).length === 1) && (this.options.rootName === defaults['0.2'].rootName)) {
- rootName = Object.keys(rootObj)[0];
- rootObj = rootObj[rootName];
- } else {
- rootName = this.options.rootName;
- }
- render = (function(_this) {
- return function(element, obj) {
- var attr, child, entry, index, key, value;
- if (typeof obj !== 'object') {
- if (_this.options.cdata && requiresCDATA(obj)) {
- element.raw(wrapCDATA(obj));
- } else {
- element.txt(obj);
- }
- } else if (Array.isArray(obj)) {
- for (index in obj) {
- if (!hasProp.call(obj, index)) continue;
- child = obj[index];
- for (key in child) {
- entry = child[key];
- element = render(element.ele(key), entry).up();
- }
- }
- } else {
- for (key in obj) {
- if (!hasProp.call(obj, key)) continue;
- child = obj[key];
- if (key === attrkey) {
- if (typeof child === "object") {
- for (attr in child) {
- value = child[attr];
- element = element.att(attr, value);
- }
- }
- } else if (key === charkey) {
- if (_this.options.cdata && requiresCDATA(child)) {
- element = element.raw(wrapCDATA(child));
- } else {
- element = element.txt(child);
- }
- } else if (Array.isArray(child)) {
- for (index in child) {
- if (!hasProp.call(child, index)) continue;
- entry = child[index];
- if (typeof entry === 'string') {
- if (_this.options.cdata && requiresCDATA(entry)) {
- element = element.ele(key).raw(wrapCDATA(entry)).up();
- } else {
- element = element.ele(key, entry).up();
- }
- } else {
- element = render(element.ele(key), entry).up();
- }
- }
- } else if (typeof child === "object") {
- element = render(element.ele(key), child).up();
- } else {
- if (typeof child === 'string' && _this.options.cdata && requiresCDATA(child)) {
- element = element.ele(key).raw(wrapCDATA(child)).up();
- } else {
- if (child == null) {
- child = '';
- }
- element = element.ele(key, child.toString()).up();
- }
- }
- }
- }
- return element;
- };
- })(this);
- rootElement = builder.create(rootName, this.options.xmldec, this.options.doctype, {
- headless: this.options.headless,
- allowSurrogateChars: this.options.allowSurrogateChars
- });
- return render(rootElement, rootObj).end(this.options.renderOpts);
- };
- return Builder;
- })();
- }).call(this);
- },{"./defaults":355,"xmlbuilder":391}],355:[function(require,module,exports){
- // Generated by CoffeeScript 1.12.7
- (function() {
- exports.defaults = {
- "0.1": {
- explicitCharkey: false,
- trim: true,
- normalize: true,
- normalizeTags: false,
- attrkey: "@",
- charkey: "#",
- explicitArray: false,
- ignoreAttrs: false,
- mergeAttrs: false,
- explicitRoot: false,
- validator: null,
- xmlns: false,
- explicitChildren: false,
- childkey: '@@',
- charsAsChildren: false,
- includeWhiteChars: false,
- async: false,
- strict: true,
- attrNameProcessors: null,
- attrValueProcessors: null,
- tagNameProcessors: null,
- valueProcessors: null,
- emptyTag: ''
- },
- "0.2": {
- explicitCharkey: false,
- trim: false,
- normalize: false,
- normalizeTags: false,
- attrkey: "$",
- charkey: "_",
- explicitArray: true,
- ignoreAttrs: false,
- mergeAttrs: false,
- explicitRoot: true,
- validator: null,
- xmlns: false,
- explicitChildren: false,
- preserveChildrenOrder: false,
- childkey: '$$',
- charsAsChildren: false,
- includeWhiteChars: false,
- async: false,
- strict: true,
- attrNameProcessors: null,
- attrValueProcessors: null,
- tagNameProcessors: null,
- valueProcessors: null,
- rootName: 'root',
- xmldec: {
- 'version': '1.0',
- 'encoding': 'UTF-8',
- 'standalone': true
- },
- doctype: null,
- renderOpts: {
- 'pretty': true,
- 'indent': ' ',
- 'newline': '\n'
- },
- headless: false,
- chunkSize: 10000,
- emptyTag: '',
- cdata: false
- }
- };
- }).call(this);
- },{}],356:[function(require,module,exports){
- // Generated by CoffeeScript 1.12.7
- (function() {
- "use strict";
- var bom, defaults, events, isEmpty, processItem, processors, sax, setImmediate,
- bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
- 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; },
- hasProp = {}.hasOwnProperty;
- sax = require('sax');
- events = require('events');
- bom = require('./bom');
- processors = require('./processors');
- setImmediate = require('timers').setImmediate;
- defaults = require('./defaults').defaults;
- isEmpty = function(thing) {
- return typeof thing === "object" && (thing != null) && Object.keys(thing).length === 0;
- };
- processItem = function(processors, item, key) {
- var i, len, process;
- for (i = 0, len = processors.length; i < len; i++) {
- process = processors[i];
- item = process(item, key);
- }
- return item;
- };
- exports.Parser = (function(superClass) {
- extend(Parser, superClass);
- function Parser(opts) {
- this.parseStringPromise = bind(this.parseStringPromise, this);
- this.parseString = bind(this.parseString, this);
- this.reset = bind(this.reset, this);
- this.assignOrPush = bind(this.assignOrPush, this);
- this.processAsync = bind(this.processAsync, this);
- var key, ref, value;
- if (!(this instanceof exports.Parser)) {
- return new exports.Parser(opts);
- }
- this.options = {};
- ref = defaults["0.2"];
- for (key in ref) {
- if (!hasProp.call(ref, key)) continue;
- value = ref[key];
- this.options[key] = value;
- }
- for (key in opts) {
- if (!hasProp.call(opts, key)) continue;
- value = opts[key];
- this.options[key] = value;
- }
- if (this.options.xmlns) {
- this.options.xmlnskey = this.options.attrkey + "ns";
- }
- if (this.options.normalizeTags) {
- if (!this.options.tagNameProcessors) {
- this.options.tagNameProcessors = [];
- }
- this.options.tagNameProcessors.unshift(processors.normalize);
- }
- this.reset();
- }
- Parser.prototype.processAsync = function() {
- var chunk, err;
- try {
- if (this.remaining.length <= this.options.chunkSize) {
- chunk = this.remaining;
- this.remaining = '';
- this.saxParser = this.saxParser.write(chunk);
- return this.saxParser.close();
- } else {
- chunk = this.remaining.substr(0, this.options.chunkSize);
- this.remaining = this.remaining.substr(this.options.chunkSize, this.remaining.length);
- this.saxParser = this.saxParser.write(chunk);
- return setImmediate(this.processAsync);
- }
- } catch (error1) {
- err = error1;
- if (!this.saxParser.errThrown) {
- this.saxParser.errThrown = true;
- return this.emit(err);
- }
- }
- };
- Parser.prototype.assignOrPush = function(obj, key, newValue) {
- if (!(key in obj)) {
- if (!this.options.explicitArray) {
- return obj[key] = newValue;
- } else {
- return obj[key] = [newValue];
- }
- } else {
- if (!(obj[key] instanceof Array)) {
- obj[key] = [obj[key]];
- }
- return obj[key].push(newValue);
- }
- };
- Parser.prototype.reset = function() {
- var attrkey, charkey, ontext, stack;
- this.removeAllListeners();
- this.saxParser = sax.parser(this.options.strict, {
- trim: false,
- normalize: false,
- xmlns: this.options.xmlns
- });
- this.saxParser.errThrown = false;
- this.saxParser.onerror = (function(_this) {
- return function(error) {
- _this.saxParser.resume();
- if (!_this.saxParser.errThrown) {
- _this.saxParser.errThrown = true;
- return _this.emit("error", error);
- }
- };
- })(this);
- this.saxParser.onend = (function(_this) {
- return function() {
- if (!_this.saxParser.ended) {
- _this.saxParser.ended = true;
- return _this.emit("end", _this.resultObject);
- }
- };
- })(this);
- this.saxParser.ended = false;
- this.EXPLICIT_CHARKEY = this.options.explicitCharkey;
- this.resultObject = null;
- stack = [];
- attrkey = this.options.attrkey;
- charkey = this.options.charkey;
- this.saxParser.onopentag = (function(_this) {
- return function(node) {
- var key, newValue, obj, processedKey, ref;
- obj = {};
- obj[charkey] = "";
- if (!_this.options.ignoreAttrs) {
- ref = node.attributes;
- for (key in ref) {
- if (!hasProp.call(ref, key)) continue;
- if (!(attrkey in obj) && !_this.options.mergeAttrs) {
- obj[attrkey] = {};
- }
- newValue = _this.options.attrValueProcessors ? processItem(_this.options.attrValueProcessors, node.attributes[key], key) : node.attributes[key];
- processedKey = _this.options.attrNameProcessors ? processItem(_this.options.attrNameProcessors, key) : key;
- if (_this.options.mergeAttrs) {
- _this.assignOrPush(obj, processedKey, newValue);
- } else {
- obj[attrkey][processedKey] = newValue;
- }
- }
- }
- obj["#name"] = _this.options.tagNameProcessors ? processItem(_this.options.tagNameProcessors, node.name) : node.name;
- if (_this.options.xmlns) {
- obj[_this.options.xmlnskey] = {
- uri: node.uri,
- local: node.local
- };
- }
- return stack.push(obj);
- };
- })(this);
- this.saxParser.onclosetag = (function(_this) {
- return function() {
- var cdata, emptyStr, key, node, nodeName, obj, objClone, old, s, xpath;
- obj = stack.pop();
- nodeName = obj["#name"];
- if (!_this.options.explicitChildren || !_this.options.preserveChildrenOrder) {
- delete obj["#name"];
- }
- if (obj.cdata === true) {
- cdata = obj.cdata;
- delete obj.cdata;
- }
- s = stack[stack.length - 1];
- if (obj[charkey].match(/^\s*$/) && !cdata) {
- emptyStr = obj[charkey];
- delete obj[charkey];
- } else {
- if (_this.options.trim) {
- obj[charkey] = obj[charkey].trim();
- }
- if (_this.options.normalize) {
- obj[charkey] = obj[charkey].replace(/\s{2,}/g, " ").trim();
- }
- obj[charkey] = _this.options.valueProcessors ? processItem(_this.options.valueProcessors, obj[charkey], nodeName) : obj[charkey];
- if (Object.keys(obj).length === 1 && charkey in obj && !_this.EXPLICIT_CHARKEY) {
- obj = obj[charkey];
- }
- }
- if (isEmpty(obj)) {
- obj = _this.options.emptyTag !== '' ? _this.options.emptyTag : emptyStr;
- }
- if (_this.options.validator != null) {
- xpath = "/" + ((function() {
- var i, len, results;
- results = [];
- for (i = 0, len = stack.length; i < len; i++) {
- node = stack[i];
- results.push(node["#name"]);
- }
- return results;
- })()).concat(nodeName).join("/");
- (function() {
- var err;
- try {
- return obj = _this.options.validator(xpath, s && s[nodeName], obj);
- } catch (error1) {
- err = error1;
- return _this.emit("error", err);
- }
- })();
- }
- if (_this.options.explicitChildren && !_this.options.mergeAttrs && typeof obj === 'object') {
- if (!_this.options.preserveChildrenOrder) {
- node = {};
- if (_this.options.attrkey in obj) {
- node[_this.options.attrkey] = obj[_this.options.attrkey];
- delete obj[_this.options.attrkey];
- }
- if (!_this.options.charsAsChildren && _this.options.charkey in obj) {
- node[_this.options.charkey] = obj[_this.options.charkey];
- delete obj[_this.options.charkey];
- }
- if (Object.getOwnPropertyNames(obj).length > 0) {
- node[_this.options.childkey] = obj;
- }
- obj = node;
- } else if (s) {
- s[_this.options.childkey] = s[_this.options.childkey] || [];
- objClone = {};
- for (key in obj) {
- if (!hasProp.call(obj, key)) continue;
- objClone[key] = obj[key];
- }
- s[_this.options.childkey].push(objClone);
- delete obj["#name"];
- if (Object.keys(obj).length === 1 && charkey in obj && !_this.EXPLICIT_CHARKEY) {
- obj = obj[charkey];
- }
- }
- }
- if (stack.length > 0) {
- return _this.assignOrPush(s, nodeName, obj);
- } else {
- if (_this.options.explicitRoot) {
- old = obj;
- obj = {};
- obj[nodeName] = old;
- }
- _this.resultObject = obj;
- _this.saxParser.ended = true;
- return _this.emit("end", _this.resultObject);
- }
- };
- })(this);
- ontext = (function(_this) {
- return function(text) {
- var charChild, s;
- s = stack[stack.length - 1];
- if (s) {
- s[charkey] += text;
- if (_this.options.explicitChildren && _this.options.preserveChildrenOrder && _this.options.charsAsChildren && (_this.options.includeWhiteChars || text.replace(/\\n/g, '').trim() !== '')) {
- s[_this.options.childkey] = s[_this.options.childkey] || [];
- charChild = {
- '#name': '__text__'
- };
- charChild[charkey] = text;
- if (_this.options.normalize) {
- charChild[charkey] = charChild[charkey].replace(/\s{2,}/g, " ").trim();
- }
- s[_this.options.childkey].push(charChild);
- }
- return s;
- }
- };
- })(this);
- this.saxParser.ontext = ontext;
- return this.saxParser.oncdata = (function(_this) {
- return function(text) {
- var s;
- s = ontext(text);
- if (s) {
- return s.cdata = true;
- }
- };
- })(this);
- };
- Parser.prototype.parseString = function(str, cb) {
- var err;
- if ((cb != null) && typeof cb === "function") {
- this.on("end", function(result) {
- this.reset();
- return cb(null, result);
- });
- this.on("error", function(err) {
- this.reset();
- return cb(err);
- });
- }
- try {
- str = str.toString();
- if (str.trim() === '') {
- this.emit("end", null);
- return true;
- }
- str = bom.stripBOM(str);
- if (this.options.async) {
- this.remaining = str;
- setImmediate(this.processAsync);
- return this.saxParser;
- }
- return this.saxParser.write(str).close();
- } catch (error1) {
- err = error1;
- if (!(this.saxParser.errThrown || this.saxParser.ended)) {
- this.emit('error', err);
- return this.saxParser.errThrown = true;
- } else if (this.saxParser.ended) {
- throw err;
- }
- }
- };
- Parser.prototype.parseStringPromise = function(str) {
- return new Promise((function(_this) {
- return function(resolve, reject) {
- return _this.parseString(str, function(err, value) {
- if (err) {
- return reject(err);
- } else {
- return resolve(value);
- }
- });
- };
- })(this));
- };
- return Parser;
- })(events);
- exports.parseString = function(str, a, b) {
- var cb, options, parser;
- if (b != null) {
- if (typeof b === 'function') {
- cb = b;
- }
- if (typeof a === 'object') {
- options = a;
- }
- } else {
- if (typeof a === 'function') {
- cb = a;
- }
- options = {};
- }
- parser = new exports.Parser(options);
- return parser.parseString(str, cb);
- };
- exports.parseStringPromise = function(str, a) {
- var options, parser;
- if (typeof a === 'object') {
- options = a;
- }
- parser = new exports.Parser(options);
- return parser.parseStringPromise(str);
- };
- }).call(this);
- },{"./bom":353,"./defaults":355,"./processors":357,"events":301,"sax":344,"timers":347}],357:[function(require,module,exports){
- // Generated by CoffeeScript 1.12.7
- (function() {
- "use strict";
- var prefixMatch;
- prefixMatch = new RegExp(/(?!xmlns)^.*:/);
- exports.normalize = function(str) {
- return str.toLowerCase();
- };
- exports.firstCharLowerCase = function(str) {
- return str.charAt(0).toLowerCase() + str.slice(1);
- };
- exports.stripPrefix = function(str) {
- return str.replace(prefixMatch, '');
- };
- exports.parseNumbers = function(str) {
- if (!isNaN(str)) {
- str = str % 1 === 0 ? parseInt(str, 10) : parseFloat(str);
- }
- return str;
- };
- exports.parseBooleans = function(str) {
- if (/^(?:true|false)$/i.test(str)) {
- str = str.toLowerCase() === 'true';
- }
- return str;
- };
- }).call(this);
- },{}],358:[function(require,module,exports){
- // Generated by CoffeeScript 1.12.7
- (function() {
- "use strict";
- var builder, defaults, parser, processors,
- 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; },
- hasProp = {}.hasOwnProperty;
- defaults = require('./defaults');
- builder = require('./builder');
- parser = require('./parser');
- processors = require('./processors');
- exports.defaults = defaults.defaults;
- exports.processors = processors;
- exports.ValidationError = (function(superClass) {
- extend(ValidationError, superClass);
- function ValidationError(message) {
- this.message = message;
- }
- return ValidationError;
- })(Error);
- exports.Builder = builder.Builder;
- exports.Parser = parser.Parser;
- exports.parseString = parser.parseString;
- exports.parseStringPromise = parser.parseStringPromise;
- }).call(this);
- },{"./builder":354,"./defaults":355,"./parser":356,"./processors":357}],359:[function(require,module,exports){
- // Generated by CoffeeScript 1.12.7
- (function() {
- module.exports = {
- Disconnected: 1,
- Preceding: 2,
- Following: 4,
- Contains: 8,
- ContainedBy: 16,
- ImplementationSpecific: 32
- };
- }).call(this);
- },{}],360:[function(require,module,exports){
- // Generated by CoffeeScript 1.12.7
- (function() {
- module.exports = {
- Element: 1,
- Attribute: 2,
- Text: 3,
- CData: 4,
- EntityReference: 5,
- EntityDeclaration: 6,
- ProcessingInstruction: 7,
- Comment: 8,
- Document: 9,
- DocType: 10,
- DocumentFragment: 11,
- NotationDeclaration: 12,
- Declaration: 201,
- Raw: 202,
- AttributeDeclaration: 203,
- ElementDeclaration: 204,
- Dummy: 205
- };
- }).call(this);
- },{}],361:[function(require,module,exports){
- // Generated by CoffeeScript 1.12.7
- (function() {
- var assign, getValue, isArray, isEmpty, isFunction, isObject, isPlainObject,
- slice = [].slice,
- hasProp = {}.hasOwnProperty;
- assign = function() {
- var i, key, len, source, sources, target;
- target = arguments[0], sources = 2 <= arguments.length ? slice.call(arguments, 1) : [];
- if (isFunction(Object.assign)) {
- Object.assign.apply(null, arguments);
- } else {
- for (i = 0, len = sources.length; i < len; i++) {
- source = sources[i];
- if (source != null) {
- for (key in source) {
- if (!hasProp.call(source, key)) continue;
- target[key] = source[key];
- }
- }
- }
- }
- return target;
- };
- isFunction = function(val) {
- return !!val && Object.prototype.toString.call(val) === '[object Function]';
- };
- isObject = function(val) {
- var ref;
- return !!val && ((ref = typeof val) === 'function' || ref === 'object');
- };
- isArray = function(val) {
- if (isFunction(Array.isArray)) {
- return Array.isArray(val);
- } else {
- return Object.prototype.toString.call(val) === '[object Array]';
- }
- };
- isEmpty = function(val) {
- var key;
- if (isArray(val)) {
- return !val.length;
- } else {
- for (key in val) {
- if (!hasProp.call(val, key)) continue;
- return false;
- }
- return true;
- }
- };
- isPlainObject = function(val) {
- var ctor, proto;
- 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));
- };
- getValue = function(obj) {
- if (isFunction(obj.valueOf)) {
- return obj.valueOf();
- } else {
- return obj;
- }
- };
- module.exports.assign = assign;
- module.exports.isFunction = isFunction;
- module.exports.isObject = isObject;
- module.exports.isArray = isArray;
- module.exports.isEmpty = isEmpty;
- module.exports.isPlainObject = isPlainObject;
- module.exports.getValue = getValue;
- }).call(this);
- },{}],362:[function(require,module,exports){
- // Generated by CoffeeScript 1.12.7
- (function() {
- module.exports = {
- None: 0,
- OpenTag: 1,
- InsideTag: 2,
- CloseTag: 3
- };
- }).call(this);
- },{}],363:[function(require,module,exports){
- // Generated by CoffeeScript 1.12.7
- (function() {
- var NodeType, XMLAttribute, XMLNode;
- NodeType = require('./NodeType');
- XMLNode = require('./XMLNode');
- module.exports = XMLAttribute = (function() {
- function XMLAttribute(parent, name, value) {
- this.parent = parent;
- if (this.parent) {
- this.options = this.parent.options;
- this.stringify = this.parent.stringify;
- }
- if (name == null) {
- throw new Error("Missing attribute name. " + this.debugInfo(name));
- }
- this.name = this.stringify.name(name);
- this.value = this.stringify.attValue(value);
- this.type = NodeType.Attribute;
- this.isId = false;
- this.schemaTypeInfo = null;
- }
- Object.defineProperty(XMLAttribute.prototype, 'nodeType', {
- get: function() {
- return this.type;
- }
- });
- Object.defineProperty(XMLAttribute.prototype, 'ownerElement', {
- get: function() {
- return this.parent;
- }
- });
- Object.defineProperty(XMLAttribute.prototype, 'textContent', {
- get: function() {
- return this.value;
- },
- set: function(value) {
- return this.value = value || '';
- }
- });
- Object.defineProperty(XMLAttribute.prototype, 'namespaceURI', {
- get: function() {
- return '';
- }
- });
- Object.defineProperty(XMLAttribute.prototype, 'prefix', {
- get: function() {
- return '';
- }
- });
- Object.defineProperty(XMLAttribute.prototype, 'localName', {
- get: function() {
- return this.name;
- }
- });
- Object.defineProperty(XMLAttribute.prototype, 'specified', {
- get: function() {
- return true;
- }
- });
- XMLAttribute.prototype.clone = function() {
- return Object.create(this);
- };
- XMLAttribute.prototype.toString = function(options) {
- return this.options.writer.attribute(this, this.options.writer.filterOptions(options));
- };
- XMLAttribute.prototype.debugInfo = function(name) {
- name = name || this.name;
- if (name == null) {
- return "parent: <" + this.parent.name + ">";
- } else {
- return "attribute: {" + name + "}, parent: <" + this.parent.name + ">";
- }
- };
- XMLAttribute.prototype.isEqualNode = function(node) {
- if (node.namespaceURI !== this.namespaceURI) {
- return false;
- }
- if (node.prefix !== this.prefix) {
- return false;
- }
- if (node.localName !== this.localName) {
- return false;
- }
- if (node.value !== this.value) {
- return false;
- }
- return true;
- };
- return XMLAttribute;
- })();
- }).call(this);
- },{"./NodeType":360,"./XMLNode":382}],364:[function(require,module,exports){
- // Generated by CoffeeScript 1.12.7
- (function() {
- var NodeType, XMLCData, XMLCharacterData,
- 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; },
- hasProp = {}.hasOwnProperty;
- NodeType = require('./NodeType');
- XMLCharacterData = require('./XMLCharacterData');
- module.exports = XMLCData = (function(superClass) {
- extend(XMLCData, superClass);
- function XMLCData(parent, text) {
- XMLCData.__super__.constructor.call(this, parent);
- if (text == null) {
- throw new Error("Missing CDATA text. " + this.debugInfo());
- }
- this.name = "#cdata-section";
- this.type = NodeType.CData;
- this.value = this.stringify.cdata(text);
- }
- XMLCData.prototype.clone = function() {
- return Object.create(this);
- };
- XMLCData.prototype.toString = function(options) {
- return this.options.writer.cdata(this, this.options.writer.filterOptions(options));
- };
- return XMLCData;
- })(XMLCharacterData);
- }).call(this);
- },{"./NodeType":360,"./XMLCharacterData":365}],365:[function(require,module,exports){
- // Generated by CoffeeScript 1.12.7
- (function() {
- var XMLCharacterData, XMLNode,
- 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; },
- hasProp = {}.hasOwnProperty;
- XMLNode = require('./XMLNode');
- module.exports = XMLCharacterData = (function(superClass) {
- extend(XMLCharacterData, superClass);
- function XMLCharacterData(parent) {
- XMLCharacterData.__super__.constructor.call(this, parent);
- this.value = '';
- }
- Object.defineProperty(XMLCharacterData.prototype, 'data', {
- get: function() {
- return this.value;
- },
- set: function(value) {
- return this.value = value || '';
- }
- });
- Object.defineProperty(XMLCharacterData.prototype, 'length', {
- get: function() {
- return this.value.length;
- }
- });
- Object.defineProperty(XMLCharacterData.prototype, 'textContent', {
- get: function() {
- return this.value;
- },
- set: function(value) {
- return this.value = value || '';
- }
- });
- XMLCharacterData.prototype.clone = function() {
- return Object.create(this);
- };
- XMLCharacterData.prototype.substringData = function(offset, count) {
- throw new Error("This DOM method is not implemented." + this.debugInfo());
- };
- XMLCharacterData.prototype.appendData = function(arg) {
- throw new Error("This DOM method is not implemented." + this.debugInfo());
- };
- XMLCharacterData.prototype.insertData = function(offset, arg) {
- throw new Error("This DOM method is not implemented." + this.debugInfo());
- };
- XMLCharacterData.prototype.deleteData = function(offset, count) {
- throw new Error("This DOM method is not implemented." + this.debugInfo());
- };
- XMLCharacterData.prototype.replaceData = function(offset, count, arg) {
- throw new Error("This DOM method is not implemented." + this.debugInfo());
- };
- XMLCharacterData.prototype.isEqualNode = function(node) {
- if (!XMLCharacterData.__super__.isEqualNode.apply(this, arguments).isEqualNode(node)) {
- return false;
- }
- if (node.data !== this.data) {
- return false;
- }
- return true;
- };
- return XMLCharacterData;
- })(XMLNode);
- }).call(this);
- },{"./XMLNode":382}],366:[function(require,module,exports){
- // Generated by CoffeeScript 1.12.7
- (function() {
- var NodeType, XMLCharacterData, XMLComment,
- 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; },
- hasProp = {}.hasOwnProperty;
- NodeType = require('./NodeType');
- XMLCharacterData = require('./XMLCharacterData');
- module.exports = XMLComment = (function(superClass) {
- extend(XMLComment, superClass);
- function XMLComment(parent, text) {
- XMLComment.__super__.constructor.call(this, parent);
- if (text == null) {
- throw new Error("Missing comment text. " + this.debugInfo());
- }
- this.name = "#comment";
- this.type = NodeType.Comment;
- this.value = this.stringify.comment(text);
- }
- XMLComment.prototype.clone = function() {
- return Object.create(this);
- };
- XMLComment.prototype.toString = function(options) {
- return this.options.writer.comment(this, this.options.writer.filterOptions(options));
- };
- return XMLComment;
- })(XMLCharacterData);
- }).call(this);
- },{"./NodeType":360,"./XMLCharacterData":365}],367:[function(require,module,exports){
- // Generated by CoffeeScript 1.12.7
- (function() {
- var XMLDOMConfiguration, XMLDOMErrorHandler, XMLDOMStringList;
- XMLDOMErrorHandler = require('./XMLDOMErrorHandler');
- XMLDOMStringList = require('./XMLDOMStringList');
- module.exports = XMLDOMConfiguration = (function() {
- function XMLDOMConfiguration() {
- var clonedSelf;
- this.defaultParams = {
- "canonical-form": false,
- "cdata-sections": false,
- "comments": false,
- "datatype-normalization": false,
- "element-content-whitespace": true,
- "entities": true,
- "error-handler": new XMLDOMErrorHandler(),
- "infoset": true,
- "validate-if-schema": false,
- "namespaces": true,
- "namespace-declarations": true,
- "normalize-characters": false,
- "schema-location": '',
- "schema-type": '',
- "split-cdata-sections": true,
- "validate": false,
- "well-formed": true
- };
- this.params = clonedSelf = Object.create(this.defaultParams);
- }
- Object.defineProperty(XMLDOMConfiguration.prototype, 'parameterNames', {
- get: function() {
- return new XMLDOMStringList(Object.keys(this.defaultParams));
- }
- });
- XMLDOMConfiguration.prototype.getParameter = function(name) {
- if (this.params.hasOwnProperty(name)) {
- return this.params[name];
- } else {
- return null;
- }
- };
- XMLDOMConfiguration.prototype.canSetParameter = function(name, value) {
- return true;
- };
- XMLDOMConfiguration.prototype.setParameter = function(name, value) {
- if (value != null) {
- return this.params[name] = value;
- } else {
- return delete this.params[name];
- }
- };
- return XMLDOMConfiguration;
- })();
- }).call(this);
- },{"./XMLDOMErrorHandler":368,"./XMLDOMStringList":370}],368:[function(require,module,exports){
- // Generated by CoffeeScript 1.12.7
- (function() {
- var XMLDOMErrorHandler;
- module.exports = XMLDOMErrorHandler = (function() {
- function XMLDOMErrorHandler() {}
- XMLDOMErrorHandler.prototype.handleError = function(error) {
- throw new Error(error);
- };
- return XMLDOMErrorHandler;
- })();
- }).call(this);
- },{}],369:[function(require,module,exports){
- // Generated by CoffeeScript 1.12.7
- (function() {
- var XMLDOMImplementation;
- module.exports = XMLDOMImplementation = (function() {
- function XMLDOMImplementation() {}
- XMLDOMImplementation.prototype.hasFeature = function(feature, version) {
- return true;
- };
- XMLDOMImplementation.prototype.createDocumentType = function(qualifiedName, publicId, systemId) {
- throw new Error("This DOM method is not implemented.");
- };
- XMLDOMImplementation.prototype.createDocument = function(namespaceURI, qualifiedName, doctype) {
- throw new Error("This DOM method is not implemented.");
- };
- XMLDOMImplementation.prototype.createHTMLDocument = function(title) {
- throw new Error("This DOM method is not implemented.");
- };
- XMLDOMImplementation.prototype.getFeature = function(feature, version) {
- throw new Error("This DOM method is not implemented.");
- };
- return XMLDOMImplementation;
- })();
- }).call(this);
- },{}],370:[function(require,module,exports){
- // Generated by CoffeeScript 1.12.7
- (function() {
- var XMLDOMStringList;
- module.exports = XMLDOMStringList = (function() {
- function XMLDOMStringList(arr) {
- this.arr = arr || [];
- }
- Object.defineProperty(XMLDOMStringList.prototype, 'length', {
- get: function() {
- return this.arr.length;
- }
- });
- XMLDOMStringList.prototype.item = function(index) {
- return this.arr[index] || null;
- };
- XMLDOMStringList.prototype.contains = function(str) {
- return this.arr.indexOf(str) !== -1;
- };
- return XMLDOMStringList;
- })();
- }).call(this);
- },{}],371:[function(require,module,exports){
- // Generated by CoffeeScript 1.12.7
- (function() {
- var NodeType, XMLDTDAttList, XMLNode,
- 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; },
- hasProp = {}.hasOwnProperty;
- XMLNode = require('./XMLNode');
- NodeType = require('./NodeType');
- module.exports = XMLDTDAttList = (function(superClass) {
- extend(XMLDTDAttList, superClass);
- function XMLDTDAttList(parent, elementName, attributeName, attributeType, defaultValueType, defaultValue) {
- XMLDTDAttList.__super__.constructor.call(this, parent);
- if (elementName == null) {
- throw new Error("Missing DTD element name. " + this.debugInfo());
- }
- if (attributeName == null) {
- throw new Error("Missing DTD attribute name. " + this.debugInfo(elementName));
- }
- if (!attributeType) {
- throw new Error("Missing DTD attribute type. " + this.debugInfo(elementName));
- }
- if (!defaultValueType) {
- throw new Error("Missing DTD attribute default. " + this.debugInfo(elementName));
- }
- if (defaultValueType.indexOf('#') !== 0) {
- defaultValueType = '#' + defaultValueType;
- }
- if (!defaultValueType.match(/^(#REQUIRED|#IMPLIED|#FIXED|#DEFAULT)$/)) {
- throw new Error("Invalid default value type; expected: #REQUIRED, #IMPLIED, #FIXED or #DEFAULT. " + this.debugInfo(elementName));
- }
- if (defaultValue && !defaultValueType.match(/^(#FIXED|#DEFAULT)$/)) {
- throw new Error("Default value only applies to #FIXED or #DEFAULT. " + this.debugInfo(elementName));
- }
- this.elementName = this.stringify.name(elementName);
- this.type = NodeType.AttributeDeclaration;
- this.attributeName = this.stringify.name(attributeName);
- this.attributeType = this.stringify.dtdAttType(attributeType);
- if (defaultValue) {
- this.defaultValue = this.stringify.dtdAttDefault(defaultValue);
- }
- this.defaultValueType = defaultValueType;
- }
- XMLDTDAttList.prototype.toString = function(options) {
- return this.options.writer.dtdAttList(this, this.options.writer.filterOptions(options));
- };
- return XMLDTDAttList;
- })(XMLNode);
- }).call(this);
- },{"./NodeType":360,"./XMLNode":382}],372:[function(require,module,exports){
- // Generated by CoffeeScript 1.12.7
- (function() {
- var NodeType, XMLDTDElement, XMLNode,
- 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; },
- hasProp = {}.hasOwnProperty;
- XMLNode = require('./XMLNode');
- NodeType = require('./NodeType');
- module.exports = XMLDTDElement = (function(superClass) {
- extend(XMLDTDElement, superClass);
- function XMLDTDElement(parent, name, value) {
- XMLDTDElement.__super__.constructor.call(this, parent);
- if (name == null) {
- throw new Error("Missing DTD element name. " + this.debugInfo());
- }
- if (!value) {
- value = '(#PCDATA)';
- }
- if (Array.isArray(value)) {
- value = '(' + value.join(',') + ')';
- }
- this.name = this.stringify.name(name);
- this.type = NodeType.ElementDeclaration;
- this.value = this.stringify.dtdElementValue(value);
- }
- XMLDTDElement.prototype.toString = function(options) {
- return this.options.writer.dtdElement(this, this.options.writer.filterOptions(options));
- };
- return XMLDTDElement;
- })(XMLNode);
- }).call(this);
- },{"./NodeType":360,"./XMLNode":382}],373:[function(require,module,exports){
- // Generated by CoffeeScript 1.12.7
- (function() {
- var NodeType, XMLDTDEntity, XMLNode, isObject,
- 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; },
- hasProp = {}.hasOwnProperty;
- isObject = require('./Utility').isObject;
- XMLNode = require('./XMLNode');
- NodeType = require('./NodeType');
- module.exports = XMLDTDEntity = (function(superClass) {
- extend(XMLDTDEntity, superClass);
- function XMLDTDEntity(parent, pe, name, value) {
- XMLDTDEntity.__super__.constructor.call(this, parent);
- if (name == null) {
- throw new Error("Missing DTD entity name. " + this.debugInfo(name));
- }
- if (value == null) {
- throw new Error("Missing DTD entity value. " + this.debugInfo(name));
- }
- this.pe = !!pe;
- this.name = this.stringify.name(name);
- this.type = NodeType.EntityDeclaration;
- if (!isObject(value)) {
- this.value = this.stringify.dtdEntityValue(value);
- this.internal = true;
- } else {
- if (!value.pubID && !value.sysID) {
- throw new Error("Public and/or system identifiers are required for an external entity. " + this.debugInfo(name));
- }
- if (value.pubID && !value.sysID) {
- throw new Error("System identifier is required for a public external entity. " + this.debugInfo(name));
- }
- this.internal = false;
- if (value.pubID != null) {
- this.pubID = this.stringify.dtdPubID(value.pubID);
- }
- if (value.sysID != null) {
- this.sysID = this.stringify.dtdSysID(value.sysID);
- }
- if (value.nData != null) {
- this.nData = this.stringify.dtdNData(value.nData);
- }
- if (this.pe && this.nData) {
- throw new Error("Notation declaration is not allowed in a parameter entity. " + this.debugInfo(name));
- }
- }
- }
- Object.defineProperty(XMLDTDEntity.prototype, 'publicId', {
- get: function() {
- return this.pubID;
- }
- });
- Object.defineProperty(XMLDTDEntity.prototype, 'systemId', {
- get: function() {
- return this.sysID;
- }
- });
- Object.defineProperty(XMLDTDEntity.prototype, 'notationName', {
- get: function() {
- return this.nData || null;
- }
- });
- Object.defineProperty(XMLDTDEntity.prototype, 'inputEncoding', {
- get: function() {
- return null;
- }
- });
- Object.defineProperty(XMLDTDEntity.prototype, 'xmlEncoding', {
- get: function() {
- return null;
- }
- });
- Object.defineProperty(XMLDTDEntity.prototype, 'xmlVersion', {
- get: function() {
- return null;
- }
- });
- XMLDTDEntity.prototype.toString = function(options) {
- return this.options.writer.dtdEntity(this, this.options.writer.filterOptions(options));
- };
- return XMLDTDEntity;
- })(XMLNode);
- }).call(this);
- },{"./NodeType":360,"./Utility":361,"./XMLNode":382}],374:[function(require,module,exports){
- // Generated by CoffeeScript 1.12.7
- (function() {
- var NodeType, XMLDTDNotation, XMLNode,
- 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; },
- hasProp = {}.hasOwnProperty;
- XMLNode = require('./XMLNode');
- NodeType = require('./NodeType');
- module.exports = XMLDTDNotation = (function(superClass) {
- extend(XMLDTDNotation, superClass);
- function XMLDTDNotation(parent, name, value) {
- XMLDTDNotation.__super__.constructor.call(this, parent);
- if (name == null) {
- throw new Error("Missing DTD notation name. " + this.debugInfo(name));
- }
- if (!value.pubID && !value.sysID) {
- throw new Error("Public or system identifiers are required for an external entity. " + this.debugInfo(name));
- }
- this.name = this.stringify.name(name);
- this.type = NodeType.NotationDeclaration;
- if (value.pubID != null) {
- this.pubID = this.stringify.dtdPubID(value.pubID);
- }
- if (value.sysID != null) {
- this.sysID = this.stringify.dtdSysID(value.sysID);
- }
- }
- Object.defineProperty(XMLDTDNotation.prototype, 'publicId', {
- get: function() {
- return this.pubID;
- }
- });
- Object.defineProperty(XMLDTDNotation.prototype, 'systemId', {
- get: function() {
- return this.sysID;
- }
- });
- XMLDTDNotation.prototype.toString = function(options) {
- return this.options.writer.dtdNotation(this, this.options.writer.filterOptions(options));
- };
- return XMLDTDNotation;
- })(XMLNode);
- }).call(this);
- },{"./NodeType":360,"./XMLNode":382}],375:[function(require,module,exports){
- // Generated by CoffeeScript 1.12.7
- (function() {
- var NodeType, XMLDeclaration, XMLNode, isObject,
- 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; },
- hasProp = {}.hasOwnProperty;
- isObject = require('./Utility').isObject;
- XMLNode = require('./XMLNode');
- NodeType = require('./NodeType');
- module.exports = XMLDeclaration = (function(superClass) {
- extend(XMLDeclaration, superClass);
- function XMLDeclaration(parent, version, encoding, standalone) {
- var ref;
- XMLDeclaration.__super__.constructor.call(this, parent);
- if (isObject(version)) {
- ref = version, version = ref.version, encoding = ref.encoding, standalone = ref.standalone;
- }
- if (!version) {
- version = '1.0';
- }
- this.type = NodeType.Declaration;
- this.version = this.stringify.xmlVersion(version);
- if (encoding != null) {
- this.encoding = this.stringify.xmlEncoding(encoding);
- }
- if (standalone != null) {
- this.standalone = this.stringify.xmlStandalone(standalone);
- }
- }
- XMLDeclaration.prototype.toString = function(options) {
- return this.options.writer.declaration(this, this.options.writer.filterOptions(options));
- };
- return XMLDeclaration;
- })(XMLNode);
- }).call(this);
- },{"./NodeType":360,"./Utility":361,"./XMLNode":382}],376:[function(require,module,exports){
- // Generated by CoffeeScript 1.12.7
- (function() {
- var NodeType, XMLDTDAttList, XMLDTDElement, XMLDTDEntity, XMLDTDNotation, XMLDocType, XMLNamedNodeMap, XMLNode, isObject,
- 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; },
- hasProp = {}.hasOwnProperty;
- isObject = require('./Utility').isObject;
- XMLNode = require('./XMLNode');
- NodeType = require('./NodeType');
- XMLDTDAttList = require('./XMLDTDAttList');
- XMLDTDEntity = require('./XMLDTDEntity');
- XMLDTDElement = require('./XMLDTDElement');
- XMLDTDNotation = require('./XMLDTDNotation');
- XMLNamedNodeMap = require('./XMLNamedNodeMap');
- module.exports = XMLDocType = (function(superClass) {
- extend(XMLDocType, superClass);
- function XMLDocType(parent, pubID, sysID) {
- var child, i, len, ref, ref1, ref2;
- XMLDocType.__super__.constructor.call(this, parent);
- this.type = NodeType.DocType;
- if (parent.children) {
- ref = parent.children;
- for (i = 0, len = ref.length; i < len; i++) {
- child = ref[i];
- if (child.type === NodeType.Element) {
- this.name = child.name;
- break;
- }
- }
- }
- this.documentObject = parent;
- if (isObject(pubID)) {
- ref1 = pubID, pubID = ref1.pubID, sysID = ref1.sysID;
- }
- if (sysID == null) {
- ref2 = [pubID, sysID], sysID = ref2[0], pubID = ref2[1];
- }
- if (pubID != null) {
- this.pubID = this.stringify.dtdPubID(pubID);
- }
- if (sysID != null) {
- this.sysID = this.stringify.dtdSysID(sysID);
- }
- }
- Object.defineProperty(XMLDocType.prototype, 'entities', {
- get: function() {
- var child, i, len, nodes, ref;
- nodes = {};
- ref = this.children;
- for (i = 0, len = ref.length; i < len; i++) {
- child = ref[i];
- if ((child.type === NodeType.EntityDeclaration) && !child.pe) {
- nodes[child.name] = child;
- }
- }
- return new XMLNamedNodeMap(nodes);
- }
- });
- Object.defineProperty(XMLDocType.prototype, 'notations', {
- get: function() {
- var child, i, len, nodes, ref;
- nodes = {};
- ref = this.children;
- for (i = 0, len = ref.length; i < len; i++) {
- child = ref[i];
- if (child.type === NodeType.NotationDeclaration) {
- nodes[child.name] = child;
- }
- }
- return new XMLNamedNodeMap(nodes);
- }
- });
- Object.defineProperty(XMLDocType.prototype, 'publicId', {
- get: function() {
- return this.pubID;
- }
- });
- Object.defineProperty(XMLDocType.prototype, 'systemId', {
- get: function() {
- return this.sysID;
- }
- });
- Object.defineProperty(XMLDocType.prototype, 'internalSubset', {
- get: function() {
- throw new Error("This DOM method is not implemented." + this.debugInfo());
- }
- });
- XMLDocType.prototype.element = function(name, value) {
- var child;
- child = new XMLDTDElement(this, name, value);
- this.children.push(child);
- return this;
- };
- XMLDocType.prototype.attList = function(elementName, attributeName, attributeType, defaultValueType, defaultValue) {
- var child;
- child = new XMLDTDAttList(this, elementName, attributeName, attributeType, defaultValueType, defaultValue);
- this.children.push(child);
- return this;
- };
- XMLDocType.prototype.entity = function(name, value) {
- var child;
- child = new XMLDTDEntity(this, false, name, value);
- this.children.push(child);
- return this;
- };
- XMLDocType.prototype.pEntity = function(name, value) {
- var child;
- child = new XMLDTDEntity(this, true, name, value);
- this.children.push(child);
- return this;
- };
- XMLDocType.prototype.notation = function(name, value) {
- var child;
- child = new XMLDTDNotation(this, name, value);
- this.children.push(child);
- return this;
- };
- XMLDocType.prototype.toString = function(options) {
- return this.options.writer.docType(this, this.options.writer.filterOptions(options));
- };
- XMLDocType.prototype.ele = function(name, value) {
- return this.element(name, value);
- };
- XMLDocType.prototype.att = function(elementName, attributeName, attributeType, defaultValueType, defaultValue) {
- return this.attList(elementName, attributeName, attributeType, defaultValueType, defaultValue);
- };
- XMLDocType.prototype.ent = function(name, value) {
- return this.entity(name, value);
- };
- XMLDocType.prototype.pent = function(name, value) {
- return this.pEntity(name, value);
- };
- XMLDocType.prototype.not = function(name, value) {
- return this.notation(name, value);
- };
- XMLDocType.prototype.up = function() {
- return this.root() || this.documentObject;
- };
- XMLDocType.prototype.isEqualNode = function(node) {
- if (!XMLDocType.__super__.isEqualNode.apply(this, arguments).isEqualNode(node)) {
- return false;
- }
- if (node.name !== this.name) {
- return false;
- }
- if (node.publicId !== this.publicId) {
- return false;
- }
- if (node.systemId !== this.systemId) {
- return false;
- }
- return true;
- };
- return XMLDocType;
- })(XMLNode);
- }).call(this);
- },{"./NodeType":360,"./Utility":361,"./XMLDTDAttList":371,"./XMLDTDElement":372,"./XMLDTDEntity":373,"./XMLDTDNotation":374,"./XMLNamedNodeMap":381,"./XMLNode":382}],377:[function(require,module,exports){
- // Generated by CoffeeScript 1.12.7
- (function() {
- var NodeType, XMLDOMConfiguration, XMLDOMImplementation, XMLDocument, XMLNode, XMLStringWriter, XMLStringifier, isPlainObject,
- 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; },
- hasProp = {}.hasOwnProperty;
- isPlainObject = require('./Utility').isPlainObject;
- XMLDOMImplementation = require('./XMLDOMImplementation');
- XMLDOMConfiguration = require('./XMLDOMConfiguration');
- XMLNode = require('./XMLNode');
- NodeType = require('./NodeType');
- XMLStringifier = require('./XMLStringifier');
- XMLStringWriter = require('./XMLStringWriter');
- module.exports = XMLDocument = (function(superClass) {
- extend(XMLDocument, superClass);
- function XMLDocument(options) {
- XMLDocument.__super__.constructor.call(this, null);
- this.name = "#document";
- this.type = NodeType.Document;
- this.documentURI = null;
- this.domConfig = new XMLDOMConfiguration();
- options || (options = {});
- if (!options.writer) {
- options.writer = new XMLStringWriter();
- }
- this.options = options;
- this.stringify = new XMLStringifier(options);
- }
- Object.defineProperty(XMLDocument.prototype, 'implementation', {
- value: new XMLDOMImplementation()
- });
- Object.defineProperty(XMLDocument.prototype, 'doctype', {
- get: function() {
- var child, i, len, ref;
- ref = this.children;
- for (i = 0, len = ref.length; i < len; i++) {
- child = ref[i];
- if (child.type === NodeType.DocType) {
- return child;
- }
- }
- return null;
- }
- });
- Object.defineProperty(XMLDocument.prototype, 'documentElement', {
- get: function() {
- return this.rootObject || null;
- }
- });
- Object.defineProperty(XMLDocument.prototype, 'inputEncoding', {
- get: function() {
- return null;
- }
- });
- Object.defineProperty(XMLDocument.prototype, 'strictErrorChecking', {
- get: function() {
- return false;
- }
- });
- Object.defineProperty(XMLDocument.prototype, 'xmlEncoding', {
- get: function() {
- if (this.children.length !== 0 && this.children[0].type === NodeType.Declaration) {
- return this.children[0].encoding;
- } else {
- return null;
- }
- }
- });
- Object.defineProperty(XMLDocument.prototype, 'xmlStandalone', {
- get: function() {
- if (this.children.length !== 0 && this.children[0].type === NodeType.Declaration) {
- return this.children[0].standalone === 'yes';
- } else {
- return false;
- }
- }
- });
- Object.defineProperty(XMLDocument.prototype, 'xmlVersion', {
- get: function() {
- if (this.children.length !== 0 && this.children[0].type === NodeType.Declaration) {
- return this.children[0].version;
- } else {
- return "1.0";
- }
- }
- });
- Object.defineProperty(XMLDocument.prototype, 'URL', {
- get: function() {
- return this.documentURI;
- }
- });
- Object.defineProperty(XMLDocument.prototype, 'origin', {
- get: function() {
- return null;
- }
- });
- Object.defineProperty(XMLDocument.prototype, 'compatMode', {
- get: function() {
- return null;
- }
- });
- Object.defineProperty(XMLDocument.prototype, 'characterSet', {
- get: function() {
- return null;
- }
- });
- Object.defineProperty(XMLDocument.prototype, 'contentType', {
- get: function() {
- return null;
- }
- });
- XMLDocument.prototype.end = function(writer) {
- var writerOptions;
- writerOptions = {};
- if (!writer) {
- writer = this.options.writer;
- } else if (isPlainObject(writer)) {
- writerOptions = writer;
- writer = this.options.writer;
- }
- return writer.document(this, writer.filterOptions(writerOptions));
- };
- XMLDocument.prototype.toString = function(options) {
- return this.options.writer.document(this, this.options.writer.filterOptions(options));
- };
- XMLDocument.prototype.createElement = function(tagName) {
- throw new Error("This DOM method is not implemented." + this.debugInfo());
- };
- XMLDocument.prototype.createDocumentFragment = function() {
- throw new Error("This DOM method is not implemented." + this.debugInfo());
- };
- XMLDocument.prototype.createTextNode = function(data) {
- throw new Error("This DOM method is not implemented." + this.debugInfo());
- };
- XMLDocument.prototype.createComment = function(data) {
- throw new Error("This DOM method is not implemented." + this.debugInfo());
- };
- XMLDocument.prototype.createCDATASection = function(data) {
- throw new Error("This DOM method is not implemented." + this.debugInfo());
- };
- XMLDocument.prototype.createProcessingInstruction = function(target, data) {
- throw new Error("This DOM method is not implemented." + this.debugInfo());
- };
- XMLDocument.prototype.createAttribute = function(name) {
- throw new Error("This DOM method is not implemented." + this.debugInfo());
- };
- XMLDocument.prototype.createEntityReference = function(name) {
- throw new Error("This DOM method is not implemented." + this.debugInfo());
- };
- XMLDocument.prototype.getElementsByTagName = function(tagname) {
- throw new Error("This DOM method is not implemented." + this.debugInfo());
- };
- XMLDocument.prototype.importNode = function(importedNode, deep) {
- throw new Error("This DOM method is not implemented." + this.debugInfo());
- };
- XMLDocument.prototype.createElementNS = function(namespaceURI, qualifiedName) {
- throw new Error("This DOM method is not implemented." + this.debugInfo());
- };
- XMLDocument.prototype.createAttributeNS = function(namespaceURI, qualifiedName) {
- throw new Error("This DOM method is not implemented." + this.debugInfo());
- };
- XMLDocument.prototype.getElementsByTagNameNS = function(namespaceURI, localName) {
- throw new Error("This DOM method is not implemented." + this.debugInfo());
- };
- XMLDocument.prototype.getElementById = function(elementId) {
- throw new Error("This DOM method is not implemented." + this.debugInfo());
- };
- XMLDocument.prototype.adoptNode = function(source) {
- throw new Error("This DOM method is not implemented." + this.debugInfo());
- };
- XMLDocument.prototype.normalizeDocument = function() {
- throw new Error("This DOM method is not implemented." + this.debugInfo());
- };
- XMLDocument.prototype.renameNode = function(node, namespaceURI, qualifiedName) {
- throw new Error("This DOM method is not implemented." + this.debugInfo());
- };
- XMLDocument.prototype.getElementsByClassName = function(classNames) {
- throw new Error("This DOM method is not implemented." + this.debugInfo());
- };
- XMLDocument.prototype.createEvent = function(eventInterface) {
- throw new Error("This DOM method is not implemented." + this.debugInfo());
- };
- XMLDocument.prototype.createRange = function() {
- throw new Error("This DOM method is not implemented." + this.debugInfo());
- };
- XMLDocument.prototype.createNodeIterator = function(root, whatToShow, filter) {
- throw new Error("This DOM method is not implemented." + this.debugInfo());
- };
- XMLDocument.prototype.createTreeWalker = function(root, whatToShow, filter) {
- throw new Error("This DOM method is not implemented." + this.debugInfo());
- };
- return XMLDocument;
- })(XMLNode);
- }).call(this);
- },{"./NodeType":360,"./Utility":361,"./XMLDOMConfiguration":367,"./XMLDOMImplementation":369,"./XMLNode":382,"./XMLStringWriter":387,"./XMLStringifier":388}],378:[function(require,module,exports){
- // Generated by CoffeeScript 1.12.7
- (function() {
- 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,
- hasProp = {}.hasOwnProperty;
- ref = require('./Utility'), isObject = ref.isObject, isFunction = ref.isFunction, isPlainObject = ref.isPlainObject, getValue = ref.getValue;
- NodeType = require('./NodeType');
- XMLDocument = require('./XMLDocument');
- XMLElement = require('./XMLElement');
- XMLCData = require('./XMLCData');
- XMLComment = require('./XMLComment');
- XMLRaw = require('./XMLRaw');
- XMLText = require('./XMLText');
- XMLProcessingInstruction = require('./XMLProcessingInstruction');
- XMLDeclaration = require('./XMLDeclaration');
- XMLDocType = require('./XMLDocType');
- XMLDTDAttList = require('./XMLDTDAttList');
- XMLDTDEntity = require('./XMLDTDEntity');
- XMLDTDElement = require('./XMLDTDElement');
- XMLDTDNotation = require('./XMLDTDNotation');
- XMLAttribute = require('./XMLAttribute');
- XMLStringifier = require('./XMLStringifier');
- XMLStringWriter = require('./XMLStringWriter');
- WriterState = require('./WriterState');
- module.exports = XMLDocumentCB = (function() {
- function XMLDocumentCB(options, onData, onEnd) {
- var writerOptions;
- this.name = "?xml";
- this.type = NodeType.Document;
- options || (options = {});
- writerOptions = {};
- if (!options.writer) {
- options.writer = new XMLStringWriter();
- } else if (isPlainObject(options.writer)) {
- writerOptions = options.writer;
- options.writer = new XMLStringWriter();
- }
- this.options = options;
- this.writer = options.writer;
- this.writerOptions = this.writer.filterOptions(writerOptions);
- this.stringify = new XMLStringifier(options);
- this.onDataCallback = onData || function() {};
- this.onEndCallback = onEnd || function() {};
- this.currentNode = null;
- this.currentLevel = -1;
- this.openTags = {};
- this.documentStarted = false;
- this.documentCompleted = false;
- this.root = null;
- }
- XMLDocumentCB.prototype.createChildNode = function(node) {
- var att, attName, attributes, child, i, len, ref1, ref2;
- switch (node.type) {
- case NodeType.CData:
- this.cdata(node.value);
- break;
- case NodeType.Comment:
- this.comment(node.value);
- break;
- case NodeType.Element:
- attributes = {};
- ref1 = node.attribs;
- for (attName in ref1) {
- if (!hasProp.call(ref1, attName)) continue;
- att = ref1[attName];
- attributes[attName] = att.value;
- }
- this.node(node.name, attributes);
- break;
- case NodeType.Dummy:
- this.dummy();
- break;
- case NodeType.Raw:
- this.raw(node.value);
- break;
- case NodeType.Text:
- this.text(node.value);
- break;
- case NodeType.ProcessingInstruction:
- this.instruction(node.target, node.value);
- break;
- default:
- throw new Error("This XML node type is not supported in a JS object: " + node.constructor.name);
- }
- ref2 = node.children;
- for (i = 0, len = ref2.length; i < len; i++) {
- child = ref2[i];
- this.createChildNode(child);
- if (child.type === NodeType.Element) {
- this.up();
- }
- }
- return this;
- };
- XMLDocumentCB.prototype.dummy = function() {
- return this;
- };
- XMLDocumentCB.prototype.node = function(name, attributes, text) {
- var ref1;
- if (name == null) {
- throw new Error("Missing node name.");
- }
- if (this.root && this.currentLevel === -1) {
- throw new Error("Document can only have one root node. " + this.debugInfo(name));
- }
- this.openCurrent();
- name = getValue(name);
- if (attributes == null) {
- attributes = {};
- }
- attributes = getValue(attributes);
- if (!isObject(attributes)) {
- ref1 = [attributes, text], text = ref1[0], attributes = ref1[1];
- }
- this.currentNode = new XMLElement(this, name, attributes);
- this.currentNode.children = false;
- this.currentLevel++;
- this.openTags[this.currentLevel] = this.currentNode;
- if (text != null) {
- this.text(text);
- }
- return this;
- };
- XMLDocumentCB.prototype.element = function(name, attributes, text) {
- var child, i, len, oldValidationFlag, ref1, root;
- if (this.currentNode && this.currentNode.type === NodeType.DocType) {
- this.dtdElement.apply(this, arguments);
- } else {
- if (Array.isArray(name) || isObject(name) || isFunction(name)) {
- oldValidationFlag = this.options.noValidation;
- this.options.noValidation = true;
- root = new XMLDocument(this.options).element('TEMP_ROOT');
- root.element(name);
- this.options.noValidation = oldValidationFlag;
- ref1 = root.children;
- for (i = 0, len = ref1.length; i < len; i++) {
- child = ref1[i];
- this.createChildNode(child);
- if (child.type === NodeType.Element) {
- this.up();
- }
- }
- } else {
- this.node(name, attributes, text);
- }
- }
- return this;
- };
- XMLDocumentCB.prototype.attribute = function(name, value) {
- var attName, attValue;
- if (!this.currentNode || this.currentNode.children) {
- throw new Error("att() can only be used immediately after an ele() call in callback mode. " + this.debugInfo(name));
- }
- if (name != null) {
- name = getValue(name);
- }
- if (isObject(name)) {
- for (attName in name) {
- if (!hasProp.call(name, attName)) continue;
- attValue = name[attName];
- this.attribute(attName, attValue);
- }
- } else {
- if (isFunction(value)) {
- value = value.apply();
- }
- if (this.options.keepNullAttributes && (value == null)) {
- this.currentNode.attribs[name] = new XMLAttribute(this, name, "");
- } else if (value != null) {
- this.currentNode.attribs[name] = new XMLAttribute(this, name, value);
- }
- }
- return this;
- };
- XMLDocumentCB.prototype.text = function(value) {
- var node;
- this.openCurrent();
- node = new XMLText(this, value);
- this.onData(this.writer.text(node, this.writerOptions, this.currentLevel + 1), this.currentLevel + 1);
- return this;
- };
- XMLDocumentCB.prototype.cdata = function(value) {
- var node;
- this.openCurrent();
- node = new XMLCData(this, value);
- this.onData(this.writer.cdata(node, this.writerOptions, this.currentLevel + 1), this.currentLevel + 1);
- return this;
- };
- XMLDocumentCB.prototype.comment = function(value) {
- var node;
- this.openCurrent();
- node = new XMLComment(this, value);
- this.onData(this.writer.comment(node, this.writerOptions, this.currentLevel + 1), this.currentLevel + 1);
- return this;
- };
- XMLDocumentCB.prototype.raw = function(value) {
- var node;
- this.openCurrent();
- node = new XMLRaw(this, value);
- this.onData(this.writer.raw(node, this.writerOptions, this.currentLevel + 1), this.currentLevel + 1);
- return this;
- };
- XMLDocumentCB.prototype.instruction = function(target, value) {
- var i, insTarget, insValue, len, node;
- this.openCurrent();
- if (target != null) {
- target = getValue(target);
- }
- if (value != null) {
- value = getValue(value);
- }
- if (Array.isArray(target)) {
- for (i = 0, len = target.length; i < len; i++) {
- insTarget = target[i];
- this.instruction(insTarget);
- }
- } else if (isObject(target)) {
- for (insTarget in target) {
- if (!hasProp.call(target, insTarget)) continue;
- insValue = target[insTarget];
- this.instruction(insTarget, insValue);
- }
- } else {
- if (isFunction(value)) {
- value = value.apply();
- }
- node = new XMLProcessingInstruction(this, target, value);
- this.onData(this.writer.processingInstruction(node, this.writerOptions, this.currentLevel + 1), this.currentLevel + 1);
- }
- return this;
- };
- XMLDocumentCB.prototype.declaration = function(version, encoding, standalone) {
- var node;
- this.openCurrent();
- if (this.documentStarted) {
- throw new Error("declaration() must be the first node.");
- }
- node = new XMLDeclaration(this, version, encoding, standalone);
- this.onData(this.writer.declaration(node, this.writerOptions, this.currentLevel + 1), this.currentLevel + 1);
- return this;
- };
- XMLDocumentCB.prototype.doctype = function(root, pubID, sysID) {
- this.openCurrent();
- if (root == null) {
- throw new Error("Missing root node name.");
- }
- if (this.root) {
- throw new Error("dtd() must come before the root node.");
- }
- this.currentNode = new XMLDocType(this, pubID, sysID);
- this.currentNode.rootNodeName = root;
- this.currentNode.children = false;
- this.currentLevel++;
- this.openTags[this.currentLevel] = this.currentNode;
- return this;
- };
- XMLDocumentCB.prototype.dtdElement = function(name, value) {
- var node;
- this.openCurrent();
- node = new XMLDTDElement(this, name, value);
- this.onData(this.writer.dtdElement(node, this.writerOptions, this.currentLevel + 1), this.currentLevel + 1);
- return this;
- };
- XMLDocumentCB.prototype.attList = function(elementName, attributeName, attributeType, defaultValueType, defaultValue) {
- var node;
- this.openCurrent();
- node = new XMLDTDAttList(this, elementName, attributeName, attributeType, defaultValueType, defaultValue);
- this.onData(this.writer.dtdAttList(node, this.writerOptions, this.currentLevel + 1), this.currentLevel + 1);
- return this;
- };
- XMLDocumentCB.prototype.entity = function(name, value) {
- var node;
- this.openCurrent();
- node = new XMLDTDEntity(this, false, name, value);
- this.onData(this.writer.dtdEntity(node, this.writerOptions, this.currentLevel + 1), this.currentLevel + 1);
- return this;
- };
- XMLDocumentCB.prototype.pEntity = function(name, value) {
- var node;
- this.openCurrent();
- node = new XMLDTDEntity(this, true, name, value);
- this.onData(this.writer.dtdEntity(node, this.writerOptions, this.currentLevel + 1), this.currentLevel + 1);
- return this;
- };
- XMLDocumentCB.prototype.notation = function(name, value) {
- var node;
- this.openCurrent();
- node = new XMLDTDNotation(this, name, value);
- this.onData(this.writer.dtdNotation(node, this.writerOptions, this.currentLevel + 1), this.currentLevel + 1);
- return this;
- };
- XMLDocumentCB.prototype.up = function() {
- if (this.currentLevel < 0) {
- throw new Error("The document node has no parent.");
- }
- if (this.currentNode) {
- if (this.currentNode.children) {
- this.closeNode(this.currentNode);
- } else {
- this.openNode(this.currentNode);
- }
- this.currentNode = null;
- } else {
- this.closeNode(this.openTags[this.currentLevel]);
- }
- delete this.openTags[this.currentLevel];
- this.currentLevel--;
- return this;
- };
- XMLDocumentCB.prototype.end = function() {
- while (this.currentLevel >= 0) {
- this.up();
- }
- return this.onEnd();
- };
- XMLDocumentCB.prototype.openCurrent = function() {
- if (this.currentNode) {
- this.currentNode.children = true;
- return this.openNode(this.currentNode);
- }
- };
- XMLDocumentCB.prototype.openNode = function(node) {
- var att, chunk, name, ref1;
- if (!node.isOpen) {
- if (!this.root && this.currentLevel === 0 && node.type === NodeType.Element) {
- this.root = node;
- }
- chunk = '';
- if (node.type === NodeType.Element) {
- this.writerOptions.state = WriterState.OpenTag;
- chunk = this.writer.indent(node, this.writerOptions, this.currentLevel) + '<' + node.name;
- ref1 = node.attribs;
- for (name in ref1) {
- if (!hasProp.call(ref1, name)) continue;
- att = ref1[name];
- chunk += this.writer.attribute(att, this.writerOptions, this.currentLevel);
- }
- chunk += (node.children ? '>' : '/>') + this.writer.endline(node, this.writerOptions, this.currentLevel);
- this.writerOptions.state = WriterState.InsideTag;
- } else {
- this.writerOptions.state = WriterState.OpenTag;
- chunk = this.writer.indent(node, this.writerOptions, this.currentLevel) + '<!DOCTYPE ' + node.rootNodeName;
- if (node.pubID && node.sysID) {
- chunk += ' PUBLIC "' + node.pubID + '" "' + node.sysID + '"';
- } else if (node.sysID) {
- chunk += ' SYSTEM "' + node.sysID + '"';
- }
- if (node.children) {
- chunk += ' [';
- this.writerOptions.state = WriterState.InsideTag;
- } else {
- this.writerOptions.state = WriterState.CloseTag;
- chunk += '>';
- }
- chunk += this.writer.endline(node, this.writerOptions, this.currentLevel);
- }
- this.onData(chunk, this.currentLevel);
- return node.isOpen = true;
- }
- };
- XMLDocumentCB.prototype.closeNode = function(node) {
- var chunk;
- if (!node.isClosed) {
- chunk = '';
- this.writerOptions.state = WriterState.CloseTag;
- if (node.type === NodeType.Element) {
- chunk = this.writer.indent(node, this.writerOptions, this.currentLevel) + '</' + node.name + '>' + this.writer.endline(node, this.writerOptions, this.currentLevel);
- } else {
- chunk = this.writer.indent(node, this.writerOptions, this.currentLevel) + ']>' + this.writer.endline(node, this.writerOptions, this.currentLevel);
- }
- this.writerOptions.state = WriterState.None;
- this.onData(chunk, this.currentLevel);
- return node.isClosed = true;
- }
- };
- XMLDocumentCB.prototype.onData = function(chunk, level) {
- this.documentStarted = true;
- return this.onDataCallback(chunk, level + 1);
- };
- XMLDocumentCB.prototype.onEnd = function() {
- this.documentCompleted = true;
- return this.onEndCallback();
- };
- XMLDocumentCB.prototype.debugInfo = function(name) {
- if (name == null) {
- return "";
- } else {
- return "node: <" + name + ">";
- }
- };
- XMLDocumentCB.prototype.ele = function() {
- return this.element.apply(this, arguments);
- };
- XMLDocumentCB.prototype.nod = function(name, attributes, text) {
- return this.node(name, attributes, text);
- };
- XMLDocumentCB.prototype.txt = function(value) {
- return this.text(value);
- };
- XMLDocumentCB.prototype.dat = function(value) {
- return this.cdata(value);
- };
- XMLDocumentCB.prototype.com = function(value) {
- return this.comment(value);
- };
- XMLDocumentCB.prototype.ins = function(target, value) {
- return this.instruction(target, value);
- };
- XMLDocumentCB.prototype.dec = function(version, encoding, standalone) {
- return this.declaration(version, encoding, standalone);
- };
- XMLDocumentCB.prototype.dtd = function(root, pubID, sysID) {
- return this.doctype(root, pubID, sysID);
- };
- XMLDocumentCB.prototype.e = function(name, attributes, text) {
- return this.element(name, attributes, text);
- };
- XMLDocumentCB.prototype.n = function(name, attributes, text) {
- return this.node(name, attributes, text);
- };
- XMLDocumentCB.prototype.t = function(value) {
- return this.text(value);
- };
- XMLDocumentCB.prototype.d = function(value) {
- return this.cdata(value);
- };
- XMLDocumentCB.prototype.c = function(value) {
- return this.comment(value);
- };
- XMLDocumentCB.prototype.r = function(value) {
- return this.raw(value);
- };
- XMLDocumentCB.prototype.i = function(target, value) {
- return this.instruction(target, value);
- };
- XMLDocumentCB.prototype.att = function() {
- if (this.currentNode && this.currentNode.type === NodeType.DocType) {
- return this.attList.apply(this, arguments);
- } else {
- return this.attribute.apply(this, arguments);
- }
- };
- XMLDocumentCB.prototype.a = function() {
- if (this.currentNode && this.currentNode.type === NodeType.DocType) {
- return this.attList.apply(this, arguments);
- } else {
- return this.attribute.apply(this, arguments);
- }
- };
- XMLDocumentCB.prototype.ent = function(name, value) {
- return this.entity(name, value);
- };
- XMLDocumentCB.prototype.pent = function(name, value) {
- return this.pEntity(name, value);
- };
- XMLDocumentCB.prototype.not = function(name, value) {
- return this.notation(name, value);
- };
- return XMLDocumentCB;
- })();
- }).call(this);
- },{"./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){
- // Generated by CoffeeScript 1.12.7
- (function() {
- var NodeType, XMLDummy, XMLNode,
- 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; },
- hasProp = {}.hasOwnProperty;
- XMLNode = require('./XMLNode');
- NodeType = require('./NodeType');
- module.exports = XMLDummy = (function(superClass) {
- extend(XMLDummy, superClass);
- function XMLDummy(parent) {
- XMLDummy.__super__.constructor.call(this, parent);
- this.type = NodeType.Dummy;
- }
- XMLDummy.prototype.clone = function() {
- return Object.create(this);
- };
- XMLDummy.prototype.toString = function(options) {
- return '';
- };
- return XMLDummy;
- })(XMLNode);
- }).call(this);
- },{"./NodeType":360,"./XMLNode":382}],380:[function(require,module,exports){
- // Generated by CoffeeScript 1.12.7
- (function() {
- var NodeType, XMLAttribute, XMLElement, XMLNamedNodeMap, XMLNode, getValue, isFunction, isObject, ref,
- 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; },
- hasProp = {}.hasOwnProperty;
- ref = require('./Utility'), isObject = ref.isObject, isFunction = ref.isFunction, getValue = ref.getValue;
- XMLNode = require('./XMLNode');
- NodeType = require('./NodeType');
- XMLAttribute = require('./XMLAttribute');
- XMLNamedNodeMap = require('./XMLNamedNodeMap');
- module.exports = XMLElement = (function(superClass) {
- extend(XMLElement, superClass);
- function XMLElement(parent, name, attributes) {
- var child, j, len, ref1;
- XMLElement.__super__.constructor.call(this, parent);
- if (name == null) {
- throw new Error("Missing element name. " + this.debugInfo());
- }
- this.name = this.stringify.name(name);
- this.type = NodeType.Element;
- this.attribs = {};
- this.schemaTypeInfo = null;
- if (attributes != null) {
- this.attribute(attributes);
- }
- if (parent.type === NodeType.Document) {
- this.isRoot = true;
- this.documentObject = parent;
- parent.rootObject = this;
- if (parent.children) {
- ref1 = parent.children;
- for (j = 0, len = ref1.length; j < len; j++) {
- child = ref1[j];
- if (child.type === NodeType.DocType) {
- child.name = this.name;
- break;
- }
- }
- }
- }
- }
- Object.defineProperty(XMLElement.prototype, 'tagName', {
- get: function() {
- return this.name;
- }
- });
- Object.defineProperty(XMLElement.prototype, 'namespaceURI', {
- get: function() {
- return '';
- }
- });
- Object.defineProperty(XMLElement.prototype, 'prefix', {
- get: function() {
- return '';
- }
- });
- Object.defineProperty(XMLElement.prototype, 'localName', {
- get: function() {
- return this.name;
- }
- });
- Object.defineProperty(XMLElement.prototype, 'id', {
- get: function() {
- throw new Error("This DOM method is not implemented." + this.debugInfo());
- }
- });
- Object.defineProperty(XMLElement.prototype, 'className', {
- get: function() {
- throw new Error("This DOM method is not implemented." + this.debugInfo());
- }
- });
- Object.defineProperty(XMLElement.prototype, 'classList', {
- get: function() {
- throw new Error("This DOM method is not implemented." + this.debugInfo());
- }
- });
- Object.defineProperty(XMLElement.prototype, 'attributes', {
- get: function() {
- if (!this.attributeMap || !this.attributeMap.nodes) {
- this.attributeMap = new XMLNamedNodeMap(this.attribs);
- }
- return this.attributeMap;
- }
- });
- XMLElement.prototype.clone = function() {
- var att, attName, clonedSelf, ref1;
- clonedSelf = Object.create(this);
- if (clonedSelf.isRoot) {
- clonedSelf.documentObject = null;
- }
- clonedSelf.attribs = {};
- ref1 = this.attribs;
- for (attName in ref1) {
- if (!hasProp.call(ref1, attName)) continue;
- att = ref1[attName];
- clonedSelf.attribs[attName] = att.clone();
- }
- clonedSelf.children = [];
- this.children.forEach(function(child) {
- var clonedChild;
- clonedChild = child.clone();
- clonedChild.parent = clonedSelf;
- return clonedSelf.children.push(clonedChild);
- });
- return clonedSelf;
- };
- XMLElement.prototype.attribute = function(name, value) {
- var attName, attValue;
- if (name != null) {
- name = getValue(name);
- }
- if (isObject(name)) {
- for (attName in name) {
- if (!hasProp.call(name, attName)) continue;
- attValue = name[attName];
- this.attribute(attName, attValue);
- }
- } else {
- if (isFunction(value)) {
- value = value.apply();
- }
- if (this.options.keepNullAttributes && (value == null)) {
- this.attribs[name] = new XMLAttribute(this, name, "");
- } else if (value != null) {
- this.attribs[name] = new XMLAttribute(this, name, value);
- }
- }
- return this;
- };
- XMLElement.prototype.removeAttribute = function(name) {
- var attName, j, len;
- if (name == null) {
- throw new Error("Missing attribute name. " + this.debugInfo());
- }
- name = getValue(name);
- if (Array.isArray(name)) {
- for (j = 0, len = name.length; j < len; j++) {
- attName = name[j];
- delete this.attribs[attName];
- }
- } else {
- delete this.attribs[name];
- }
- return this;
- };
- XMLElement.prototype.toString = function(options) {
- return this.options.writer.element(this, this.options.writer.filterOptions(options));
- };
- XMLElement.prototype.att = function(name, value) {
- return this.attribute(name, value);
- };
- XMLElement.prototype.a = function(name, value) {
- return this.attribute(name, value);
- };
- XMLElement.prototype.getAttribute = function(name) {
- if (this.attribs.hasOwnProperty(name)) {
- return this.attribs[name].value;
- } else {
- return null;
- }
- };
- XMLElement.prototype.setAttribute = function(name, value) {
- throw new Error("This DOM method is not implemented." + this.debugInfo());
- };
- XMLElement.prototype.getAttributeNode = function(name) {
- if (this.attribs.hasOwnProperty(name)) {
- return this.attribs[name];
- } else {
- return null;
- }
- };
- XMLElement.prototype.setAttributeNode = function(newAttr) {
- throw new Error("This DOM method is not implemented." + this.debugInfo());
- };
- XMLElement.prototype.removeAttributeNode = function(oldAttr) {
- throw new Error("This DOM method is not implemented." + this.debugInfo());
- };
- XMLElement.prototype.getElementsByTagName = function(name) {
- throw new Error("This DOM method is not implemented." + this.debugInfo());
- };
- XMLElement.prototype.getAttributeNS = function(namespaceURI, localName) {
- throw new Error("This DOM method is not implemented." + this.debugInfo());
- };
- XMLElement.prototype.setAttributeNS = function(namespaceURI, qualifiedName, value) {
- throw new Error("This DOM method is not implemented." + this.debugInfo());
- };
- XMLElement.prototype.removeAttributeNS = function(namespaceURI, localName) {
- throw new Error("This DOM method is not implemented." + this.debugInfo());
- };
- XMLElement.prototype.getAttributeNodeNS = function(namespaceURI, localName) {
- throw new Error("This DOM method is not implemented." + this.debugInfo());
- };
- XMLElement.prototype.setAttributeNodeNS = function(newAttr) {
- throw new Error("This DOM method is not implemented." + this.debugInfo());
- };
- XMLElement.prototype.getElementsByTagNameNS = function(namespaceURI, localName) {
- throw new Error("This DOM method is not implemented." + this.debugInfo());
- };
- XMLElement.prototype.hasAttribute = function(name) {
- return this.attribs.hasOwnProperty(name);
- };
- XMLElement.prototype.hasAttributeNS = function(namespaceURI, localName) {
- throw new Error("This DOM method is not implemented." + this.debugInfo());
- };
- XMLElement.prototype.setIdAttribute = function(name, isId) {
- if (this.attribs.hasOwnProperty(name)) {
- return this.attribs[name].isId;
- } else {
- return isId;
- }
- };
- XMLElement.prototype.setIdAttributeNS = function(namespaceURI, localName, isId) {
- throw new Error("This DOM method is not implemented." + this.debugInfo());
- };
- XMLElement.prototype.setIdAttributeNode = function(idAttr, isId) {
- throw new Error("This DOM method is not implemented." + this.debugInfo());
- };
- XMLElement.prototype.getElementsByTagName = function(tagname) {
- throw new Error("This DOM method is not implemented." + this.debugInfo());
- };
- XMLElement.prototype.getElementsByTagNameNS = function(namespaceURI, localName) {
- throw new Error("This DOM method is not implemented." + this.debugInfo());
- };
- XMLElement.prototype.getElementsByClassName = function(classNames) {
- throw new Error("This DOM method is not implemented." + this.debugInfo());
- };
- XMLElement.prototype.isEqualNode = function(node) {
- var i, j, ref1;
- if (!XMLElement.__super__.isEqualNode.apply(this, arguments).isEqualNode(node)) {
- return false;
- }
- if (node.namespaceURI !== this.namespaceURI) {
- return false;
- }
- if (node.prefix !== this.prefix) {
- return false;
- }
- if (node.localName !== this.localName) {
- return false;
- }
- if (node.attribs.length !== this.attribs.length) {
- return false;
- }
- for (i = j = 0, ref1 = this.attribs.length - 1; 0 <= ref1 ? j <= ref1 : j >= ref1; i = 0 <= ref1 ? ++j : --j) {
- if (!this.attribs[i].isEqualNode(node.attribs[i])) {
- return false;
- }
- }
- return true;
- };
- return XMLElement;
- })(XMLNode);
- }).call(this);
- },{"./NodeType":360,"./Utility":361,"./XMLAttribute":363,"./XMLNamedNodeMap":381,"./XMLNode":382}],381:[function(require,module,exports){
- // Generated by CoffeeScript 1.12.7
- (function() {
- var XMLNamedNodeMap;
- module.exports = XMLNamedNodeMap = (function() {
- function XMLNamedNodeMap(nodes) {
- this.nodes = nodes;
- }
- Object.defineProperty(XMLNamedNodeMap.prototype, 'length', {
- get: function() {
- return Object.keys(this.nodes).length || 0;
- }
- });
- XMLNamedNodeMap.prototype.clone = function() {
- return this.nodes = null;
- };
- XMLNamedNodeMap.prototype.getNamedItem = function(name) {
- return this.nodes[name];
- };
- XMLNamedNodeMap.prototype.setNamedItem = function(node) {
- var oldNode;
- oldNode = this.nodes[node.nodeName];
- this.nodes[node.nodeName] = node;
- return oldNode || null;
- };
- XMLNamedNodeMap.prototype.removeNamedItem = function(name) {
- var oldNode;
- oldNode = this.nodes[name];
- delete this.nodes[name];
- return oldNode || null;
- };
- XMLNamedNodeMap.prototype.item = function(index) {
- return this.nodes[Object.keys(this.nodes)[index]] || null;
- };
- XMLNamedNodeMap.prototype.getNamedItemNS = function(namespaceURI, localName) {
- throw new Error("This DOM method is not implemented.");
- };
- XMLNamedNodeMap.prototype.setNamedItemNS = function(node) {
- throw new Error("This DOM method is not implemented.");
- };
- XMLNamedNodeMap.prototype.removeNamedItemNS = function(namespaceURI, localName) {
- throw new Error("This DOM method is not implemented.");
- };
- return XMLNamedNodeMap;
- })();
- }).call(this);
- },{}],382:[function(require,module,exports){
- // Generated by CoffeeScript 1.12.7
- (function() {
- var DocumentPosition, NodeType, XMLCData, XMLComment, XMLDeclaration, XMLDocType, XMLDummy, XMLElement, XMLNamedNodeMap, XMLNode, XMLNodeList, XMLProcessingInstruction, XMLRaw, XMLText, getValue, isEmpty, isFunction, isObject, ref1,
- hasProp = {}.hasOwnProperty;
- ref1 = require('./Utility'), isObject = ref1.isObject, isFunction = ref1.isFunction, isEmpty = ref1.isEmpty, getValue = ref1.getValue;
- XMLElement = null;
- XMLCData = null;
- XMLComment = null;
- XMLDeclaration = null;
- XMLDocType = null;
- XMLRaw = null;
- XMLText = null;
- XMLProcessingInstruction = null;
- XMLDummy = null;
- NodeType = null;
- XMLNodeList = null;
- XMLNamedNodeMap = null;
- DocumentPosition = null;
- module.exports = XMLNode = (function() {
- function XMLNode(parent1) {
- this.parent = parent1;
- if (this.parent) {
- this.options = this.parent.options;
- this.stringify = this.parent.stringify;
- }
- this.value = null;
- this.children = [];
- this.baseURI = null;
- if (!XMLElement) {
- XMLElement = require('./XMLElement');
- XMLCData = require('./XMLCData');
- XMLComment = require('./XMLComment');
- XMLDeclaration = require('./XMLDeclaration');
- XMLDocType = require('./XMLDocType');
- XMLRaw = require('./XMLRaw');
- XMLText = require('./XMLText');
- XMLProcessingInstruction = require('./XMLProcessingInstruction');
- XMLDummy = require('./XMLDummy');
- NodeType = require('./NodeType');
- XMLNodeList = require('./XMLNodeList');
- XMLNamedNodeMap = require('./XMLNamedNodeMap');
- DocumentPosition = require('./DocumentPosition');
- }
- }
- Object.defineProperty(XMLNode.prototype, 'nodeName', {
- get: function() {
- return this.name;
- }
- });
- Object.defineProperty(XMLNode.prototype, 'nodeType', {
- get: function() {
- return this.type;
- }
- });
- Object.defineProperty(XMLNode.prototype, 'nodeValue', {
- get: function() {
- return this.value;
- }
- });
- Object.defineProperty(XMLNode.prototype, 'parentNode', {
- get: function() {
- return this.parent;
- }
- });
- Object.defineProperty(XMLNode.prototype, 'childNodes', {
- get: function() {
- if (!this.childNodeList || !this.childNodeList.nodes) {
- this.childNodeList = new XMLNodeList(this.children);
- }
- return this.childNodeList;
- }
- });
- Object.defineProperty(XMLNode.prototype, 'firstChild', {
- get: function() {
- return this.children[0] || null;
- }
- });
- Object.defineProperty(XMLNode.prototype, 'lastChild', {
- get: function() {
- return this.children[this.children.length - 1] || null;
- }
- });
- Object.defineProperty(XMLNode.prototype, 'previousSibling', {
- get: function() {
- var i;
- i = this.parent.children.indexOf(this);
- return this.parent.children[i - 1] || null;
- }
- });
- Object.defineProperty(XMLNode.prototype, 'nextSibling', {
- get: function() {
- var i;
- i = this.parent.children.indexOf(this);
- return this.parent.children[i + 1] || null;
- }
- });
- Object.defineProperty(XMLNode.prototype, 'ownerDocument', {
- get: function() {
- return this.document() || null;
- }
- });
- Object.defineProperty(XMLNode.prototype, 'textContent', {
- get: function() {
- var child, j, len, ref2, str;
- if (this.nodeType === NodeType.Element || this.nodeType === NodeType.DocumentFragment) {
- str = '';
- ref2 = this.children;
- for (j = 0, len = ref2.length; j < len; j++) {
- child = ref2[j];
- if (child.textContent) {
- str += child.textContent;
- }
- }
- return str;
- } else {
- return null;
- }
- },
- set: function(value) {
- throw new Error("This DOM method is not implemented." + this.debugInfo());
- }
- });
- XMLNode.prototype.setParent = function(parent) {
- var child, j, len, ref2, results;
- this.parent = parent;
- if (parent) {
- this.options = parent.options;
- this.stringify = parent.stringify;
- }
- ref2 = this.children;
- results = [];
- for (j = 0, len = ref2.length; j < len; j++) {
- child = ref2[j];
- results.push(child.setParent(this));
- }
- return results;
- };
- XMLNode.prototype.element = function(name, attributes, text) {
- var childNode, item, j, k, key, lastChild, len, len1, ref2, ref3, val;
- lastChild = null;
- if (attributes === null && (text == null)) {
- ref2 = [{}, null], attributes = ref2[0], text = ref2[1];
- }
- if (attributes == null) {
- attributes = {};
- }
- attributes = getValue(attributes);
- if (!isObject(attributes)) {
- ref3 = [attributes, text], text = ref3[0], attributes = ref3[1];
- }
- if (name != null) {
- name = getValue(name);
- }
- if (Array.isArray(name)) {
- for (j = 0, len = name.length; j < len; j++) {
- item = name[j];
- lastChild = this.element(item);
- }
- } else if (isFunction(name)) {
- lastChild = this.element(name.apply());
- } else if (isObject(name)) {
- for (key in name) {
- if (!hasProp.call(name, key)) continue;
- val = name[key];
- if (isFunction(val)) {
- val = val.apply();
- }
- if (!this.options.ignoreDecorators && this.stringify.convertAttKey && key.indexOf(this.stringify.convertAttKey) === 0) {
- lastChild = this.attribute(key.substr(this.stringify.convertAttKey.length), val);
- } else if (!this.options.separateArrayItems && Array.isArray(val) && isEmpty(val)) {
- lastChild = this.dummy();
- } else if (isObject(val) && isEmpty(val)) {
- lastChild = this.element(key);
- } else if (!this.options.keepNullNodes && (val == null)) {
- lastChild = this.dummy();
- } else if (!this.options.separateArrayItems && Array.isArray(val)) {
- for (k = 0, len1 = val.length; k < len1; k++) {
- item = val[k];
- childNode = {};
- childNode[key] = item;
- lastChild = this.element(childNode);
- }
- } else if (isObject(val)) {
- if (!this.options.ignoreDecorators && this.stringify.convertTextKey && key.indexOf(this.stringify.convertTextKey) === 0) {
- lastChild = this.element(val);
- } else {
- lastChild = this.element(key);
- lastChild.element(val);
- }
- } else {
- lastChild = this.element(key, val);
- }
- }
- } else if (!this.options.keepNullNodes && text === null) {
- lastChild = this.dummy();
- } else {
- if (!this.options.ignoreDecorators && this.stringify.convertTextKey && name.indexOf(this.stringify.convertTextKey) === 0) {
- lastChild = this.text(text);
- } else if (!this.options.ignoreDecorators && this.stringify.convertCDataKey && name.indexOf(this.stringify.convertCDataKey) === 0) {
- lastChild = this.cdata(text);
- } else if (!this.options.ignoreDecorators && this.stringify.convertCommentKey && name.indexOf(this.stringify.convertCommentKey) === 0) {
- lastChild = this.comment(text);
- } else if (!this.options.ignoreDecorators && this.stringify.convertRawKey && name.indexOf(this.stringify.convertRawKey) === 0) {
- lastChild = this.raw(text);
- } else if (!this.options.ignoreDecorators && this.stringify.convertPIKey && name.indexOf(this.stringify.convertPIKey) === 0) {
- lastChild = this.instruction(name.substr(this.stringify.convertPIKey.length), text);
- } else {
- lastChild = this.node(name, attributes, text);
- }
- }
- if (lastChild == null) {
- throw new Error("Could not create any elements with: " + name + ". " + this.debugInfo());
- }
- return lastChild;
- };
- XMLNode.prototype.insertBefore = function(name, attributes, text) {
- var child, i, newChild, refChild, removed;
- if (name != null ? name.type : void 0) {
- newChild = name;
- refChild = attributes;
- newChild.setParent(this);
- if (refChild) {
- i = children.indexOf(refChild);
- removed = children.splice(i);
- children.push(newChild);
- Array.prototype.push.apply(children, removed);
- } else {
- children.push(newChild);
- }
- return newChild;
- } else {
- if (this.isRoot) {
- throw new Error("Cannot insert elements at root level. " + this.debugInfo(name));
- }
- i = this.parent.children.indexOf(this);
- removed = this.parent.children.splice(i);
- child = this.parent.element(name, attributes, text);
- Array.prototype.push.apply(this.parent.children, removed);
- return child;
- }
- };
- XMLNode.prototype.insertAfter = function(name, attributes, text) {
- var child, i, removed;
- if (this.isRoot) {
- throw new Error("Cannot insert elements at root level. " + this.debugInfo(name));
- }
- i = this.parent.children.indexOf(this);
- removed = this.parent.children.splice(i + 1);
- child = this.parent.element(name, attributes, text);
- Array.prototype.push.apply(this.parent.children, removed);
- return child;
- };
- XMLNode.prototype.remove = function() {
- var i, ref2;
- if (this.isRoot) {
- throw new Error("Cannot remove the root element. " + this.debugInfo());
- }
- i = this.parent.children.indexOf(this);
- [].splice.apply(this.parent.children, [i, i - i + 1].concat(ref2 = [])), ref2;
- return this.parent;
- };
- XMLNode.prototype.node = function(name, attributes, text) {
- var child, ref2;
- if (name != null) {
- name = getValue(name);
- }
- attributes || (attributes = {});
- attributes = getValue(attributes);
- if (!isObject(attributes)) {
- ref2 = [attributes, text], text = ref2[0], attributes = ref2[1];
- }
- child = new XMLElement(this, name, attributes);
- if (text != null) {
- child.text(text);
- }
- this.children.push(child);
- return child;
- };
- XMLNode.prototype.text = function(value) {
- var child;
- if (isObject(value)) {
- this.element(value);
- }
- child = new XMLText(this, value);
- this.children.push(child);
- return this;
- };
- XMLNode.prototype.cdata = function(value) {
- var child;
- child = new XMLCData(this, value);
- this.children.push(child);
- return this;
- };
- XMLNode.prototype.comment = function(value) {
- var child;
- child = new XMLComment(this, value);
- this.children.push(child);
- return this;
- };
- XMLNode.prototype.commentBefore = function(value) {
- var child, i, removed;
- i = this.parent.children.indexOf(this);
- removed = this.parent.children.splice(i);
- child = this.parent.comment(value);
- Array.prototype.push.apply(this.parent.children, removed);
- return this;
- };
- XMLNode.prototype.commentAfter = function(value) {
- var child, i, removed;
- i = this.parent.children.indexOf(this);
- removed = this.parent.children.splice(i + 1);
- child = this.parent.comment(value);
- Array.prototype.push.apply(this.parent.children, removed);
- return this;
- };
- XMLNode.prototype.raw = function(value) {
- var child;
- child = new XMLRaw(this, value);
- this.children.push(child);
- return this;
- };
- XMLNode.prototype.dummy = function() {
- var child;
- child = new XMLDummy(this);
- return child;
- };
- XMLNode.prototype.instruction = function(target, value) {
- var insTarget, insValue, instruction, j, len;
- if (target != null) {
- target = getValue(target);
- }
- if (value != null) {
- value = getValue(value);
- }
- if (Array.isArray(target)) {
- for (j = 0, len = target.length; j < len; j++) {
- insTarget = target[j];
- this.instruction(insTarget);
- }
- } else if (isObject(target)) {
- for (insTarget in target) {
- if (!hasProp.call(target, insTarget)) continue;
- insValue = target[insTarget];
- this.instruction(insTarget, insValue);
- }
- } else {
- if (isFunction(value)) {
- value = value.apply();
- }
- instruction = new XMLProcessingInstruction(this, target, value);
- this.children.push(instruction);
- }
- return this;
- };
- XMLNode.prototype.instructionBefore = function(target, value) {
- var child, i, removed;
- i = this.parent.children.indexOf(this);
- removed = this.parent.children.splice(i);
- child = this.parent.instruction(target, value);
- Array.prototype.push.apply(this.parent.children, removed);
- return this;
- };
- XMLNode.prototype.instructionAfter = function(target, value) {
- var child, i, removed;
- i = this.parent.children.indexOf(this);
- removed = this.parent.children.splice(i + 1);
- child = this.parent.instruction(target, value);
- Array.prototype.push.apply(this.parent.children, removed);
- return this;
- };
- XMLNode.prototype.declaration = function(version, encoding, standalone) {
- var doc, xmldec;
- doc = this.document();
- xmldec = new XMLDeclaration(doc, version, encoding, standalone);
- if (doc.children.length === 0) {
- doc.children.unshift(xmldec);
- } else if (doc.children[0].type === NodeType.Declaration) {
- doc.children[0] = xmldec;
- } else {
- doc.children.unshift(xmldec);
- }
- return doc.root() || doc;
- };
- XMLNode.prototype.dtd = function(pubID, sysID) {
- var child, doc, doctype, i, j, k, len, len1, ref2, ref3;
- doc = this.document();
- doctype = new XMLDocType(doc, pubID, sysID);
- ref2 = doc.children;
- for (i = j = 0, len = ref2.length; j < len; i = ++j) {
- child = ref2[i];
- if (child.type === NodeType.DocType) {
- doc.children[i] = doctype;
- return doctype;
- }
- }
- ref3 = doc.children;
- for (i = k = 0, len1 = ref3.length; k < len1; i = ++k) {
- child = ref3[i];
- if (child.isRoot) {
- doc.children.splice(i, 0, doctype);
- return doctype;
- }
- }
- doc.children.push(doctype);
- return doctype;
- };
- XMLNode.prototype.up = function() {
- if (this.isRoot) {
- throw new Error("The root node has no parent. Use doc() if you need to get the document object.");
- }
- return this.parent;
- };
- XMLNode.prototype.root = function() {
- var node;
- node = this;
- while (node) {
- if (node.type === NodeType.Document) {
- return node.rootObject;
- } else if (node.isRoot) {
- return node;
- } else {
- node = node.parent;
- }
- }
- };
- XMLNode.prototype.document = function() {
- var node;
- node = this;
- while (node) {
- if (node.type === NodeType.Document) {
- return node;
- } else {
- node = node.parent;
- }
- }
- };
- XMLNode.prototype.end = function(options) {
- return this.document().end(options);
- };
- XMLNode.prototype.prev = function() {
- var i;
- i = this.parent.children.indexOf(this);
- if (i < 1) {
- throw new Error("Already at the first node. " + this.debugInfo());
- }
- return this.parent.children[i - 1];
- };
- XMLNode.prototype.next = function() {
- var i;
- i = this.parent.children.indexOf(this);
- if (i === -1 || i === this.parent.children.length - 1) {
- throw new Error("Already at the last node. " + this.debugInfo());
- }
- return this.parent.children[i + 1];
- };
- XMLNode.prototype.importDocument = function(doc) {
- var clonedRoot;
- clonedRoot = doc.root().clone();
- clonedRoot.parent = this;
- clonedRoot.isRoot = false;
- this.children.push(clonedRoot);
- return this;
- };
- XMLNode.prototype.debugInfo = function(name) {
- var ref2, ref3;
- name = name || this.name;
- if ((name == null) && !((ref2 = this.parent) != null ? ref2.name : void 0)) {
- return "";
- } else if (name == null) {
- return "parent: <" + this.parent.name + ">";
- } else if (!((ref3 = this.parent) != null ? ref3.name : void 0)) {
- return "node: <" + name + ">";
- } else {
- return "node: <" + name + ">, parent: <" + this.parent.name + ">";
- }
- };
- XMLNode.prototype.ele = function(name, attributes, text) {
- return this.element(name, attributes, text);
- };
- XMLNode.prototype.nod = function(name, attributes, text) {
- return this.node(name, attributes, text);
- };
- XMLNode.prototype.txt = function(value) {
- return this.text(value);
- };
- XMLNode.prototype.dat = function(value) {
- return this.cdata(value);
- };
- XMLNode.prototype.com = function(value) {
- return this.comment(value);
- };
- XMLNode.prototype.ins = function(target, value) {
- return this.instruction(target, value);
- };
- XMLNode.prototype.doc = function() {
- return this.document();
- };
- XMLNode.prototype.dec = function(version, encoding, standalone) {
- return this.declaration(version, encoding, standalone);
- };
- XMLNode.prototype.e = function(name, attributes, text) {
- return this.element(name, attributes, text);
- };
- XMLNode.prototype.n = function(name, attributes, text) {
- return this.node(name, attributes, text);
- };
- XMLNode.prototype.t = function(value) {
- return this.text(value);
- };
- XMLNode.prototype.d = function(value) {
- return this.cdata(value);
- };
- XMLNode.prototype.c = function(value) {
- return this.comment(value);
- };
- XMLNode.prototype.r = function(value) {
- return this.raw(value);
- };
- XMLNode.prototype.i = function(target, value) {
- return this.instruction(target, value);
- };
- XMLNode.prototype.u = function() {
- return this.up();
- };
- XMLNode.prototype.importXMLBuilder = function(doc) {
- return this.importDocument(doc);
- };
- XMLNode.prototype.replaceChild = function(newChild, oldChild) {
- throw new Error("This DOM method is not implemented." + this.debugInfo());
- };
- XMLNode.prototype.removeChild = function(oldChild) {
- throw new Error("This DOM method is not implemented." + this.debugInfo());
- };
- XMLNode.prototype.appendChild = function(newChild) {
- throw new Error("This DOM method is not implemented." + this.debugInfo());
- };
- XMLNode.prototype.hasChildNodes = function() {
- return this.children.length !== 0;
- };
- XMLNode.prototype.cloneNode = function(deep) {
- throw new Error("This DOM method is not implemented." + this.debugInfo());
- };
- XMLNode.prototype.normalize = function() {
- throw new Error("This DOM method is not implemented." + this.debugInfo());
- };
- XMLNode.prototype.isSupported = function(feature, version) {
- return true;
- };
- XMLNode.prototype.hasAttributes = function() {
- return this.attribs.length !== 0;
- };
- XMLNode.prototype.compareDocumentPosition = function(other) {
- var ref, res;
- ref = this;
- if (ref === other) {
- return 0;
- } else if (this.document() !== other.document()) {
- res = DocumentPosition.Disconnected | DocumentPosition.ImplementationSpecific;
- if (Math.random() < 0.5) {
- res |= DocumentPosition.Preceding;
- } else {
- res |= DocumentPosition.Following;
- }
- return res;
- } else if (ref.isAncestor(other)) {
- return DocumentPosition.Contains | DocumentPosition.Preceding;
- } else if (ref.isDescendant(other)) {
- return DocumentPosition.Contains | DocumentPosition.Following;
- } else if (ref.isPreceding(other)) {
- return DocumentPosition.Preceding;
- } else {
- return DocumentPosition.Following;
- }
- };
- XMLNode.prototype.isSameNode = function(other) {
- throw new Error("This DOM method is not implemented." + this.debugInfo());
- };
- XMLNode.prototype.lookupPrefix = function(namespaceURI) {
- throw new Error("This DOM method is not implemented." + this.debugInfo());
- };
- XMLNode.prototype.isDefaultNamespace = function(namespaceURI) {
- throw new Error("This DOM method is not implemented." + this.debugInfo());
- };
- XMLNode.prototype.lookupNamespaceURI = function(prefix) {
- throw new Error("This DOM method is not implemented." + this.debugInfo());
- };
- XMLNode.prototype.isEqualNode = function(node) {
- var i, j, ref2;
- if (node.nodeType !== this.nodeType) {
- return false;
- }
- if (node.children.length !== this.children.length) {
- return false;
- }
- for (i = j = 0, ref2 = this.children.length - 1; 0 <= ref2 ? j <= ref2 : j >= ref2; i = 0 <= ref2 ? ++j : --j) {
- if (!this.children[i].isEqualNode(node.children[i])) {
- return false;
- }
- }
- return true;
- };
- XMLNode.prototype.getFeature = function(feature, version) {
- throw new Error("This DOM method is not implemented." + this.debugInfo());
- };
- XMLNode.prototype.setUserData = function(key, data, handler) {
- throw new Error("This DOM method is not implemented." + this.debugInfo());
- };
- XMLNode.prototype.getUserData = function(key) {
- throw new Error("This DOM method is not implemented." + this.debugInfo());
- };
- XMLNode.prototype.contains = function(other) {
- if (!other) {
- return false;
- }
- return other === this || this.isDescendant(other);
- };
- XMLNode.prototype.isDescendant = function(node) {
- var child, isDescendantChild, j, len, ref2;
- ref2 = this.children;
- for (j = 0, len = ref2.length; j < len; j++) {
- child = ref2[j];
- if (node === child) {
- return true;
- }
- isDescendantChild = child.isDescendant(node);
- if (isDescendantChild) {
- return true;
- }
- }
- return false;
- };
- XMLNode.prototype.isAncestor = function(node) {
- return node.isDescendant(this);
- };
- XMLNode.prototype.isPreceding = function(node) {
- var nodePos, thisPos;
- nodePos = this.treePosition(node);
- thisPos = this.treePosition(this);
- if (nodePos === -1 || thisPos === -1) {
- return false;
- } else {
- return nodePos < thisPos;
- }
- };
- XMLNode.prototype.isFollowing = function(node) {
- var nodePos, thisPos;
- nodePos = this.treePosition(node);
- thisPos = this.treePosition(this);
- if (nodePos === -1 || thisPos === -1) {
- return false;
- } else {
- return nodePos > thisPos;
- }
- };
- XMLNode.prototype.treePosition = function(node) {
- var found, pos;
- pos = 0;
- found = false;
- this.foreachTreeNode(this.document(), function(childNode) {
- pos++;
- if (!found && childNode === node) {
- return found = true;
- }
- });
- if (found) {
- return pos;
- } else {
- return -1;
- }
- };
- XMLNode.prototype.foreachTreeNode = function(node, func) {
- var child, j, len, ref2, res;
- node || (node = this.document());
- ref2 = node.children;
- for (j = 0, len = ref2.length; j < len; j++) {
- child = ref2[j];
- if (res = func(child)) {
- return res;
- } else {
- res = this.foreachTreeNode(child, func);
- if (res) {
- return res;
- }
- }
- }
- };
- return XMLNode;
- })();
- }).call(this);
- },{"./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){
- // Generated by CoffeeScript 1.12.7
- (function() {
- var XMLNodeList;
- module.exports = XMLNodeList = (function() {
- function XMLNodeList(nodes) {
- this.nodes = nodes;
- }
- Object.defineProperty(XMLNodeList.prototype, 'length', {
- get: function() {
- return this.nodes.length || 0;
- }
- });
- XMLNodeList.prototype.clone = function() {
- return this.nodes = null;
- };
- XMLNodeList.prototype.item = function(index) {
- return this.nodes[index] || null;
- };
- return XMLNodeList;
- })();
- }).call(this);
- },{}],384:[function(require,module,exports){
- // Generated by CoffeeScript 1.12.7
- (function() {
- var NodeType, XMLCharacterData, XMLProcessingInstruction,
- 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; },
- hasProp = {}.hasOwnProperty;
- NodeType = require('./NodeType');
- XMLCharacterData = require('./XMLCharacterData');
- module.exports = XMLProcessingInstruction = (function(superClass) {
- extend(XMLProcessingInstruction, superClass);
- function XMLProcessingInstruction(parent, target, value) {
- XMLProcessingInstruction.__super__.constructor.call(this, parent);
- if (target == null) {
- throw new Error("Missing instruction target. " + this.debugInfo());
- }
- this.type = NodeType.ProcessingInstruction;
- this.target = this.stringify.insTarget(target);
- this.name = this.target;
- if (value) {
- this.value = this.stringify.insValue(value);
- }
- }
- XMLProcessingInstruction.prototype.clone = function() {
- return Object.create(this);
- };
- XMLProcessingInstruction.prototype.toString = function(options) {
- return this.options.writer.processingInstruction(this, this.options.writer.filterOptions(options));
- };
- XMLProcessingInstruction.prototype.isEqualNode = function(node) {
- if (!XMLProcessingInstruction.__super__.isEqualNode.apply(this, arguments).isEqualNode(node)) {
- return false;
- }
- if (node.target !== this.target) {
- return false;
- }
- return true;
- };
- return XMLProcessingInstruction;
- })(XMLCharacterData);
- }).call(this);
- },{"./NodeType":360,"./XMLCharacterData":365}],385:[function(require,module,exports){
- // Generated by CoffeeScript 1.12.7
- (function() {
- var NodeType, XMLNode, XMLRaw,
- 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; },
- hasProp = {}.hasOwnProperty;
- NodeType = require('./NodeType');
- XMLNode = require('./XMLNode');
- module.exports = XMLRaw = (function(superClass) {
- extend(XMLRaw, superClass);
- function XMLRaw(parent, text) {
- XMLRaw.__super__.constructor.call(this, parent);
- if (text == null) {
- throw new Error("Missing raw text. " + this.debugInfo());
- }
- this.type = NodeType.Raw;
- this.value = this.stringify.raw(text);
- }
- XMLRaw.prototype.clone = function() {
- return Object.create(this);
- };
- XMLRaw.prototype.toString = function(options) {
- return this.options.writer.raw(this, this.options.writer.filterOptions(options));
- };
- return XMLRaw;
- })(XMLNode);
- }).call(this);
- },{"./NodeType":360,"./XMLNode":382}],386:[function(require,module,exports){
- // Generated by CoffeeScript 1.12.7
- (function() {
- var NodeType, WriterState, XMLStreamWriter, XMLWriterBase,
- 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; },
- hasProp = {}.hasOwnProperty;
- NodeType = require('./NodeType');
- XMLWriterBase = require('./XMLWriterBase');
- WriterState = require('./WriterState');
- module.exports = XMLStreamWriter = (function(superClass) {
- extend(XMLStreamWriter, superClass);
- function XMLStreamWriter(stream, options) {
- this.stream = stream;
- XMLStreamWriter.__super__.constructor.call(this, options);
- }
- XMLStreamWriter.prototype.endline = function(node, options, level) {
- if (node.isLastRootNode && options.state === WriterState.CloseTag) {
- return '';
- } else {
- return XMLStreamWriter.__super__.endline.call(this, node, options, level);
- }
- };
- XMLStreamWriter.prototype.document = function(doc, options) {
- var child, i, j, k, len, len1, ref, ref1, results;
- ref = doc.children;
- for (i = j = 0, len = ref.length; j < len; i = ++j) {
- child = ref[i];
- child.isLastRootNode = i === doc.children.length - 1;
- }
- options = this.filterOptions(options);
- ref1 = doc.children;
- results = [];
- for (k = 0, len1 = ref1.length; k < len1; k++) {
- child = ref1[k];
- results.push(this.writeChildNode(child, options, 0));
- }
- return results;
- };
- XMLStreamWriter.prototype.attribute = function(att, options, level) {
- return this.stream.write(XMLStreamWriter.__super__.attribute.call(this, att, options, level));
- };
- XMLStreamWriter.prototype.cdata = function(node, options, level) {
- return this.stream.write(XMLStreamWriter.__super__.cdata.call(this, node, options, level));
- };
- XMLStreamWriter.prototype.comment = function(node, options, level) {
- return this.stream.write(XMLStreamWriter.__super__.comment.call(this, node, options, level));
- };
- XMLStreamWriter.prototype.declaration = function(node, options, level) {
- return this.stream.write(XMLStreamWriter.__super__.declaration.call(this, node, options, level));
- };
- XMLStreamWriter.prototype.docType = function(node, options, level) {
- var child, j, len, ref;
- level || (level = 0);
- this.openNode(node, options, level);
- options.state = WriterState.OpenTag;
- this.stream.write(this.indent(node, options, level));
- this.stream.write('<!DOCTYPE ' + node.root().name);
- if (node.pubID && node.sysID) {
- this.stream.write(' PUBLIC "' + node.pubID + '" "' + node.sysID + '"');
- } else if (node.sysID) {
- this.stream.write(' SYSTEM "' + node.sysID + '"');
- }
- if (node.children.length > 0) {
- this.stream.write(' [');
- this.stream.write(this.endline(node, options, level));
- options.state = WriterState.InsideTag;
- ref = node.children;
- for (j = 0, len = ref.length; j < len; j++) {
- child = ref[j];
- this.writeChildNode(child, options, level + 1);
- }
- options.state = WriterState.CloseTag;
- this.stream.write(']');
- }
- options.state = WriterState.CloseTag;
- this.stream.write(options.spaceBeforeSlash + '>');
- this.stream.write(this.endline(node, options, level));
- options.state = WriterState.None;
- return this.closeNode(node, options, level);
- };
- XMLStreamWriter.prototype.element = function(node, options, level) {
- var att, child, childNodeCount, firstChildNode, j, len, name, prettySuppressed, ref, ref1;
- level || (level = 0);
- this.openNode(node, options, level);
- options.state = WriterState.OpenTag;
- this.stream.write(this.indent(node, options, level) + '<' + node.name);
- ref = node.attribs;
- for (name in ref) {
- if (!hasProp.call(ref, name)) continue;
- att = ref[name];
- this.attribute(att, options, level);
- }
- childNodeCount = node.children.length;
- firstChildNode = childNodeCount === 0 ? null : node.children[0];
- if (childNodeCount === 0 || node.children.every(function(e) {
- return (e.type === NodeType.Text || e.type === NodeType.Raw) && e.value === '';
- })) {
- if (options.allowEmpty) {
- this.stream.write('>');
- options.state = WriterState.CloseTag;
- this.stream.write('</' + node.name + '>');
- } else {
- options.state = WriterState.CloseTag;
- this.stream.write(options.spaceBeforeSlash + '/>');
- }
- } else if (options.pretty && childNodeCount === 1 && (firstChildNode.type === NodeType.Text || firstChildNode.type === NodeType.Raw) && (firstChildNode.value != null)) {
- this.stream.write('>');
- options.state = WriterState.InsideTag;
- options.suppressPrettyCount++;
- prettySuppressed = true;
- this.writeChildNode(firstChildNode, options, level + 1);
- options.suppressPrettyCount--;
- prettySuppressed = false;
- options.state = WriterState.CloseTag;
- this.stream.write('</' + node.name + '>');
- } else {
- this.stream.write('>' + this.endline(node, options, level));
- options.state = WriterState.InsideTag;
- ref1 = node.children;
- for (j = 0, len = ref1.length; j < len; j++) {
- child = ref1[j];
- this.writeChildNode(child, options, level + 1);
- }
- options.state = WriterState.CloseTag;
- this.stream.write(this.indent(node, options, level) + '</' + node.name + '>');
- }
- this.stream.write(this.endline(node, options, level));
- options.state = WriterState.None;
- return this.closeNode(node, options, level);
- };
- XMLStreamWriter.prototype.processingInstruction = function(node, options, level) {
- return this.stream.write(XMLStreamWriter.__super__.processingInstruction.call(this, node, options, level));
- };
- XMLStreamWriter.prototype.raw = function(node, options, level) {
- return this.stream.write(XMLStreamWriter.__super__.raw.call(this, node, options, level));
- };
- XMLStreamWriter.prototype.text = function(node, options, level) {
- return this.stream.write(XMLStreamWriter.__super__.text.call(this, node, options, level));
- };
- XMLStreamWriter.prototype.dtdAttList = function(node, options, level) {
- return this.stream.write(XMLStreamWriter.__super__.dtdAttList.call(this, node, options, level));
- };
- XMLStreamWriter.prototype.dtdElement = function(node, options, level) {
- return this.stream.write(XMLStreamWriter.__super__.dtdElement.call(this, node, options, level));
- };
- XMLStreamWriter.prototype.dtdEntity = function(node, options, level) {
- return this.stream.write(XMLStreamWriter.__super__.dtdEntity.call(this, node, options, level));
- };
- XMLStreamWriter.prototype.dtdNotation = function(node, options, level) {
- return this.stream.write(XMLStreamWriter.__super__.dtdNotation.call(this, node, options, level));
- };
- return XMLStreamWriter;
- })(XMLWriterBase);
- }).call(this);
- },{"./NodeType":360,"./WriterState":362,"./XMLWriterBase":390}],387:[function(require,module,exports){
- // Generated by CoffeeScript 1.12.7
- (function() {
- var XMLStringWriter, XMLWriterBase,
- 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; },
- hasProp = {}.hasOwnProperty;
- XMLWriterBase = require('./XMLWriterBase');
- module.exports = XMLStringWriter = (function(superClass) {
- extend(XMLStringWriter, superClass);
- function XMLStringWriter(options) {
- XMLStringWriter.__super__.constructor.call(this, options);
- }
- XMLStringWriter.prototype.document = function(doc, options) {
- var child, i, len, r, ref;
- options = this.filterOptions(options);
- r = '';
- ref = doc.children;
- for (i = 0, len = ref.length; i < len; i++) {
- child = ref[i];
- r += this.writeChildNode(child, options, 0);
- }
- if (options.pretty && r.slice(-options.newline.length) === options.newline) {
- r = r.slice(0, -options.newline.length);
- }
- return r;
- };
- return XMLStringWriter;
- })(XMLWriterBase);
- }).call(this);
- },{"./XMLWriterBase":390}],388:[function(require,module,exports){
- // Generated by CoffeeScript 1.12.7
- (function() {
- var XMLStringifier,
- bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
- hasProp = {}.hasOwnProperty;
- module.exports = XMLStringifier = (function() {
- function XMLStringifier(options) {
- this.assertLegalName = bind(this.assertLegalName, this);
- this.assertLegalChar = bind(this.assertLegalChar, this);
- var key, ref, value;
- options || (options = {});
- this.options = options;
- if (!this.options.version) {
- this.options.version = '1.0';
- }
- ref = options.stringify || {};
- for (key in ref) {
- if (!hasProp.call(ref, key)) continue;
- value = ref[key];
- this[key] = value;
- }
- }
- XMLStringifier.prototype.name = function(val) {
- if (this.options.noValidation) {
- return val;
- }
- return this.assertLegalName('' + val || '');
- };
- XMLStringifier.prototype.text = function(val) {
- if (this.options.noValidation) {
- return val;
- }
- return this.assertLegalChar(this.textEscape('' + val || ''));
- };
- XMLStringifier.prototype.cdata = function(val) {
- if (this.options.noValidation) {
- return val;
- }
- val = '' + val || '';
- val = val.replace(']]>', ']]]]><![CDATA[>');
- return this.assertLegalChar(val);
- };
- XMLStringifier.prototype.comment = function(val) {
- if (this.options.noValidation) {
- return val;
- }
- val = '' + val || '';
- if (val.match(/--/)) {
- throw new Error("Comment text cannot contain double-hypen: " + val);
- }
- return this.assertLegalChar(val);
- };
- XMLStringifier.prototype.raw = function(val) {
- if (this.options.noValidation) {
- return val;
- }
- return '' + val || '';
- };
- XMLStringifier.prototype.attValue = function(val) {
- if (this.options.noValidation) {
- return val;
- }
- return this.assertLegalChar(this.attEscape(val = '' + val || ''));
- };
- XMLStringifier.prototype.insTarget = function(val) {
- if (this.options.noValidation) {
- return val;
- }
- return this.assertLegalChar('' + val || '');
- };
- XMLStringifier.prototype.insValue = function(val) {
- if (this.options.noValidation) {
- return val;
- }
- val = '' + val || '';
- if (val.match(/\?>/)) {
- throw new Error("Invalid processing instruction value: " + val);
- }
- return this.assertLegalChar(val);
- };
- XMLStringifier.prototype.xmlVersion = function(val) {
- if (this.options.noValidation) {
- return val;
- }
- val = '' + val || '';
- if (!val.match(/1\.[0-9]+/)) {
- throw new Error("Invalid version number: " + val);
- }
- return val;
- };
- XMLStringifier.prototype.xmlEncoding = function(val) {
- if (this.options.noValidation) {
- return val;
- }
- val = '' + val || '';
- if (!val.match(/^[A-Za-z](?:[A-Za-z0-9._-])*$/)) {
- throw new Error("Invalid encoding: " + val);
- }
- return this.assertLegalChar(val);
- };
- XMLStringifier.prototype.xmlStandalone = function(val) {
- if (this.options.noValidation) {
- return val;
- }
- if (val) {
- return "yes";
- } else {
- return "no";
- }
- };
- XMLStringifier.prototype.dtdPubID = function(val) {
- if (this.options.noValidation) {
- return val;
- }
- return this.assertLegalChar('' + val || '');
- };
- XMLStringifier.prototype.dtdSysID = function(val) {
- if (this.options.noValidation) {
- return val;
- }
- return this.assertLegalChar('' + val || '');
- };
- XMLStringifier.prototype.dtdElementValue = function(val) {
- if (this.options.noValidation) {
- return val;
- }
- return this.assertLegalChar('' + val || '');
- };
- XMLStringifier.prototype.dtdAttType = function(val) {
- if (this.options.noValidation) {
- return val;
- }
- return this.assertLegalChar('' + val || '');
- };
- XMLStringifier.prototype.dtdAttDefault = function(val) {
- if (this.options.noValidation) {
- return val;
- }
- return this.assertLegalChar('' + val || '');
- };
- XMLStringifier.prototype.dtdEntityValue = function(val) {
- if (this.options.noValidation) {
- return val;
- }
- return this.assertLegalChar('' + val || '');
- };
- XMLStringifier.prototype.dtdNData = function(val) {
- if (this.options.noValidation) {
- return val;
- }
- return this.assertLegalChar('' + val || '');
- };
- XMLStringifier.prototype.convertAttKey = '@';
- XMLStringifier.prototype.convertPIKey = '?';
- XMLStringifier.prototype.convertTextKey = '#text';
- XMLStringifier.prototype.convertCDataKey = '#cdata';
- XMLStringifier.prototype.convertCommentKey = '#comment';
- XMLStringifier.prototype.convertRawKey = '#raw';
- XMLStringifier.prototype.assertLegalChar = function(str) {
- var regex, res;
- if (this.options.noValidation) {
- return str;
- }
- regex = '';
- if (this.options.version === '1.0') {
- regex = /[\0-\x08\x0B\f\x0E-\x1F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/;
- if (res = str.match(regex)) {
- throw new Error("Invalid character in string: " + str + " at index " + res.index);
- }
- } else if (this.options.version === '1.1') {
- regex = /[\0\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/;
- if (res = str.match(regex)) {
- throw new Error("Invalid character in string: " + str + " at index " + res.index);
- }
- }
- return str;
- };
- XMLStringifier.prototype.assertLegalName = function(str) {
- var regex;
- if (this.options.noValidation) {
- return str;
- }
- this.assertLegalChar(str);
- 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])*$/;
- if (!str.match(regex)) {
- throw new Error("Invalid character in name");
- }
- return str;
- };
- XMLStringifier.prototype.textEscape = function(str) {
- var ampregex;
- if (this.options.noValidation) {
- return str;
- }
- ampregex = this.options.noDoubleEncoding ? /(?!&\S+;)&/g : /&/g;
- return str.replace(ampregex, '&').replace(/</g, '<').replace(/>/g, '>').replace(/\r/g, '
');
- };
- XMLStringifier.prototype.attEscape = function(str) {
- var ampregex;
- if (this.options.noValidation) {
- return str;
- }
- ampregex = this.options.noDoubleEncoding ? /(?!&\S+;)&/g : /&/g;
- return str.replace(ampregex, '&').replace(/</g, '<').replace(/"/g, '"').replace(/\t/g, '	').replace(/\n/g, '
').replace(/\r/g, '
');
- };
- return XMLStringifier;
- })();
- }).call(this);
- },{}],389:[function(require,module,exports){
- // Generated by CoffeeScript 1.12.7
- (function() {
- var NodeType, XMLCharacterData, XMLText,
- 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; },
- hasProp = {}.hasOwnProperty;
- NodeType = require('./NodeType');
- XMLCharacterData = require('./XMLCharacterData');
- module.exports = XMLText = (function(superClass) {
- extend(XMLText, superClass);
- function XMLText(parent, text) {
- XMLText.__super__.constructor.call(this, parent);
- if (text == null) {
- throw new Error("Missing element text. " + this.debugInfo());
- }
- this.name = "#text";
- this.type = NodeType.Text;
- this.value = this.stringify.text(text);
- }
- Object.defineProperty(XMLText.prototype, 'isElementContentWhitespace', {
- get: function() {
- throw new Error("This DOM method is not implemented." + this.debugInfo());
- }
- });
- Object.defineProperty(XMLText.prototype, 'wholeText', {
- get: function() {
- var next, prev, str;
- str = '';
- prev = this.previousSibling;
- while (prev) {
- str = prev.data + str;
- prev = prev.previousSibling;
- }
- str += this.data;
- next = this.nextSibling;
- while (next) {
- str = str + next.data;
- next = next.nextSibling;
- }
- return str;
- }
- });
- XMLText.prototype.clone = function() {
- return Object.create(this);
- };
- XMLText.prototype.toString = function(options) {
- return this.options.writer.text(this, this.options.writer.filterOptions(options));
- };
- XMLText.prototype.splitText = function(offset) {
- throw new Error("This DOM method is not implemented." + this.debugInfo());
- };
- XMLText.prototype.replaceWholeText = function(content) {
- throw new Error("This DOM method is not implemented." + this.debugInfo());
- };
- return XMLText;
- })(XMLCharacterData);
- }).call(this);
- },{"./NodeType":360,"./XMLCharacterData":365}],390:[function(require,module,exports){
- // Generated by CoffeeScript 1.12.7
- (function() {
- var NodeType, WriterState, XMLCData, XMLComment, XMLDTDAttList, XMLDTDElement, XMLDTDEntity, XMLDTDNotation, XMLDeclaration, XMLDocType, XMLDummy, XMLElement, XMLProcessingInstruction, XMLRaw, XMLText, XMLWriterBase, assign,
- hasProp = {}.hasOwnProperty;
- assign = require('./Utility').assign;
- NodeType = require('./NodeType');
- XMLDeclaration = require('./XMLDeclaration');
- XMLDocType = require('./XMLDocType');
- XMLCData = require('./XMLCData');
- XMLComment = require('./XMLComment');
- XMLElement = require('./XMLElement');
- XMLRaw = require('./XMLRaw');
- XMLText = require('./XMLText');
- XMLProcessingInstruction = require('./XMLProcessingInstruction');
- XMLDummy = require('./XMLDummy');
- XMLDTDAttList = require('./XMLDTDAttList');
- XMLDTDElement = require('./XMLDTDElement');
- XMLDTDEntity = require('./XMLDTDEntity');
- XMLDTDNotation = require('./XMLDTDNotation');
- WriterState = require('./WriterState');
- module.exports = XMLWriterBase = (function() {
- function XMLWriterBase(options) {
- var key, ref, value;
- options || (options = {});
- this.options = options;
- ref = options.writer || {};
- for (key in ref) {
- if (!hasProp.call(ref, key)) continue;
- value = ref[key];
- this["_" + key] = this[key];
- this[key] = value;
- }
- }
- XMLWriterBase.prototype.filterOptions = function(options) {
- var filteredOptions, ref, ref1, ref2, ref3, ref4, ref5, ref6;
- options || (options = {});
- options = assign({}, this.options, options);
- filteredOptions = {
- writer: this
- };
- filteredOptions.pretty = options.pretty || false;
- filteredOptions.allowEmpty = options.allowEmpty || false;
- filteredOptions.indent = (ref = options.indent) != null ? ref : ' ';
- filteredOptions.newline = (ref1 = options.newline) != null ? ref1 : '\n';
- filteredOptions.offset = (ref2 = options.offset) != null ? ref2 : 0;
- filteredOptions.dontPrettyTextNodes = (ref3 = (ref4 = options.dontPrettyTextNodes) != null ? ref4 : options.dontprettytextnodes) != null ? ref3 : 0;
- filteredOptions.spaceBeforeSlash = (ref5 = (ref6 = options.spaceBeforeSlash) != null ? ref6 : options.spacebeforeslash) != null ? ref5 : '';
- if (filteredOptions.spaceBeforeSlash === true) {
- filteredOptions.spaceBeforeSlash = ' ';
- }
- filteredOptions.suppressPrettyCount = 0;
- filteredOptions.user = {};
- filteredOptions.state = WriterState.None;
- return filteredOptions;
- };
- XMLWriterBase.prototype.indent = function(node, options, level) {
- var indentLevel;
- if (!options.pretty || options.suppressPrettyCount) {
- return '';
- } else if (options.pretty) {
- indentLevel = (level || 0) + options.offset + 1;
- if (indentLevel > 0) {
- return new Array(indentLevel).join(options.indent);
- }
- }
- return '';
- };
- XMLWriterBase.prototype.endline = function(node, options, level) {
- if (!options.pretty || options.suppressPrettyCount) {
- return '';
- } else {
- return options.newline;
- }
- };
- XMLWriterBase.prototype.attribute = function(att, options, level) {
- var r;
- this.openAttribute(att, options, level);
- r = ' ' + att.name + '="' + att.value + '"';
- this.closeAttribute(att, options, level);
- return r;
- };
- XMLWriterBase.prototype.cdata = function(node, options, level) {
- var r;
- this.openNode(node, options, level);
- options.state = WriterState.OpenTag;
- r = this.indent(node, options, level) + '<![CDATA[';
- options.state = WriterState.InsideTag;
- r += node.value;
- options.state = WriterState.CloseTag;
- r += ']]>' + this.endline(node, options, level);
- options.state = WriterState.None;
- this.closeNode(node, options, level);
- return r;
- };
- XMLWriterBase.prototype.comment = function(node, options, level) {
- var r;
- this.openNode(node, options, level);
- options.state = WriterState.OpenTag;
- r = this.indent(node, options, level) + '<!-- ';
- options.state = WriterState.InsideTag;
- r += node.value;
- options.state = WriterState.CloseTag;
- r += ' -->' + this.endline(node, options, level);
- options.state = WriterState.None;
- this.closeNode(node, options, level);
- return r;
- };
- XMLWriterBase.prototype.declaration = function(node, options, level) {
- var r;
- this.openNode(node, options, level);
- options.state = WriterState.OpenTag;
- r = this.indent(node, options, level) + '<?xml';
- options.state = WriterState.InsideTag;
- r += ' version="' + node.version + '"';
- if (node.encoding != null) {
- r += ' encoding="' + node.encoding + '"';
- }
- if (node.standalone != null) {
- r += ' standalone="' + node.standalone + '"';
- }
- options.state = WriterState.CloseTag;
- r += options.spaceBeforeSlash + '?>';
- r += this.endline(node, options, level);
- options.state = WriterState.None;
- this.closeNode(node, options, level);
- return r;
- };
- XMLWriterBase.prototype.docType = function(node, options, level) {
- var child, i, len, r, ref;
- level || (level = 0);
- this.openNode(node, options, level);
- options.state = WriterState.OpenTag;
- r = this.indent(node, options, level);
- r += '<!DOCTYPE ' + node.root().name;
- if (node.pubID && node.sysID) {
- r += ' PUBLIC "' + node.pubID + '" "' + node.sysID + '"';
- } else if (node.sysID) {
- r += ' SYSTEM "' + node.sysID + '"';
- }
- if (node.children.length > 0) {
- r += ' [';
- r += this.endline(node, options, level);
- options.state = WriterState.InsideTag;
- ref = node.children;
- for (i = 0, len = ref.length; i < len; i++) {
- child = ref[i];
- r += this.writeChildNode(child, options, level + 1);
- }
- options.state = WriterState.CloseTag;
- r += ']';
- }
- options.state = WriterState.CloseTag;
- r += options.spaceBeforeSlash + '>';
- r += this.endline(node, options, level);
- options.state = WriterState.None;
- this.closeNode(node, options, level);
- return r;
- };
- XMLWriterBase.prototype.element = function(node, options, level) {
- var att, child, childNodeCount, firstChildNode, i, j, len, len1, name, prettySuppressed, r, ref, ref1, ref2;
- level || (level = 0);
- prettySuppressed = false;
- r = '';
- this.openNode(node, options, level);
- options.state = WriterState.OpenTag;
- r += this.indent(node, options, level) + '<' + node.name;
- ref = node.attribs;
- for (name in ref) {
- if (!hasProp.call(ref, name)) continue;
- att = ref[name];
- r += this.attribute(att, options, level);
- }
- childNodeCount = node.children.length;
- firstChildNode = childNodeCount === 0 ? null : node.children[0];
- if (childNodeCount === 0 || node.children.every(function(e) {
- return (e.type === NodeType.Text || e.type === NodeType.Raw) && e.value === '';
- })) {
- if (options.allowEmpty) {
- r += '>';
- options.state = WriterState.CloseTag;
- r += '</' + node.name + '>' + this.endline(node, options, level);
- } else {
- options.state = WriterState.CloseTag;
- r += options.spaceBeforeSlash + '/>' + this.endline(node, options, level);
- }
- } else if (options.pretty && childNodeCount === 1 && (firstChildNode.type === NodeType.Text || firstChildNode.type === NodeType.Raw) && (firstChildNode.value != null)) {
- r += '>';
- options.state = WriterState.InsideTag;
- options.suppressPrettyCount++;
- prettySuppressed = true;
- r += this.writeChildNode(firstChildNode, options, level + 1);
- options.suppressPrettyCount--;
- prettySuppressed = false;
- options.state = WriterState.CloseTag;
- r += '</' + node.name + '>' + this.endline(node, options, level);
- } else {
- if (options.dontPrettyTextNodes) {
- ref1 = node.children;
- for (i = 0, len = ref1.length; i < len; i++) {
- child = ref1[i];
- if ((child.type === NodeType.Text || child.type === NodeType.Raw) && (child.value != null)) {
- options.suppressPrettyCount++;
- prettySuppressed = true;
- break;
- }
- }
- }
- r += '>' + this.endline(node, options, level);
- options.state = WriterState.InsideTag;
- ref2 = node.children;
- for (j = 0, len1 = ref2.length; j < len1; j++) {
- child = ref2[j];
- r += this.writeChildNode(child, options, level + 1);
- }
- options.state = WriterState.CloseTag;
- r += this.indent(node, options, level) + '</' + node.name + '>';
- if (prettySuppressed) {
- options.suppressPrettyCount--;
- }
- r += this.endline(node, options, level);
- options.state = WriterState.None;
- }
- this.closeNode(node, options, level);
- return r;
- };
- XMLWriterBase.prototype.writeChildNode = function(node, options, level) {
- switch (node.type) {
- case NodeType.CData:
- return this.cdata(node, options, level);
- case NodeType.Comment:
- return this.comment(node, options, level);
- case NodeType.Element:
- return this.element(node, options, level);
- case NodeType.Raw:
- return this.raw(node, options, level);
- case NodeType.Text:
- return this.text(node, options, level);
- case NodeType.ProcessingInstruction:
- return this.processingInstruction(node, options, level);
- case NodeType.Dummy:
- return '';
- case NodeType.Declaration:
- return this.declaration(node, options, level);
- case NodeType.DocType:
- return this.docType(node, options, level);
- case NodeType.AttributeDeclaration:
- return this.dtdAttList(node, options, level);
- case NodeType.ElementDeclaration:
- return this.dtdElement(node, options, level);
- case NodeType.EntityDeclaration:
- return this.dtdEntity(node, options, level);
- case NodeType.NotationDeclaration:
- return this.dtdNotation(node, options, level);
- default:
- throw new Error("Unknown XML node type: " + node.constructor.name);
- }
- };
- XMLWriterBase.prototype.processingInstruction = function(node, options, level) {
- var r;
- this.openNode(node, options, level);
- options.state = WriterState.OpenTag;
- r = this.indent(node, options, level) + '<?';
- options.state = WriterState.InsideTag;
- r += node.target;
- if (node.value) {
- r += ' ' + node.value;
- }
- options.state = WriterState.CloseTag;
- r += options.spaceBeforeSlash + '?>';
- r += this.endline(node, options, level);
- options.state = WriterState.None;
- this.closeNode(node, options, level);
- return r;
- };
- XMLWriterBase.prototype.raw = function(node, options, level) {
- var r;
- this.openNode(node, options, level);
- options.state = WriterState.OpenTag;
- r = this.indent(node, options, level);
- options.state = WriterState.InsideTag;
- r += node.value;
- options.state = WriterState.CloseTag;
- r += this.endline(node, options, level);
- options.state = WriterState.None;
- this.closeNode(node, options, level);
- return r;
- };
- XMLWriterBase.prototype.text = function(node, options, level) {
- var r;
- this.openNode(node, options, level);
- options.state = WriterState.OpenTag;
- r = this.indent(node, options, level);
- options.state = WriterState.InsideTag;
- r += node.value;
- options.state = WriterState.CloseTag;
- r += this.endline(node, options, level);
- options.state = WriterState.None;
- this.closeNode(node, options, level);
- return r;
- };
- XMLWriterBase.prototype.dtdAttList = function(node, options, level) {
- var r;
- this.openNode(node, options, level);
- options.state = WriterState.OpenTag;
- r = this.indent(node, options, level) + '<!ATTLIST';
- options.state = WriterState.InsideTag;
- r += ' ' + node.elementName + ' ' + node.attributeName + ' ' + node.attributeType;
- if (node.defaultValueType !== '#DEFAULT') {
- r += ' ' + node.defaultValueType;
- }
- if (node.defaultValue) {
- r += ' "' + node.defaultValue + '"';
- }
- options.state = WriterState.CloseTag;
- r += options.spaceBeforeSlash + '>' + this.endline(node, options, level);
- options.state = WriterState.None;
- this.closeNode(node, options, level);
- return r;
- };
- XMLWriterBase.prototype.dtdElement = function(node, options, level) {
- var r;
- this.openNode(node, options, level);
- options.state = WriterState.OpenTag;
- r = this.indent(node, options, level) + '<!ELEMENT';
- options.state = WriterState.InsideTag;
- r += ' ' + node.name + ' ' + node.value;
- options.state = WriterState.CloseTag;
- r += options.spaceBeforeSlash + '>' + this.endline(node, options, level);
- options.state = WriterState.None;
- this.closeNode(node, options, level);
- return r;
- };
- XMLWriterBase.prototype.dtdEntity = function(node, options, level) {
- var r;
- this.openNode(node, options, level);
- options.state = WriterState.OpenTag;
- r = this.indent(node, options, level) + '<!ENTITY';
- options.state = WriterState.InsideTag;
- if (node.pe) {
- r += ' %';
- }
- r += ' ' + node.name;
- if (node.value) {
- r += ' "' + node.value + '"';
- } else {
- if (node.pubID && node.sysID) {
- r += ' PUBLIC "' + node.pubID + '" "' + node.sysID + '"';
- } else if (node.sysID) {
- r += ' SYSTEM "' + node.sysID + '"';
- }
- if (node.nData) {
- r += ' NDATA ' + node.nData;
- }
- }
- options.state = WriterState.CloseTag;
- r += options.spaceBeforeSlash + '>' + this.endline(node, options, level);
- options.state = WriterState.None;
- this.closeNode(node, options, level);
- return r;
- };
- XMLWriterBase.prototype.dtdNotation = function(node, options, level) {
- var r;
- this.openNode(node, options, level);
- options.state = WriterState.OpenTag;
- r = this.indent(node, options, level) + '<!NOTATION';
- options.state = WriterState.InsideTag;
- r += ' ' + node.name;
- if (node.pubID && node.sysID) {
- r += ' PUBLIC "' + node.pubID + '" "' + node.sysID + '"';
- } else if (node.pubID) {
- r += ' PUBLIC "' + node.pubID + '"';
- } else if (node.sysID) {
- r += ' SYSTEM "' + node.sysID + '"';
- }
- options.state = WriterState.CloseTag;
- r += options.spaceBeforeSlash + '>' + this.endline(node, options, level);
- options.state = WriterState.None;
- this.closeNode(node, options, level);
- return r;
- };
- XMLWriterBase.prototype.openNode = function(node, options, level) {};
- XMLWriterBase.prototype.closeNode = function(node, options, level) {};
- XMLWriterBase.prototype.openAttribute = function(att, options, level) {};
- XMLWriterBase.prototype.closeAttribute = function(att, options, level) {};
- return XMLWriterBase;
- })();
- }).call(this);
- },{"./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){
- // Generated by CoffeeScript 1.12.7
- (function() {
- var NodeType, WriterState, XMLDOMImplementation, XMLDocument, XMLDocumentCB, XMLStreamWriter, XMLStringWriter, assign, isFunction, ref;
- ref = require('./Utility'), assign = ref.assign, isFunction = ref.isFunction;
- XMLDOMImplementation = require('./XMLDOMImplementation');
- XMLDocument = require('./XMLDocument');
- XMLDocumentCB = require('./XMLDocumentCB');
- XMLStringWriter = require('./XMLStringWriter');
- XMLStreamWriter = require('./XMLStreamWriter');
- NodeType = require('./NodeType');
- WriterState = require('./WriterState');
- module.exports.create = function(name, xmldec, doctype, options) {
- var doc, root;
- if (name == null) {
- throw new Error("Root element needs a name.");
- }
- options = assign({}, xmldec, doctype, options);
- doc = new XMLDocument(options);
- root = doc.element(name);
- if (!options.headless) {
- doc.declaration(options);
- if ((options.pubID != null) || (options.sysID != null)) {
- doc.dtd(options);
- }
- }
- return root;
- };
- module.exports.begin = function(options, onData, onEnd) {
- var ref1;
- if (isFunction(options)) {
- ref1 = [options, onData], onData = ref1[0], onEnd = ref1[1];
- options = {};
- }
- if (onData) {
- return new XMLDocumentCB(options, onData, onEnd);
- } else {
- return new XMLDocument(options);
- }
- };
- module.exports.stringWriter = function(options) {
- return new XMLStringWriter(options);
- };
- module.exports.streamWriter = function(stream, options) {
- return new XMLStreamWriter(stream, options);
- };
- module.exports.implementation = new XMLDOMImplementation();
- module.exports.nodeType = NodeType;
- module.exports.writerState = WriterState;
- }).call(this);
- },{"./NodeType":360,"./Utility":361,"./WriterState":362,"./XMLDOMImplementation":369,"./XMLDocument":377,"./XMLDocumentCB":378,"./XMLStreamWriter":386,"./XMLStringWriter":387}],392:[function(require,module,exports){
- module.exports = extend
- var hasOwnProperty = Object.prototype.hasOwnProperty;
- function extend() {
- var target = {}
- for (var i = 0; i < arguments.length; i++) {
- var source = arguments[i]
- for (var key in source) {
- if (hasOwnProperty.call(source, key)) {
- target[key] = source[key]
- }
- }
- }
- return target
- }
- },{}],393:[function(require,module,exports){
- "use strict";
- require("core-js/modules/es.array.fill.js");
- require("core-js/modules/es.array.concat.js");
- require("core-js/modules/es.object.to-string.js");
- require("core-js/modules/es.regexp.to-string.js");
- require("core-js/modules/es.array.join.js");
- require("core-js/modules/es.array.slice.js");
- var Buffer = require('buffer').Buffer;
- var sha = require('./sha');
- var md5 = require('./md5');
- var algorithms = {
- sha1: sha,
- md5: md5
- };
- var blocksize = 64;
- var zeroBuffer = Buffer.alloc(blocksize);
- zeroBuffer.fill(0);
- function hmac(fn, key, data) {
- if (!Buffer.isBuffer(key)) key = Buffer.from(key);
- if (!Buffer.isBuffer(data)) data = Buffer.from(data);
- if (key.length > blocksize) {
- key = fn(key);
- } else if (key.length < blocksize) {
- key = Buffer.concat([key, zeroBuffer], blocksize);
- }
- var ipad = Buffer.alloc(blocksize),
- opad = Buffer.alloc(blocksize);
- for (var i = 0; i < blocksize; i++) {
- ipad[i] = key[i] ^ 0x36;
- opad[i] = key[i] ^ 0x5C;
- }
- var hash = fn(Buffer.concat([ipad, data]));
- return fn(Buffer.concat([opad, hash]));
- }
- function hash(alg, key) {
- alg = alg || 'sha1';
- var fn = algorithms[alg];
- var bufs = [];
- var length = 0;
- if (!fn) error('algorithm:', alg, 'is not yet supported');
- return {
- update: function update(data) {
- if (!Buffer.isBuffer(data)) data = Buffer.from(data);
- bufs.push(data);
- length += data.length;
- return this;
- },
- digest: function digest(enc) {
- var buf = Buffer.concat(bufs);
- var r = key ? hmac(fn, key, buf) : fn(buf);
- bufs = null;
- return enc ? r.toString(enc) : r;
- }
- };
- }
- function error() {
- var m = [].slice.call(arguments).join(' ');
- throw new Error([m, 'we accept pull requests', 'http://github.com/dominictarr/crypto-browserify'].join('\n'));
- }
- exports.createHash = function (alg) {
- return hash(alg);
- };
- exports.createHmac = function (alg, key) {
- return hash(alg, key);
- };
- exports.createCredentials = function () {
- error('sorry,createCredentials is not implemented yet');
- };
- exports.createCipher = function () {
- error('sorry,createCipher is not implemented yet');
- };
- exports.createCipheriv = function () {
- error('sorry,createCipheriv is not implemented yet');
- };
- exports.createDecipher = function () {
- error('sorry,createDecipher is not implemented yet');
- };
- exports.createDecipheriv = function () {
- error('sorry,createDecipheriv is not implemented yet');
- };
- exports.createSign = function () {
- error('sorry,createSign is not implemented yet');
- };
- exports.createVerify = function () {
- error('sorry,createVerify is not implemented yet');
- };
- exports.createDiffieHellman = function () {
- error('sorry,createDiffieHellman is not implemented yet');
- };
- exports.pbkdf2 = function () {
- error('sorry,pbkdf2 is not implemented yet');
- };
- },{"./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){
- "use strict";
- require("core-js/modules/es.array.fill.js");
- require("core-js/modules/es.array.concat.js");
- var Buffer = require('buffer').Buffer;
- var intSize = 4;
- var zeroBuffer = Buffer.alloc(intSize);
- zeroBuffer.fill(0);
- var chrsz = 8;
- function toArray(buf, bigEndian) {
- if (buf.length % intSize !== 0) {
- var len = buf.length + (intSize - buf.length % intSize);
- buf = Buffer.concat([buf, zeroBuffer], len);
- }
- var arr = [];
- var fn = bigEndian ? buf.readInt32BE : buf.readInt32LE;
- for (var i = 0; i < buf.length; i += intSize) {
- arr.push(fn.call(buf, i));
- }
- return arr;
- }
- function toBuffer(arr, size, bigEndian) {
- var buf = Buffer.alloc(size);
- var fn = bigEndian ? buf.writeInt32BE : buf.writeInt32LE;
- for (var i = 0; i < arr.length; i++) {
- fn.call(buf, arr[i], i * 4, true);
- }
- return buf;
- }
- function hash(buf, fn, hashSize, bigEndian) {
- if (!Buffer.isBuffer(buf)) buf = Buffer.from(buf);
- var arr = fn(toArray(buf, bigEndian), buf.length * chrsz);
- return toBuffer(arr, hashSize, bigEndian);
- }
- module.exports = {
- hash: hash
- };
- },{"buffer":85,"core-js/modules/es.array.concat.js":241,"core-js/modules/es.array.fill.js":242}],395:[function(require,module,exports){
- "use strict";
- /*
- * A JavaScript implementation of the RSA Data Security, Inc. MD5 Message
- * Digest Algorithm, as defined in RFC 1321.
- * Version 2.1 Copyright (C) Paul Johnston 1999 - 2002.
- * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet
- * Distributed under the BSD License
- * See http://pajhome.org.uk/crypt/md5 for more info.
- */
- var helpers = require('./helpers');
- /*
- * Perform a simple self-test to see if the VM is working
- */
- function md5_vm_test() {
- return hex_md5("abc") == "900150983cd24fb0d6963f7d28e17f72";
- }
- /*
- * Calculate the MD5 of an array of little-endian words, and a bit length
- */
- function core_md5(x, len) {
- /* append padding */
- x[len >> 5] |= 0x80 << len % 32;
- x[(len + 64 >>> 9 << 4) + 14] = len;
- var a = 1732584193;
- var b = -271733879;
- var c = -1732584194;
- var d = 271733878;
- for (var i = 0; i < x.length; i += 16) {
- var olda = a;
- var oldb = b;
- var oldc = c;
- var oldd = d;
- a = md5_ff(a, b, c, d, x[i + 0], 7, -680876936);
- d = md5_ff(d, a, b, c, x[i + 1], 12, -389564586);
- c = md5_ff(c, d, a, b, x[i + 2], 17, 606105819);
- b = md5_ff(b, c, d, a, x[i + 3], 22, -1044525330);
- a = md5_ff(a, b, c, d, x[i + 4], 7, -176418897);
- d = md5_ff(d, a, b, c, x[i + 5], 12, 1200080426);
- c = md5_ff(c, d, a, b, x[i + 6], 17, -1473231341);
- b = md5_ff(b, c, d, a, x[i + 7], 22, -45705983);
- a = md5_ff(a, b, c, d, x[i + 8], 7, 1770035416);
- d = md5_ff(d, a, b, c, x[i + 9], 12, -1958414417);
- c = md5_ff(c, d, a, b, x[i + 10], 17, -42063);
- b = md5_ff(b, c, d, a, x[i + 11], 22, -1990404162);
- a = md5_ff(a, b, c, d, x[i + 12], 7, 1804603682);
- d = md5_ff(d, a, b, c, x[i + 13], 12, -40341101);
- c = md5_ff(c, d, a, b, x[i + 14], 17, -1502002290);
- b = md5_ff(b, c, d, a, x[i + 15], 22, 1236535329);
- a = md5_gg(a, b, c, d, x[i + 1], 5, -165796510);
- d = md5_gg(d, a, b, c, x[i + 6], 9, -1069501632);
- c = md5_gg(c, d, a, b, x[i + 11], 14, 643717713);
- b = md5_gg(b, c, d, a, x[i + 0], 20, -373897302);
- a = md5_gg(a, b, c, d, x[i + 5], 5, -701558691);
- d = md5_gg(d, a, b, c, x[i + 10], 9, 38016083);
- c = md5_gg(c, d, a, b, x[i + 15], 14, -660478335);
- b = md5_gg(b, c, d, a, x[i + 4], 20, -405537848);
- a = md5_gg(a, b, c, d, x[i + 9], 5, 568446438);
- d = md5_gg(d, a, b, c, x[i + 14], 9, -1019803690);
- c = md5_gg(c, d, a, b, x[i + 3], 14, -187363961);
- b = md5_gg(b, c, d, a, x[i + 8], 20, 1163531501);
- a = md5_gg(a, b, c, d, x[i + 13], 5, -1444681467);
- d = md5_gg(d, a, b, c, x[i + 2], 9, -51403784);
- c = md5_gg(c, d, a, b, x[i + 7], 14, 1735328473);
- b = md5_gg(b, c, d, a, x[i + 12], 20, -1926607734);
- a = md5_hh(a, b, c, d, x[i + 5], 4, -378558);
- d = md5_hh(d, a, b, c, x[i + 8], 11, -2022574463);
- c = md5_hh(c, d, a, b, x[i + 11], 16, 1839030562);
- b = md5_hh(b, c, d, a, x[i + 14], 23, -35309556);
- a = md5_hh(a, b, c, d, x[i + 1], 4, -1530992060);
- d = md5_hh(d, a, b, c, x[i + 4], 11, 1272893353);
- c = md5_hh(c, d, a, b, x[i + 7], 16, -155497632);
- b = md5_hh(b, c, d, a, x[i + 10], 23, -1094730640);
- a = md5_hh(a, b, c, d, x[i + 13], 4, 681279174);
- d = md5_hh(d, a, b, c, x[i + 0], 11, -358537222);
- c = md5_hh(c, d, a, b, x[i + 3], 16, -722521979);
- b = md5_hh(b, c, d, a, x[i + 6], 23, 76029189);
- a = md5_hh(a, b, c, d, x[i + 9], 4, -640364487);
- d = md5_hh(d, a, b, c, x[i + 12], 11, -421815835);
- c = md5_hh(c, d, a, b, x[i + 15], 16, 530742520);
- b = md5_hh(b, c, d, a, x[i + 2], 23, -995338651);
- a = md5_ii(a, b, c, d, x[i + 0], 6, -198630844);
- d = md5_ii(d, a, b, c, x[i + 7], 10, 1126891415);
- c = md5_ii(c, d, a, b, x[i + 14], 15, -1416354905);
- b = md5_ii(b, c, d, a, x[i + 5], 21, -57434055);
- a = md5_ii(a, b, c, d, x[i + 12], 6, 1700485571);
- d = md5_ii(d, a, b, c, x[i + 3], 10, -1894986606);
- c = md5_ii(c, d, a, b, x[i + 10], 15, -1051523);
- b = md5_ii(b, c, d, a, x[i + 1], 21, -2054922799);
- a = md5_ii(a, b, c, d, x[i + 8], 6, 1873313359);
- d = md5_ii(d, a, b, c, x[i + 15], 10, -30611744);
- c = md5_ii(c, d, a, b, x[i + 6], 15, -1560198380);
- b = md5_ii(b, c, d, a, x[i + 13], 21, 1309151649);
- a = md5_ii(a, b, c, d, x[i + 4], 6, -145523070);
- d = md5_ii(d, a, b, c, x[i + 11], 10, -1120210379);
- c = md5_ii(c, d, a, b, x[i + 2], 15, 718787259);
- b = md5_ii(b, c, d, a, x[i + 9], 21, -343485551);
- a = safe_add(a, olda);
- b = safe_add(b, oldb);
- c = safe_add(c, oldc);
- d = safe_add(d, oldd);
- }
- return Array(a, b, c, d);
- }
- /*
- * These functions implement the four basic operations the algorithm uses.
- */
- function md5_cmn(q, a, b, x, s, t) {
- return safe_add(bit_rol(safe_add(safe_add(a, q), safe_add(x, t)), s), b);
- }
- function md5_ff(a, b, c, d, x, s, t) {
- return md5_cmn(b & c | ~b & d, a, b, x, s, t);
- }
- function md5_gg(a, b, c, d, x, s, t) {
- return md5_cmn(b & d | c & ~d, a, b, x, s, t);
- }
- function md5_hh(a, b, c, d, x, s, t) {
- return md5_cmn(b ^ c ^ d, a, b, x, s, t);
- }
- function md5_ii(a, b, c, d, x, s, t) {
- return md5_cmn(c ^ (b | ~d), a, b, x, s, t);
- }
- /*
- * Add integers, wrapping at 2^32. This uses 16-bit operations internally
- * to work around bugs in some JS interpreters.
- */
- function safe_add(x, y) {
- var lsw = (x & 0xFFFF) + (y & 0xFFFF);
- var msw = (x >> 16) + (y >> 16) + (lsw >> 16);
- return msw << 16 | lsw & 0xFFFF;
- }
- /*
- * Bitwise rotate a 32-bit number to the left.
- */
- function bit_rol(num, cnt) {
- return num << cnt | num >>> 32 - cnt;
- }
- module.exports = function md5(buf) {
- return helpers.hash(buf, core_md5, 16);
- };
- },{"./helpers":394}],396:[function(require,module,exports){
- "use strict";
- /*
- * A JavaScript implementation of the Secure Hash Algorithm, SHA-1, as defined
- * in FIPS PUB 180-1
- * Version 2.1a Copyright Paul Johnston 2000 - 2002.
- * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet
- * Distributed under the BSD License
- * See http://pajhome.org.uk/crypt/md5 for details.
- */
- var helpers = require('./helpers');
- /*
- * Calculate the SHA-1 of an array of big-endian words, and a bit length
- */
- function core_sha1(x, len) {
- /* append padding */
- x[len >> 5] |= 0x80 << 24 - len % 32;
- x[(len + 64 >> 9 << 4) + 15] = len;
- var w = Array(80);
- var a = 1732584193;
- var b = -271733879;
- var c = -1732584194;
- var d = 271733878;
- var e = -1009589776;
- for (var i = 0; i < x.length; i += 16) {
- var olda = a;
- var oldb = b;
- var oldc = c;
- var oldd = d;
- var olde = e;
- for (var j = 0; j < 80; j++) {
- 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);
- 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)));
- e = d;
- d = c;
- c = rol(b, 30);
- b = a;
- a = t;
- }
- a = safe_add(a, olda);
- b = safe_add(b, oldb);
- c = safe_add(c, oldc);
- d = safe_add(d, oldd);
- e = safe_add(e, olde);
- }
- return Array(a, b, c, d, e);
- }
- /*
- * Perform the appropriate triplet combination function for the current
- * iteration
- */
- function sha1_ft(t, b, c, d) {
- if (t < 20) return b & c | ~b & d;
- if (t < 40) return b ^ c ^ d;
- if (t < 60) return b & c | b & d | c & d;
- return b ^ c ^ d;
- }
- /*
- * Determine the appropriate additive constant for the current iteration
- */
- function sha1_kt(t) {
- return t < 20 ? 1518500249 : t < 40 ? 1859775393 : t < 60 ? -1894007588 : -899497514;
- }
- /*
- * Add integers, wrapping at 2^32. This uses 16-bit operations internally
- * to work around bugs in some JS interpreters.
- */
- function safe_add(x, y) {
- var lsw = (x & 0xFFFF) + (y & 0xFFFF);
- var msw = (x >> 16) + (y >> 16) + (lsw >> 16);
- return msw << 16 | lsw & 0xFFFF;
- }
- /*
- * Bitwise rotate a 32-bit number to the left.
- */
- function rol(num, cnt) {
- return num << cnt | num >>> 32 - cnt;
- }
- module.exports = function sha1(buf) {
- return helpers.hash(buf, core_sha1, 20, true);
- };
- },{"./helpers":394}],397:[function(require,module,exports){
- "use strict";
- module.exports = function () {
- return function () {};
- };
- },{}],398:[function(require,module,exports){
- (function (Buffer){(function (){
- "use strict";
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
- var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
- var _require = require('stream'),
- Stream = _require.Stream;
- var _require2 = require('../lib/common/utils/isArray'),
- isArray = _require2.isArray;
- module.exports.string = function isString(obj) {
- return typeof obj === 'string';
- };
- module.exports.array = isArray;
- module.exports.buffer = Buffer.isBuffer;
- function isStream(obj) {
- return obj instanceof Stream;
- }
- module.exports.writableStream = function isWritableStream(obj) {
- return isStream(obj) && typeof obj._write === 'function' && (0, _typeof2.default)(obj._writableState) === 'object';
- };
- }).call(this)}).call(this,{"isBuffer":require("../node_modules/is-buffer/index.js")})
- },{"../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){
- "use strict";
- var immediate = require('immediate');
- var process = module.exports = {};
- process.nextTick = immediate;
- process.title = 'browser';
- process.browser = true;
- process.env = {};
- process.argv = [];
- process.version = ''; // empty string to avoid regexp issues
- process.versions = {};
- function noop() {}
- process.on = noop;
- process.addListener = noop;
- process.once = noop;
- process.off = noop;
- process.removeListener = noop;
- process.removeAllListeners = noop;
- process.emit = noop;
- process.prependListener = noop;
- process.prependOnceListener = noop;
- process.listeners = function (name) {
- return [];
- };
- process.binding = function (name) {
- throw new Error('process.binding is not supported');
- };
- process.cwd = function () {
- return '/';
- };
- process.chdir = function (dir) {
- throw new Error('process.chdir is not supported');
- };
- process.umask = function () {
- return 0;
- };
- },{"immediate":305}],400:[function(require,module,exports){
- (function (global){(function (){
- "use strict";
- require("core-js/modules/es.regexp.exec.js");
- require("core-js/modules/es.string.search.js");
- //"version": "2.8.2",
- var ClientRequest = require('./lib/request');
- var response = require('./lib/response');
- var extend = require('xtend');
- var statusCodes = require('builtin-status-codes');
- var url = require('url');
- var http = exports;
- http.request = function (opts, cb) {
- 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
- // will result in a (valid) protocol-relative url. However, this won't work if
- // the protocol is something else, like 'file:'
- var defaultProtocol = global.location.protocol.search(/^https?:$/) === -1 ? 'http:' : '';
- var protocol = opts.protocol || defaultProtocol;
- var host = opts.hostname || opts.host;
- var port = opts.port;
- var path = opts.path || '/'; // Necessary for IPv6 addresses
- if (host && host.indexOf(':') !== -1) host = '[' + host + ']'; // This may be a relative url. The browser should always be able to interpret it correctly.
- opts.url = (host ? protocol + '//' + host : '') + (port ? ':' + port : '') + path;
- opts.method = (opts.method || 'GET').toUpperCase();
- opts.headers = opts.headers || {}; // Also valid opts.auth, opts.mode
- var req = new ClientRequest(opts);
- if (cb) req.on('response', cb);
- return req;
- };
- http.get = function get(opts, cb) {
- var req = http.request(opts, cb);
- req.end();
- return req;
- };
- http.ClientRequest = ClientRequest;
- http.IncomingMessage = response.IncomingMessage;
- http.Agent = function () {};
- http.Agent.defaultMaxSockets = 4;
- http.globalAgent = new http.Agent();
- http.STATUS_CODES = statusCodes;
- 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'];
- }).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
- },{"./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){
- (function (global){(function (){
- "use strict";
- require("core-js/modules/es.object.to-string.js");
- require("core-js/modules/es.promise.js");
- require("core-js/modules/es.array-buffer.constructor.js");
- require("core-js/modules/es.array-buffer.slice.js");
- require("core-js/modules/es.array.slice.js");
- exports.fetch = isFunction(global.fetch) && isFunction(global.ReadableStream);
- exports.writableStream = isFunction(global.WritableStream);
- exports.abortController = isFunction(global.AbortController);
- exports.blobConstructor = false;
- try {
- new Blob([new ArrayBuffer(1)]);
- exports.blobConstructor = true;
- } catch (e) {} // The xhr request to example.com may violate some restrictive CSP configurations,
- // so if we're running in a browser that supports `fetch`, avoid calling getXHR()
- // and assume support for certain features below.
- var xhr;
- function getXHR() {
- // Cache the xhr value
- if (xhr !== undefined) return xhr;
- if (global.XMLHttpRequest) {
- xhr = new global.XMLHttpRequest(); // If XDomainRequest is available (ie only, where xhr might not work
- // cross domain), use the page location. Otherwise use example.com
- // Note: this doesn't actually make an http request.
- try {
- xhr.open('GET', global.XDomainRequest ? '/' : 'https://example.com');
- } catch (e) {
- xhr = null;
- }
- } else {
- // Service workers don't have XHR
- xhr = null;
- }
- return xhr;
- }
- function checkTypeSupport(type) {
- var xhr = getXHR();
- if (!xhr) return false;
- try {
- xhr.responseType = type;
- return xhr.responseType === type;
- } catch (e) {}
- return false;
- } // For some strange reason, Safari 7.0 reports typeof global.ArrayBuffer === 'object'.
- // Safari 7.1 appears to have fixed this bug.
- var haveArrayBuffer = typeof global.ArrayBuffer !== 'undefined';
- var haveSlice = haveArrayBuffer && isFunction(global.ArrayBuffer.prototype.slice); // If fetch is supported, then arraybuffer will be supported too. Skip calling
- // checkTypeSupport(), since that calls getXHR().
- exports.arraybuffer = exports.fetch || haveArrayBuffer && checkTypeSupport('arraybuffer'); // These next two tests unavoidably show warnings in Chrome. Since fetch will always
- // be used if it's available, just return false for these to avoid the warnings.
- exports.msstream = !exports.fetch && haveSlice && checkTypeSupport('ms-stream');
- exports.mozchunkedarraybuffer = !exports.fetch && haveArrayBuffer && checkTypeSupport('moz-chunked-arraybuffer'); // If fetch is supported, then overrideMimeType will be supported too. Skip calling
- // getXHR().
- exports.overrideMimeType = exports.fetch || (getXHR() ? isFunction(getXHR().overrideMimeType) : false);
- exports.vbArray = isFunction(global.VBArray);
- function isFunction(value) {
- return typeof value === 'function';
- }
- xhr = null; // Help gc
- }).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
- },{"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){
- (function (process,global,Buffer){(function (){
- "use strict";
- require("core-js/modules/es.object.to-string.js");
- require("core-js/modules/es.regexp.to-string.js");
- require("core-js/modules/web.dom-collections.for-each.js");
- require("core-js/modules/es.object.keys.js");
- require("core-js/modules/es.array.concat.js");
- require("core-js/modules/es.array.map.js");
- require("core-js/modules/es.function.name.js");
- require("core-js/modules/es.promise.js");
- require("core-js/modules/es.regexp.exec.js");
- require("core-js/modules/es.string.split.js");
- var capability = require('./capability');
- var inherits = require('inherits');
- var response = require('./response');
- var stream = require('readable-stream');
- var toArrayBuffer = require('to-arraybuffer');
- var IncomingMessage = response.IncomingMessage;
- var rStates = response.readyStates;
- function decideMode(preferBinary, useFetch) {
- if (capability.fetch && useFetch) {
- return 'fetch';
- } else if (capability.mozchunkedarraybuffer) {
- return 'moz-chunked-arraybuffer';
- } else if (capability.msstream) {
- return 'ms-stream';
- } else if (capability.arraybuffer && preferBinary) {
- return 'arraybuffer';
- } else if (capability.vbArray && preferBinary) {
- return 'text:vbarray';
- } else {
- return 'text';
- }
- }
- var ClientRequest = module.exports = function (opts) {
- var self = this;
- stream.Writable.call(self);
- self._opts = opts;
- self._body = [];
- self._headers = {};
- if (opts.auth) self.setHeader('Authorization', 'Basic ' + new Buffer(opts.auth).toString('base64'));
- Object.keys(opts.headers).forEach(function (name) {
- self.setHeader(name, opts.headers[name]);
- });
- var preferBinary;
- var useFetch = true;
- if (opts.mode === 'disable-fetch' || 'requestTimeout' in opts && !capability.abortController) {
- // If the use of XHR should be preferred. Not typically needed.
- useFetch = false;
- preferBinary = true;
- } else if (opts.mode === 'prefer-streaming') {
- // If streaming is a high priority but binary compatibility and
- // the accuracy of the 'content-type' header aren't
- preferBinary = false;
- } else if (opts.mode === 'allow-wrong-content-type') {
- // If streaming is more important than preserving the 'content-type' header
- preferBinary = !capability.overrideMimeType;
- } else if (!opts.mode || opts.mode === 'default' || opts.mode === 'prefer-fast') {
- // Use binary if text streaming may corrupt data or the content-type header, or for speed
- preferBinary = true;
- } else {
- throw new Error('Invalid value for opts.mode');
- }
- self._mode = decideMode(preferBinary, useFetch);
- self._fetchTimer = null;
- self.on('finish', function () {
- self._onFinish();
- });
- };
- inherits(ClientRequest, stream.Writable);
- ClientRequest.prototype.setHeader = function (name, value) {
- var self = this;
- var lowerName = name.toLowerCase(); // This check is not necessary, but it prevents warnings from browsers about setting unsafe
- // headers. To be honest I'm not entirely sure hiding these warnings is a good thing, but
- // http-browserify did it, so I will too.
- if (unsafeHeaders.indexOf(lowerName) !== -1) return;
- self._headers[lowerName] = {
- name: name,
- value: value
- };
- };
- ClientRequest.prototype.getHeader = function (name) {
- var header = this._headers[name.toLowerCase()];
- if (header) return header.value;
- return null;
- };
- ClientRequest.prototype.removeHeader = function (name) {
- var self = this;
- delete self._headers[name.toLowerCase()];
- };
- ClientRequest.prototype._onFinish = function () {
- var self = this;
- if (self._destroyed) return;
- var opts = self._opts;
- var headersObj = self._headers;
- var body = null;
- if (opts.method !== 'GET' && opts.method !== 'HEAD') {
- if (capability.arraybuffer) {
- body = toArrayBuffer(Buffer.concat(self._body));
- } else if (capability.blobConstructor) {
- body = new global.Blob(self._body.map(function (buffer) {
- return toArrayBuffer(buffer);
- }), {
- type: (headersObj['content-type'] || {}).value || ''
- });
- } else {
- // get utf8 string
- body = Buffer.concat(self._body).toString();
- }
- } // create flattened list of headers
- var headersList = [];
- Object.keys(headersObj).forEach(function (keyName) {
- var name = headersObj[keyName].name;
- var value = headersObj[keyName].value;
- if (Array.isArray(value)) {
- value.forEach(function (v) {
- headersList.push([name, v]);
- });
- } else {
- headersList.push([name, value]);
- }
- });
- if (self._mode === 'fetch') {
- var signal = null;
- var fetchTimer = null;
- if (capability.abortController) {
- var controller = new AbortController();
- signal = controller.signal;
- self._fetchAbortController = controller;
- if ('requestTimeout' in opts && opts.requestTimeout !== 0) {
- self._fetchTimer = global.setTimeout(function () {
- self.emit('requestTimeout');
- if (self._fetchAbortController) self._fetchAbortController.abort();
- }, opts.requestTimeout);
- }
- }
- global.fetch(self._opts.url, {
- method: self._opts.method,
- headers: headersList,
- body: body || undefined,
- mode: 'cors',
- credentials: opts.withCredentials ? 'include' : 'same-origin',
- signal: signal
- }).then(function (response) {
- self._fetchResponse = response;
- self._connect();
- }, function (reason) {
- global.clearTimeout(self._fetchTimer);
- if (!self._destroyed) self.emit('error', reason);
- });
- } else {
- var xhr = self._xhr = new global.XMLHttpRequest();
- try {
- xhr.open(self._opts.method, self._opts.url, true);
- } catch (err) {
- process.nextTick(function () {
- self.emit('error', err);
- });
- return;
- } // Can't set responseType on really old browsers
- if ('responseType' in xhr) xhr.responseType = self._mode.split(':')[0];
- if ('withCredentials' in xhr) xhr.withCredentials = !!opts.withCredentials;
- if (self._mode === 'text' && 'overrideMimeType' in xhr) xhr.overrideMimeType('text/plain; charset=x-user-defined');
- if ('requestTimeout' in opts) {
- xhr.timeout = opts.requestTimeout;
- xhr.ontimeout = function () {
- self.emit('requestTimeout');
- };
- }
- headersList.forEach(function (header) {
- xhr.setRequestHeader(header[0], header[1]);
- });
- self._response = null;
- xhr.onreadystatechange = function () {
- switch (xhr.readyState) {
- case rStates.LOADING:
- case rStates.DONE:
- self._onXHRProgress();
- break;
- }
- }; // Necessary for streaming in Firefox, since xhr.response is ONLY defined
- // in onprogress, not in onreadystatechange with xhr.readyState = 3
- if (self._mode === 'moz-chunked-arraybuffer') {
- xhr.onprogress = function () {
- self._onXHRProgress();
- };
- }
- xhr.onerror = function () {
- if (self._destroyed) return;
- self.emit('error', new Error('XHR error'));
- };
- try {
- xhr.send(body);
- } catch (err) {
- process.nextTick(function () {
- self.emit('error', err);
- });
- return;
- }
- }
- };
- /**
- * Checks if xhr.status is readable and non-zero, indicating no error.
- * Even though the spec says it should be available in readyState 3,
- * accessing it throws an exception in IE8
- */
- function statusValid(xhr) {
- try {
- var status = xhr.status;
- return status !== null && status !== 0;
- } catch (e) {
- return false;
- }
- }
- ClientRequest.prototype._onXHRProgress = function () {
- var self = this;
- if (!statusValid(self._xhr) || self._destroyed) return;
- if (!self._response) self._connect();
- self._response._onXHRProgress();
- };
- ClientRequest.prototype._connect = function () {
- var self = this;
- if (self._destroyed) return;
- self._response = new IncomingMessage(self._xhr, self._fetchResponse, self._mode, self._fetchTimer);
- self._response.on('error', function (err) {
- self.emit('error', err);
- });
- self.emit('response', self._response);
- };
- ClientRequest.prototype._write = function (chunk, encoding, cb) {
- var self = this;
- self._body.push(chunk);
- cb();
- };
- ClientRequest.prototype.abort = ClientRequest.prototype.destroy = function () {
- var self = this;
- self._destroyed = true;
- global.clearTimeout(self._fetchTimer);
- if (self._response) self._response._destroyed = true;
- if (self._xhr) self._xhr.abort();else if (self._fetchAbortController) self._fetchAbortController.abort();
- };
- ClientRequest.prototype.end = function (data, encoding, cb) {
- var self = this;
- if (typeof data === 'function') {
- cb = data;
- data = undefined;
- }
- stream.Writable.prototype.end.call(self, data, encoding, cb);
- };
- ClientRequest.prototype.flushHeaders = function () {};
- ClientRequest.prototype.setTimeout = function () {};
- ClientRequest.prototype.setNoDelay = function () {};
- ClientRequest.prototype.setSocketKeepAlive = function () {}; // Taken from http://www.w3.org/TR/XMLHttpRequest/#the-setrequestheader%28%29-method
- 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'];
- }).call(this)}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {},require("buffer").Buffer)
- },{"./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){
- (function (process,global,Buffer){(function (){
- "use strict";
- require("core-js/modules/web.dom-collections.for-each.js");
- require("core-js/modules/es.object.to-string.js");
- require("core-js/modules/es.promise.js");
- require("core-js/modules/es.regexp.exec.js");
- require("core-js/modules/es.string.split.js");
- require("core-js/modules/es.string.match.js");
- require("core-js/modules/es.array.iterator.js");
- require("core-js/modules/es.array-buffer.slice.js");
- require("core-js/modules/es.typed-array.uint8-array.js");
- require("core-js/modules/es.typed-array.copy-within.js");
- require("core-js/modules/es.typed-array.every.js");
- require("core-js/modules/es.typed-array.fill.js");
- require("core-js/modules/es.typed-array.filter.js");
- require("core-js/modules/es.typed-array.find.js");
- require("core-js/modules/es.typed-array.find-index.js");
- require("core-js/modules/es.typed-array.for-each.js");
- require("core-js/modules/es.typed-array.includes.js");
- require("core-js/modules/es.typed-array.index-of.js");
- require("core-js/modules/es.typed-array.iterator.js");
- require("core-js/modules/es.typed-array.join.js");
- require("core-js/modules/es.typed-array.last-index-of.js");
- require("core-js/modules/es.typed-array.map.js");
- require("core-js/modules/es.typed-array.reduce.js");
- require("core-js/modules/es.typed-array.reduce-right.js");
- require("core-js/modules/es.typed-array.reverse.js");
- require("core-js/modules/es.typed-array.set.js");
- require("core-js/modules/es.typed-array.slice.js");
- require("core-js/modules/es.typed-array.some.js");
- require("core-js/modules/es.typed-array.sort.js");
- require("core-js/modules/es.typed-array.subarray.js");
- require("core-js/modules/es.typed-array.to-locale-string.js");
- require("core-js/modules/es.typed-array.to-string.js");
- require("core-js/modules/es.array.slice.js");
- var capability = require('./capability');
- var inherits = require('inherits');
- var stream = require('readable-stream');
- var rStates = exports.readyStates = {
- UNSENT: 0,
- OPENED: 1,
- HEADERS_RECEIVED: 2,
- LOADING: 3,
- DONE: 4
- };
- var IncomingMessage = exports.IncomingMessage = function (xhr, response, mode, fetchTimer) {
- var self = this;
- stream.Readable.call(self);
- self._mode = mode;
- self.headers = {};
- self.rawHeaders = [];
- self.trailers = {};
- self.rawTrailers = []; // Fake the 'close' event, but only once 'end' fires
- self.on('end', function () {
- // The nextTick is necessary to prevent the 'request' module from causing an infinite loop
- process.nextTick(function () {
- self.emit('close');
- });
- });
- if (mode === 'fetch') {
- var read = function read() {
- reader.read().then(function (result) {
- if (self._destroyed) return;
- if (result.done) {
- global.clearTimeout(fetchTimer);
- self.push(null);
- return;
- }
- self.push(new Buffer(result.value));
- read();
- }).catch(function (err) {
- global.clearTimeout(fetchTimer);
- if (!self._destroyed) self.emit('error', err);
- });
- };
- self._fetchResponse = response;
- self.url = response.url;
- self.statusCode = response.status;
- self.statusMessage = response.statusText;
- response.headers.forEach(function (header, key) {
- self.headers[key.toLowerCase()] = header;
- self.rawHeaders.push(key, header);
- });
- if (capability.writableStream) {
- var writable = new WritableStream({
- write: function write(chunk) {
- return new Promise(function (resolve, reject) {
- if (self._destroyed) {
- reject();
- } else if (self.push(new Buffer(chunk))) {
- resolve();
- } else {
- self._resumeFetch = resolve;
- }
- });
- },
- close: function close() {
- global.clearTimeout(fetchTimer);
- if (!self._destroyed) self.push(null);
- },
- abort: function abort(err) {
- if (!self._destroyed) self.emit('error', err);
- }
- });
- try {
- response.body.pipeTo(writable).catch(function (err) {
- global.clearTimeout(fetchTimer);
- if (!self._destroyed) self.emit('error', err);
- });
- return;
- } catch (e) {} // pipeTo method isn't defined. Can't find a better way to feature test this
- } // fallback for when writableStream or pipeTo aren't available
- var reader = response.body.getReader();
- read();
- } else {
- self._xhr = xhr;
- self._pos = 0;
- self.url = xhr.responseURL;
- self.statusCode = xhr.status;
- self.statusMessage = xhr.statusText;
- var headers = xhr.getAllResponseHeaders().split(/\r?\n/);
- headers.forEach(function (header) {
- var matches = header.match(/^([^:]+):\s*(.*)/);
- if (matches) {
- var key = matches[1].toLowerCase();
- if (key === 'set-cookie') {
- if (self.headers[key] === undefined) {
- self.headers[key] = [];
- }
- self.headers[key].push(matches[2]);
- } else if (self.headers[key] !== undefined) {
- self.headers[key] += ', ' + matches[2];
- } else {
- self.headers[key] = matches[2];
- }
- self.rawHeaders.push(matches[1], matches[2]);
- }
- });
- self._charset = 'x-user-defined';
- if (!capability.overrideMimeType) {
- var mimeType = self.rawHeaders['mime-type'];
- if (mimeType) {
- var charsetMatch = mimeType.match(/;\s*charset=([^;])(;|$)/);
- if (charsetMatch) {
- self._charset = charsetMatch[1].toLowerCase();
- }
- }
- if (!self._charset) self._charset = 'utf-8'; // best guess
- }
- }
- };
- inherits(IncomingMessage, stream.Readable);
- IncomingMessage.prototype._read = function () {
- var self = this;
- var resolve = self._resumeFetch;
- if (resolve) {
- self._resumeFetch = null;
- resolve();
- }
- };
- IncomingMessage.prototype._onXHRProgress = function () {
- var self = this;
- var xhr = self._xhr;
- var response = null;
- switch (self._mode) {
- case 'text:vbarray':
- // For IE9
- if (xhr.readyState !== rStates.DONE) break;
- try {
- // This fails in IE8
- response = new global.VBArray(xhr.responseBody).toArray();
- } catch (e) {}
- if (response !== null) {
- self.push(new Buffer(response));
- break;
- }
- // Falls through in IE8
- case 'text':
- try {
- // This will fail when readyState = 3 in IE9. Switch mode and wait for readyState = 4
- response = xhr.responseText;
- } catch (e) {
- self._mode = 'text:vbarray';
- break;
- }
- if (response.length > self._pos) {
- var newData = response.substr(self._pos);
- if (self._charset === 'x-user-defined') {
- var buffer = new Buffer(newData.length);
- for (var i = 0; i < newData.length; i++) {
- buffer[i] = newData.charCodeAt(i) & 0xff;
- }
- self.push(buffer);
- } else {
- self.push(newData, self._charset);
- }
- self._pos = response.length;
- }
- break;
- case 'arraybuffer':
- if (xhr.readyState !== rStates.DONE || !xhr.response) break;
- response = xhr.response;
- self.push(new Buffer(new Uint8Array(response)));
- break;
- case 'moz-chunked-arraybuffer':
- // take whole
- response = xhr.response;
- if (xhr.readyState !== rStates.LOADING || !response) break;
- self.push(new Buffer(new Uint8Array(response)));
- break;
- case 'ms-stream':
- response = xhr.response;
- if (xhr.readyState !== rStates.LOADING) break;
- var reader = new global.MSStreamReader();
- reader.onprogress = function () {
- if (reader.result.byteLength > self._pos) {
- self.push(new Buffer(new Uint8Array(reader.result.slice(self._pos))));
- self._pos = reader.result.byteLength;
- }
- };
- reader.onload = function () {
- self.push(null);
- }; // reader.onerror = ??? // TODO: this
- reader.readAsArrayBuffer(response);
- break;
- } // The ms-stream case handles end separately in reader.onload()
- if (self._xhr.readyState === rStates.DONE && self._mode !== 'ms-stream') {
- self.push(null);
- }
- };
- }).call(this)}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {},require("buffer").Buffer)
- },{"./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){
- // Copyright Joyent, Inc. and other Node contributors.
- //
- // Permission is hereby granted, free of charge, to any person obtaining a
- // copy of this software and associated documentation files (the
- // "Software"), to deal in the Software without restriction, including
- // without limitation the rights to use, copy, modify, merge, publish,
- // distribute, sublicense, and/or sell copies of the Software, and to permit
- // persons to whom the Software is furnished to do so, subject to the
- // following conditions:
- //
- // The above copyright notice and this permission notice shall be included
- // in all copies or substantial portions of the Software.
- //
- // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
- // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
- // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
- // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
- // USE OR OTHER DEALINGS IN THE SOFTWARE.
- 'use strict';
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
- var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
- require("core-js/modules/es.regexp.exec.js");
- require("core-js/modules/es.string.search.js");
- require("core-js/modules/es.array.concat.js");
- require("core-js/modules/es.string.split.js");
- require("core-js/modules/es.string.replace.js");
- require("core-js/modules/es.array.join.js");
- require("core-js/modules/es.string.trim.js");
- require("core-js/modules/es.string.match.js");
- require("core-js/modules/es.array.slice.js");
- require("core-js/modules/es.object.keys.js");
- require("core-js/modules/es.array.splice.js");
- var punycode = require('punycode');
- var util = require('./util');
- exports.parse = urlParse;
- exports.resolve = urlResolve;
- exports.resolveObject = urlResolveObject;
- exports.format = urlFormat;
- exports.Url = Url;
- function Url() {
- this.protocol = null;
- this.slashes = null;
- this.auth = null;
- this.host = null;
- this.port = null;
- this.hostname = null;
- this.hash = null;
- this.search = null;
- this.query = null;
- this.pathname = null;
- this.path = null;
- this.href = null;
- } // Reference: RFC 3986, RFC 1808, RFC 2396
- // define these here so at least they only have to be
- // compiled once on the first module load.
- var protocolPattern = /^([a-z0-9.+-]+:)/i,
- portPattern = /:[0-9]*$/,
- // Special case for a simple path URL
- simplePathPattern = /^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,
- // RFC 2396: characters reserved for delimiting URLs.
- // We actually just auto-escape these.
- delims = ['<', '>', '"', '`', ' ', '\r', '\n', '\t'],
- // RFC 2396: characters not allowed for various reasons.
- unwise = ['{', '}', '|', '\\', '^', '`'].concat(delims),
- // Allowed by RFCs, but cause of XSS attacks. Always escape these.
- autoEscape = ['\''].concat(unwise),
- // Characters that are never ever allowed in a hostname.
- // Note that any invalid chars are also handled, but these
- // are the ones that are *expected* to be seen, so we fast-path
- // them.
- nonHostChars = ['%', '/', '?', ';', '#'].concat(autoEscape),
- hostEndingChars = ['/', '?', '#'],
- hostnameMaxLen = 255,
- hostnamePartPattern = /^[+a-z0-9A-Z_-]{0,63}$/,
- hostnamePartStart = /^([+a-z0-9A-Z_-]{0,63})(.*)$/,
- // protocols that can allow "unsafe" and "unwise" chars.
- unsafeProtocol = {
- 'javascript': true,
- 'javascript:': true
- },
- // protocols that never have a hostname.
- hostlessProtocol = {
- 'javascript': true,
- 'javascript:': true
- },
- // protocols that always contain a // bit.
- slashedProtocol = {
- 'http': true,
- 'https': true,
- 'ftp': true,
- 'gopher': true,
- 'file': true,
- 'http:': true,
- 'https:': true,
- 'ftp:': true,
- 'gopher:': true,
- 'file:': true
- },
- querystring = require('querystring');
- function urlParse(url, parseQueryString, slashesDenoteHost) {
- if (url && util.isObject(url) && url instanceof Url) return url;
- var u = new Url();
- u.parse(url, parseQueryString, slashesDenoteHost);
- return u;
- }
- Url.prototype.parse = function (url, parseQueryString, slashesDenoteHost) {
- if (!util.isString(url)) {
- throw new TypeError("Parameter 'url' must be a string, not " + (0, _typeof2.default)(url));
- } // Copy chrome, IE, opera backslash-handling behavior.
- // Back slashes before the query string get converted to forward slashes
- // See: https://code.google.com/p/chromium/issues/detail?id=25916
- var queryIndex = url.indexOf('?'),
- splitter = queryIndex !== -1 && queryIndex < url.indexOf('#') ? '?' : '#',
- uSplit = url.split(splitter),
- slashRegex = /\\/g;
- uSplit[0] = uSplit[0].replace(slashRegex, '/');
- url = uSplit.join(splitter);
- var rest = url; // trim before proceeding.
- // This is to support parse stuff like " http://foo.com \n"
- rest = rest.trim();
- if (!slashesDenoteHost && url.split('#').length === 1) {
- // Try fast path regexp
- var simplePath = simplePathPattern.exec(rest);
- if (simplePath) {
- this.path = rest;
- this.href = rest;
- this.pathname = simplePath[1];
- if (simplePath[2]) {
- this.search = simplePath[2];
- if (parseQueryString) {
- this.query = querystring.parse(this.search.substr(1));
- } else {
- this.query = this.search.substr(1);
- }
- } else if (parseQueryString) {
- this.search = '';
- this.query = {};
- }
- return this;
- }
- }
- var proto = protocolPattern.exec(rest);
- if (proto) {
- proto = proto[0];
- var lowerProto = proto.toLowerCase();
- this.protocol = lowerProto;
- rest = rest.substr(proto.length);
- } // figure out if it's got a host
- // user@server is *always* interpreted as a hostname, and url
- // resolution will treat //foo/bar as host=foo,path=bar because that's
- // how the browser resolves relative URLs.
- if (slashesDenoteHost || proto || rest.match(/^\/\/[^@\/]+@[^@\/]+/)) {
- var slashes = rest.substr(0, 2) === '//';
- if (slashes && !(proto && hostlessProtocol[proto])) {
- rest = rest.substr(2);
- this.slashes = true;
- }
- }
- if (!hostlessProtocol[proto] && (slashes || proto && !slashedProtocol[proto])) {
- // there's a hostname.
- // the first instance of /, ?, ;, or # ends the host.
- //
- // If there is an @ in the hostname, then non-host chars *are* allowed
- // to the left of the last @ sign, unless some host-ending character
- // comes *before* the @-sign.
- // URLs are obnoxious.
- //
- // ex:
- // http://a@b@c/ => user:a@b host:c
- // http://a@b?@c => user:a host:c path:/?@c
- // v0.12 TODO(isaacs): This is not quite how Chrome does things.
- // Review our test case against browsers more comprehensively.
- // find the first instance of any hostEndingChars
- var hostEnd = -1;
- for (var i = 0; i < hostEndingChars.length; i++) {
- var hec = rest.indexOf(hostEndingChars[i]);
- if (hec !== -1 && (hostEnd === -1 || hec < hostEnd)) hostEnd = hec;
- } // at this point, either we have an explicit point where the
- // auth portion cannot go past, or the last @ char is the decider.
- var auth, atSign;
- if (hostEnd === -1) {
- // atSign can be anywhere.
- atSign = rest.lastIndexOf('@');
- } else {
- // atSign must be in auth portion.
- // http://a@b/c@d => host:b auth:a path:/c@d
- atSign = rest.lastIndexOf('@', hostEnd);
- } // Now we have a portion which is definitely the auth.
- // Pull that off.
- if (atSign !== -1) {
- auth = rest.slice(0, atSign);
- rest = rest.slice(atSign + 1);
- this.auth = decodeURIComponent(auth);
- } // the host is the remaining to the left of the first non-host char
- hostEnd = -1;
- for (var i = 0; i < nonHostChars.length; i++) {
- var hec = rest.indexOf(nonHostChars[i]);
- if (hec !== -1 && (hostEnd === -1 || hec < hostEnd)) hostEnd = hec;
- } // if we still have not hit it, then the entire thing is a host.
- if (hostEnd === -1) hostEnd = rest.length;
- this.host = rest.slice(0, hostEnd);
- rest = rest.slice(hostEnd); // pull out port.
- this.parseHost(); // we've indicated that there is a hostname,
- // so even if it's empty, it has to be present.
- this.hostname = this.hostname || ''; // if hostname begins with [ and ends with ]
- // assume that it's an IPv6 address.
- var ipv6Hostname = this.hostname[0] === '[' && this.hostname[this.hostname.length - 1] === ']'; // validate a little.
- if (!ipv6Hostname) {
- var hostparts = this.hostname.split('.');
- for (var i = 0, l = hostparts.length; i < l; i++) {
- var part = hostparts[i];
- if (!part) continue;
- if (!part.match(hostnamePartPattern)) {
- var newpart = '';
- for (var j = 0, k = part.length; j < k; j++) {
- if (part.charCodeAt(j) > 127) {
- // we replace non-ASCII char with a temporary placeholder
- // we need this to make sure size of hostname is not
- // broken by replacing non-ASCII by nothing
- newpart += 'x';
- } else {
- newpart += part[j];
- }
- } // we test again with ASCII char only
- if (!newpart.match(hostnamePartPattern)) {
- var validParts = hostparts.slice(0, i);
- var notHost = hostparts.slice(i + 1);
- var bit = part.match(hostnamePartStart);
- if (bit) {
- validParts.push(bit[1]);
- notHost.unshift(bit[2]);
- }
- if (notHost.length) {
- rest = '/' + notHost.join('.') + rest;
- }
- this.hostname = validParts.join('.');
- break;
- }
- }
- }
- }
- if (this.hostname.length > hostnameMaxLen) {
- this.hostname = '';
- } else {
- // hostnames are always lower case.
- this.hostname = this.hostname.toLowerCase();
- }
- if (!ipv6Hostname) {
- // IDNA Support: Returns a punycoded representation of "domain".
- // It only converts parts of the domain name that
- // have non-ASCII characters, i.e. it doesn't matter if
- // you call it with a domain that already is ASCII-only.
- this.hostname = punycode.toASCII(this.hostname);
- }
- var p = this.port ? ':' + this.port : '';
- var h = this.hostname || '';
- this.host = h + p;
- this.href += this.host; // strip [ and ] from the hostname
- // the host field still retains them, though
- if (ipv6Hostname) {
- this.hostname = this.hostname.substr(1, this.hostname.length - 2);
- if (rest[0] !== '/') {
- rest = '/' + rest;
- }
- }
- } // now rest is set to the post-host stuff.
- // chop off any delim chars.
- if (!unsafeProtocol[lowerProto]) {
- // First, make 100% sure that any "autoEscape" chars get
- // escaped, even if encodeURIComponent doesn't think they
- // need to be.
- for (var i = 0, l = autoEscape.length; i < l; i++) {
- var ae = autoEscape[i];
- if (rest.indexOf(ae) === -1) continue;
- var esc = encodeURIComponent(ae);
- if (esc === ae) {
- esc = escape(ae);
- }
- rest = rest.split(ae).join(esc);
- }
- } // chop off from the tail first.
- var hash = rest.indexOf('#');
- if (hash !== -1) {
- // got a fragment string.
- this.hash = rest.substr(hash);
- rest = rest.slice(0, hash);
- }
- var qm = rest.indexOf('?');
- if (qm !== -1) {
- this.search = rest.substr(qm);
- this.query = rest.substr(qm + 1);
- if (parseQueryString) {
- this.query = querystring.parse(this.query);
- }
- rest = rest.slice(0, qm);
- } else if (parseQueryString) {
- // no query string, but parseQueryString still requested
- this.search = '';
- this.query = {};
- }
- if (rest) this.pathname = rest;
- if (slashedProtocol[lowerProto] && this.hostname && !this.pathname) {
- this.pathname = '/';
- } //to support http.request
- if (this.pathname || this.search) {
- var p = this.pathname || '';
- var s = this.search || '';
- this.path = p + s;
- } // finally, reconstruct the href based on what has been validated.
- this.href = this.format();
- return this;
- }; // format a parsed object into a url string
- function urlFormat(obj) {
- // ensure it's an object, and not a string url.
- // If it's an obj, this is a no-op.
- // this way, you can call url_format() on strings
- // to clean up potentially wonky urls.
- if (util.isString(obj)) obj = urlParse(obj);
- if (!(obj instanceof Url)) return Url.prototype.format.call(obj);
- return obj.format();
- }
- Url.prototype.format = function () {
- var auth = this.auth || '';
- if (auth) {
- auth = encodeURIComponent(auth);
- auth = auth.replace(/%3A/i, ':');
- auth += '@';
- }
- var protocol = this.protocol || '',
- pathname = this.pathname || '',
- hash = this.hash || '',
- host = false,
- query = '';
- if (this.host) {
- host = auth + this.host;
- } else if (this.hostname) {
- host = auth + (this.hostname.indexOf(':') === -1 ? this.hostname : '[' + this.hostname + ']');
- if (this.port) {
- host += ':' + this.port;
- }
- }
- if (this.query && util.isObject(this.query) && Object.keys(this.query).length) {
- query = querystring.stringify(this.query);
- }
- var search = this.search || query && '?' + query || '';
- if (protocol && protocol.substr(-1) !== ':') protocol += ':'; // only the slashedProtocols get the //. Not mailto:, xmpp:, etc.
- // unless they had them to begin with.
- if (this.slashes || (!protocol || slashedProtocol[protocol]) && host !== false) {
- host = '//' + (host || '');
- if (pathname && pathname.charAt(0) !== '/') pathname = '/' + pathname;
- } else if (!host) {
- host = '';
- }
- if (hash && hash.charAt(0) !== '#') hash = '#' + hash;
- if (search && search.charAt(0) !== '?') search = '?' + search;
- pathname = pathname.replace(/[?#]/g, function (match) {
- return encodeURIComponent(match);
- });
- search = search.replace('#', '%23');
- return protocol + host + pathname + search + hash;
- };
- function urlResolve(source, relative) {
- return urlParse(source, false, true).resolve(relative);
- }
- Url.prototype.resolve = function (relative) {
- return this.resolveObject(urlParse(relative, false, true)).format();
- };
- function urlResolveObject(source, relative) {
- if (!source) return relative;
- return urlParse(source, false, true).resolveObject(relative);
- }
- Url.prototype.resolveObject = function (relative) {
- if (util.isString(relative)) {
- var rel = new Url();
- rel.parse(relative, false, true);
- relative = rel;
- }
- var result = new Url();
- var tkeys = Object.keys(this);
- for (var tk = 0; tk < tkeys.length; tk++) {
- var tkey = tkeys[tk];
- result[tkey] = this[tkey];
- } // hash is always overridden, no matter what.
- // even href="" will remove it.
- result.hash = relative.hash; // if the relative url is empty, then there's nothing left to do here.
- if (relative.href === '') {
- result.href = result.format();
- return result;
- } // hrefs like //foo/bar always cut to the protocol.
- if (relative.slashes && !relative.protocol) {
- // take everything except the protocol from relative
- var rkeys = Object.keys(relative);
- for (var rk = 0; rk < rkeys.length; rk++) {
- var rkey = rkeys[rk];
- if (rkey !== 'protocol') result[rkey] = relative[rkey];
- } //urlParse appends trailing / to urls like http://www.example.com
- if (slashedProtocol[result.protocol] && result.hostname && !result.pathname) {
- result.path = result.pathname = '/';
- }
- result.href = result.format();
- return result;
- }
- if (relative.protocol && relative.protocol !== result.protocol) {
- // if it's a known url protocol, then changing
- // the protocol does weird things
- // first, if it's not file:, then we MUST have a host,
- // and if there was a path
- // to begin with, then we MUST have a path.
- // if it is file:, then the host is dropped,
- // because that's known to be hostless.
- // anything else is assumed to be absolute.
- if (!slashedProtocol[relative.protocol]) {
- var keys = Object.keys(relative);
- for (var v = 0; v < keys.length; v++) {
- var k = keys[v];
- result[k] = relative[k];
- }
- result.href = result.format();
- return result;
- }
- result.protocol = relative.protocol;
- if (!relative.host && !hostlessProtocol[relative.protocol]) {
- var relPath = (relative.pathname || '').split('/');
- while (relPath.length && !(relative.host = relPath.shift())) {
- ;
- }
- if (!relative.host) relative.host = '';
- if (!relative.hostname) relative.hostname = '';
- if (relPath[0] !== '') relPath.unshift('');
- if (relPath.length < 2) relPath.unshift('');
- result.pathname = relPath.join('/');
- } else {
- result.pathname = relative.pathname;
- }
- result.search = relative.search;
- result.query = relative.query;
- result.host = relative.host || '';
- result.auth = relative.auth;
- result.hostname = relative.hostname || relative.host;
- result.port = relative.port; // to support http.request
- if (result.pathname || result.search) {
- var p = result.pathname || '';
- var s = result.search || '';
- result.path = p + s;
- }
- result.slashes = result.slashes || relative.slashes;
- result.href = result.format();
- return result;
- }
- var isSourceAbs = result.pathname && result.pathname.charAt(0) === '/',
- isRelAbs = relative.host || relative.pathname && relative.pathname.charAt(0) === '/',
- mustEndAbs = isRelAbs || isSourceAbs || result.host && relative.pathname,
- removeAllDots = mustEndAbs,
- srcPath = result.pathname && result.pathname.split('/') || [],
- relPath = relative.pathname && relative.pathname.split('/') || [],
- psychotic = result.protocol && !slashedProtocol[result.protocol]; // if the url is a non-slashed url, then relative
- // links like ../.. should be able
- // to crawl up to the hostname, as well. This is strange.
- // result.protocol has already been set by now.
- // Later on, put the first path part into the host field.
- if (psychotic) {
- result.hostname = '';
- result.port = null;
- if (result.host) {
- if (srcPath[0] === '') srcPath[0] = result.host;else srcPath.unshift(result.host);
- }
- result.host = '';
- if (relative.protocol) {
- relative.hostname = null;
- relative.port = null;
- if (relative.host) {
- if (relPath[0] === '') relPath[0] = relative.host;else relPath.unshift(relative.host);
- }
- relative.host = null;
- }
- mustEndAbs = mustEndAbs && (relPath[0] === '' || srcPath[0] === '');
- }
- if (isRelAbs) {
- // it's absolute.
- result.host = relative.host || relative.host === '' ? relative.host : result.host;
- result.hostname = relative.hostname || relative.hostname === '' ? relative.hostname : result.hostname;
- result.search = relative.search;
- result.query = relative.query;
- srcPath = relPath; // fall through to the dot-handling below.
- } else if (relPath.length) {
- // it's relative
- // throw away the existing file, and take the new path instead.
- if (!srcPath) srcPath = [];
- srcPath.pop();
- srcPath = srcPath.concat(relPath);
- result.search = relative.search;
- result.query = relative.query;
- } else if (!util.isNullOrUndefined(relative.search)) {
- // just pull out the search.
- // like href='?foo'.
- // Put this after the other two cases because it simplifies the booleans
- if (psychotic) {
- result.hostname = result.host = srcPath.shift(); //occationaly the auth can get stuck only in host
- //this especially happens in cases like
- //url.resolveObject('mailto:local1@domain1', 'local2@domain2')
- var authInHost = result.host && result.host.indexOf('@') > 0 ? result.host.split('@') : false;
- if (authInHost) {
- result.auth = authInHost.shift();
- result.host = result.hostname = authInHost.shift();
- }
- }
- result.search = relative.search;
- result.query = relative.query; //to support http.request
- if (!util.isNull(result.pathname) || !util.isNull(result.search)) {
- result.path = (result.pathname ? result.pathname : '') + (result.search ? result.search : '');
- }
- result.href = result.format();
- return result;
- }
- if (!srcPath.length) {
- // no path at all. easy.
- // we've already handled the other stuff above.
- result.pathname = null; //to support http.request
- if (result.search) {
- result.path = '/' + result.search;
- } else {
- result.path = null;
- }
- result.href = result.format();
- return result;
- } // if a url ENDs in . or .., then it must get a trailing slash.
- // however, if it ends in anything else non-slashy,
- // then it must NOT get a trailing slash.
- var last = srcPath.slice(-1)[0];
- var hasTrailingSlash = (result.host || relative.host || srcPath.length > 1) && (last === '.' || last === '..') || last === ''; // strip single dots, resolve double dots to parent dir
- // if the path tries to go above the root, `up` ends up > 0
- var up = 0;
- for (var i = srcPath.length; i >= 0; i--) {
- last = srcPath[i];
- if (last === '.') {
- srcPath.splice(i, 1);
- } else if (last === '..') {
- srcPath.splice(i, 1);
- up++;
- } else if (up) {
- srcPath.splice(i, 1);
- up--;
- }
- } // if the path is allowed to go above the root, restore leading ..s
- if (!mustEndAbs && !removeAllDots) {
- for (; up--; up) {
- srcPath.unshift('..');
- }
- }
- if (mustEndAbs && srcPath[0] !== '' && (!srcPath[0] || srcPath[0].charAt(0) !== '/')) {
- srcPath.unshift('');
- }
- if (hasTrailingSlash && srcPath.join('/').substr(-1) !== '/') {
- srcPath.push('');
- }
- var isAbsolute = srcPath[0] === '' || srcPath[0] && srcPath[0].charAt(0) === '/'; // put the host back
- if (psychotic) {
- result.hostname = result.host = isAbsolute ? '' : srcPath.length ? srcPath.shift() : ''; //occationaly the auth can get stuck only in host
- //this especially happens in cases like
- //url.resolveObject('mailto:local1@domain1', 'local2@domain2')
- var authInHost = result.host && result.host.indexOf('@') > 0 ? result.host.split('@') : false;
- if (authInHost) {
- result.auth = authInHost.shift();
- result.host = result.hostname = authInHost.shift();
- }
- }
- mustEndAbs = mustEndAbs || result.host && srcPath.length;
- if (mustEndAbs && !isAbsolute) {
- srcPath.unshift('');
- }
- if (!srcPath.length) {
- result.pathname = null;
- result.path = null;
- } else {
- result.pathname = srcPath.join('/');
- } //to support request.http
- if (!util.isNull(result.pathname) || !util.isNull(result.search)) {
- result.path = (result.pathname ? result.pathname : '') + (result.search ? result.search : '');
- }
- result.auth = relative.auth || result.auth;
- result.slashes = result.slashes || relative.slashes;
- result.href = result.format();
- return result;
- };
- Url.prototype.parseHost = function () {
- var host = this.host;
- var port = portPattern.exec(host);
- if (port) {
- port = port[0];
- if (port !== ':') {
- this.port = port.substr(1);
- }
- host = host.substr(0, host.length - port.length);
- }
- if (host) this.hostname = host;
- };
- },{"./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){
- 'use strict';
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
- var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
- module.exports = {
- isString: function isString(arg) {
- return typeof arg === 'string';
- },
- isObject: function isObject(arg) {
- return (0, _typeof2.default)(arg) === 'object' && arg !== null;
- },
- isNull: function isNull(arg) {
- return arg === null;
- },
- isNullOrUndefined: function isNullOrUndefined(arg) {
- return arg == null;
- }
- };
- },{"@babel/runtime/helpers/interopRequireDefault":74,"@babel/runtime/helpers/typeof":75}],406:[function(require,module,exports){
- "use strict";
- require("core-js/modules/es.number.constructor.js");
- // copy from https://github.com/node-modules/utility for browser
- exports.encodeURIComponent = function (text) {
- try {
- return encodeURIComponent(text);
- } catch (e) {
- return text;
- }
- };
- exports.escape = require('escape-html');
- exports.timestamp = function timestamp(t) {
- if (t) {
- var v = t;
- if (typeof v === 'string') {
- v = Number(v);
- }
- if (String(t).length === 10) {
- v *= 1000;
- }
- return new Date(v);
- }
- return Math.round(Date.now() / 1000);
- };
- },{"core-js/modules/es.number.constructor.js":254,"escape-html":300}],407:[function(require,module,exports){
- (function (process,Buffer){(function (){
- 'use strict';
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
- var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
- require("core-js/modules/es.string.trim.js");
- require("core-js/modules/es.regexp.exec.js");
- require("core-js/modules/es.string.split.js");
- require("core-js/modules/es.object.to-string.js");
- require("core-js/modules/es.promise.js");
- require("core-js/modules/es.function.name.js");
- require("core-js/modules/es.array.concat.js");
- var util = require('util');
- var urlutil = require('url');
- var http = require('http');
- var https = require('https');
- var debug = require('debug')('urllib');
- var ms = require('humanize-ms');
- var REQUEST_ID = 0;
- var MAX_VALUE = Math.pow(2, 31) - 10;
- var PROTO_RE = /^https?:\/\//i;
- function getAgent(agent, defaultAgent) {
- return agent === undefined ? defaultAgent : agent;
- }
- function parseContentType(str) {
- if (!str) {
- return '';
- }
- return str.split(';')[0].trim().toLowerCase();
- }
- function makeCallback(resolve, reject) {
- return function (err, data, res) {
- if (err) {
- return reject(err);
- }
- resolve({
- data: data,
- status: res.statusCode,
- headers: res.headers,
- res: res
- });
- };
- } // exports.TIMEOUT = ms('5s');
- exports.TIMEOUTS = [ms('300s'), ms('300s')];
- var TEXT_DATA_TYPES = ['json', 'text'];
- exports.request = function request(url, args, callback) {
- // request(url, callback)
- if (arguments.length === 2 && typeof args === 'function') {
- callback = args;
- args = null;
- }
- if (typeof callback === 'function') {
- return exports.requestWithCallback(url, args, callback);
- }
- return new Promise(function (resolve, reject) {
- exports.requestWithCallback(url, args, makeCallback(resolve, reject));
- });
- };
- exports.requestWithCallback = function requestWithCallback(url, args, callback) {
- if (!url || typeof url !== 'string' && (0, _typeof2.default)(url) !== 'object') {
- var msg = util.format('expect request url to be a string or a http request options, but got' + ' %j', url);
- throw new Error(msg);
- }
- if (arguments.length === 2 && typeof args === 'function') {
- callback = args;
- args = null;
- }
- args = args || {};
- if (REQUEST_ID >= MAX_VALUE) {
- REQUEST_ID = 0;
- }
- var reqId = ++REQUEST_ID;
- args.requestUrls = args.requestUrls || [];
- var reqMeta = {
- requestId: reqId,
- url: url,
- args: args,
- ctx: args.ctx
- };
- if (args.emitter) {
- args.emitter.emit('request', reqMeta);
- }
- args.timeout = args.timeout || exports.TIMEOUTS;
- args.maxRedirects = args.maxRedirects || 10;
- args.streaming = args.streaming || args.customResponse;
- var requestStartTime = Date.now();
- var parsedUrl;
- if (typeof url === 'string') {
- if (!PROTO_RE.test(url)) {
- // Support `request('www.server.com')`
- url = 'https://' + url;
- }
- parsedUrl = urlutil.parse(url);
- } else {
- parsedUrl = url;
- }
- var method = (args.type || args.method || parsedUrl.method || 'GET').toUpperCase();
- var port = parsedUrl.port || 80;
- var httplib = http;
- var agent = getAgent(args.agent, exports.agent);
- var fixJSONCtlChars = args.fixJSONCtlChars;
- if (parsedUrl.protocol === 'https:') {
- httplib = https;
- agent = getAgent(args.httpsAgent, exports.httpsAgent);
- if (!parsedUrl.port) {
- port = 443;
- }
- } // request through proxy tunnel
- // var proxyTunnelAgent = detectProxyAgent(parsedUrl, args);
- // if (proxyTunnelAgent) {
- // agent = proxyTunnelAgent;
- // }
- var options = {
- host: parsedUrl.hostname || parsedUrl.host || 'localhost',
- path: parsedUrl.path || '/',
- method: method,
- port: port,
- agent: agent,
- headers: args.headers || {},
- // default is dns.lookup
- // https://github.com/nodejs/node/blob/master/lib/net.js#L986
- // custom dnslookup require node >= 4.0.0
- // https://github.com/nodejs/node/blob/archived-io.js-v0.12/lib/net.js#L952
- lookup: args.lookup
- };
- if (Array.isArray(args.timeout)) {
- options.requestTimeout = args.timeout[args.timeout.length - 1];
- } else if (typeof args.timeout !== 'undefined') {
- options.requestTimeout = args.timeout;
- } // const sslNames = [
- // 'pfx',
- // 'key',
- // 'passphrase',
- // 'cert',
- // 'ca',
- // 'ciphers',
- // 'rejectUnauthorized',
- // 'secureProtocol',
- // 'secureOptions',
- // ];
- // for (let i = 0; i < sslNames.length; i++) {
- // const name = sslNames[i];
- // if (args.hasOwnProperty(name)) {
- // options[name] = args[name];
- // }
- // }
- // don't check ssl
- // if (options.rejectUnauthorized === false && !options.hasOwnProperty('secureOptions')) {
- // options.secureOptions = require('constants').SSL_OP_NO_TLSv1_2;
- // }
- var auth = args.auth || parsedUrl.auth;
- if (auth) {
- options.auth = auth;
- } // content undefined data 有值
- var body = args.content || args.data;
- var dataAsQueryString = method === 'GET' || method === 'HEAD' || args.dataAsQueryString;
- if (!args.content) {
- if (body && !(typeof body === 'string' || Buffer.isBuffer(body))) {
- if (dataAsQueryString) {
- // read: GET, HEAD, use query string
- body = args.nestedQuerystring ? qs.stringify(body) : querystring.stringify(body);
- } else {
- var contentType = options.headers['Content-Type'] || options.headers['content-type']; // auto add application/x-www-form-urlencoded when using urlencode form request
- if (!contentType) {
- if (args.contentType === 'json') {
- contentType = 'application/json';
- } else {
- contentType = 'application/x-www-form-urlencoded';
- }
- options.headers['Content-Type'] = contentType;
- }
- if (parseContentType(contentType) === 'application/json') {
- body = JSON.stringify(body);
- } else {
- // 'application/x-www-form-urlencoded'
- body = args.nestedQuerystring ? qs.stringify(body) : querystring.stringify(body);
- }
- }
- }
- } // if it's a GET or HEAD request, data should be sent as query string
- if (dataAsQueryString && body) {
- options.path += (parsedUrl.query ? '&' : '?') + body;
- body = null;
- }
- var requestSize = 0;
- if (body) {
- var length = body.length;
- if (!Buffer.isBuffer(body)) {
- length = Buffer.byteLength(body);
- }
- requestSize = options.headers['Content-Length'] = length;
- }
- if (args.dataType === 'json') {
- options.headers.Accept = 'application/json';
- }
- if (typeof args.beforeRequest === 'function') {
- // you can use this hook to change every thing.
- args.beforeRequest(options);
- }
- var connectTimer = null;
- var responseTimer = null;
- var __err = null;
- var connected = false; // socket connected or not
- var keepAliveSocket = false; // request with keepalive socket
- var responseSize = 0;
- var statusCode = -1;
- var responseAborted = false;
- var remoteAddress = '';
- var remotePort = '';
- var timing = null;
- if (args.timing) {
- timing = {
- // socket assigned
- queuing: 0,
- // dns lookup time
- dnslookup: 0,
- // socket connected
- connected: 0,
- // request sent
- requestSent: 0,
- // Time to first byte (TTFB)
- waiting: 0,
- contentDownload: 0
- };
- }
- function cancelConnectTimer() {
- if (connectTimer) {
- clearTimeout(connectTimer);
- connectTimer = null;
- }
- }
- function cancelResponseTimer() {
- if (responseTimer) {
- clearTimeout(responseTimer);
- responseTimer = null;
- }
- }
- function done(err, data, res) {
- cancelResponseTimer();
- if (!callback) {
- 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
- if (err) {
- console.warn('[urllib:warn] [%s] [%s] [worker:%s] %s: %s\nstack: %s', Date(), reqId, process.pid, err.name, err.message, err.stack);
- }
- return;
- }
- var cb = callback;
- callback = null;
- var headers = {};
- if (res) {
- statusCode = res.statusCode;
- headers = res.headers;
- } // handle digest auth
- // if (statusCode === 401 && headers['www-authenticate']
- // && (!args.headers || !args.headers.Authorization) && args.digestAuth) {
- // const authenticate = headers['www-authenticate'];
- // if (authenticate.indexOf('Digest ') >= 0) {
- // debug('Request#%d %s: got digest auth header WWW-Authenticate: %s', reqId, url, authenticate);
- // args.headers = args.headers || {};
- // args.headers.Authorization = digestAuthHeader(options.method, options.path, authenticate, args.digestAuth);
- // debug('Request#%d %s: auth with digest header: %s', reqId, url, args.headers.Authorization);
- // if (res.headers['set-cookie']) {
- // args.headers.Cookie = res.headers['set-cookie'].join(';');
- // }
- // return exports.requestWithCallback(url, args, cb);
- // }
- // }
- var requestUseTime = Date.now() - requestStartTime;
- if (timing) {
- timing.contentDownload = requestUseTime;
- }
- 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);
- var response = {
- status: statusCode,
- statusCode: statusCode,
- headers: headers,
- size: responseSize,
- aborted: responseAborted,
- rt: requestUseTime,
- keepAliveSocket: keepAliveSocket,
- data: data,
- requestUrls: args.requestUrls,
- timing: timing,
- remoteAddress: remoteAddress,
- remotePort: remotePort
- };
- if (err) {
- var agentStatus = '';
- if (agent && typeof agent.getCurrentStatus === 'function') {
- // add current agent status to error message for logging and debug
- agentStatus = ', agent status: ' + JSON.stringify(agent.getCurrentStatus());
- }
- err.message += ', ' + options.method + ' ' + url + ' ' + statusCode + ' (connected: ' + connected + ', keepalive socket: ' + keepAliveSocket + agentStatus + ')' + '\nheaders: ' + JSON.stringify(headers);
- err.data = data;
- err.path = options.path;
- err.status = statusCode;
- err.headers = headers;
- err.res = response;
- }
- cb(err, data, args.streaming ? res : response);
- if (args.emitter) {
- // keep to use the same reqMeta object on request event before
- reqMeta.url = url;
- reqMeta.socket = req && req.connection;
- reqMeta.options = options;
- reqMeta.size = requestSize;
- args.emitter.emit('response', {
- requestId: reqId,
- error: err,
- ctx: args.ctx,
- req: reqMeta,
- res: response
- });
- }
- }
- function handleRedirect(res) {
- var err = null;
- if (args.followRedirect && statuses.redirect[res.statusCode]) {
- // handle redirect
- args._followRedirectCount = (args._followRedirectCount || 0) + 1;
- var location = res.headers.location;
- if (!location) {
- err = new Error('Got statusCode ' + res.statusCode + ' but cannot resolve next location from headers');
- err.name = 'FollowRedirectError';
- } else if (args._followRedirectCount > args.maxRedirects) {
- err = new Error('Exceeded maxRedirects. Probably stuck in a redirect loop ' + url);
- err.name = 'MaxRedirectError';
- } else {
- var newUrl = args.formatRedirectUrl ? args.formatRedirectUrl(url, location) : urlutil.resolve(url, location);
- debug('Request#%d %s: `redirected` from %s to %s', reqId, options.path, url, newUrl); // make sure timer stop
- cancelResponseTimer(); // should clean up headers.Host on `location: http://other-domain/url`
- if (args.headers && args.headers.Host && PROTO_RE.test(location)) {
- args.headers.Host = null;
- } // avoid done will be execute in the future change.
- var cb = callback;
- callback = null;
- exports.requestWithCallback(newUrl, args, cb);
- return {
- redirect: true,
- error: null
- };
- }
- }
- return {
- redirect: false,
- error: err
- };
- }
- if (args.gzip) {
- if (!options.headers['Accept-Encoding'] && !options.headers['accept-encoding']) {
- options.headers['Accept-Encoding'] = 'gzip';
- }
- }
- function decodeContent(res, body, cb) {
- var encoding = res.headers['content-encoding']; // if (body.length === 0) {
- // return cb(null, body, encoding);
- // }
- // if (!encoding || encoding.toLowerCase() !== 'gzip') {
- return cb(null, body, encoding); // }
- // debug('gunzip %d length body', body.length);
- // zlib.gunzip(body, cb);
- }
- var writeStream = args.writeStream;
- debug('Request#%d %s %s with headers %j, options.path: %s', reqId, method, url, options.headers, options.path);
- args.requestUrls.push(url);
- function onResponse(res) {
- if (timing) {
- timing.waiting = Date.now() - requestStartTime;
- }
- debug('Request#%d %s `req response` event emit: status %d, headers: %j', reqId, url, res.statusCode, res.headers);
- if (args.streaming) {
- var result = handleRedirect(res);
- if (result.redirect) {
- res.resume();
- return;
- }
- if (result.error) {
- res.resume();
- return done(result.error, null, res);
- }
- return done(null, null, res);
- }
- res.on('close', function () {
- debug('Request#%d %s: `res close` event emit, total size %d', reqId, url, responseSize);
- });
- res.on('error', function () {
- debug('Request#%d %s: `res error` event emit, total size %d', reqId, url, responseSize);
- });
- res.on('aborted', function () {
- responseAborted = true;
- debug('Request#%d %s: `res aborted` event emit, total size %d', reqId, url, responseSize);
- });
- if (writeStream) {
- // If there's a writable stream to recieve the response data, just pipe the
- // response stream to that writable stream and call the callback when it has
- // finished writing.
- //
- // NOTE that when the response stream `res` emits an 'end' event it just
- // means that it has finished piping data to another stream. In the
- // meanwhile that writable stream may still writing data to the disk until
- // it emits a 'close' event.
- //
- // That means that we should not apply callback until the 'close' of the
- // writable stream is emited.
- //
- // See also:
- // - https://github.com/TBEDP/urllib/commit/959ac3365821e0e028c231a5e8efca6af410eabb
- // - http://nodejs.org/api/stream.html#stream_event_end
- // - http://nodejs.org/api/stream.html#stream_event_close_1
- var _result = handleRedirect(res);
- if (_result.redirect) {
- res.resume();
- return;
- }
- if (_result.error) {
- res.resume(); // end ths stream first
- writeStream.end();
- return done(_result.error, null, res);
- } // you can set consumeWriteStream false that only wait response end
- if (args.consumeWriteStream === false) {
- res.on('end', done.bind(null, null, null, res));
- } else {
- // node 0.10, 0.12: only emit res aborted, writeStream close not fired
- // if (isNode010 || isNode012) {
- // first([
- // [ writeStream, 'close' ],
- // [ res, 'aborted' ],
- // ], function(_, stream, event) {
- // debug('Request#%d %s: writeStream or res %s event emitted', reqId, url, event);
- // done(__err || null, null, res);
- // });
- if (false) {} else {
- writeStream.on('close', function () {
- debug('Request#%d %s: writeStream close event emitted', reqId, url);
- done(__err || null, null, res);
- });
- }
- }
- return res.pipe(writeStream);
- } // Otherwise, just concat those buffers.
- //
- // NOTE that the `chunk` is not a String but a Buffer. It means that if
- // you simply concat two chunk with `+` you're actually converting both
- // Buffers into Strings before concating them. It'll cause problems when
- // dealing with multi-byte characters.
- //
- // The solution is to store each chunk in an array and concat them with
- // 'buffer-concat' when all chunks is recieved.
- //
- // See also:
- // http://cnodejs.org/topic/4faf65852e8fb5bc65113403
- var chunks = [];
- res.on('data', function (chunk) {
- debug('Request#%d %s: `res data` event emit, size %d', reqId, url, chunk.length);
- responseSize += chunk.length;
- chunks.push(chunk);
- });
- res.on('end', function () {
- var body = Buffer.concat(chunks, responseSize);
- debug('Request#%d %s: `res end` event emit, total size %d, _dumped: %s', reqId, url, responseSize, res._dumped);
- if (__err) {
- // req.abort() after `res data` event emit.
- return done(__err, body, res);
- }
- var result = handleRedirect(res);
- if (result.error) {
- return done(result.error, body, res);
- }
- if (result.redirect) {
- return;
- }
- decodeContent(res, body, function (err, data, encoding) {
- if (err) {
- return done(err, body, res);
- } // if body not decode, dont touch it
- if (!encoding && TEXT_DATA_TYPES.indexOf(args.dataType) >= 0) {
- // try to decode charset
- try {
- data = decodeBodyByCharset(data, res);
- } catch (e) {
- debug('decodeBodyByCharset error: %s', e); // if error, dont touch it
- return done(null, data, res);
- }
- if (args.dataType === 'json') {
- if (responseSize === 0) {
- data = null;
- } else {
- var r = parseJSON(data, fixJSONCtlChars);
- if (r.error) {
- err = r.error;
- } else {
- data = r.data;
- }
- }
- }
- }
- if (responseAborted) {
- // err = new Error('Remote socket was terminated before `response.end()` was called');
- // err.name = 'RemoteSocketClosedError';
- debug('Request#%d %s: Remote socket was terminated before `response.end()` was called', reqId, url);
- }
- done(err, data, res);
- });
- });
- }
- var connectTimeout, responseTimeout;
- if (Array.isArray(args.timeout)) {
- connectTimeout = ms(args.timeout[0]);
- responseTimeout = ms(args.timeout[1]);
- } else {
- // set both timeout equal
- connectTimeout = responseTimeout = ms(args.timeout);
- }
- debug('ConnectTimeout: %d, ResponseTimeout: %d', connectTimeout, responseTimeout);
- function startConnectTimer() {
- debug('Connect timer ticking, timeout: %d', connectTimeout);
- connectTimer = setTimeout(function () {
- connectTimer = null;
- if (statusCode === -1) {
- statusCode = -2;
- }
- var msg = 'Connect timeout for ' + connectTimeout + 'ms';
- var errorName = 'ConnectionTimeoutError';
- if (!req.socket) {
- errorName = 'SocketAssignTimeoutError';
- msg += ', working sockets is full';
- }
- __err = new Error(msg);
- __err.name = errorName;
- __err.requestId = reqId;
- debug('ConnectTimeout: Request#%d %s %s: %s, connected: %s', reqId, url, __err.name, msg, connected);
- abortRequest();
- }, connectTimeout);
- }
- function startResposneTimer() {
- debug('Response timer ticking, timeout: %d', responseTimeout);
- responseTimer = setTimeout(function () {
- responseTimer = null;
- var msg = 'Response timeout for ' + responseTimeout + 'ms';
- var errorName = 'ResponseTimeoutError';
- __err = new Error(msg);
- __err.name = errorName;
- __err.requestId = reqId;
- debug('ResponseTimeout: Request#%d %s %s: %s, connected: %s', reqId, url, __err.name, msg, connected);
- abortRequest();
- }, responseTimeout);
- }
- var req; // request headers checker will throw error
- options.mode = args.mode ? args.mode : '';
- try {
- req = httplib.request(options, onResponse);
- } catch (err) {
- return done(err);
- } // environment detection: browser or nodejs
- if (typeof window === 'undefined') {
- // start connect timer just after `request` return, and just in nodejs environment
- startConnectTimer();
- } else {
- req.on('requestTimeout', function () {
- if (statusCode === -1) {
- statusCode = -2;
- }
- var msg = 'Connect timeout for ' + connectTimeout + 'ms';
- var errorName = 'ConnectionTimeoutError';
- __err = new Error(msg);
- __err.name = errorName;
- __err.requestId = reqId;
- abortRequest();
- });
- }
- function abortRequest() {
- debug('Request#%d %s abort, connected: %s', reqId, url, connected); // it wont case error event when req haven't been assigned a socket yet.
- if (!req.socket) {
- __err.noSocket = true;
- done(__err);
- }
- req.abort();
- }
- if (timing) {
- // request sent
- req.on('finish', function () {
- timing.requestSent = Date.now() - requestStartTime;
- });
- }
- req.once('socket', function (socket) {
- if (timing) {
- // socket queuing time
- timing.queuing = Date.now() - requestStartTime;
- } // https://github.com/nodejs/node/blob/master/lib/net.js#L377
- // https://github.com/nodejs/node/blob/v0.10.40-release/lib/net.js#L352
- // should use socket.socket on 0.10.x
- // if (isNode010 && socket.socket) {
- // socket = socket.socket;
- // }
- var readyState = socket.readyState;
- if (readyState === 'opening') {
- socket.once('lookup', function (err, ip, addressType) {
- debug('Request#%d %s lookup: %s, %s, %s', reqId, url, err, ip, addressType);
- if (timing) {
- timing.dnslookup = Date.now() - requestStartTime;
- }
- if (ip) {
- remoteAddress = ip;
- }
- });
- socket.once('connect', function () {
- if (timing) {
- // socket connected
- timing.connected = Date.now() - requestStartTime;
- } // cancel socket timer at first and start tick for TTFB
- cancelConnectTimer();
- startResposneTimer();
- debug('Request#%d %s new socket connected', reqId, url);
- connected = true;
- if (!remoteAddress) {
- remoteAddress = socket.remoteAddress;
- }
- remotePort = socket.remotePort;
- });
- return;
- }
- debug('Request#%d %s reuse socket connected, readyState: %s', reqId, url, readyState);
- connected = true;
- keepAliveSocket = true;
- if (!remoteAddress) {
- remoteAddress = socket.remoteAddress;
- }
- remotePort = socket.remotePort; // reuse socket, timer should be canceled.
- cancelConnectTimer();
- startResposneTimer();
- });
- req.on('error', function (err) {
- //TypeError for browser fetch api, Error for browser xmlhttprequest api
- if (err.name === 'Error' || err.name === 'TypeError') {
- err.name = connected ? 'ResponseError' : 'RequestError';
- }
- err.message += ' (req "error")';
- debug('Request#%d %s `req error` event emit, %s: %s', reqId, url, err.name, err.message);
- done(__err || err);
- });
- if (writeStream) {
- writeStream.once('error', function (err) {
- err.message += ' (writeStream "error")';
- __err = err;
- debug('Request#%d %s `writeStream error` event emit, %s: %s', reqId, url, err.name, err.message);
- abortRequest();
- });
- }
- if (args.stream) {
- args.stream.pipe(req);
- args.stream.once('error', function (err) {
- err.message += ' (stream "error")';
- __err = err;
- debug('Request#%d %s `readStream error` event emit, %s: %s', reqId, url, err.name, err.message);
- abortRequest();
- });
- } else {
- req.end(body);
- }
- req.requestId = reqId;
- return req;
- };
- }).call(this)}).call(this,require('_process'),require("buffer").Buffer)
- },{"@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)
- });
|